📄 timer.h
字号:
/*******************************************************************************
* Copyright: Copyright (c) 2007. Hisilicon Technologies, CO., LTD.
* Version: V300R001B04
* Filename: Timer.h
* Description: 实现系统Timer的操作功能
* History:
1.Created by SunShaoJie on 2007/12/25
*******************************************************************************/
#ifndef __TIMER_H
#define __TIMER_H
#include "sys.h"
#include "Register.h"
/* Timer register */
#define TIMER1_LOAD (TIMER1_BASE + 0x0)
#define TIMER1_CURRENT (TIMER1_BASE + 0x4)
#define TIMER1_CNTL (TIMER1_BASE + 0x8)
#define TIMER1_INT_CLEAR (TIMER1_BASE + 0xC)
#define TIMER1_RIS (TIMER1_BASE + 0x10)
#define TIMER1_MIS (TIMER1_BASE + 0x14)
#define TIMER1_BGLOAD (TIMER1_BASE + 0x18)
#define TIMER2_LOAD (TIMER2_BASE + 0x00)
#define TIMER2_CURRENT (TIMER2_BASE + 0x04)
#define TIMER2_CNTL (TIMER2_BASE + 0x08)
#define TIMER2_INT_CLEAR (TIMER2_BASE + 0x0C)
#define TIMER2_RIS (TIMER2_BASE + 0x10)
#define TIMER2_MIS (TIMER2_BASE + 0x14)
#define TIMER2_BGLOAD (TIMER2_BASE + 0x18)
#define TIMER3_LOAD (TIMER3_BASE + 0x0)
#define TIMER3_CURRENT (TIMER3_BASE + 0x4)
#define TIMER3_CNTL (TIMER3_BASE + 0x8)
#define TIMER3_INT_CLEAR (TIMER3_BASE + 0xC)
#define TIMER3_RIS (TIMER3_BASE + 0x10)
#define TIMER3_MIS (TIMER3_BASE + 0x14)
#define TIMER3_BGLOAD (TIMER3_BASE + 0x18)
#define TIMER4_LOAD (TIMER4_BASE + 0x00)
#define TIMER4_CURRENT (TIMER4_BASE + 0x04)
#define TIMER4_CNTL (TIMER4_BASE + 0x08)
#define TIMER4_INT_CLEAR (TIMER4_BASE + 0x0C)
#define TIMER4_RIS (TIMER4_BASE + 0x10)
#define TIMER4_MIS (TIMER4_BASE + 0x14)
#define TIMER4_BGLOAD (TIMER4_BASE + 0x18)
/*
* definitions for the Timer:
* two timers clocked from same source and with the same reload overhead
*/
#define SYS_TIMER_CLEAR TIMER1_INT_CLEAR /* Timer 1 Interrupt Clear */
#define SYS_TIMER_CTRL TIMER1_CNTL /* Timer 1 Control */
#define SYS_TIMER_LOAD TIMER1_LOAD /* Timer 1 Load */
#define SYS_TIMER_VALUE TIMER1_CURRENT /* Timer 1 Value */
#define SYS_TIMER_RIS TIMER1_RIS
#define SYS_TIMER_MIS TIMER1_MIS
#define SYS_TIMER_BGLOAD TIMER1_BGLOAD
#define AUX_TIMER_CLEAR TIMER3_INT_CLEAR /* Timer 2 Interrupt Clear */
#define AUX_TIMER_CTRL TIMER3_CNTL /* Timer 2 Control */
#define AUX_TIMER_LOAD TIMER3_LOAD /* Timer 2 Load */
#define AUX_TIMER_VALUE TIMER3_CURRENT /* Timer 2 Value */
#define AUX_TIMER_RIS TIMER3_RIS
#define AUX_TIMER_MIS TIMER3_MIS
#define AUX_TIMER_BGLOAD TIMER3_BGLOAD
#define ms
/*******************************************************************************
Function: InitSysTimer
Description: 初始化系统时钟,并检测时钟是否开始运行
*******************************************************************************/
BOOL InitSysTimer(void);
/*******************************************************************************
Function: GetSysTimer
Description: 得到当前的系统时钟值
*******************************************************************************/
UINT32 GetSysTimer(void);
/*******************************************************************************
Function: GetPassedMicSec
Description: 得到相对于记录点,已经消逝的时间值,以ms为单位
*******************************************************************************/
UINT32 GetPassedMicSec(UINT32 dwBaseTick);
/*******************************************************************************
Function: Sleep
Description: 延时,以ms为单位
Input: dwNum: 需要延时的毫秒数
Output: 无
Return: 无
Others: 无
*******************************************************************************/
void Sleep(UINT32 dwNum);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -