/*H*************************************************************************** * * $Archive:: $ * $Revision:: $ * $Date:: $ * $Author:: $ * * DESCRIPTION: * Data definitions for the TMS320C54XX timer. * * USAGE/LIMITATIONS: * * NOTES: * * By: Patrick Cresap * *H***************************************************************************/ #ifndef C54Xtimer_h #define C54Xtimer_h /*---- compilation control switches ----------------------------------------*/ /***************************************************************************** * INCLUDE FILES (minimize nesting of header files) *****************************************************************************/ /*---- system and platform files -------------------------------------------*/ /*---- program files -------------------------------------------------------*/ /***************************************************************************** * FILE CONTENT *****************************************************************************/ /***************************************************************************** * FUNCTIONAL AREA DETAIL *****************************************************************************/ /*A*************************************************************************** * NAME: * * USAGE: * * NOTES: * *A***************************************************************************/ /*---- context -------------------------------------------------------------*/ /*---- data descriptions ---------------------------------------------------*/ /*---- global data declarations --------------------------------------------*/ /*--------------------------------------------------------------------------- * Time Control Register Break Down *---------------------------------------------------------------------------*/ #define TDDR0 0x0001 /* TDDR Timer divide down ratio- Contains the period */ #define TDDR1 0x0002 /* for one of the timer counters. Only does 0 - 15, */ #define TDDR2 0x0004 /* PRD does 0-65536. You can use them together or use*/ #define TDDR3 0x0008 /* just one or both to obtain desired clock speed. */ #define TSS 0x0010 /* Timer start/stop. TSS=1 = stop, TSS=0 = restart */ #define TRB 0x0020 /* Timer Reset Bit. Loads TDDR when TRB=1. */ #define PSC0 0x0040 /* Prescalar counter. TDDR is loaded into PSC. */ #define PSC1 0x0080 /* Do not change, leave 0000 */ #define PSC2 0x0100 #define PSC3 0x0200 #define TCR_FREE 0x0400 #define TCR_SOFT 0x0800 /* Detemines state of clock at breakpoint */ /*--------------------------------------------------------------------------- * Timing registers definitions *---------------------------------------------------------------------------*/ /*-- Timing register, contains current count -------------------------------*/ #define TIM ( ( unsigned short *) 0x0024 ) /*-- Period register, defines the period of timer --------------------------*/ #define PRD ( ( unsigned short *) 0x0025 ) /*-- Time Control register, controls timer operation ------------------------*/ #define TCR ( ( unsigned short *) 0x0026 ) /*-- Timer interrupt position in IMR ---------------------------------------*/ #define IMR_TINT 0x0008 /*-- Definitions for the Clock ---------------------------------------------*/ typedef struct clock_struct { unsigned short tick; unsigned short millisecond; unsigned short second; unsigned short minute; unsigned short hour; }CLOCK_STRUCT; /*---- global function prototypes ------------------------------------------*/ void time ( void ); void C5XX_TimerInit( int TintPeriod ); void set_time(void); #endif /* timer5410.h ------ END OF FILE -------------------------------------*/