libdragon
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_INTERRUPT_H
9#define __LIBDRAGON_INTERRUPT_H
10
11#include <stdint.h>
12
47#ifdef __cplusplus
48extern "C" {
49#endif
50
63
72void register_AI_handler( void (*callback)() );
73
80void register_VI_handler( void (*callback)() );
81
88void register_PI_handler( void (*callback)() );
89
96void register_DP_handler( void (*callback)() );
97
104void register_SI_handler( void (*callback)() );
105
112void register_SP_handler( void (*callback)() );
113
132void register_TI_handler( void (*callback)() );
133
151void register_CART_handler( void (*callback)() );
152
181void register_RESET_handler( void (*callback)() );
182
183
190void unregister_AI_handler( void (*callback)() );
191
198void unregister_VI_handler( void (*callback)() );
199
206void unregister_PI_handler( void (*callback)() );
207
214void unregister_DP_handler( void (*callback)() );
215
222void unregister_SI_handler( void (*callback)() );
223
230void unregister_SP_handler( void (*callback)() );
231
242void unregister_TI_handler( void (*callback)() );
243
250void unregister_CART_handler( void (*callback)() );
251
258void unregister_RESET_handler( void (*callback)() );
259
260
267void set_AI_interrupt( int active );
268
296void set_VI_interrupt( int active, unsigned long line );
297
304void set_PI_interrupt( int active );
305
312void set_DP_interrupt( int active );
313
320void set_SI_interrupt( int active );
321
328void set_SP_interrupt( int active );
329
342void set_TI_interrupt( int active );
343
352void set_CART_interrupt( int active );
353
364void set_RESET_interrupt( int active );
365
378#define RESET_TIME_LENGTH TICKS_FROM_MS(200)
379
380
409uint32_t exception_reset_time( void );
410
411static inline __attribute__((deprecated("calling init_interrupts no longer required")))
412void init_interrupts() {}
413
414static inline __attribute__((deprecated("use register_RESET_handler instead")))
415void register_reset_handler( void (*callback)() )
416{
417 register_RESET_handler(callback);
418}
419
420
428void enable_interrupts();
429
436void disable_interrupts();
437
438
447
448#ifdef __cplusplus
449}
450#endif
451
452#endif
interrupt_state_t
State of interrupts on the system.
Definition interrupt.h:55
@ INTERRUPTS_DISABLED
Interrupts are currently disabled.
Definition interrupt.h:59
@ INTERRUPTS_ENABLED
Interrupts are currently enabled.
Definition interrupt.h:61
@ INTERRUPTS_UNINITIALIZED
Interrupt controller has not been initialized.
Definition interrupt.h:57
void unregister_AI_handler(void(*callback)())
Unregister an AI callback.
Definition interrupt.c:298
void unregister_SI_handler(void(*callback)())
Unegister a SI callback.
Definition interrupt.c:338
void register_CART_handler(void(*callback)())
Register a CART interrupt callback.
Definition interrupt.c:364
void enable_interrupts()
Enable interrupts systemwide.
Definition interrupt.c:521
void unregister_TI_handler(void(*callback)())
Unregister a timer callback.
Definition interrupt.c:359
void register_AI_handler(void(*callback)())
Register an AI callback.
Definition interrupt.c:293
void set_SP_interrupt(int active)
Enable or disable the SP interrupt.
Definition interrupt.c:433
void set_SI_interrupt(int active)
Enable or disable the SI interrupt.
Definition interrupt.c:428
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:561
void unregister_RESET_handler(void(*callback)())
Unregister a RESET interrupt callback.
Definition interrupt.c:387
void register_PI_handler(void(*callback)())
Register a PI callback.
Definition interrupt.c:313
void unregister_VI_handler(void(*callback)())
Unregister a VI callback.
Definition interrupt.c:308
void disable_interrupts()
Disable interrupts systemwide.
Definition interrupt.c:496
void unregister_DP_handler(void(*callback)())
Unregister a DP callback.
Definition interrupt.c:328
void set_TI_interrupt(int active)
Enable or disable the timer interrupt.
Definition interrupt.c:438
void set_PI_interrupt(int active)
Enable or disable the PI interrupt.
Definition interrupt.c:418
void unregister_PI_handler(void(*callback)())
Unegister a PI callback.
Definition interrupt.c:318
void unregister_CART_handler(void(*callback)())
Unregister a CART interrupt callback.
Definition interrupt.c:369
void set_AI_interrupt(int active)
Enable or disable the AI interrupt.
Definition interrupt.c:400
void register_TI_handler(void(*callback)())
Register a timer callback.
Definition interrupt.c:354
void register_RESET_handler(void(*callback)())
Register a handler that will be called when the user presses the RESET button.
Definition interrupt.c:374
void register_VI_handler(void(*callback)())
Register a VI callback.
Definition interrupt.c:303
void set_CART_interrupt(int active)
Enable or disable the CART interrupt.
Definition interrupt.c:450
void set_DP_interrupt(int active)
Enable or disable the DP interrupt.
Definition interrupt.c:423
void unregister_SP_handler(void(*callback)())
Unegister a SP callback.
Definition interrupt.c:348
void set_RESET_interrupt(int active)
Enable the RESET interrupt.
Definition interrupt.c:462
void register_SI_handler(void(*callback)())
Register a SI callback.
Definition interrupt.c:333
void register_SP_handler(void(*callback)())
Register a SP callback.
Definition interrupt.c:343
void register_DP_handler(void(*callback)())
Register a DP callback.
Definition interrupt.c:323
void set_VI_interrupt(int active, unsigned long line)
Enable or disable the VI interrupt.
Definition interrupt.c:405
interrupt_state_t get_interrupts_state()
Return the current state of interrupts.
Definition interrupt.c:544