-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathepwm.h
7730 lines (7282 loc) · 249 KB
/
epwm.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
//#############################################################################
//
// FILE: epwm.h
//
// TITLE: C28x EPWM Driver
//
//#############################################################################
// $TI Release: F28004x Support Library v1.11.00.00 $
// $Release Date: Sun Oct 4 15:49:15 IST 2020 $
// $Copyright:
// Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 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.
//
// Neither the name of Texas Instruments Incorporated 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
// OWNER 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 EPWM_H
#define EPWM_H
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//! \addtogroup epwm_api ePWM
//! @{
//
//*****************************************************************************
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_epwm.h"
#include "cpu.h"
#include "debug.h"
//
// Time Base Module
//
//*****************************************************************************
//
//! Values that can be passed to EPWM_setEmulationMode() as the
//! \e emulationMode parameter.
//
//*****************************************************************************
typedef enum
{
//! Stop after next Time Base counter increment or decrement.
EPWM_EMULATION_STOP_AFTER_NEXT_TB = 0,
//! Stop when counter completes whole cycle
EPWM_EMULATION_STOP_AFTER_FULL_CYCLE = 1,
//! Free run
EPWM_EMULATION_FREE_RUN = 2
} EPWM_EmulationMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setCountModeAfterSync() as the
//! \e mode parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_COUNT_MODE_DOWN_AFTER_SYNC = 0, //!< Count down after sync event
EPWM_COUNT_MODE_UP_AFTER_SYNC = 1 //!< Count up after sync event
} EPWM_SyncCountMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setClockPrescaler() as the
//! \e prescaler parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_CLOCK_DIVIDER_1 = 0, //!< Divide clock by 1
EPWM_CLOCK_DIVIDER_2 = 1, //!< Divide clock by 2
EPWM_CLOCK_DIVIDER_4 = 2, //!< Divide clock by 4
EPWM_CLOCK_DIVIDER_8 = 3, //!< Divide clock by 8
EPWM_CLOCK_DIVIDER_16 = 4, //!< Divide clock by 16
EPWM_CLOCK_DIVIDER_32 = 5, //!< Divide clock by 32
EPWM_CLOCK_DIVIDER_64 = 6, //!< Divide clock by 64
EPWM_CLOCK_DIVIDER_128 = 7 //!< Divide clock by 128
} EPWM_ClockDivider;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setClockPrescaler() as the
//! \e highSpeedPrescaler parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_HSCLOCK_DIVIDER_1 = 0, //!< Divide clock by 1
EPWM_HSCLOCK_DIVIDER_2 = 1, //!< Divide clock by 2
EPWM_HSCLOCK_DIVIDER_4 = 2, //!< Divide clock by 4
EPWM_HSCLOCK_DIVIDER_6 = 3, //!< Divide clock by 6
EPWM_HSCLOCK_DIVIDER_8 = 4, //!< Divide clock by 8
EPWM_HSCLOCK_DIVIDER_10 = 5, //!< Divide clock by 10
EPWM_HSCLOCK_DIVIDER_12 = 6, //!< Divide clock by 12
EPWM_HSCLOCK_DIVIDER_14 = 7 //!< Divide clock by 14
} EPWM_HSClockDivider;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setSyncOutPulseMode() as the \e mode
//! parameter.
//
//*****************************************************************************
typedef enum
{
//! sync pulse is generated by software
EPWM_SYNC_OUT_PULSE_ON_SOFTWARE = 0,
//! sync pulse is passed from EPWMxSYNCIN
EPWM_SYNC_OUT_PULSE_ON_EPWMxSYNCIN = 0,
//! sync pulse is generated when time base counter equals zero
EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO = 1,
//! sync pulse is generated when time base counter equals compare B value.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_B = 2,
//! sync pulse is disabled
EPWM_SYNC_OUT_PULSE_DISABLED = 4,
//! sync pulse is generated when time base counter equals compare D value.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_C = 5,
//! sync pulse is disabled.
EPWM_SYNC_OUT_PULSE_ON_COUNTER_COMPARE_D = 6
} EPWM_SyncOutPulseMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setPeriodLoadMode() as the
//! \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! PWM Period register access is through shadow register
EPWM_PERIOD_SHADOW_LOAD = 0,
//! PWM Period register access is directly
EPWM_PERIOD_DIRECT_LOAD = 1
} EPWM_PeriodLoadMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTimeBaseCounterMode() as the
//! \e counterMode parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_COUNTER_MODE_UP = 0, //!< Up - count mode.
EPWM_COUNTER_MODE_DOWN = 1, //!< Down - count mode.
EPWM_COUNTER_MODE_UP_DOWN = 2, //!< Up - down - count mode.
EPWM_COUNTER_MODE_STOP_FREEZE = 3 //!< Stop - Freeze counter.
} EPWM_TimeBaseCountMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_selectPeriodLoadEvent() as the
//! \e shadowLoadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! shadow to active load occurs when time base counter reaches 0.
EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO = 0,
//! shadow to active load occurs when time base counter reaches 0 and a
//! SYNC occurs
EPWM_SHADOW_LOAD_MODE_COUNTER_SYNC = 1,
//! shadow to active load occurs only when a SYNC occurs
EPWM_SHADOW_LOAD_MODE_SYNC = 2
} EPWM_PeriodShadowLoadMode;
//*****************************************************************************
//
// Values that can be returned by the EPWM_getTimeBaseCounterDirection()
//
//*****************************************************************************
//! Time base counter is counting up
//!
#define EPWM_TIME_BASE_STATUS_COUNT_UP 1U
//! Time base counter is counting down
//!
#define EPWM_TIME_BASE_STATUS_COUNT_DOWN 0U
//*****************************************************************************
//
//! Values that can be passed to EPWM_setupEPWMLinks() as the \e epwmLink
//! parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_LINK_WITH_EPWM_1 = 0, //!< link current ePWM with ePWM1
EPWM_LINK_WITH_EPWM_2 = 1, //!< link current ePWM with ePWM2
EPWM_LINK_WITH_EPWM_3 = 2, //!< link current ePWM with ePWM3
EPWM_LINK_WITH_EPWM_4 = 3, //!< link current ePWM with ePWM4
EPWM_LINK_WITH_EPWM_5 = 4, //!< link current ePWM with ePWM5
EPWM_LINK_WITH_EPWM_6 = 5, //!< link current ePWM with ePWM6
EPWM_LINK_WITH_EPWM_7 = 6, //!< link current ePWM with ePWM7
EPWM_LINK_WITH_EPWM_8 = 7 //!< link current ePWM with ePWM8
} EPWM_CurrentLink;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setupEPWMLinks() as the \e linkComp
//! parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_LINK_TBPRD = 0, //!< link TBPRD:TBPRDHR registers
EPWM_LINK_COMP_A = 4, //!< link COMPA registers
EPWM_LINK_COMP_B = 8, //!< link COMPB registers
EPWM_LINK_COMP_C = 12, //!< link COMPC registers
EPWM_LINK_COMP_D = 16, //!< link COMPD registers
EPWM_LINK_GLDCTL2 = 28 //!< link GLDCTL2 registers
} EPWM_LinkComponent;
//
// Counter Compare Module
//
//*****************************************************************************
//
//! Values that can be passed to the EPWM_getCounterCompareShadowStatus(),
//! EPWM_setCounterCompareValue(), EPWM_setCounterCompareShadowLoadMode(),
//! EPWM_disableCounterCompareShadowLoadMode()
//! as the \e compModule parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_COUNTER_COMPARE_A = 0, //!< counter compare A
EPWM_COUNTER_COMPARE_B = 2, //!< counter compare B
EPWM_COUNTER_COMPARE_C = 5, //!< counter compare C
EPWM_COUNTER_COMPARE_D = 7 //!< counter compare D
} EPWM_CounterCompareModule;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setCounterCompareShadowLoadMode() as the
//! \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! load when counter equals zero
EPWM_COMP_LOAD_ON_CNTR_ZERO = 0,
//! load when counter equals period
EPWM_COMP_LOAD_ON_CNTR_PERIOD = 1,
//! load when counter equals zero or period
EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! Freeze shadow to active load
EPWM_COMP_LOAD_FREEZE = 3,
//! load when counter equals zero
EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO = 4,
//! load when counter equals period
EPWM_COMP_LOAD_ON_SYNC_CNTR_PERIOD = 5,
//! load when counter equals zero or period
EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO_PERIOD = 6,
//! load on sync only
EPWM_COMP_LOAD_ON_SYNC_ONLY = 8
} EPWM_CounterCompareLoadMode;
//
// Action Qualifier Module
//
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierShadowLoadMode() and
//! EPWM_disableActionQualifierShadowLoadMode() as the \e aqModule parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_ACTION_QUALIFIER_A = 0, //!< Action Qualifier A
EPWM_ACTION_QUALIFIER_B = 2 //!< Action Qualifier B
} EPWM_ActionQualifierModule;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierShadowLoadMode() as the
//! \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! load when counter equals zero
EPWM_AQ_LOAD_ON_CNTR_ZERO = 0,
//! load when counter equals period
EPWM_AQ_LOAD_ON_CNTR_PERIOD = 1,
//! load when counter equals zero or period
EPWM_AQ_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! Freeze shadow to active load
EPWM_AQ_LOAD_FREEZE = 3,
//! load on sync or when counter equals zero
EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO = 4,
//! load on sync or when counter equals period
EPWM_AQ_LOAD_ON_SYNC_CNTR_PERIOD = 5,
//! load on sync or when counter equals zero or period
EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO_PERIOD = 6,
//! load on sync only
EPWM_AQ_LOAD_ON_SYNC_ONLY = 8
} EPWM_ActionQualifierLoadMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierT1TriggerSource() and
//! EPWM_setActionQualifierT2TriggerSource() as the \e trigger parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1 = 0, //!< Digital compare event A 1
EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_2 = 1, //!< Digital compare event A 2
EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_1 = 2, //!< Digital compare event B 1
EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_2 = 3, //!< Digital compare event B 2
EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_1 = 4, //!< Trip zone 1
EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_2 = 5, //!< Trip zone 2
EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_3 = 6, //!< Trip zone 3
EPWM_AQ_TRIGGER_EVENT_TRIG_EPWM_SYNCIN = 7,//!< ePWM sync
EPWM_AQ_TRIGGER_EVENT_TRIG_DC_EVTFILT = 8 //!< Digital compare filter event
} EPWM_ActionQualifierTriggerSource;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierAction() as the \e
//! event parameter.
//
//*****************************************************************************
typedef enum
{
//! Time base counter equals zero
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO = 0,
//! Time base counter equals period
EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD = 2,
//! Time base counter up equals COMPA
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA = 4,
//! Time base counter down equals COMPA
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA = 6,
//! Time base counter up equals COMPB
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB = 8,
//! Time base counter down equals COMPB
EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB = 10,
//! T1 event on count up
EPWM_AQ_OUTPUT_ON_T1_COUNT_UP = 1,
//! T1 event on count down
EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN = 3,
//! T2 event on count up
EPWM_AQ_OUTPUT_ON_T2_COUNT_UP = 5,
//! T2 event on count down
EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN = 7
} EPWM_ActionQualifierOutputEvent;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierSWAction(),
//! EPWM_setActionQualifierAction() as the \e outPut parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_AQ_OUTPUT_NO_CHANGE = 0, //!< No change in the output pins
EPWM_AQ_OUTPUT_LOW = 1, //!< Set output pins to low
EPWM_AQ_OUTPUT_HIGH = 2, //!< Set output pins to High
EPWM_AQ_OUTPUT_TOGGLE = 3 //!< Toggle the output pins
} EPWM_ActionQualifierOutput;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierContSWForceAction()
//! as the \e outPut parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_AQ_SW_DISABLED = 0, //!< Software forcing disabled
EPWM_AQ_SW_OUTPUT_LOW = 1, //!< Set output pins to low
EPWM_AQ_SW_OUTPUT_HIGH = 2 //!< Set output pins to High
} EPWM_ActionQualifierSWOutput;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierActionComplete()
//! as the \e action parameter.
//
//*****************************************************************************
typedef enum
{
//! Time base counter equals zero and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_ZERO = 0x0,
//! Time base counter equals zero and set output pins to low
EPWM_AQ_OUTPUT_LOW_ZERO = 0x1,
//! Time base counter equals zero and set output pins to high
EPWM_AQ_OUTPUT_HIGH_ZERO = 0x2,
//! Time base counter equals zero and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_ZERO = 0x3,
//! Time base counter equals period and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_PERIOD = 0x0,
//! Time base counter equals period and set output pins to low
EPWM_AQ_OUTPUT_LOW_PERIOD = 0x4,
//! Time base counter equals period and set output pins to high
EPWM_AQ_OUTPUT_HIGH_PERIOD = 0x8,
//! Time base counter equals period and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_PERIOD = 0xC,
//! Time base counter up equals COMPA and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPA = 0x00,
//! Time base counter up equals COMPA and set output pins to low
EPWM_AQ_OUTPUT_LOW_UP_CMPA = 0x10,
//! Time base counter up equals COMPA and set output pins to high
EPWM_AQ_OUTPUT_HIGH_UP_CMPA = 0x20,
//! Time base counter up equals COMPA and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_UP_CMPA = 0x30,
//! Time base counter down equals COMPA and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPA = 0x00,
//! Time base counter down equals COMPA and set output pins to low
EPWM_AQ_OUTPUT_LOW_DOWN_CMPA = 0x40,
//! Time base counter down equals COMPA and set output pins to high
EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA = 0x80,
//! Time base counter down equals COMPA and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPA = 0xC0,
//! Time base counter up equals COMPB and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPB = 0x000,
//! Time base counter up equals COMPB and set output pins to low
EPWM_AQ_OUTPUT_LOW_UP_CMPB = 0x100,
//! Time base counter up equals COMPB and set output pins to high
EPWM_AQ_OUTPUT_HIGH_UP_CMPB = 0x200,
//! Time base counter up equals COMPB and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_UP_CMPB = 0x300,
//! Time base counter down equals COMPB and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPB = 0x000,
//! Time base counter down equals COMPB and set output pins to low
EPWM_AQ_OUTPUT_LOW_DOWN_CMPB = 0x400,
//! Time base counter down equals COMPB and set output pins to high
EPWM_AQ_OUTPUT_HIGH_DOWN_CMPB = 0x800,
//! Time base counter down equals COMPB and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPB = 0xC00
} EPWM_ActionQualifierEventAction;
//*****************************************************************************
//
//! Values that can be passed to
//! EPWM_setAdditionalActionQualifierActionComplete() as the \e action
//! parameter.
//
//*****************************************************************************
typedef enum
{
//! T1 event on count up and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_UP_T1 = 0x0,
//! T1 event on count up and set output pins to low
EPWM_AQ_OUTPUT_LOW_UP_T1 = 0x1,
//! T1 event on count up and set output pins to high
EPWM_AQ_OUTPUT_HIGH_UP_T1 = 0x2,
//! T1 event on count up and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_UP_T1 = 0x3,
//! T1 event on count down and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T1 = 0x0,
//! T1 event on count down and set output pins to low
EPWM_AQ_OUTPUT_LOW_DOWN_T1 = 0x4,
//! T1 event on count down and set output pins to high
EPWM_AQ_OUTPUT_HIGH_DOWN_T1 = 0x8,
//! T1 event on count down and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_DOWN_T1 = 0xC,
//! T2 event on count up and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_UP_T2 = 0x00,
//! T2 event on count up and set output pins to low
EPWM_AQ_OUTPUT_LOW_UP_T2 = 0x10,
//! T2 event on count up and set output pins to high
EPWM_AQ_OUTPUT_HIGH_UP_T2 = 0x20,
//! T2 event on count up and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_UP_T2 = 0x30,
//! T2 event on count down and no change in the output pins
EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T2 = 0x00,
//! T2 event on count down and set output pins to low
EPWM_AQ_OUTPUT_LOW_DOWN_T2 = 0x40,
//! T2 event on count down and set output pins to high
EPWM_AQ_OUTPUT_HIGH_DOWN_T2 = 0x80,
//! T2 event on count down and toggle the output pins
EPWM_AQ_OUTPUT_TOGGLE_DOWN_T2 = 0xC0
} EPWM_AdditionalActionQualifierEventAction;
//*****************************************************************************
//
//! Values that can be passed to EPWM_forceActionQualifierSWAction(),
//! EPWM_setActionQualifierSWAction(), EPWM_setActionQualifierAction()
//! EPWM_setActionQualifierContSWForceAction() as the \e epwmOutput parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_AQ_OUTPUT_A = 0, //!< ePWMxA output
#ifndef __TMS320C2000__
EPWM_AQ_OUTPUT_B = 2 //!< ePWMxB output
#else
EPWM_AQ_OUTPUT_B = 1 //!< ePWMxB output for F2806x
#endif
} EPWM_ActionQualifierOutputModule;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setActionQualifierContSWForceShadowMode()
//! as the \e mode parameter.
//
//*****************************************************************************
typedef enum
{
//! shadow mode load when counter equals zero
EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO = 0,
//! shadow mode load when counter equals period
EPWM_AQ_SW_SH_LOAD_ON_CNTR_PERIOD = 1,
//! shadow mode load when counter equals zero or period
EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! No shadow load mode. Immediate mode only.
EPWM_AQ_SW_IMMEDIATE_LOAD = 3
} EPWM_ActionQualifierContForce;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setDeadBandOutputSwapMode()
//! as the \e output parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_DB_OUTPUT_A = 0, //!< DB output is ePWMA
EPWM_DB_OUTPUT_B = 1 //!< DB output is ePWMB
} EPWM_DeadBandOutput;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setDeadBandDelayPolarity(),
//! EPWM_setDeadBandDelayMode() as the \e delayMode parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_DB_RED = 1, //!< DB RED (Rising Edge Delay) mode
EPWM_DB_FED = 0 //!< DB FED (Falling Edge Delay) mode
} EPWM_DeadBandDelayMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setDeadBandDelayPolarity as the
//! \e polarity parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_DB_POLARITY_ACTIVE_HIGH = 0, //!< DB polarity is not inverted
EPWM_DB_POLARITY_ACTIVE_LOW = 1 //!< DB polarity is inverted
} EPWM_DeadBandPolarity;
//*****************************************************************************
//
// Values that can be passed to EPWM_setRisingEdgeDeadBandDelayInput(),
// EPWM_setFallingEdgeDeadBandDelayInput() as the input parameter.
//
//*****************************************************************************
//! Input signal is ePWMA
//!
#define EPWM_DB_INPUT_EPWMA 0U
//! Input signal is ePWMB
//!
#define EPWM_DB_INPUT_EPWMB 1U
//! Input signal is the output of Rising Edge delay
//!
#define EPWM_DB_INPUT_DB_RED 2U
//*****************************************************************************
//
//! Values that can be passed to EPWM_setDeadBandControlShadowLoadMode() as
//! the \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! load when counter equals zero
EPWM_DB_LOAD_ON_CNTR_ZERO = 0,
//! load when counter equals period
EPWM_DB_LOAD_ON_CNTR_PERIOD = 1,
//! load when counter equals zero or period
EPWM_DB_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! Freeze shadow to active load
EPWM_DB_LOAD_FREEZE = 3
} EPWM_DeadBandControlLoadMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setRisingEdgeDelayCountShadowLoadMode()
//! as the \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! load when counter equals zero
EPWM_RED_LOAD_ON_CNTR_ZERO = 0,
//! load when counter equals period
EPWM_RED_LOAD_ON_CNTR_PERIOD = 1,
//! load when counter equals zero or period
EPWM_RED_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! Freeze shadow to active load
EPWM_RED_LOAD_FREEZE = 3
} EPWM_RisingEdgeDelayLoadMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setFallingEdgeDelayCountShadowLoadMode()
//! as the \e loadMode parameter.
//
//*****************************************************************************
typedef enum
{
//! load when counter equals zero
EPWM_FED_LOAD_ON_CNTR_ZERO = 0,
//! load when counter equals period
EPWM_FED_LOAD_ON_CNTR_PERIOD = 1,
//! load when counter equals zero or period
EPWM_FED_LOAD_ON_CNTR_ZERO_PERIOD = 2,
//! Freeze shadow to active load
EPWM_FED_LOAD_FREEZE = 3
} EPWM_FallingEdgeDelayLoadMode;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setDeadBandCounterClock() as the
//! \e clockMode parameter.
//
//*****************************************************************************
typedef enum
{
//! Dead band counter runs at TBCLK rate
EPWM_DB_COUNTER_CLOCK_FULL_CYCLE = 0,
//! Dead band counter runs at 2*TBCLK rate
EPWM_DB_COUNTER_CLOCK_HALF_CYCLE = 1
} EPWM_DeadBandClockMode;
//
// Trip Zone
//
//*****************************************************************************
//
// Values that can be passed to EPWM_enableTripZoneSignals() and
// EPWM_disableTripZoneSignals() as the tzSignal parameter.
//
//*****************************************************************************
//! TZ1 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC1 0x1U
//! TZ2 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC2 0x2U
//! TZ3 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC3 0x4U
//! TZ4 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC4 0x8U
//! TZ5 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC5 0x10U
//! TZ6 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_CBC6 0x20U
//! DCAEVT2 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_DCAEVT2 0x40U
//! DCBEVT2 Cycle By Cycle
//!
#define EPWM_TZ_SIGNAL_DCBEVT2 0x80U
//! One-shot TZ1
//!
#define EPWM_TZ_SIGNAL_OSHT1 0x100U
//! One-shot TZ2
//!
#define EPWM_TZ_SIGNAL_OSHT2 0x200U
//! One-shot TZ3
//!
#define EPWM_TZ_SIGNAL_OSHT3 0x400U
//! One-shot TZ4
//!
#define EPWM_TZ_SIGNAL_OSHT4 0x800U
//! One-shot TZ5
//!
#define EPWM_TZ_SIGNAL_OSHT5 0x1000U
//! One-shot TZ6
//!
#define EPWM_TZ_SIGNAL_OSHT6 0x2000U
//! One-shot DCAEVT1
//!
#define EPWM_TZ_SIGNAL_DCAEVT1 0x4000U
//! One-shot DCBEVT1
//!
#define EPWM_TZ_SIGNAL_DCBEVT1 0x8000U
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneDigitalCompareEventCondition()
//! as the \e dcType parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_TZ_DC_OUTPUT_A1 = 0, //!< Digital Compare output 1 A
EPWM_TZ_DC_OUTPUT_A2 = 3, //!< Digital Compare output 2 A
EPWM_TZ_DC_OUTPUT_B1 = 6, //!< Digital Compare output 1 B
EPWM_TZ_DC_OUTPUT_B2 = 9 //!< Digital Compare output 2 B
} EPWM_TripZoneDigitalCompareOutput;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneDigitalCompareEventCondition()
//! as the \e dcEvent parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_TZ_EVENT_DC_DISABLED = 0, //!< Event is disabled
EPWM_TZ_EVENT_DCXH_LOW = 1, //!< Event when DCxH low
EPWM_TZ_EVENT_DCXH_HIGH = 2, //!< Event when DCxH high
EPWM_TZ_EVENT_DCXL_LOW = 3, //!< Event when DCxL low
EPWM_TZ_EVENT_DCXL_HIGH = 4, //!< Event when DCxL high
EPWM_TZ_EVENT_DCXL_HIGH_DCXH_LOW = 5 //!< Event when DCxL high DCxH low
} EPWM_TripZoneDigitalCompareOutputEvent;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneAction() as the \e tzEvent
//! parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_TZ_ACTION_EVENT_TZA = 0, //!< TZ1 - TZ6, DCAEVT2, DCAEVT1
EPWM_TZ_ACTION_EVENT_TZB = 2, //!< TZ1 - TZ6, DCBEVT2, DCBEVT1
EPWM_TZ_ACTION_EVENT_DCAEVT1 = 4, //!< DCAEVT1 (Digital Compare A event 1)
EPWM_TZ_ACTION_EVENT_DCAEVT2 = 6, //!< DCAEVT2 (Digital Compare A event 2)
EPWM_TZ_ACTION_EVENT_DCBEVT1 = 8, //!< DCBEVT1 (Digital Compare B event 1)
EPWM_TZ_ACTION_EVENT_DCBEVT2 = 10 //!< DCBEVT2 (Digital Compare B event 2)
} EPWM_TripZoneEvent;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneAction() as the
//! \e tzAction parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_TZ_ACTION_HIGH_Z = 0, //!< high impedance output
EPWM_TZ_ACTION_HIGH = 1, //!< high voltage state
EPWM_TZ_ACTION_LOW = 2, //!< low voltage state
EPWM_TZ_ACTION_DISABLE = 3 //!< disable action
} EPWM_TripZoneAction;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneAdvAction() as the
//! \e tzAdvEvent parameter.
//
//*****************************************************************************
typedef enum
{
//! TZ1 - TZ6, DCBEVT2, DCBEVT1 while counting down
EPWM_TZ_ADV_ACTION_EVENT_TZB_D = 9,
//! TZ1 - TZ6, DCBEVT2, DCBEVT1 while counting up
EPWM_TZ_ADV_ACTION_EVENT_TZB_U = 6,
//! TZ1 - TZ6, DCAEVT2, DCAEVT1 while counting down
EPWM_TZ_ADV_ACTION_EVENT_TZA_D = 3,
//! TZ1 - TZ6, DCAEVT2, DCAEVT1 while counting up
EPWM_TZ_ADV_ACTION_EVENT_TZA_U = 0
} EPWM_TripZoneAdvancedEvent;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneAdvDigitalCompareActionA(),
//! EPWM_setTripZoneAdvDigitalCompareActionB(),EPWM_setTripZoneAdvAction()
//! as the \e tzAdvDCAction parameter.
//
//*****************************************************************************
typedef enum
{
EPWM_TZ_ADV_ACTION_HIGH_Z = 0, //!< high impedance output
EPWM_TZ_ADV_ACTION_HIGH = 1, //!< high voltage state
EPWM_TZ_ADV_ACTION_LOW = 2, //!< low voltage state
EPWM_TZ_ADV_ACTION_TOGGLE = 3, //!< toggle the output
EPWM_TZ_ADV_ACTION_DISABLE = 7 //!< disable action
} EPWM_TripZoneAdvancedAction;
//*****************************************************************************
//
//! Values that can be passed to EPWM_setTripZoneAdvDigitalCompareActionA() and
//! EPWM_setTripZoneAdvDigitalCompareActionB() as the \e tzAdvDCEvent
//! parameter.
//
//*****************************************************************************
typedef enum
{
//! Digital Compare event A/B 1 while counting up
EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U = 0,
//! Digital Compare event A/B 1 while counting down
EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D = 3,
//! Digital Compare event A/B 2 while counting up
EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_U = 6,
//! Digital Compare event A/B 2 while counting down
EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D = 9
} EPWM_TripZoneAdvDigitalCompareEvent;
//*****************************************************************************
//
// Values that can be passed to EPWM_enableTripZoneInterrupt()and
// EPWM_disableTripZoneInterrupt() as the tzInterrupt parameter .
//
//*****************************************************************************
//! Trip Zones Cycle By Cycle interrupt
//!
#define EPWM_TZ_INTERRUPT_CBC 0x2U
//! Trip Zones One Shot interrupt
//!
#define EPWM_TZ_INTERRUPT_OST 0x4U
//! Digital Compare A Event 1 interrupt
//!
#define EPWM_TZ_INTERRUPT_DCAEVT1 0x8U
//! Digital Compare A Event 2 interrupt
//!
#define EPWM_TZ_INTERRUPT_DCAEVT2 0x10U
//! Digital Compare B Event 1 interrupt
//!
#define EPWM_TZ_INTERRUPT_DCBEVT1 0x20U
//! Digital Compare B Event 2 interrupt
//!
#define EPWM_TZ_INTERRUPT_DCBEVT2 0x40U
//*****************************************************************************
//
// Values that can be returned by EPWM_getTripZoneFlagStatus() .
//
//*****************************************************************************
//! Trip Zones Cycle By Cycle flag
//!
#define EPWM_TZ_FLAG_CBC 0x2U
//! Trip Zones One Shot flag
//!
#define EPWM_TZ_FLAG_OST 0x4U
//! Digital Compare A Event 1 flag
//!
#define EPWM_TZ_FLAG_DCAEVT1 0x8U
//! Digital Compare A Event 2 flag
//!
#define EPWM_TZ_FLAG_DCAEVT2 0x10U
//! Digital Compare B Event 1 flag
//!
#define EPWM_TZ_FLAG_DCBEVT1 0x20U
//! Digital Compare B Event 2 flag
//!
#define EPWM_TZ_FLAG_DCBEVT2 0x40U
//*****************************************************************************
//
// Value can be passed to EPWM_clearTripZoneFlag() as the
// tzInterrupt parameter and returned by EPWM_getTripZoneFlagStatus().
//
//*****************************************************************************
//! Trip Zone interrupt
//!
#define EPWM_TZ_INTERRUPT 0x1U
//*****************************************************************************
//
// Values that can be passed to EPWM_clearCycleByCycleTripZoneFlag()
// as the tzCbcFlag parameter and returned by
// EPWM_getCycleByCycleTripZoneFlagStatus().
//
//*****************************************************************************
//! CBC flag 1
//!
#define EPWM_TZ_CBC_FLAG_1 0x1U
//! CBC flag 2
//!
#define EPWM_TZ_CBC_FLAG_2 0x2U
//! CBC flag 3
//!
#define EPWM_TZ_CBC_FLAG_3 0x4U
//! CBC flag 4
//!
#define EPWM_TZ_CBC_FLAG_4 0x8U
//! CBC flag 5
//!
#define EPWM_TZ_CBC_FLAG_5 0x10U
//! CBC flag 6
//!
#define EPWM_TZ_CBC_FLAG_6 0x20U
//! CBC flag Digital compare event A2
//!
#define EPWM_TZ_CBC_FLAG_DCAEVT2 0x40U
//! CBC flag Digital compare event B2
//!
#define EPWM_TZ_CBC_FLAG_DCBEVT2 0x80U
//*****************************************************************************
//
// Values that can be passed to EPWM_clearOneShotTripZoneFlag() as
// the tzCbcFlag parameter and returned by the
// EPWM_getOneShotTripZoneFlagStatus() .
//
//*****************************************************************************
//! OST flag OST1
//!
#define EPWM_TZ_OST_FLAG_OST1 0x1U
//! OST flag OST2
//!
#define EPWM_TZ_OST_FLAG_OST2 0x2U
//! OST flag OST3
//!
#define EPWM_TZ_OST_FLAG_OST3 0x4U
//! OST flag OST4
//!
#define EPWM_TZ_OST_FLAG_OST4 0x8U
//! OST flag OST5
//!
#define EPWM_TZ_OST_FLAG_OST5 0x10U
//! OST flag OST6
//!
#define EPWM_TZ_OST_FLAG_OST6 0x20U
//! OST flag Digital compare event A1
//!
#define EPWM_TZ_OST_FLAG_DCAEVT1 0x40U
//! OST flag Digital compare event B1
//!
#define EPWM_TZ_OST_FLAG_DCBEVT1 0x80U
//*****************************************************************************
//
//! Values that can be passed to EPWM_selectCycleByCycleTripZoneClearEvent() as
//! the \e clearMode parameter.
//
//*****************************************************************************
typedef enum
{
//! Clear CBC pulse when counter equals zero
EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO = 0,
//! Clear CBC pulse when counter equals period
EPWM_TZ_CBC_PULSE_CLR_CNTR_PERIOD = 1,
//! Clear CBC pulse when counter equals zero or period
EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD = 2
} EPWM_CycleByCycleTripZoneClearMode;
//*****************************************************************************
//
// Values that can be passed to EPWM_forceTripZoneEvent() as the
// tzForceEvent parameter.
//
//*****************************************************************************
//! Force Cycle By Cycle trip event
//!
#define EPWM_TZ_FORCE_EVENT_CBC 0x2U
//! Force a One-Shot Trip Event
//!
#define EPWM_TZ_FORCE_EVENT_OST 0x4U
//! ForceDigital Compare Output A Event 1
//!
#define EPWM_TZ_FORCE_EVENT_DCAEVT1 0x8U
//! ForceDigital Compare Output A Event 2
//!
#define EPWM_TZ_FORCE_EVENT_DCAEVT2 0x10U
//! ForceDigital Compare Output B Event 1