资源预览内容
第1页 / 共71页
第2页 / 共71页
第3页 / 共71页
第4页 / 共71页
第5页 / 共71页
第6页 / 共71页
第7页 / 共71页
第8页 / 共71页
第9页 / 共71页
第10页 / 共71页
亲,该文档总共71页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
/ TI File $Revision: /main/1 $/ Checkin $Date: December 1, 2004 12:31:30 $/#/ FILE: DSP280x_CpuTimers.h/ TITLE: DSP280x CPU 32-bit Timers Register Definitions./ NOTES: CpuTimer1 and CpuTimer2 are reserved for use with DSP BIOS and/ other realtime operating systems. / Do not use these two timers in your application if you ever plan/ on integrating DSP-BIOS or another realtime OS. / For this reason, the code to manipulate these two timers is/ commented out and not used in these examples./#/ $TI Release: DSP280x, DSP2801x Header Files V1.41 $/ $Release Date: August 7th, 2006 $/#ifndef DSP280x_CPU_TIMERS_H#define DSP280x_CPU_TIMERS_H#ifdef _cplusplusextern C #endif/-/ CPU Timer Register Bit Definitions:/ TCR: Control register bit definitions:struct TCR_BITS / bits descriptionUint16 rsvd1:4; / 3:0 reservedUint16 TSS:1; / 4 Timer Start/StopUint16 TRB:1; / 5 Timer reloadUint16 rsvd2:4; / 9:6 reservedUint16 SOFT:1; / 10 Emulation modesUint16 FREE:1; / 11Uint16 rsvd3:2; / 12:13 reservedUint16 TIE:1; / 14 Output enableUint16 TIF:1; / 15 Interrupt flag; union TCR_REG Uint16 all;struct TCR_BITS bit;/ TPR: Pre-scale low bit definitions:struct TPR_BITS / bits descriptionUint16 TDDR:8; / 7:0 Divide-down lowUint16 PSC:8; / 15:8 Prescale counter low;union TPR_REG Uint16 all;struct TPR_BITS bit;/ TPRH: Pre-scale high bit definitions:struct TPRH_BITS / bits descriptionUint16 TDDRH:8; / 7:0 Divide-down highUint16 PSCH:8; / 15:8 Prescale counter high;union TPRH_REG Uint16 all;struct TPRH_BITS bit;/ TIM, TIMH: Timer register definitions:struct TIM_REG Uint16 LSW;Uint16 MSW;union TIM_GROUP Uint32 all;struct TIM_REG half;/ PRD, PRDH: Period register definitions:struct PRD_REG Uint16 LSW; Uint16 MSW;union PRD_GROUP Uint32 all;struct PRD_REG half;/-/ CPU Timer Register File:/struct CPUTIMER_REGS union TIM_GROUP TIM; / Timer counter registerunion PRD_GROUP PRD; / Period registerunion TCR_REG TCR; / Timer control registerUint16 rsvd1; / reservedunion TPR_REG TPR; / Timer pre-scale lowunion TPRH_REG TPRH; / Timer pre-scale high;/-/ CPU Timer Support Variables:/struct CPUTIMER_VARS volatile struct CPUTIMER_REGS *RegsAddr;Uint32 InterruptCount;float CPUFreqInMHz;float PeriodInUSec;/-/ Function prototypes and external definitions:/void InitCpuTimers(void);void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period);extern volatile struct CPUTIMER_REGS CpuTimer0Regs;extern struct CPUTIMER_VARS CpuTimer0;/ CpuTimer 1 and CpuTimer2 are reserved for DSP BIOS & other RTOS/extern volatile struct CPUTIMER_REGS CpuTimer1Regs;/extern volatile struct CPUTIMER_REGS CpuTimer2Regs;/extern struct CPUTIMER_VARS CpuTimer1;/extern struct CPUTIMER_VARS CpuTimer2;/-/ Usefull Timer Operations:/ Start Timer:#define StartCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 0/ Stop Timer:#define StopCpuTimer0() CpuTimer0Regs.TCR.bit.TSS = 1/ Reload Timer With period Value:#define ReloadCpuTimer0() CpuTimer0Regs.TCR.bit.TRB = 1/ Read 32-Bit Timer Value:#define ReadCpuTimer0Counter() CpuTimer0Regs.TIM.all/ Read 32-Bit Period Value:#define ReadCpuTimer0Period() CpuTimer0Regs.PRD.all/ CpuTimer 1 and CpuTimer2 are reserved for DSP BIOS & other RTOS/ Do not use these two timers if you ever plan on integrating / DSP-BIOS or another realtime OS. / For this reason, the code to manipulate these two timers is/ commented out and not used in these examples./ Start Timer:/#define StartCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 0/#define StartCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 0/ Stop Timer:/#define StopCpuTimer1() CpuTimer1Regs.TCR.bit.TSS = 1/#define StopCpuTimer2() CpuTimer2Regs.TCR.bit.TSS = 1/ Reload Timer With period Value:/#define ReloadCpuTimer1() CpuTimer1Regs.TCR.bit.TRB = 1/#define ReloadCpuTimer2() CpuTimer2Regs.TCR.bit.TRB = 1/ Read 32-Bit Timer Value:/#define ReadCpuTimer1Counter() CpuTimer1Regs.TIM.all/#define ReadCpuTimer2Counter() CpuTimer2Regs.TIM.all/ Read 32-Bit Period Value:/#
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号