libdragon
Loading...
Searching...
No Matches
interrupt.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_INTERRUPT_H
7#define __LIBDRAGON_INTERRUPT_H
8
9#include <stdint.h>
10
45#ifdef __cplusplus
46extern "C" {
47#endif
48
61
70void register_AI_handler( void (*callback)() );
71
78void register_VI_handler( void (*callback)() );
79
86void register_PI_handler( void (*callback)() );
87
94void register_DP_handler( void (*callback)() );
95
102void register_SI_handler( void (*callback)() );
103
110void register_SP_handler( void (*callback)() );
111
130void register_TI_handler( void (*callback)() );
131
149void register_CART_handler( void (*callback)() );
150
179void register_RESET_handler( void (*callback)() );
180
181
188void unregister_AI_handler( void (*callback)() );
189
196void unregister_VI_handler( void (*callback)() );
197
204void unregister_PI_handler( void (*callback)() );
205
212void unregister_DP_handler( void (*callback)() );
213
220void unregister_SI_handler( void (*callback)() );
221
228void unregister_SP_handler( void (*callback)() );
229
240void unregister_TI_handler( void (*callback)() );
241
248void unregister_CART_handler( void (*callback)() );
249
256void unregister_RESET_handler( void (*callback)() );
257
258
265void set_AI_interrupt( int active );
266
294void set_VI_interrupt( int active, unsigned long line );
295
302void set_PI_interrupt( int active );
303
310void set_DP_interrupt( int active );
311
318void set_SI_interrupt( int active );
319
326void set_SP_interrupt( int active );
327
340void set_TI_interrupt( int active );
341
350void set_CART_interrupt( int active );
351
362void set_RESET_interrupt( int active );
363
376#define RESET_TIME_LENGTH TICKS_FROM_MS(200)
377
378
407uint32_t exception_reset_time( void );
408
409static inline __attribute__((deprecated("calling init_interrupts no longer required")))
410void init_interrupts() {}
411
412static inline __attribute__((deprecated("use register_RESET_handler instead")))
413void register_reset_handler( void (*callback)() )
414{
415 register_RESET_handler(callback);
416}
417
418
426void enable_interrupts();
427
434void disable_interrupts();
435
436
445
446#ifdef __cplusplus
447}
448#endif
449
450#endif
interrupt_state_t
State of interrupts on the system.
Definition interrupt.h:53
@ INTERRUPTS_DISABLED
Interrupts are currently disabled.
Definition interrupt.h:57
@ INTERRUPTS_ENABLED
Interrupts are currently enabled.
Definition interrupt.h:59
@ INTERRUPTS_UNINITIALIZED
Interrupt controller has not been initialized.
Definition interrupt.h:55
void unregister_AI_handler(void(*callback)())
Unregister an AI callback.
Definition interrupt.c:296
void unregister_SI_handler(void(*callback)())
Unegister a SI callback.
Definition interrupt.c:336
void register_CART_handler(void(*callback)())
Register a CART interrupt callback.
Definition interrupt.c:362
void enable_interrupts()
Enable interrupts systemwide.
Definition interrupt.c:519
void unregister_TI_handler(void(*callback)())
Unregister a timer callback.
Definition interrupt.c:357
void register_AI_handler(void(*callback)())
Register an AI callback.
Definition interrupt.c:291
void set_SP_interrupt(int active)
Enable or disable the SP interrupt.
Definition interrupt.c:431
void set_SI_interrupt(int active)
Enable or disable the SI interrupt.
Definition interrupt.c:426
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:559
void unregister_RESET_handler(void(*callback)())
Unregister a RESET interrupt callback.
Definition interrupt.c:385
void register_PI_handler(void(*callback)())
Register a PI callback.
Definition interrupt.c:311
void unregister_VI_handler(void(*callback)())
Unregister a VI callback.
Definition interrupt.c:306
void disable_interrupts()
Disable interrupts systemwide.
Definition interrupt.c:494
void unregister_DP_handler(void(*callback)())
Unregister a DP callback.
Definition interrupt.c:326
void set_TI_interrupt(int active)
Enable or disable the timer interrupt.
Definition interrupt.c:436
void set_PI_interrupt(int active)
Enable or disable the PI interrupt.
Definition interrupt.c:416
void unregister_PI_handler(void(*callback)())
Unegister a PI callback.
Definition interrupt.c:316
void unregister_CART_handler(void(*callback)())
Unregister a CART interrupt callback.
Definition interrupt.c:367
void set_AI_interrupt(int active)
Enable or disable the AI interrupt.
Definition interrupt.c:398
void register_TI_handler(void(*callback)())
Register a timer callback.
Definition interrupt.c:352
void register_RESET_handler(void(*callback)())
Register a handler that will be called when the user presses the RESET button.
Definition interrupt.c:372
void register_VI_handler(void(*callback)())
Register a VI callback.
Definition interrupt.c:301
void set_CART_interrupt(int active)
Enable or disable the CART interrupt.
Definition interrupt.c:448
void set_DP_interrupt(int active)
Enable or disable the DP interrupt.
Definition interrupt.c:421
void unregister_SP_handler(void(*callback)())
Unegister a SP callback.
Definition interrupt.c:346
void set_RESET_interrupt(int active)
Enable the RESET interrupt.
Definition interrupt.c:460
void register_SI_handler(void(*callback)())
Register a SI callback.
Definition interrupt.c:331
void register_SP_handler(void(*callback)())
Register a SP callback.
Definition interrupt.c:341
void register_DP_handler(void(*callback)())
Register a DP callback.
Definition interrupt.c:321
void set_VI_interrupt(int active, unsigned long line)
Enable or disable the VI interrupt.
Definition interrupt.c:403
interrupt_state_t get_interrupts_state()
Return the current state of interrupts.
Definition interrupt.c:542