freqm.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /**
  2. * \file
  3. *
  4. * \brief Component description for FREQM
  5. *
  6. * Copyright (c) 2018 Microchip Technology Inc.
  7. *
  8. * \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");
  15. * you may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License 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,
  22. * WITHOUT 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. * \license_stop
  27. *
  28. */
  29. /* file generated from device description version 2018-05-30T11:07:17Z */
  30. #ifndef _SAML11_FREQM_COMPONENT_H_
  31. #define _SAML11_FREQM_COMPONENT_H_
  32. #define _SAML11_FREQM_COMPONENT_ /**< \deprecated Backward compatibility for ASF */
  33. /** \addtogroup SAML_SAML11 Frequency Meter
  34. * @{
  35. */
  36. /* ========================================================================== */
  37. /** SOFTWARE API DEFINITION FOR FREQM */
  38. /* ========================================================================== */
  39. #define FREQM_U2257 /**< (FREQM) Module ID */
  40. #define REV_FREQM 0x210 /**< (FREQM) Module revision */
  41. /* -------- FREQM_CTRLA : (FREQM Offset: 0x00) (R/W 8) Control A Register -------- */
  42. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  43. typedef union {
  44. struct {
  45. uint8_t SWRST:1; /**< bit: 0 Software Reset */
  46. uint8_t ENABLE:1; /**< bit: 1 Enable */
  47. uint8_t :6; /**< bit: 2..7 Reserved */
  48. } bit; /**< Structure used for bit access */
  49. uint8_t reg; /**< Type used for register access */
  50. } FREQM_CTRLA_Type;
  51. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  52. #define FREQM_CTRLA_OFFSET (0x00) /**< (FREQM_CTRLA) Control A Register Offset */
  53. #define FREQM_CTRLA_RESETVALUE _U_(0x00) /**< (FREQM_CTRLA) Control A Register Reset Value */
  54. #define FREQM_CTRLA_SWRST_Pos 0 /**< (FREQM_CTRLA) Software Reset Position */
  55. #define FREQM_CTRLA_SWRST_Msk (_U_(0x1) << FREQM_CTRLA_SWRST_Pos) /**< (FREQM_CTRLA) Software Reset Mask */
  56. #define FREQM_CTRLA_SWRST FREQM_CTRLA_SWRST_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_CTRLA_SWRST_Msk instead */
  57. #define FREQM_CTRLA_ENABLE_Pos 1 /**< (FREQM_CTRLA) Enable Position */
  58. #define FREQM_CTRLA_ENABLE_Msk (_U_(0x1) << FREQM_CTRLA_ENABLE_Pos) /**< (FREQM_CTRLA) Enable Mask */
  59. #define FREQM_CTRLA_ENABLE FREQM_CTRLA_ENABLE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_CTRLA_ENABLE_Msk instead */
  60. #define FREQM_CTRLA_MASK _U_(0x03) /**< \deprecated (FREQM_CTRLA) Register MASK (Use FREQM_CTRLA_Msk instead) */
  61. #define FREQM_CTRLA_Msk _U_(0x03) /**< (FREQM_CTRLA) Register Mask */
  62. /* -------- FREQM_CTRLB : (FREQM Offset: 0x01) (/W 8) Control B Register -------- */
  63. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  64. typedef union {
  65. struct {
  66. uint8_t START:1; /**< bit: 0 Start Measurement */
  67. uint8_t :7; /**< bit: 1..7 Reserved */
  68. } bit; /**< Structure used for bit access */
  69. uint8_t reg; /**< Type used for register access */
  70. } FREQM_CTRLB_Type;
  71. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  72. #define FREQM_CTRLB_OFFSET (0x01) /**< (FREQM_CTRLB) Control B Register Offset */
  73. #define FREQM_CTRLB_RESETVALUE _U_(0x00) /**< (FREQM_CTRLB) Control B Register Reset Value */
  74. #define FREQM_CTRLB_START_Pos 0 /**< (FREQM_CTRLB) Start Measurement Position */
  75. #define FREQM_CTRLB_START_Msk (_U_(0x1) << FREQM_CTRLB_START_Pos) /**< (FREQM_CTRLB) Start Measurement Mask */
  76. #define FREQM_CTRLB_START FREQM_CTRLB_START_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_CTRLB_START_Msk instead */
  77. #define FREQM_CTRLB_MASK _U_(0x01) /**< \deprecated (FREQM_CTRLB) Register MASK (Use FREQM_CTRLB_Msk instead) */
  78. #define FREQM_CTRLB_Msk _U_(0x01) /**< (FREQM_CTRLB) Register Mask */
  79. /* -------- FREQM_CFGA : (FREQM Offset: 0x02) (R/W 16) Config A register -------- */
  80. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  81. typedef union {
  82. struct {
  83. uint16_t REFNUM:8; /**< bit: 0..7 Number of Reference Clock Cycles */
  84. uint16_t :7; /**< bit: 8..14 Reserved */
  85. uint16_t DIVREF:1; /**< bit: 15 Divide Reference Clock */
  86. } bit; /**< Structure used for bit access */
  87. uint16_t reg; /**< Type used for register access */
  88. } FREQM_CFGA_Type;
  89. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  90. #define FREQM_CFGA_OFFSET (0x02) /**< (FREQM_CFGA) Config A register Offset */
  91. #define FREQM_CFGA_RESETVALUE _U_(0x00) /**< (FREQM_CFGA) Config A register Reset Value */
  92. #define FREQM_CFGA_REFNUM_Pos 0 /**< (FREQM_CFGA) Number of Reference Clock Cycles Position */
  93. #define FREQM_CFGA_REFNUM_Msk (_U_(0xFF) << FREQM_CFGA_REFNUM_Pos) /**< (FREQM_CFGA) Number of Reference Clock Cycles Mask */
  94. #define FREQM_CFGA_REFNUM(value) (FREQM_CFGA_REFNUM_Msk & ((value) << FREQM_CFGA_REFNUM_Pos))
  95. #define FREQM_CFGA_DIVREF_Pos 15 /**< (FREQM_CFGA) Divide Reference Clock Position */
  96. #define FREQM_CFGA_DIVREF_Msk (_U_(0x1) << FREQM_CFGA_DIVREF_Pos) /**< (FREQM_CFGA) Divide Reference Clock Mask */
  97. #define FREQM_CFGA_DIVREF FREQM_CFGA_DIVREF_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_CFGA_DIVREF_Msk instead */
  98. #define FREQM_CFGA_MASK _U_(0x80FF) /**< \deprecated (FREQM_CFGA) Register MASK (Use FREQM_CFGA_Msk instead) */
  99. #define FREQM_CFGA_Msk _U_(0x80FF) /**< (FREQM_CFGA) Register Mask */
  100. /* -------- FREQM_INTENCLR : (FREQM Offset: 0x08) (R/W 8) Interrupt Enable Clear Register -------- */
  101. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  102. typedef union {
  103. struct {
  104. uint8_t DONE:1; /**< bit: 0 Measurement Done Interrupt Enable */
  105. uint8_t :7; /**< bit: 1..7 Reserved */
  106. } bit; /**< Structure used for bit access */
  107. uint8_t reg; /**< Type used for register access */
  108. } FREQM_INTENCLR_Type;
  109. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  110. #define FREQM_INTENCLR_OFFSET (0x08) /**< (FREQM_INTENCLR) Interrupt Enable Clear Register Offset */
  111. #define FREQM_INTENCLR_RESETVALUE _U_(0x00) /**< (FREQM_INTENCLR) Interrupt Enable Clear Register Reset Value */
  112. #define FREQM_INTENCLR_DONE_Pos 0 /**< (FREQM_INTENCLR) Measurement Done Interrupt Enable Position */
  113. #define FREQM_INTENCLR_DONE_Msk (_U_(0x1) << FREQM_INTENCLR_DONE_Pos) /**< (FREQM_INTENCLR) Measurement Done Interrupt Enable Mask */
  114. #define FREQM_INTENCLR_DONE FREQM_INTENCLR_DONE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_INTENCLR_DONE_Msk instead */
  115. #define FREQM_INTENCLR_MASK _U_(0x01) /**< \deprecated (FREQM_INTENCLR) Register MASK (Use FREQM_INTENCLR_Msk instead) */
  116. #define FREQM_INTENCLR_Msk _U_(0x01) /**< (FREQM_INTENCLR) Register Mask */
  117. /* -------- FREQM_INTENSET : (FREQM Offset: 0x09) (R/W 8) Interrupt Enable Set Register -------- */
  118. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  119. typedef union {
  120. struct {
  121. uint8_t DONE:1; /**< bit: 0 Measurement Done Interrupt Enable */
  122. uint8_t :7; /**< bit: 1..7 Reserved */
  123. } bit; /**< Structure used for bit access */
  124. uint8_t reg; /**< Type used for register access */
  125. } FREQM_INTENSET_Type;
  126. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  127. #define FREQM_INTENSET_OFFSET (0x09) /**< (FREQM_INTENSET) Interrupt Enable Set Register Offset */
  128. #define FREQM_INTENSET_RESETVALUE _U_(0x00) /**< (FREQM_INTENSET) Interrupt Enable Set Register Reset Value */
  129. #define FREQM_INTENSET_DONE_Pos 0 /**< (FREQM_INTENSET) Measurement Done Interrupt Enable Position */
  130. #define FREQM_INTENSET_DONE_Msk (_U_(0x1) << FREQM_INTENSET_DONE_Pos) /**< (FREQM_INTENSET) Measurement Done Interrupt Enable Mask */
  131. #define FREQM_INTENSET_DONE FREQM_INTENSET_DONE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_INTENSET_DONE_Msk instead */
  132. #define FREQM_INTENSET_MASK _U_(0x01) /**< \deprecated (FREQM_INTENSET) Register MASK (Use FREQM_INTENSET_Msk instead) */
  133. #define FREQM_INTENSET_Msk _U_(0x01) /**< (FREQM_INTENSET) Register Mask */
  134. /* -------- FREQM_INTFLAG : (FREQM Offset: 0x0a) (R/W 8) Interrupt Flag Register -------- */
  135. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  136. typedef union { // __I to avoid read-modify-write on write-to-clear register
  137. struct {
  138. __I uint8_t DONE:1; /**< bit: 0 Measurement Done */
  139. __I uint8_t :7; /**< bit: 1..7 Reserved */
  140. } bit; /**< Structure used for bit access */
  141. uint8_t reg; /**< Type used for register access */
  142. } FREQM_INTFLAG_Type;
  143. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  144. #define FREQM_INTFLAG_OFFSET (0x0A) /**< (FREQM_INTFLAG) Interrupt Flag Register Offset */
  145. #define FREQM_INTFLAG_RESETVALUE _U_(0x00) /**< (FREQM_INTFLAG) Interrupt Flag Register Reset Value */
  146. #define FREQM_INTFLAG_DONE_Pos 0 /**< (FREQM_INTFLAG) Measurement Done Position */
  147. #define FREQM_INTFLAG_DONE_Msk (_U_(0x1) << FREQM_INTFLAG_DONE_Pos) /**< (FREQM_INTFLAG) Measurement Done Mask */
  148. #define FREQM_INTFLAG_DONE FREQM_INTFLAG_DONE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_INTFLAG_DONE_Msk instead */
  149. #define FREQM_INTFLAG_MASK _U_(0x01) /**< \deprecated (FREQM_INTFLAG) Register MASK (Use FREQM_INTFLAG_Msk instead) */
  150. #define FREQM_INTFLAG_Msk _U_(0x01) /**< (FREQM_INTFLAG) Register Mask */
  151. /* -------- FREQM_STATUS : (FREQM Offset: 0x0b) (R/W 8) Status Register -------- */
  152. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  153. typedef union {
  154. struct {
  155. uint8_t BUSY:1; /**< bit: 0 FREQM Status */
  156. uint8_t OVF:1; /**< bit: 1 Sticky Count Value Overflow */
  157. uint8_t :6; /**< bit: 2..7 Reserved */
  158. } bit; /**< Structure used for bit access */
  159. uint8_t reg; /**< Type used for register access */
  160. } FREQM_STATUS_Type;
  161. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  162. #define FREQM_STATUS_OFFSET (0x0B) /**< (FREQM_STATUS) Status Register Offset */
  163. #define FREQM_STATUS_RESETVALUE _U_(0x00) /**< (FREQM_STATUS) Status Register Reset Value */
  164. #define FREQM_STATUS_BUSY_Pos 0 /**< (FREQM_STATUS) FREQM Status Position */
  165. #define FREQM_STATUS_BUSY_Msk (_U_(0x1) << FREQM_STATUS_BUSY_Pos) /**< (FREQM_STATUS) FREQM Status Mask */
  166. #define FREQM_STATUS_BUSY FREQM_STATUS_BUSY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_STATUS_BUSY_Msk instead */
  167. #define FREQM_STATUS_OVF_Pos 1 /**< (FREQM_STATUS) Sticky Count Value Overflow Position */
  168. #define FREQM_STATUS_OVF_Msk (_U_(0x1) << FREQM_STATUS_OVF_Pos) /**< (FREQM_STATUS) Sticky Count Value Overflow Mask */
  169. #define FREQM_STATUS_OVF FREQM_STATUS_OVF_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_STATUS_OVF_Msk instead */
  170. #define FREQM_STATUS_MASK _U_(0x03) /**< \deprecated (FREQM_STATUS) Register MASK (Use FREQM_STATUS_Msk instead) */
  171. #define FREQM_STATUS_Msk _U_(0x03) /**< (FREQM_STATUS) Register Mask */
  172. /* -------- FREQM_SYNCBUSY : (FREQM Offset: 0x0c) (R/ 32) Synchronization Busy Register -------- */
  173. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  174. typedef union {
  175. struct {
  176. uint32_t SWRST:1; /**< bit: 0 Software Reset */
  177. uint32_t ENABLE:1; /**< bit: 1 Enable */
  178. uint32_t :30; /**< bit: 2..31 Reserved */
  179. } bit; /**< Structure used for bit access */
  180. uint32_t reg; /**< Type used for register access */
  181. } FREQM_SYNCBUSY_Type;
  182. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  183. #define FREQM_SYNCBUSY_OFFSET (0x0C) /**< (FREQM_SYNCBUSY) Synchronization Busy Register Offset */
  184. #define FREQM_SYNCBUSY_RESETVALUE _U_(0x00) /**< (FREQM_SYNCBUSY) Synchronization Busy Register Reset Value */
  185. #define FREQM_SYNCBUSY_SWRST_Pos 0 /**< (FREQM_SYNCBUSY) Software Reset Position */
  186. #define FREQM_SYNCBUSY_SWRST_Msk (_U_(0x1) << FREQM_SYNCBUSY_SWRST_Pos) /**< (FREQM_SYNCBUSY) Software Reset Mask */
  187. #define FREQM_SYNCBUSY_SWRST FREQM_SYNCBUSY_SWRST_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_SYNCBUSY_SWRST_Msk instead */
  188. #define FREQM_SYNCBUSY_ENABLE_Pos 1 /**< (FREQM_SYNCBUSY) Enable Position */
  189. #define FREQM_SYNCBUSY_ENABLE_Msk (_U_(0x1) << FREQM_SYNCBUSY_ENABLE_Pos) /**< (FREQM_SYNCBUSY) Enable Mask */
  190. #define FREQM_SYNCBUSY_ENABLE FREQM_SYNCBUSY_ENABLE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use FREQM_SYNCBUSY_ENABLE_Msk instead */
  191. #define FREQM_SYNCBUSY_MASK _U_(0x03) /**< \deprecated (FREQM_SYNCBUSY) Register MASK (Use FREQM_SYNCBUSY_Msk instead) */
  192. #define FREQM_SYNCBUSY_Msk _U_(0x03) /**< (FREQM_SYNCBUSY) Register Mask */
  193. /* -------- FREQM_VALUE : (FREQM Offset: 0x10) (R/ 32) Count Value Register -------- */
  194. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  195. typedef union {
  196. struct {
  197. uint32_t VALUE:24; /**< bit: 0..23 Measurement Value */
  198. uint32_t :8; /**< bit: 24..31 Reserved */
  199. } bit; /**< Structure used for bit access */
  200. uint32_t reg; /**< Type used for register access */
  201. } FREQM_VALUE_Type;
  202. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  203. #define FREQM_VALUE_OFFSET (0x10) /**< (FREQM_VALUE) Count Value Register Offset */
  204. #define FREQM_VALUE_RESETVALUE _U_(0x00) /**< (FREQM_VALUE) Count Value Register Reset Value */
  205. #define FREQM_VALUE_VALUE_Pos 0 /**< (FREQM_VALUE) Measurement Value Position */
  206. #define FREQM_VALUE_VALUE_Msk (_U_(0xFFFFFF) << FREQM_VALUE_VALUE_Pos) /**< (FREQM_VALUE) Measurement Value Mask */
  207. #define FREQM_VALUE_VALUE(value) (FREQM_VALUE_VALUE_Msk & ((value) << FREQM_VALUE_VALUE_Pos))
  208. #define FREQM_VALUE_MASK _U_(0xFFFFFF) /**< \deprecated (FREQM_VALUE) Register MASK (Use FREQM_VALUE_Msk instead) */
  209. #define FREQM_VALUE_Msk _U_(0xFFFFFF) /**< (FREQM_VALUE) Register Mask */
  210. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  211. /** \brief FREQM hardware registers */
  212. typedef struct { /* Frequency Meter */
  213. __IO FREQM_CTRLA_Type CTRLA; /**< Offset: 0x00 (R/W 8) Control A Register */
  214. __O FREQM_CTRLB_Type CTRLB; /**< Offset: 0x01 ( /W 8) Control B Register */
  215. __IO FREQM_CFGA_Type CFGA; /**< Offset: 0x02 (R/W 16) Config A register */
  216. __I uint8_t Reserved1[4];
  217. __IO FREQM_INTENCLR_Type INTENCLR; /**< Offset: 0x08 (R/W 8) Interrupt Enable Clear Register */
  218. __IO FREQM_INTENSET_Type INTENSET; /**< Offset: 0x09 (R/W 8) Interrupt Enable Set Register */
  219. __IO FREQM_INTFLAG_Type INTFLAG; /**< Offset: 0x0A (R/W 8) Interrupt Flag Register */
  220. __IO FREQM_STATUS_Type STATUS; /**< Offset: 0x0B (R/W 8) Status Register */
  221. __I FREQM_SYNCBUSY_Type SYNCBUSY; /**< Offset: 0x0C (R/ 32) Synchronization Busy Register */
  222. __I FREQM_VALUE_Type VALUE; /**< Offset: 0x10 (R/ 32) Count Value Register */
  223. } Freqm;
  224. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  225. /** @} end of Frequency Meter */
  226. #endif /* _SAML11_FREQM_COMPONENT_H_ */