2016-07-25 09:04:22 +02:00
|
|
|
#ifndef _INTERNALS_TIMER_H
|
|
|
|
#define _INTERNALS_TIMER_H 1
|
2016-07-06 11:28:51 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
struct Timer
|
|
|
|
This structure holds information for a running timer.
|
|
|
|
*/
|
|
|
|
struct Timer
|
|
|
|
{
|
|
|
|
void (*callback)(void);
|
|
|
|
int repeats;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct Timer timers[3];
|
|
|
|
|
|
|
|
/*
|
|
|
|
struct mod_tmu
|
|
|
|
This structure holds information about the timer unit (peripheral
|
|
|
|
module) registers.
|
|
|
|
*/
|
|
|
|
struct mod_tmu
|
|
|
|
{
|
|
|
|
// Timer constant register.
|
|
|
|
unsigned int TCOR;
|
|
|
|
// Timer counter.
|
|
|
|
unsigned int TCNT;
|
|
|
|
|
|
|
|
// Timer control register.
|
|
|
|
union
|
|
|
|
{
|
|
|
|
unsigned short WORD;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned :7;
|
|
|
|
// Underflow flag.
|
|
|
|
unsigned UNF :1;
|
|
|
|
unsigned :2;
|
|
|
|
// Underflow interrupt enable.
|
|
|
|
unsigned UNIE :1;
|
|
|
|
// Clock edge, reserved on SH7305.
|
|
|
|
unsigned CKEG :2;
|
|
|
|
// Timer prescaler.
|
|
|
|
unsigned TPSC :3;
|
|
|
|
};
|
|
|
|
} TCR;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
timer_get()
|
|
|
|
Returns the timer and TSTR register addresses.
|
|
|
|
*/
|
|
|
|
void timer_get(int timer, struct mod_tmu **tmu, unsigned char **tstr);
|
|
|
|
|
2016-07-25 09:04:22 +02:00
|
|
|
#endif // _INTERNALS_TIMER_H
|