nrf51.h 84 KB

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