⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcf5xxx_timer.h

📁 motorola 针对coldfire 5275 评估板的Dbug bootloader源程序
💻 H
字号:
/*
 * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -