tc.h 47 KB

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