opa_reg.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /**************************************************************************//**
  2. * @file opa_reg.h
  3. * @version V1.00
  4. * @brief OPA register definition header file
  5. *
  6. * SPDX-License-Identifier: Apache-2.0
  7. * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #ifndef __OPA_REG_H__
  10. #define __OPA_REG_H__
  11. #if defined ( __CC_ARM )
  12. #pragma anon_unions
  13. #endif
  14. /**
  15. @addtogroup REGISTER Control Register
  16. @{
  17. */
  18. /**
  19. @addtogroup OPA OP Amplifier(OPA)
  20. Memory Mapped Structure for OPA Controller
  21. @{ */
  22. typedef struct
  23. {
  24. /**
  25. * @var OPA_T::CTL
  26. * Offset: 0x00 OP Amplifier Control Register
  27. * ---------------------------------------------------------------------------------------------------
  28. * |Bits |Field |Descriptions
  29. * | :----: | :----: | :---- |
  30. * |[0] |OPEN0 |OP Amplifier 0 Enable Bit
  31. * | | |0 = OP amplifier0 Disabled.
  32. * | | |1 = OP amplifier0 Enabled.
  33. * | | |Note: OP Amplifier 0 output needs wait stable 20u03BCs after OPEN0 is set.
  34. * |[1] |OPEN1 |OP Amplifier 1 Enable Bit
  35. * | | |0 = OP amplifier1 Disabled.
  36. * | | |1 = OP amplifier1 Enabled.
  37. * | | |Note: OP Amplifier 1 output needs wait stable 20u03BCs after OPEN1 is set.
  38. * |[2] |OPEN2 |OP Amplifier 2 Enable Bit
  39. * | | |0 = OP amplifier2 Disabled.
  40. * | | |1 = OP amplifier2 Enabled.
  41. * | | |Note: OP Amplifier 2 output needs wait stable 20u03BCs after OPEN2 is set.
  42. * |[4] |OPDOEN0 |OP Amplifier 0 Schmitt Trigger Non-inverting Buffer Enable Bit
  43. * | | |0 = OP amplifier0 Schmitt Trigger non-invert buffer Disabled.
  44. * | | |1 = OP amplifier0 Schmitt Trigger non-invert buffer Enabled.
  45. * |[5] |OPDOEN1 |OP Amplifier 1 Schmitt Trigger Non-inverting Buffer Enable Bit
  46. * | | |0 = OP amplifier1 Schmitt Trigger non-invert buffer Disabled.
  47. * | | |1 = OP amplifier1 Schmitt Trigger non-invert buffer Enabled.
  48. * |[6] |OPDOEN2 |OP Amplifier 2 Schmitt Trigger Non-inverting Buffer Enable Bit
  49. * | | |0 = OP amplifier2 Schmitt Trigger non-invert buffer Disabled.
  50. * | | |1 = OP amplifier2 Schmitt Trigger non-invert buffer Enabled.
  51. * |[8] |OPDOIEN0 |OP Amplifier 0 Schmitt Trigger Digital Output Interrupt Enable Bit
  52. * | | |0 = OP Amplifier 0 digital output interrupt function Disabled.
  53. * | | |1 = OP Amplifier 0 digital output interrupt function Enabled.
  54. * | | |The OPDOIF0 interrupt flag is set by hardware whenever the OP amplifier 0 Schmitt Trigger non-inverting buffer digital output changes state, in the meanwhile, if OPDOIEN0 is set to 1, a comparator interrupt request is generated.
  55. * |[9] |OPDOIEN1 |OP Amplifier 1 Schmitt Trigger Digital Output Interrupt Enable Bit
  56. * | | |0 = OP Amplifier 1 digital output interrupt function Disabled.
  57. * | | |1 = OP Amplifier 1 digital output interrupt function Enabled.
  58. * | | |OPDOIF1 interrupt flag is set by hardware whenever the OP amplifier 1 Schmitt trigger non-inverting buffer digital output changes state, in the meanwhile, if OPDOIEN1 is set to 1, a comparator interrupt request is generated.
  59. * |[10] |OPDOIEN2 |OP Amplifier 2 Schmitt Trigger Digital Output Interrupt Enable Bit
  60. * | | |0 = OP Amplifier 2 digital output interrupt function Disabled.
  61. * | | |1 = OP Amplifier 2 digital output interrupt function Enabled.
  62. * | | |OPDOIF2 interrupt flag is set by hardware whenever the OP amplifier 2 Schmitt Trigger non-inverting buffer digital output changes state, in the meanwhile, if OPDOIEN2 is set to 1, a comparator interrupt request is generated.
  63. * @var OPA_T::STATUS
  64. * Offset: 0x04 OP Amplifier Status Register
  65. * ---------------------------------------------------------------------------------------------------
  66. * |Bits |Field |Descriptions
  67. * | :----: | :----: | :---- |
  68. * |[0] |OPDO0 |OP Amplifier 0 Digital Output
  69. * | | |Synchronized to the APB clock to allow reading by software
  70. * | | |Cleared when the Schmitt Trigger buffer is disabled (OPDOEN0 = 0)
  71. * |[1] |OPDO1 |OP Amplifier 1 Digital Output
  72. * | | |Synchronized to the APB clock to allow reading by software
  73. * | | |Cleared when the Schmitt Trigger buffer is disabled (OPDOEN1 = 0)
  74. * |[2] |OPDO2 |OP Amplifier 2 Digital Output
  75. * | | |Synchronized to the APB clock to allow reading by software
  76. * | | |Cleared when the Schmitt Trigger buffer is disabled (OPDOEN2 = 0)
  77. * |[4] |OPDOIF0 |OP Amplifier 0 Schmitt Trigger Digital Output Interrupt Flag
  78. * | | |OPDOIF0 interrupt flag is set by hardware whenever the OP amplifier 0 Schmitt Trigger non-inverting buffer digital output changes state
  79. * | | |This bit is cleared by writing 1 to it.
  80. * |[5] |OPDOIF1 |OP Amplifier 1 Schmitt Trigger Digital Output Interrupt Flag
  81. * | | |OPDOIF1 interrupt flag is set by hardware whenever the OP amplifier 1 Schmitt Trigger non-inverting buffer digital output changes state
  82. * | | |This bit is cleared by writing 1 to it.
  83. * |[6] |OPDOIF2 |OP Amplifier 2 Schmitt Trigger Digital Output Interrupt Flag
  84. * | | |OPDOIF2 interrupt flag is set by hardware whenever the OP amplifier 2 Schmitt Trigger non-inverting buffer digital output changes state
  85. * | | |This bit is cleared by writing 1 to it.
  86. * @var OPA_T::CALCTL
  87. * Offset: 0x08 OP Amplifier Calibration Control Register
  88. * ---------------------------------------------------------------------------------------------------
  89. * |Bits |Field |Descriptions
  90. * | :----: | :----: | :---- |
  91. * |[0] |CALTRG0 |OP Amplifier 0 Calibration Trigger Bit
  92. * | | |0 = Stop, hardware auto clear.
  93. * | | |1 = Start. Note: Before enable this bit, it should set OPEN0 in advance.
  94. * |[1] |CALTRG1 |OP Amplifier 1 Calibration Trigger Bit
  95. * | | |0 = Stop, hardware auto clear.
  96. * | | |1 = Start. Note: Before enable this bit, it should set OPEN1 in advance.
  97. * |[2] |CALTRG2 |OP Amplifier 2 Calibration Trigger Bit
  98. * | | |0 = Stop, hardware auto clear.
  99. * | | |1 = Start. Note: Before enable this bit, it should set OPEN2 in advance.
  100. * |[16] |CALRVS0 |OPA0 Calibration Reference Voltage Selection
  101. * | | |0 = VREF is AVDD.
  102. * | | |1 = VREF from high vcm to low vcm.
  103. * |[17] |CALRVS1 |OPA1 Calibration Reference Voltage Selection
  104. * | | |0 = VREF is AVDD.
  105. * | | |1 = VREF from high vcm to low vcm.
  106. * |[18] |CALRVS2 |OPA2 Calibration Reference Voltage Selection
  107. * | | |0 = VREF is AVDD.
  108. * | | |1 = VREF from high vcm to low vcm.
  109. * @var OPA_T::CALST
  110. * Offset: 0x0C OP Amplifier Calibration Status Register
  111. * ---------------------------------------------------------------------------------------------------
  112. * |Bits |Field |Descriptions
  113. * | :----: | :----: | :---- |
  114. * |[0] |DONE0 |OP Amplifier 0 Calibration Done Status
  115. * | | |0 = Calibrating.
  116. * | | |1 = Calibration Done.
  117. * |[1] |CALNS0 |OP Amplifier 0 Calibration Result Status for NMOS
  118. * | | |0 = Pass.
  119. * | | |1 = Fail.
  120. * |[2] |CALPS0 |OP Amplifier 0 Calibration Result Status for PMOS
  121. * | | |0 = Pass.
  122. * | | |1 = Fail.
  123. * |[4] |DONE1 |OP Amplifier 1 Calibration Done Status
  124. * | | |0 = Calibrating.
  125. * | | |1 = Calibration Done.
  126. * |[5] |CALNS1 |OP Amplifier 1 Calibration Result Status for NMOS
  127. * | | |0 = Pass.
  128. * | | |1 = Fail.
  129. * |[6] |CALPS1 |OP Amplifier 1 Calibration Result Status for PMOS
  130. * | | |0 = Pass.
  131. * | | |1 = Fail.
  132. * |[8] |DONE2 |OP Amplifier 2 Calibration Done Status
  133. * | | |0 = Calibrating.
  134. * | | |1 = Calibration Done.
  135. * |[9] |CALNS2 |OP Amplifier 2 Calibration Result Status for NMOS
  136. * | | |0 = Pass.
  137. * | | |1 = Fail.
  138. * |[10] |CALPS2 |OP Amplifier 2 Calibration Result Status for PMOS
  139. * | | |0 = Pass.
  140. * | | |1 = Fail.
  141. */
  142. __IO uint32_t CTL; /*!< [0x0000] OP Amplifier Control Register */
  143. __IO uint32_t STATUS; /*!< [0x0004] OP Amplifier Status Register */
  144. __IO uint32_t CALCTL; /*!< [0x0008] OP Amplifier Calibration Control Register */
  145. __I uint32_t CALST; /*!< [0x000c] OP Amplifier Calibration Status Register */
  146. } OPA_T;
  147. /**
  148. @addtogroup OPA_CONST OPA Bit Field Definition
  149. Constant Definitions for OPA Controller
  150. @{ */
  151. #define OPA_CTL_OPEN0_Pos (0) /*!< OPA_T::CTL: OPEN0 Position */
  152. #define OPA_CTL_OPEN0_Msk (0x1ul << OPA_CTL_OPEN0_Pos) /*!< OPA_T::CTL: OPEN0 Mask */
  153. #define OPA_CTL_OPEN1_Pos (1) /*!< OPA_T::CTL: OPEN1 Position */
  154. #define OPA_CTL_OPEN1_Msk (0x1ul << OPA_CTL_OPEN1_Pos) /*!< OPA_T::CTL: OPEN1 Mask */
  155. #define OPA_CTL_OPEN2_Pos (2) /*!< OPA_T::CTL: OPEN2 Position */
  156. #define OPA_CTL_OPEN2_Msk (0x1ul << OPA_CTL_OPEN2_Pos) /*!< OPA_T::CTL: OPEN2 Mask */
  157. #define OPA_CTL_OPDOEN0_Pos (4) /*!< OPA_T::CTL: OPDOEN0 Position */
  158. #define OPA_CTL_OPDOEN0_Msk (0x1ul << OPA_CTL_OPDOEN0_Pos) /*!< OPA_T::CTL: OPDOEN0 Mask */
  159. #define OPA_CTL_OPDOEN1_Pos (5) /*!< OPA_T::CTL: OPDOEN1 Position */
  160. #define OPA_CTL_OPDOEN1_Msk (0x1ul << OPA_CTL_OPDOEN1_Pos) /*!< OPA_T::CTL: OPDOEN1 Mask */
  161. #define OPA_CTL_OPDOEN2_Pos (6) /*!< OPA_T::CTL: OPDOEN2 Position */
  162. #define OPA_CTL_OPDOEN2_Msk (0x1ul << OPA_CTL_OPDOEN2_Pos) /*!< OPA_T::CTL: OPDOEN2 Mask */
  163. #define OPA_CTL_OPDOIEN0_Pos (8) /*!< OPA_T::CTL: OPDOIEN0 Position */
  164. #define OPA_CTL_OPDOIEN0_Msk (0x1ul << OPA_CTL_OPDOIEN0_Pos) /*!< OPA_T::CTL: OPDOIEN0 Mask */
  165. #define OPA_CTL_OPDOIEN1_Pos (9) /*!< OPA_T::CTL: OPDOIEN1 Position */
  166. #define OPA_CTL_OPDOIEN1_Msk (0x1ul << OPA_CTL_OPDOIEN1_Pos) /*!< OPA_T::CTL: OPDOIEN1 Mask */
  167. #define OPA_CTL_OPDOIEN2_Pos (10) /*!< OPA_T::CTL: OPDOIEN2 Position */
  168. #define OPA_CTL_OPDOIEN2_Msk (0x1ul << OPA_CTL_OPDOIEN2_Pos) /*!< OPA_T::CTL: OPDOIEN2 Mask */
  169. #define OPA_STATUS_OPDO0_Pos (0) /*!< OPA_T::STATUS: OPDO0 Position */
  170. #define OPA_STATUS_OPDO0_Msk (0x1ul << OPA_STATUS_OPDO0_Pos) /*!< OPA_T::STATUS: OPDO0 Mask */
  171. #define OPA_STATUS_OPDO1_Pos (1) /*!< OPA_T::STATUS: OPDO1 Position */
  172. #define OPA_STATUS_OPDO1_Msk (0x1ul << OPA_STATUS_OPDO1_Pos) /*!< OPA_T::STATUS: OPDO1 Mask */
  173. #define OPA_STATUS_OPDO2_Pos (2) /*!< OPA_T::STATUS: OPDO2 Position */
  174. #define OPA_STATUS_OPDO2_Msk (0x1ul << OPA_STATUS_OPDO2_Pos) /*!< OPA_T::STATUS: OPDO2 Mask */
  175. #define OPA_STATUS_OPDOIF0_Pos (4) /*!< OPA_T::STATUS: OPDOIF0 Position */
  176. #define OPA_STATUS_OPDOIF0_Msk (0x1ul << OPA_STATUS_OPDOIF0_Pos) /*!< OPA_T::STATUS: OPDOIF0 Mask */
  177. #define OPA_STATUS_OPDOIF1_Pos (5) /*!< OPA_T::STATUS: OPDOIF1 Position */
  178. #define OPA_STATUS_OPDOIF1_Msk (0x1ul << OPA_STATUS_OPDOIF1_Pos) /*!< OPA_T::STATUS: OPDOIF1 Mask */
  179. #define OPA_STATUS_OPDOIF2_Pos (6) /*!< OPA_T::STATUS: OPDOIF2 Position */
  180. #define OPA_STATUS_OPDOIF2_Msk (0x1ul << OPA_STATUS_OPDOIF2_Pos) /*!< OPA_T::STATUS: OPDOIF2 Mask */
  181. #define OPA_CALCTL_CALTRG0_Pos (0) /*!< OPA_T::CALCTL: CALTRG0 Position */
  182. #define OPA_CALCTL_CALTRG0_Msk (0x1ul << OPA_CALCTL_CALTRG0_Pos) /*!< OPA_T::CALCTL: CALTRG0 Mask */
  183. #define OPA_CALCTL_CALTRG1_Pos (1) /*!< OPA_T::CALCTL: CALTRG1 Position */
  184. #define OPA_CALCTL_CALTRG1_Msk (0x1ul << OPA_CALCTL_CALTRG1_Pos) /*!< OPA_T::CALCTL: CALTRG1 Mask */
  185. #define OPA_CALCTL_CALTRG2_Pos (2) /*!< OPA_T::CALCTL: CALTRG2 Position */
  186. #define OPA_CALCTL_CALTRG2_Msk (0x1ul << OPA_CALCTL_CALTRG2_Pos) /*!< OPA_T::CALCTL: CALTRG2 Mask */
  187. #define OPA_CALCTL_CALCLK0_Pos (4) /*!< OPA_T::CALCTL: CALCLK0 Position */
  188. #define OPA_CALCTL_CALCLK0_Msk (0x3ul << OPA_CALCTL_CALCLK0_Pos) /*!< OPA_T::CALCTL: CALCLK0 Mask */
  189. #define OPA_CALCTL_CALCLK1_Pos (6) /*!< OPA_T::CALCTL: CALCLK1 Position */
  190. #define OPA_CALCTL_CALCLK1_Msk (0x3ul << OPA_CALCTL_CALCLK1_Pos) /*!< OPA_T::CALCTL: CALCLK1 Mask */
  191. #define OPA_CALCTL_CALCLK2_Pos (8) /*!< OPA_T::CALCTL: CALCLK2 Position */
  192. #define OPA_CALCTL_CALCLK2_Msk (0x3ul << OPA_CALCTL_CALCLK2_Pos) /*!< OPA_T::CALCTL: CALCLK2 Mask */
  193. #define OPA_CALCTL_CALRVS0_Pos (16) /*!< OPA_T::CALCTL: CALRVS0 Position */
  194. #define OPA_CALCTL_CALRVS0_Msk (0x1ul << OPA_CALCTL_CALRVS0_Pos) /*!< OPA_T::CALCTL: CALRVS0 Mask */
  195. #define OPA_CALCTL_CALRVS1_Pos (17) /*!< OPA_T::CALCTL: CALRVS1 Position */
  196. #define OPA_CALCTL_CALRVS1_Msk (0x1ul << OPA_CALCTL_CALRVS1_Pos) /*!< OPA_T::CALCTL: CALRVS1 Mask */
  197. #define OPA_CALCTL_CALRVS2_Pos (18) /*!< OPA_T::CALCTL: CALRVS2 Position */
  198. #define OPA_CALCTL_CALRVS2_Msk (0x1ul << OPA_CALCTL_CALRVS2_Pos) /*!< OPA_T::CALCTL: CALRVS2 Mask */
  199. #define OPA_CALST_DONE0_Pos (0) /*!< OPA_T::CALST: DONE0 Position */
  200. #define OPA_CALST_DONE0_Msk (0x1ul << OPA_CALST_DONE0_Pos) /*!< OPA_T::CALST: DONE0 Mask */
  201. #define OPA_CALST_CALNS0_Pos (1) /*!< OPA_T::CALST: CALNS0 Position */
  202. #define OPA_CALST_CALNS0_Msk (0x1ul << OPA_CALST_CALNS0_Pos) /*!< OPA_T::CALST: CALNS0 Mask */
  203. #define OPA_CALST_CALPS0_Pos (2) /*!< OPA_T::CALST: CALPS0 Position */
  204. #define OPA_CALST_CALPS0_Msk (0x1ul << OPA_CALST_CALPS0_Pos) /*!< OPA_T::CALST: CALPS0 Mask */
  205. #define OPA_CALST_DONE1_Pos (4) /*!< OPA_T::CALST: DONE1 Position */
  206. #define OPA_CALST_DONE1_Msk (0x1ul << OPA_CALST_DONE1_Pos) /*!< OPA_T::CALST: DONE1 Mask */
  207. #define OPA_CALST_CALNS1_Pos (5) /*!< OPA_T::CALST: CALNS1 Position */
  208. #define OPA_CALST_CALNS1_Msk (0x1ul << OPA_CALST_CALNS1_Pos) /*!< OPA_T::CALST: CALNS1 Mask */
  209. #define OPA_CALST_CALPS1_Pos (6) /*!< OPA_T::CALST: CALPS1 Position */
  210. #define OPA_CALST_CALPS1_Msk (0x1ul << OPA_CALST_CALPS1_Pos) /*!< OPA_T::CALST: CALPS1 Mask */
  211. #define OPA_CALST_DONE2_Pos (8) /*!< OPA_T::CALST: DONE2 Position */
  212. #define OPA_CALST_DONE2_Msk (0x1ul << OPA_CALST_DONE2_Pos) /*!< OPA_T::CALST: DONE2 Mask */
  213. #define OPA_CALST_CALNS2_Pos (9) /*!< OPA_T::CALST: CALNS2 Position */
  214. #define OPA_CALST_CALNS2_Msk (0x1ul << OPA_CALST_CALNS2_Pos) /*!< OPA_T::CALST: CALNS2 Mask */
  215. #define OPA_CALST_CALPS2_Pos (10) /*!< OPA_T::CALST: CALPS2 Position */
  216. #define OPA_CALST_CALPS2_Msk (0x1ul << OPA_CALST_CALPS2_Pos) /*!< OPA_T::CALST: CALPS2 Mask */
  217. /**@}*/ /* OPA_CONST */
  218. /**@}*/ /* end of OPA register group */
  219. /**@}*/ /* end of REGISTER group */
  220. #if defined ( __CC_ARM )
  221. #pragma no_anon_unions
  222. #endif
  223. #endif /* __OPA_REG_H__ */