60 #include <inc/hw_ints.h>
61 #include <inc/hw_types.h>
62 #include <inc/hw_memmap.h>
63 #include <inc/hw_gpt.h>
82 #ifndef DRIVERLIB_GENERATE_ROM
83 #define TimerConfigure NOROM_TimerConfigure
84 #define TimerLevelControl NOROM_TimerLevelControl
85 #define TimerTriggerControl NOROM_TimerTriggerControl
86 #define TimerStallControl NOROM_TimerStallControl
87 #define TimerWaitOnTriggerControl NOROM_TimerWaitOnTriggerControl
88 #define TimerIntRegister NOROM_TimerIntRegister
89 #define TimerIntUnregister NOROM_TimerIntUnregister
97 #define TIMER_CFG_ONE_SHOT 0x00000021 // Full-width one-shot timer
98 #define TIMER_CFG_ONE_SHOT_UP 0x00000031 // Full-width one-shot up-count timer
99 #define TIMER_CFG_PERIODIC 0x00000022 // Full-width periodic timer
100 #define TIMER_CFG_PERIODIC_UP 0x00000032 // Full-width periodic up-count timer
101 #define TIMER_CFG_RTC 0x01000000 // Full-width RTC timer
102 #define TIMER_CFG_SPLIT_PAIR 0x04000000 // Two half-width timers
103 #define TIMER_CFG_A_ONE_SHOT 0x00000021 // Timer A one-shot timer
104 #define TIMER_CFG_A_ONE_SHOT_UP 0x00000031 // Timer A one-shot up-count timer
105 #define TIMER_CFG_A_PERIODIC 0x00000022 // Timer A periodic timer
106 #define TIMER_CFG_A_PERIODIC_UP 0x00000032 // Timer A periodic up-count timer
107 #define TIMER_CFG_A_CAP_COUNT 0x00000003 // Timer A event counter
108 #define TIMER_CFG_A_CAP_COUNT_UP 0x00000013 // Timer A event up-counter
109 #define TIMER_CFG_A_CAP_TIME 0x00000007 // Timer A event timer
110 #define TIMER_CFG_A_CAP_TIME_UP 0x00000017 // Timer A event up-count timer
111 #define TIMER_CFG_A_PWM 0x0000000A // Timer A PWM output
112 #define TIMER_CFG_B_ONE_SHOT 0x00002100 // Timer B one-shot timer
113 #define TIMER_CFG_B_ONE_SHOT_UP 0x00003100 // Timer B one-shot up-count timer
114 #define TIMER_CFG_B_PERIODIC 0x00002200 // Timer B periodic timer
115 #define TIMER_CFG_B_PERIODIC_UP 0x00003200 // Timer B periodic up-count timer
116 #define TIMER_CFG_B_CAP_COUNT 0x00000300 // Timer B event counter
117 #define TIMER_CFG_B_CAP_COUNT_UP 0x00001300 // Timer B event up-counter
118 #define TIMER_CFG_B_CAP_TIME 0x00000700 // Timer B event timer
119 #define TIMER_CFG_B_CAP_TIME_UP 0x00001700 // Timer B event up-count timer
120 #define TIMER_CFG_B_PWM 0x00000A00 // Timer B PWM output
129 #define TIMER_TIMB_DMA 0x00002000 // TimerB DMA Done interrupt
130 #define TIMER_TIMB_MATCH 0x00000800 // TimerB match interrupt
131 #define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt
132 #define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt
133 #define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt
134 #define TIMER_TIMA_DMA 0x00000020 // TimerA DMA Done interrupt
135 #define TIMER_TIMA_MATCH 0x00000010 // TimerA match interrupt
136 #define TIMER_RTC_MATCH 0x00000008 // RTC interrupt mask
137 #define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt
138 #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
139 #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt
146 #define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges
147 #define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges
148 #define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges
156 #define TIMER_A 0x000000FF // Timer A
157 #define TIMER_B 0x0000FF00 // Timer B
158 #define TIMER_BOTH 0x0000FFFF // Timer Both
165 #define TIMER_0A_SYNC 0x00000001 // Synchronize Timer 0A
166 #define TIMER_0B_SYNC 0x00000002 // Synchronize Timer 0B
167 #define TIMER_1A_SYNC 0x00000004 // Synchronize Timer 1A
168 #define TIMER_1B_SYNC 0x00000008 // Synchronize Timer 1B
169 #define TIMER_2A_SYNC 0x00000010 // Synchronize Timer 2A
170 #define TIMER_2B_SYNC 0x00000020 // Synchronize Timer 2B
171 #define TIMER_3A_SYNC 0x00000040 // Synchronize Timer 3A
172 #define TIMER_3B_SYNC 0x00000080 // Synchronize Timer 3B
180 #ifdef DRIVERLIB_DEBUG
196 TimerBaseValid(uint32_t ui32Base)
225 ASSERT(TimerBaseValid(ui32Base));
256 ASSERT(TimerBaseValid(ui32Base));
263 HWREG(ui32Base +
GPT_O_CTL) &= ~(ui32Timer &
320 extern void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config);
390 ASSERT(TimerBaseValid(ui32Base));
399 (ui32Event & ui32Timer));
470 ASSERT(TimerBaseValid(ui32Base));
495 ASSERT(TimerBaseValid(ui32Base));
543 ASSERT(TimerBaseValid(ui32Base));
592 __STATIC_INLINE uint32_t
598 ASSERT(TimerBaseValid(ui32Base));
637 ASSERT(TimerBaseValid(ui32Base));
678 __STATIC_INLINE uint32_t
684 ASSERT(TimerBaseValid(ui32Base));
718 TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
723 ASSERT(TimerBaseValid(ui32Base));
765 __STATIC_INLINE uint32_t
771 ASSERT(TimerBaseValid(ui32Base));
801 __STATIC_INLINE uint32_t
807 ASSERT(TimerBaseValid(ui32Base));
849 ASSERT(TimerBaseValid(ui32Base));
891 __STATIC_INLINE uint32_t
897 ASSERT(TimerBaseValid(ui32Base));
932 void (*pfnHandler)(
void));
985 ASSERT(TimerBaseValid(ui32Base));
990 HWREG(ui32Base +
GPT_O_IMR) |= ui32IntFlags;
1016 __STATIC_INLINE
void
1022 ASSERT(TimerBaseValid(ui32Base));
1027 HWREG(ui32Base +
GPT_O_IMR) &= ~(ui32IntFlags);
1053 __STATIC_INLINE uint32_t
1059 ASSERT(TimerBaseValid(ui32Base));
1065 return(bMasked ? HWREG(ui32Base +
GPT_O_MIS) :
1101 __STATIC_INLINE
void
1107 ASSERT(TimerBaseValid(ui32Base));
1141 __STATIC_INLINE
void
1161 #ifndef DRIVERLIB_NOROM
1163 #ifdef ROM_TimerConfigure
1164 #undef TimerConfigure
1165 #define TimerConfigure ROM_TimerConfigure
1167 #ifdef ROM_TimerLevelControl
1168 #undef TimerLevelControl
1169 #define TimerLevelControl ROM_TimerLevelControl
1171 #ifdef ROM_TimerTriggerControl
1172 #undef TimerTriggerControl
1173 #define TimerTriggerControl ROM_TimerTriggerControl
1175 #ifdef ROM_TimerStallControl
1176 #undef TimerStallControl
1177 #define TimerStallControl ROM_TimerStallControl
1179 #ifdef ROM_TimerWaitOnTriggerControl
1180 #undef TimerWaitOnTriggerControl
1181 #define TimerWaitOnTriggerControl ROM_TimerWaitOnTriggerControl
1183 #ifdef ROM_TimerIntRegister
1184 #undef TimerIntRegister
1185 #define TimerIntRegister ROM_TimerIntRegister
1187 #ifdef ROM_TimerIntUnregister
1188 #undef TimerIntUnregister
1189 #define TimerIntUnregister ROM_TimerIntUnregister
__STATIC_INLINE void TimerSynchronize(uint32_t ui32Base, uint32_t ui32Timers)
Synchronizes the counters in a set of timers.
__STATIC_INLINE uint32_t TimerLoadGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer load value.
void TimerWaitOnTriggerControl(uint32_t ui32Base, uint32_t ui32Timer, bool bWait)
Controls the wait on trigger handling.
__STATIC_INLINE void TimerEventControl(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
Controls the event type.
void TimerStallControl(uint32_t ui32Base, uint32_t ui32Timer, bool bStall)
Controls the stall handling.
__STATIC_INLINE void TimerIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual timer interrupt sources.
void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
Registers an interrupt handler for the timer interrupt.
__STATIC_INLINE void TimerPrescaleSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale value.
__STATIC_INLINE uint32_t TimerValueGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the current timer value.
__STATIC_INLINE uint32_t TimerIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current interrupt status.
__STATIC_INLINE void TimerPrescaleMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale match value.
__STATIC_INLINE void TimerEnable(uint32_t ui32Base, uint32_t ui32Timer)
Enables the timer(s).
__STATIC_INLINE uint32_t TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer match value.
__STATIC_INLINE void TimerIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual timer interrupt sources.
__STATIC_INLINE void TimerDisable(uint32_t ui32Base, uint32_t ui32Timer)
Disables the timer(s).
void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config)
Configures the timer(s).
__STATIC_INLINE void TimerRtcDisable(uint32_t ui32Base)
Disable RTC counting.
void TimerIntUnregister(uint32_t ui32Base, uint32_t ui32Timer)
Unregisters an interrupt handler for the timer interrupt.
void TimerLevelControl(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)
Controls the output level.
__STATIC_INLINE uint32_t TimerPrescaleGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale value.
__STATIC_INLINE void TimerRtcEnable(uint32_t ui32Base)
Enable RTC counting.
__STATIC_INLINE void TimerIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears timer interrupt sources.
void TimerTriggerControl(uint32_t ui32Base, uint32_t ui32Timer, bool bEnable)
Enables or disables the ADC trigger output.
__STATIC_INLINE void TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer load value.
__STATIC_INLINE void TimerMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer match value.
__STATIC_INLINE uint32_t TimerPrescaleMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale match value.