62 #include <inc/hw_ints.h>
63 #include <inc/hw_types.h>
64 #include <inc/hw_memmap.h>
65 #include <inc/hw_gpt.h>
83 #define TimerConfigure NOROM_TimerConfigure
84 #define TimerLevelControl NOROM_TimerLevelControl
85 #define TimerStallControl NOROM_TimerStallControl
86 #define TimerWaitOnTriggerControl NOROM_TimerWaitOnTriggerControl
87 #define TimerIntRegister NOROM_TimerIntRegister
88 #define TimerIntUnregister NOROM_TimerIntUnregister
89 #define TimerMatchUpdateMode NOROM_TimerMatchUpdateMode
90 #define TimerIntervalLoadMode NOROM_TimerIntervalLoadMode
98 #define TIMER_CFG_ONE_SHOT 0x00000021 // Full-width one-shot timer
99 #define TIMER_CFG_ONE_SHOT_UP 0x00000031 // Full-width one-shot up-count timer
100 #define TIMER_CFG_PERIODIC 0x00000022 // Full-width periodic timer
101 #define TIMER_CFG_PERIODIC_UP 0x00000032 // Full-width periodic up-count 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_CAPA_EVENT 0x00000004 // CaptureA event interrupt
137 #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
138 #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt
145 #define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges
146 #define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges
147 #define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges
155 #define TIMER_A 0x000000FF // Timer A
156 #define TIMER_B 0x0000FF00 // Timer B
157 #define TIMER_BOTH 0x0000FFFF // Timer Both
164 #define TIMER_0A_SYNC 0x00000001 // Synchronize Timer 0A
165 #define TIMER_0B_SYNC 0x00000002 // Synchronize Timer 0B
166 #define TIMER_1A_SYNC 0x00000004 // Synchronize Timer 1A
167 #define TIMER_1B_SYNC 0x00000008 // Synchronize Timer 1B
168 #define TIMER_2A_SYNC 0x00000010 // Synchronize Timer 2A
169 #define TIMER_2B_SYNC 0x00000020 // Synchronize Timer 2B
170 #define TIMER_3A_SYNC 0x00000040 // Synchronize Timer 3A
171 #define TIMER_3B_SYNC 0x00000080 // Synchronize Timer 3B
178 #define TIMER_MATCHUPDATE_NEXTCYCLE 0x00000000 // Apply match register on next cycle
179 #define TIMER_MATCHUPDATE_TIMEOUT 0x00000001 // Apply match register on next timeout
186 #define TIMER_INTERVALLOAD_NEXTCYCLE 0x00000000 // Load TxR register with the value in the TxILR register on the next clock cycle
187 #define TIMER_INTERVALLOAD_TIMEOUT 0x00000001 // Load TxR register with the value in the TxILR register on next timeout
195 #ifdef DRIVERLIB_DEBUG
211 TimerBaseValid(uint32_t ui32Base)
240 ASSERT(TimerBaseValid(ui32Base));
271 ASSERT(TimerBaseValid(ui32Base));
278 HWREG(ui32Base +
GPT_O_CTL) &= ~(ui32Timer &
334 extern void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config);
383 ASSERT(TimerBaseValid(ui32Base));
392 (ui32Event & ui32Timer));
485 ASSERT(TimerBaseValid(ui32Base));
534 __STATIC_INLINE uint32_t
540 ASSERT(TimerBaseValid(ui32Base));
579 ASSERT(TimerBaseValid(ui32Base));
620 __STATIC_INLINE uint32_t
626 ASSERT(TimerBaseValid(ui32Base));
660 TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
665 ASSERT(TimerBaseValid(ui32Base));
707 __STATIC_INLINE uint32_t
713 ASSERT(TimerBaseValid(ui32Base));
743 __STATIC_INLINE uint32_t
749 ASSERT(TimerBaseValid(ui32Base));
791 ASSERT(TimerBaseValid(ui32Base));
833 __STATIC_INLINE uint32_t
839 ASSERT(TimerBaseValid(ui32Base));
874 void (*pfnHandler)(
void));
926 ASSERT(TimerBaseValid(ui32Base));
931 HWREG(ui32Base +
GPT_O_IMR) |= ui32IntFlags;
962 ASSERT(TimerBaseValid(ui32Base));
967 HWREG(ui32Base +
GPT_O_IMR) &= ~(ui32IntFlags);
992 __STATIC_INLINE uint32_t
998 ASSERT(TimerBaseValid(ui32Base));
1004 return(bMasked ? HWREG(ui32Base +
GPT_O_MIS) :
1045 __STATIC_INLINE
void
1051 ASSERT(TimerBaseValid(ui32Base));
1085 __STATIC_INLINE
void
1108 __STATIC_INLINE
void
1112 ASSERT(TimerBaseValid(ui32Base));
1127 __STATIC_INLINE
void
1131 ASSERT(TimerBaseValid(ui32Base));
1196 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1198 #ifdef ROM_TimerConfigure
1199 #undef TimerConfigure
1200 #define TimerConfigure ROM_TimerConfigure
1202 #ifdef ROM_TimerLevelControl
1203 #undef TimerLevelControl
1204 #define TimerLevelControl ROM_TimerLevelControl
1206 #ifdef ROM_TimerStallControl
1207 #undef TimerStallControl
1208 #define TimerStallControl ROM_TimerStallControl
1210 #ifdef ROM_TimerWaitOnTriggerControl
1211 #undef TimerWaitOnTriggerControl
1212 #define TimerWaitOnTriggerControl ROM_TimerWaitOnTriggerControl
1214 #ifdef ROM_TimerIntRegister
1215 #undef TimerIntRegister
1216 #define TimerIntRegister ROM_TimerIntRegister
1218 #ifdef ROM_TimerIntUnregister
1219 #undef TimerIntUnregister
1220 #define TimerIntUnregister ROM_TimerIntUnregister
1222 #ifdef ROM_TimerMatchUpdateMode
1223 #undef TimerMatchUpdateMode
1224 #define TimerMatchUpdateMode ROM_TimerMatchUpdateMode
1226 #ifdef ROM_TimerIntervalLoadMode
1227 #undef TimerIntervalLoadMode
1228 #define TimerIntervalLoadMode ROM_TimerIntervalLoadMode
void TimerWaitOnTriggerControl(uint32_t ui32Base, uint32_t ui32Timer, bool bWait)
Controls the wait on trigger handling.
static uint32_t TimerPrescaleMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale match value.
static void TimerMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer match value.
static uint32_t TimerValueGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the current timer value.
static void TimerIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual timer interrupt sources.
void TimerStallControl(uint32_t ui32Base, uint32_t ui32Timer, bool bStall)
Controls the stall handling.
void TimerMatchUpdateMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode)
Sets the Match Register Update mode.
static void TimerDisable(uint32_t ui32Base, uint32_t ui32Timer)
Disables the timer(s).
static uint32_t TimerLoadGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer load value.
void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
Registers an interrupt handler for the timer interrupt.
static uint32_t TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer match value.
static void TimerCcpCombineEnable(uint32_t ui32Base)
Enables AND'ing of the CCP outputs from Timer A and Timer B.
static void TimerIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears timer interrupt sources.
static uint32_t TimerIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current interrupt status.
void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config)
Configures the timer(s).
static void TimerEventControl(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
Controls the event type.
static void TimerIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual timer interrupt sources.
static void TimerPrescaleSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale value.
void TimerIntUnregister(uint32_t ui32Base, uint32_t ui32Timer)
Unregisters an interrupt handler for the timer interrupt.
static void TimerEnable(uint32_t ui32Base, uint32_t ui32Timer)
Enables the timer(s).
void TimerLevelControl(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)
Controls the output level.
void TimerIntervalLoadMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode)
Sets the Interval Load mode.
static void TimerPrescaleMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale match value.
static uint32_t TimerPrescaleGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale value.
static void TimerSynchronize(uint32_t ui32Base, uint32_t ui32Timers)
Synchronizes the counters in a set of timers.
static void TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer load value.
static void TimerCcpCombineDisable(uint32_t ui32Base)
Disables AND'ing of the CCP outputs from Timer A and Timer B.