trng.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /**
  2. * \file
  3. *
  4. * \brief Component description for TRNG
  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_TRNG_COMPONENT_H_
  31. #define _SAML11_TRNG_COMPONENT_H_
  32. #define _SAML11_TRNG_COMPONENT_ /**< \deprecated Backward compatibility for ASF */
  33. /** \addtogroup SAML_SAML11 True Random Generator
  34. * @{
  35. */
  36. /* ========================================================================== */
  37. /** SOFTWARE API DEFINITION FOR TRNG */
  38. /* ========================================================================== */
  39. #define TRNG_U2242 /**< (TRNG) Module ID */
  40. #define REV_TRNG 0x120 /**< (TRNG) Module revision */
  41. /* -------- TRNG_CTRLA : (TRNG Offset: 0x00) (R/W 8) Control A -------- */
  42. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  43. typedef union {
  44. struct {
  45. uint8_t :1; /**< bit: 0 Reserved */
  46. uint8_t ENABLE:1; /**< bit: 1 Enable */
  47. uint8_t :4; /**< bit: 2..5 Reserved */
  48. uint8_t RUNSTDBY:1; /**< bit: 6 Run in Standby */
  49. uint8_t :1; /**< bit: 7 Reserved */
  50. } bit; /**< Structure used for bit access */
  51. uint8_t reg; /**< Type used for register access */
  52. } TRNG_CTRLA_Type;
  53. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  54. #define TRNG_CTRLA_OFFSET (0x00) /**< (TRNG_CTRLA) Control A Offset */
  55. #define TRNG_CTRLA_RESETVALUE _U_(0x00) /**< (TRNG_CTRLA) Control A Reset Value */
  56. #define TRNG_CTRLA_ENABLE_Pos 1 /**< (TRNG_CTRLA) Enable Position */
  57. #define TRNG_CTRLA_ENABLE_Msk (_U_(0x1) << TRNG_CTRLA_ENABLE_Pos) /**< (TRNG_CTRLA) Enable Mask */
  58. #define TRNG_CTRLA_ENABLE TRNG_CTRLA_ENABLE_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_CTRLA_ENABLE_Msk instead */
  59. #define TRNG_CTRLA_RUNSTDBY_Pos 6 /**< (TRNG_CTRLA) Run in Standby Position */
  60. #define TRNG_CTRLA_RUNSTDBY_Msk (_U_(0x1) << TRNG_CTRLA_RUNSTDBY_Pos) /**< (TRNG_CTRLA) Run in Standby Mask */
  61. #define TRNG_CTRLA_RUNSTDBY TRNG_CTRLA_RUNSTDBY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_CTRLA_RUNSTDBY_Msk instead */
  62. #define TRNG_CTRLA_MASK _U_(0x42) /**< \deprecated (TRNG_CTRLA) Register MASK (Use TRNG_CTRLA_Msk instead) */
  63. #define TRNG_CTRLA_Msk _U_(0x42) /**< (TRNG_CTRLA) Register Mask */
  64. /* -------- TRNG_EVCTRL : (TRNG Offset: 0x04) (R/W 8) Event Control -------- */
  65. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  66. typedef union {
  67. struct {
  68. uint8_t DATARDYEO:1; /**< bit: 0 Data Ready Event Output */
  69. uint8_t :7; /**< bit: 1..7 Reserved */
  70. } bit; /**< Structure used for bit access */
  71. uint8_t reg; /**< Type used for register access */
  72. } TRNG_EVCTRL_Type;
  73. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  74. #define TRNG_EVCTRL_OFFSET (0x04) /**< (TRNG_EVCTRL) Event Control Offset */
  75. #define TRNG_EVCTRL_RESETVALUE _U_(0x00) /**< (TRNG_EVCTRL) Event Control Reset Value */
  76. #define TRNG_EVCTRL_DATARDYEO_Pos 0 /**< (TRNG_EVCTRL) Data Ready Event Output Position */
  77. #define TRNG_EVCTRL_DATARDYEO_Msk (_U_(0x1) << TRNG_EVCTRL_DATARDYEO_Pos) /**< (TRNG_EVCTRL) Data Ready Event Output Mask */
  78. #define TRNG_EVCTRL_DATARDYEO TRNG_EVCTRL_DATARDYEO_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_EVCTRL_DATARDYEO_Msk instead */
  79. #define TRNG_EVCTRL_MASK _U_(0x01) /**< \deprecated (TRNG_EVCTRL) Register MASK (Use TRNG_EVCTRL_Msk instead) */
  80. #define TRNG_EVCTRL_Msk _U_(0x01) /**< (TRNG_EVCTRL) Register Mask */
  81. /* -------- TRNG_INTENCLR : (TRNG Offset: 0x08) (R/W 8) Interrupt Enable Clear -------- */
  82. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  83. typedef union {
  84. struct {
  85. uint8_t DATARDY:1; /**< bit: 0 Data Ready Interrupt Enable */
  86. uint8_t :7; /**< bit: 1..7 Reserved */
  87. } bit; /**< Structure used for bit access */
  88. uint8_t reg; /**< Type used for register access */
  89. } TRNG_INTENCLR_Type;
  90. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  91. #define TRNG_INTENCLR_OFFSET (0x08) /**< (TRNG_INTENCLR) Interrupt Enable Clear Offset */
  92. #define TRNG_INTENCLR_RESETVALUE _U_(0x00) /**< (TRNG_INTENCLR) Interrupt Enable Clear Reset Value */
  93. #define TRNG_INTENCLR_DATARDY_Pos 0 /**< (TRNG_INTENCLR) Data Ready Interrupt Enable Position */
  94. #define TRNG_INTENCLR_DATARDY_Msk (_U_(0x1) << TRNG_INTENCLR_DATARDY_Pos) /**< (TRNG_INTENCLR) Data Ready Interrupt Enable Mask */
  95. #define TRNG_INTENCLR_DATARDY TRNG_INTENCLR_DATARDY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_INTENCLR_DATARDY_Msk instead */
  96. #define TRNG_INTENCLR_MASK _U_(0x01) /**< \deprecated (TRNG_INTENCLR) Register MASK (Use TRNG_INTENCLR_Msk instead) */
  97. #define TRNG_INTENCLR_Msk _U_(0x01) /**< (TRNG_INTENCLR) Register Mask */
  98. /* -------- TRNG_INTENSET : (TRNG Offset: 0x09) (R/W 8) Interrupt Enable Set -------- */
  99. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  100. typedef union {
  101. struct {
  102. uint8_t DATARDY:1; /**< bit: 0 Data Ready Interrupt Enable */
  103. uint8_t :7; /**< bit: 1..7 Reserved */
  104. } bit; /**< Structure used for bit access */
  105. uint8_t reg; /**< Type used for register access */
  106. } TRNG_INTENSET_Type;
  107. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  108. #define TRNG_INTENSET_OFFSET (0x09) /**< (TRNG_INTENSET) Interrupt Enable Set Offset */
  109. #define TRNG_INTENSET_RESETVALUE _U_(0x00) /**< (TRNG_INTENSET) Interrupt Enable Set Reset Value */
  110. #define TRNG_INTENSET_DATARDY_Pos 0 /**< (TRNG_INTENSET) Data Ready Interrupt Enable Position */
  111. #define TRNG_INTENSET_DATARDY_Msk (_U_(0x1) << TRNG_INTENSET_DATARDY_Pos) /**< (TRNG_INTENSET) Data Ready Interrupt Enable Mask */
  112. #define TRNG_INTENSET_DATARDY TRNG_INTENSET_DATARDY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_INTENSET_DATARDY_Msk instead */
  113. #define TRNG_INTENSET_MASK _U_(0x01) /**< \deprecated (TRNG_INTENSET) Register MASK (Use TRNG_INTENSET_Msk instead) */
  114. #define TRNG_INTENSET_Msk _U_(0x01) /**< (TRNG_INTENSET) Register Mask */
  115. /* -------- TRNG_INTFLAG : (TRNG Offset: 0x0a) (R/W 8) Interrupt Flag Status and Clear -------- */
  116. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  117. typedef union { // __I to avoid read-modify-write on write-to-clear register
  118. struct {
  119. __I uint8_t DATARDY:1; /**< bit: 0 Data Ready Interrupt Flag */
  120. __I uint8_t :7; /**< bit: 1..7 Reserved */
  121. } bit; /**< Structure used for bit access */
  122. uint8_t reg; /**< Type used for register access */
  123. } TRNG_INTFLAG_Type;
  124. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  125. #define TRNG_INTFLAG_OFFSET (0x0A) /**< (TRNG_INTFLAG) Interrupt Flag Status and Clear Offset */
  126. #define TRNG_INTFLAG_RESETVALUE _U_(0x00) /**< (TRNG_INTFLAG) Interrupt Flag Status and Clear Reset Value */
  127. #define TRNG_INTFLAG_DATARDY_Pos 0 /**< (TRNG_INTFLAG) Data Ready Interrupt Flag Position */
  128. #define TRNG_INTFLAG_DATARDY_Msk (_U_(0x1) << TRNG_INTFLAG_DATARDY_Pos) /**< (TRNG_INTFLAG) Data Ready Interrupt Flag Mask */
  129. #define TRNG_INTFLAG_DATARDY TRNG_INTFLAG_DATARDY_Msk /**< \deprecated Old style mask definition for 1 bit bitfield. Use TRNG_INTFLAG_DATARDY_Msk instead */
  130. #define TRNG_INTFLAG_MASK _U_(0x01) /**< \deprecated (TRNG_INTFLAG) Register MASK (Use TRNG_INTFLAG_Msk instead) */
  131. #define TRNG_INTFLAG_Msk _U_(0x01) /**< (TRNG_INTFLAG) Register Mask */
  132. /* -------- TRNG_DATA : (TRNG Offset: 0x20) (R/ 32) Output Data -------- */
  133. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  134. typedef union {
  135. struct {
  136. uint32_t DATA:32; /**< bit: 0..31 Output Data */
  137. } bit; /**< Structure used for bit access */
  138. uint32_t reg; /**< Type used for register access */
  139. } TRNG_DATA_Type;
  140. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  141. #define TRNG_DATA_OFFSET (0x20) /**< (TRNG_DATA) Output Data Offset */
  142. #define TRNG_DATA_RESETVALUE _U_(0x00) /**< (TRNG_DATA) Output Data Reset Value */
  143. #define TRNG_DATA_DATA_Pos 0 /**< (TRNG_DATA) Output Data Position */
  144. #define TRNG_DATA_DATA_Msk (_U_(0xFFFFFFFF) << TRNG_DATA_DATA_Pos) /**< (TRNG_DATA) Output Data Mask */
  145. #define TRNG_DATA_DATA(value) (TRNG_DATA_DATA_Msk & ((value) << TRNG_DATA_DATA_Pos))
  146. #define TRNG_DATA_MASK _U_(0xFFFFFFFF) /**< \deprecated (TRNG_DATA) Register MASK (Use TRNG_DATA_Msk instead) */
  147. #define TRNG_DATA_Msk _U_(0xFFFFFFFF) /**< (TRNG_DATA) Register Mask */
  148. #if !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__))
  149. /** \brief TRNG hardware registers */
  150. typedef struct { /* True Random Generator */
  151. __IO TRNG_CTRLA_Type CTRLA; /**< Offset: 0x00 (R/W 8) Control A */
  152. __I uint8_t Reserved1[3];
  153. __IO TRNG_EVCTRL_Type EVCTRL; /**< Offset: 0x04 (R/W 8) Event Control */
  154. __I uint8_t Reserved2[3];
  155. __IO TRNG_INTENCLR_Type INTENCLR; /**< Offset: 0x08 (R/W 8) Interrupt Enable Clear */
  156. __IO TRNG_INTENSET_Type INTENSET; /**< Offset: 0x09 (R/W 8) Interrupt Enable Set */
  157. __IO TRNG_INTFLAG_Type INTFLAG; /**< Offset: 0x0A (R/W 8) Interrupt Flag Status and Clear */
  158. __I uint8_t Reserved3[21];
  159. __I TRNG_DATA_Type DATA; /**< Offset: 0x20 (R/ 32) Output Data */
  160. } Trng;
  161. #endif /* !(defined(__ASSEMBLER__) || defined(__IAR_SYSTEMS_ASM__)) */
  162. /** @} end of True Random Generator */
  163. #endif /* _SAML11_TRNG_COMPONENT_H_ */