libdragon
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
11#ifdef __cplusplus
12extern "C" {
13#endif
14
23typedef enum
24{
32
35void register_AI_handler( void (*callback)() );
36void register_VI_handler( void (*callback)() );
37void register_PI_handler( void (*callback)() );
38void register_DP_handler( void (*callback)() );
39void register_SI_handler( void (*callback)() );
40void register_SP_handler( void (*callback)() );
41void register_TI_handler( void (*callback)() );
42void register_CART_handler( void (*callback)() );
43void register_RESET_handler( void (*callback)() );
44
45void unregister_AI_handler( void (*callback)() );
46void unregister_VI_handler( void (*callback)() );
47void unregister_PI_handler( void (*callback)() );
48void unregister_DP_handler( void (*callback)() );
49void unregister_SI_handler( void (*callback)() );
50void unregister_SP_handler( void (*callback)() );
51void unregister_TI_handler( void (*callback)() );
52void unregister_CART_handler( void (*callback)() );
53void unregister_RESET_handler( void (*callback)() );
54
55void set_AI_interrupt( int active );
56void set_VI_interrupt( int active, unsigned long line );
57void set_PI_interrupt( int active );
58void set_DP_interrupt( int active );
59void set_SI_interrupt( int active );
60void set_SP_interrupt( int active );
61void set_TI_interrupt( int active );
62void set_CART_interrupt( int active );
63void set_RESET_interrupt( int active );
64
77#define RESET_TIME_LENGTH TICKS_FROM_MS(200)
78
79uint32_t exception_reset_time( void );
80
81static inline __attribute__((deprecated("calling init_interrupts no longer required")))
82void init_interrupts() {}
83
84static inline __attribute__((deprecated("use register_RESET_handler instead")))
85void register_reset_handler( void (*callback)() )
86{
87 register_RESET_handler(callback);
88}
89
92
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif
void unregister_AI_handler(void(*callback)())
Unregister an AI callback.
Definition: interrupt.c:395
void unregister_SI_handler(void(*callback)())
Unegister a SI callback.
Definition: interrupt.c:483
void register_CART_handler(void(*callback)())
Register a CART interrupt callback.
Definition: interrupt.c:566
void enable_interrupts()
Enable interrupts systemwide.
Definition: interrupt.c:900
void unregister_TI_handler(void(*callback)())
Unregister a timer callback.
Definition: interrupt.c:544
void register_AI_handler(void(*callback)())
Register an AI callback.
Definition: interrupt.c:384
void set_SP_interrupt(int active)
Enable or disable the SP interrupt.
Definition: interrupt.c:760
void set_SI_interrupt(int active)
Enable or disable the SI interrupt.
Definition: interrupt.c:742
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:975
void unregister_RESET_handler(void(*callback)())
Unregister a RESET interrupt callback.
Definition: interrupt.c:629
interrupt_state_t
State of interrupts on the system.
Definition: interrupt.h:24
void register_PI_handler(void(*callback)())
Register a PI callback.
Definition: interrupt.c:428
void unregister_VI_handler(void(*callback)())
Unregister a VI callback.
Definition: interrupt.c:417
void disable_interrupts()
Disable interrupts systemwide.
Definition: interrupt.c:866
void unregister_DP_handler(void(*callback)())
Unregister a DP callback.
Definition: interrupt.c:461
void set_TI_interrupt(int active)
Enable or disable the timer interrupt.
Definition: interrupt.c:784
void set_PI_interrupt(int active)
Enable or disable the PI interrupt.
Definition: interrupt.c:706
void unregister_PI_handler(void(*callback)())
Unegister a PI callback.
Definition: interrupt.c:439
void unregister_CART_handler(void(*callback)())
Unregister a CART interrupt callback.
Definition: interrupt.c:577
void set_AI_interrupt(int active)
Enable or disable the AI interrupt.
Definition: interrupt.c:648
void register_TI_handler(void(*callback)())
Register a timer callback.
Definition: interrupt.c:529
void register_RESET_handler(void(*callback)())
Register a handler that will be called when the user presses the RESET button.
Definition: interrupt.c:610
void register_VI_handler(void(*callback)())
Register a VI callback.
Definition: interrupt.c:406
void set_CART_interrupt(int active)
Enable or disable the CART interrupt.
Definition: interrupt.c:804
void set_DP_interrupt(int active)
Enable or disable the DP interrupt.
Definition: interrupt.c:724
void unregister_SP_handler(void(*callback)())
Unegister a SP callback.
Definition: interrupt.c:505
void set_RESET_interrupt(int active)
Enable the RESET interrupt.
Definition: interrupt.c:826
void register_SI_handler(void(*callback)())
Register a SI callback.
Definition: interrupt.c:472
void register_SP_handler(void(*callback)())
Register a SP callback.
Definition: interrupt.c:494
void register_DP_handler(void(*callback)())
Register a DP callback.
Definition: interrupt.c:450
void set_VI_interrupt(int active, unsigned long line)
Enable or disable the VI interrupt.
Definition: interrupt.c:687
interrupt_state_t get_interrupts_state()
Return the current state of interrupts.
Definition: interrupt.c:930
@ INTERRUPTS_DISABLED
Interrupts are currently disabled.
Definition: interrupt.h:28
@ INTERRUPTS_ENABLED
Interrupts are currently enabled.
Definition: interrupt.h:30
@ INTERRUPTS_UNINITIALIZED
Interrupt controller has not been initialized.
Definition: interrupt.h:26