-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhw_gpt.h
1686 lines (1550 loc) · 76.9 KB
/
hw_gpt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
* Filename: hw_gpt_h
* Revised: 2017-01-31 09:37:48 +0100 (Tue, 31 Jan 2017)
* Revision: 48345
*
* Copyright (c) 2015 - 2017, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of the ORGANIZATION nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef __HW_GPT_H__
#define __HW_GPT_H__
//*****************************************************************************
//
// This section defines the register offsets of
// GPT component
//
//*****************************************************************************
// Configuration
#define GPT_O_CFG 0x00000000
// Timer A Mode
#define GPT_O_TAMR 0x00000004
// Timer B Mode
#define GPT_O_TBMR 0x00000008
// Control
#define GPT_O_CTL 0x0000000C
// Synch Register
#define GPT_O_SYNC 0x00000010
// Interrupt Mask
#define GPT_O_IMR 0x00000018
// Raw Interrupt Status
#define GPT_O_RIS 0x0000001C
// Masked Interrupt Status
#define GPT_O_MIS 0x00000020
// Interrupt Clear
#define GPT_O_ICLR 0x00000024
// Timer A Interval Load Register
#define GPT_O_TAILR 0x00000028
// Timer B Interval Load Register
#define GPT_O_TBILR 0x0000002C
// Timer A Match Register
#define GPT_O_TAMATCHR 0x00000030
// Timer B Match Register
#define GPT_O_TBMATCHR 0x00000034
// Timer A Pre-scale
#define GPT_O_TAPR 0x00000038
// Timer B Pre-scale
#define GPT_O_TBPR 0x0000003C
// Timer A Pre-scale Match
#define GPT_O_TAPMR 0x00000040
// Timer B Pre-scale Match
#define GPT_O_TBPMR 0x00000044
// Timer A Register
#define GPT_O_TAR 0x00000048
// Timer B Register
#define GPT_O_TBR 0x0000004C
// Timer A Value
#define GPT_O_TAV 0x00000050
// Timer B Value
#define GPT_O_TBV 0x00000054
// Timer A Pre-scale Snap-shot
#define GPT_O_TAPS 0x0000005C
// Timer B Pre-scale Snap-shot
#define GPT_O_TBPS 0x00000060
// Timer A Pre-scale Value
#define GPT_O_TAPV 0x00000064
// Timer B Pre-scale Value
#define GPT_O_TBPV 0x00000068
// DMA Event
#define GPT_O_DMAEV 0x0000006C
// Peripheral Version
#define GPT_O_VERSION 0x00000FB0
// Combined CCP Output
#define GPT_O_ANDCCP 0x00000FB4
//*****************************************************************************
//
// Register: GPT_O_CFG
//
//*****************************************************************************
// Field: [2:0] CFG
//
// GPT Configuration
// 0x2- 0x3 - Reserved
// 0x5- 0x7 - Reserved
// ENUMs:
// 16BIT_TIMER 16-bit timer configuration.
// Configure for two 16-bit
// timers.
// Also see TAMR.TAMR and
// TBMR.TBMR.
// 32BIT_TIMER 32-bit timer configuration
#define GPT_CFG_CFG_W 3
#define GPT_CFG_CFG_M 0x00000007
#define GPT_CFG_CFG_S 0
#define GPT_CFG_CFG_16BIT_TIMER 0x00000004
#define GPT_CFG_CFG_32BIT_TIMER 0x00000000
//*****************************************************************************
//
// Register: GPT_O_TAMR
//
//*****************************************************************************
// Field: [15:13] TCACT
//
// Timer Compare Action Select
// ENUMs:
// CLRSET_ON_TO Clear CCP output pin immediately and set on
// Time-Out
// SETCLR_ON_TO Set CCP output pin immediately and clear on
// Time-Out
// CLRTOG_ON_TO Clear CCP output pin immediately and toggle on
// Time-Out
// SETTOG_ON_TO Set CCP output pin immediately and toggle on
// Time-Out
// SET_ON_TO Set CCP output pin on Time-Out
// CLR_ON_TO Clear CCP output pin on Time-Out
// TOG_ON_TO Toggle State on Time-Out
// DIS_CMP Disable compare operations
#define GPT_TAMR_TCACT_W 3
#define GPT_TAMR_TCACT_M 0x0000E000
#define GPT_TAMR_TCACT_S 13
#define GPT_TAMR_TCACT_CLRSET_ON_TO 0x0000E000
#define GPT_TAMR_TCACT_SETCLR_ON_TO 0x0000C000
#define GPT_TAMR_TCACT_CLRTOG_ON_TO 0x0000A000
#define GPT_TAMR_TCACT_SETTOG_ON_TO 0x00008000
#define GPT_TAMR_TCACT_SET_ON_TO 0x00006000
#define GPT_TAMR_TCACT_CLR_ON_TO 0x00004000
#define GPT_TAMR_TCACT_TOG_ON_TO 0x00002000
#define GPT_TAMR_TCACT_DIS_CMP 0x00000000
// Field: [12] TACINTD
//
// One-Shot/Periodic Interrupt Disable
// ENUMs:
// DIS_TO_INTR Time-out interrupt are disabled
// EN_TO_INTR Time-out interrupt function as normal
#define GPT_TAMR_TACINTD 0x00001000
#define GPT_TAMR_TACINTD_BITN 12
#define GPT_TAMR_TACINTD_M 0x00001000
#define GPT_TAMR_TACINTD_S 12
#define GPT_TAMR_TACINTD_DIS_TO_INTR 0x00001000
#define GPT_TAMR_TACINTD_EN_TO_INTR 0x00000000
// Field: [11] TAPLO
//
// GPTM Timer A PWM Legacy Operation
//
// 0 Legacy operation with CCP pin driven Low when the TAILR
// register is reloaded after the timer reaches 0.
//
// 1 CCP is driven High when the TAILR register is reloaded after the timer
// reaches 0.
//
// This bit is only valid in PWM mode.
// ENUMs:
// CCP_ON_TO CCP output pin is set to 1 on time-out
// LEGACY Legacy operation
#define GPT_TAMR_TAPLO 0x00000800
#define GPT_TAMR_TAPLO_BITN 11
#define GPT_TAMR_TAPLO_M 0x00000800
#define GPT_TAMR_TAPLO_S 11
#define GPT_TAMR_TAPLO_CCP_ON_TO 0x00000800
#define GPT_TAMR_TAPLO_LEGACY 0x00000000
// Field: [10] TAMRSU
//
// Timer A Match Register Update mode
//
// This bit defines when the TAMATCHR and TAPR registers are updated.
//
// If the timer is disabled (CTL.TAEN = 0) when this bit is set, TAMATCHR and
// TAPR are updated when the timer is enabled.
// If the timer is stalled (CTL.TASTALL = 1) when this bit is set, TAMATCHR and
// TAPR are updated according to the configuration of this bit.
// ENUMs:
// TOUPDATE Update TAMATCHR and TAPR, if used, on the next
// time-out.
// CYCLEUPDATE Update TAMATCHR and TAPR, if used, on the next
// cycle.
#define GPT_TAMR_TAMRSU 0x00000400
#define GPT_TAMR_TAMRSU_BITN 10
#define GPT_TAMR_TAMRSU_M 0x00000400
#define GPT_TAMR_TAMRSU_S 10
#define GPT_TAMR_TAMRSU_TOUPDATE 0x00000400
#define GPT_TAMR_TAMRSU_CYCLEUPDATE 0x00000000
// Field: [9] TAPWMIE
//
// GPTM Timer A PWM Interrupt Enable
// This bit enables interrupts in PWM mode on rising, falling, or both edges of
// the CCP output, as defined by the CTL.TAEVENT
// In addition, when this bit is set and a capture event occurs, Timer A
// automatically generates triggers to the DMA if the trigger capability is
// enabled by setting the CTL.TAOTE bit and the DMAEV.CAEDMAEN bit
// respectively.
//
// 0 Capture event interrupt is disabled.
// 1 Capture event interrupt is enabled.
// This bit is only valid in PWM mode.
// ENUMs:
// EN Interrupt is enabled. This bit is only valid in
// PWM mode.
// DIS Interrupt is disabled.
#define GPT_TAMR_TAPWMIE 0x00000200
#define GPT_TAMR_TAPWMIE_BITN 9
#define GPT_TAMR_TAPWMIE_M 0x00000200
#define GPT_TAMR_TAPWMIE_S 9
#define GPT_TAMR_TAPWMIE_EN 0x00000200
#define GPT_TAMR_TAPWMIE_DIS 0x00000000
// Field: [8] TAILD
//
// GPT Timer A PWM Interval Load Write
// ENUMs:
// TOUPDATE Update the TAR register with the value in the
// TAILR register on the next timeout. If the
// prescaler is used, update the TAPS register
// with the value in the TAPR register on the next
// timeout.
// CYCLEUPDATE Update the TAR register with the value in the
// TAILR register on the next clock cycle. If the
// pre-scaler is used, update the TAPS register
// with the value in the TAPR register on the next
// clock cycle.
#define GPT_TAMR_TAILD 0x00000100
#define GPT_TAMR_TAILD_BITN 8
#define GPT_TAMR_TAILD_M 0x00000100
#define GPT_TAMR_TAILD_S 8
#define GPT_TAMR_TAILD_TOUPDATE 0x00000100
#define GPT_TAMR_TAILD_CYCLEUPDATE 0x00000000
// Field: [7] TASNAPS
//
// GPT Timer A Snap-Shot Mode
// ENUMs:
// EN If Timer A is configured in the periodic mode, the
// actual free-running value of Timer A is loaded
// at the time-out event into the GPT Timer A
// (TAR) register.
// DIS Snap-shot mode is disabled.
#define GPT_TAMR_TASNAPS 0x00000080
#define GPT_TAMR_TASNAPS_BITN 7
#define GPT_TAMR_TASNAPS_M 0x00000080
#define GPT_TAMR_TASNAPS_S 7
#define GPT_TAMR_TASNAPS_EN 0x00000080
#define GPT_TAMR_TASNAPS_DIS 0x00000000
// Field: [6] TAWOT
//
// GPT Timer A Wait-On-Trigger
// ENUMs:
// WAIT If Timer A is enabled (CTL.TAEN = 1), Timer A does
// not begin counting until it receives a trigger
// from the timer in the previous position in the
// daisy chain. This bit must be clear for GPT
// Module 0, Timer A. This function is valid for
// one-shot, periodic, and PWM modes
// NOWAIT Timer A begins counting as soon as it is enabled.
#define GPT_TAMR_TAWOT 0x00000040
#define GPT_TAMR_TAWOT_BITN 6
#define GPT_TAMR_TAWOT_M 0x00000040
#define GPT_TAMR_TAWOT_S 6
#define GPT_TAMR_TAWOT_WAIT 0x00000040
#define GPT_TAMR_TAWOT_NOWAIT 0x00000000
// Field: [5] TAMIE
//
// GPT Timer A Match Interrupt Enable
// ENUMs:
// EN An interrupt is generated when the match value in
// TAMATCHR is reached in the one-shot and
// periodic modes.
// DIS The match interrupt is disabled for match events.
// Additionally, output triggers on match events
// are prevented.
#define GPT_TAMR_TAMIE 0x00000020
#define GPT_TAMR_TAMIE_BITN 5
#define GPT_TAMR_TAMIE_M 0x00000020
#define GPT_TAMR_TAMIE_S 5
#define GPT_TAMR_TAMIE_EN 0x00000020
#define GPT_TAMR_TAMIE_DIS 0x00000000
// Field: [4] TACDIR
//
// GPT Timer A Count Direction
// ENUMs:
// UP The timer counts up. When counting up, the timer
// starts from a value of 0x0.
// DOWN The timer counts down.
#define GPT_TAMR_TACDIR 0x00000010
#define GPT_TAMR_TACDIR_BITN 4
#define GPT_TAMR_TACDIR_M 0x00000010
#define GPT_TAMR_TACDIR_S 4
#define GPT_TAMR_TACDIR_UP 0x00000010
#define GPT_TAMR_TACDIR_DOWN 0x00000000
// Field: [3] TAAMS
//
// GPT Timer A Alternate Mode
//
// Note: To enable PWM mode, you must also clear TACM and then configure TAMR
// field to 0x2.
// ENUMs:
// PWM PWM mode is enabled
// CAP_COMP Capture/Compare mode is enabled.
#define GPT_TAMR_TAAMS 0x00000008
#define GPT_TAMR_TAAMS_BITN 3
#define GPT_TAMR_TAAMS_M 0x00000008
#define GPT_TAMR_TAAMS_S 3
#define GPT_TAMR_TAAMS_PWM 0x00000008
#define GPT_TAMR_TAAMS_CAP_COMP 0x00000000
// Field: [2] TACM
//
// GPT Timer A Capture Mode
// ENUMs:
// EDGTIME Edge-Time mode
// EDGCNT Edge-Count mode
#define GPT_TAMR_TACM 0x00000004
#define GPT_TAMR_TACM_BITN 2
#define GPT_TAMR_TACM_M 0x00000004
#define GPT_TAMR_TACM_S 2
#define GPT_TAMR_TACM_EDGTIME 0x00000004
#define GPT_TAMR_TACM_EDGCNT 0x00000000
// Field: [1:0] TAMR
//
// GPT Timer A Mode
//
// 0x0 Reserved
// 0x1 One-Shot Timer mode
// 0x2 Periodic Timer mode
// 0x3 Capture mode
// The Timer mode is based on the timer configuration defined by bits 2:0 in
// the CFG register
// ENUMs:
// CAPTURE Capture mode
// PERIODIC Periodic Timer mode
// ONE_SHOT One-Shot Timer mode
#define GPT_TAMR_TAMR_W 2
#define GPT_TAMR_TAMR_M 0x00000003
#define GPT_TAMR_TAMR_S 0
#define GPT_TAMR_TAMR_CAPTURE 0x00000003
#define GPT_TAMR_TAMR_PERIODIC 0x00000002
#define GPT_TAMR_TAMR_ONE_SHOT 0x00000001
//*****************************************************************************
//
// Register: GPT_O_TBMR
//
//*****************************************************************************
// Field: [15:13] TCACT
//
// Timer Compare Action Select
// ENUMs:
// CLRSET_ON_TO Clear CCP output pin immediately and set on
// Time-Out
// SETCLR_ON_TO Set CCP output pin immediately and clear on
// Time-Out
// CLRTOG_ON_TO Clear CCP output pin immediately and toggle on
// Time-Out
// SETTOG_ON_TO Set CCP output pin immediately and toggle on
// Time-Out
// SET_ON_TO Set CCP output pin on Time-Out
// CLR_ON_TO Clear CCP output pin on Time-Out
// TOG_ON_TO Toggle State on Time-Out
// DIS_CMP Disable compare operations
#define GPT_TBMR_TCACT_W 3
#define GPT_TBMR_TCACT_M 0x0000E000
#define GPT_TBMR_TCACT_S 13
#define GPT_TBMR_TCACT_CLRSET_ON_TO 0x0000E000
#define GPT_TBMR_TCACT_SETCLR_ON_TO 0x0000C000
#define GPT_TBMR_TCACT_CLRTOG_ON_TO 0x0000A000
#define GPT_TBMR_TCACT_SETTOG_ON_TO 0x00008000
#define GPT_TBMR_TCACT_SET_ON_TO 0x00006000
#define GPT_TBMR_TCACT_CLR_ON_TO 0x00004000
#define GPT_TBMR_TCACT_TOG_ON_TO 0x00002000
#define GPT_TBMR_TCACT_DIS_CMP 0x00000000
// Field: [12] TBCINTD
//
// One-Shot/Periodic Interrupt Mode
// ENUMs:
// DIS_TO_INTR Mask Time-Out Interrupt
// EN_TO_INTR Normal Time-Out Interrupt
#define GPT_TBMR_TBCINTD 0x00001000
#define GPT_TBMR_TBCINTD_BITN 12
#define GPT_TBMR_TBCINTD_M 0x00001000
#define GPT_TBMR_TBCINTD_S 12
#define GPT_TBMR_TBCINTD_DIS_TO_INTR 0x00001000
#define GPT_TBMR_TBCINTD_EN_TO_INTR 0x00000000
// Field: [11] TBPLO
//
// GPTM Timer B PWM Legacy Operation
//
// 0 Legacy operation with CCP pin driven Low when the TBILR
// register is reloaded after the timer reaches 0.
//
// 1 CCP is driven High when the TBILR register is reloaded after the timer
// reaches 0.
//
// This bit is only valid in PWM mode.
// ENUMs:
// CCP_ON_TO CCP output pin is set to 1 on time-out
// LEGACY Legacy operation
#define GPT_TBMR_TBPLO 0x00000800
#define GPT_TBMR_TBPLO_BITN 11
#define GPT_TBMR_TBPLO_M 0x00000800
#define GPT_TBMR_TBPLO_S 11
#define GPT_TBMR_TBPLO_CCP_ON_TO 0x00000800
#define GPT_TBMR_TBPLO_LEGACY 0x00000000
// Field: [10] TBMRSU
//
// Timer B Match Register Update mode
//
// This bit defines when the TBMATCHR and TBPR registers are updated
//
// If the timer is disabled (CTL.TBEN is clear) when this bit is set, TBMATCHR
// and TBPR are updated when the timer is enabled.
// If the timer is stalled (CTL.TBSTALL is set) when this bit is set, TBMATCHR
// and TBPR are updated according to the configuration of this bit.
// ENUMs:
// TOUPDATE Update TBMATCHR and TBPR, if used, on the next
// time-out.
// CYCLEUPDATE Update TBMATCHR and TBPR, if used, on the next
// cycle.
#define GPT_TBMR_TBMRSU 0x00000400
#define GPT_TBMR_TBMRSU_BITN 10
#define GPT_TBMR_TBMRSU_M 0x00000400
#define GPT_TBMR_TBMRSU_S 10
#define GPT_TBMR_TBMRSU_TOUPDATE 0x00000400
#define GPT_TBMR_TBMRSU_CYCLEUPDATE 0x00000000
// Field: [9] TBPWMIE
//
// GPTM Timer B PWM Interrupt Enable
// This bit enables interrupts in PWM mode on rising, falling, or both edges of
// the CCP output, as defined by the CTL.TBEVENT
// In addition, when this bit is set and a capture event occurs, Timer A
// automatically generates triggers to the DMA if the trigger capability is
// enabled by setting the CTL.TBOTE bit and the DMAEV.CBEDMAEN bit
// respectively.
//
// 0 Capture event interrupt is disabled.
// 1 Capture event interrupt is enabled.
// This bit is only valid in PWM mode.
// ENUMs:
// EN Interrupt is enabled. This bit is only valid in
// PWM mode.
// DIS Interrupt is disabled.
#define GPT_TBMR_TBPWMIE 0x00000200
#define GPT_TBMR_TBPWMIE_BITN 9
#define GPT_TBMR_TBPWMIE_M 0x00000200
#define GPT_TBMR_TBPWMIE_S 9
#define GPT_TBMR_TBPWMIE_EN 0x00000200
#define GPT_TBMR_TBPWMIE_DIS 0x00000000
// Field: [8] TBILD
//
// GPT Timer B PWM Interval Load Write
// ENUMs:
// TOUPDATE Update the TBR register with the value in the
// TBILR register on the next timeout. If the
// prescaler is used, update the TBPS register
// with the value in the TBPR register on the next
// timeout.
// CYCLEUPDATE Update the TBR register with the value in the
// TBILR register on the next clock cycle. If the
// pre-scaler is used, update the TBPS register
// with the value in the TBPR register on the next
// clock cycle.
#define GPT_TBMR_TBILD 0x00000100
#define GPT_TBMR_TBILD_BITN 8
#define GPT_TBMR_TBILD_M 0x00000100
#define GPT_TBMR_TBILD_S 8
#define GPT_TBMR_TBILD_TOUPDATE 0x00000100
#define GPT_TBMR_TBILD_CYCLEUPDATE 0x00000000
// Field: [7] TBSNAPS
//
// GPT Timer B Snap-Shot Mode
// ENUMs:
// EN If Timer B is configured in the periodic mode
// DIS Snap-shot mode is disabled.
#define GPT_TBMR_TBSNAPS 0x00000080
#define GPT_TBMR_TBSNAPS_BITN 7
#define GPT_TBMR_TBSNAPS_M 0x00000080
#define GPT_TBMR_TBSNAPS_S 7
#define GPT_TBMR_TBSNAPS_EN 0x00000080
#define GPT_TBMR_TBSNAPS_DIS 0x00000000
// Field: [6] TBWOT
//
// GPT Timer B Wait-On-Trigger
// ENUMs:
// WAIT If Timer B is enabled (CTL.TBEN is set), Timer B
// does not begin counting until it receives a
// trigger from the timer in the previous position
// in the daisy chain. This function is valid for
// one-shot, periodic, and PWM modes
// NOWAIT Timer B begins counting as soon as it is enabled.
#define GPT_TBMR_TBWOT 0x00000040
#define GPT_TBMR_TBWOT_BITN 6
#define GPT_TBMR_TBWOT_M 0x00000040
#define GPT_TBMR_TBWOT_S 6
#define GPT_TBMR_TBWOT_WAIT 0x00000040
#define GPT_TBMR_TBWOT_NOWAIT 0x00000000
// Field: [5] TBMIE
//
// GPT Timer B Match Interrupt Enable.
// ENUMs:
// EN An interrupt is generated when the match value in
// the TBMATCHR register is reached in the
// one-shot and periodic modes.
// DIS The match interrupt is disabled for match events.
// Additionally, output triggers on match events
// are prevented.
#define GPT_TBMR_TBMIE 0x00000020
#define GPT_TBMR_TBMIE_BITN 5
#define GPT_TBMR_TBMIE_M 0x00000020
#define GPT_TBMR_TBMIE_S 5
#define GPT_TBMR_TBMIE_EN 0x00000020
#define GPT_TBMR_TBMIE_DIS 0x00000000
// Field: [4] TBCDIR
//
// GPT Timer B Count Direction
// ENUMs:
// UP The timer counts up. When counting up, the timer
// starts from a value of 0x0.
// DOWN The timer counts down.
#define GPT_TBMR_TBCDIR 0x00000010
#define GPT_TBMR_TBCDIR_BITN 4
#define GPT_TBMR_TBCDIR_M 0x00000010
#define GPT_TBMR_TBCDIR_S 4
#define GPT_TBMR_TBCDIR_UP 0x00000010
#define GPT_TBMR_TBCDIR_DOWN 0x00000000
// Field: [3] TBAMS
//
// GPT Timer B Alternate Mode
//
// Note: To enable PWM mode, you must also clear TBCM bit and configure TBMR
// field to 0x2.
// ENUMs:
// PWM PWM mode is enabled
// CAP_COMP Capture/Compare mode is enabled.
#define GPT_TBMR_TBAMS 0x00000008
#define GPT_TBMR_TBAMS_BITN 3
#define GPT_TBMR_TBAMS_M 0x00000008
#define GPT_TBMR_TBAMS_S 3
#define GPT_TBMR_TBAMS_PWM 0x00000008
#define GPT_TBMR_TBAMS_CAP_COMP 0x00000000
// Field: [2] TBCM
//
// GPT Timer B Capture Mode
// ENUMs:
// EDGTIME Edge-Time mode
// EDGCNT Edge-Count mode
#define GPT_TBMR_TBCM 0x00000004
#define GPT_TBMR_TBCM_BITN 2
#define GPT_TBMR_TBCM_M 0x00000004
#define GPT_TBMR_TBCM_S 2
#define GPT_TBMR_TBCM_EDGTIME 0x00000004
#define GPT_TBMR_TBCM_EDGCNT 0x00000000
// Field: [1:0] TBMR
//
// GPT Timer B Mode
//
// 0x0 Reserved
// 0x1 One-Shot Timer mode
// 0x2 Periodic Timer mode
// 0x3 Capture mode
// The Timer mode is based on the timer configuration defined by bits 2:0 in
// the CFG register
// ENUMs:
// CAPTURE Capture mode
// PERIODIC Periodic Timer mode
// ONE_SHOT One-Shot Timer mode
#define GPT_TBMR_TBMR_W 2
#define GPT_TBMR_TBMR_M 0x00000003
#define GPT_TBMR_TBMR_S 0
#define GPT_TBMR_TBMR_CAPTURE 0x00000003
#define GPT_TBMR_TBMR_PERIODIC 0x00000002
#define GPT_TBMR_TBMR_ONE_SHOT 0x00000001
//*****************************************************************************
//
// Register: GPT_O_CTL
//
//*****************************************************************************
// Field: [14] TBPWML
//
// GPT Timer B PWM Output Level
//
// 0: Output is unaffected.
// 1: Output is inverted.
// ENUMs:
// INVERTED Inverted
// NORMAL Not inverted
#define GPT_CTL_TBPWML 0x00004000
#define GPT_CTL_TBPWML_BITN 14
#define GPT_CTL_TBPWML_M 0x00004000
#define GPT_CTL_TBPWML_S 14
#define GPT_CTL_TBPWML_INVERTED 0x00004000
#define GPT_CTL_TBPWML_NORMAL 0x00000000
// Field: [11:10] TBEVENT
//
// GPT Timer B Event Mode
//
// The values in this register are defined as follows:
// Value Description
// 0x0 Positive edge
// 0x1 Negative edge
// 0x2 Reserved
// 0x3 Both edges
// Note: If PWM output inversion is enabled, edge detection interrupt
// behavior is reversed. Thus, if a positive-edge interrupt trigger
// has been set and the PWM inversion generates a postive
// edge, no event-trigger interrupt asserts. Instead, the interrupt
// is generated on the negative edge of the PWM signal.
// ENUMs:
// BOTH Both edges
// NEG Negative edge
// POS Positive edge
#define GPT_CTL_TBEVENT_W 2
#define GPT_CTL_TBEVENT_M 0x00000C00
#define GPT_CTL_TBEVENT_S 10
#define GPT_CTL_TBEVENT_BOTH 0x00000C00
#define GPT_CTL_TBEVENT_NEG 0x00000400
#define GPT_CTL_TBEVENT_POS 0x00000000
// Field: [9] TBSTALL
//
// GPT Timer B Stall Enable
// ENUMs:
// EN Timer B freezes counting while the processor is
// halted by the debugger.
// DIS Timer B continues counting while the processor is
// halted by the debugger.
#define GPT_CTL_TBSTALL 0x00000200
#define GPT_CTL_TBSTALL_BITN 9
#define GPT_CTL_TBSTALL_M 0x00000200
#define GPT_CTL_TBSTALL_S 9
#define GPT_CTL_TBSTALL_EN 0x00000200
#define GPT_CTL_TBSTALL_DIS 0x00000000
// Field: [8] TBEN
//
// GPT Timer B Enable
// ENUMs:
// EN Timer B is enabled and begins counting or the
// capture logic is enabled based on CFG register.
// DIS Timer B is disabled.
#define GPT_CTL_TBEN 0x00000100
#define GPT_CTL_TBEN_BITN 8
#define GPT_CTL_TBEN_M 0x00000100
#define GPT_CTL_TBEN_S 8
#define GPT_CTL_TBEN_EN 0x00000100
#define GPT_CTL_TBEN_DIS 0x00000000
// Field: [6] TAPWML
//
// GPT Timer A PWM Output Level
// ENUMs:
// INVERTED Inverted
// NORMAL Not inverted
#define GPT_CTL_TAPWML 0x00000040
#define GPT_CTL_TAPWML_BITN 6
#define GPT_CTL_TAPWML_M 0x00000040
#define GPT_CTL_TAPWML_S 6
#define GPT_CTL_TAPWML_INVERTED 0x00000040
#define GPT_CTL_TAPWML_NORMAL 0x00000000
// Field: [3:2] TAEVENT
//
// GPT Timer A Event Mode
//
// The values in this register are defined as follows:
// Value Description
// 0x0 Positive edge
// 0x1 Negative edge
// 0x2 Reserved
// 0x3 Both edges
// Note: If PWM output inversion is enabled, edge detection interrupt
// behavior is reversed. Thus, if a positive-edge interrupt trigger
// has been set and the PWM inversion generates a postive
// edge, no event-trigger interrupt asserts. Instead, the interrupt
// is generated on the negative edge of the PWM signal.
// ENUMs:
// BOTH Both edges
// NEG Negative edge
// POS Positive edge
#define GPT_CTL_TAEVENT_W 2
#define GPT_CTL_TAEVENT_M 0x0000000C
#define GPT_CTL_TAEVENT_S 2
#define GPT_CTL_TAEVENT_BOTH 0x0000000C
#define GPT_CTL_TAEVENT_NEG 0x00000004
#define GPT_CTL_TAEVENT_POS 0x00000000
// Field: [1] TASTALL
//
// GPT Timer A Stall Enable
// ENUMs:
// EN Timer A freezes counting while the processor is
// halted by the debugger.
// DIS Timer A continues counting while the processor is
// halted by the debugger.
#define GPT_CTL_TASTALL 0x00000002
#define GPT_CTL_TASTALL_BITN 1
#define GPT_CTL_TASTALL_M 0x00000002
#define GPT_CTL_TASTALL_S 1
#define GPT_CTL_TASTALL_EN 0x00000002
#define GPT_CTL_TASTALL_DIS 0x00000000
// Field: [0] TAEN
//
// GPT Timer A Enable
// ENUMs:
// EN Timer A is enabled and begins counting or the
// capture logic is enabled based on the CFG
// register.
// DIS Timer A is disabled.
#define GPT_CTL_TAEN 0x00000001
#define GPT_CTL_TAEN_BITN 0
#define GPT_CTL_TAEN_M 0x00000001
#define GPT_CTL_TAEN_S 0
#define GPT_CTL_TAEN_EN 0x00000001
#define GPT_CTL_TAEN_DIS 0x00000000
//*****************************************************************************
//
// Register: GPT_O_SYNC
//
//*****************************************************************************
// Field: [7:6] SYNC3
//
// Synchronize GPT Timer 3.
// ENUMs:
// BOTH A timeout event for both Timer A and Timer B of
// GPT3 is triggered
// TIMERB A timeout event for Timer B of GPT3 is triggered
// TIMERA A timeout event for Timer A of GPT3 is triggered
// NOSYNC No Sync. GPT3 is not affected.
#define GPT_SYNC_SYNC3_W 2
#define GPT_SYNC_SYNC3_M 0x000000C0
#define GPT_SYNC_SYNC3_S 6
#define GPT_SYNC_SYNC3_BOTH 0x000000C0
#define GPT_SYNC_SYNC3_TIMERB 0x00000080
#define GPT_SYNC_SYNC3_TIMERA 0x00000040
#define GPT_SYNC_SYNC3_NOSYNC 0x00000000
// Field: [5:4] SYNC2
//
// Synchronize GPT Timer 2.
// ENUMs:
// BOTH A timeout event for both Timer A and Timer B of
// GPT2 is triggered
// TIMERB A timeout event for Timer B of GPT2 is triggered
// TIMERA A timeout event for Timer A of GPT2 is triggered
// NOSYNC No Sync. GPT2 is not affected.
#define GPT_SYNC_SYNC2_W 2
#define GPT_SYNC_SYNC2_M 0x00000030
#define GPT_SYNC_SYNC2_S 4
#define GPT_SYNC_SYNC2_BOTH 0x00000030
#define GPT_SYNC_SYNC2_TIMERB 0x00000020
#define GPT_SYNC_SYNC2_TIMERA 0x00000010
#define GPT_SYNC_SYNC2_NOSYNC 0x00000000
// Field: [3:2] SYNC1
//
// Synchronize GPT Timer 1
// ENUMs:
// BOTH A timeout event for both Timer A and Timer B of
// GPT1 is triggered
// TIMERB A timeout event for Timer B of GPT1 is triggered
// TIMERA A timeout event for Timer A of GPT1 is triggered
// NOSYNC No Sync. GPT1 is not affected.
#define GPT_SYNC_SYNC1_W 2
#define GPT_SYNC_SYNC1_M 0x0000000C
#define GPT_SYNC_SYNC1_S 2
#define GPT_SYNC_SYNC1_BOTH 0x0000000C
#define GPT_SYNC_SYNC1_TIMERB 0x00000008
#define GPT_SYNC_SYNC1_TIMERA 0x00000004
#define GPT_SYNC_SYNC1_NOSYNC 0x00000000
// Field: [1:0] SYNC0
//
// Synchronize GPT Timer 0
// ENUMs:
// BOTH A timeout event for both Timer A and Timer B of
// GPT0 is triggered
// TIMERB A timeout event for Timer B of GPT0 is triggered
// TIMERA A timeout event for Timer A of GPT0 is triggered
// NOSYNC No Sync. GPT0 is not affected.
#define GPT_SYNC_SYNC0_W 2
#define GPT_SYNC_SYNC0_M 0x00000003
#define GPT_SYNC_SYNC0_S 0
#define GPT_SYNC_SYNC0_BOTH 0x00000003
#define GPT_SYNC_SYNC0_TIMERB 0x00000002
#define GPT_SYNC_SYNC0_TIMERA 0x00000001
#define GPT_SYNC_SYNC0_NOSYNC 0x00000000
//*****************************************************************************
//
// Register: GPT_O_IMR
//
//*****************************************************************************
// Field: [13] DMABIM
//
// Enabling this bit will make the RIS.DMABRIS interrupt propagate to
// MIS.DMABMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_DMABIM 0x00002000
#define GPT_IMR_DMABIM_BITN 13
#define GPT_IMR_DMABIM_M 0x00002000
#define GPT_IMR_DMABIM_S 13
#define GPT_IMR_DMABIM_EN 0x00002000
#define GPT_IMR_DMABIM_DIS 0x00000000
// Field: [11] TBMIM
//
// Enabling this bit will make the RIS.TBMRIS interrupt propagate to MIS.TBMMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_TBMIM 0x00000800
#define GPT_IMR_TBMIM_BITN 11
#define GPT_IMR_TBMIM_M 0x00000800
#define GPT_IMR_TBMIM_S 11
#define GPT_IMR_TBMIM_EN 0x00000800
#define GPT_IMR_TBMIM_DIS 0x00000000
// Field: [10] CBEIM
//
// Enabling this bit will make the RIS.CBERIS interrupt propagate to MIS.CBEMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_CBEIM 0x00000400
#define GPT_IMR_CBEIM_BITN 10
#define GPT_IMR_CBEIM_M 0x00000400
#define GPT_IMR_CBEIM_S 10
#define GPT_IMR_CBEIM_EN 0x00000400
#define GPT_IMR_CBEIM_DIS 0x00000000
// Field: [9] CBMIM
//
// Enabling this bit will make the RIS.CBMRIS interrupt propagate to MIS.CBMMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_CBMIM 0x00000200
#define GPT_IMR_CBMIM_BITN 9
#define GPT_IMR_CBMIM_M 0x00000200
#define GPT_IMR_CBMIM_S 9
#define GPT_IMR_CBMIM_EN 0x00000200
#define GPT_IMR_CBMIM_DIS 0x00000000
// Field: [8] TBTOIM
//
// Enabling this bit will make the RIS.TBTORIS interrupt propagate to
// MIS.TBTOMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_TBTOIM 0x00000100
#define GPT_IMR_TBTOIM_BITN 8
#define GPT_IMR_TBTOIM_M 0x00000100
#define GPT_IMR_TBTOIM_S 8
#define GPT_IMR_TBTOIM_EN 0x00000100
#define GPT_IMR_TBTOIM_DIS 0x00000000
// Field: [5] DMAAIM
//
// Enabling this bit will make the RIS.DMAARIS interrupt propagate to
// MIS.DMAAMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_DMAAIM 0x00000020
#define GPT_IMR_DMAAIM_BITN 5
#define GPT_IMR_DMAAIM_M 0x00000020
#define GPT_IMR_DMAAIM_S 5
#define GPT_IMR_DMAAIM_EN 0x00000020
#define GPT_IMR_DMAAIM_DIS 0x00000000
// Field: [4] TAMIM
//
// Enabling this bit will make the RIS.TAMRIS interrupt propagate to MIS.TAMMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_TAMIM 0x00000010
#define GPT_IMR_TAMIM_BITN 4
#define GPT_IMR_TAMIM_M 0x00000010
#define GPT_IMR_TAMIM_S 4
#define GPT_IMR_TAMIM_EN 0x00000010
#define GPT_IMR_TAMIM_DIS 0x00000000
// Field: [2] CAEIM
//
// Enabling this bit will make the RIS.CAERIS interrupt propagate to MIS.CAEMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_CAEIM 0x00000004
#define GPT_IMR_CAEIM_BITN 2
#define GPT_IMR_CAEIM_M 0x00000004
#define GPT_IMR_CAEIM_S 2
#define GPT_IMR_CAEIM_EN 0x00000004
#define GPT_IMR_CAEIM_DIS 0x00000000
// Field: [1] CAMIM
//
// Enabling this bit will make the RIS.CAMRIS interrupt propagate to MIS.CAMMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_CAMIM 0x00000002
#define GPT_IMR_CAMIM_BITN 1
#define GPT_IMR_CAMIM_M 0x00000002
#define GPT_IMR_CAMIM_S 1
#define GPT_IMR_CAMIM_EN 0x00000002
#define GPT_IMR_CAMIM_DIS 0x00000000
// Field: [0] TATOIM
//
// Enabling this bit will make the RIS.TATORIS interrupt propagate to
// MIS.TATOMIS
// ENUMs:
// EN Enable Interrupt
// DIS Disable Interrupt
#define GPT_IMR_TATOIM 0x00000001
#define GPT_IMR_TATOIM_BITN 0
#define GPT_IMR_TATOIM_M 0x00000001
#define GPT_IMR_TATOIM_S 0