hsk-libs-dev
270
High Speed Karlsruhe XC878 library collection
|
HSK Timer 0/1 implementation. More...
Macros | |
#define | BIT_ET0 1 |
IEN0 Timer 0 Overflow Interrupt Enable bit. More... | |
#define | BIT_ET1 3 |
IEN0 Timer 1 Overflow Interrupt Enable bit. More... | |
#define | BIT_T0M 0 |
TMOD Timer 0 Mode select bits. More... | |
#define | CNT_T0M 2 |
T0M bit count. More... | |
#define | BIT_T1M 4 |
TMOD Timer 0 Mode select bits. More... | |
#define | CNT_T1M 2 |
T1M bit count. More... | |
#define | BIT_RMAP 0 |
SYSCON0 Special Function Register Map Control bit. More... | |
Functions | |
void | ISR_hsk_timer0 (void) |
The ISR for timer 0. More... | |
void | ISR_hsk_timer1 (void) |
The ISR for timer 1. More... | |
void | hsk_timer01_setup (const ubyte id, const uword interval, const void(*const callback)(void)) |
Setup timer 0 or 1 to tick at a given interval. More... | |
void | hsk_timer0_setup (const uword interval, const void(*const callback)(void)) |
Setup timer 0 to tick at a given interval. More... | |
void | hsk_timer0_enable (void) |
Enables the timer 0 and its interrupt. More... | |
void | hsk_timer0_disable (void) |
Disables timer 0 and its interrupt. More... | |
void | hsk_timer1_setup (const uword interval, const void(*const callback)(void)) |
Setup timer 1 to tick at a given interval. More... | |
void | hsk_timer1_enable (void) |
Enables the timer 1 and its interrupt. More... | |
void | hsk_timer1_disable (void) |
Disables timer 1 and its interrupt. More... | |
Variables | |
struct { | |
uword overflow | |
The value to load into the timer upon overflow. More... | |
void(* callback )(void) | |
A callback function pointer used by the ISR. More... | |
} | timers [2] |
Struct representing runtime information for a timer. More... | |
HSK Timer 0/1 implementation.
This simple library implements access to the timers T0 and T1, as 16 bit timers to use as a ticking source.
#define BIT_ET0 1 |
IEN0 Timer 0 Overflow Interrupt Enable bit.
#define BIT_ET1 3 |
IEN0 Timer 1 Overflow Interrupt Enable bit.
#define BIT_RMAP 0 |
SYSCON0 Special Function Register Map Control bit.
#define BIT_T0M 0 |
TMOD Timer 0 Mode select bits.
#define BIT_T1M 4 |
TMOD Timer 0 Mode select bits.
#define CNT_T0M 2 |
T0M bit count.
#define CNT_T1M 2 |
T1M bit count.
|
private |
Setup timer 0 or 1 to tick at a given interval.
The callback function will be called by the interrupt once the interrupt has been enabled. Note that the callback function is entered with the current page unknown.
This works on the assumption, that PCLK is set to 24MHz.
id | Timer 0 or 1. |
interval | The ticking interval in µs, don't go beyond 5461. |
callback | A function pointer to a callback function. |
The timer ticks with PCLK / 2, which means 12 timer ticks per µs.
void hsk_timer0_disable | ( | void | ) |
Disables timer 0 and its interrupt.
void hsk_timer0_enable | ( | void | ) |
Enables the timer 0 and its interrupt.
void hsk_timer0_setup | ( | const uword | interval, |
const void(*)(void) | callback | ||
) |
Setup timer 0 to tick at a given interval.
The callback function will be called by the interrupt once the interrupt has been enabled. Note that the callback function is entered with the current page unknown.
This works on the assumption, that PCLK is set to 24MHz.
interval | The ticking interval in µs, don't go beyond 5461. |
callback | A function pointer to a callback function. |
void hsk_timer1_disable | ( | void | ) |
Disables timer 1 and its interrupt.
void hsk_timer1_enable | ( | void | ) |
Enables the timer 1 and its interrupt.
void hsk_timer1_setup | ( | const uword | interval, |
const void(*)(void) | callback | ||
) |
Setup timer 1 to tick at a given interval.
The callback function will be called by the interrupt once the interrupt has been enabled. Note that the callback function is entered with the current page unknown.
This works on the assumption, that PCLK is set to 24MHz.
interval | The ticking interval in µs, don't go beyond 5461. |
callback | A function pointer to a callback function. |
|
private |
The ISR for timer 0.
Sets up the timer 0 count registers and calls the callback function.
|
private |
The ISR for timer 1.
Sets up the timer 1 count registers and calls the callback function.
void( * callback) (void) |
A callback function pointer used by the ISR.
uword overflow |
The value to load into the timer upon overflow.
|
static |
Struct representing runtime information for a timer.