AM261x MCU+ SDK: eqep.h Source File

| AM261x MCU+ SDK 26.00.00 |

eqep/v1/eqep.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2021 Texas Instruments Incorporated
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
42 #ifndef EQEP_V1_H_
43 #define EQEP_V1_H_
44
45 //*****************************************************************************
46 //
47 // If building with a C++ compiler, make all of the definitions in this header
48 // have a C binding.
49 //
50 //*****************************************************************************
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #endif
55
56 //*****************************************************************************
57 //
59 //
60 //*****************************************************************************
61
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include <drivers/hw_include/hw_types.h>
65 #include <drivers/hw_include/cslr_soc.h>
66 #include <kernel/dpl/DebugP.h>
67 #include <drivers/hw_include/cslr_eqep.h>
68
69 //*****************************************************************************
70 //
71 // Values that can be passed to EQEP_setDecoderConfig() as the config
72 // parameter.
73 //
74 //*****************************************************************************
75
76 //
77 // Operation Mode
78 //
80 #define EQEP_CONFIG_QUADRATURE (0x0000U)
81 #define EQEP_CONFIG_CLOCK_DIR (0x4000U)
83 #define EQEP_CONFIG_UP_COUNT (0x8000U)
85 #define EQEP_CONFIG_DOWN_COUNT (0xC000U)
87
88 //
89 // Resolution
90 //
92 #define EQEP_CONFIG_2X_RESOLUTION (0x0000U)
93 #define EQEP_CONFIG_1X_RESOLUTION (0x0800U)
95
96 //
97 // Swap QEPA and QEPB
98 //
100 #define EQEP_CONFIG_NO_SWAP (0x0000U)
101 #define EQEP_CONFIG_SWAP (0x0400U)
103
104 //*****************************************************************************
105
106 //
107 // Values that can be passed to EQEP_setCompareConfig() as the config
108 // parameter.
109 //
110 //*****************************************************************************
111
112 //
113 // Sync pulse pin
114 //
116 #define EQEP_COMPARE_NO_SYNC_OUT (0x0000U)
117 #define EQEP_COMPARE_IDX_SYNC_OUT (0x2000U)
119 #define EQEP_COMPARE_STROBE_SYNC_OUT (0x3000U)
121
122 //
123 // Shadow register use
124 //
126 #define EQEP_COMPARE_NO_SHADOW (0x0000U)
127 #define EQEP_COMPARE_LOAD_ON_ZERO (0x8000U)
129 #define EQEP_COMPARE_LOAD_ON_MATCH (0xC000U)
131
132 //*****************************************************************************
133 //
134 // Values that can be passed to EQEP_enableInterrupt(),
135 // EQEP_disableInterrupt(), and EQEP_clearInterruptStatus() as the
136 // intFlags parameter and returned by EQEP_clearInterruptStatus().
137 //
138 //*****************************************************************************
139 #define EQEP_INT_GLOBAL (0x0001U)
140 #define EQEP_INT_POS_CNT_ERROR (0x0002U)
141 #define EQEP_INT_PHASE_ERROR (0x0004U)
142 #define EQEP_INT_DIR_CHANGE (0x0008U)
143 #define EQEP_INT_WATCHDOG (0x0010U)
144 #define EQEP_INT_UNDERFLOW (0x0020U)
145 #define EQEP_INT_OVERFLOW (0x0040U)
146 #define EQEP_INT_POS_COMP_READY (0x0080U)
147 #define EQEP_INT_POS_COMP_MATCH (0x0100U)
148 #define EQEP_INT_STROBE_EVNT_LATCH (0x0200U)
149 #define EQEP_INT_INDEX_EVNT_LATCH (0x0400U)
150 #define EQEP_INT_UNIT_TIME_OUT (0x0800U)
151 #define EQEP_INT_QMA_ERROR (0x1000U)
152
153 //*****************************************************************************
154 //
155 // Values that can be returned by EQEP_getStatus().
156 //
157 //*****************************************************************************
159 #define EQEP_STS_UNIT_POS_EVNT (0x0080U)
160 #define EQEP_STS_DIR_ON_1ST_IDX (0x0040U)
162 #define EQEP_STS_DIR_FLAG (0x0020U)
164 #define EQEP_STS_DIR_LATCH (0x0010U)
166 #define EQEP_STS_CAP_OVRFLW_ERROR (0x0008U)
168 #define EQEP_STS_CAP_DIR_ERROR (0x0004U)
170 #define EQEP_STS_1ST_IDX_FLAG (0x0002U)
172 #define EQEP_STS_POS_CNT_ERROR (0x0001U)
174
175 //*****************************************************************************
176 //
177 // Values that can be passed to EQEP_setLatchMode() as the latchMode parameter.
178 //
179 //*****************************************************************************
180
181 //
182 // Position counter latch event
183 //
184 #define EQEP_LATCH_CNT_READ_BY_CPU (0x0000U)
185 #define EQEP_LATCH_UNIT_TIME_OUT (0x0004U)
186
187 //
188 // Strobe position counter latch event
189 //
191 #define EQEP_LATCH_RISING_STROBE (0x0000U)
192 #define EQEP_LATCH_EDGE_DIR_STROBE (0x0040U)
194
195 //
196 // Index position counter latch event
197 //
198 #define EQEP_LATCH_RISING_INDEX (0x0010U)
199 #define EQEP_LATCH_FALLING_INDEX (0x0020U)
200 #define EQEP_LATCH_SW_INDEX_MARKER (0x0030U)
201
202 //*****************************************************************************
203 //
204 // Values that can be passed to EQEP_setPositionInitMode() as the initMode
205 // parameter.
206 //
207 //*****************************************************************************
208 #define EQEP_INIT_DO_NOTHING (0x0000U)
209
210 //
211 // Strobe events
212 //
214 #define EQEP_INIT_RISING_STROBE (0x0800U)
215 #define EQEP_INIT_EDGE_DIR_STROBE (0x0C00U)
217
218 //
219 // Index events
220 //
221 #define EQEP_INIT_RISING_INDEX (0x0200U)
222 #define EQEP_INIT_FALLING_INDEX (0x0300U)
223
224 //*****************************************************************************
225 //
228 //
229 //*****************************************************************************
230 typedef enum
231 {
233 EQEP_POSITION_RESET_IDX = 0x0000,
235 EQEP_POSITION_RESET_MAX_POS = 0x1000,
237 EQEP_POSITION_RESET_1ST_IDX = 0x2000,
239 EQEP_POSITION_RESET_UNIT_TIME_OUT = 0x3000
240 } EQEP_PositionResetMode;
241
242 //*****************************************************************************
243 //
246 //
247 //*****************************************************************************
248 typedef enum
249 {
250 EQEP_CAPTURE_CLK_DIV_1 = 0x00,
251 EQEP_CAPTURE_CLK_DIV_2 = 0x10,
252 EQEP_CAPTURE_CLK_DIV_4 = 0x20,
253 EQEP_CAPTURE_CLK_DIV_8 = 0x30,
254 EQEP_CAPTURE_CLK_DIV_16 = 0x40,
255 EQEP_CAPTURE_CLK_DIV_32 = 0x50,
256 EQEP_CAPTURE_CLK_DIV_64 = 0x60,
257 EQEP_CAPTURE_CLK_DIV_128 = 0x70
258 } EQEP_CAPCLKPrescale;
259
260 //*****************************************************************************
261 //
264 //
265 //*****************************************************************************
266 typedef enum
267 {
268 EQEP_UNIT_POS_EVNT_DIV_1 = 0,
269 EQEP_UNIT_POS_EVNT_DIV_2 = 1,
270 EQEP_UNIT_POS_EVNT_DIV_4 = 2,
271 EQEP_UNIT_POS_EVNT_DIV_8 = 3,
272 EQEP_UNIT_POS_EVNT_DIV_16 = 4,
273 EQEP_UNIT_POS_EVNT_DIV_32 = 5,
274 EQEP_UNIT_POS_EVNT_DIV_64 = 6,
275 EQEP_UNIT_POS_EVNT_DIV_128 = 7,
276 EQEP_UNIT_POS_EVNT_DIV_256 = 8,
277 EQEP_UNIT_POS_EVNT_DIV_512 = 9,
278 EQEP_UNIT_POS_EVNT_DIV_1024 = 10,
279 EQEP_UNIT_POS_EVNT_DIV_2048 = 11
280 } EQEP_UPEVNTPrescale;
281
282 //*****************************************************************************
283 //
286 //
287 //*****************************************************************************
288 typedef enum
289 {
290 EQEP_STROBE_FROM_GPIO = 0,
291 } EQEP_StrobeSource;
292
293 //*****************************************************************************
294 //
297 //
298 //*****************************************************************************
299 typedef enum
300 {
301 EQEP_QMA_MODE_BYPASS = 0,
302 EQEP_QMA_MODE_1 = 1,
303 EQEP_QMA_MODE_2 = 2
304 } EQEP_QMAMode;
305
306 //*****************************************************************************
307 //
310 //
311 //*****************************************************************************
312 typedef enum
313 {
314 EQEP_SOURCE_ZERO = 0x0000U,
315 EQEP_SOURCE_DEVICE_PIN = 0x0001U,
316 EQEP_SOURCE_PWMXBAROUT0 = 0x0002U,
317 EQEP_SOURCE_PWMXBAROUT1 = 0x0003U,
318 EQEP_SOURCE_PWMXBAROUT2 = 0x0004U,
319 EQEP_SOURCE_PWMXBAROUT3 = 0x0005U,
320 EQEP_SOURCE_PWMXBAROUT4 = 0x0006U,
321 EQEP_SOURCE_PWMXBAROUT5 = 0x0007U,
322 EQEP_SOURCE_PWMXBAROUT6 = 0x0008U,
323 EQEP_SOURCE_PWMXBAROUT7 = 0x0009U,
324 EQEP_SOURCE_PWMXBAROUT8 = 0x000AU,
325 EQEP_SOURCE_PWMXBAROUT9 = 0x000BU,
326 EQEP_SOURCE_PWMXBAROUT10 = 0x000CU,
327 EQEP_SOURCE_PWMXBAROUT11 = 0x000DU,
328 EQEP_SOURCE_PWMXBAROUT12 = 0x000EU,
329 EQEP_SOURCE_PWMXBAROUT13 = 0x000FU,
330 EQEP_SOURCE_PWMXBAROUT14 = 0x0010U,
331 EQEP_SOURCE_PWMXBAROUT15 = 0x0011U,
332 EQEP_SOURCE_PWMXBAROUT16 = 0x0012U,
333 EQEP_SOURCE_PWMXBAROUT17 = 0x0013U,
334 EQEP_SOURCE_PWMXBAROUT18 = 0x0014U,
335 EQEP_SOURCE_PWMXBAROUT19 = 0x0015U,
336 EQEP_SOURCE_PWMXBAROUT20 = 0x0016U,
337 EQEP_SOURCE_PWMXBAROUT21 = 0x0017U,
338 EQEP_SOURCE_PWMXBAROUT22 = 0x0018U,
339 EQEP_SOURCE_PWMXBAROUT23 = 0x0019U,
340 EQEP_SOURCE_PWMXBAROUT24 = 0x001AU,
341 EQEP_SOURCE_PWMXBAROUT25 = 0x001BU,
342 EQEP_SOURCE_PWMXBAROUT26 = 0x001CU,
343 EQEP_SOURCE_PWMXBAROUT27 = 0x001DU,
344 EQEP_SOURCE_PWMXBAROUT28 = 0x001EU,
345 EQEP_SOURCE_PWMXBAROUT29 = 0x001FU
346 } EQEP_Source;
347
348 //*****************************************************************************
349 //
353 //
354 //*****************************************************************************
355 typedef struct {
356 EQEP_Source sourceA;
357 EQEP_Source sourceB;
358 EQEP_Source sourceIndex;
359 }EQEP_SourceSelect;
360
361 //*****************************************************************************
362 //
365 //
366 //*****************************************************************************
367 typedef enum
368 {
369 EQEP_EMULATIONMODE_STOPIMMEDIATELY = 0,
370 EQEP_EMULATIONMODE_STOPATROLLOVER = 1,
371 EQEP_EMULATIONMODE_RUNFREE = 2
372 }EQEP_EmulationMode;
373
374 //*****************************************************************************
375 //
386 //
387 //*****************************************************************************
388 static inline void
389 EQEP_enableModule(uint32_t base)
390 {
391 //
392 // Enable the eQEP module.
393 //
394 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
395 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) | CSL_EQEP_QEPCTL_QPEN_MASK));
396 }
397
398 //*****************************************************************************
399 //
408 //
409 //*****************************************************************************
410 static inline void
411 EQEP_disableModule(uint32_t base)
412 {
413 //
414 // Disable the eQEP module.
415 //
416 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
417 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~CSL_EQEP_QEPCTL_QPEN_MASK));
418 }
419
420 //*****************************************************************************
421 //
443 //
444 //*****************************************************************************
445 static inline void
446 EQEP_setDecoderConfig(uint32_t base, uint16_t config)
447 {
448 //
449 // Write the new decoder configuration to the hardware.
450 //
451 HW_WR_REG16(base + CSL_EQEP_QDECCTL,
452 ((HW_RD_REG16(base + CSL_EQEP_QDECCTL) & ~(CSL_EQEP_QDECCTL_SWAP_MASK |
453 CSL_EQEP_QDECCTL_XCR_MASK | CSL_EQEP_QDECCTL_QSRC_MASK)) | config));
454 }
455
456 //*****************************************************************************
457 //
475 //
476 //*****************************************************************************
477 static inline void
478 EQEP_setPositionCounterConfig(uint32_t base, EQEP_PositionResetMode mode,
479 uint32_t maxPosition)
480 {
481 //
482 // Write the position counter reset configuration to the hardware.
483 //
484 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
485 ((HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~CSL_EQEP_QEPCTL_PCRM_MASK) |
486 (uint16_t)mode));
487
488 //
489 // Set the maximum position.
490 //
491 HW_WR_REG32(base + CSL_EQEP_QPOSMAX, maxPosition);
492 }
493
494 //*****************************************************************************
495 //
507 //
508 //*****************************************************************************
509 static inline uint32_t
510 EQEP_getPosition(uint32_t base)
511 {
512 //
513 // Return the current position counter.
514 //
515 return(HW_RD_REG32(base + CSL_EQEP_QPOSCNT));
516 }
517
518 //*****************************************************************************
519 //
529 //
530 //*****************************************************************************
531 static inline void
532 EQEP_setPosition(uint32_t base, uint32_t position)
533 {
534 //
535 // Set the position counter.
536 //
537 HW_WR_REG32(base + CSL_EQEP_QPOSCNT, position);
538 }
539
540 //*****************************************************************************
541 //
553 //
554 //*****************************************************************************
555 static inline int16_t
556 EQEP_getDirection(uint32_t base)
557 {
558 int16_t direction;
559
560 //
561 // Return the direction of rotation.
562 //
563 if((HW_RD_REG16(base + CSL_EQEP_QEPSTS) & CSL_EQEP_QEPSTS_QDF_MASK) != 0U)
564 {
565 direction = 1;
566 }
567 else
568 {
569 direction = -1;
570 }
571
572 return(direction);
573 }
574
575 //*****************************************************************************
576 //
597 //
598 //*****************************************************************************
599 static inline void
600 EQEP_enableInterrupt(uint32_t base, uint16_t intFlags)
601 {
602 //
603 // Enable the specified interrupts.
604 //.
605 HW_WR_REG16(base + CSL_EQEP_QEINT,
606 (HW_RD_REG16(base + CSL_EQEP_QEINT) | intFlags));
607 }
608
609 //*****************************************************************************
610 //
631 //
632 //*****************************************************************************
633 static inline void
634 EQEP_disableInterrupt(uint32_t base, uint16_t intFlags)
635 {
636 //
637 // Disable the specified interrupts.
638 //
639 HW_WR_REG16(base + CSL_EQEP_QEINT,
640 (HW_RD_REG16(base + CSL_EQEP_QEINT) & ~intFlags));
641 }
642
643 //*****************************************************************************
644 //
666 //
667 //*****************************************************************************
668 static inline uint16_t
669 EQEP_getInterruptStatus(uint32_t base)
670 {
671 //
672 // Return Interrupt Status
673 //
674 return(HW_RD_REG16(base + CSL_EQEP_QFLG));
675 }
676
677 //*****************************************************************************
678 //
703 //
704 //*****************************************************************************
705 static inline void
706 EQEP_clearInterruptStatus(uint32_t base, uint16_t intFlags)
707 {
708 //
709 // Clear the requested interrupt sources.
710 //
711 HW_WR_REG16(base + CSL_EQEP_QCLR, intFlags);
712 }
713
714 //*****************************************************************************
715 //
736 //
737 //*****************************************************************************
738 static inline void
739 EQEP_forceInterrupt(uint32_t base, uint16_t intFlags)
740 {
741 //
742 // Force the specified interrupts.
743 //
744 HW_WR_REG16(base + CSL_EQEP_QFRC,
745 (HW_RD_REG16(base + CSL_EQEP_QFRC) | intFlags));
746 }
747
748 //*****************************************************************************
749 //
759 //
760 //*****************************************************************************
761 static inline bool
762 EQEP_getError(uint32_t base)
763 {
764 //
765 // Return the error indicator.
766 //
767 return((HW_RD_REG16(base + CSL_EQEP_QFLG) & CSL_EQEP_QFLG_PHE_MASK) != 0U);
768 }
769
770 //*****************************************************************************
771 //
793 //
794 //*****************************************************************************
795 static inline uint16_t
796 EQEP_getStatus(uint32_t base)
797 {
798 //
799 // Return the status register.
800 //
801 return(HW_RD_REG16(base + CSL_EQEP_QEPSTS) & 0x00FFU);
802 }
803
804 //*****************************************************************************
805 //
826 //
827 //*****************************************************************************
828 static inline void
829 EQEP_clearStatus(uint32_t base, uint16_t statusFlags)
830 {
831 //
832 // Clear the requested interrupt sources.
833 //
834 HW_WR_REG16(base + CSL_EQEP_QEPSTS, statusFlags);
835 }
836
837 //*****************************************************************************
838 //
862 //
863 //*****************************************************************************
864 static inline void
865 EQEP_setCaptureConfig(uint32_t base, EQEP_CAPCLKPrescale capPrescale,
866 EQEP_UPEVNTPrescale evntPrescale)
867 {
868 //
869 // Write new prescaler configurations to the appropriate registers.
870 //
871 HW_WR_REG16(base + CSL_EQEP_QCAPCTL,
872 ((HW_RD_REG16(base + CSL_EQEP_QCAPCTL) & ~(CSL_EQEP_QCAPCTL_UPPS_MASK |
873 CSL_EQEP_QCAPCTL_CCPS_MASK)) | ((uint16_t)evntPrescale |
874 (uint16_t)capPrescale)));
875 }
876
877 //*****************************************************************************
878 //
886 //
887 //*****************************************************************************
888 static inline void
889 EQEP_enableCapture(uint32_t base)
890 {
891 //
892 // Enable edge capture.
893 //
894 HW_WR_REG16(base + CSL_EQEP_QCAPCTL,
895 (HW_RD_REG16(base + CSL_EQEP_QCAPCTL) | CSL_EQEP_QCAPCTL_CEN_MASK));
896 }
897
898 //*****************************************************************************
899 //
907 //
908 //*****************************************************************************
909 static inline void
910 EQEP_disableCapture(uint32_t base)
911 {
912 //
913 // Disable edge capture.
914 //
915 HW_WR_REG16(base + CSL_EQEP_QCAPCTL,
916 (HW_RD_REG16(base + CSL_EQEP_QCAPCTL) & ~CSL_EQEP_QCAPCTL_CEN_MASK));
917 }
918
919 //*****************************************************************************
920 //
929 //
930 //*****************************************************************************
931 static inline uint16_t
932 EQEP_getCapturePeriod(uint32_t base)
933 {
934 //
935 // Return the capture period.
936 //
937 return(HW_RD_REG16(base + CSL_EQEP_QCPRD));
938 }
939
940 //*****************************************************************************
941 //
949 //
950 //*****************************************************************************
951 static inline uint16_t
952 EQEP_getCaptureTimer(uint32_t base)
953 {
954 //
955 // Return the capture timer value.
956 //
957 return(HW_RD_REG16(base + CSL_EQEP_QCTMR));
958 }
959
960 //*****************************************************************************
961 //
969 //
970 //*****************************************************************************
971 static inline void
972 EQEP_enableCompare(uint32_t base)
973 {
974 //
975 // Enable position compare.
976 //
977 HW_WR_REG16(base + CSL_EQEP_QPOSCTL,
978 (HW_RD_REG16(base + CSL_EQEP_QPOSCTL) | CSL_EQEP_QPOSCTL_PCE_MASK));
979 }
980
981 //*****************************************************************************
982 //
991 //
992 //*****************************************************************************
993 static inline void
994 EQEP_disableCompare(uint32_t base)
995 {
996 //
997 // Disable position compare.
998 //
999 HW_WR_REG16(base + CSL_EQEP_QPOSCTL,
1000 (HW_RD_REG16(base + CSL_EQEP_QPOSCTL) & ~CSL_EQEP_QPOSCTL_PCE_MASK));
1001 }
1002
1003 //*****************************************************************************
1004 //
1016 //
1017 //*****************************************************************************
1018 static inline void
1019 EQEP_setComparePulseWidth(uint32_t base, uint16_t cycles)
1020 {
1021 //
1022 // Check the arguments.
1023 //
1024 DebugP_assert(cycles <= (CSL_EQEP_QPOSCTL_PCSPW_MASK + 1U));
1025
1026 //
1027 // Set the pulse width.
1028 //
1029 HW_WR_REG16(base + CSL_EQEP_QPOSCTL,
1030 ((HW_RD_REG16(base + CSL_EQEP_QPOSCTL) &
1031 ~(uint16_t)CSL_EQEP_QPOSCTL_PCSPW_MASK) | (cycles - 1U)));
1032 }
1033
1034 //*****************************************************************************
1035 //
1046 //
1047 //*****************************************************************************
1048 static inline void
1049 EQEP_loadUnitTimer(uint32_t base, uint32_t period)
1050 {
1051 //
1052 // Set the period of the unit timer.
1053 //
1054 HW_WR_REG32(base + CSL_EQEP_QUPRD, period);
1055 }
1056
1057 //*****************************************************************************
1058 //
1069 //
1070 //*****************************************************************************
1071 static inline void
1072 EQEP_enableUnitTimer(uint32_t base, uint32_t period)
1073 {
1074 //
1075 // Set the period of the unit timer.
1076 //
1077 HW_WR_REG32(base + CSL_EQEP_QUPRD, period);
1078
1079 //
1080 // Enable peripheral unit timer.
1081 //
1082 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1083 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) | CSL_EQEP_QEPCTL_UTE_MASK));
1084 }
1085
1086 //*****************************************************************************
1087 //
1096 //
1097 //*****************************************************************************
1098 static inline void
1099 EQEP_disableUnitTimer(uint32_t base)
1100 {
1101 //
1102 // Disable peripheral unit timer.
1103 //
1104 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1105 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~CSL_EQEP_QEPCTL_UTE_MASK));
1106 }
1107
1108 //*****************************************************************************
1109 //
1123 //
1124 //*****************************************************************************
1125 static inline void
1126 EQEP_enableWatchdog(uint32_t base, uint16_t period)
1127 {
1128 //
1129 // Set the timeout count for the eQEP peripheral watchdog timer.
1130 //
1131 HW_WR_REG16(base + CSL_EQEP_QWDPRD, period);
1132
1133 //
1134 // Enable peripheral watchdog.
1135 //
1136 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1137 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) | CSL_EQEP_QEPCTL_WDE_MASK));
1138 }
1139
1140 //*****************************************************************************
1141 //
1150 //
1151 //*****************************************************************************
1152 static inline void
1153 EQEP_disableWatchdog(uint32_t base)
1154 {
1155 //
1156 // Disable peripheral watchdog.
1157 //
1158 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1159 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~CSL_EQEP_QEPCTL_WDE_MASK));
1160 }
1161
1162 //*****************************************************************************
1163 //
1172 //
1173 //*****************************************************************************
1174 static inline void
1175 EQEP_setWatchdogTimerValue(uint32_t base, uint16_t value)
1176 {
1177 //
1178 // Write the value to the watchdog timer register.
1179 //
1180 HW_WR_REG16(base + CSL_EQEP_QWDTMR, value);
1181 }
1182
1183 //*****************************************************************************
1184 //
1190 //
1191 //*****************************************************************************
1192 static inline uint16_t
1193 EQEP_getWatchdogTimerValue(uint32_t base)
1194 {
1195 //
1196 // Read the value from the watchdog timer register.
1197 //
1198 return(HW_RD_REG16(base + CSL_EQEP_QWDTMR));
1199 }
1200
1201 //*****************************************************************************
1202 //
1225 //
1226 //*****************************************************************************
1227 static inline void
1228 EQEP_setPositionInitMode(uint32_t base, uint16_t initMode)
1229 {
1230 //
1231 // Set the init mode in the QEP Control register.
1232 //
1233 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1234 ((HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~(CSL_EQEP_QEPCTL_IEI_MASK |
1235 CSL_EQEP_QEPCTL_SEI_MASK)) | initMode));
1236 }
1237
1238 //*****************************************************************************
1239 //
1255 //
1256 //*****************************************************************************
1257 static inline void
1258 EQEP_setSWPositionInit(uint32_t base, bool initialize)
1259 {
1260 //
1261 // Set or clear the software initialization bit.
1262 //
1263 if(initialize)
1264 {
1265 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1266 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) | CSL_EQEP_QEPCTL_SWI_MASK));
1267 }
1268 else
1269 {
1270 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1271 (HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~CSL_EQEP_QEPCTL_SWI_MASK));
1272 }
1273 }
1274
1275 //*****************************************************************************
1276 //
1288 //
1289 //*****************************************************************************
1290 static inline void
1291 EQEP_setInitialPosition(uint32_t base, uint32_t position)
1292 {
1293 //
1294 // Write position to position counter init register
1295 //
1296 HW_WR_REG32(base + CSL_EQEP_QPOSINIT, position);
1297 }
1298
1299 //*****************************************************************************
1300 //
1327 //
1328 //*****************************************************************************
1329 static inline void
1330 EQEP_setLatchMode(uint32_t base, uint32_t latchMode)
1331 {
1332 //
1333 // Set the latch mode in the QEP Control register.
1334 //
1335 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1336 ((HW_RD_REG16(base + CSL_EQEP_QEPCTL) & ~(CSL_EQEP_QEPCTL_QCLM_MASK |
1337 CSL_EQEP_QEPCTL_IEL_MASK | CSL_EQEP_QEPCTL_SEL_MASK)) | latchMode));
1338 }
1339
1340 //*****************************************************************************
1341 //
1352 //
1353 //*****************************************************************************
1354 static inline uint32_t
1355 EQEP_getIndexPositionLatch(uint32_t base)
1356 {
1357 //
1358 // Return the current position counter.
1359 //
1360 return(HW_RD_REG32(base + CSL_EQEP_QPOSILAT));
1361 }
1362
1363 //*****************************************************************************
1364 //
1376 //
1377 //*****************************************************************************
1378 static inline uint32_t
1379 EQEP_getStrobePositionLatch(uint32_t base)
1380 {
1381 //
1382 // Return the current position counter.
1383 //
1384 return(HW_RD_REG32(base + CSL_EQEP_QPOSSLAT));
1385 }
1386
1387 //*****************************************************************************
1388 //
1398 //
1399 //*****************************************************************************
1400 static inline uint32_t
1401 EQEP_getPositionLatch(uint32_t base)
1402 {
1403 //
1404 // Return the current position counter.
1405 //
1406 return(HW_RD_REG32(base + CSL_EQEP_QPOSLAT));
1407 }
1408
1409 //*****************************************************************************
1410 //
1421 //
1422 //*****************************************************************************
1423 static inline uint16_t
1424 EQEP_getCaptureTimerLatch(uint32_t base)
1425 {
1426 //
1427 // Return the current position counter.
1428 //
1429 return(HW_RD_REG16(base + CSL_EQEP_QCTMRLAT));
1430 }
1431
1432 //*****************************************************************************
1433 //
1444 //
1445 //*****************************************************************************
1446 static inline uint16_t
1447 EQEP_getCapturePeriodLatch(uint32_t base)
1448 {
1449 //
1450 // Return the current position counter.
1451 //
1452 return(HW_RD_REG16(base + CSL_EQEP_QCPRDLAT));
1453 }
1454
1455 //*****************************************************************************
1456 //
1471 //
1472 //*****************************************************************************
1473 static inline void
1474 EQEP_setQMAModuleMode(uint32_t base, EQEP_QMAMode qmaMode)
1475 {
1476 //
1477 // Write the QMA module mode into the appropriate register.
1478 //
1479 HW_WR_REG16(base + CSL_EQEP_QMACTRL,
1480 ((HW_RD_REG16(base + CSL_EQEP_QMACTRL) & ~CSL_EQEP_QMACTRL_MODE_MASK) |
1481 (uint16_t)qmaMode));
1482 }
1483
1484 //*****************************************************************************
1485 //
1501 //
1502 //*****************************************************************************
1503 static inline void
1504 EQEP_setStrobeSource(uint32_t base, EQEP_StrobeSource strobeSrc)
1505 {
1506 //
1507 // Write the strobe source selection into the appropriate register.
1508 //
1509 HW_WR_REG16(base + CSL_EQEP_QEPSTROBESEL,
1510 ((HW_RD_REG16(base + CSL_EQEP_QEPSTROBESEL) &
1511 ~CSL_EQEP_QEPSTROBESEL_STROBESEL_MASK) | (uint16_t)strobeSrc));
1512 }
1513
1514 //*****************************************************************************
1515 //
1524 //
1525 //*****************************************************************************
1526 static inline void
1527 EQEP_enableDirectionChangeDuringIndex(uint32_t base)
1528 {
1529 //
1530 //Sets the index direction enhancement bit
1531 //
1532 HW_WR_REG16(base + CSL_EQEP_QDECCTL,
1533 (HW_RD_REG16(base + CSL_EQEP_QDECCTL) | CSL_EQEP_QDECCTL_QIDIRE_MASK));
1534 }
1535
1536 //*****************************************************************************
1537 //
1546 //
1547 //*****************************************************************************
1548 static inline void
1549 EQEP_disableDirectionChangeDuringIndex(uint32_t base)
1550 {
1551 //
1552 //Clears the index direction enhancement bit
1553 //
1554 HW_WR_REG16(base + CSL_EQEP_QDECCTL,
1555 (HW_RD_REG16(base + CSL_EQEP_QDECCTL) & ~CSL_EQEP_QDECCTL_QIDIRE_MASK));
1556 }
1557
1558 //*****************************************************************************
1559 //
1569 //
1570 //*****************************************************************************
1571 static inline void
1572 EQEP_selectSource(uint32_t base, EQEP_SourceSelect sourceConfig )
1573 {
1574 //
1575 // Selecting sources for eQEP signals
1576 //
1577 HW_WR_REG32(base + CSL_EQEP_QEPSRCSEL,
1578 ((HW_RD_REG32(base + CSL_EQEP_QEPSRCSEL) &
1579 ~(CSL_EQEP_QEPSRCSEL_QEPASEL_MASK | CSL_EQEP_QEPSRCSEL_QEPBSEL_MASK |
1580 CSL_EQEP_QEPSRCSEL_QEPISEL_MASK)) |
1581 ((uint32_t)((uint32_t)(sourceConfig.sourceA) <<
1582 CSL_EQEP_QEPSRCSEL_QEPASEL_SHIFT) |
1583 (uint32_t)((uint32_t)(sourceConfig.sourceB) <<
1584 CSL_EQEP_QEPSRCSEL_QEPBSEL_SHIFT) |
1585 (uint32_t)((uint32_t)(sourceConfig.sourceIndex) <<
1586 CSL_EQEP_QEPSRCSEL_QEPISEL_SHIFT))));
1587 }
1588
1589 //*****************************************************************************
1590 //
1609 //
1610 //*****************************************************************************
1611 static inline void
1612 EQEP_setEmulationMode(uint32_t base, EQEP_EmulationMode emuMode)
1613 {
1614 //
1615 // Write the emulation mode to the FREE_SOFT bits.
1616 //
1617 HW_WR_REG16(base + CSL_EQEP_QEPCTL,
1618 ((HW_RD_REG16(base + CSL_EQEP_QEPCTL) &
1619 ~CSL_EQEP_QEPSRCSEL_QEPISEL_SHIFT) |
1620 ((uint16_t)emuMode << CSL_EQEP_QEPCTL_FREE_SOFT_SHIFT)));
1621 }
1622
1623 //*****************************************************************************
1624 //
1654 //
1655 //*****************************************************************************
1656 extern void
1657 EQEP_setCompareConfig(uint32_t base, uint16_t config, uint32_t compareValue,
1658 uint16_t cycles);
1659
1660 //*****************************************************************************
1661 //
1675 //
1676 //*****************************************************************************
1677 extern void
1678 EQEP_setInputPolarity(uint32_t base, bool invertQEPA, bool invertQEPB,
1679 bool invertIndex, bool invertStrobe);
1680
1681 //*****************************************************************************
1682 //
1683 // Close the Doxygen group.
1685 //
1686 //*****************************************************************************
1687
1688 //*****************************************************************************
1689 //
1690 // Mark the end of the C bindings section for C++ compilers.
1691 //
1692 //*****************************************************************************
1693 #ifdef __cplusplus
1694 }
1695 #endif
1696
1697 #endif // EQEP_V1_H_
EQEP_enableDirectionChangeDuringIndex
static void EQEP_enableDirectionChangeDuringIndex(uint32_t base)
Definition: eqep/v1/eqep.h:1527
EQEP_SOURCE_PWMXBAROUT11
@ EQEP_SOURCE_PWMXBAROUT11
Signal comes from PWM Xbar out 11.
Definition: eqep/v1/eqep.h:327
EQEP_getCapturePeriodLatch
static uint16_t EQEP_getCapturePeriodLatch(uint32_t base)
Definition: eqep/v1/eqep.h:1447
EQEP_CAPTURE_CLK_DIV_32
@ EQEP_CAPTURE_CLK_DIV_32
CAPCLK = SYSCLKOUT/32.
Definition: eqep/v1/eqep.h:255
EQEP_SOURCE_PWMXBAROUT23
@ EQEP_SOURCE_PWMXBAROUT23
Signal comes from PWM Xbar out 23.
Definition: eqep/v1/eqep.h:339
EQEP_UNIT_POS_EVNT_DIV_2
@ EQEP_UNIT_POS_EVNT_DIV_2
UPEVNT = QCLK/2.
Definition: eqep/v1/eqep.h:269
EQEP_POSITION_RESET_MAX_POS
@ EQEP_POSITION_RESET_MAX_POS
Reset position on maximum position.
Definition: eqep/v1/eqep.h:235
EQEP_setInputPolarity
void EQEP_setInputPolarity(uint32_t base, bool invertQEPA, bool invertQEPB, bool invertIndex, bool invertStrobe)
EQEP_UNIT_POS_EVNT_DIV_2048
@ EQEP_UNIT_POS_EVNT_DIV_2048
UPEVNT = QCLK/2048.
Definition: eqep/v1/eqep.h:279
EQEP_enableModule
static void EQEP_enableModule(uint32_t base)
Definition: eqep/v1/eqep.h:389
EQEP_getPosition
static uint32_t EQEP_getPosition(uint32_t base)
Definition: eqep/v1/eqep.h:510
EQEP_SOURCE_PWMXBAROUT29
@ EQEP_SOURCE_PWMXBAROUT29
Signal comes from PWM Xbar out 29.
Definition: eqep/v1/eqep.h:345
EQEP_SOURCE_PWMXBAROUT8
@ EQEP_SOURCE_PWMXBAROUT8
Signal comes from PWM Xbar out 8.
Definition: eqep/v1/eqep.h:324
EQEP_disableCapture
static void EQEP_disableCapture(uint32_t base)
Definition: eqep/v1/eqep.h:910
EQEP_POSITION_RESET_1ST_IDX
@ EQEP_POSITION_RESET_1ST_IDX
Reset position on the first index pulse.
Definition: eqep/v1/eqep.h:237
EQEP_setDecoderConfig
static void EQEP_setDecoderConfig(uint32_t base, uint16_t config)
Definition: eqep/v1/eqep.h:446
EQEP_setCaptureConfig
static void EQEP_setCaptureConfig(uint32_t base, EQEP_CAPCLKPrescale capPrescale, EQEP_UPEVNTPrescale evntPrescale)
Definition: eqep/v1/eqep.h:865
EQEP_SOURCE_PWMXBAROUT21
@ EQEP_SOURCE_PWMXBAROUT21
Signal comes from PWM Xbar out 21.
Definition: eqep/v1/eqep.h:337
EQEP_setLatchMode
static void EQEP_setLatchMode(uint32_t base, uint32_t latchMode)
Definition: eqep/v1/eqep.h:1330
EQEP_disableCompare
static void EQEP_disableCompare(uint32_t base)
Definition: eqep/v1/eqep.h:994
EQEP_StrobeSource
EQEP_StrobeSource
Definition: eqep/v1/eqep.h:289
EQEP_CAPTURE_CLK_DIV_2
@ EQEP_CAPTURE_CLK_DIV_2
CAPCLK = SYSCLKOUT/2.
Definition: eqep/v1/eqep.h:251
EQEP_SOURCE_PWMXBAROUT9
@ EQEP_SOURCE_PWMXBAROUT9
Signal comes from PWM Xbar out 9.
Definition: eqep/v1/eqep.h:325
EQEP_disableInterrupt
static void EQEP_disableInterrupt(uint32_t base, uint16_t intFlags)
Definition: eqep/v1/eqep.h:634
EQEP_CAPTURE_CLK_DIV_8
@ EQEP_CAPTURE_CLK_DIV_8
CAPCLK = SYSCLKOUT/8.
Definition: eqep/v1/eqep.h:253
EQEP_SOURCE_PWMXBAROUT2
@ EQEP_SOURCE_PWMXBAROUT2
Signal comes from PWM Xbar out 2.
Definition: eqep/v1/eqep.h:318
EQEP_setInitialPosition
static void EQEP_setInitialPosition(uint32_t base, uint32_t position)
Definition: eqep/v1/eqep.h:1291
EQEP_getWatchdogTimerValue
static uint16_t EQEP_getWatchdogTimerValue(uint32_t base)
Definition: eqep/v1/eqep.h:1193
EQEP_selectSource
static void EQEP_selectSource(uint32_t base, EQEP_SourceSelect sourceConfig)
Definition: eqep/v1/eqep.h:1572
EQEP_disableDirectionChangeDuringIndex
static void EQEP_disableDirectionChangeDuringIndex(uint32_t base)
Definition: eqep/v1/eqep.h:1549
EQEP_loadUnitTimer
static void EQEP_loadUnitTimer(uint32_t base, uint32_t period)
Definition: eqep/v1/eqep.h:1049
EQEP_SOURCE_PWMXBAROUT16
@ EQEP_SOURCE_PWMXBAROUT16
Signal comes from PWM Xbar out 16.
Definition: eqep/v1/eqep.h:332
EQEP_getCaptureTimerLatch
static uint16_t EQEP_getCaptureTimerLatch(uint32_t base)
Definition: eqep/v1/eqep.h:1424
EQEP_QMA_MODE_BYPASS
@ EQEP_QMA_MODE_BYPASS
QMA module is bypassed.
Definition: eqep/v1/eqep.h:301
EQEP_UPEVNTPrescale
EQEP_UPEVNTPrescale
Definition: eqep/v1/eqep.h:267
EQEP_setPosition
static void EQEP_setPosition(uint32_t base, uint32_t position)
Definition: eqep/v1/eqep.h:532
EQEP_PositionResetMode
EQEP_PositionResetMode
Definition: eqep/v1/eqep.h:231
EQEP_enableUnitTimer
static void EQEP_enableUnitTimer(uint32_t base, uint32_t period)
Definition: eqep/v1/eqep.h:1072
EQEP_enableInterrupt
static void EQEP_enableInterrupt(uint32_t base, uint16_t intFlags)
Definition: eqep/v1/eqep.h:600
EQEP_disableUnitTimer
static void EQEP_disableUnitTimer(uint32_t base)
Definition: eqep/v1/eqep.h:1099
EQEP_disableModule
static void EQEP_disableModule(uint32_t base)
Definition: eqep/v1/eqep.h:411
EQEP_SOURCE_PWMXBAROUT4
@ EQEP_SOURCE_PWMXBAROUT4
Signal comes from PWM Xbar out 4.
Definition: eqep/v1/eqep.h:320
EQEP_SourceSelect::sourceA
EQEP_Source sourceA
Definition: eqep/v1/eqep.h:356
EQEP_getPositionLatch
static uint32_t EQEP_getPositionLatch(uint32_t base)
Definition: eqep/v1/eqep.h:1401
EQEP_CAPCLKPrescale
EQEP_CAPCLKPrescale
Definition: eqep/v1/eqep.h:249
EQEP_STROBE_FROM_GPIO
@ EQEP_STROBE_FROM_GPIO
Strobe signal comes from GPIO.
Definition: eqep/v1/eqep.h:290
EQEP_CAPTURE_CLK_DIV_16
@ EQEP_CAPTURE_CLK_DIV_16
CAPCLK = SYSCLKOUT/16.
Definition: eqep/v1/eqep.h:254
EQEP_SOURCE_PWMXBAROUT26
@ EQEP_SOURCE_PWMXBAROUT26
Signal comes from PWM Xbar out 26.
Definition: eqep/v1/eqep.h:342
EQEP_SOURCE_PWMXBAROUT18
@ EQEP_SOURCE_PWMXBAROUT18
Signal comes from PWM Xbar out 18.
Definition: eqep/v1/eqep.h:334
EQEP_getCapturePeriod
static uint16_t EQEP_getCapturePeriod(uint32_t base)
Definition: eqep/v1/eqep.h:932
EQEP_getStrobePositionLatch
static uint32_t EQEP_getStrobePositionLatch(uint32_t base)
Definition: eqep/v1/eqep.h:1379
EQEP_POSITION_RESET_IDX
@ EQEP_POSITION_RESET_IDX
Reset position on index pulse.
Definition: eqep/v1/eqep.h:233
EQEP_UNIT_POS_EVNT_DIV_32
@ EQEP_UNIT_POS_EVNT_DIV_32
UPEVNT = QCLK/32.
Definition: eqep/v1/eqep.h:273
EQEP_CAPTURE_CLK_DIV_128
@ EQEP_CAPTURE_CLK_DIV_128
CAPCLK = SYSCLKOUT/128.
Definition: eqep/v1/eqep.h:257
EQEP_forceInterrupt
static void EQEP_forceInterrupt(uint32_t base, uint16_t intFlags)
Definition: eqep/v1/eqep.h:739
EQEP_SOURCE_PWMXBAROUT24
@ EQEP_SOURCE_PWMXBAROUT24
Signal comes from PWM Xbar out 24.
Definition: eqep/v1/eqep.h:340
EQEP_SOURCE_PWMXBAROUT0
@ EQEP_SOURCE_PWMXBAROUT0
Signal comes from PWM Xbar out 0.
Definition: eqep/v1/eqep.h:316
EQEP_SourceSelect::sourceB
EQEP_Source sourceB
Definition: eqep/v1/eqep.h:357
EQEP_enableCompare
static void EQEP_enableCompare(uint32_t base)
Definition: eqep/v1/eqep.h:972
EQEP_SourceSelect::sourceIndex
EQEP_Source sourceIndex
Definition: eqep/v1/eqep.h:358
EQEP_getInterruptStatus
static uint16_t EQEP_getInterruptStatus(uint32_t base)
Definition: eqep/v1/eqep.h:669
EQEP_SOURCE_PWMXBAROUT3
@ EQEP_SOURCE_PWMXBAROUT3
Signal comes from PWM Xbar out 3.
Definition: eqep/v1/eqep.h:319
EQEP_SOURCE_PWMXBAROUT5
@ EQEP_SOURCE_PWMXBAROUT5
Signal comes from PWM Xbar out 5.
Definition: eqep/v1/eqep.h:321
EQEP_SOURCE_PWMXBAROUT15
@ EQEP_SOURCE_PWMXBAROUT15
Signal comes from PWM Xbar out 15.
Definition: eqep/v1/eqep.h:331
EQEP_getCaptureTimer
static uint16_t EQEP_getCaptureTimer(uint32_t base)
Definition: eqep/v1/eqep.h:952
EQEP_CAPTURE_CLK_DIV_1
@ EQEP_CAPTURE_CLK_DIV_1
CAPCLK = SYSCLKOUT/1.
Definition: eqep/v1/eqep.h:250
EQEP_clearInterruptStatus
static void EQEP_clearInterruptStatus(uint32_t base, uint16_t intFlags)
Definition: eqep/v1/eqep.h:706
EQEP_Source
EQEP_Source
Definition: eqep/v1/eqep.h:313
EQEP_disableWatchdog
static void EQEP_disableWatchdog(uint32_t base)
Definition: eqep/v1/eqep.h:1153
EQEP_SOURCE_PWMXBAROUT6
@ EQEP_SOURCE_PWMXBAROUT6
Signal comes from PWM Xbar out 6.
Definition: eqep/v1/eqep.h:322
EQEP_setStrobeSource
static void EQEP_setStrobeSource(uint32_t base, EQEP_StrobeSource strobeSrc)
Definition: eqep/v1/eqep.h:1504
EQEP_setPositionCounterConfig
static void EQEP_setPositionCounterConfig(uint32_t base, EQEP_PositionResetMode mode, uint32_t maxPosition)
Definition: eqep/v1/eqep.h:478
EQEP_UNIT_POS_EVNT_DIV_8
@ EQEP_UNIT_POS_EVNT_DIV_8
UPEVNT = QCLK/8.
Definition: eqep/v1/eqep.h:271
EQEP_SOURCE_PWMXBAROUT12
@ EQEP_SOURCE_PWMXBAROUT12
Signal comes from PWM Xbar out 12.
Definition: eqep/v1/eqep.h:328
EQEP_SOURCE_ZERO
@ EQEP_SOURCE_ZERO
Signal is 0.
Definition: eqep/v1/eqep.h:314
EQEP_UNIT_POS_EVNT_DIV_4
@ EQEP_UNIT_POS_EVNT_DIV_4
UPEVNT = QCLK/4.
Definition: eqep/v1/eqep.h:270
EQEP_clearStatus
static void EQEP_clearStatus(uint32_t base, uint16_t statusFlags)
Definition: eqep/v1/eqep.h:829
EQEP_getStatus
static uint16_t EQEP_getStatus(uint32_t base)
Definition: eqep/v1/eqep.h:796
EQEP_SOURCE_PWMXBAROUT27
@ EQEP_SOURCE_PWMXBAROUT27
Signal comes from PWM Xbar out 27.
Definition: eqep/v1/eqep.h:343
EQEP_SOURCE_DEVICE_PIN
@ EQEP_SOURCE_DEVICE_PIN
Signal comes from Device Pin.
Definition: eqep/v1/eqep.h:315
EQEP_SOURCE_PWMXBAROUT10
@ EQEP_SOURCE_PWMXBAROUT10
Signal comes from PWM Xbar out 10.
Definition: eqep/v1/eqep.h:326
EQEP_getIndexPositionLatch
static uint32_t EQEP_getIndexPositionLatch(uint32_t base)
Definition: eqep/v1/eqep.h:1355
EQEP_SOURCE_PWMXBAROUT22
@ EQEP_SOURCE_PWMXBAROUT22
Signal comes from PWM Xbar out 22.
Definition: eqep/v1/eqep.h:338
EQEP_EmulationMode
EQEP_EmulationMode
Definition: eqep/v1/eqep.h:368
EQEP_enableWatchdog
static void EQEP_enableWatchdog(uint32_t base, uint16_t period)
Definition: eqep/v1/eqep.h:1126
EQEP_setSWPositionInit
static void EQEP_setSWPositionInit(uint32_t base, bool initialize)
Definition: eqep/v1/eqep.h:1258
EQEP_QMA_MODE_2
@ EQEP_QMA_MODE_2
QMA mode-2 operation is selected.
Definition: eqep/v1/eqep.h:303
EQEP_getDirection
static int16_t EQEP_getDirection(uint32_t base)
Definition: eqep/v1/eqep.h:556
EQEP_UNIT_POS_EVNT_DIV_512
@ EQEP_UNIT_POS_EVNT_DIV_512
UPEVNT = QCLK/512.
Definition: eqep/v1/eqep.h:277
EQEP_setEmulationMode
static void EQEP_setEmulationMode(uint32_t base, EQEP_EmulationMode emuMode)
Definition: eqep/v1/eqep.h:1612
DebugP.h
EQEP_setQMAModuleMode
static void EQEP_setQMAModuleMode(uint32_t base, EQEP_QMAMode qmaMode)
Definition: eqep/v1/eqep.h:1474
EQEP_UNIT_POS_EVNT_DIV_1024
@ EQEP_UNIT_POS_EVNT_DIV_1024
UPEVNT = QCLK/1024.
Definition: eqep/v1/eqep.h:278
EQEP_SourceSelect
Definition: eqep/v1/eqep.h:355
EQEP_enableCapture
static void EQEP_enableCapture(uint32_t base)
Definition: eqep/v1/eqep.h:889
EQEP_getError
static bool EQEP_getError(uint32_t base)
Definition: eqep/v1/eqep.h:762
EQEP_EMULATIONMODE_STOPATROLLOVER
@ EQEP_EMULATIONMODE_STOPATROLLOVER
Counters stop at period rollover.
Definition: eqep/v1/eqep.h:370
EQEP_SOURCE_PWMXBAROUT14
@ EQEP_SOURCE_PWMXBAROUT14
Signal comes from PWM Xbar out 14.
Definition: eqep/v1/eqep.h:330
EQEP_QMAMode
EQEP_QMAMode
Definition: eqep/v1/eqep.h:300
EQEP_UNIT_POS_EVNT_DIV_64
@ EQEP_UNIT_POS_EVNT_DIV_64
UPEVNT = QCLK/64.
Definition: eqep/v1/eqep.h:274
EQEP_SOURCE_PWMXBAROUT19
@ EQEP_SOURCE_PWMXBAROUT19
Signal comes from PWM Xbar out 19.
Definition: eqep/v1/eqep.h:335
EQEP_SOURCE_PWMXBAROUT25
@ EQEP_SOURCE_PWMXBAROUT25
Signal comes from PWM Xbar out 25.
Definition: eqep/v1/eqep.h:341
EQEP_setCompareConfig
void EQEP_setCompareConfig(uint32_t base, uint16_t config, uint32_t compareValue, uint16_t cycles)
EQEP_EMULATIONMODE_STOPIMMEDIATELY
@ EQEP_EMULATIONMODE_STOPIMMEDIATELY
Counters stop immediately.
Definition: eqep/v1/eqep.h:369
EQEP_SOURCE_PWMXBAROUT28
@ EQEP_SOURCE_PWMXBAROUT28
Signal comes from PWM Xbar out 28.
Definition: eqep/v1/eqep.h:344
EQEP_SOURCE_PWMXBAROUT13
@ EQEP_SOURCE_PWMXBAROUT13
Signal comes from PWM Xbar out 13.
Definition: eqep/v1/eqep.h:329
EQEP_setWatchdogTimerValue
static void EQEP_setWatchdogTimerValue(uint32_t base, uint16_t value)
Definition: eqep/v1/eqep.h:1175
EQEP_SOURCE_PWMXBAROUT7
@ EQEP_SOURCE_PWMXBAROUT7
Signal comes from PWM Xbar out 7.
Definition: eqep/v1/eqep.h:323
EQEP_CAPTURE_CLK_DIV_4
@ EQEP_CAPTURE_CLK_DIV_4
CAPCLK = SYSCLKOUT/4.
Definition: eqep/v1/eqep.h:252
EQEP_setPositionInitMode
static void EQEP_setPositionInitMode(uint32_t base, uint16_t initMode)
Definition: eqep/v1/eqep.h:1228
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:187
EQEP_QMA_MODE_1
@ EQEP_QMA_MODE_1
QMA mode-1 operation is selected.
Definition: eqep/v1/eqep.h:302
EQEP_UNIT_POS_EVNT_DIV_16
@ EQEP_UNIT_POS_EVNT_DIV_16
UPEVNT = QCLK/16.
Definition: eqep/v1/eqep.h:272
EQEP_setComparePulseWidth
static void EQEP_setComparePulseWidth(uint32_t base, uint16_t cycles)
Definition: eqep/v1/eqep.h:1019
EQEP_CAPTURE_CLK_DIV_64
@ EQEP_CAPTURE_CLK_DIV_64
CAPCLK = SYSCLKOUT/64.
Definition: eqep/v1/eqep.h:256
EQEP_SOURCE_PWMXBAROUT1
@ EQEP_SOURCE_PWMXBAROUT1
Signal comes from PWM Xbar out 1.
Definition: eqep/v1/eqep.h:317
EQEP_UNIT_POS_EVNT_DIV_128
@ EQEP_UNIT_POS_EVNT_DIV_128
UPEVNT = QCLK/128.
Definition: eqep/v1/eqep.h:275
EQEP_SOURCE_PWMXBAROUT17
@ EQEP_SOURCE_PWMXBAROUT17
Signal comes from PWM Xbar out 17.
Definition: eqep/v1/eqep.h:333
EQEP_UNIT_POS_EVNT_DIV_256
@ EQEP_UNIT_POS_EVNT_DIV_256
UPEVNT = QCLK/256.
Definition: eqep/v1/eqep.h:276
EQEP_EMULATIONMODE_RUNFREE
@ EQEP_EMULATIONMODE_RUNFREE
Counter unaffected by suspend.
Definition: eqep/v1/eqep.h:371
EQEP_UNIT_POS_EVNT_DIV_1
@ EQEP_UNIT_POS_EVNT_DIV_1
UPEVNT = QCLK/1.
Definition: eqep/v1/eqep.h:268
EQEP_POSITION_RESET_UNIT_TIME_OUT
@ EQEP_POSITION_RESET_UNIT_TIME_OUT
Reset position on a unit time event.
Definition: eqep/v1/eqep.h:239
EQEP_SOURCE_PWMXBAROUT20
@ EQEP_SOURCE_PWMXBAROUT20
Signal comes from PWM Xbar out 20.
Definition: eqep/v1/eqep.h:336