timer.h

来自「Coldfire MCF5282 DBug bootloader」· C头文件 代码 · 共 48 行

H
48
字号
/*
 * File:		timer.h
 * Purpose:		routines for accessing integrated timer modules
 *
 * Notes:		
 *
 *
 * Modifications:
 *
 */

#ifndef _TIMER_H
#define _TIMER_H

/********************************************************************/

typedef struct
{
	MCF5407_IMM *immp;				/* internal memory map pointer */
	void	(*isr)(void*, void*);	/* current iterrupt service routine */
	float	period;					/* tick period in nano-seconds */
	uint16	then;					/* previous TCN value */
	uint16	now;					/* most recent TCN value */
	uint32	timeouts;				/* count of timer reference reaches */
	uint32	reference;				/* number of timeouts desired */
	uint32	vector;					/* Interrupt vector for this channel */
	uint16	tmr;					/* Timer Mode Register */
	uint16	trr;					/* Timer Reference Register */
	uint8	channel;				/* which channel is this structure for? */
} mcf5407_timer;

/********************************************************************/

uint32 
timer_init(
	MCF5407_IMM *,		/* immp	- Internal memory map pointer (MBAR)		*/
	uint8,				/* channel - Timer to initialize (0 or 1)			*/
	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,				/* vector - Autovectored interrupt number (25-31)	*/
	void(*)(void*, void*)	/* isr - Interrupt Service Routine				*/
	); 

/********************************************************************/

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?