mcf5xxx_timer.h
来自「motorola 针对coldfire 5275 评估板的Dbug bootlo」· C头文件 代码 · 共 62 行
H
62 行
/*
* File: mcf5xxx_timer.h
* Purpose: routines for accessing integrated timer modules
*
* Notes:
*
*
* Modifications:
*
*/
#ifndef _TIMER_H
#define _TIMER_H
/********************************************************************/
typedef struct
{
void (*isr)(void*, void*); /* current iterrupt service routine */
float period; /* tick period in nano-seconds */
uint32 then; /* previous TCN value */
uint32 now; /* most recent TCN value */
uint32 timeouts; /* count of timer reference reaches */
uint32 reference; /* number of timeouts desired */
uint32 level; /* Interrupt priority for this channel */
uint16 tmr; /* Timer Mode Register */
uint16 trr; /* Timer Reference Register */
uint8 channel; /* which channel is this structure for? */
} MCF5XXX_TIMER;
/********************************************************************/
uint32
timer_init(
uint8, /* channel - Timer to initialize (0->3) */
float, /* period - Tick period in nano-seconds */
/* Min = 1/sysclock, Max = (256 * 16)/sysclock) */
/* If period == 0, disable timer */
float, /* sysclock - System bus clock */
uint32, /* level - Interrupt priority level */
void(*)(void*, void*) /* isr - Interrupt Service Routine */
);
/********************************************************************/
/* Vector numbers for all the timer channels */
#if (defined(CPU_MCF5282) || \
defined(CPU_MCF5275) || \
defined(CPU_MCF523X) || \
defined(CPU_MCF5271))
#define TIMER_VECTOR(a) (a + 83)
#elif (defined(CPU_MCF5272))
#define TIMER_VECTOR(a) (a + 69)
#elif (defined(CPU_MCF5208) || \
defined(CPU_MCF532X))
#define TIMER_VECTOR(a) (a + 96)
#endif
/********************************************************************/
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?