tc.h 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. /**
  2. * \file
  3. *
  4. * \brief Component description for TC
  5. *
  6. * Copyright (c) 2018 Microchip Technology Inc.
  7. *
  8. * \asf_license_start
  9. *
  10. * \page License
  11. *
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the Licence at
  17. *
  18. * http://www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. *
  26. * \asf_license_stop
  27. *
  28. */
  29. #ifndef _SAMD11_TC_COMPONENT_
  30. #define _SAMD11_TC_COMPONENT_
  31. /* ========================================================================== */
  32. /** SOFTWARE API DEFINITION FOR TC */
  33. /* ========================================================================== */
  34. /** \addtogroup SAMD11_TC Basic Timer Counter */
  35. /*@{*/
  36. #define TC_U2212
  37. #define REV_TC 0x140
  38. /* -------- TC_CTRLA : (TC Offset: 0x00) (R/W 16) Control A -------- */
  39. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  40. typedef union {
  41. struct {
  42. uint16_t SWRST:1; /*!< bit: 0 Software Reset */
  43. uint16_t ENABLE:1; /*!< bit: 1 Enable */
  44. uint16_t MODE:2; /*!< bit: 2.. 3 TC Mode */
  45. uint16_t :1; /*!< bit: 4 Reserved */
  46. uint16_t WAVEGEN:2; /*!< bit: 5.. 6 Waveform Generation Operation */
  47. uint16_t :1; /*!< bit: 7 Reserved */
  48. uint16_t PRESCALER:3; /*!< bit: 8..10 Prescaler */
  49. uint16_t RUNSTDBY:1; /*!< bit: 11 Run in Standby */
  50. uint16_t PRESCSYNC:2; /*!< bit: 12..13 Prescaler and Counter Synchronization */
  51. uint16_t :2; /*!< bit: 14..15 Reserved */
  52. } bit; /*!< Structure used for bit access */
  53. uint16_t reg; /*!< Type used for register access */
  54. } TC_CTRLA_Type;
  55. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  56. #define TC_CTRLA_OFFSET 0x00 /**< \brief (TC_CTRLA offset) Control A */
  57. #define TC_CTRLA_RESETVALUE _U_(0x0000) /**< \brief (TC_CTRLA reset_value) Control A */
  58. #define TC_CTRLA_SWRST_Pos 0 /**< \brief (TC_CTRLA) Software Reset */
  59. #define TC_CTRLA_SWRST (_U_(0x1) << TC_CTRLA_SWRST_Pos)
  60. #define TC_CTRLA_ENABLE_Pos 1 /**< \brief (TC_CTRLA) Enable */
  61. #define TC_CTRLA_ENABLE (_U_(0x1) << TC_CTRLA_ENABLE_Pos)
  62. #define TC_CTRLA_MODE_Pos 2 /**< \brief (TC_CTRLA) TC Mode */
  63. #define TC_CTRLA_MODE_Msk (_U_(0x3) << TC_CTRLA_MODE_Pos)
  64. #define TC_CTRLA_MODE(value) (TC_CTRLA_MODE_Msk & ((value) << TC_CTRLA_MODE_Pos))
  65. #define TC_CTRLA_MODE_COUNT16_Val _U_(0x0) /**< \brief (TC_CTRLA) Counter in 16-bit mode */
  66. #define TC_CTRLA_MODE_COUNT8_Val _U_(0x1) /**< \brief (TC_CTRLA) Counter in 8-bit mode */
  67. #define TC_CTRLA_MODE_COUNT32_Val _U_(0x2) /**< \brief (TC_CTRLA) Counter in 32-bit mode */
  68. #define TC_CTRLA_MODE_COUNT16 (TC_CTRLA_MODE_COUNT16_Val << TC_CTRLA_MODE_Pos)
  69. #define TC_CTRLA_MODE_COUNT8 (TC_CTRLA_MODE_COUNT8_Val << TC_CTRLA_MODE_Pos)
  70. #define TC_CTRLA_MODE_COUNT32 (TC_CTRLA_MODE_COUNT32_Val << TC_CTRLA_MODE_Pos)
  71. #define TC_CTRLA_WAVEGEN_Pos 5 /**< \brief (TC_CTRLA) Waveform Generation Operation */
  72. #define TC_CTRLA_WAVEGEN_Msk (_U_(0x3) << TC_CTRLA_WAVEGEN_Pos)
  73. #define TC_CTRLA_WAVEGEN(value) (TC_CTRLA_WAVEGEN_Msk & ((value) << TC_CTRLA_WAVEGEN_Pos))
  74. #define TC_CTRLA_WAVEGEN_NFRQ_Val _U_(0x0) /**< \brief (TC_CTRLA) */
  75. #define TC_CTRLA_WAVEGEN_MFRQ_Val _U_(0x1) /**< \brief (TC_CTRLA) */
  76. #define TC_CTRLA_WAVEGEN_NPWM_Val _U_(0x2) /**< \brief (TC_CTRLA) */
  77. #define TC_CTRLA_WAVEGEN_MPWM_Val _U_(0x3) /**< \brief (TC_CTRLA) */
  78. #define TC_CTRLA_WAVEGEN_NFRQ (TC_CTRLA_WAVEGEN_NFRQ_Val << TC_CTRLA_WAVEGEN_Pos)
  79. #define TC_CTRLA_WAVEGEN_MFRQ (TC_CTRLA_WAVEGEN_MFRQ_Val << TC_CTRLA_WAVEGEN_Pos)
  80. #define TC_CTRLA_WAVEGEN_NPWM (TC_CTRLA_WAVEGEN_NPWM_Val << TC_CTRLA_WAVEGEN_Pos)
  81. #define TC_CTRLA_WAVEGEN_MPWM (TC_CTRLA_WAVEGEN_MPWM_Val << TC_CTRLA_WAVEGEN_Pos)
  82. #define TC_CTRLA_PRESCALER_Pos 8 /**< \brief (TC_CTRLA) Prescaler */
  83. #define TC_CTRLA_PRESCALER_Msk (_U_(0x7) << TC_CTRLA_PRESCALER_Pos)
  84. #define TC_CTRLA_PRESCALER(value) (TC_CTRLA_PRESCALER_Msk & ((value) << TC_CTRLA_PRESCALER_Pos))
  85. #define TC_CTRLA_PRESCALER_DIV1_Val _U_(0x0) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC */
  86. #define TC_CTRLA_PRESCALER_DIV2_Val _U_(0x1) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/2 */
  87. #define TC_CTRLA_PRESCALER_DIV4_Val _U_(0x2) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/4 */
  88. #define TC_CTRLA_PRESCALER_DIV8_Val _U_(0x3) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/8 */
  89. #define TC_CTRLA_PRESCALER_DIV16_Val _U_(0x4) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/16 */
  90. #define TC_CTRLA_PRESCALER_DIV64_Val _U_(0x5) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/64 */
  91. #define TC_CTRLA_PRESCALER_DIV256_Val _U_(0x6) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/256 */
  92. #define TC_CTRLA_PRESCALER_DIV1024_Val _U_(0x7) /**< \brief (TC_CTRLA) Prescaler: GCLK_TC/1024 */
  93. #define TC_CTRLA_PRESCALER_DIV1 (TC_CTRLA_PRESCALER_DIV1_Val << TC_CTRLA_PRESCALER_Pos)
  94. #define TC_CTRLA_PRESCALER_DIV2 (TC_CTRLA_PRESCALER_DIV2_Val << TC_CTRLA_PRESCALER_Pos)
  95. #define TC_CTRLA_PRESCALER_DIV4 (TC_CTRLA_PRESCALER_DIV4_Val << TC_CTRLA_PRESCALER_Pos)
  96. #define TC_CTRLA_PRESCALER_DIV8 (TC_CTRLA_PRESCALER_DIV8_Val << TC_CTRLA_PRESCALER_Pos)
  97. #define TC_CTRLA_PRESCALER_DIV16 (TC_CTRLA_PRESCALER_DIV16_Val << TC_CTRLA_PRESCALER_Pos)
  98. #define TC_CTRLA_PRESCALER_DIV64 (TC_CTRLA_PRESCALER_DIV64_Val << TC_CTRLA_PRESCALER_Pos)
  99. #define TC_CTRLA_PRESCALER_DIV256 (TC_CTRLA_PRESCALER_DIV256_Val << TC_CTRLA_PRESCALER_Pos)
  100. #define TC_CTRLA_PRESCALER_DIV1024 (TC_CTRLA_PRESCALER_DIV1024_Val << TC_CTRLA_PRESCALER_Pos)
  101. #define TC_CTRLA_RUNSTDBY_Pos 11 /**< \brief (TC_CTRLA) Run in Standby */
  102. #define TC_CTRLA_RUNSTDBY (_U_(0x1) << TC_CTRLA_RUNSTDBY_Pos)
  103. #define TC_CTRLA_PRESCSYNC_Pos 12 /**< \brief (TC_CTRLA) Prescaler and Counter Synchronization */
  104. #define TC_CTRLA_PRESCSYNC_Msk (_U_(0x3) << TC_CTRLA_PRESCSYNC_Pos)
  105. #define TC_CTRLA_PRESCSYNC(value) (TC_CTRLA_PRESCSYNC_Msk & ((value) << TC_CTRLA_PRESCSYNC_Pos))
  106. #define TC_CTRLA_PRESCSYNC_GCLK_Val _U_(0x0) /**< \brief (TC_CTRLA) Reload or reset the counter on next generic clock */
  107. #define TC_CTRLA_PRESCSYNC_PRESC_Val _U_(0x1) /**< \brief (TC_CTRLA) Reload or reset the counter on next prescaler clock */
  108. #define TC_CTRLA_PRESCSYNC_RESYNC_Val _U_(0x2) /**< \brief (TC_CTRLA) Reload or reset the counter on next generic clock. Reset the prescaler counter */
  109. #define TC_CTRLA_PRESCSYNC_GCLK (TC_CTRLA_PRESCSYNC_GCLK_Val << TC_CTRLA_PRESCSYNC_Pos)
  110. #define TC_CTRLA_PRESCSYNC_PRESC (TC_CTRLA_PRESCSYNC_PRESC_Val << TC_CTRLA_PRESCSYNC_Pos)
  111. #define TC_CTRLA_PRESCSYNC_RESYNC (TC_CTRLA_PRESCSYNC_RESYNC_Val << TC_CTRLA_PRESCSYNC_Pos)
  112. #define TC_CTRLA_MASK _U_(0x3F6F) /**< \brief (TC_CTRLA) MASK Register */
  113. /* -------- TC_READREQ : (TC Offset: 0x02) (R/W 16) Read Request -------- */
  114. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  115. typedef union {
  116. struct {
  117. uint16_t ADDR:5; /*!< bit: 0.. 4 Address */
  118. uint16_t :9; /*!< bit: 5..13 Reserved */
  119. uint16_t RCONT:1; /*!< bit: 14 Read Continuously */
  120. uint16_t RREQ:1; /*!< bit: 15 Read Request */
  121. } bit; /*!< Structure used for bit access */
  122. uint16_t reg; /*!< Type used for register access */
  123. } TC_READREQ_Type;
  124. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  125. #define TC_READREQ_OFFSET 0x02 /**< \brief (TC_READREQ offset) Read Request */
  126. #define TC_READREQ_RESETVALUE _U_(0x0000) /**< \brief (TC_READREQ reset_value) Read Request */
  127. #define TC_READREQ_ADDR_Pos 0 /**< \brief (TC_READREQ) Address */
  128. #define TC_READREQ_ADDR_Msk (_U_(0x1F) << TC_READREQ_ADDR_Pos)
  129. #define TC_READREQ_ADDR(value) (TC_READREQ_ADDR_Msk & ((value) << TC_READREQ_ADDR_Pos))
  130. #define TC_READREQ_RCONT_Pos 14 /**< \brief (TC_READREQ) Read Continuously */
  131. #define TC_READREQ_RCONT (_U_(0x1) << TC_READREQ_RCONT_Pos)
  132. #define TC_READREQ_RREQ_Pos 15 /**< \brief (TC_READREQ) Read Request */
  133. #define TC_READREQ_RREQ (_U_(0x1) << TC_READREQ_RREQ_Pos)
  134. #define TC_READREQ_MASK _U_(0xC01F) /**< \brief (TC_READREQ) MASK Register */
  135. /* -------- TC_CTRLBCLR : (TC Offset: 0x04) (R/W 8) Control B Clear -------- */
  136. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  137. typedef union {
  138. struct {
  139. uint8_t DIR:1; /*!< bit: 0 Counter Direction */
  140. uint8_t :1; /*!< bit: 1 Reserved */
  141. uint8_t ONESHOT:1; /*!< bit: 2 One-Shot */
  142. uint8_t :3; /*!< bit: 3.. 5 Reserved */
  143. uint8_t CMD:2; /*!< bit: 6.. 7 Command */
  144. } bit; /*!< Structure used for bit access */
  145. uint8_t reg; /*!< Type used for register access */
  146. } TC_CTRLBCLR_Type;
  147. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  148. #define TC_CTRLBCLR_OFFSET 0x04 /**< \brief (TC_CTRLBCLR offset) Control B Clear */
  149. #define TC_CTRLBCLR_RESETVALUE _U_(0x02) /**< \brief (TC_CTRLBCLR reset_value) Control B Clear */
  150. #define TC_CTRLBCLR_DIR_Pos 0 /**< \brief (TC_CTRLBCLR) Counter Direction */
  151. #define TC_CTRLBCLR_DIR (_U_(0x1) << TC_CTRLBCLR_DIR_Pos)
  152. #define TC_CTRLBCLR_ONESHOT_Pos 2 /**< \brief (TC_CTRLBCLR) One-Shot */
  153. #define TC_CTRLBCLR_ONESHOT (_U_(0x1) << TC_CTRLBCLR_ONESHOT_Pos)
  154. #define TC_CTRLBCLR_CMD_Pos 6 /**< \brief (TC_CTRLBCLR) Command */
  155. #define TC_CTRLBCLR_CMD_Msk (_U_(0x3) << TC_CTRLBCLR_CMD_Pos)
  156. #define TC_CTRLBCLR_CMD(value) (TC_CTRLBCLR_CMD_Msk & ((value) << TC_CTRLBCLR_CMD_Pos))
  157. #define TC_CTRLBCLR_CMD_NONE_Val _U_(0x0) /**< \brief (TC_CTRLBCLR) No action */
  158. #define TC_CTRLBCLR_CMD_RETRIGGER_Val _U_(0x1) /**< \brief (TC_CTRLBCLR) Force a start, restart or retrigger */
  159. #define TC_CTRLBCLR_CMD_STOP_Val _U_(0x2) /**< \brief (TC_CTRLBCLR) Force a stop */
  160. #define TC_CTRLBCLR_CMD_NONE (TC_CTRLBCLR_CMD_NONE_Val << TC_CTRLBCLR_CMD_Pos)
  161. #define TC_CTRLBCLR_CMD_RETRIGGER (TC_CTRLBCLR_CMD_RETRIGGER_Val << TC_CTRLBCLR_CMD_Pos)
  162. #define TC_CTRLBCLR_CMD_STOP (TC_CTRLBCLR_CMD_STOP_Val << TC_CTRLBCLR_CMD_Pos)
  163. #define TC_CTRLBCLR_MASK _U_(0xC5) /**< \brief (TC_CTRLBCLR) MASK Register */
  164. /* -------- TC_CTRLBSET : (TC Offset: 0x05) (R/W 8) Control B Set -------- */
  165. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  166. typedef union {
  167. struct {
  168. uint8_t DIR:1; /*!< bit: 0 Counter Direction */
  169. uint8_t :1; /*!< bit: 1 Reserved */
  170. uint8_t ONESHOT:1; /*!< bit: 2 One-Shot */
  171. uint8_t :3; /*!< bit: 3.. 5 Reserved */
  172. uint8_t CMD:2; /*!< bit: 6.. 7 Command */
  173. } bit; /*!< Structure used for bit access */
  174. uint8_t reg; /*!< Type used for register access */
  175. } TC_CTRLBSET_Type;
  176. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  177. #define TC_CTRLBSET_OFFSET 0x05 /**< \brief (TC_CTRLBSET offset) Control B Set */
  178. #define TC_CTRLBSET_RESETVALUE _U_(0x00) /**< \brief (TC_CTRLBSET reset_value) Control B Set */
  179. #define TC_CTRLBSET_DIR_Pos 0 /**< \brief (TC_CTRLBSET) Counter Direction */
  180. #define TC_CTRLBSET_DIR (_U_(0x1) << TC_CTRLBSET_DIR_Pos)
  181. #define TC_CTRLBSET_ONESHOT_Pos 2 /**< \brief (TC_CTRLBSET) One-Shot */
  182. #define TC_CTRLBSET_ONESHOT (_U_(0x1) << TC_CTRLBSET_ONESHOT_Pos)
  183. #define TC_CTRLBSET_CMD_Pos 6 /**< \brief (TC_CTRLBSET) Command */
  184. #define TC_CTRLBSET_CMD_Msk (_U_(0x3) << TC_CTRLBSET_CMD_Pos)
  185. #define TC_CTRLBSET_CMD(value) (TC_CTRLBSET_CMD_Msk & ((value) << TC_CTRLBSET_CMD_Pos))
  186. #define TC_CTRLBSET_CMD_NONE_Val _U_(0x0) /**< \brief (TC_CTRLBSET) No action */
  187. #define TC_CTRLBSET_CMD_RETRIGGER_Val _U_(0x1) /**< \brief (TC_CTRLBSET) Force a start, restart or retrigger */
  188. #define TC_CTRLBSET_CMD_STOP_Val _U_(0x2) /**< \brief (TC_CTRLBSET) Force a stop */
  189. #define TC_CTRLBSET_CMD_NONE (TC_CTRLBSET_CMD_NONE_Val << TC_CTRLBSET_CMD_Pos)
  190. #define TC_CTRLBSET_CMD_RETRIGGER (TC_CTRLBSET_CMD_RETRIGGER_Val << TC_CTRLBSET_CMD_Pos)
  191. #define TC_CTRLBSET_CMD_STOP (TC_CTRLBSET_CMD_STOP_Val << TC_CTRLBSET_CMD_Pos)
  192. #define TC_CTRLBSET_MASK _U_(0xC5) /**< \brief (TC_CTRLBSET) MASK Register */
  193. /* -------- TC_CTRLC : (TC Offset: 0x06) (R/W 8) Control C -------- */
  194. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  195. typedef union {
  196. struct {
  197. uint8_t INVEN0:1; /*!< bit: 0 Output Waveform 0 Invert Enable */
  198. uint8_t INVEN1:1; /*!< bit: 1 Output Waveform 1 Invert Enable */
  199. uint8_t :2; /*!< bit: 2.. 3 Reserved */
  200. uint8_t CPTEN0:1; /*!< bit: 4 Capture Channel 0 Enable */
  201. uint8_t CPTEN1:1; /*!< bit: 5 Capture Channel 1 Enable */
  202. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  203. } bit; /*!< Structure used for bit access */
  204. struct {
  205. uint8_t INVEN:2; /*!< bit: 0.. 1 Output Waveform x Invert Enable */
  206. uint8_t :2; /*!< bit: 2.. 3 Reserved */
  207. uint8_t CPTEN:2; /*!< bit: 4.. 5 Capture Channel x Enable */
  208. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  209. } vec; /*!< Structure used for vec access */
  210. uint8_t reg; /*!< Type used for register access */
  211. } TC_CTRLC_Type;
  212. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  213. #define TC_CTRLC_OFFSET 0x06 /**< \brief (TC_CTRLC offset) Control C */
  214. #define TC_CTRLC_RESETVALUE _U_(0x00) /**< \brief (TC_CTRLC reset_value) Control C */
  215. #define TC_CTRLC_INVEN0_Pos 0 /**< \brief (TC_CTRLC) Output Waveform 0 Invert Enable */
  216. #define TC_CTRLC_INVEN0 (_U_(1) << TC_CTRLC_INVEN0_Pos)
  217. #define TC_CTRLC_INVEN1_Pos 1 /**< \brief (TC_CTRLC) Output Waveform 1 Invert Enable */
  218. #define TC_CTRLC_INVEN1 (_U_(1) << TC_CTRLC_INVEN1_Pos)
  219. #define TC_CTRLC_INVEN_Pos 0 /**< \brief (TC_CTRLC) Output Waveform x Invert Enable */
  220. #define TC_CTRLC_INVEN_Msk (_U_(0x3) << TC_CTRLC_INVEN_Pos)
  221. #define TC_CTRLC_INVEN(value) (TC_CTRLC_INVEN_Msk & ((value) << TC_CTRLC_INVEN_Pos))
  222. #define TC_CTRLC_CPTEN0_Pos 4 /**< \brief (TC_CTRLC) Capture Channel 0 Enable */
  223. #define TC_CTRLC_CPTEN0 (_U_(1) << TC_CTRLC_CPTEN0_Pos)
  224. #define TC_CTRLC_CPTEN1_Pos 5 /**< \brief (TC_CTRLC) Capture Channel 1 Enable */
  225. #define TC_CTRLC_CPTEN1 (_U_(1) << TC_CTRLC_CPTEN1_Pos)
  226. #define TC_CTRLC_CPTEN_Pos 4 /**< \brief (TC_CTRLC) Capture Channel x Enable */
  227. #define TC_CTRLC_CPTEN_Msk (_U_(0x3) << TC_CTRLC_CPTEN_Pos)
  228. #define TC_CTRLC_CPTEN(value) (TC_CTRLC_CPTEN_Msk & ((value) << TC_CTRLC_CPTEN_Pos))
  229. #define TC_CTRLC_MASK _U_(0x33) /**< \brief (TC_CTRLC) MASK Register */
  230. /* -------- TC_DBGCTRL : (TC Offset: 0x08) (R/W 8) Debug Control -------- */
  231. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  232. typedef union {
  233. struct {
  234. uint8_t DBGRUN:1; /*!< bit: 0 Debug Run Mode */
  235. uint8_t :7; /*!< bit: 1.. 7 Reserved */
  236. } bit; /*!< Structure used for bit access */
  237. uint8_t reg; /*!< Type used for register access */
  238. } TC_DBGCTRL_Type;
  239. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  240. #define TC_DBGCTRL_OFFSET 0x08 /**< \brief (TC_DBGCTRL offset) Debug Control */
  241. #define TC_DBGCTRL_RESETVALUE _U_(0x00) /**< \brief (TC_DBGCTRL reset_value) Debug Control */
  242. #define TC_DBGCTRL_DBGRUN_Pos 0 /**< \brief (TC_DBGCTRL) Debug Run Mode */
  243. #define TC_DBGCTRL_DBGRUN (_U_(0x1) << TC_DBGCTRL_DBGRUN_Pos)
  244. #define TC_DBGCTRL_MASK _U_(0x01) /**< \brief (TC_DBGCTRL) MASK Register */
  245. /* -------- TC_EVCTRL : (TC Offset: 0x0A) (R/W 16) Event Control -------- */
  246. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  247. typedef union {
  248. struct {
  249. uint16_t EVACT:3; /*!< bit: 0.. 2 Event Action */
  250. uint16_t :1; /*!< bit: 3 Reserved */
  251. uint16_t TCINV:1; /*!< bit: 4 TC Inverted Event Input */
  252. uint16_t TCEI:1; /*!< bit: 5 TC Event Input */
  253. uint16_t :2; /*!< bit: 6.. 7 Reserved */
  254. uint16_t OVFEO:1; /*!< bit: 8 Overflow/Underflow Event Output Enable */
  255. uint16_t :3; /*!< bit: 9..11 Reserved */
  256. uint16_t MCEO0:1; /*!< bit: 12 Match or Capture Channel 0 Event Output Enable */
  257. uint16_t MCEO1:1; /*!< bit: 13 Match or Capture Channel 1 Event Output Enable */
  258. uint16_t :2; /*!< bit: 14..15 Reserved */
  259. } bit; /*!< Structure used for bit access */
  260. struct {
  261. uint16_t :12; /*!< bit: 0..11 Reserved */
  262. uint16_t MCEO:2; /*!< bit: 12..13 Match or Capture Channel x Event Output Enable */
  263. uint16_t :2; /*!< bit: 14..15 Reserved */
  264. } vec; /*!< Structure used for vec access */
  265. uint16_t reg; /*!< Type used for register access */
  266. } TC_EVCTRL_Type;
  267. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  268. #define TC_EVCTRL_OFFSET 0x0A /**< \brief (TC_EVCTRL offset) Event Control */
  269. #define TC_EVCTRL_RESETVALUE _U_(0x0000) /**< \brief (TC_EVCTRL reset_value) Event Control */
  270. #define TC_EVCTRL_EVACT_Pos 0 /**< \brief (TC_EVCTRL) Event Action */
  271. #define TC_EVCTRL_EVACT_Msk (_U_(0x7) << TC_EVCTRL_EVACT_Pos)
  272. #define TC_EVCTRL_EVACT(value) (TC_EVCTRL_EVACT_Msk & ((value) << TC_EVCTRL_EVACT_Pos))
  273. #define TC_EVCTRL_EVACT_OFF_Val _U_(0x0) /**< \brief (TC_EVCTRL) Event action disabled */
  274. #define TC_EVCTRL_EVACT_RETRIGGER_Val _U_(0x1) /**< \brief (TC_EVCTRL) Start, restart or retrigger TC on event */
  275. #define TC_EVCTRL_EVACT_COUNT_Val _U_(0x2) /**< \brief (TC_EVCTRL) Count on event */
  276. #define TC_EVCTRL_EVACT_START_Val _U_(0x3) /**< \brief (TC_EVCTRL) Start TC on event */
  277. #define TC_EVCTRL_EVACT_PPW_Val _U_(0x5) /**< \brief (TC_EVCTRL) Period captured in CC0, pulse width in CC1 */
  278. #define TC_EVCTRL_EVACT_PWP_Val _U_(0x6) /**< \brief (TC_EVCTRL) Period captured in CC1, pulse width in CC0 */
  279. #define TC_EVCTRL_EVACT_OFF (TC_EVCTRL_EVACT_OFF_Val << TC_EVCTRL_EVACT_Pos)
  280. #define TC_EVCTRL_EVACT_RETRIGGER (TC_EVCTRL_EVACT_RETRIGGER_Val << TC_EVCTRL_EVACT_Pos)
  281. #define TC_EVCTRL_EVACT_COUNT (TC_EVCTRL_EVACT_COUNT_Val << TC_EVCTRL_EVACT_Pos)
  282. #define TC_EVCTRL_EVACT_START (TC_EVCTRL_EVACT_START_Val << TC_EVCTRL_EVACT_Pos)
  283. #define TC_EVCTRL_EVACT_PPW (TC_EVCTRL_EVACT_PPW_Val << TC_EVCTRL_EVACT_Pos)
  284. #define TC_EVCTRL_EVACT_PWP (TC_EVCTRL_EVACT_PWP_Val << TC_EVCTRL_EVACT_Pos)
  285. #define TC_EVCTRL_TCINV_Pos 4 /**< \brief (TC_EVCTRL) TC Inverted Event Input */
  286. #define TC_EVCTRL_TCINV (_U_(0x1) << TC_EVCTRL_TCINV_Pos)
  287. #define TC_EVCTRL_TCEI_Pos 5 /**< \brief (TC_EVCTRL) TC Event Input */
  288. #define TC_EVCTRL_TCEI (_U_(0x1) << TC_EVCTRL_TCEI_Pos)
  289. #define TC_EVCTRL_OVFEO_Pos 8 /**< \brief (TC_EVCTRL) Overflow/Underflow Event Output Enable */
  290. #define TC_EVCTRL_OVFEO (_U_(0x1) << TC_EVCTRL_OVFEO_Pos)
  291. #define TC_EVCTRL_MCEO0_Pos 12 /**< \brief (TC_EVCTRL) Match or Capture Channel 0 Event Output Enable */
  292. #define TC_EVCTRL_MCEO0 (_U_(1) << TC_EVCTRL_MCEO0_Pos)
  293. #define TC_EVCTRL_MCEO1_Pos 13 /**< \brief (TC_EVCTRL) Match or Capture Channel 1 Event Output Enable */
  294. #define TC_EVCTRL_MCEO1 (_U_(1) << TC_EVCTRL_MCEO1_Pos)
  295. #define TC_EVCTRL_MCEO_Pos 12 /**< \brief (TC_EVCTRL) Match or Capture Channel x Event Output Enable */
  296. #define TC_EVCTRL_MCEO_Msk (_U_(0x3) << TC_EVCTRL_MCEO_Pos)
  297. #define TC_EVCTRL_MCEO(value) (TC_EVCTRL_MCEO_Msk & ((value) << TC_EVCTRL_MCEO_Pos))
  298. #define TC_EVCTRL_MASK _U_(0x3137) /**< \brief (TC_EVCTRL) MASK Register */
  299. /* -------- TC_INTENCLR : (TC Offset: 0x0C) (R/W 8) Interrupt Enable Clear -------- */
  300. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  301. typedef union {
  302. struct {
  303. uint8_t OVF:1; /*!< bit: 0 Overflow Interrupt Enable */
  304. uint8_t ERR:1; /*!< bit: 1 Error Interrupt Enable */
  305. uint8_t :1; /*!< bit: 2 Reserved */
  306. uint8_t SYNCRDY:1; /*!< bit: 3 Synchronization Ready Interrupt Enable */
  307. uint8_t MC0:1; /*!< bit: 4 Match or Capture Channel 0 Interrupt Enable */
  308. uint8_t MC1:1; /*!< bit: 5 Match or Capture Channel 1 Interrupt Enable */
  309. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  310. } bit; /*!< Structure used for bit access */
  311. struct {
  312. uint8_t :4; /*!< bit: 0.. 3 Reserved */
  313. uint8_t MC:2; /*!< bit: 4.. 5 Match or Capture Channel x Interrupt Enable */
  314. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  315. } vec; /*!< Structure used for vec access */
  316. uint8_t reg; /*!< Type used for register access */
  317. } TC_INTENCLR_Type;
  318. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  319. #define TC_INTENCLR_OFFSET 0x0C /**< \brief (TC_INTENCLR offset) Interrupt Enable Clear */
  320. #define TC_INTENCLR_RESETVALUE _U_(0x00) /**< \brief (TC_INTENCLR reset_value) Interrupt Enable Clear */
  321. #define TC_INTENCLR_OVF_Pos 0 /**< \brief (TC_INTENCLR) Overflow Interrupt Enable */
  322. #define TC_INTENCLR_OVF (_U_(0x1) << TC_INTENCLR_OVF_Pos)
  323. #define TC_INTENCLR_ERR_Pos 1 /**< \brief (TC_INTENCLR) Error Interrupt Enable */
  324. #define TC_INTENCLR_ERR (_U_(0x1) << TC_INTENCLR_ERR_Pos)
  325. #define TC_INTENCLR_SYNCRDY_Pos 3 /**< \brief (TC_INTENCLR) Synchronization Ready Interrupt Enable */
  326. #define TC_INTENCLR_SYNCRDY (_U_(0x1) << TC_INTENCLR_SYNCRDY_Pos)
  327. #define TC_INTENCLR_MC0_Pos 4 /**< \brief (TC_INTENCLR) Match or Capture Channel 0 Interrupt Enable */
  328. #define TC_INTENCLR_MC0 (_U_(1) << TC_INTENCLR_MC0_Pos)
  329. #define TC_INTENCLR_MC1_Pos 5 /**< \brief (TC_INTENCLR) Match or Capture Channel 1 Interrupt Enable */
  330. #define TC_INTENCLR_MC1 (_U_(1) << TC_INTENCLR_MC1_Pos)
  331. #define TC_INTENCLR_MC_Pos 4 /**< \brief (TC_INTENCLR) Match or Capture Channel x Interrupt Enable */
  332. #define TC_INTENCLR_MC_Msk (_U_(0x3) << TC_INTENCLR_MC_Pos)
  333. #define TC_INTENCLR_MC(value) (TC_INTENCLR_MC_Msk & ((value) << TC_INTENCLR_MC_Pos))
  334. #define TC_INTENCLR_MASK _U_(0x3B) /**< \brief (TC_INTENCLR) MASK Register */
  335. /* -------- TC_INTENSET : (TC Offset: 0x0D) (R/W 8) Interrupt Enable Set -------- */
  336. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  337. typedef union {
  338. struct {
  339. uint8_t OVF:1; /*!< bit: 0 Overflow Interrupt Enable */
  340. uint8_t ERR:1; /*!< bit: 1 Error Interrupt Enable */
  341. uint8_t :1; /*!< bit: 2 Reserved */
  342. uint8_t SYNCRDY:1; /*!< bit: 3 Synchronization Ready Interrupt Enable */
  343. uint8_t MC0:1; /*!< bit: 4 Match or Capture Channel 0 Interrupt Enable */
  344. uint8_t MC1:1; /*!< bit: 5 Match or Capture Channel 1 Interrupt Enable */
  345. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  346. } bit; /*!< Structure used for bit access */
  347. struct {
  348. uint8_t :4; /*!< bit: 0.. 3 Reserved */
  349. uint8_t MC:2; /*!< bit: 4.. 5 Match or Capture Channel x Interrupt Enable */
  350. uint8_t :2; /*!< bit: 6.. 7 Reserved */
  351. } vec; /*!< Structure used for vec access */
  352. uint8_t reg; /*!< Type used for register access */
  353. } TC_INTENSET_Type;
  354. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  355. #define TC_INTENSET_OFFSET 0x0D /**< \brief (TC_INTENSET offset) Interrupt Enable Set */
  356. #define TC_INTENSET_RESETVALUE _U_(0x00) /**< \brief (TC_INTENSET reset_value) Interrupt Enable Set */
  357. #define TC_INTENSET_OVF_Pos 0 /**< \brief (TC_INTENSET) Overflow Interrupt Enable */
  358. #define TC_INTENSET_OVF (_U_(0x1) << TC_INTENSET_OVF_Pos)
  359. #define TC_INTENSET_ERR_Pos 1 /**< \brief (TC_INTENSET) Error Interrupt Enable */
  360. #define TC_INTENSET_ERR (_U_(0x1) << TC_INTENSET_ERR_Pos)
  361. #define TC_INTENSET_SYNCRDY_Pos 3 /**< \brief (TC_INTENSET) Synchronization Ready Interrupt Enable */
  362. #define TC_INTENSET_SYNCRDY (_U_(0x1) << TC_INTENSET_SYNCRDY_Pos)
  363. #define TC_INTENSET_MC0_Pos 4 /**< \brief (TC_INTENSET) Match or Capture Channel 0 Interrupt Enable */
  364. #define TC_INTENSET_MC0 (_U_(1) << TC_INTENSET_MC0_Pos)
  365. #define TC_INTENSET_MC1_Pos 5 /**< \brief (TC_INTENSET) Match or Capture Channel 1 Interrupt Enable */
  366. #define TC_INTENSET_MC1 (_U_(1) << TC_INTENSET_MC1_Pos)
  367. #define TC_INTENSET_MC_Pos 4 /**< \brief (TC_INTENSET) Match or Capture Channel x Interrupt Enable */
  368. #define TC_INTENSET_MC_Msk (_U_(0x3) << TC_INTENSET_MC_Pos)
  369. #define TC_INTENSET_MC(value) (TC_INTENSET_MC_Msk & ((value) << TC_INTENSET_MC_Pos))
  370. #define TC_INTENSET_MASK _U_(0x3B) /**< \brief (TC_INTENSET) MASK Register */
  371. /* -------- TC_INTFLAG : (TC Offset: 0x0E) (R/W 8) Interrupt Flag Status and Clear -------- */
  372. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  373. typedef union { // __I to avoid read-modify-write on write-to-clear register
  374. struct {
  375. __I uint8_t OVF:1; /*!< bit: 0 Overflow */
  376. __I uint8_t ERR:1; /*!< bit: 1 Error */
  377. __I uint8_t :1; /*!< bit: 2 Reserved */
  378. __I uint8_t SYNCRDY:1; /*!< bit: 3 Synchronization Ready */
  379. __I uint8_t MC0:1; /*!< bit: 4 Match or Capture Channel 0 */
  380. __I uint8_t MC1:1; /*!< bit: 5 Match or Capture Channel 1 */
  381. __I uint8_t :2; /*!< bit: 6.. 7 Reserved */
  382. } bit; /*!< Structure used for bit access */
  383. struct {
  384. __I uint8_t :4; /*!< bit: 0.. 3 Reserved */
  385. __I uint8_t MC:2; /*!< bit: 4.. 5 Match or Capture Channel x */
  386. __I uint8_t :2; /*!< bit: 6.. 7 Reserved */
  387. } vec; /*!< Structure used for vec access */
  388. uint8_t reg; /*!< Type used for register access */
  389. } TC_INTFLAG_Type;
  390. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  391. #define TC_INTFLAG_OFFSET 0x0E /**< \brief (TC_INTFLAG offset) Interrupt Flag Status and Clear */
  392. #define TC_INTFLAG_RESETVALUE _U_(0x00) /**< \brief (TC_INTFLAG reset_value) Interrupt Flag Status and Clear */
  393. #define TC_INTFLAG_OVF_Pos 0 /**< \brief (TC_INTFLAG) Overflow */
  394. #define TC_INTFLAG_OVF (_U_(0x1) << TC_INTFLAG_OVF_Pos)
  395. #define TC_INTFLAG_ERR_Pos 1 /**< \brief (TC_INTFLAG) Error */
  396. #define TC_INTFLAG_ERR (_U_(0x1) << TC_INTFLAG_ERR_Pos)
  397. #define TC_INTFLAG_SYNCRDY_Pos 3 /**< \brief (TC_INTFLAG) Synchronization Ready */
  398. #define TC_INTFLAG_SYNCRDY (_U_(0x1) << TC_INTFLAG_SYNCRDY_Pos)
  399. #define TC_INTFLAG_MC0_Pos 4 /**< \brief (TC_INTFLAG) Match or Capture Channel 0 */
  400. #define TC_INTFLAG_MC0 (_U_(1) << TC_INTFLAG_MC0_Pos)
  401. #define TC_INTFLAG_MC1_Pos 5 /**< \brief (TC_INTFLAG) Match or Capture Channel 1 */
  402. #define TC_INTFLAG_MC1 (_U_(1) << TC_INTFLAG_MC1_Pos)
  403. #define TC_INTFLAG_MC_Pos 4 /**< \brief (TC_INTFLAG) Match or Capture Channel x */
  404. #define TC_INTFLAG_MC_Msk (_U_(0x3) << TC_INTFLAG_MC_Pos)
  405. #define TC_INTFLAG_MC(value) (TC_INTFLAG_MC_Msk & ((value) << TC_INTFLAG_MC_Pos))
  406. #define TC_INTFLAG_MASK _U_(0x3B) /**< \brief (TC_INTFLAG) MASK Register */
  407. /* -------- TC_STATUS : (TC Offset: 0x0F) (R/ 8) Status -------- */
  408. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  409. typedef union {
  410. struct {
  411. uint8_t :3; /*!< bit: 0.. 2 Reserved */
  412. uint8_t STOP:1; /*!< bit: 3 Stop */
  413. uint8_t SLAVE:1; /*!< bit: 4 Slave */
  414. uint8_t :2; /*!< bit: 5.. 6 Reserved */
  415. uint8_t SYNCBUSY:1; /*!< bit: 7 Synchronization Busy */
  416. } bit; /*!< Structure used for bit access */
  417. uint8_t reg; /*!< Type used for register access */
  418. } TC_STATUS_Type;
  419. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  420. #define TC_STATUS_OFFSET 0x0F /**< \brief (TC_STATUS offset) Status */
  421. #define TC_STATUS_RESETVALUE _U_(0x08) /**< \brief (TC_STATUS reset_value) Status */
  422. #define TC_STATUS_STOP_Pos 3 /**< \brief (TC_STATUS) Stop */
  423. #define TC_STATUS_STOP (_U_(0x1) << TC_STATUS_STOP_Pos)
  424. #define TC_STATUS_SLAVE_Pos 4 /**< \brief (TC_STATUS) Slave */
  425. #define TC_STATUS_SLAVE (_U_(0x1) << TC_STATUS_SLAVE_Pos)
  426. #define TC_STATUS_SYNCBUSY_Pos 7 /**< \brief (TC_STATUS) Synchronization Busy */
  427. #define TC_STATUS_SYNCBUSY (_U_(0x1) << TC_STATUS_SYNCBUSY_Pos)
  428. #define TC_STATUS_MASK _U_(0x98) /**< \brief (TC_STATUS) MASK Register */
  429. /* -------- TC_COUNT16_COUNT : (TC Offset: 0x10) (R/W 16) COUNT16 COUNT16 Counter Value -------- */
  430. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  431. typedef union {
  432. struct {
  433. uint16_t COUNT:16; /*!< bit: 0..15 Count Value */
  434. } bit; /*!< Structure used for bit access */
  435. uint16_t reg; /*!< Type used for register access */
  436. } TC_COUNT16_COUNT_Type;
  437. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  438. #define TC_COUNT16_COUNT_OFFSET 0x10 /**< \brief (TC_COUNT16_COUNT offset) COUNT16 Counter Value */
  439. #define TC_COUNT16_COUNT_RESETVALUE _U_(0x0000) /**< \brief (TC_COUNT16_COUNT reset_value) COUNT16 Counter Value */
  440. #define TC_COUNT16_COUNT_COUNT_Pos 0 /**< \brief (TC_COUNT16_COUNT) Count Value */
  441. #define TC_COUNT16_COUNT_COUNT_Msk (_U_(0xFFFF) << TC_COUNT16_COUNT_COUNT_Pos)
  442. #define TC_COUNT16_COUNT_COUNT(value) (TC_COUNT16_COUNT_COUNT_Msk & ((value) << TC_COUNT16_COUNT_COUNT_Pos))
  443. #define TC_COUNT16_COUNT_MASK _U_(0xFFFF) /**< \brief (TC_COUNT16_COUNT) MASK Register */
  444. /* -------- TC_COUNT32_COUNT : (TC Offset: 0x10) (R/W 32) COUNT32 COUNT32 Counter Value -------- */
  445. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  446. typedef union {
  447. struct {
  448. uint32_t COUNT:32; /*!< bit: 0..31 Count Value */
  449. } bit; /*!< Structure used for bit access */
  450. uint32_t reg; /*!< Type used for register access */
  451. } TC_COUNT32_COUNT_Type;
  452. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  453. #define TC_COUNT32_COUNT_OFFSET 0x10 /**< \brief (TC_COUNT32_COUNT offset) COUNT32 Counter Value */
  454. #define TC_COUNT32_COUNT_RESETVALUE _U_(0x00000000) /**< \brief (TC_COUNT32_COUNT reset_value) COUNT32 Counter Value */
  455. #define TC_COUNT32_COUNT_COUNT_Pos 0 /**< \brief (TC_COUNT32_COUNT) Count Value */
  456. #define TC_COUNT32_COUNT_COUNT_Msk (_U_(0xFFFFFFFF) << TC_COUNT32_COUNT_COUNT_Pos)
  457. #define TC_COUNT32_COUNT_COUNT(value) (TC_COUNT32_COUNT_COUNT_Msk & ((value) << TC_COUNT32_COUNT_COUNT_Pos))
  458. #define TC_COUNT32_COUNT_MASK _U_(0xFFFFFFFF) /**< \brief (TC_COUNT32_COUNT) MASK Register */
  459. /* -------- TC_COUNT8_COUNT : (TC Offset: 0x10) (R/W 8) COUNT8 COUNT8 Counter Value -------- */
  460. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  461. typedef union {
  462. struct {
  463. uint8_t COUNT:8; /*!< bit: 0.. 7 Counter Value */
  464. } bit; /*!< Structure used for bit access */
  465. uint8_t reg; /*!< Type used for register access */
  466. } TC_COUNT8_COUNT_Type;
  467. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  468. #define TC_COUNT8_COUNT_OFFSET 0x10 /**< \brief (TC_COUNT8_COUNT offset) COUNT8 Counter Value */
  469. #define TC_COUNT8_COUNT_RESETVALUE _U_(0x00) /**< \brief (TC_COUNT8_COUNT reset_value) COUNT8 Counter Value */
  470. #define TC_COUNT8_COUNT_COUNT_Pos 0 /**< \brief (TC_COUNT8_COUNT) Counter Value */
  471. #define TC_COUNT8_COUNT_COUNT_Msk (_U_(0xFF) << TC_COUNT8_COUNT_COUNT_Pos)
  472. #define TC_COUNT8_COUNT_COUNT(value) (TC_COUNT8_COUNT_COUNT_Msk & ((value) << TC_COUNT8_COUNT_COUNT_Pos))
  473. #define TC_COUNT8_COUNT_MASK _U_(0xFF) /**< \brief (TC_COUNT8_COUNT) MASK Register */
  474. /* -------- TC_COUNT8_PER : (TC Offset: 0x14) (R/W 8) COUNT8 COUNT8 Period Value -------- */
  475. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  476. typedef union {
  477. struct {
  478. uint8_t PER:8; /*!< bit: 0.. 7 Period Value */
  479. } bit; /*!< Structure used for bit access */
  480. uint8_t reg; /*!< Type used for register access */
  481. } TC_COUNT8_PER_Type;
  482. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  483. #define TC_COUNT8_PER_OFFSET 0x14 /**< \brief (TC_COUNT8_PER offset) COUNT8 Period Value */
  484. #define TC_COUNT8_PER_RESETVALUE _U_(0xFF) /**< \brief (TC_COUNT8_PER reset_value) COUNT8 Period Value */
  485. #define TC_COUNT8_PER_PER_Pos 0 /**< \brief (TC_COUNT8_PER) Period Value */
  486. #define TC_COUNT8_PER_PER_Msk (_U_(0xFF) << TC_COUNT8_PER_PER_Pos)
  487. #define TC_COUNT8_PER_PER(value) (TC_COUNT8_PER_PER_Msk & ((value) << TC_COUNT8_PER_PER_Pos))
  488. #define TC_COUNT8_PER_MASK _U_(0xFF) /**< \brief (TC_COUNT8_PER) MASK Register */
  489. /* -------- TC_COUNT16_CC : (TC Offset: 0x18) (R/W 16) COUNT16 COUNT16 Compare/Capture -------- */
  490. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  491. typedef union {
  492. struct {
  493. uint16_t CC:16; /*!< bit: 0..15 Compare/Capture Value */
  494. } bit; /*!< Structure used for bit access */
  495. uint16_t reg; /*!< Type used for register access */
  496. } TC_COUNT16_CC_Type;
  497. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  498. #define TC_COUNT16_CC_OFFSET 0x18 /**< \brief (TC_COUNT16_CC offset) COUNT16 Compare/Capture */
  499. #define TC_COUNT16_CC_RESETVALUE _U_(0x0000) /**< \brief (TC_COUNT16_CC reset_value) COUNT16 Compare/Capture */
  500. #define TC_COUNT16_CC_CC_Pos 0 /**< \brief (TC_COUNT16_CC) Compare/Capture Value */
  501. #define TC_COUNT16_CC_CC_Msk (_U_(0xFFFF) << TC_COUNT16_CC_CC_Pos)
  502. #define TC_COUNT16_CC_CC(value) (TC_COUNT16_CC_CC_Msk & ((value) << TC_COUNT16_CC_CC_Pos))
  503. #define TC_COUNT16_CC_MASK _U_(0xFFFF) /**< \brief (TC_COUNT16_CC) MASK Register */
  504. /* -------- TC_COUNT32_CC : (TC Offset: 0x18) (R/W 32) COUNT32 COUNT32 Compare/Capture -------- */
  505. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  506. typedef union {
  507. struct {
  508. uint32_t CC:32; /*!< bit: 0..31 Compare/Capture Value */
  509. } bit; /*!< Structure used for bit access */
  510. uint32_t reg; /*!< Type used for register access */
  511. } TC_COUNT32_CC_Type;
  512. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  513. #define TC_COUNT32_CC_OFFSET 0x18 /**< \brief (TC_COUNT32_CC offset) COUNT32 Compare/Capture */
  514. #define TC_COUNT32_CC_RESETVALUE _U_(0x00000000) /**< \brief (TC_COUNT32_CC reset_value) COUNT32 Compare/Capture */
  515. #define TC_COUNT32_CC_CC_Pos 0 /**< \brief (TC_COUNT32_CC) Compare/Capture Value */
  516. #define TC_COUNT32_CC_CC_Msk (_U_(0xFFFFFFFF) << TC_COUNT32_CC_CC_Pos)
  517. #define TC_COUNT32_CC_CC(value) (TC_COUNT32_CC_CC_Msk & ((value) << TC_COUNT32_CC_CC_Pos))
  518. #define TC_COUNT32_CC_MASK _U_(0xFFFFFFFF) /**< \brief (TC_COUNT32_CC) MASK Register */
  519. /* -------- TC_COUNT8_CC : (TC Offset: 0x18) (R/W 8) COUNT8 COUNT8 Compare/Capture -------- */
  520. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  521. typedef union {
  522. struct {
  523. uint8_t CC:8; /*!< bit: 0.. 7 Compare/Capture Value */
  524. } bit; /*!< Structure used for bit access */
  525. uint8_t reg; /*!< Type used for register access */
  526. } TC_COUNT8_CC_Type;
  527. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  528. #define TC_COUNT8_CC_OFFSET 0x18 /**< \brief (TC_COUNT8_CC offset) COUNT8 Compare/Capture */
  529. #define TC_COUNT8_CC_RESETVALUE _U_(0x00) /**< \brief (TC_COUNT8_CC reset_value) COUNT8 Compare/Capture */
  530. #define TC_COUNT8_CC_CC_Pos 0 /**< \brief (TC_COUNT8_CC) Compare/Capture Value */
  531. #define TC_COUNT8_CC_CC_Msk (_U_(0xFF) << TC_COUNT8_CC_CC_Pos)
  532. #define TC_COUNT8_CC_CC(value) (TC_COUNT8_CC_CC_Msk & ((value) << TC_COUNT8_CC_CC_Pos))
  533. #define TC_COUNT8_CC_MASK _U_(0xFF) /**< \brief (TC_COUNT8_CC) MASK Register */
  534. /** \brief TC_COUNT8 hardware registers */
  535. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  536. typedef struct { /* 8-bit Counter Mode */
  537. __IO TC_CTRLA_Type CTRLA; /**< \brief Offset: 0x00 (R/W 16) Control A */
  538. __IO TC_READREQ_Type READREQ; /**< \brief Offset: 0x02 (R/W 16) Read Request */
  539. __IO TC_CTRLBCLR_Type CTRLBCLR; /**< \brief Offset: 0x04 (R/W 8) Control B Clear */
  540. __IO TC_CTRLBSET_Type CTRLBSET; /**< \brief Offset: 0x05 (R/W 8) Control B Set */
  541. __IO TC_CTRLC_Type CTRLC; /**< \brief Offset: 0x06 (R/W 8) Control C */
  542. RoReg8 Reserved1[0x1];
  543. __IO TC_DBGCTRL_Type DBGCTRL; /**< \brief Offset: 0x08 (R/W 8) Debug Control */
  544. RoReg8 Reserved2[0x1];
  545. __IO TC_EVCTRL_Type EVCTRL; /**< \brief Offset: 0x0A (R/W 16) Event Control */
  546. __IO TC_INTENCLR_Type INTENCLR; /**< \brief Offset: 0x0C (R/W 8) Interrupt Enable Clear */
  547. __IO TC_INTENSET_Type INTENSET; /**< \brief Offset: 0x0D (R/W 8) Interrupt Enable Set */
  548. __IO TC_INTFLAG_Type INTFLAG; /**< \brief Offset: 0x0E (R/W 8) Interrupt Flag Status and Clear */
  549. __I TC_STATUS_Type STATUS; /**< \brief Offset: 0x0F (R/ 8) Status */
  550. __IO TC_COUNT8_COUNT_Type COUNT; /**< \brief Offset: 0x10 (R/W 8) COUNT8 Counter Value */
  551. RoReg8 Reserved3[0x3];
  552. __IO TC_COUNT8_PER_Type PER; /**< \brief Offset: 0x14 (R/W 8) COUNT8 Period Value */
  553. RoReg8 Reserved4[0x3];
  554. __IO TC_COUNT8_CC_Type CC[2]; /**< \brief Offset: 0x18 (R/W 8) COUNT8 Compare/Capture */
  555. } TcCount8;
  556. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  557. /** \brief TC_COUNT16 hardware registers */
  558. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  559. typedef struct { /* 16-bit Counter Mode */
  560. __IO TC_CTRLA_Type CTRLA; /**< \brief Offset: 0x00 (R/W 16) Control A */
  561. __IO TC_READREQ_Type READREQ; /**< \brief Offset: 0x02 (R/W 16) Read Request */
  562. __IO TC_CTRLBCLR_Type CTRLBCLR; /**< \brief Offset: 0x04 (R/W 8) Control B Clear */
  563. __IO TC_CTRLBSET_Type CTRLBSET; /**< \brief Offset: 0x05 (R/W 8) Control B Set */
  564. __IO TC_CTRLC_Type CTRLC; /**< \brief Offset: 0x06 (R/W 8) Control C */
  565. RoReg8 Reserved1[0x1];
  566. __IO TC_DBGCTRL_Type DBGCTRL; /**< \brief Offset: 0x08 (R/W 8) Debug Control */
  567. RoReg8 Reserved2[0x1];
  568. __IO TC_EVCTRL_Type EVCTRL; /**< \brief Offset: 0x0A (R/W 16) Event Control */
  569. __IO TC_INTENCLR_Type INTENCLR; /**< \brief Offset: 0x0C (R/W 8) Interrupt Enable Clear */
  570. __IO TC_INTENSET_Type INTENSET; /**< \brief Offset: 0x0D (R/W 8) Interrupt Enable Set */
  571. __IO TC_INTFLAG_Type INTFLAG; /**< \brief Offset: 0x0E (R/W 8) Interrupt Flag Status and Clear */
  572. __I TC_STATUS_Type STATUS; /**< \brief Offset: 0x0F (R/ 8) Status */
  573. __IO TC_COUNT16_COUNT_Type COUNT; /**< \brief Offset: 0x10 (R/W 16) COUNT16 Counter Value */
  574. RoReg8 Reserved3[0x6];
  575. __IO TC_COUNT16_CC_Type CC[2]; /**< \brief Offset: 0x18 (R/W 16) COUNT16 Compare/Capture */
  576. } TcCount16;
  577. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  578. /** \brief TC_COUNT32 hardware registers */
  579. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  580. typedef struct { /* 32-bit Counter Mode */
  581. __IO TC_CTRLA_Type CTRLA; /**< \brief Offset: 0x00 (R/W 16) Control A */
  582. __IO TC_READREQ_Type READREQ; /**< \brief Offset: 0x02 (R/W 16) Read Request */
  583. __IO TC_CTRLBCLR_Type CTRLBCLR; /**< \brief Offset: 0x04 (R/W 8) Control B Clear */
  584. __IO TC_CTRLBSET_Type CTRLBSET; /**< \brief Offset: 0x05 (R/W 8) Control B Set */
  585. __IO TC_CTRLC_Type CTRLC; /**< \brief Offset: 0x06 (R/W 8) Control C */
  586. RoReg8 Reserved1[0x1];
  587. __IO TC_DBGCTRL_Type DBGCTRL; /**< \brief Offset: 0x08 (R/W 8) Debug Control */
  588. RoReg8 Reserved2[0x1];
  589. __IO TC_EVCTRL_Type EVCTRL; /**< \brief Offset: 0x0A (R/W 16) Event Control */
  590. __IO TC_INTENCLR_Type INTENCLR; /**< \brief Offset: 0x0C (R/W 8) Interrupt Enable Clear */
  591. __IO TC_INTENSET_Type INTENSET; /**< \brief Offset: 0x0D (R/W 8) Interrupt Enable Set */
  592. __IO TC_INTFLAG_Type INTFLAG; /**< \brief Offset: 0x0E (R/W 8) Interrupt Flag Status and Clear */
  593. __I TC_STATUS_Type STATUS; /**< \brief Offset: 0x0F (R/ 8) Status */
  594. __IO TC_COUNT32_COUNT_Type COUNT; /**< \brief Offset: 0x10 (R/W 32) COUNT32 Counter Value */
  595. RoReg8 Reserved3[0x4];
  596. __IO TC_COUNT32_CC_Type CC[2]; /**< \brief Offset: 0x18 (R/W 32) COUNT32 Compare/Capture */
  597. } TcCount32;
  598. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  599. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  600. typedef union {
  601. TcCount8 COUNT8; /**< \brief Offset: 0x00 8-bit Counter Mode */
  602. TcCount16 COUNT16; /**< \brief Offset: 0x00 16-bit Counter Mode */
  603. TcCount32 COUNT32; /**< \brief Offset: 0x00 32-bit Counter Mode */
  604. } Tc;
  605. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  606. /*@}*/
  607. #endif /* _SAMD11_TC_COMPONENT_ */