CC13xx Driver Library
timer.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: timer.h
3 * Revised: 2015-09-21 15:19:36 +0200 (Mon, 21 Sep 2015)
4 * Revision: 44629
5 *
6 * Copyright (c) 2015, Texas Instruments Incorporated
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1) Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2) Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 ******************************************************************************/
36 
37 //****************************************************************************
38 //
43 //
44 //****************************************************************************
45 
46 #ifndef __GPT_H__
47 #define __GPT_H__
48 
49 //*****************************************************************************
50 //
51 // If building with a C++ compiler, make all of the definitions in this header
52 // have a C binding.
53 //
54 //*****************************************************************************
55 #ifdef __cplusplus
56 extern "C"
57 {
58 #endif
59 
60 #include <stdbool.h>
61 #include <stdint.h>
62 #include <inc/hw_ints.h>
63 #include <inc/hw_types.h>
64 #include <inc/hw_memmap.h>
65 #include <inc/hw_gpt.h>
66 #include <driverlib/interrupt.h>
67 #include <driverlib/debug.h>
68 
69 //*****************************************************************************
70 //
71 // Support for DriverLib in ROM:
72 // This section renames all functions that are not "static inline", so that
73 // calling these functions will default to implementation in flash. At the end
74 // of this file a second renaming will change the defaults to implementation in
75 // ROM for available functions.
76 //
77 // To force use of the implementation in flash, e.g. for debugging:
78 // - Globally: Define DRIVERLIB_NOROM at project level
79 // - Per function: Use prefix "NOROM_" when calling the function
80 //
81 //*****************************************************************************
82 #if !defined(DOXYGEN)
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
91 #endif
92 
93 //*****************************************************************************
94 //
95 // Values that can be passed to TimerConfigure as the ui32Config parameter.
96 //
97 //*****************************************************************************
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
122 
123 //*****************************************************************************
124 //
125 // Values that can be passed to TimerIntEnable, TimerIntDisable, and
126 // TimerIntClear as the ui32IntFlags parameter, and returned from
127 // TimerIntStatus.
128 //
129 //*****************************************************************************
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
141 
142 //*****************************************************************************
143 //
144 // Values that can be passed to TimerControlEvent as the ui32Event parameter.
145 //
146 //*****************************************************************************
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
150 
151 //*****************************************************************************
152 //
153 // Values that can be passed to most of the timer APIs as the ui32Timer
154 // parameter.
155 //
156 //*****************************************************************************
157 #define TIMER_A 0x000000FF // Timer A
158 #define TIMER_B 0x0000FF00 // Timer B
159 #define TIMER_BOTH 0x0000FFFF // Timer Both
160 
161 //*****************************************************************************
162 //
163 // Values that can be passed to GPTSynchronize as the ui32Timers parameter
164 //
165 //*****************************************************************************
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
174 
175 //*****************************************************************************
176 //
177 // Values that can be passed to TimerMatchUpdateMode
178 //
179 //*****************************************************************************
180 #define TIMER_MATCHUPDATE_NEXTCYCLE 0x00000000 // Apply match register on next cycle
181 #define TIMER_MATCHUPDATE_TIMEOUT 0x00000001 // Apply match register on next timeout
182 
183 //*****************************************************************************
184 //
185 // Values that can be passed to TimerIntervalLoad
186 //
187 //*****************************************************************************
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
190 
191 //*****************************************************************************
192 //
193 // API Functions and prototypes
194 //
195 //*****************************************************************************
196 
197 #ifdef DRIVERLIB_DEBUG
198 //*****************************************************************************
199 //
210 //
211 //*****************************************************************************
212 static bool
213 TimerBaseValid(uint32_t ui32Base)
214 {
215  return((ui32Base == GPT0_BASE) || (ui32Base == GPT1_BASE) ||
216  (ui32Base == GPT2_BASE) || (ui32Base == GPT3_BASE));
217 }
218 #endif
219 
220 //*****************************************************************************
221 //
234 //
235 //*****************************************************************************
236 __STATIC_INLINE void
237 TimerEnable(uint32_t ui32Base, uint32_t ui32Timer)
238 {
239  //
240  // Check the arguments.
241  //
242  ASSERT(TimerBaseValid(ui32Base));
243  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
244  (ui32Timer == TIMER_BOTH));
245 
246  //
247  // Enable the timer(s) module.
248  //
249  HWREG(ui32Base + GPT_O_CTL) |= ui32Timer & (GPT_CTL_TAEN | GPT_CTL_TBEN);
250 }
251 
252 //*****************************************************************************
253 //
265 //
266 //*****************************************************************************
267 __STATIC_INLINE void
268 TimerDisable(uint32_t ui32Base, uint32_t ui32Timer)
269 {
270  //
271  // Check the arguments.
272  //
273  ASSERT(TimerBaseValid(ui32Base));
274  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
275  (ui32Timer == TIMER_BOTH));
276 
277  //
278  // Disable the timer module.
279  //
280  HWREG(ui32Base + GPT_O_CTL) &= ~(ui32Timer &
282 }
283 
284 //*****************************************************************************
285 //
335 //
336 //*****************************************************************************
337 extern void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config);
338 
339 //*****************************************************************************
340 //
355 //
356 //*****************************************************************************
357 extern void TimerLevelControl(uint32_t ui32Base, uint32_t ui32Timer,
358  bool bInvert);
359 
360 //*****************************************************************************
361 //
378 //
379 //*****************************************************************************
380 __STATIC_INLINE void
381 TimerEventControl(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
382 {
383  //
384  // Check the arguments.
385  //
386  ASSERT(TimerBaseValid(ui32Base));
387  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
388  (ui32Timer == TIMER_BOTH));
389 
390  //
391  // Set the event type.
392  //
393  ui32Timer &= GPT_CTL_TAEVENT_M | GPT_CTL_TBEVENT_M;
394  HWREG(ui32Base + GPT_O_CTL) = ((HWREG(ui32Base + GPT_O_CTL) & ~ui32Timer) |
395  (ui32Event & ui32Timer));
396 }
397 
398 //*****************************************************************************
399 //
417 //
418 //*****************************************************************************
419 extern void TimerStallControl(uint32_t ui32Base, uint32_t ui32Timer,
420  bool bStall);
421 
422 //*****************************************************************************
423 //
443 //
444 //*****************************************************************************
445 extern void TimerWaitOnTriggerControl(uint32_t ui32Base, uint32_t ui32Timer,
446  bool bWait);
447 
448 //*****************************************************************************
449 //
458 //
459 //*****************************************************************************
460 __STATIC_INLINE void
461 TimerRtcEnable(uint32_t ui32Base)
462 {
463  //
464  // Check the arguments.
465  //
466  ASSERT(TimerBaseValid(ui32Base));
467 
468  //
469  // Enable RTC counting.
470  //
471  HWREG(ui32Base + GPT_O_CTL) |= GPT_CTL_RTCEN;
472 }
473 
474 //*****************************************************************************
475 //
483 //
484 //*****************************************************************************
485 __STATIC_INLINE void
486 TimerRtcDisable(uint32_t ui32Base)
487 {
488  //
489  // Check the arguments.
490  //
491  ASSERT(TimerBaseValid(ui32Base));
492 
493  //
494  // Disable RTC counting.
495  //
496  HWREG(ui32Base + GPT_O_CTL) &= ~(GPT_CTL_RTCEN);
497 }
498 
499 //*****************************************************************************
500 //
531 //
532 //*****************************************************************************
533 __STATIC_INLINE void
534 TimerPrescaleSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
535 {
536  //
537  // Check the arguments.
538  //
539  ASSERT(TimerBaseValid(ui32Base));
540  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
541  (ui32Timer == TIMER_BOTH));
542  ASSERT(ui32Value < 256);
543 
544  //
545  // Set the timer A prescaler if requested.
546  //
547  if(ui32Timer & TIMER_A)
548  {
549  HWREG(ui32Base + GPT_O_TAPR) = ui32Value;
550  }
551 
552  //
553  // Set the timer B prescaler if requested.
554  //
555  if(ui32Timer & TIMER_B)
556  {
557  HWREG(ui32Base + GPT_O_TBPR) = ui32Value;
558  }
559 }
560 
561 //*****************************************************************************
562 //
586 //
587 //*****************************************************************************
588 __STATIC_INLINE uint32_t
589 TimerPrescaleGet(uint32_t ui32Base, uint32_t ui32Timer)
590 {
591  //
592  // Check the arguments.
593  //
594  ASSERT(TimerBaseValid(ui32Base));
595  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
596  (ui32Timer == TIMER_BOTH));
597 
598  //
599  // Return the appropriate prescale value.
600  //
601  return((ui32Timer == TIMER_A) ? HWREG(ui32Base + GPT_O_TAPR) :
602  HWREG(ui32Base + GPT_O_TBPR));
603 }
604 
605 //*****************************************************************************
606 //
625 //
626 //*****************************************************************************
627 __STATIC_INLINE void
628 TimerPrescaleMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
629 {
630  //
631  // Check the arguments.
632  //
633  ASSERT(TimerBaseValid(ui32Base));
634  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
635  (ui32Timer == TIMER_BOTH));
636  ASSERT(ui32Value < 256);
637 
638  //
639  // Set the timer A prescale match if requested.
640  //
641  if(ui32Timer & TIMER_A)
642  {
643  HWREG(ui32Base + GPT_O_TAPMR) = ui32Value;
644  }
645 
646  //
647  // Set the timer B prescale match if requested.
648  //
649  if(ui32Timer & TIMER_B)
650  {
651  HWREG(ui32Base + GPT_O_TBPMR) = ui32Value;
652  }
653 }
654 
655 //*****************************************************************************
656 //
672 //
673 //*****************************************************************************
674 __STATIC_INLINE uint32_t
675 TimerPrescaleMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
676 {
677  //
678  // Check the arguments.
679  //
680  ASSERT(TimerBaseValid(ui32Base));
681  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B));
682 
683  //
684  // Return the appropriate prescale match value.
685  //
686  return((ui32Timer == TIMER_A) ? HWREG(ui32Base + GPT_O_TAPMR) :
687  HWREG(ui32Base + GPT_O_TBPMR));
688 }
689 
690 //*****************************************************************************
691 //
711 //
712 //*****************************************************************************
713 __STATIC_INLINE void
714 TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
715 {
716  //
717  // Check the arguments.
718  //
719  ASSERT(TimerBaseValid(ui32Base));
720  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
721  (ui32Timer == TIMER_BOTH));
722 
723  //
724  // Set the timer A load value if requested.
725  //
726  if(ui32Timer & TIMER_A)
727  {
728  HWREG(ui32Base + GPT_O_TAILR) = ui32Value;
729  }
730 
731  //
732  // Set the timer B load value if requested.
733  //
734  if(ui32Timer & TIMER_B)
735  {
736  HWREG(ui32Base + GPT_O_TBILR) = ui32Value;
737  }
738 }
739 
740 //*****************************************************************************
741 //
759 //
760 //*****************************************************************************
761 __STATIC_INLINE uint32_t
762 TimerLoadGet(uint32_t ui32Base, uint32_t ui32Timer)
763 {
764  //
765  // Check the arguments.
766  //
767  ASSERT(TimerBaseValid(ui32Base));
768  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B));
769 
770  //
771  // Return the appropriate load value.
772  //
773  return((ui32Timer == TIMER_A) ? HWREG(ui32Base + GPT_O_TAILR) :
774  HWREG(ui32Base + GPT_O_TBILR));
775 }
776 
777 //*****************************************************************************
778 //
795 //
796 //*****************************************************************************
797 __STATIC_INLINE uint32_t
798 TimerValueGet(uint32_t ui32Base, uint32_t ui32Timer)
799 {
800  //
801  // Check the arguments.
802  //
803  ASSERT(TimerBaseValid(ui32Base));
804  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B));
805 
806  //
807  // Return the appropriate timer value.
808  //
809  return((ui32Timer == TIMER_A) ? HWREG(ui32Base + GPT_O_TAR) :
810  HWREG(ui32Base + GPT_O_TBR));
811 }
812 
813 //*****************************************************************************
814 //
837 //
838 //*****************************************************************************
839 __STATIC_INLINE void
840 TimerMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
841 {
842  //
843  // Check the arguments.
844  //
845  ASSERT(TimerBaseValid(ui32Base));
846  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B) ||
847  (ui32Timer == TIMER_BOTH));
848 
849  //
850  // Set the timer A match value if requested.
851  //
852  if(ui32Timer & TIMER_A)
853  {
854  HWREG(ui32Base + GPT_O_TAMATCHR) = ui32Value;
855  }
856 
857  //
858  // Set the timer B match value if requested.
859  //
860  if(ui32Timer & TIMER_B)
861  {
862  HWREG(ui32Base + GPT_O_TBMATCHR) = ui32Value;
863  }
864 }
865 
866 //*****************************************************************************
867 //
885 //
886 //*****************************************************************************
887 __STATIC_INLINE uint32_t
888 TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
889 {
890  //
891  // Check the arguments.
892  //
893  ASSERT(TimerBaseValid(ui32Base));
894  ASSERT((ui32Timer == TIMER_A) || (ui32Timer == TIMER_B));
895 
896  //
897  // Return the appropriate match value.
898  //
899  return((ui32Timer == TIMER_A) ? HWREG(ui32Base + GPT_O_TAMATCHR) :
900  HWREG(ui32Base + GPT_O_TBMATCHR));
901 }
902 
903 //*****************************************************************************
904 //
925 //
926 //*****************************************************************************
927 extern void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer,
928  void (*pfnHandler)(void));
929 
930 //*****************************************************************************
931 //
948 //
949 //*****************************************************************************
950 extern void TimerIntUnregister(uint32_t ui32Base, uint32_t ui32Timer);
951 
952 //*****************************************************************************
953 //
973 //
974 //*****************************************************************************
975 __STATIC_INLINE void
976 TimerIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
977 {
978  //
979  // Check the arguments.
980  //
981  ASSERT(TimerBaseValid(ui32Base));
982 
983  //
984  // Enable the specified interrupts.
985  //
986  HWREG(ui32Base + GPT_O_IMR) |= ui32IntFlags;
987 }
988 
989 //*****************************************************************************
990 //
1010 //
1011 //*****************************************************************************
1012 __STATIC_INLINE void
1013 TimerIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
1014 {
1015  //
1016  // Check the arguments.
1017  //
1018  ASSERT(TimerBaseValid(ui32Base));
1019 
1020  //
1021  // Disable the specified interrupts.
1022  //
1023  HWREG(ui32Base + GPT_O_IMR) &= ~(ui32IntFlags);
1024 }
1025 
1026 //*****************************************************************************
1027 //
1047 //
1048 //*****************************************************************************
1049 __STATIC_INLINE uint32_t
1050 TimerIntStatus(uint32_t ui32Base, bool bMasked)
1051 {
1052  //
1053  // Check the arguments.
1054  //
1055  ASSERT(TimerBaseValid(ui32Base));
1056 
1057  //
1058  // Return either the interrupt status or the raw interrupt status as
1059  // requested.
1060  //
1061  return(bMasked ? HWREG(ui32Base + GPT_O_MIS) :
1062  HWREG(ui32Base + GPT_O_RIS));
1063 }
1064 
1065 //*****************************************************************************
1066 //
1101 //
1102 //*****************************************************************************
1103 __STATIC_INLINE void
1104 TimerIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
1105 {
1106  //
1107  // Check the arguments.
1108  //
1109  ASSERT(TimerBaseValid(ui32Base));
1110 
1111  //
1112  // Clear the requested interrupt sources.
1113  //
1114  HWREG(ui32Base + GPT_O_ICLR) = ui32IntFlags;
1115 }
1116 
1117 //*****************************************************************************
1118 //
1141 //
1142 //*****************************************************************************
1143 __STATIC_INLINE void
1144 TimerSynchronize(uint32_t ui32Base, uint32_t ui32Timers)
1145 {
1146  //
1147  // Check the arguments.
1148  //
1149  ASSERT(ui32Base == GPT0_BASE);
1150 
1151  //
1152  // Synchronize the specified timers.
1153  //
1154  HWREG(ui32Base + GPT_O_SYNC) = ui32Timers;
1155 }
1156 
1157 //*****************************************************************************
1158 //
1164 //
1165 //*****************************************************************************
1166 __STATIC_INLINE void
1167 TimerCcpCombineEnable(uint32_t ui32Base)
1168 {
1169  // Check the arguments
1170  ASSERT(TimerBaseValid(ui32Base));
1171 
1172  // Set the bit
1173  HWREG(ui32Base + GPT_O_ANDCCP) |= GPT_ANDCCP_CCP_AND_EN;
1174 }
1175 
1176 //*****************************************************************************
1177 //
1183 //
1184 //*****************************************************************************
1185 __STATIC_INLINE void
1186 TimerCcpCombineDisable(uint32_t ui32Base)
1187 {
1188  // Check the arguments
1189  ASSERT(TimerBaseValid(ui32Base));
1190 
1191  // Clear the bit
1192  HWREG(ui32Base + GPT_O_ANDCCP) &= ~(GPT_ANDCCP_CCP_AND_EN);
1193 }
1194 
1195 //*****************************************************************************
1196 //
1217 //
1218 //*****************************************************************************
1219 extern void TimerMatchUpdateMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode);
1220 
1221 //*****************************************************************************
1222 //
1244 //
1245 //*****************************************************************************
1246 extern void TimerIntervalLoadMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode);
1247 
1248 //*****************************************************************************
1249 //
1250 // Support for DriverLib in ROM:
1251 // Redirect to implementation in ROM when available.
1252 //
1253 //*****************************************************************************
1254 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1255  #include <driverlib/rom.h>
1256  #ifdef ROM_TimerConfigure
1257  #undef TimerConfigure
1258  #define TimerConfigure ROM_TimerConfigure
1259  #endif
1260  #ifdef ROM_TimerLevelControl
1261  #undef TimerLevelControl
1262  #define TimerLevelControl ROM_TimerLevelControl
1263  #endif
1264  #ifdef ROM_TimerStallControl
1265  #undef TimerStallControl
1266  #define TimerStallControl ROM_TimerStallControl
1267  #endif
1268  #ifdef ROM_TimerWaitOnTriggerControl
1269  #undef TimerWaitOnTriggerControl
1270  #define TimerWaitOnTriggerControl ROM_TimerWaitOnTriggerControl
1271  #endif
1272  #ifdef ROM_TimerIntRegister
1273  #undef TimerIntRegister
1274  #define TimerIntRegister ROM_TimerIntRegister
1275  #endif
1276  #ifdef ROM_TimerIntUnregister
1277  #undef TimerIntUnregister
1278  #define TimerIntUnregister ROM_TimerIntUnregister
1279  #endif
1280  #ifdef ROM_TimerMatchUpdateMode
1281  #undef TimerMatchUpdateMode
1282  #define TimerMatchUpdateMode ROM_TimerMatchUpdateMode
1283  #endif
1284  #ifdef ROM_TimerIntervalLoadMode
1285  #undef TimerIntervalLoadMode
1286  #define TimerIntervalLoadMode ROM_TimerIntervalLoadMode
1287  #endif
1288 #endif
1289 
1290 //*****************************************************************************
1291 //
1292 // Mark the end of the C bindings section for C++ compilers.
1293 //
1294 //*****************************************************************************
1295 #ifdef __cplusplus
1296 }
1297 #endif
1298 
1299 #endif // __GPT_H__
1300 
1301 //*****************************************************************************
1302 //
1306 //
1307 //*****************************************************************************
void TimerWaitOnTriggerControl(uint32_t ui32Base, uint32_t ui32Timer, bool bWait)
Controls the wait on trigger handling.
Definition: timer.c:223
static uint32_t TimerPrescaleMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale match value.
Definition: timer.h:675
static void TimerMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer match value.
Definition: timer.h:840
static uint32_t TimerValueGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the current timer value.
Definition: timer.h:798
static void TimerIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual timer interrupt sources.
Definition: timer.h:1013
void TimerStallControl(uint32_t ui32Base, uint32_t ui32Timer, bool bStall)
Controls the stall handling.
Definition: timer.c:199
void TimerMatchUpdateMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode)
Sets the Match Register Update mode.
Definition: timer.c:379
static void TimerRtcEnable(uint32_t ui32Base)
Enable RTC counting.
Definition: timer.h:461
static void TimerDisable(uint32_t ui32Base, uint32_t ui32Timer)
Disables the timer(s).
Definition: timer.h:268
static uint32_t TimerLoadGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer load value.
Definition: timer.h:762
void TimerIntRegister(uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
Registers an interrupt handler for the timer interrupt.
Definition: timer.c:269
static uint32_t TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer)
Gets the timer match value.
Definition: timer.h:888
static void TimerCcpCombineEnable(uint32_t ui32Base)
Enables AND'ing of the CCP outputs from Timer A and Timer B.
Definition: timer.h:1167
static void TimerIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears timer interrupt sources.
Definition: timer.h:1104
static uint32_t TimerIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current interrupt status.
Definition: timer.h:1050
void TimerConfigure(uint32_t ui32Base, uint32_t ui32Config)
Configures the timer(s).
Definition: timer.c:117
static void TimerEventControl(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
Controls the event type.
Definition: timer.h:381
static void TimerIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual timer interrupt sources.
Definition: timer.h:976
static void TimerRtcDisable(uint32_t ui32Base)
Disable RTC counting.
Definition: timer.h:486
static void TimerPrescaleSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale value.
Definition: timer.h:534
#define ASSERT(expr)
Definition: debug.h:74
#define TIMER_B
Definition: timer.h:158
void TimerIntUnregister(uint32_t ui32Base, uint32_t ui32Timer)
Unregisters an interrupt handler for the timer interrupt.
Definition: timer.c:324
static void TimerEnable(uint32_t ui32Base, uint32_t ui32Timer)
Enables the timer(s).
Definition: timer.h:237
void TimerLevelControl(uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)
Controls the output level.
Definition: timer.c:174
void TimerIntervalLoadMode(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Mode)
Sets the Interval Load mode.
Definition: timer.c:419
#define TIMER_A
Definition: timer.h:157
static void TimerPrescaleMatchSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Set the timer prescale match value.
Definition: timer.h:628
static uint32_t TimerPrescaleGet(uint32_t ui32Base, uint32_t ui32Timer)
Get the timer prescale value.
Definition: timer.h:589
static void TimerSynchronize(uint32_t ui32Base, uint32_t ui32Timers)
Synchronizes the counters in a set of timers.
Definition: timer.h:1144
static void TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
Sets the timer load value.
Definition: timer.h:714
#define TIMER_BOTH
Definition: timer.h:159
static void TimerCcpCombineDisable(uint32_t ui32Base)
Disables AND'ing of the CCP outputs from Timer A and Timer B.
Definition: timer.h:1186