hw_ecap.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. //###########################################################################
  2. //
  3. // FILE: hw_ecap.h
  4. //
  5. // TITLE: Definitions for the C28x ECAP registers.
  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 __HW_ECAP_H__
  43. #define __HW_ECAP_H__
  44. //*****************************************************************************
  45. //
  46. // The following are defines for the ECAP register offsets
  47. //
  48. //*****************************************************************************
  49. #define ECAP_O_TSCTR 0x0 // Time-Stamp Counter
  50. #define ECAP_O_CTRPHS 0x2 // Counter Phase Offset Value
  51. // Register
  52. #define ECAP_O_CAP1 0x4 // Capture 1 Register
  53. #define ECAP_O_CAP2 0x6 // Capture 2 Register
  54. #define ECAP_O_CAP3 0x8 // Capture 3Register
  55. #define ECAP_O_CAP4 0xA // Capture 4 Register
  56. #define ECAP_O_ECCTL1 0x14 // Capture Control Register 1
  57. #define ECAP_O_ECCTL2 0x15 // Capture Control Register 2
  58. #define ECAP_O_ECEINT 0x16 // Capture Interrupt Enable
  59. // Register
  60. #define ECAP_O_ECFLG 0x17 // Capture Interrupt Flag Register
  61. #define ECAP_O_ECCLR 0x18 // Capture Interrupt Flag Register
  62. #define ECAP_O_ECFRC 0x19 // Capture Interrupt Force
  63. // Register
  64. //*****************************************************************************
  65. //
  66. // The following are defines for the bit fields in the TSCTR register
  67. //
  68. //*****************************************************************************
  69. #define ECAP_TSCTR_TSCTR_S 0
  70. #define ECAP_TSCTR_TSCTR_M 0xFFFFFFFF // Time Stamp Counter
  71. //*****************************************************************************
  72. //
  73. // The following are defines for the bit fields in the CTRPHS register
  74. //
  75. //*****************************************************************************
  76. #define ECAP_CTRPHS_CTRPHS_S 0
  77. #define ECAP_CTRPHS_CTRPHS_M 0xFFFFFFFF // Counter phase
  78. //*****************************************************************************
  79. //
  80. // The following are defines for the bit fields in the CAP1 register
  81. //
  82. //*****************************************************************************
  83. #define ECAP_CAP1_CAP1_S 0
  84. #define ECAP_CAP1_CAP1_M 0xFFFFFFFF // Capture 1
  85. //*****************************************************************************
  86. //
  87. // The following are defines for the bit fields in the CAP2 register
  88. //
  89. //*****************************************************************************
  90. #define ECAP_CAP2_CAP2_S 0
  91. #define ECAP_CAP2_CAP2_M 0xFFFFFFFF // Capture 2
  92. //*****************************************************************************
  93. //
  94. // The following are defines for the bit fields in the CAP3 register
  95. //
  96. //*****************************************************************************
  97. #define ECAP_CAP3_CAP3_S 0
  98. #define ECAP_CAP3_CAP3_M 0xFFFFFFFF // Capture 3
  99. //*****************************************************************************
  100. //
  101. // The following are defines for the bit fields in the CAP4 register
  102. //
  103. //*****************************************************************************
  104. #define ECAP_CAP4_CAP4_S 0
  105. #define ECAP_CAP4_CAP4_M 0xFFFFFFFF // Capture 4
  106. //*****************************************************************************
  107. //
  108. // The following are defines for the bit fields in the ECCTL1 register
  109. //
  110. //*****************************************************************************
  111. #define ECAP_ECCTL1_CAP1POL 0x1 // Capture Event 1 Polarity select
  112. #define ECAP_ECCTL1_CTRRST1 0x2 // Counter Reset on Capture Event
  113. // 1
  114. #define ECAP_ECCTL1_CAP2POL 0x4 // Capture Event 2 Polarity select
  115. #define ECAP_ECCTL1_CTRRST2 0x8 // Counter Reset on Capture Event
  116. // 2
  117. #define ECAP_ECCTL1_CAP3POL 0x10 // Capture Event 3 Polarity select
  118. #define ECAP_ECCTL1_CTRRST3 0x20 // Counter Reset on Capture Event
  119. // 3
  120. #define ECAP_ECCTL1_CAP4POL 0x40 // Capture Event 4 Polarity select
  121. #define ECAP_ECCTL1_CTRRST4 0x80 // Counter Reset on Capture Event
  122. // 4
  123. #define ECAP_ECCTL1_CAPLDEN 0x100 // Enable Loading CAP1-4 regs on a
  124. // Cap Event
  125. #define ECAP_ECCTL1_PRESCALE_S 9
  126. #define ECAP_ECCTL1_PRESCALE_M 0x3E00 // Event Filter prescale select
  127. #define ECAP_ECCTL1_FREE_SOFT_S 14
  128. #define ECAP_ECCTL1_FREE_SOFT_M 0xC000 // Emulation mode
  129. //*****************************************************************************
  130. //
  131. // The following are defines for the bit fields in the ECCTL2 register
  132. //
  133. //*****************************************************************************
  134. #define ECAP_ECCTL2_CONT_ONESHT 0x1 // Continuous or one-shot
  135. #define ECAP_ECCTL2_STOP_WRAP_S 1
  136. #define ECAP_ECCTL2_STOP_WRAP_M 0x6 // Stop value for one-shot, Wrap
  137. // for continuous
  138. #define ECAP_ECCTL2_RE_ARM 0x8 // One-shot re-arm
  139. #define ECAP_ECCTL2_TSCTRSTOP 0x10 // TSCNT counter stop
  140. #define ECAP_ECCTL2_SYNCI_EN 0x20 // Counter sync-in select
  141. #define ECAP_ECCTL2_SYNCO_SEL_S 6
  142. #define ECAP_ECCTL2_SYNCO_SEL_M 0xC0 // Sync-out mode
  143. #define ECAP_ECCTL2_SWSYNC 0x100 // SW forced counter sync
  144. #define ECAP_ECCTL2_CAP_APWM 0x200 // CAP/APWM operating mode select
  145. #define ECAP_ECCTL2_APWMPOL 0x400 // APWM output polarity select
  146. //*****************************************************************************
  147. //
  148. // The following are defines for the bit fields in the ECEINT register
  149. //
  150. //*****************************************************************************
  151. #define ECAP_ECEINT_CEVT1 0x2 // Capture Event 1 Interrupt
  152. // Enable
  153. #define ECAP_ECEINT_CEVT2 0x4 // Capture Event 2 Interrupt
  154. // Enable
  155. #define ECAP_ECEINT_CEVT3 0x8 // Capture Event 3 Interrupt
  156. // Enable
  157. #define ECAP_ECEINT_CEVT4 0x10 // Capture Event 4 Interrupt
  158. // Enable
  159. #define ECAP_ECEINT_CTROVF 0x20 // Counter Overflow Interrupt
  160. // Enable
  161. #define ECAP_ECEINT_CTR_PRD 0x40 // Period Equal Interrupt Enable
  162. #define ECAP_ECEINT_CTR_CMP 0x80 // Compare Equal Interrupt Enable
  163. //*****************************************************************************
  164. //
  165. // The following are defines for the bit fields in the ECFLG register
  166. //
  167. //*****************************************************************************
  168. #define ECAP_ECFLG_INT 0x1 // Global Flag
  169. #define ECAP_ECFLG_CEVT1 0x2 // Capture Event 1 Interrupt Flag
  170. #define ECAP_ECFLG_CEVT2 0x4 // Capture Event 2 Interrupt Flag
  171. #define ECAP_ECFLG_CEVT3 0x8 // Capture Event 3 Interrupt Flag
  172. #define ECAP_ECFLG_CEVT4 0x10 // Capture Event 4 Interrupt Flag
  173. #define ECAP_ECFLG_CTROVF 0x20 // Counter Overflow Interrupt Flag
  174. #define ECAP_ECFLG_CTR_PRD 0x40 // Period Equal Interrupt Flag
  175. #define ECAP_ECFLG_CTR_CMP 0x80 // Compare Equal Interrupt Flag
  176. //*****************************************************************************
  177. //
  178. // The following are defines for the bit fields in the ECCLR register
  179. //
  180. //*****************************************************************************
  181. #define ECAP_ECCLR_INT 0x1 // Global Flag
  182. #define ECAP_ECCLR_CEVT1 0x2 // Capture Event 1 Interrupt Flag
  183. #define ECAP_ECCLR_CEVT2 0x4 // Capture Event 2 Interrupt Flag
  184. #define ECAP_ECCLR_CEVT3 0x8 // Capture Event 3 Interrupt Flag
  185. #define ECAP_ECCLR_CEVT4 0x10 // Capture Event 4 Interrupt Flag
  186. #define ECAP_ECCLR_CTROVF 0x20 // Counter Overflow Interrupt Flag
  187. #define ECAP_ECCLR_CTR_PRD 0x40 // Period Equal Interrupt Flag
  188. #define ECAP_ECCLR_CTR_CMP 0x80 // Compare Equal Interrupt Flag
  189. //*****************************************************************************
  190. //
  191. // The following are defines for the bit fields in the ECFRC register
  192. //
  193. //*****************************************************************************
  194. #define ECAP_ECFRC_CEVT1 0x2 // Capture Event 1 Interrupt
  195. // Enable
  196. #define ECAP_ECFRC_CEVT2 0x4 // Capture Event 2 Interrupt
  197. // Enable
  198. #define ECAP_ECFRC_CEVT3 0x8 // Capture Event 3 Interrupt
  199. // Enable
  200. #define ECAP_ECFRC_CEVT4 0x10 // Capture Event 4 Interrupt
  201. // Enable
  202. #define ECAP_ECFRC_CTROVF 0x20 // Counter Overflow Interrupt
  203. // Enable
  204. #define ECAP_ECFRC_CTR_PRD 0x40 // Period Equal Interrupt Enable
  205. #define ECAP_ECFRC_CTR_CMP 0x80 // Compare Equal Interrupt Enable
  206. #endif