port.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. /**
  2. * \file
  3. *
  4. * \brief Component description for PORT
  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_PORT_COMPONENT_
  30. #define _SAMD11_PORT_COMPONENT_
  31. /* ========================================================================== */
  32. /** SOFTWARE API DEFINITION FOR PORT */
  33. /* ========================================================================== */
  34. /** \addtogroup SAMD11_PORT Port Module */
  35. /*@{*/
  36. #define PORT_U2210
  37. #define REV_PORT 0x100
  38. /* -------- PORT_DIR : (PORT Offset: 0x00) (R/W 32) GROUP Data Direction -------- */
  39. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  40. typedef union {
  41. struct {
  42. uint32_t DIR:32; /*!< bit: 0..31 Port Data Direction */
  43. } bit; /*!< Structure used for bit access */
  44. uint32_t reg; /*!< Type used for register access */
  45. } PORT_DIR_Type;
  46. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  47. #define PORT_DIR_OFFSET 0x00 /**< \brief (PORT_DIR offset) Data Direction */
  48. #define PORT_DIR_RESETVALUE _U_(0x00000000) /**< \brief (PORT_DIR reset_value) Data Direction */
  49. #define PORT_DIR_DIR_Pos 0 /**< \brief (PORT_DIR) Port Data Direction */
  50. #define PORT_DIR_DIR_Msk (_U_(0xFFFFFFFF) << PORT_DIR_DIR_Pos)
  51. #define PORT_DIR_DIR(value) (PORT_DIR_DIR_Msk & ((value) << PORT_DIR_DIR_Pos))
  52. #define PORT_DIR_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_DIR) MASK Register */
  53. /* -------- PORT_DIRCLR : (PORT Offset: 0x04) (R/W 32) GROUP Data Direction Clear -------- */
  54. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  55. typedef union {
  56. struct {
  57. uint32_t DIRCLR:32; /*!< bit: 0..31 Port Data Direction Clear */
  58. } bit; /*!< Structure used for bit access */
  59. uint32_t reg; /*!< Type used for register access */
  60. } PORT_DIRCLR_Type;
  61. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  62. #define PORT_DIRCLR_OFFSET 0x04 /**< \brief (PORT_DIRCLR offset) Data Direction Clear */
  63. #define PORT_DIRCLR_RESETVALUE _U_(0x00000000) /**< \brief (PORT_DIRCLR reset_value) Data Direction Clear */
  64. #define PORT_DIRCLR_DIRCLR_Pos 0 /**< \brief (PORT_DIRCLR) Port Data Direction Clear */
  65. #define PORT_DIRCLR_DIRCLR_Msk (_U_(0xFFFFFFFF) << PORT_DIRCLR_DIRCLR_Pos)
  66. #define PORT_DIRCLR_DIRCLR(value) (PORT_DIRCLR_DIRCLR_Msk & ((value) << PORT_DIRCLR_DIRCLR_Pos))
  67. #define PORT_DIRCLR_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_DIRCLR) MASK Register */
  68. /* -------- PORT_DIRSET : (PORT Offset: 0x08) (R/W 32) GROUP Data Direction Set -------- */
  69. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  70. typedef union {
  71. struct {
  72. uint32_t DIRSET:32; /*!< bit: 0..31 Port Data Direction Set */
  73. } bit; /*!< Structure used for bit access */
  74. uint32_t reg; /*!< Type used for register access */
  75. } PORT_DIRSET_Type;
  76. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  77. #define PORT_DIRSET_OFFSET 0x08 /**< \brief (PORT_DIRSET offset) Data Direction Set */
  78. #define PORT_DIRSET_RESETVALUE _U_(0x00000000) /**< \brief (PORT_DIRSET reset_value) Data Direction Set */
  79. #define PORT_DIRSET_DIRSET_Pos 0 /**< \brief (PORT_DIRSET) Port Data Direction Set */
  80. #define PORT_DIRSET_DIRSET_Msk (_U_(0xFFFFFFFF) << PORT_DIRSET_DIRSET_Pos)
  81. #define PORT_DIRSET_DIRSET(value) (PORT_DIRSET_DIRSET_Msk & ((value) << PORT_DIRSET_DIRSET_Pos))
  82. #define PORT_DIRSET_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_DIRSET) MASK Register */
  83. /* -------- PORT_DIRTGL : (PORT Offset: 0x0C) (R/W 32) GROUP Data Direction Toggle -------- */
  84. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  85. typedef union {
  86. struct {
  87. uint32_t DIRTGL:32; /*!< bit: 0..31 Port Data Direction Toggle */
  88. } bit; /*!< Structure used for bit access */
  89. uint32_t reg; /*!< Type used for register access */
  90. } PORT_DIRTGL_Type;
  91. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  92. #define PORT_DIRTGL_OFFSET 0x0C /**< \brief (PORT_DIRTGL offset) Data Direction Toggle */
  93. #define PORT_DIRTGL_RESETVALUE _U_(0x00000000) /**< \brief (PORT_DIRTGL reset_value) Data Direction Toggle */
  94. #define PORT_DIRTGL_DIRTGL_Pos 0 /**< \brief (PORT_DIRTGL) Port Data Direction Toggle */
  95. #define PORT_DIRTGL_DIRTGL_Msk (_U_(0xFFFFFFFF) << PORT_DIRTGL_DIRTGL_Pos)
  96. #define PORT_DIRTGL_DIRTGL(value) (PORT_DIRTGL_DIRTGL_Msk & ((value) << PORT_DIRTGL_DIRTGL_Pos))
  97. #define PORT_DIRTGL_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_DIRTGL) MASK Register */
  98. /* -------- PORT_OUT : (PORT Offset: 0x10) (R/W 32) GROUP Data Output Value -------- */
  99. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  100. typedef union {
  101. struct {
  102. uint32_t OUT:32; /*!< bit: 0..31 Port Data Output Value */
  103. } bit; /*!< Structure used for bit access */
  104. uint32_t reg; /*!< Type used for register access */
  105. } PORT_OUT_Type;
  106. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  107. #define PORT_OUT_OFFSET 0x10 /**< \brief (PORT_OUT offset) Data Output Value */
  108. #define PORT_OUT_RESETVALUE _U_(0x00000000) /**< \brief (PORT_OUT reset_value) Data Output Value */
  109. #define PORT_OUT_OUT_Pos 0 /**< \brief (PORT_OUT) Port Data Output Value */
  110. #define PORT_OUT_OUT_Msk (_U_(0xFFFFFFFF) << PORT_OUT_OUT_Pos)
  111. #define PORT_OUT_OUT(value) (PORT_OUT_OUT_Msk & ((value) << PORT_OUT_OUT_Pos))
  112. #define PORT_OUT_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_OUT) MASK Register */
  113. /* -------- PORT_OUTCLR : (PORT Offset: 0x14) (R/W 32) GROUP Data Output Value Clear -------- */
  114. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  115. typedef union {
  116. struct {
  117. uint32_t OUTCLR:32; /*!< bit: 0..31 Port Data Output Value Clear */
  118. } bit; /*!< Structure used for bit access */
  119. uint32_t reg; /*!< Type used for register access */
  120. } PORT_OUTCLR_Type;
  121. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  122. #define PORT_OUTCLR_OFFSET 0x14 /**< \brief (PORT_OUTCLR offset) Data Output Value Clear */
  123. #define PORT_OUTCLR_RESETVALUE _U_(0x00000000) /**< \brief (PORT_OUTCLR reset_value) Data Output Value Clear */
  124. #define PORT_OUTCLR_OUTCLR_Pos 0 /**< \brief (PORT_OUTCLR) Port Data Output Value Clear */
  125. #define PORT_OUTCLR_OUTCLR_Msk (_U_(0xFFFFFFFF) << PORT_OUTCLR_OUTCLR_Pos)
  126. #define PORT_OUTCLR_OUTCLR(value) (PORT_OUTCLR_OUTCLR_Msk & ((value) << PORT_OUTCLR_OUTCLR_Pos))
  127. #define PORT_OUTCLR_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_OUTCLR) MASK Register */
  128. /* -------- PORT_OUTSET : (PORT Offset: 0x18) (R/W 32) GROUP Data Output Value Set -------- */
  129. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  130. typedef union {
  131. struct {
  132. uint32_t OUTSET:32; /*!< bit: 0..31 Port Data Output Value Set */
  133. } bit; /*!< Structure used for bit access */
  134. uint32_t reg; /*!< Type used for register access */
  135. } PORT_OUTSET_Type;
  136. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  137. #define PORT_OUTSET_OFFSET 0x18 /**< \brief (PORT_OUTSET offset) Data Output Value Set */
  138. #define PORT_OUTSET_RESETVALUE _U_(0x00000000) /**< \brief (PORT_OUTSET reset_value) Data Output Value Set */
  139. #define PORT_OUTSET_OUTSET_Pos 0 /**< \brief (PORT_OUTSET) Port Data Output Value Set */
  140. #define PORT_OUTSET_OUTSET_Msk (_U_(0xFFFFFFFF) << PORT_OUTSET_OUTSET_Pos)
  141. #define PORT_OUTSET_OUTSET(value) (PORT_OUTSET_OUTSET_Msk & ((value) << PORT_OUTSET_OUTSET_Pos))
  142. #define PORT_OUTSET_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_OUTSET) MASK Register */
  143. /* -------- PORT_OUTTGL : (PORT Offset: 0x1C) (R/W 32) GROUP Data Output Value Toggle -------- */
  144. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  145. typedef union {
  146. struct {
  147. uint32_t OUTTGL:32; /*!< bit: 0..31 Port Data Output Value Toggle */
  148. } bit; /*!< Structure used for bit access */
  149. uint32_t reg; /*!< Type used for register access */
  150. } PORT_OUTTGL_Type;
  151. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  152. #define PORT_OUTTGL_OFFSET 0x1C /**< \brief (PORT_OUTTGL offset) Data Output Value Toggle */
  153. #define PORT_OUTTGL_RESETVALUE _U_(0x00000000) /**< \brief (PORT_OUTTGL reset_value) Data Output Value Toggle */
  154. #define PORT_OUTTGL_OUTTGL_Pos 0 /**< \brief (PORT_OUTTGL) Port Data Output Value Toggle */
  155. #define PORT_OUTTGL_OUTTGL_Msk (_U_(0xFFFFFFFF) << PORT_OUTTGL_OUTTGL_Pos)
  156. #define PORT_OUTTGL_OUTTGL(value) (PORT_OUTTGL_OUTTGL_Msk & ((value) << PORT_OUTTGL_OUTTGL_Pos))
  157. #define PORT_OUTTGL_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_OUTTGL) MASK Register */
  158. /* -------- PORT_IN : (PORT Offset: 0x20) (R/ 32) GROUP Data Input Value -------- */
  159. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  160. typedef union {
  161. struct {
  162. uint32_t IN:32; /*!< bit: 0..31 Port Data Input Value */
  163. } bit; /*!< Structure used for bit access */
  164. uint32_t reg; /*!< Type used for register access */
  165. } PORT_IN_Type;
  166. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  167. #define PORT_IN_OFFSET 0x20 /**< \brief (PORT_IN offset) Data Input Value */
  168. #define PORT_IN_RESETVALUE _U_(0x00000000) /**< \brief (PORT_IN reset_value) Data Input Value */
  169. #define PORT_IN_IN_Pos 0 /**< \brief (PORT_IN) Port Data Input Value */
  170. #define PORT_IN_IN_Msk (_U_(0xFFFFFFFF) << PORT_IN_IN_Pos)
  171. #define PORT_IN_IN(value) (PORT_IN_IN_Msk & ((value) << PORT_IN_IN_Pos))
  172. #define PORT_IN_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_IN) MASK Register */
  173. /* -------- PORT_CTRL : (PORT Offset: 0x24) (R/W 32) GROUP Control -------- */
  174. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  175. typedef union {
  176. struct {
  177. uint32_t SAMPLING:32; /*!< bit: 0..31 Input Sampling Mode */
  178. } bit; /*!< Structure used for bit access */
  179. uint32_t reg; /*!< Type used for register access */
  180. } PORT_CTRL_Type;
  181. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  182. #define PORT_CTRL_OFFSET 0x24 /**< \brief (PORT_CTRL offset) Control */
  183. #define PORT_CTRL_RESETVALUE _U_(0x00000000) /**< \brief (PORT_CTRL reset_value) Control */
  184. #define PORT_CTRL_SAMPLING_Pos 0 /**< \brief (PORT_CTRL) Input Sampling Mode */
  185. #define PORT_CTRL_SAMPLING_Msk (_U_(0xFFFFFFFF) << PORT_CTRL_SAMPLING_Pos)
  186. #define PORT_CTRL_SAMPLING(value) (PORT_CTRL_SAMPLING_Msk & ((value) << PORT_CTRL_SAMPLING_Pos))
  187. #define PORT_CTRL_MASK _U_(0xFFFFFFFF) /**< \brief (PORT_CTRL) MASK Register */
  188. /* -------- PORT_WRCONFIG : (PORT Offset: 0x28) ( /W 32) GROUP Write Configuration -------- */
  189. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  190. typedef union {
  191. struct {
  192. uint32_t PINMASK:16; /*!< bit: 0..15 Pin Mask for Multiple Pin Configuration */
  193. uint32_t PMUXEN:1; /*!< bit: 16 Peripheral Multiplexer Enable */
  194. uint32_t INEN:1; /*!< bit: 17 Input Enable */
  195. uint32_t PULLEN:1; /*!< bit: 18 Pull Enable */
  196. uint32_t :3; /*!< bit: 19..21 Reserved */
  197. uint32_t DRVSTR:1; /*!< bit: 22 Output Driver Strength Selection */
  198. uint32_t :1; /*!< bit: 23 Reserved */
  199. uint32_t PMUX:4; /*!< bit: 24..27 Peripheral Multiplexing */
  200. uint32_t WRPMUX:1; /*!< bit: 28 Write PMUX */
  201. uint32_t :1; /*!< bit: 29 Reserved */
  202. uint32_t WRPINCFG:1; /*!< bit: 30 Write PINCFG */
  203. uint32_t HWSEL:1; /*!< bit: 31 Half-Word Select */
  204. } bit; /*!< Structure used for bit access */
  205. uint32_t reg; /*!< Type used for register access */
  206. } PORT_WRCONFIG_Type;
  207. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  208. #define PORT_WRCONFIG_OFFSET 0x28 /**< \brief (PORT_WRCONFIG offset) Write Configuration */
  209. #define PORT_WRCONFIG_RESETVALUE _U_(0x00000000) /**< \brief (PORT_WRCONFIG reset_value) Write Configuration */
  210. #define PORT_WRCONFIG_PINMASK_Pos 0 /**< \brief (PORT_WRCONFIG) Pin Mask for Multiple Pin Configuration */
  211. #define PORT_WRCONFIG_PINMASK_Msk (_U_(0xFFFF) << PORT_WRCONFIG_PINMASK_Pos)
  212. #define PORT_WRCONFIG_PINMASK(value) (PORT_WRCONFIG_PINMASK_Msk & ((value) << PORT_WRCONFIG_PINMASK_Pos))
  213. #define PORT_WRCONFIG_PMUXEN_Pos 16 /**< \brief (PORT_WRCONFIG) Peripheral Multiplexer Enable */
  214. #define PORT_WRCONFIG_PMUXEN (_U_(0x1) << PORT_WRCONFIG_PMUXEN_Pos)
  215. #define PORT_WRCONFIG_INEN_Pos 17 /**< \brief (PORT_WRCONFIG) Input Enable */
  216. #define PORT_WRCONFIG_INEN (_U_(0x1) << PORT_WRCONFIG_INEN_Pos)
  217. #define PORT_WRCONFIG_PULLEN_Pos 18 /**< \brief (PORT_WRCONFIG) Pull Enable */
  218. #define PORT_WRCONFIG_PULLEN (_U_(0x1) << PORT_WRCONFIG_PULLEN_Pos)
  219. #define PORT_WRCONFIG_DRVSTR_Pos 22 /**< \brief (PORT_WRCONFIG) Output Driver Strength Selection */
  220. #define PORT_WRCONFIG_DRVSTR (_U_(0x1) << PORT_WRCONFIG_DRVSTR_Pos)
  221. #define PORT_WRCONFIG_PMUX_Pos 24 /**< \brief (PORT_WRCONFIG) Peripheral Multiplexing */
  222. #define PORT_WRCONFIG_PMUX_Msk (_U_(0xF) << PORT_WRCONFIG_PMUX_Pos)
  223. #define PORT_WRCONFIG_PMUX(value) (PORT_WRCONFIG_PMUX_Msk & ((value) << PORT_WRCONFIG_PMUX_Pos))
  224. #define PORT_WRCONFIG_WRPMUX_Pos 28 /**< \brief (PORT_WRCONFIG) Write PMUX */
  225. #define PORT_WRCONFIG_WRPMUX (_U_(0x1) << PORT_WRCONFIG_WRPMUX_Pos)
  226. #define PORT_WRCONFIG_WRPINCFG_Pos 30 /**< \brief (PORT_WRCONFIG) Write PINCFG */
  227. #define PORT_WRCONFIG_WRPINCFG (_U_(0x1) << PORT_WRCONFIG_WRPINCFG_Pos)
  228. #define PORT_WRCONFIG_HWSEL_Pos 31 /**< \brief (PORT_WRCONFIG) Half-Word Select */
  229. #define PORT_WRCONFIG_HWSEL (_U_(0x1) << PORT_WRCONFIG_HWSEL_Pos)
  230. #define PORT_WRCONFIG_MASK _U_(0xDF47FFFF) /**< \brief (PORT_WRCONFIG) MASK Register */
  231. /* -------- PORT_PMUX : (PORT Offset: 0x30) (R/W 8) GROUP Peripheral Multiplexing n -------- */
  232. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  233. typedef union {
  234. struct {
  235. uint8_t PMUXE:4; /*!< bit: 0.. 3 Peripheral Multiplexing Even */
  236. uint8_t PMUXO:4; /*!< bit: 4.. 7 Peripheral Multiplexing Odd */
  237. } bit; /*!< Structure used for bit access */
  238. uint8_t reg; /*!< Type used for register access */
  239. } PORT_PMUX_Type;
  240. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  241. #define PORT_PMUX_OFFSET 0x30 /**< \brief (PORT_PMUX offset) Peripheral Multiplexing n */
  242. #define PORT_PMUX_RESETVALUE _U_(0x00) /**< \brief (PORT_PMUX reset_value) Peripheral Multiplexing n */
  243. #define PORT_PMUX_PMUXE_Pos 0 /**< \brief (PORT_PMUX) Peripheral Multiplexing Even */
  244. #define PORT_PMUX_PMUXE_Msk (_U_(0xF) << PORT_PMUX_PMUXE_Pos)
  245. #define PORT_PMUX_PMUXE(value) (PORT_PMUX_PMUXE_Msk & ((value) << PORT_PMUX_PMUXE_Pos))
  246. #define PORT_PMUX_PMUXE_A_Val _U_(0x0) /**< \brief (PORT_PMUX) Peripheral function A selected */
  247. #define PORT_PMUX_PMUXE_B_Val _U_(0x1) /**< \brief (PORT_PMUX) Peripheral function B selected */
  248. #define PORT_PMUX_PMUXE_C_Val _U_(0x2) /**< \brief (PORT_PMUX) Peripheral function C selected */
  249. #define PORT_PMUX_PMUXE_D_Val _U_(0x3) /**< \brief (PORT_PMUX) Peripheral function D selected */
  250. #define PORT_PMUX_PMUXE_E_Val _U_(0x4) /**< \brief (PORT_PMUX) Peripheral function E selected */
  251. #define PORT_PMUX_PMUXE_F_Val _U_(0x5) /**< \brief (PORT_PMUX) Peripheral function F selected */
  252. #define PORT_PMUX_PMUXE_G_Val _U_(0x6) /**< \brief (PORT_PMUX) Peripheral function G selected */
  253. #define PORT_PMUX_PMUXE_H_Val _U_(0x7) /**< \brief (PORT_PMUX) Peripheral function H selected */
  254. #define PORT_PMUX_PMUXE_A (PORT_PMUX_PMUXE_A_Val << PORT_PMUX_PMUXE_Pos)
  255. #define PORT_PMUX_PMUXE_B (PORT_PMUX_PMUXE_B_Val << PORT_PMUX_PMUXE_Pos)
  256. #define PORT_PMUX_PMUXE_C (PORT_PMUX_PMUXE_C_Val << PORT_PMUX_PMUXE_Pos)
  257. #define PORT_PMUX_PMUXE_D (PORT_PMUX_PMUXE_D_Val << PORT_PMUX_PMUXE_Pos)
  258. #define PORT_PMUX_PMUXE_E (PORT_PMUX_PMUXE_E_Val << PORT_PMUX_PMUXE_Pos)
  259. #define PORT_PMUX_PMUXE_F (PORT_PMUX_PMUXE_F_Val << PORT_PMUX_PMUXE_Pos)
  260. #define PORT_PMUX_PMUXE_G (PORT_PMUX_PMUXE_G_Val << PORT_PMUX_PMUXE_Pos)
  261. #define PORT_PMUX_PMUXE_H (PORT_PMUX_PMUXE_H_Val << PORT_PMUX_PMUXE_Pos)
  262. #define PORT_PMUX_PMUXO_Pos 4 /**< \brief (PORT_PMUX) Peripheral Multiplexing Odd */
  263. #define PORT_PMUX_PMUXO_Msk (_U_(0xF) << PORT_PMUX_PMUXO_Pos)
  264. #define PORT_PMUX_PMUXO(value) (PORT_PMUX_PMUXO_Msk & ((value) << PORT_PMUX_PMUXO_Pos))
  265. #define PORT_PMUX_PMUXO_A_Val _U_(0x0) /**< \brief (PORT_PMUX) Peripheral function A selected */
  266. #define PORT_PMUX_PMUXO_B_Val _U_(0x1) /**< \brief (PORT_PMUX) Peripheral function B selected */
  267. #define PORT_PMUX_PMUXO_C_Val _U_(0x2) /**< \brief (PORT_PMUX) Peripheral function C selected */
  268. #define PORT_PMUX_PMUXO_D_Val _U_(0x3) /**< \brief (PORT_PMUX) Peripheral function D selected */
  269. #define PORT_PMUX_PMUXO_E_Val _U_(0x4) /**< \brief (PORT_PMUX) Peripheral function E selected */
  270. #define PORT_PMUX_PMUXO_F_Val _U_(0x5) /**< \brief (PORT_PMUX) Peripheral function F selected */
  271. #define PORT_PMUX_PMUXO_G_Val _U_(0x6) /**< \brief (PORT_PMUX) Peripheral function G selected */
  272. #define PORT_PMUX_PMUXO_H_Val _U_(0x7) /**< \brief (PORT_PMUX) Peripheral function H selected */
  273. #define PORT_PMUX_PMUXO_A (PORT_PMUX_PMUXO_A_Val << PORT_PMUX_PMUXO_Pos)
  274. #define PORT_PMUX_PMUXO_B (PORT_PMUX_PMUXO_B_Val << PORT_PMUX_PMUXO_Pos)
  275. #define PORT_PMUX_PMUXO_C (PORT_PMUX_PMUXO_C_Val << PORT_PMUX_PMUXO_Pos)
  276. #define PORT_PMUX_PMUXO_D (PORT_PMUX_PMUXO_D_Val << PORT_PMUX_PMUXO_Pos)
  277. #define PORT_PMUX_PMUXO_E (PORT_PMUX_PMUXO_E_Val << PORT_PMUX_PMUXO_Pos)
  278. #define PORT_PMUX_PMUXO_F (PORT_PMUX_PMUXO_F_Val << PORT_PMUX_PMUXO_Pos)
  279. #define PORT_PMUX_PMUXO_G (PORT_PMUX_PMUXO_G_Val << PORT_PMUX_PMUXO_Pos)
  280. #define PORT_PMUX_PMUXO_H (PORT_PMUX_PMUXO_H_Val << PORT_PMUX_PMUXO_Pos)
  281. #define PORT_PMUX_MASK _U_(0xFF) /**< \brief (PORT_PMUX) MASK Register */
  282. /* -------- PORT_PINCFG : (PORT Offset: 0x40) (R/W 8) GROUP Pin Configuration n -------- */
  283. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  284. typedef union {
  285. struct {
  286. uint8_t PMUXEN:1; /*!< bit: 0 Peripheral Multiplexer Enable */
  287. uint8_t INEN:1; /*!< bit: 1 Input Enable */
  288. uint8_t PULLEN:1; /*!< bit: 2 Pull Enable */
  289. uint8_t :3; /*!< bit: 3.. 5 Reserved */
  290. uint8_t DRVSTR:1; /*!< bit: 6 Output Driver Strength Selection */
  291. uint8_t :1; /*!< bit: 7 Reserved */
  292. } bit; /*!< Structure used for bit access */
  293. uint8_t reg; /*!< Type used for register access */
  294. } PORT_PINCFG_Type;
  295. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  296. #define PORT_PINCFG_OFFSET 0x40 /**< \brief (PORT_PINCFG offset) Pin Configuration n */
  297. #define PORT_PINCFG_RESETVALUE _U_(0x00) /**< \brief (PORT_PINCFG reset_value) Pin Configuration n */
  298. #define PORT_PINCFG_PMUXEN_Pos 0 /**< \brief (PORT_PINCFG) Peripheral Multiplexer Enable */
  299. #define PORT_PINCFG_PMUXEN (_U_(0x1) << PORT_PINCFG_PMUXEN_Pos)
  300. #define PORT_PINCFG_INEN_Pos 1 /**< \brief (PORT_PINCFG) Input Enable */
  301. #define PORT_PINCFG_INEN (_U_(0x1) << PORT_PINCFG_INEN_Pos)
  302. #define PORT_PINCFG_PULLEN_Pos 2 /**< \brief (PORT_PINCFG) Pull Enable */
  303. #define PORT_PINCFG_PULLEN (_U_(0x1) << PORT_PINCFG_PULLEN_Pos)
  304. #define PORT_PINCFG_DRVSTR_Pos 6 /**< \brief (PORT_PINCFG) Output Driver Strength Selection */
  305. #define PORT_PINCFG_DRVSTR (_U_(0x1) << PORT_PINCFG_DRVSTR_Pos)
  306. #define PORT_PINCFG_MASK _U_(0x47) /**< \brief (PORT_PINCFG) MASK Register */
  307. /** \brief PortGroup hardware registers */
  308. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  309. typedef struct {
  310. __IO PORT_DIR_Type DIR; /**< \brief Offset: 0x00 (R/W 32) Data Direction */
  311. __IO PORT_DIRCLR_Type DIRCLR; /**< \brief Offset: 0x04 (R/W 32) Data Direction Clear */
  312. __IO PORT_DIRSET_Type DIRSET; /**< \brief Offset: 0x08 (R/W 32) Data Direction Set */
  313. __IO PORT_DIRTGL_Type DIRTGL; /**< \brief Offset: 0x0C (R/W 32) Data Direction Toggle */
  314. __IO PORT_OUT_Type OUT; /**< \brief Offset: 0x10 (R/W 32) Data Output Value */
  315. __IO PORT_OUTCLR_Type OUTCLR; /**< \brief Offset: 0x14 (R/W 32) Data Output Value Clear */
  316. __IO PORT_OUTSET_Type OUTSET; /**< \brief Offset: 0x18 (R/W 32) Data Output Value Set */
  317. __IO PORT_OUTTGL_Type OUTTGL; /**< \brief Offset: 0x1C (R/W 32) Data Output Value Toggle */
  318. __I PORT_IN_Type IN; /**< \brief Offset: 0x20 (R/ 32) Data Input Value */
  319. __IO PORT_CTRL_Type CTRL; /**< \brief Offset: 0x24 (R/W 32) Control */
  320. __O PORT_WRCONFIG_Type WRCONFIG; /**< \brief Offset: 0x28 ( /W 32) Write Configuration */
  321. RoReg8 Reserved1[0x4];
  322. __IO PORT_PMUX_Type PMUX[16]; /**< \brief Offset: 0x30 (R/W 8) Peripheral Multiplexing n */
  323. __IO PORT_PINCFG_Type PINCFG[32]; /**< \brief Offset: 0x40 (R/W 8) Pin Configuration n */
  324. RoReg8 Reserved2[0x20];
  325. } PortGroup;
  326. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  327. /** \brief PORT hardware registers */
  328. #if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
  329. typedef struct {
  330. PortGroup Group[1]; /**< \brief Offset: 0x00 PortGroup groups [GROUPS] */
  331. } Port;
  332. #endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
  333. /*@}*/
  334. #endif /* _SAMD11_PORT_COMPONENT_ */