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

📄 gp_timers.h.svn-base

📁 Spearhead2000 的 USB驱动程序
💻 SVN-BASE
字号:
#ifndef __GP_TIMERS_H#define __GP_TIMERS_Hextern void gptSetTimer(unsigned int timer, unsigned int control, unsigned int value);extern unsigned int gptGetTimerVal(unsigned int timer);extern void gptRestart(unsigned int timer);extern void gptInterrupt(unsigned int vector);extern void gptInit(void);extern void gptTest(void);extern void gpt_test(void);#define APB_GP_TIMERS1_BASE   0x12001080 /*for GPT0*/#define APB_GP_TIMERS2_BASE   0x12001100 /*for GPT1*/#define APB_GP_TIMERS3_BASE   0x12002080 /*for GPT2*/#define APB_GP_TIMERS4_BASE   0x12002100 /*for GPT3*/typedef struct GPTController{  unsigned int TIMER_CONTROL_REG;  unsigned int TIMER_STATUS_RES_INT_ACK;  unsigned int TIMER_COMPARE_REG;  unsigned int TIMER_COUNT_REG;  unsigned int TIMER_RISING_EDGE_CAPTURE;  unsigned int TIMER_FALLING_EDGE_CAPTURE;} GPTController;#define GPT1Cntl ((volatile struct GPTController*) (APB_GP_TIMERS1_BASE))#define GPT2Cntl ((volatile struct GPTController*) (APB_GP_TIMERS2_BASE))#define GPT3Cntl ((volatile struct GPTController*) (APB_GP_TIMERS3_BASE))#define GPT4Cntl ((volatile struct GPTController*) (APB_GP_TIMERS4_BASE))#define  TIMER1	     1#define  TIMER2	     2#define  TIMER3	     3#define  TIMER4	     4/* TIMER values */#define  GPT_FREQ_66_5Mhz    0x0000#define  GPT_FREQ_33_25Mhz   0x0001#define  GPT_FREQ_16_625Mhz  0x0002#define  GPT_FREQ_8_313Mhz   0x0003#define  GPT_FREQ_4_156Mhz   0x0004#define  GPT_FREQ_2_078Mhz   0x0005#define  GPT_FREQ_1_039Mhz   0x0006#define  GPT_FREQ_519_531Khz 0x0007#define  GPT_FREQ_259_766Khz 0x0008#define  GPT_SINGLE_SHOT     0x0010#define  GPT_AUTO_RELOAD     0x0000#define  GPT_ENAB	     0x0020#define  GPT_CAPT_NONE	     0x0000 // capture on rise edge#define  GPT_CAPT_R	     0x0040 // capture on rise edge#define  GPT_CAPT_F	     0x0080 // capture on fall edge#define  GPT_CAPT_RF	     0x00C0 // capture on rise and fall edge#define  GPT_MATCH_INT       0x0100#define  GPT_FEDGE_INT       0x0200#define  GPT_REDGE_INT       0x0400#define  GPT_MATCH	     0x0001#define  GPT_FEDGE	     0x0002#define  GPT_REDGE	     0x0004#endif //__GP_TIMERS_H

⌨️ 快捷键说明

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