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
|
|
|
|
{
|
2016-08-02 07:51:44 +02:00
|
|
|
unsigned int TCOR; // Timer constant register.
|
|
|
|
unsigned int TCNT; // Timer counter.
|
2016-07-06 11:28:51 +02:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
unsigned short WORD;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
unsigned :7;
|
2016-08-02 07:51:44 +02:00
|
|
|
unsigned UNF :1; // Underflow flag.
|
2016-07-06 11:28:51 +02:00
|
|
|
unsigned :2;
|
2016-08-02 07:51:44 +02:00
|
|
|
unsigned UNIE :1; // Underflow interrupt enable.
|
|
|
|
unsigned CKEG :2; // Clock edge (SH7705 only).
|
|
|
|
unsigned TPSC :3; // Timer prescaler.
|
2016-07-06 11:28:51 +02:00
|
|
|
};
|
2016-08-02 07:51:44 +02:00
|
|
|
} TCR; // Timer control register.
|
2016-07-06 11:28:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
timer_get()
|
|
|
|
Returns the timer and TSTR register addresses.
|
|
|
|
*/
|
2016-08-02 07:51:44 +02:00
|
|
|
void timer_get(int timer, volatile struct mod_tmu **tmu,
|
|
|
|
volatile unsigned char **tstr);
|
2016-07-06 11:28:51 +02:00
|
|
|
|
2016-07-25 09:04:22 +02:00
|
|
|
#endif // _INTERNALS_TIMER_H
|