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_RTC 0x01000000 // Full-width RTC timer
103 #define TIMER_CFG_SPLIT_PAIR 0x04000000 // Two half-width timers
104 #define TIMER_CFG_A_ONE_SHOT 0x00000021 // Timer A one-shot timer
105 #define TIMER_CFG_A_ONE_SHOT_UP 0x00000031 // Timer A one-shot up-count timer
106 #define TIMER_CFG_A_PERIODIC 0x00000022 // Timer A periodic timer
107 #define TIMER_CFG_A_PERIODIC_UP 0x00000032 // Timer A periodic up-count timer
108 #define TIMER_CFG_A_CAP_COUNT 0x00000003 // Timer A event counter
109 #define TIMER_CFG_A_CAP_COUNT_UP 0x00000013 // Timer A event up-counter
110 #define TIMER_CFG_A_CAP_TIME 0x00000007 // Timer A event timer
111 #define TIMER_CFG_A_CAP_TIME_UP 0x00000017 // Timer A event up-count timer
112 #define TIMER_CFG_A_PWM 0x0000000A // Timer A PWM output
113 #define TIMER_CFG_B_ONE_SHOT 0x00002100 // Timer B one-shot timer
114 #define TIMER_CFG_B_ONE_SHOT_UP 0x00003100 // Timer B one-shot up-count timer
115 #define TIMER_CFG_B_PERIODIC 0x00002200 // Timer B periodic timer
116 #define TIMER_CFG_B_PERIODIC_UP 0x00003200 // Timer B periodic up-count timer
117 #define TIMER_CFG_B_CAP_COUNT 0x00000300 // Timer B event counter
118 #define TIMER_CFG_B_CAP_COUNT_UP 0x00001300 // Timer B event up-counter
119 #define TIMER_CFG_B_CAP_TIME 0x00000700 // Timer B event timer
120 #define TIMER_CFG_B_CAP_TIME_UP 0x00001700 // Timer B event up-count timer
121 #define TIMER_CFG_B_PWM 0x00000A00 // Timer B PWM output
130 #define TIMER_TIMB_DMA 0x00002000 // TimerB DMA Done interrupt
131 #define TIMER_TIMB_MATCH 0x00000800 // TimerB match interrupt
132 #define TIMER_CAPB_EVENT 0x00000400 // CaptureB event interrupt
133 #define TIMER_CAPB_MATCH 0x00000200 // CaptureB match interrupt
134 #define TIMER_TIMB_TIMEOUT 0x00000100 // TimerB time out interrupt
135 #define TIMER_TIMA_DMA 0x00000020 // TimerA DMA Done interrupt
136 #define TIMER_TIMA_MATCH 0x00000010 // TimerA match interrupt
137 #define TIMER_RTC_MATCH 0x00000008 // RTC interrupt mask
138 #define TIMER_CAPA_EVENT 0x00000004 // CaptureA event interrupt
139 #define TIMER_CAPA_MATCH 0x00000002 // CaptureA match interrupt
140 #define TIMER_TIMA_TIMEOUT 0x00000001 // TimerA time out interrupt
147 #define TIMER_EVENT_POS_EDGE 0x00000000 // Count positive edges
148 #define TIMER_EVENT_NEG_EDGE 0x00000404 // Count negative edges
149 #define TIMER_EVENT_BOTH_EDGES 0x00000C0C // Count both edges
157 #define TIMER_A 0x000000FF // Timer A
158 #define TIMER_B 0x0000FF00 // Timer B
159 #define TIMER_BOTH 0x0000FFFF // Timer Both
166 #define TIMER_0A_SYNC 0x00000001 // Synchronize Timer 0A
167 #define TIMER_0B_SYNC 0x00000002 // Synchronize Timer 0B
168 #define TIMER_1A_SYNC 0x00000004 // Synchronize Timer 1A
169 #define TIMER_1B_SYNC 0x00000008 // Synchronize Timer 1B
170 #define TIMER_2A_SYNC 0x00000010 // Synchronize Timer 2A
171 #define TIMER_2B_SYNC 0x00000020 // Synchronize Timer 2B
172 #define TIMER_3A_SYNC 0x00000040 // Synchronize Timer 3A
173 #define TIMER_3B_SYNC 0x00000080 // Synchronize Timer 3B
180 #define TIMER_MATCHUPDATE_NEXTCYCLE 0x00000000 // Apply match register on next cycle
181 #define TIMER_MATCHUPDATE_TIMEOUT 0x00000001 // Apply match register on next timeout
188 #define TIMER_INTERVALLOAD_NEXTCYCLE 0x00000000 // Load TxR register with the value in the TxILR register on the next clock cycle
189 #define TIMER_INTERVALLOAD_TIMEOUT 0x00000001 // Load TxR register with the value in the TxILR register on next timeout
197 #ifdef DRIVERLIB_DEBUG
213 TimerBaseValid(uint32_t ui32Base)
242 ASSERT(TimerBaseValid(ui32Base));
273 ASSERT(TimerBaseValid(ui32Base));
280 HWREG(ui32Base +
GPT_O_CTL) &= ~(ui32Timer &
337 extern void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config);
386 ASSERT(TimerBaseValid(ui32Base));
395 (ui32Event & ui32Timer));
466 ASSERT(TimerBaseValid(ui32Base));
491 ASSERT(TimerBaseValid(ui32Base));
539 ASSERT(TimerBaseValid(ui32Base));
588 __STATIC_INLINE uint32_t
594 ASSERT(TimerBaseValid(ui32Base));
633 ASSERT(TimerBaseValid(ui32Base));
674 __STATIC_INLINE uint32_t
680 ASSERT(TimerBaseValid(ui32Base));
714 TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
719 ASSERT(TimerBaseValid(ui32Base));
761 __STATIC_INLINE uint32_t
767 ASSERT(TimerBaseValid(ui32Base));
797 __STATIC_INLINE uint32_t
803 ASSERT(TimerBaseValid(ui32Base));
845 ASSERT(TimerBaseValid(ui32Base));
887 __STATIC_INLINE uint32_t
893 ASSERT(TimerBaseValid(ui32Base));
928 void (*pfnHandler)(
void));
981 ASSERT(TimerBaseValid(ui32Base));
986 HWREG(ui32Base +
GPT_O_IMR) |= ui32IntFlags;
1012 __STATIC_INLINE
void
1018 ASSERT(TimerBaseValid(ui32Base));
1023 HWREG(ui32Base +
GPT_O_IMR) &= ~(ui32IntFlags);
1049 __STATIC_INLINE uint32_t
1055 ASSERT(TimerBaseValid(ui32Base));
1061 return(bMasked ? HWREG(ui32Base +
GPT_O_MIS) :
1103 __STATIC_INLINE
void
1109 ASSERT(TimerBaseValid(ui32Base));
1143 __STATIC_INLINE
void
1166 __STATIC_INLINE
void
1170 ASSERT(TimerBaseValid(ui32Base));
1185 __STATIC_INLINE
void
1189 ASSERT(TimerBaseValid(ui32Base));
1254 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1256 #ifdef ROM_TimerConfigure
1257 #undef TimerConfigure
1258 #define TimerConfigure ROM_TimerConfigure
1260 #ifdef ROM_TimerLevelControl
1261 #undef TimerLevelControl
1262 #define TimerLevelControl ROM_TimerLevelControl
1264 #ifdef ROM_TimerStallControl
1265 #undef TimerStallControl
1266 #define TimerStallControl ROM_TimerStallControl
1268 #ifdef ROM_TimerWaitOnTriggerControl
1269 #undef TimerWaitOnTriggerControl
1270 #define TimerWaitOnTriggerControl ROM_TimerWaitOnTriggerControl
1272 #ifdef ROM_TimerIntRegister
1273 #undef TimerIntRegister
1274 #define TimerIntRegister ROM_TimerIntRegister
1276 #ifdef ROM_TimerIntUnregister
1277 #undef TimerIntUnregister
1278 #define TimerIntUnregister ROM_TimerIntUnregister
1280 #ifdef ROM_TimerMatchUpdateMode
1281 #undef TimerMatchUpdateMode
1282 #define TimerMatchUpdateMode ROM_TimerMatchUpdateMode
1284 #ifdef ROM_TimerIntervalLoadMode
1285 #undef TimerIntervalLoadMode
1286 #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 TimerRtcEnable(uint32_t ui32Base)
Enable RTC counting.
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 TimerRtcDisable(uint32_t ui32Base)
Disable RTC counting.
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.