libdragon
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1
9#ifndef __LIBDRAGON_INTERRUPT_H
10#define __LIBDRAGON_INTERRUPT_H
11
12#include <stdint.h>
13
48#ifdef __cplusplus
49extern "C" {
50#endif
51
64
73void register_AI_handler( void (*callback)() );
74
81void register_VI_handler( void (*callback)() );
82
89void register_PI_handler( void (*callback)() );
90
97void register_DP_handler( void (*callback)() );
98
105void register_SI_handler( void (*callback)() );
106
113void register_SP_handler( void (*callback)() );
114
133void register_TI_handler( void (*callback)() );
134
152void register_CART_handler( void (*callback)() );
153
182void register_RESET_handler( void (*callback)() );
183
190void register_BB_FLASH_handler( void (*callback)() );
191
198void register_BB_AES_handler( void (*callback)() );
199
206void register_BB_IDE_handler( void (*callback)() );
207
214void register_BB_PI_ERR_handler( void (*callback)() );
215
222void register_BB_USB0_handler( void (*callback)() );
223
230void register_BB_USB1_handler( void (*callback)() );
231
238void register_BB_BTN_handler( void (*callback)() );
239
246void register_BB_MD_handler( void (*callback)() );
247
254void unregister_AI_handler( void (*callback)() );
255
262void unregister_VI_handler( void (*callback)() );
263
270void unregister_PI_handler( void (*callback)() );
271
278void unregister_DP_handler( void (*callback)() );
279
286void unregister_SI_handler( void (*callback)() );
287
294void unregister_SP_handler( void (*callback)() );
295
306void unregister_TI_handler( void (*callback)() );
307
314void unregister_CART_handler( void (*callback)() );
315
322void unregister_RESET_handler( void (*callback)() );
323
330void unregister_BB_FLASH_handler( void (*callback)() );
331
338void unregister_BB_AES_handler( void (*callback)() );
339
346void unregister_BB_IDE_handler( void (*callback)() );
347
354void unregister_BB_PI_ERR_handler( void (*callback)() );
355
362void unregister_BB_USB0_handler( void (*callback)() );
363
370void unregister_BB_USB1_handler( void (*callback)() );
371
378void unregister_BB_BTN_handler( void (*callback)() );
379
386void unregister_BB_MD_handler( void (*callback)() );
387
394void set_AI_interrupt( int active );
395
423void set_VI_interrupt( int active, unsigned long line );
424
431void set_PI_interrupt( int active );
432
439void set_DP_interrupt( int active );
440
447void set_SI_interrupt( int active );
448
455void set_SP_interrupt( int active );
456
469void set_TI_interrupt( int active );
470
479void set_CART_interrupt( int active );
480
491void set_RESET_interrupt( int active );
492
499void set_BB_FLASH_interrupt( int active );
500
507void set_BB_AES_interrupt( int active );
508
515void set_BB_IDE_interrupt( int active );
516
523void set_BB_PI_ERR_interrupt( int active );
524
531void set_BB_USB0_interrupt( int active );
532
539void set_BB_USB1_interrupt( int active );
540
547void set_BB_BTN_interrupt( int active );
548
555void set_BB_MD_interrupt( int active );
556
569#define RESET_TIME_LENGTH TICKS_FROM_MS(200)
570
571
600uint32_t exception_reset_time( void );
601
602static inline __attribute__((deprecated("calling init_interrupts no longer required")))
603void init_interrupts() {}
604
605static inline __attribute__((deprecated("use register_RESET_handler instead")))
606void register_reset_handler( void (*callback)() )
607{
608 register_RESET_handler(callback);
609}
610
611
619void enable_interrupts();
620
627void disable_interrupts();
628
629
638
639#ifdef __cplusplus
640}
641#endif
642
643#endif
interrupt_state_t
State of interrupts on the system.
Definition interrupt.h:56
@ INTERRUPTS_DISABLED
Interrupts are currently disabled.
Definition interrupt.h:60
@ INTERRUPTS_ENABLED
Interrupts are currently enabled.
Definition interrupt.h:62
@ INTERRUPTS_UNINITIALIZED
Interrupt controller has not been initialized.
Definition interrupt.h:58
void unregister_AI_handler(void(*callback)())
Unregister an AI callback.
Definition interrupt.c:403
void unregister_SI_handler(void(*callback)())
Unegister a SI callback.
Definition interrupt.c:443
void register_CART_handler(void(*callback)())
Register a CART interrupt callback.
Definition interrupt.c:469
void enable_interrupts()
Enable interrupts systemwide.
Definition interrupt.c:751
void unregister_TI_handler(void(*callback)())
Unregister a timer callback.
Definition interrupt.c:464
void register_AI_handler(void(*callback)())
Register an AI callback.
Definition interrupt.c:398
void set_SP_interrupt(int active)
Enable or disable the SP interrupt.
Definition interrupt.c:618
void set_BB_MD_interrupt(int active)
Enable or disable the BBPlayer MD interrupt.
Definition interrupt.c:694
void set_SI_interrupt(int active)
Enable or disable the SI interrupt.
Definition interrupt.c:613
uint32_t exception_reset_time(void)
Check whether the RESET button was pressed and how long we are into the reset process.
Definition interrupt.c:791
void unregister_RESET_handler(void(*callback)())
Unregister a RESET interrupt callback.
Definition interrupt.c:492
void register_BB_USB1_handler(void(*callback)())
Register a BBPlayer USB1 callback.
Definition interrupt.c:555
void register_PI_handler(void(*callback)())
Register a PI callback.
Definition interrupt.c:418
void unregister_BB_USB1_handler(void(*callback)())
Unregister a BBPlayer USB1 interrupt callback.
Definition interrupt.c:560
void register_BB_IDE_handler(void(*callback)())
Register a BBPlayer IDE callback.
Definition interrupt.c:525
void unregister_VI_handler(void(*callback)())
Unregister a VI callback.
Definition interrupt.c:413
void register_BB_USB0_handler(void(*callback)())
Register a BBPlayer USB0 callback.
Definition interrupt.c:545
void set_BB_USB0_interrupt(int active)
Enable or disable the BBPlayer USB0 interrupt.
Definition interrupt.c:679
void disable_interrupts()
Disable interrupts systemwide.
Definition interrupt.c:726
void unregister_DP_handler(void(*callback)())
Unregister a DP callback.
Definition interrupt.c:433
void register_BB_PI_ERR_handler(void(*callback)())
Register a BBPlayer PI Error callback.
Definition interrupt.c:535
void set_TI_interrupt(int active)
Enable or disable the timer interrupt.
Definition interrupt.c:623
void set_PI_interrupt(int active)
Enable or disable the PI interrupt.
Definition interrupt.c:603
void unregister_PI_handler(void(*callback)())
Unegister a PI callback.
Definition interrupt.c:423
void unregister_CART_handler(void(*callback)())
Unregister a CART interrupt callback.
Definition interrupt.c:474
void set_BB_AES_interrupt(int active)
Enable or disable the BBPlayer AES interrupt.
Definition interrupt.c:664
void unregister_BB_BTN_handler(void(*callback)())
Unregister a BBPlayer BTN interrupt callback.
Definition interrupt.c:570
void set_AI_interrupt(int active)
Enable or disable the AI interrupt.
Definition interrupt.c:585
void register_BB_MD_handler(void(*callback)())
Register a BBPlayer MD callback.
Definition interrupt.c:575
void register_BB_AES_handler(void(*callback)())
Register a BBPlayer AES callback.
Definition interrupt.c:515
void register_BB_FLASH_handler(void(*callback)())
Register a BBPlayer FLASH callback.
Definition interrupt.c:505
void register_TI_handler(void(*callback)())
Register a timer callback.
Definition interrupt.c:459
void unregister_BB_MD_handler(void(*callback)())
Unregister a BBPlayer MD interrupt callback.
Definition interrupt.c:580
void unregister_BB_USB0_handler(void(*callback)())
Unregister a BBPlayer USB0 interrupt callback.
Definition interrupt.c:550
void set_BB_IDE_interrupt(int active)
Enable or disable the BBPlayer IDE interrupt.
Definition interrupt.c:669
void register_RESET_handler(void(*callback)())
Register a handler that will be called when the user presses the RESET button.
Definition interrupt.c:479
void set_BB_USB1_interrupt(int active)
Enable or disable the BBPlayer USB1 interrupt.
Definition interrupt.c:684
void set_BB_FLASH_interrupt(int active)
Enable or disable the BBPlayer FLASH interrupt.
Definition interrupt.c:659
void register_VI_handler(void(*callback)())
Register a VI callback.
Definition interrupt.c:408
void set_BB_BTN_interrupt(int active)
Enable or disable the BBPlayer BTN interrupt.
Definition interrupt.c:689
void register_BB_BTN_handler(void(*callback)())
Register a BBPlayer BTN callback.
Definition interrupt.c:565
void set_CART_interrupt(int active)
Enable or disable the CART interrupt.
Definition interrupt.c:635
void unregister_BB_FLASH_handler(void(*callback)())
Unregister a BBPlayer FLASH interrupt callback.
Definition interrupt.c:510
void unregister_BB_IDE_handler(void(*callback)())
Unregister a BBPlayer IDE interrupt callback.
Definition interrupt.c:530
void set_BB_PI_ERR_interrupt(int active)
Enable or disable the BBPlayer PI Error interrupt.
Definition interrupt.c:674
void set_DP_interrupt(int active)
Enable or disable the DP interrupt.
Definition interrupt.c:608
void unregister_SP_handler(void(*callback)())
Unegister a SP callback.
Definition interrupt.c:453
void unregister_BB_PI_ERR_handler(void(*callback)())
Unregister a BBPlayer PI Error interrupt callback.
Definition interrupt.c:540
void set_RESET_interrupt(int active)
Enable the RESET interrupt.
Definition interrupt.c:647
void register_SI_handler(void(*callback)())
Register a SI callback.
Definition interrupt.c:438
void unregister_BB_AES_handler(void(*callback)())
Unregister a BBPlayer AES interrupt callback.
Definition interrupt.c:520
void register_SP_handler(void(*callback)())
Register a SP callback.
Definition interrupt.c:448
void register_DP_handler(void(*callback)())
Register a DP callback.
Definition interrupt.c:428
void set_VI_interrupt(int active, unsigned long line)
Enable or disable the VI interrupt.
Definition interrupt.c:590
interrupt_state_t get_interrupts_state()
Return the current state of interrupts.
Definition interrupt.c:774