mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2025-01-03 23:43:36 +01:00
114 lines
2.3 KiB
C
114 lines
2.3 KiB
C
#ifndef _GINT_H
|
|
#define _GINT_H 1
|
|
|
|
//---
|
|
// Public API.
|
|
//---
|
|
|
|
/*
|
|
gint_getVBR()
|
|
Returns the current vbr address.
|
|
|
|
@return vbr address currently in use.
|
|
*/
|
|
unsigned int gint_getVBR(void);
|
|
|
|
/*
|
|
gint_systemVBR()
|
|
Returns the vbr address used by the system (saved when execution
|
|
starts).
|
|
|
|
@return vbr address used by the system.
|
|
*/
|
|
unsigned int gint_systemVBR(void);
|
|
|
|
/*
|
|
gint_setRTCCallback()
|
|
Sets the callback function for the real-time clock interrupt. If
|
|
frequency is non-NULL, the clock frequency is set to the given value.
|
|
*/
|
|
void gint_setRTCCallback(void (*callback)(void), enum GintFrequency frequency);
|
|
|
|
/*
|
|
gint_getRTCCallback()
|
|
Returns the callback function. If frequency is non-NULL, it is set to
|
|
the current frequency value.
|
|
*/
|
|
void (*(gint_getRTCCallback)(void))(enum GintFrequency *frequency);
|
|
|
|
|
|
|
|
//---
|
|
// Internal API.
|
|
// Referenced here for documentation purposes only.
|
|
// Do NOT call these functions, you'll most probably screw up the whole
|
|
// interrupt handling system.
|
|
//---
|
|
|
|
/*
|
|
gint_setVBR()
|
|
Sets the vbr address and does some configuration while interrupts are
|
|
disabled.
|
|
|
|
@arg new_vbr_address
|
|
@arg setup Will be called for configuration under interrupt-safe
|
|
environment.
|
|
*/
|
|
void gint_setVBR(unsigned int new_vbr_address, void (*setup)(void));
|
|
|
|
/*
|
|
gint_init()
|
|
Initializes gint. Loads the interrupt handler into the memory and sets
|
|
the new vbr address.
|
|
*/
|
|
void gint_init(void);
|
|
|
|
/*
|
|
gint_quit()
|
|
Stops gint. Restores the system's configuration and vbr address.
|
|
*/
|
|
void gint_quit(void);
|
|
|
|
/*
|
|
gint_setup()
|
|
Configures interrupt priorities and some parameters to allow gint to
|
|
take control of the interrupt flow.
|
|
*/
|
|
void gint_setup_7705(void);
|
|
void gint_setup_7305(void);
|
|
|
|
/*
|
|
gint_stop()
|
|
Un-configures the interrupt flow to give back the interrupt control to
|
|
the system.
|
|
*/
|
|
void gint_stop_7705(void);
|
|
void gint_stop_7305(void);
|
|
|
|
/*
|
|
gint()
|
|
Handles interrupts.
|
|
*/
|
|
void gint(void) __attribute__((
|
|
section(".gint.int.entry"),
|
|
interrupt_handler
|
|
));
|
|
void gint_7705(void) __attribute__((section(".gint.int")));
|
|
void gint_7305(void) __attribute__((section(".gint.int")));
|
|
|
|
|
|
|
|
//---
|
|
// Internal priority definitions.
|
|
//---
|
|
|
|
#define GINT_INTP_WDT 4
|
|
#define GINT_INTP_RTC 12
|
|
|
|
#define GINT_INTP_GRAY 15
|
|
#define GINT_INTP_KEY 8
|
|
#define GINT_INTP_TIMER 10
|
|
|
|
|
|
|
|
#endif // _GINT_H
|