F2837xD_ecap.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. //###########################################################################
  2. //
  3. // FILE: F2837xD_ecap.h
  4. //
  5. // TITLE: ECAP Register Definitions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2837xD Support Library v3.05.00.00 $
  9. // $Release Date: Tue Jun 26 03:15:23 CDT 2018 $
  10. // $Copyright:
  11. // Copyright (C) 2013-2018 Texas Instruments Incorporated - http://www.ti.com/
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions
  15. // are met:
  16. //
  17. // Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. //
  20. // Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the
  23. // distribution.
  24. //
  25. // Neither the name of Texas Instruments Incorporated nor the names of
  26. // its contributors may be used to endorse or promote products derived
  27. // from this software without specific prior written permission.
  28. //
  29. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  30. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  31. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  32. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  35. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  36. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  37. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  38. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. // $
  41. //###########################################################################
  42. #ifndef __F2837xD_ECAP_H__
  43. #define __F2837xD_ECAP_H__
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. //---------------------------------------------------------------------------
  48. // ECAP Individual Register Bit Definitions:
  49. struct ECCTL1_BITS { // bits description
  50. Uint16 CAP1POL:1; // 0 Capture Event 1 Polarity select
  51. Uint16 CTRRST1:1; // 1 Counter Reset on Capture Event 1
  52. Uint16 CAP2POL:1; // 2 Capture Event 2 Polarity select
  53. Uint16 CTRRST2:1; // 3 Counter Reset on Capture Event 2
  54. Uint16 CAP3POL:1; // 4 Capture Event 3 Polarity select
  55. Uint16 CTRRST3:1; // 5 Counter Reset on Capture Event 3
  56. Uint16 CAP4POL:1; // 6 Capture Event 4 Polarity select
  57. Uint16 CTRRST4:1; // 7 Counter Reset on Capture Event 4
  58. Uint16 CAPLDEN:1; // 8 Enable Loading CAP1-4 regs on a Cap Event
  59. Uint16 PRESCALE:5; // 13:9 Event Filter prescale select
  60. Uint16 FREE_SOFT:2; // 15:14 Emulation mode
  61. };
  62. union ECCTL1_REG {
  63. Uint16 all;
  64. struct ECCTL1_BITS bit;
  65. };
  66. struct ECCTL2_BITS { // bits description
  67. Uint16 CONT_ONESHT:1; // 0 Continuous or one-shot
  68. Uint16 STOP_WRAP:2; // 2:1 Stop value for one-shot, Wrap for continuous
  69. Uint16 REARM:1; // 3 One-shot re-arm
  70. Uint16 TSCTRSTOP:1; // 4 TSCNT counter stop
  71. Uint16 SYNCI_EN:1; // 5 Counter sync-in select
  72. Uint16 SYNCO_SEL:2; // 7:6 Sync-out mode
  73. Uint16 SWSYNC:1; // 8 SW forced counter sync
  74. Uint16 CAP_APWM:1; // 9 CAP/APWM operating mode select
  75. Uint16 APWMPOL:1; // 10 APWM output polarity select
  76. Uint16 rsvd1:5; // 15:11 Reserved
  77. };
  78. union ECCTL2_REG {
  79. Uint16 all;
  80. struct ECCTL2_BITS bit;
  81. };
  82. struct ECEINT_BITS { // bits description
  83. Uint16 rsvd1:1; // 0 Reserved
  84. Uint16 CEVT1:1; // 1 Capture Event 1 Interrupt Enable
  85. Uint16 CEVT2:1; // 2 Capture Event 2 Interrupt Enable
  86. Uint16 CEVT3:1; // 3 Capture Event 3 Interrupt Enable
  87. Uint16 CEVT4:1; // 4 Capture Event 4 Interrupt Enable
  88. Uint16 CTROVF:1; // 5 Counter Overflow Interrupt Enable
  89. Uint16 CTR_EQ_PRD:1; // 6 Period Equal Interrupt Enable
  90. Uint16 CTR_EQ_CMP:1; // 7 Compare Equal Interrupt Enable
  91. Uint16 rsvd2:8; // 15:8 Reserved
  92. };
  93. union ECEINT_REG {
  94. Uint16 all;
  95. struct ECEINT_BITS bit;
  96. };
  97. struct ECFLG_BITS { // bits description
  98. Uint16 INT:1; // 0 Global Flag
  99. Uint16 CEVT1:1; // 1 Capture Event 1 Interrupt Flag
  100. Uint16 CEVT2:1; // 2 Capture Event 2 Interrupt Flag
  101. Uint16 CEVT3:1; // 3 Capture Event 3 Interrupt Flag
  102. Uint16 CEVT4:1; // 4 Capture Event 4 Interrupt Flag
  103. Uint16 CTROVF:1; // 5 Counter Overflow Interrupt Flag
  104. Uint16 CTR_PRD:1; // 6 Period Equal Interrupt Flag
  105. Uint16 CTR_CMP:1; // 7 Compare Equal Interrupt Flag
  106. Uint16 rsvd1:8; // 15:8 Reserved
  107. };
  108. union ECFLG_REG {
  109. Uint16 all;
  110. struct ECFLG_BITS bit;
  111. };
  112. struct ECCLR_BITS { // bits description
  113. Uint16 INT:1; // 0 ECAP Global Interrupt Status Clear
  114. Uint16 CEVT1:1; // 1 Capture Event 1 Status Clear
  115. Uint16 CEVT2:1; // 2 Capture Event 2 Status Clear
  116. Uint16 CEVT3:1; // 3 Capture Event 3 Status Clear
  117. Uint16 CEVT4:1; // 4 Capture Event 4 Status Clear
  118. Uint16 CTROVF:1; // 5 Counter Overflow Status Clear
  119. Uint16 CTR_PRD:1; // 6 Period Equal Status Clear
  120. Uint16 CTR_CMP:1; // 7 Compare Equal Status Clear
  121. Uint16 rsvd1:8; // 15:8 Reserved
  122. };
  123. union ECCLR_REG {
  124. Uint16 all;
  125. struct ECCLR_BITS bit;
  126. };
  127. struct ECFRC_BITS { // bits description
  128. Uint16 rsvd1:1; // 0 Reserved
  129. Uint16 CEVT1:1; // 1 Capture Event 1 Force Interrupt
  130. Uint16 CEVT2:1; // 2 Capture Event 2 Force Interrupt
  131. Uint16 CEVT3:1; // 3 Capture Event 3 Force Interrupt
  132. Uint16 CEVT4:1; // 4 Capture Event 4 Force Interrupt
  133. Uint16 CTROVF:1; // 5 Counter Overflow Force Interrupt
  134. Uint16 CTR_PRD:1; // 6 Period Equal Force Interrupt
  135. Uint16 CTR_CMP:1; // 7 Compare Equal Force Interrupt
  136. Uint16 rsvd2:8; // 15:8 Reserved
  137. };
  138. union ECFRC_REG {
  139. Uint16 all;
  140. struct ECFRC_BITS bit;
  141. };
  142. struct ECAP_REGS {
  143. Uint32 TSCTR; // Time-Stamp Counter
  144. Uint32 CTRPHS; // Counter Phase Offset Value Register
  145. Uint32 CAP1; // Capture 1 Register
  146. Uint32 CAP2; // Capture 2 Register
  147. Uint32 CAP3; // Capture 3 Register
  148. Uint32 CAP4; // Capture 4 Register
  149. Uint16 rsvd1[8]; // Reserved
  150. union ECCTL1_REG ECCTL1; // Capture Control Register 1
  151. union ECCTL2_REG ECCTL2; // Capture Control Register 2
  152. union ECEINT_REG ECEINT; // Capture Interrupt Enable Register
  153. union ECFLG_REG ECFLG; // Capture Interrupt Flag Register
  154. union ECCLR_REG ECCLR; // Capture Interrupt Clear Register
  155. union ECFRC_REG ECFRC; // Capture Interrupt Force Register
  156. Uint16 rsvd2[6]; // Reserved
  157. };
  158. //---------------------------------------------------------------------------
  159. // ECAP External References & Function Declarations:
  160. //
  161. #ifdef CPU1
  162. extern volatile struct ECAP_REGS ECap1Regs;
  163. extern volatile struct ECAP_REGS ECap2Regs;
  164. extern volatile struct ECAP_REGS ECap3Regs;
  165. extern volatile struct ECAP_REGS ECap4Regs;
  166. extern volatile struct ECAP_REGS ECap5Regs;
  167. extern volatile struct ECAP_REGS ECap6Regs;
  168. #endif
  169. #ifdef CPU2
  170. extern volatile struct ECAP_REGS ECap1Regs;
  171. extern volatile struct ECAP_REGS ECap2Regs;
  172. extern volatile struct ECAP_REGS ECap3Regs;
  173. extern volatile struct ECAP_REGS ECap4Regs;
  174. extern volatile struct ECAP_REGS ECap5Regs;
  175. extern volatile struct ECAP_REGS ECap6Regs;
  176. #endif
  177. #ifdef __cplusplus
  178. }
  179. #endif /* extern "C" */
  180. #endif
  181. //===========================================================================
  182. // End of file.
  183. //===========================================================================