nrf51.h 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285
  1. /****************************************************************************************************//**
  2. * @file nrf51.h
  3. *
  4. * @brief CMSIS Cortex-M0 Peripheral Access Layer Header File for
  5. * nrf51 from Nordic Semiconductor.
  6. *
  7. * @version V522
  8. * @date 23. February 2016
  9. *
  10. * @note Generated with SVDConv V2.81d
  11. * from CMSIS SVD File 'nrf51.svd' Version 522,
  12. *
  13. * @par Copyright (c) 2013, Nordic Semiconductor ASA
  14. * All rights reserved.
  15. *
  16. * Redistribution and use in source and binary forms, with or without
  17. * modification, are permitted provided that the following conditions are met:
  18. *
  19. * * Redistributions of source code must retain the above copyright notice, this
  20. * list of conditions and the following disclaimer.
  21. *
  22. * * Redistributions in binary form must reproduce the above copyright notice,
  23. * this list of conditions and the following disclaimer in the documentation
  24. * and/or other materials provided with the distribution.
  25. *
  26. * * Neither the name of Nordic Semiconductor ASA nor the names of its
  27. * contributors may be used to endorse or promote products derived from
  28. * this software without specific prior written permission.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  33. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  34. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  36. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  37. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  38. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  39. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. *
  41. *
  42. *******************************************************************************************************/
  43. /** @addtogroup Nordic Semiconductor
  44. * @{
  45. */
  46. /** @addtogroup nrf51
  47. * @{
  48. */
  49. #ifndef NRF51_H
  50. #define NRF51_H
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. /* ------------------------- Interrupt Number Definition ------------------------ */
  55. typedef enum {
  56. /* ------------------- Cortex-M0 Processor Exceptions Numbers ------------------- */
  57. Reset_IRQn = -15, /*!< 1 Reset Vector, invoked on Power up and warm reset */
  58. NonMaskableInt_IRQn = -14, /*!< 2 Non maskable Interrupt, cannot be stopped or preempted */
  59. HardFault_IRQn = -13, /*!< 3 Hard Fault, all classes of Fault */
  60. SVCall_IRQn = -5, /*!< 11 System Service Call via SVC instruction */
  61. DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor */
  62. PendSV_IRQn = -2, /*!< 14 Pendable request for system service */
  63. SysTick_IRQn = -1, /*!< 15 System Tick Timer */
  64. /* ---------------------- nrf51 Specific Interrupt Numbers ---------------------- */
  65. POWER_CLOCK_IRQn = 0, /*!< 0 POWER_CLOCK */
  66. RADIO_IRQn = 1, /*!< 1 RADIO */
  67. UART0_IRQn = 2, /*!< 2 UART0 */
  68. SPI0_TWI0_IRQn = 3, /*!< 3 SPI0_TWI0 */
  69. SPI1_TWI1_IRQn = 4, /*!< 4 SPI1_TWI1 */
  70. GPIOTE_IRQn = 6, /*!< 6 GPIOTE */
  71. ADC_IRQn = 7, /*!< 7 ADC */
  72. TIMER0_IRQn = 8, /*!< 8 TIMER0 */
  73. TIMER1_IRQn = 9, /*!< 9 TIMER1 */
  74. TIMER2_IRQn = 10, /*!< 10 TIMER2 */
  75. RTC0_IRQn = 11, /*!< 11 RTC0 */
  76. TEMP_IRQn = 12, /*!< 12 TEMP */
  77. RNG_IRQn = 13, /*!< 13 RNG */
  78. ECB_IRQn = 14, /*!< 14 ECB */
  79. CCM_AAR_IRQn = 15, /*!< 15 CCM_AAR */
  80. WDT_IRQn = 16, /*!< 16 WDT */
  81. RTC1_IRQn = 17, /*!< 17 RTC1 */
  82. QDEC_IRQn = 18, /*!< 18 QDEC */
  83. LPCOMP_IRQn = 19, /*!< 19 LPCOMP */
  84. SWI0_IRQn = 20, /*!< 20 SWI0 */
  85. SWI1_IRQn = 21, /*!< 21 SWI1 */
  86. SWI2_IRQn = 22, /*!< 22 SWI2 */
  87. SWI3_IRQn = 23, /*!< 23 SWI3 */
  88. SWI4_IRQn = 24, /*!< 24 SWI4 */
  89. SWI5_IRQn = 25 /*!< 25 SWI5 */
  90. } IRQn_Type;
  91. /** @addtogroup Configuration_of_CMSIS
  92. * @{
  93. */
  94. /* ================================================================================ */
  95. /* ================ Processor and Core Peripheral Section ================ */
  96. /* ================================================================================ */
  97. /* ----------------Configuration of the Cortex-M0 Processor and Core Peripherals---------------- */
  98. #define __CM0_REV 0x0301 /*!< Cortex-M0 Core Revision */
  99. #define __MPU_PRESENT 0 /*!< MPU present or not */
  100. #define __NVIC_PRIO_BITS 2 /*!< Number of Bits used for Priority Levels */
  101. #define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */
  102. /** @} */ /* End of group Configuration_of_CMSIS */
  103. #include "core_cm0.h" /*!< Cortex-M0 processor and core peripherals */
  104. #include "system_nrf51.h" /*!< nrf51 System */
  105. /* ================================================================================ */
  106. /* ================ Device Specific Peripheral Section ================ */
  107. /* ================================================================================ */
  108. /** @addtogroup Device_Peripheral_Registers
  109. * @{
  110. */
  111. /* ------------------- Start of section using anonymous unions ------------------ */
  112. #if defined(__CC_ARM)
  113. #pragma push
  114. #pragma anon_unions
  115. #elif defined(__ICCARM__)
  116. #pragma language=extended
  117. #elif defined(__GNUC__)
  118. /* anonymous unions are enabled by default */
  119. #elif defined(__TMS470__)
  120. /* anonymous unions are enabled by default */
  121. #elif defined(__TASKING__)
  122. #pragma warning 586
  123. #else
  124. #warning Not supported compiler type
  125. #endif
  126. typedef struct {
  127. __IO uint32_t CPU0; /*!< Configurable priority configuration register for CPU0. */
  128. __IO uint32_t SPIS1; /*!< Configurable priority configuration register for SPIS1. */
  129. __IO uint32_t RADIO; /*!< Configurable priority configuration register for RADIO. */
  130. __IO uint32_t ECB; /*!< Configurable priority configuration register for ECB. */
  131. __IO uint32_t CCM; /*!< Configurable priority configuration register for CCM. */
  132. __IO uint32_t AAR; /*!< Configurable priority configuration register for AAR. */
  133. } AMLI_RAMPRI_Type;
  134. typedef struct {
  135. __IO uint32_t SCK; /*!< Pin select for SCK. */
  136. __IO uint32_t MOSI; /*!< Pin select for MOSI. */
  137. __IO uint32_t MISO; /*!< Pin select for MISO. */
  138. } SPIM_PSEL_Type;
  139. typedef struct {
  140. __IO uint32_t PTR; /*!< Data pointer. */
  141. __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to receive. */
  142. __I uint32_t AMOUNT; /*!< Number of bytes received in the last transaction. */
  143. } SPIM_RXD_Type;
  144. typedef struct {
  145. __IO uint32_t PTR; /*!< Data pointer. */
  146. __IO uint32_t MAXCNT; /*!< Maximum number of buffer bytes to send. */
  147. __I uint32_t AMOUNT; /*!< Number of bytes sent in the last transaction. */
  148. } SPIM_TXD_Type;
  149. typedef struct {
  150. __O uint32_t EN; /*!< Enable channel group. */
  151. __O uint32_t DIS; /*!< Disable channel group. */
  152. } PPI_TASKS_CHG_Type;
  153. typedef struct {
  154. __IO uint32_t EEP; /*!< Channel event end-point. */
  155. __IO uint32_t TEP; /*!< Channel task end-point. */
  156. } PPI_CH_Type;
  157. /* ================================================================================ */
  158. /* ================ POWER ================ */
  159. /* ================================================================================ */
  160. /**
  161. * @brief Power Control. (POWER)
  162. */
  163. typedef struct { /*!< POWER Structure */
  164. __I uint32_t RESERVED0[30];
  165. __O uint32_t TASKS_CONSTLAT; /*!< Enable constant latency mode. */
  166. __O uint32_t TASKS_LOWPWR; /*!< Enable low power mode (variable latency). */
  167. __I uint32_t RESERVED1[34];
  168. __IO uint32_t EVENTS_POFWARN; /*!< Power failure warning. */
  169. __I uint32_t RESERVED2[126];
  170. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  171. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  172. __I uint32_t RESERVED3[61];
  173. __IO uint32_t RESETREAS; /*!< Reset reason. */
  174. __I uint32_t RESERVED4[9];
  175. __I uint32_t RAMSTATUS; /*!< Ram status register. */
  176. __I uint32_t RESERVED5[53];
  177. __O uint32_t SYSTEMOFF; /*!< System off register. */
  178. __I uint32_t RESERVED6[3];
  179. __IO uint32_t POFCON; /*!< Power failure configuration. */
  180. __I uint32_t RESERVED7[2];
  181. __IO uint32_t GPREGRET; /*!< General purpose retention register. This register is a retained
  182. register. */
  183. __I uint32_t RESERVED8;
  184. __IO uint32_t RAMON; /*!< Ram on/off. */
  185. __I uint32_t RESERVED9[7];
  186. __IO uint32_t RESET; /*!< Pin reset functionality configuration register. This register
  187. is a retained register. */
  188. __I uint32_t RESERVED10[3];
  189. __IO uint32_t RAMONB; /*!< Ram on/off. */
  190. __I uint32_t RESERVED11[8];
  191. __IO uint32_t DCDCEN; /*!< DCDC converter enable configuration register. */
  192. __I uint32_t RESERVED12[291];
  193. __IO uint32_t DCDCFORCE; /*!< DCDC power-up force register. */
  194. } NRF_POWER_Type;
  195. /* ================================================================================ */
  196. /* ================ CLOCK ================ */
  197. /* ================================================================================ */
  198. /**
  199. * @brief Clock control. (CLOCK)
  200. */
  201. typedef struct { /*!< CLOCK Structure */
  202. __O uint32_t TASKS_HFCLKSTART; /*!< Start HFCLK clock source. */
  203. __O uint32_t TASKS_HFCLKSTOP; /*!< Stop HFCLK clock source. */
  204. __O uint32_t TASKS_LFCLKSTART; /*!< Start LFCLK clock source. */
  205. __O uint32_t TASKS_LFCLKSTOP; /*!< Stop LFCLK clock source. */
  206. __O uint32_t TASKS_CAL; /*!< Start calibration of LFCLK RC oscillator. */
  207. __O uint32_t TASKS_CTSTART; /*!< Start calibration timer. */
  208. __O uint32_t TASKS_CTSTOP; /*!< Stop calibration timer. */
  209. __I uint32_t RESERVED0[57];
  210. __IO uint32_t EVENTS_HFCLKSTARTED; /*!< HFCLK oscillator started. */
  211. __IO uint32_t EVENTS_LFCLKSTARTED; /*!< LFCLK oscillator started. */
  212. __I uint32_t RESERVED1;
  213. __IO uint32_t EVENTS_DONE; /*!< Calibration of LFCLK RC oscillator completed. */
  214. __IO uint32_t EVENTS_CTTO; /*!< Calibration timer timeout. */
  215. __I uint32_t RESERVED2[124];
  216. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  217. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  218. __I uint32_t RESERVED3[63];
  219. __I uint32_t HFCLKRUN; /*!< Task HFCLKSTART trigger status. */
  220. __I uint32_t HFCLKSTAT; /*!< High frequency clock status. */
  221. __I uint32_t RESERVED4;
  222. __I uint32_t LFCLKRUN; /*!< Task LFCLKSTART triggered status. */
  223. __I uint32_t LFCLKSTAT; /*!< Low frequency clock status. */
  224. __I uint32_t LFCLKSRCCOPY; /*!< Clock source for the LFCLK clock, set when task LKCLKSTART is
  225. triggered. */
  226. __I uint32_t RESERVED5[62];
  227. __IO uint32_t LFCLKSRC; /*!< Clock source for the LFCLK clock. */
  228. __I uint32_t RESERVED6[7];
  229. __IO uint32_t CTIV; /*!< Calibration timer interval. */
  230. __I uint32_t RESERVED7[5];
  231. __IO uint32_t XTALFREQ; /*!< Crystal frequency. */
  232. } NRF_CLOCK_Type;
  233. /* ================================================================================ */
  234. /* ================ MPU ================ */
  235. /* ================================================================================ */
  236. /**
  237. * @brief Memory Protection Unit. (MPU)
  238. */
  239. typedef struct { /*!< MPU Structure */
  240. __I uint32_t RESERVED0[330];
  241. __IO uint32_t PERR0; /*!< Configuration of peripherals in mpu regions. */
  242. __IO uint32_t RLENR0; /*!< Length of RAM region 0. */
  243. __I uint32_t RESERVED1[52];
  244. __IO uint32_t PROTENSET0; /*!< Erase and write protection bit enable set register. */
  245. __IO uint32_t PROTENSET1; /*!< Erase and write protection bit enable set register. */
  246. __IO uint32_t DISABLEINDEBUG; /*!< Disable erase and write protection mechanism in debug mode. */
  247. __IO uint32_t PROTBLOCKSIZE; /*!< Erase and write protection block size. */
  248. } NRF_MPU_Type;
  249. /* ================================================================================ */
  250. /* ================ AMLI ================ */
  251. /* ================================================================================ */
  252. /**
  253. * @brief AHB Multi-Layer Interface. (AMLI)
  254. */
  255. typedef struct { /*!< AMLI Structure */
  256. __I uint32_t RESERVED0[896];
  257. AMLI_RAMPRI_Type RAMPRI; /*!< RAM configurable priority configuration structure. */
  258. } NRF_AMLI_Type;
  259. /* ================================================================================ */
  260. /* ================ RADIO ================ */
  261. /* ================================================================================ */
  262. /**
  263. * @brief The radio. (RADIO)
  264. */
  265. typedef struct { /*!< RADIO Structure */
  266. __O uint32_t TASKS_TXEN; /*!< Enable radio in TX mode. */
  267. __O uint32_t TASKS_RXEN; /*!< Enable radio in RX mode. */
  268. __O uint32_t TASKS_START; /*!< Start radio. */
  269. __O uint32_t TASKS_STOP; /*!< Stop radio. */
  270. __O uint32_t TASKS_DISABLE; /*!< Disable radio. */
  271. __O uint32_t TASKS_RSSISTART; /*!< Start the RSSI and take one sample of the receive signal strength. */
  272. __O uint32_t TASKS_RSSISTOP; /*!< Stop the RSSI measurement. */
  273. __O uint32_t TASKS_BCSTART; /*!< Start the bit counter. */
  274. __O uint32_t TASKS_BCSTOP; /*!< Stop the bit counter. */
  275. __I uint32_t RESERVED0[55];
  276. __IO uint32_t EVENTS_READY; /*!< Ready event. */
  277. __IO uint32_t EVENTS_ADDRESS; /*!< Address event. */
  278. __IO uint32_t EVENTS_PAYLOAD; /*!< Payload event. */
  279. __IO uint32_t EVENTS_END; /*!< End event. */
  280. __IO uint32_t EVENTS_DISABLED; /*!< Disable event. */
  281. __IO uint32_t EVENTS_DEVMATCH; /*!< A device address match occurred on the last received packet. */
  282. __IO uint32_t EVENTS_DEVMISS; /*!< No device address match occurred on the last received packet. */
  283. __IO uint32_t EVENTS_RSSIEND; /*!< Sampling of the receive signal strength complete. A new RSSI
  284. sample is ready for readout at the RSSISAMPLE register. */
  285. __I uint32_t RESERVED1[2];
  286. __IO uint32_t EVENTS_BCMATCH; /*!< Bit counter reached bit count value specified in BCC register. */
  287. __I uint32_t RESERVED2[53];
  288. __IO uint32_t SHORTS; /*!< Shortcuts for the radio. */
  289. __I uint32_t RESERVED3[64];
  290. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  291. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  292. __I uint32_t RESERVED4[61];
  293. __I uint32_t CRCSTATUS; /*!< CRC status of received packet. */
  294. __I uint32_t RESERVED5;
  295. __I uint32_t RXMATCH; /*!< Received address. */
  296. __I uint32_t RXCRC; /*!< Received CRC. */
  297. __I uint32_t DAI; /*!< Device address match index. */
  298. __I uint32_t RESERVED6[60];
  299. __IO uint32_t PACKETPTR; /*!< Packet pointer. Decision point: START task. */
  300. __IO uint32_t FREQUENCY; /*!< Frequency. */
  301. __IO uint32_t TXPOWER; /*!< Output power. */
  302. __IO uint32_t MODE; /*!< Data rate and modulation. */
  303. __IO uint32_t PCNF0; /*!< Packet configuration 0. */
  304. __IO uint32_t PCNF1; /*!< Packet configuration 1. */
  305. __IO uint32_t BASE0; /*!< Radio base address 0. Decision point: START task. */
  306. __IO uint32_t BASE1; /*!< Radio base address 1. Decision point: START task. */
  307. __IO uint32_t PREFIX0; /*!< Prefixes bytes for logical addresses 0 to 3. */
  308. __IO uint32_t PREFIX1; /*!< Prefixes bytes for logical addresses 4 to 7. */
  309. __IO uint32_t TXADDRESS; /*!< Transmit address select. */
  310. __IO uint32_t RXADDRESSES; /*!< Receive address select. */
  311. __IO uint32_t CRCCNF; /*!< CRC configuration. */
  312. __IO uint32_t CRCPOLY; /*!< CRC polynomial. */
  313. __IO uint32_t CRCINIT; /*!< CRC initial value. */
  314. __IO uint32_t TEST; /*!< Test features enable register. */
  315. __IO uint32_t TIFS; /*!< Inter Frame Spacing in microseconds. */
  316. __I uint32_t RSSISAMPLE; /*!< RSSI sample. */
  317. __I uint32_t RESERVED7;
  318. __I uint32_t STATE; /*!< Current radio state. */
  319. __IO uint32_t DATAWHITEIV; /*!< Data whitening initial value. */
  320. __I uint32_t RESERVED8[2];
  321. __IO uint32_t BCC; /*!< Bit counter compare. */
  322. __I uint32_t RESERVED9[39];
  323. __IO uint32_t DAB[8]; /*!< Device address base segment. */
  324. __IO uint32_t DAP[8]; /*!< Device address prefix. */
  325. __IO uint32_t DACNF; /*!< Device address match configuration. */
  326. __I uint32_t RESERVED10[56];
  327. __IO uint32_t OVERRIDE0; /*!< Trim value override register 0. */
  328. __IO uint32_t OVERRIDE1; /*!< Trim value override register 1. */
  329. __IO uint32_t OVERRIDE2; /*!< Trim value override register 2. */
  330. __IO uint32_t OVERRIDE3; /*!< Trim value override register 3. */
  331. __IO uint32_t OVERRIDE4; /*!< Trim value override register 4. */
  332. __I uint32_t RESERVED11[561];
  333. __IO uint32_t POWER; /*!< Peripheral power control. */
  334. } NRF_RADIO_Type;
  335. /* ================================================================================ */
  336. /* ================ UART ================ */
  337. /* ================================================================================ */
  338. /**
  339. * @brief Universal Asynchronous Receiver/Transmitter. (UART)
  340. */
  341. typedef struct { /*!< UART Structure */
  342. __O uint32_t TASKS_STARTRX; /*!< Start UART receiver. */
  343. __O uint32_t TASKS_STOPRX; /*!< Stop UART receiver. */
  344. __O uint32_t TASKS_STARTTX; /*!< Start UART transmitter. */
  345. __O uint32_t TASKS_STOPTX; /*!< Stop UART transmitter. */
  346. __I uint32_t RESERVED0[3];
  347. __O uint32_t TASKS_SUSPEND; /*!< Suspend UART. */
  348. __I uint32_t RESERVED1[56];
  349. __IO uint32_t EVENTS_CTS; /*!< CTS activated. */
  350. __IO uint32_t EVENTS_NCTS; /*!< CTS deactivated. */
  351. __IO uint32_t EVENTS_RXDRDY; /*!< Data received in RXD. */
  352. __I uint32_t RESERVED2[4];
  353. __IO uint32_t EVENTS_TXDRDY; /*!< Data sent from TXD. */
  354. __I uint32_t RESERVED3;
  355. __IO uint32_t EVENTS_ERROR; /*!< Error detected. */
  356. __I uint32_t RESERVED4[7];
  357. __IO uint32_t EVENTS_RXTO; /*!< Receiver timeout. */
  358. __I uint32_t RESERVED5[46];
  359. __IO uint32_t SHORTS; /*!< Shortcuts for UART. */
  360. __I uint32_t RESERVED6[64];
  361. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  362. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  363. __I uint32_t RESERVED7[93];
  364. __IO uint32_t ERRORSRC; /*!< Error source. Write error field to 1 to clear error. */
  365. __I uint32_t RESERVED8[31];
  366. __IO uint32_t ENABLE; /*!< Enable UART and acquire IOs. */
  367. __I uint32_t RESERVED9;
  368. __IO uint32_t PSELRTS; /*!< Pin select for RTS. */
  369. __IO uint32_t PSELTXD; /*!< Pin select for TXD. */
  370. __IO uint32_t PSELCTS; /*!< Pin select for CTS. */
  371. __IO uint32_t PSELRXD; /*!< Pin select for RXD. */
  372. __I uint32_t RXD; /*!< RXD register. On read action the buffer pointer is displaced.
  373. Once read the character is consumed. If read when no character
  374. available, the UART will stop working. */
  375. __O uint32_t TXD; /*!< TXD register. */
  376. __I uint32_t RESERVED10;
  377. __IO uint32_t BAUDRATE; /*!< UART Baudrate. */
  378. __I uint32_t RESERVED11[17];
  379. __IO uint32_t CONFIG; /*!< Configuration of parity and hardware flow control register. */
  380. __I uint32_t RESERVED12[675];
  381. __IO uint32_t POWER; /*!< Peripheral power control. */
  382. } NRF_UART_Type;
  383. /* ================================================================================ */
  384. /* ================ SPI ================ */
  385. /* ================================================================================ */
  386. /**
  387. * @brief SPI master 0. (SPI)
  388. */
  389. typedef struct { /*!< SPI Structure */
  390. __I uint32_t RESERVED0[66];
  391. __IO uint32_t EVENTS_READY; /*!< TXD byte sent and RXD byte received. */
  392. __I uint32_t RESERVED1[126];
  393. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  394. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  395. __I uint32_t RESERVED2[125];
  396. __IO uint32_t ENABLE; /*!< Enable SPI. */
  397. __I uint32_t RESERVED3;
  398. __IO uint32_t PSELSCK; /*!< Pin select for SCK. */
  399. __IO uint32_t PSELMOSI; /*!< Pin select for MOSI. */
  400. __IO uint32_t PSELMISO; /*!< Pin select for MISO. */
  401. __I uint32_t RESERVED4;
  402. __I uint32_t RXD; /*!< RX data. */
  403. __IO uint32_t TXD; /*!< TX data. */
  404. __I uint32_t RESERVED5;
  405. __IO uint32_t FREQUENCY; /*!< SPI frequency */
  406. __I uint32_t RESERVED6[11];
  407. __IO uint32_t CONFIG; /*!< Configuration register. */
  408. __I uint32_t RESERVED7[681];
  409. __IO uint32_t POWER; /*!< Peripheral power control. */
  410. } NRF_SPI_Type;
  411. /* ================================================================================ */
  412. /* ================ TWI ================ */
  413. /* ================================================================================ */
  414. /**
  415. * @brief Two-wire interface master 0. (TWI)
  416. */
  417. typedef struct { /*!< TWI Structure */
  418. __O uint32_t TASKS_STARTRX; /*!< Start 2-Wire master receive sequence. */
  419. __I uint32_t RESERVED0;
  420. __O uint32_t TASKS_STARTTX; /*!< Start 2-Wire master transmit sequence. */
  421. __I uint32_t RESERVED1[2];
  422. __O uint32_t TASKS_STOP; /*!< Stop 2-Wire transaction. */
  423. __I uint32_t RESERVED2;
  424. __O uint32_t TASKS_SUSPEND; /*!< Suspend 2-Wire transaction. */
  425. __O uint32_t TASKS_RESUME; /*!< Resume 2-Wire transaction. */
  426. __I uint32_t RESERVED3[56];
  427. __IO uint32_t EVENTS_STOPPED; /*!< Two-wire stopped. */
  428. __IO uint32_t EVENTS_RXDREADY; /*!< Two-wire ready to deliver new RXD byte received. */
  429. __I uint32_t RESERVED4[4];
  430. __IO uint32_t EVENTS_TXDSENT; /*!< Two-wire finished sending last TXD byte. */
  431. __I uint32_t RESERVED5;
  432. __IO uint32_t EVENTS_ERROR; /*!< Two-wire error detected. */
  433. __I uint32_t RESERVED6[4];
  434. __IO uint32_t EVENTS_BB; /*!< Two-wire byte boundary. */
  435. __I uint32_t RESERVED7[3];
  436. __IO uint32_t EVENTS_SUSPENDED; /*!< Two-wire suspended. */
  437. __I uint32_t RESERVED8[45];
  438. __IO uint32_t SHORTS; /*!< Shortcuts for TWI. */
  439. __I uint32_t RESERVED9[64];
  440. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  441. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  442. __I uint32_t RESERVED10[110];
  443. __IO uint32_t ERRORSRC; /*!< Two-wire error source. Write error field to 1 to clear error. */
  444. __I uint32_t RESERVED11[14];
  445. __IO uint32_t ENABLE; /*!< Enable two-wire master. */
  446. __I uint32_t RESERVED12;
  447. __IO uint32_t PSELSCL; /*!< Pin select for SCL. */
  448. __IO uint32_t PSELSDA; /*!< Pin select for SDA. */
  449. __I uint32_t RESERVED13[2];
  450. __I uint32_t RXD; /*!< RX data register. */
  451. __IO uint32_t TXD; /*!< TX data register. */
  452. __I uint32_t RESERVED14;
  453. __IO uint32_t FREQUENCY; /*!< Two-wire frequency. */
  454. __I uint32_t RESERVED15[24];
  455. __IO uint32_t ADDRESS; /*!< Address used in the two-wire transfer. */
  456. __I uint32_t RESERVED16[668];
  457. __IO uint32_t POWER; /*!< Peripheral power control. */
  458. } NRF_TWI_Type;
  459. /* ================================================================================ */
  460. /* ================ SPIS ================ */
  461. /* ================================================================================ */
  462. /**
  463. * @brief SPI slave 1. (SPIS)
  464. */
  465. typedef struct { /*!< SPIS Structure */
  466. __I uint32_t RESERVED0[9];
  467. __O uint32_t TASKS_ACQUIRE; /*!< Acquire SPI semaphore. */
  468. __O uint32_t TASKS_RELEASE; /*!< Release SPI semaphore. */
  469. __I uint32_t RESERVED1[54];
  470. __IO uint32_t EVENTS_END; /*!< Granted transaction completed. */
  471. __I uint32_t RESERVED2[2];
  472. __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached */
  473. __I uint32_t RESERVED3[5];
  474. __IO uint32_t EVENTS_ACQUIRED; /*!< Semaphore acquired. */
  475. __I uint32_t RESERVED4[53];
  476. __IO uint32_t SHORTS; /*!< Shortcuts for SPIS. */
  477. __I uint32_t RESERVED5[64];
  478. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  479. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  480. __I uint32_t RESERVED6[61];
  481. __I uint32_t SEMSTAT; /*!< Semaphore status. */
  482. __I uint32_t RESERVED7[15];
  483. __IO uint32_t STATUS; /*!< Status from last transaction. */
  484. __I uint32_t RESERVED8[47];
  485. __IO uint32_t ENABLE; /*!< Enable SPIS. */
  486. __I uint32_t RESERVED9;
  487. __IO uint32_t PSELSCK; /*!< Pin select for SCK. */
  488. __IO uint32_t PSELMISO; /*!< Pin select for MISO. */
  489. __IO uint32_t PSELMOSI; /*!< Pin select for MOSI. */
  490. __IO uint32_t PSELCSN; /*!< Pin select for CSN. */
  491. __I uint32_t RESERVED10[7];
  492. __IO uint32_t RXDPTR; /*!< RX data pointer. */
  493. __IO uint32_t MAXRX; /*!< Maximum number of bytes in the receive buffer. */
  494. __I uint32_t AMOUNTRX; /*!< Number of bytes received in last granted transaction. */
  495. __I uint32_t RESERVED11;
  496. __IO uint32_t TXDPTR; /*!< TX data pointer. */
  497. __IO uint32_t MAXTX; /*!< Maximum number of bytes in the transmit buffer. */
  498. __I uint32_t AMOUNTTX; /*!< Number of bytes transmitted in last granted transaction. */
  499. __I uint32_t RESERVED12;
  500. __IO uint32_t CONFIG; /*!< Configuration register. */
  501. __I uint32_t RESERVED13;
  502. __IO uint32_t DEF; /*!< Default character. */
  503. __I uint32_t RESERVED14[24];
  504. __IO uint32_t ORC; /*!< Over-read character. */
  505. __I uint32_t RESERVED15[654];
  506. __IO uint32_t POWER; /*!< Peripheral power control. */
  507. } NRF_SPIS_Type;
  508. /* ================================================================================ */
  509. /* ================ SPIM ================ */
  510. /* ================================================================================ */
  511. /**
  512. * @brief SPI master with easyDMA 1. (SPIM)
  513. */
  514. typedef struct { /*!< SPIM Structure */
  515. __I uint32_t RESERVED0[4];
  516. __O uint32_t TASKS_START; /*!< Start SPI transaction. */
  517. __O uint32_t TASKS_STOP; /*!< Stop SPI transaction. */
  518. __I uint32_t RESERVED1;
  519. __O uint32_t TASKS_SUSPEND; /*!< Suspend SPI transaction. */
  520. __O uint32_t TASKS_RESUME; /*!< Resume SPI transaction. */
  521. __I uint32_t RESERVED2[56];
  522. __IO uint32_t EVENTS_STOPPED; /*!< SPI transaction has stopped. */
  523. __I uint32_t RESERVED3[2];
  524. __IO uint32_t EVENTS_ENDRX; /*!< End of RXD buffer reached. */
  525. __I uint32_t RESERVED4[3];
  526. __IO uint32_t EVENTS_ENDTX; /*!< End of TXD buffer reached. */
  527. __I uint32_t RESERVED5[10];
  528. __IO uint32_t EVENTS_STARTED; /*!< Transaction started. */
  529. __I uint32_t RESERVED6[109];
  530. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  531. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  532. __I uint32_t RESERVED7[125];
  533. __IO uint32_t ENABLE; /*!< Enable SPIM. */
  534. __I uint32_t RESERVED8;
  535. SPIM_PSEL_Type PSEL; /*!< Pin select configuration. */
  536. __I uint32_t RESERVED9[4];
  537. __IO uint32_t FREQUENCY; /*!< SPI frequency. */
  538. __I uint32_t RESERVED10[3];
  539. SPIM_RXD_Type RXD; /*!< RXD EasyDMA configuration and status. */
  540. __I uint32_t RESERVED11;
  541. SPIM_TXD_Type TXD; /*!< TXD EasyDMA configuration and status. */
  542. __I uint32_t RESERVED12;
  543. __IO uint32_t CONFIG; /*!< Configuration register. */
  544. __I uint32_t RESERVED13[26];
  545. __IO uint32_t ORC; /*!< Over-read character. */
  546. __I uint32_t RESERVED14[654];
  547. __IO uint32_t POWER; /*!< Peripheral power control. */
  548. } NRF_SPIM_Type;
  549. /* ================================================================================ */
  550. /* ================ GPIOTE ================ */
  551. /* ================================================================================ */
  552. /**
  553. * @brief GPIO tasks and events. (GPIOTE)
  554. */
  555. typedef struct { /*!< GPIOTE Structure */
  556. __O uint32_t TASKS_OUT[4]; /*!< Tasks asssociated with GPIOTE channels. */
  557. __I uint32_t RESERVED0[60];
  558. __IO uint32_t EVENTS_IN[4]; /*!< Tasks asssociated with GPIOTE channels. */
  559. __I uint32_t RESERVED1[27];
  560. __IO uint32_t EVENTS_PORT; /*!< Event generated from multiple pins. */
  561. __I uint32_t RESERVED2[97];
  562. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  563. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  564. __I uint32_t RESERVED3[129];
  565. __IO uint32_t CONFIG[4]; /*!< Channel configuration registers. */
  566. __I uint32_t RESERVED4[695];
  567. __IO uint32_t POWER; /*!< Peripheral power control. */
  568. } NRF_GPIOTE_Type;
  569. /* ================================================================================ */
  570. /* ================ ADC ================ */
  571. /* ================================================================================ */
  572. /**
  573. * @brief Analog to digital converter. (ADC)
  574. */
  575. typedef struct { /*!< ADC Structure */
  576. __O uint32_t TASKS_START; /*!< Start an ADC conversion. */
  577. __O uint32_t TASKS_STOP; /*!< Stop ADC. */
  578. __I uint32_t RESERVED0[62];
  579. __IO uint32_t EVENTS_END; /*!< ADC conversion complete. */
  580. __I uint32_t RESERVED1[128];
  581. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  582. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  583. __I uint32_t RESERVED2[61];
  584. __I uint32_t BUSY; /*!< ADC busy register. */
  585. __I uint32_t RESERVED3[63];
  586. __IO uint32_t ENABLE; /*!< ADC enable. */
  587. __IO uint32_t CONFIG; /*!< ADC configuration register. */
  588. __I uint32_t RESULT; /*!< Result of ADC conversion. */
  589. __I uint32_t RESERVED4[700];
  590. __IO uint32_t POWER; /*!< Peripheral power control. */
  591. } NRF_ADC_Type;
  592. /* ================================================================================ */
  593. /* ================ TIMER ================ */
  594. /* ================================================================================ */
  595. /**
  596. * @brief Timer 0. (TIMER)
  597. */
  598. typedef struct { /*!< TIMER Structure */
  599. __O uint32_t TASKS_START; /*!< Start Timer. */
  600. __O uint32_t TASKS_STOP; /*!< Stop Timer. */
  601. __O uint32_t TASKS_COUNT; /*!< Increment Timer (In counter mode). */
  602. __O uint32_t TASKS_CLEAR; /*!< Clear timer. */
  603. __O uint32_t TASKS_SHUTDOWN; /*!< Shutdown timer. */
  604. __I uint32_t RESERVED0[11];
  605. __O uint32_t TASKS_CAPTURE[4]; /*!< Capture Timer value to CC[n] registers. */
  606. __I uint32_t RESERVED1[60];
  607. __IO uint32_t EVENTS_COMPARE[4]; /*!< Compare event on CC[n] match. */
  608. __I uint32_t RESERVED2[44];
  609. __IO uint32_t SHORTS; /*!< Shortcuts for Timer. */
  610. __I uint32_t RESERVED3[64];
  611. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  612. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  613. __I uint32_t RESERVED4[126];
  614. __IO uint32_t MODE; /*!< Timer Mode selection. */
  615. __IO uint32_t BITMODE; /*!< Sets timer behaviour. */
  616. __I uint32_t RESERVED5;
  617. __IO uint32_t PRESCALER; /*!< 4-bit prescaler to source clock frequency (max value 9). Source
  618. clock frequency is divided by 2^SCALE. */
  619. __I uint32_t RESERVED6[11];
  620. __IO uint32_t CC[4]; /*!< Capture/compare registers. */
  621. __I uint32_t RESERVED7[683];
  622. __IO uint32_t POWER; /*!< Peripheral power control. */
  623. } NRF_TIMER_Type;
  624. /* ================================================================================ */
  625. /* ================ RTC ================ */
  626. /* ================================================================================ */
  627. /**
  628. * @brief Real time counter 0. (RTC)
  629. */
  630. typedef struct { /*!< RTC Structure */
  631. __O uint32_t TASKS_START; /*!< Start RTC Counter. */
  632. __O uint32_t TASKS_STOP; /*!< Stop RTC Counter. */
  633. __O uint32_t TASKS_CLEAR; /*!< Clear RTC Counter. */
  634. __O uint32_t TASKS_TRIGOVRFLW; /*!< Set COUNTER to 0xFFFFFFF0. */
  635. __I uint32_t RESERVED0[60];
  636. __IO uint32_t EVENTS_TICK; /*!< Event on COUNTER increment. */
  637. __IO uint32_t EVENTS_OVRFLW; /*!< Event on COUNTER overflow. */
  638. __I uint32_t RESERVED1[14];
  639. __IO uint32_t EVENTS_COMPARE[4]; /*!< Compare event on CC[n] match. */
  640. __I uint32_t RESERVED2[109];
  641. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  642. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  643. __I uint32_t RESERVED3[13];
  644. __IO uint32_t EVTEN; /*!< Configures event enable routing to PPI for each RTC event. */
  645. __IO uint32_t EVTENSET; /*!< Enable events routing to PPI. The reading of this register gives
  646. the value of EVTEN. */
  647. __IO uint32_t EVTENCLR; /*!< Disable events routing to PPI. The reading of this register
  648. gives the value of EVTEN. */
  649. __I uint32_t RESERVED4[110];
  650. __I uint32_t COUNTER; /*!< Current COUNTER value. */
  651. __IO uint32_t PRESCALER; /*!< 12-bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).
  652. Must be written when RTC is STOPed. */
  653. __I uint32_t RESERVED5[13];
  654. __IO uint32_t CC[4]; /*!< Capture/compare registers. */
  655. __I uint32_t RESERVED6[683];
  656. __IO uint32_t POWER; /*!< Peripheral power control. */
  657. } NRF_RTC_Type;
  658. /* ================================================================================ */
  659. /* ================ TEMP ================ */
  660. /* ================================================================================ */
  661. /**
  662. * @brief Temperature Sensor. (TEMP)
  663. */
  664. typedef struct { /*!< TEMP Structure */
  665. __O uint32_t TASKS_START; /*!< Start temperature measurement. */
  666. __O uint32_t TASKS_STOP; /*!< Stop temperature measurement. */
  667. __I uint32_t RESERVED0[62];
  668. __IO uint32_t EVENTS_DATARDY; /*!< Temperature measurement complete, data ready event. */
  669. __I uint32_t RESERVED1[128];
  670. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  671. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  672. __I uint32_t RESERVED2[127];
  673. __I int32_t TEMP; /*!< Die temperature in degC, 2's complement format, 0.25 degC pecision. */
  674. __I uint32_t RESERVED3[700];
  675. __IO uint32_t POWER; /*!< Peripheral power control. */
  676. } NRF_TEMP_Type;
  677. /* ================================================================================ */
  678. /* ================ RNG ================ */
  679. /* ================================================================================ */
  680. /**
  681. * @brief Random Number Generator. (RNG)
  682. */
  683. typedef struct { /*!< RNG Structure */
  684. __O uint32_t TASKS_START; /*!< Start the random number generator. */
  685. __O uint32_t TASKS_STOP; /*!< Stop the random number generator. */
  686. __I uint32_t RESERVED0[62];
  687. __IO uint32_t EVENTS_VALRDY; /*!< New random number generated and written to VALUE register. */
  688. __I uint32_t RESERVED1[63];
  689. __IO uint32_t SHORTS; /*!< Shortcuts for the RNG. */
  690. __I uint32_t RESERVED2[64];
  691. __IO uint32_t INTENSET; /*!< Interrupt enable set register */
  692. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register */
  693. __I uint32_t RESERVED3[126];
  694. __IO uint32_t CONFIG; /*!< Configuration register. */
  695. __I uint32_t VALUE; /*!< RNG random number. */
  696. __I uint32_t RESERVED4[700];
  697. __IO uint32_t POWER; /*!< Peripheral power control. */
  698. } NRF_RNG_Type;
  699. /* ================================================================================ */
  700. /* ================ ECB ================ */
  701. /* ================================================================================ */
  702. /**
  703. * @brief AES ECB Mode Encryption. (ECB)
  704. */
  705. typedef struct { /*!< ECB Structure */
  706. __O uint32_t TASKS_STARTECB; /*!< Start ECB block encrypt. If a crypto operation is running, this
  707. will not initiate a new encryption and the ERRORECB event will
  708. be triggered. */
  709. __O uint32_t TASKS_STOPECB; /*!< Stop current ECB encryption. If a crypto operation is running,
  710. this will will trigger the ERRORECB event. */
  711. __I uint32_t RESERVED0[62];
  712. __IO uint32_t EVENTS_ENDECB; /*!< ECB block encrypt complete. */
  713. __IO uint32_t EVENTS_ERRORECB; /*!< ECB block encrypt aborted due to a STOPECB task or due to an
  714. error. */
  715. __I uint32_t RESERVED1[127];
  716. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  717. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  718. __I uint32_t RESERVED2[126];
  719. __IO uint32_t ECBDATAPTR; /*!< ECB block encrypt memory pointer. */
  720. __I uint32_t RESERVED3[701];
  721. __IO uint32_t POWER; /*!< Peripheral power control. */
  722. } NRF_ECB_Type;
  723. /* ================================================================================ */
  724. /* ================ AAR ================ */
  725. /* ================================================================================ */
  726. /**
  727. * @brief Accelerated Address Resolver. (AAR)
  728. */
  729. typedef struct { /*!< AAR Structure */
  730. __O uint32_t TASKS_START; /*!< Start resolving addresses based on IRKs specified in the IRK
  731. data structure. */
  732. __I uint32_t RESERVED0;
  733. __O uint32_t TASKS_STOP; /*!< Stop resolving addresses. */
  734. __I uint32_t RESERVED1[61];
  735. __IO uint32_t EVENTS_END; /*!< Address resolution procedure completed. */
  736. __IO uint32_t EVENTS_RESOLVED; /*!< Address resolved. */
  737. __IO uint32_t EVENTS_NOTRESOLVED; /*!< Address not resolved. */
  738. __I uint32_t RESERVED2[126];
  739. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  740. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  741. __I uint32_t RESERVED3[61];
  742. __I uint32_t STATUS; /*!< Resolution status. */
  743. __I uint32_t RESERVED4[63];
  744. __IO uint32_t ENABLE; /*!< Enable AAR. */
  745. __IO uint32_t NIRK; /*!< Number of Identity root Keys in the IRK data structure. */
  746. __IO uint32_t IRKPTR; /*!< Pointer to the IRK data structure. */
  747. __I uint32_t RESERVED5;
  748. __IO uint32_t ADDRPTR; /*!< Pointer to the resolvable address (6 bytes). */
  749. __IO uint32_t SCRATCHPTR; /*!< Pointer to a scratch data area used for temporary storage during
  750. resolution. A minimum of 3 bytes must be reserved. */
  751. __I uint32_t RESERVED6[697];
  752. __IO uint32_t POWER; /*!< Peripheral power control. */
  753. } NRF_AAR_Type;
  754. /* ================================================================================ */
  755. /* ================ CCM ================ */
  756. /* ================================================================================ */
  757. /**
  758. * @brief AES CCM Mode Encryption. (CCM)
  759. */
  760. typedef struct { /*!< CCM Structure */
  761. __O uint32_t TASKS_KSGEN; /*!< Start generation of key-stream. This operation will stop by
  762. itself when completed. */
  763. __O uint32_t TASKS_CRYPT; /*!< Start encrypt/decrypt. This operation will stop by itself when
  764. completed. */
  765. __O uint32_t TASKS_STOP; /*!< Stop encrypt/decrypt. */
  766. __I uint32_t RESERVED0[61];
  767. __IO uint32_t EVENTS_ENDKSGEN; /*!< Keystream generation completed. */
  768. __IO uint32_t EVENTS_ENDCRYPT; /*!< Encrypt/decrypt completed. */
  769. __IO uint32_t EVENTS_ERROR; /*!< Error happened. */
  770. __I uint32_t RESERVED1[61];
  771. __IO uint32_t SHORTS; /*!< Shortcuts for the CCM. */
  772. __I uint32_t RESERVED2[64];
  773. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  774. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  775. __I uint32_t RESERVED3[61];
  776. __I uint32_t MICSTATUS; /*!< CCM RX MIC check result. */
  777. __I uint32_t RESERVED4[63];
  778. __IO uint32_t ENABLE; /*!< CCM enable. */
  779. __IO uint32_t MODE; /*!< Operation mode. */
  780. __IO uint32_t CNFPTR; /*!< Pointer to a data structure holding AES key and NONCE vector. */
  781. __IO uint32_t INPTR; /*!< Pointer to the input packet. */
  782. __IO uint32_t OUTPTR; /*!< Pointer to the output packet. */
  783. __IO uint32_t SCRATCHPTR; /*!< Pointer to a scratch data area used for temporary storage during
  784. resolution. A minimum of 43 bytes must be reserved. */
  785. __I uint32_t RESERVED5[697];
  786. __IO uint32_t POWER; /*!< Peripheral power control. */
  787. } NRF_CCM_Type;
  788. /* ================================================================================ */
  789. /* ================ WDT ================ */
  790. /* ================================================================================ */
  791. /**
  792. * @brief Watchdog Timer. (WDT)
  793. */
  794. typedef struct { /*!< WDT Structure */
  795. __O uint32_t TASKS_START; /*!< Start the watchdog. */
  796. __I uint32_t RESERVED0[63];
  797. __IO uint32_t EVENTS_TIMEOUT; /*!< Watchdog timeout. */
  798. __I uint32_t RESERVED1[128];
  799. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  800. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  801. __I uint32_t RESERVED2[61];
  802. __I uint32_t RUNSTATUS; /*!< Watchdog running status. */
  803. __I uint32_t REQSTATUS; /*!< Request status. */
  804. __I uint32_t RESERVED3[63];
  805. __IO uint32_t CRV; /*!< Counter reload value in number of 32kiHz clock cycles. */
  806. __IO uint32_t RREN; /*!< Reload request enable. */
  807. __IO uint32_t CONFIG; /*!< Configuration register. */
  808. __I uint32_t RESERVED4[60];
  809. __O uint32_t RR[8]; /*!< Reload requests registers. */
  810. __I uint32_t RESERVED5[631];
  811. __IO uint32_t POWER; /*!< Peripheral power control. */
  812. } NRF_WDT_Type;
  813. /* ================================================================================ */
  814. /* ================ QDEC ================ */
  815. /* ================================================================================ */
  816. /**
  817. * @brief Rotary decoder. (QDEC)
  818. */
  819. typedef struct { /*!< QDEC Structure */
  820. __O uint32_t TASKS_START; /*!< Start the quadrature decoder. */
  821. __O uint32_t TASKS_STOP; /*!< Stop the quadrature decoder. */
  822. __O uint32_t TASKS_READCLRACC; /*!< Transfers the content from ACC registers to ACCREAD registers,
  823. and clears the ACC registers. */
  824. __I uint32_t RESERVED0[61];
  825. __IO uint32_t EVENTS_SAMPLERDY; /*!< A new sample is written to the sample register. */
  826. __IO uint32_t EVENTS_REPORTRDY; /*!< REPORTPER number of samples accumulated in ACC register, and
  827. ACC register different than zero. */
  828. __IO uint32_t EVENTS_ACCOF; /*!< ACC or ACCDBL register overflow. */
  829. __I uint32_t RESERVED1[61];
  830. __IO uint32_t SHORTS; /*!< Shortcuts for the QDEC. */
  831. __I uint32_t RESERVED2[64];
  832. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  833. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  834. __I uint32_t RESERVED3[125];
  835. __IO uint32_t ENABLE; /*!< Enable the QDEC. */
  836. __IO uint32_t LEDPOL; /*!< LED output pin polarity. */
  837. __IO uint32_t SAMPLEPER; /*!< Sample period. */
  838. __I int32_t SAMPLE; /*!< Motion sample value. */
  839. __IO uint32_t REPORTPER; /*!< Number of samples to generate an EVENT_REPORTRDY. */
  840. __I int32_t ACC; /*!< Accumulated valid transitions register. */
  841. __I int32_t ACCREAD; /*!< Snapshot of ACC register. Value generated by the TASKS_READCLEACC
  842. task. */
  843. __IO uint32_t PSELLED; /*!< Pin select for LED output. */
  844. __IO uint32_t PSELA; /*!< Pin select for phase A input. */
  845. __IO uint32_t PSELB; /*!< Pin select for phase B input. */
  846. __IO uint32_t DBFEN; /*!< Enable debouncer input filters. */
  847. __I uint32_t RESERVED4[5];
  848. __IO uint32_t LEDPRE; /*!< Time LED is switched ON before the sample. */
  849. __I uint32_t ACCDBL; /*!< Accumulated double (error) transitions register. */
  850. __I uint32_t ACCDBLREAD; /*!< Snapshot of ACCDBL register. Value generated by the TASKS_READCLEACC
  851. task. */
  852. __I uint32_t RESERVED5[684];
  853. __IO uint32_t POWER; /*!< Peripheral power control. */
  854. } NRF_QDEC_Type;
  855. /* ================================================================================ */
  856. /* ================ LPCOMP ================ */
  857. /* ================================================================================ */
  858. /**
  859. * @brief Low power comparator. (LPCOMP)
  860. */
  861. typedef struct { /*!< LPCOMP Structure */
  862. __O uint32_t TASKS_START; /*!< Start the comparator. */
  863. __O uint32_t TASKS_STOP; /*!< Stop the comparator. */
  864. __O uint32_t TASKS_SAMPLE; /*!< Sample comparator value. */
  865. __I uint32_t RESERVED0[61];
  866. __IO uint32_t EVENTS_READY; /*!< LPCOMP is ready and output is valid. */
  867. __IO uint32_t EVENTS_DOWN; /*!< Input voltage crossed the threshold going down. */
  868. __IO uint32_t EVENTS_UP; /*!< Input voltage crossed the threshold going up. */
  869. __IO uint32_t EVENTS_CROSS; /*!< Input voltage crossed the threshold in any direction. */
  870. __I uint32_t RESERVED1[60];
  871. __IO uint32_t SHORTS; /*!< Shortcuts for the LPCOMP. */
  872. __I uint32_t RESERVED2[64];
  873. __IO uint32_t INTENSET; /*!< Interrupt enable set register. */
  874. __IO uint32_t INTENCLR; /*!< Interrupt enable clear register. */
  875. __I uint32_t RESERVED3[61];
  876. __I uint32_t RESULT; /*!< Result of last compare. */
  877. __I uint32_t RESERVED4[63];
  878. __IO uint32_t ENABLE; /*!< Enable the LPCOMP. */
  879. __IO uint32_t PSEL; /*!< Input pin select. */
  880. __IO uint32_t REFSEL; /*!< Reference select. */
  881. __IO uint32_t EXTREFSEL; /*!< External reference select. */
  882. __I uint32_t RESERVED5[4];
  883. __IO uint32_t ANADETECT; /*!< Analog detect configuration. */
  884. __I uint32_t RESERVED6[694];
  885. __IO uint32_t POWER; /*!< Peripheral power control. */
  886. } NRF_LPCOMP_Type;
  887. /* ================================================================================ */
  888. /* ================ SWI ================ */
  889. /* ================================================================================ */
  890. /**
  891. * @brief SW Interrupts. (SWI)
  892. */
  893. typedef struct { /*!< SWI Structure */
  894. __I uint32_t UNUSED; /*!< Unused. */
  895. } NRF_SWI_Type;
  896. /* ================================================================================ */
  897. /* ================ NVMC ================ */
  898. /* ================================================================================ */
  899. /**
  900. * @brief Non Volatile Memory Controller. (NVMC)
  901. */
  902. typedef struct { /*!< NVMC Structure */
  903. __I uint32_t RESERVED0[256];
  904. __I uint32_t READY; /*!< Ready flag. */
  905. __I uint32_t RESERVED1[64];
  906. __IO uint32_t CONFIG; /*!< Configuration register. */
  907. union {
  908. __IO uint32_t ERASEPCR1; /*!< Register for erasing a non-protected non-volatile memory page. */
  909. __IO uint32_t ERASEPAGE; /*!< Register for erasing a non-protected non-volatile memory page. */
  910. };
  911. __IO uint32_t ERASEALL; /*!< Register for erasing all non-volatile user memory. */
  912. __IO uint32_t ERASEPCR0; /*!< Register for erasing a protected non-volatile memory page. */
  913. __IO uint32_t ERASEUICR; /*!< Register for start erasing User Information Congfiguration Registers. */
  914. } NRF_NVMC_Type;
  915. /* ================================================================================ */
  916. /* ================ PPI ================ */
  917. /* ================================================================================ */
  918. /**
  919. * @brief PPI controller. (PPI)
  920. */
  921. typedef struct { /*!< PPI Structure */
  922. PPI_TASKS_CHG_Type TASKS_CHG[4]; /*!< Channel group tasks. */
  923. __I uint32_t RESERVED0[312];
  924. __IO uint32_t CHEN; /*!< Channel enable. */
  925. __IO uint32_t CHENSET; /*!< Channel enable set. */
  926. __IO uint32_t CHENCLR; /*!< Channel enable clear. */
  927. __I uint32_t RESERVED1;
  928. PPI_CH_Type CH[16]; /*!< PPI Channel. */
  929. __I uint32_t RESERVED2[156];
  930. __IO uint32_t CHG[4]; /*!< Channel group configuration. */
  931. } NRF_PPI_Type;
  932. /* ================================================================================ */
  933. /* ================ FICR ================ */
  934. /* ================================================================================ */
  935. /**
  936. * @brief Factory Information Configuration. (FICR)
  937. */
  938. typedef struct { /*!< FICR Structure */
  939. __I uint32_t RESERVED0[4];
  940. __I uint32_t CODEPAGESIZE; /*!< Code memory page size in bytes. */
  941. __I uint32_t CODESIZE; /*!< Code memory size in pages. */
  942. __I uint32_t RESERVED1[4];
  943. __I uint32_t CLENR0; /*!< Length of code region 0 in bytes. */
  944. __I uint32_t PPFC; /*!< Pre-programmed factory code present. */
  945. __I uint32_t RESERVED2;
  946. __I uint32_t NUMRAMBLOCK; /*!< Number of individualy controllable RAM blocks. */
  947. union {
  948. __I uint32_t SIZERAMBLOCK[4]; /*!< Deprecated array of size of RAM block in bytes. This name is
  949. kept for backward compatinility purposes. Use SIZERAMBLOCKS
  950. instead. */
  951. __I uint32_t SIZERAMBLOCKS; /*!< Size of RAM blocks in bytes. */
  952. };
  953. __I uint32_t RESERVED3[5];
  954. __I uint32_t CONFIGID; /*!< Configuration identifier. */
  955. __I uint32_t DEVICEID[2]; /*!< Device identifier. */
  956. __I uint32_t RESERVED4[6];
  957. __I uint32_t ER[4]; /*!< Encryption root. */
  958. __I uint32_t IR[4]; /*!< Identity root. */
  959. __I uint32_t DEVICEADDRTYPE; /*!< Device address type. */
  960. __I uint32_t DEVICEADDR[2]; /*!< Device address. */
  961. __I uint32_t OVERRIDEEN; /*!< Radio calibration override enable. */
  962. __I uint32_t NRF_1MBIT[5]; /*!< Override values for the OVERRIDEn registers in RADIO for NRF_1Mbit
  963. mode. */
  964. __I uint32_t RESERVED5[10];
  965. __I uint32_t BLE_1MBIT[5]; /*!< Override values for the OVERRIDEn registers in RADIO for BLE_1Mbit
  966. mode. */
  967. } NRF_FICR_Type;
  968. /* ================================================================================ */
  969. /* ================ UICR ================ */
  970. /* ================================================================================ */
  971. /**
  972. * @brief User Information Configuration. (UICR)
  973. */
  974. typedef struct { /*!< UICR Structure */
  975. __IO uint32_t CLENR0; /*!< Length of code region 0. */
  976. __IO uint32_t RBPCONF; /*!< Readback protection configuration. */
  977. __IO uint32_t XTALFREQ; /*!< Reset value for CLOCK XTALFREQ register. */
  978. __I uint32_t RESERVED0;
  979. __I uint32_t FWID; /*!< Firmware ID. */
  980. union {
  981. __IO uint32_t NRFFW[15]; /*!< Reserved for Nordic firmware design. */
  982. __IO uint32_t BOOTLOADERADDR; /*!< Bootloader start address. */
  983. };
  984. __IO uint32_t NRFHW[12]; /*!< Reserved for Nordic hardware design. */
  985. __IO uint32_t CUSTOMER[32]; /*!< Reserved for customer. */
  986. } NRF_UICR_Type;
  987. /* ================================================================================ */
  988. /* ================ GPIO ================ */
  989. /* ================================================================================ */
  990. /**
  991. * @brief General purpose input and output. (GPIO)
  992. */
  993. typedef struct { /*!< GPIO Structure */
  994. __I uint32_t RESERVED0[321];
  995. __IO uint32_t OUT; /*!< Write GPIO port. */
  996. __IO uint32_t OUTSET; /*!< Set individual bits in GPIO port. */
  997. __IO uint32_t OUTCLR; /*!< Clear individual bits in GPIO port. */
  998. __I uint32_t IN; /*!< Read GPIO port. */
  999. __IO uint32_t DIR; /*!< Direction of GPIO pins. */
  1000. __IO uint32_t DIRSET; /*!< DIR set register. */
  1001. __IO uint32_t DIRCLR; /*!< DIR clear register. */
  1002. __I uint32_t RESERVED1[120];
  1003. __IO uint32_t PIN_CNF[32]; /*!< Configuration of GPIO pins. */
  1004. } NRF_GPIO_Type;
  1005. /* -------------------- End of section using anonymous unions ------------------- */
  1006. #if defined(__CC_ARM)
  1007. #pragma pop
  1008. #elif defined(__ICCARM__)
  1009. /* leave anonymous unions enabled */
  1010. #elif defined(__GNUC__)
  1011. /* anonymous unions are enabled by default */
  1012. #elif defined(__TMS470__)
  1013. /* anonymous unions are enabled by default */
  1014. #elif defined(__TASKING__)
  1015. #pragma warning restore
  1016. #else
  1017. #warning Not supported compiler type
  1018. #endif
  1019. /* ================================================================================ */
  1020. /* ================ Peripheral memory map ================ */
  1021. /* ================================================================================ */
  1022. #define NRF_POWER_BASE 0x40000000UL
  1023. #define NRF_CLOCK_BASE 0x40000000UL
  1024. #define NRF_MPU_BASE 0x40000000UL
  1025. #define NRF_AMLI_BASE 0x40000000UL
  1026. #define NRF_RADIO_BASE 0x40001000UL
  1027. #define NRF_UART0_BASE 0x40002000UL
  1028. #define NRF_SPI0_BASE 0x40003000UL
  1029. #define NRF_TWI0_BASE 0x40003000UL
  1030. #define NRF_SPI1_BASE 0x40004000UL
  1031. #define NRF_TWI1_BASE 0x40004000UL
  1032. #define NRF_SPIS1_BASE 0x40004000UL
  1033. #define NRF_SPIM1_BASE 0x40004000UL
  1034. #define NRF_GPIOTE_BASE 0x40006000UL
  1035. #define NRF_ADC_BASE 0x40007000UL
  1036. #define NRF_TIMER0_BASE 0x40008000UL
  1037. #define NRF_TIMER1_BASE 0x40009000UL
  1038. #define NRF_TIMER2_BASE 0x4000A000UL
  1039. #define NRF_RTC0_BASE 0x4000B000UL
  1040. #define NRF_TEMP_BASE 0x4000C000UL
  1041. #define NRF_RNG_BASE 0x4000D000UL
  1042. #define NRF_ECB_BASE 0x4000E000UL
  1043. #define NRF_AAR_BASE 0x4000F000UL
  1044. #define NRF_CCM_BASE 0x4000F000UL
  1045. #define NRF_WDT_BASE 0x40010000UL
  1046. #define NRF_RTC1_BASE 0x40011000UL
  1047. #define NRF_QDEC_BASE 0x40012000UL
  1048. #define NRF_LPCOMP_BASE 0x40013000UL
  1049. #define NRF_SWI_BASE 0x40014000UL
  1050. #define NRF_NVMC_BASE 0x4001E000UL
  1051. #define NRF_PPI_BASE 0x4001F000UL
  1052. #define NRF_FICR_BASE 0x10000000UL
  1053. #define NRF_UICR_BASE 0x10001000UL
  1054. #define NRF_GPIO_BASE 0x50000000UL
  1055. /* ================================================================================ */
  1056. /* ================ Peripheral declaration ================ */
  1057. /* ================================================================================ */
  1058. #define NRF_POWER ((NRF_POWER_Type *) NRF_POWER_BASE)
  1059. #define NRF_CLOCK ((NRF_CLOCK_Type *) NRF_CLOCK_BASE)
  1060. #define NRF_MPU ((NRF_MPU_Type *) NRF_MPU_BASE)
  1061. #define NRF_AMLI ((NRF_AMLI_Type *) NRF_AMLI_BASE)
  1062. #define NRF_RADIO ((NRF_RADIO_Type *) NRF_RADIO_BASE)
  1063. #define NRF_UART0 ((NRF_UART_Type *) NRF_UART0_BASE)
  1064. #define NRF_SPI0 ((NRF_SPI_Type *) NRF_SPI0_BASE)
  1065. #define NRF_TWI0 ((NRF_TWI_Type *) NRF_TWI0_BASE)
  1066. #define NRF_SPI1 ((NRF_SPI_Type *) NRF_SPI1_BASE)
  1067. #define NRF_TWI1 ((NRF_TWI_Type *) NRF_TWI1_BASE)
  1068. #define NRF_SPIS1 ((NRF_SPIS_Type *) NRF_SPIS1_BASE)
  1069. #define NRF_SPIM1 ((NRF_SPIM_Type *) NRF_SPIM1_BASE)
  1070. #define NRF_GPIOTE ((NRF_GPIOTE_Type *) NRF_GPIOTE_BASE)
  1071. #define NRF_ADC ((NRF_ADC_Type *) NRF_ADC_BASE)
  1072. #define NRF_TIMER0 ((NRF_TIMER_Type *) NRF_TIMER0_BASE)
  1073. #define NRF_TIMER1 ((NRF_TIMER_Type *) NRF_TIMER1_BASE)
  1074. #define NRF_TIMER2 ((NRF_TIMER_Type *) NRF_TIMER2_BASE)
  1075. #define NRF_RTC0 ((NRF_RTC_Type *) NRF_RTC0_BASE)
  1076. #define NRF_TEMP ((NRF_TEMP_Type *) NRF_TEMP_BASE)
  1077. #define NRF_RNG ((NRF_RNG_Type *) NRF_RNG_BASE)
  1078. #define NRF_ECB ((NRF_ECB_Type *) NRF_ECB_BASE)
  1079. #define NRF_AAR ((NRF_AAR_Type *) NRF_AAR_BASE)
  1080. #define NRF_CCM ((NRF_CCM_Type *) NRF_CCM_BASE)
  1081. #define NRF_WDT ((NRF_WDT_Type *) NRF_WDT_BASE)
  1082. #define NRF_RTC1 ((NRF_RTC_Type *) NRF_RTC1_BASE)
  1083. #define NRF_QDEC ((NRF_QDEC_Type *) NRF_QDEC_BASE)
  1084. #define NRF_LPCOMP ((NRF_LPCOMP_Type *) NRF_LPCOMP_BASE)
  1085. #define NRF_SWI ((NRF_SWI_Type *) NRF_SWI_BASE)
  1086. #define NRF_NVMC ((NRF_NVMC_Type *) NRF_NVMC_BASE)
  1087. #define NRF_PPI ((NRF_PPI_Type *) NRF_PPI_BASE)
  1088. #define NRF_FICR ((NRF_FICR_Type *) NRF_FICR_BASE)
  1089. #define NRF_UICR ((NRF_UICR_Type *) NRF_UICR_BASE)
  1090. #define NRF_GPIO ((NRF_GPIO_Type *) NRF_GPIO_BASE)
  1091. /** @} */ /* End of group Device_Peripheral_Registers */
  1092. /** @} */ /* End of group nrf51 */
  1093. /** @} */ /* End of group Nordic Semiconductor */
  1094. #ifdef __cplusplus
  1095. }
  1096. #endif
  1097. #endif /* nrf51_H */