M480.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. /**************************************************************************//**
  2. * @file M480.h
  3. * @version V1.00
  4. * @brief M480 peripheral access layer header file.
  5. * This file contains all the peripheral register's definitions,
  6. * bits definitions and memory mapping for NuMicro M480 MCU.
  7. *
  8. * SPDX-License-Identifier: Apache-2.0
  9. * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
  10. *****************************************************************************/
  11. /**
  12. \mainpage NuMicro M480 Driver Reference Guide
  13. *
  14. * <b>Introduction</b>
  15. *
  16. * This user manual describes the usage of M480 Series MCU device driver
  17. *
  18. * <b>Disclaimer</b>
  19. *
  20. * The Software is furnished "AS IS", without warranty as to performance or results, and
  21. * the entire risk as to performance or results is assumed by YOU. Nuvoton disclaims all
  22. * warranties, express, implied or otherwise, with regard to the Software, its use, or
  23. * operation, including without limitation any and all warranties of merchantability, fitness
  24. * for a particular purpose, and non-infringement of intellectual property rights.
  25. *
  26. * <b>Important Notice</b>
  27. *
  28. * Nuvoton Products are neither intended nor warranted for usage in systems or equipment,
  29. * any malfunction or failure of which may cause loss of human life, bodily injury or severe
  30. * property damage. Such applications are deemed, "Insecure Usage".
  31. *
  32. * Insecure usage includes, but is not limited to: equipment for surgical implementation,
  33. * atomic energy control instruments, airplane or spaceship instruments, the control or
  34. * operation of dynamic, brake or safety systems designed for vehicular use, traffic signal
  35. * instruments, all types of safety devices, and other applications intended to support or
  36. * sustain life.
  37. *
  38. * All Insecure Usage shall be made at customer's risk, and in the event that third parties
  39. * lay claims to Nuvoton as a result of customer's Insecure Usage, customer shall indemnify
  40. * the damages and liabilities thus incurred by Nuvoton.
  41. *
  42. * Please note that all data and specifications are subject to change without notice. All the
  43. * trademarks of products and companies mentioned in this datasheet belong to their respective
  44. * owners.
  45. *
  46. * <b>Copyright Notice</b>
  47. *
  48. * Copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
  49. */
  50. #ifndef __M480_H__
  51. #define __M480_H__
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55. /******************************************************************************/
  56. /* Processor and Core Peripherals */
  57. /******************************************************************************/
  58. /** @addtogroup CMSIS_Device Device CMSIS Definitions
  59. Configuration of the Cortex-M4 Processor and Core Peripherals
  60. @{
  61. */
  62. /**
  63. * @details Interrupt Number Definition.
  64. */
  65. typedef enum IRQn
  66. {
  67. /****** Cortex-M4 Processor Exceptions Numbers ***************************************************/
  68. NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
  69. MemoryManagement_IRQn = -12, /*!< 4 Memory Management Interrupt */
  70. BusFault_IRQn = -11, /*!< 5 Bus Fault Interrupt */
  71. UsageFault_IRQn = -10, /*!< 6 Usage Fault Interrupt */
  72. SVCall_IRQn = -5, /*!< 11 SV Call Interrupt */
  73. DebugMonitor_IRQn = -4, /*!< 12 Debug Monitor Interrupt */
  74. PendSV_IRQn = -2, /*!< 14 Pend SV Interrupt */
  75. SysTick_IRQn = -1, /*!< 15 System Tick Interrupt */
  76. /****** M480 Specific Interrupt Numbers ********************************************************/
  77. BOD_IRQn = 0, /*!< Brown Out detection Interrupt */
  78. IRC_IRQn = 1, /*!< Internal RC Interrupt */
  79. PWRWU_IRQn = 2, /*!< Power Down Wake Up Interrupt */
  80. RAMPE_IRQn = 3, /*!< SRAM parity check failed Interrupt */
  81. CKFAIL_IRQn = 4, /*!< Clock failed Interrupt */
  82. RTC_IRQn = 6, /*!< Real Time Clock Interrupt */
  83. TAMPER_IRQn = 7, /*!< Tamper detection Interrupt */
  84. WDT_IRQn = 8, /*!< Watchdog timer Interrupt */
  85. WWDT_IRQn = 9, /*!< Window Watchdog timer Interrupt */
  86. EINT0_IRQn = 10, /*!< External Input 0 Interrupt */
  87. EINT1_IRQn = 11, /*!< External Input 1 Interrupt */
  88. EINT2_IRQn = 12, /*!< External Input 2 Interrupt */
  89. EINT3_IRQn = 13, /*!< External Input 3 Interrupt */
  90. EINT4_IRQn = 14, /*!< External Input 4 Interrupt */
  91. EINT5_IRQn = 15, /*!< External Input 5 Interrupt */
  92. GPA_IRQn = 16, /*!< GPIO Port A Interrupt */
  93. GPB_IRQn = 17, /*!< GPIO Port B Interrupt */
  94. GPC_IRQn = 18, /*!< GPIO Port C Interrupt */
  95. GPD_IRQn = 19, /*!< GPIO Port D Interrupt */
  96. GPE_IRQn = 20, /*!< GPIO Port E Interrupt */
  97. GPF_IRQn = 21, /*!< GPIO Port F Interrupt */
  98. QSPI0_IRQn = 22, /*!< QSPI0 Interrupt */
  99. SPI0_IRQn = 23, /*!< SPI0 Interrupt */
  100. BRAKE0_IRQn = 24, /*!< BRAKE0 Interrupt */
  101. EPWM0P0_IRQn = 25, /*!< EPWM0P0 Interrupt */
  102. EPWM0P1_IRQn = 26, /*!< EPWM0P1 Interrupt */
  103. EPWM0P2_IRQn = 27, /*!< EPWM0P2 Interrupt */
  104. BRAKE1_IRQn = 28, /*!< BRAKE1 Interrupt */
  105. EPWM1P0_IRQn = 29, /*!< EPWM1P0 Interrupt */
  106. EPWM1P1_IRQn = 30, /*!< EPWM1P1 Interrupt */
  107. EPWM1P2_IRQn = 31, /*!< EPWM1P2 Interrupt */
  108. TMR0_IRQn = 32, /*!< Timer 0 Interrupt */
  109. TMR1_IRQn = 33, /*!< Timer 1 Interrupt */
  110. TMR2_IRQn = 34, /*!< Timer 2 Interrupt */
  111. TMR3_IRQn = 35, /*!< Timer 3 Interrupt */
  112. UART0_IRQn = 36, /*!< UART 0 Interrupt */
  113. UART1_IRQn = 37, /*!< UART 1 Interrupt */
  114. I2C0_IRQn = 38, /*!< I2C 0 Interrupt */
  115. I2C1_IRQn = 39, /*!< I2C 1 Interrupt */
  116. PDMA_IRQn = 40, /*!< Peripheral DMA Interrupt */
  117. DAC_IRQn = 41, /*!< DAC Interrupt */
  118. EADC00_IRQn = 42, /*!< EADC00 Interrupt */
  119. EADC01_IRQn = 43, /*!< EADC01 Interrupt */
  120. ACMP01_IRQn = 44, /*!< Analog Comparator 0 and 1 Interrupt */
  121. EADC02_IRQn = 46, /*!< EADC02 Interrupt */
  122. EADC03_IRQn = 47, /*!< EADC03 Interrupt */
  123. UART2_IRQn = 48, /*!< UART2 Interrupt */
  124. UART3_IRQn = 49, /*!< UART3 Interrupt */
  125. QSPI1_IRQn = 50, /*!< QSPI1 Interrupt */
  126. SPI1_IRQn = 51, /*!< SPI1 Interrupt */
  127. SPI2_IRQn = 52, /*!< SPI2 Interrupt */
  128. USBD_IRQn = 53, /*!< USB device Interrupt */
  129. USBH_IRQn = 54, /*!< USB host Interrupt */
  130. USBOTG_IRQn = 55, /*!< USB OTG Interrupt */
  131. CAN0_IRQn = 56, /*!< CAN0 Interrupt */
  132. CAN1_IRQn = 57, /*!< CAN1 Interrupt */
  133. SC0_IRQn = 58, /*!< Smart Card 0 Interrupt */
  134. SC1_IRQn = 59, /*!< Smart Card 1 Interrupt */
  135. SC2_IRQn = 60, /*!< Smart Card 2 Interrupt */
  136. SPI3_IRQn = 62, /*!< SPI3 Interrupt */
  137. EMAC_TX_IRQn = 66, /*!< Ethernet MAC TX Interrupt */
  138. EMAC_RX_IRQn = 67, /*!< Ethernet MAC RX Interrupt */
  139. SDH0_IRQn = 64, /*!< Secure Digital Host Controller 0 Interrupt */
  140. USBD20_IRQn = 65, /*!< High Speed USB device Interrupt */
  141. I2S0_IRQn = 68, /*!< I2S0 Interrupt */
  142. OPA_IRQn = 70, /*!< OPA Interrupt */
  143. CRPT_IRQn = 71, /*!< CRPT Interrupt */
  144. GPG_IRQn = 72, /*!< GPIO Port G Interrupt */
  145. EINT6_IRQn = 73, /*!< External Input 6 Interrupt */
  146. UART4_IRQn = 74, /*!< UART4 Interrupt */
  147. UART5_IRQn = 75, /*!< UART5 Interrupt */
  148. USCI0_IRQn = 76, /*!< USCI0 Interrupt */
  149. USCI1_IRQn = 77, /*!< USCI1 Interrupt */
  150. BPWM0_IRQn = 78, /*!< BPWM0 Interrupt */
  151. BPWM1_IRQn = 79, /*!< BPWM1 Interrupt */
  152. SPIM_IRQn = 80, /*!< SPIM Interrupt */
  153. CCAP_IRQn = 81, /*!< CCAP Interrupt */
  154. I2C2_IRQn = 82, /*!< I2C2 Interrupt */
  155. QEI0_IRQn = 84, /*!< QEI0 Interrupt */
  156. QEI1_IRQn = 85, /*!< QEI1 Interrupt */
  157. ECAP0_IRQn = 86, /*!< ECAP0 Interrupt */
  158. ECAP1_IRQn = 87, /*!< ECAP1 Interrupt */
  159. GPH_IRQn = 88, /*!< GPIO Port H Interrupt */
  160. EINT7_IRQn = 89, /*!< External Input 7 Interrupt */
  161. SDH1_IRQn = 90, /*!< Secure Digital Host Controller 1 Interrupt */
  162. HSUSBH_IRQn = 92, /*!< High speed USB host Interrupt */
  163. USBOTG20_IRQn = 93, /*!< High speed USB OTG Interrupt */
  164. TRNG_IRQn = 101, /*!< TRNG Interrupt */
  165. UART6_IRQn = 102, /*!< UART6 Interrupt */
  166. UART7_IRQn = 103, /*!< UART7 Interrupt */
  167. EADC10_IRQn = 104, /*!< EADC10 Interrupt */
  168. EADC11_IRQn = 105, /*!< EADC11 Interrupt */
  169. EADC12_IRQn = 106, /*!< EADC12 Interrupt */
  170. EADC13_IRQn = 107, /*!< EADC13 Interrupt */
  171. CAN2_IRQn = 108, /*!< CAN2 Interrupt */
  172. }
  173. IRQn_Type;
  174. /*
  175. * ==========================================================================
  176. * ----------- Processor and Core Peripheral Section ------------------------
  177. * ==========================================================================
  178. */
  179. /* Configuration of the Cortex-M4 Processor and Core Peripherals */
  180. #define __CM4_REV 0x0201UL /*!< Core Revision r2p1 */
  181. #define __NVIC_PRIO_BITS 4UL /*!< Number of Bits used for Priority Levels */
  182. #define __Vendor_SysTickConfig 0UL /*!< Set to 1 if different SysTick Config is used */
  183. #define __MPU_PRESENT 1UL /*!< MPU present or not */
  184. #ifdef __FPU_PRESENT
  185. #undef __FPU_PRESENT
  186. #define __FPU_PRESENT 1UL /*!< FPU present or not */
  187. #else
  188. #define __FPU_PRESENT 1UL /*!< FPU present or not */
  189. #endif
  190. /*@}*/ /* end of group CMSIS_Device */
  191. #include "core_cm4.h" /* Cortex-M4 processor and core peripherals */
  192. #include "system_M480.h" /* System include file */
  193. #include <stdint.h>
  194. #if defined ( __CC_ARM )
  195. #pragma anon_unions
  196. #endif
  197. /******************************************************************************/
  198. /* Register definitions */
  199. /******************************************************************************/
  200. #include "sys_reg.h"
  201. #include "clk_reg.h"
  202. #include "fmc_reg.h"
  203. #include "gpio_reg.h"
  204. #include "pdma_reg.h"
  205. #include "timer_reg.h"
  206. #include "wdt_reg.h"
  207. #include "wwdt_reg.h"
  208. #include "rtc_reg.h"
  209. #include "epwm_reg.h"
  210. #include "bpwm_reg.h"
  211. #include "qei_reg.h"
  212. #include "ecap_reg.h"
  213. #include "uart_reg.h"
  214. #include "emac_reg.h"
  215. #include "sc_reg.h"
  216. #include "i2s_reg.h"
  217. #include "spi_reg.h"
  218. #include "qspi_reg.h"
  219. #include "spim_reg.h"
  220. #include "i2c_reg.h"
  221. #include "uuart_reg.h"
  222. #include "uspi_reg.h"
  223. #include "ui2c_reg.h"
  224. #include "can_reg.h"
  225. #include "sdh_reg.h"
  226. #include "ebi_reg.h"
  227. #include "usbd_reg.h"
  228. #include "hsusbd_reg.h"
  229. #include "usbh_reg.h"
  230. #include "hsusbh_reg.h"
  231. #include "otg_reg.h"
  232. #include "hsotg_reg.h"
  233. #include "crc_reg.h"
  234. #include "crypto_reg.h"
  235. #include "trng_reg.h"
  236. #include "eadc_reg.h"
  237. #include "dac_reg.h"
  238. #include "acmp_reg.h"
  239. #include "opa_reg.h"
  240. #include "ccap_reg.h"
  241. /** @addtogroup PERIPHERAL_MEM_MAP Peripheral Memory Base
  242. Memory Mapped Structure for Peripherals
  243. @{
  244. */
  245. /* Peripheral and SRAM base address */
  246. #define FLASH_BASE ((uint32_t)0x00000000) /*!< Flash base address */
  247. #define SRAM_BASE ((uint32_t)0x20000000) /*!< SRAM Base Address */
  248. #define PERIPH_BASE ((uint32_t)0x40000000) /*!< Peripheral Base Address */
  249. #define AHBPERIPH_BASE PERIPH_BASE /*!< AHB Base Address */
  250. #define APBPERIPH_BASE (PERIPH_BASE + (uint32_t)0x00040000) /*!< APB Base Address */
  251. /*!< AHB peripherals */
  252. #define SYS_BASE (AHBPERIPH_BASE + 0x00000UL)
  253. #define CLK_BASE (AHBPERIPH_BASE + 0x00200UL)
  254. #define NMI_BASE (AHBPERIPH_BASE + 0x00300UL)
  255. #define GPIOA_BASE (AHBPERIPH_BASE + 0x04000UL)
  256. #define GPIOB_BASE (AHBPERIPH_BASE + 0x04040UL)
  257. #define GPIOC_BASE (AHBPERIPH_BASE + 0x04080UL)
  258. #define GPIOD_BASE (AHBPERIPH_BASE + 0x040C0UL)
  259. #define GPIOE_BASE (AHBPERIPH_BASE + 0x04100UL)
  260. #define GPIOF_BASE (AHBPERIPH_BASE + 0x04140UL)
  261. #define GPIOG_BASE (AHBPERIPH_BASE + 0x04180UL)
  262. #define GPIOH_BASE (AHBPERIPH_BASE + 0x041C0UL)
  263. #define GPIOI_BASE (AHBPERIPH_BASE + 0x04200UL)
  264. #define GPIO_DBCTL_BASE (AHBPERIPH_BASE + 0x04440UL)
  265. #define GPIO_PIN_DATA_BASE (AHBPERIPH_BASE + 0x04800UL)
  266. #define PDMA_BASE (AHBPERIPH_BASE + 0x08000UL)
  267. #define USBH_BASE (AHBPERIPH_BASE + 0x09000UL)
  268. #define HSUSBH_BASE (AHBPERIPH_BASE + 0x1A000UL)
  269. #define EMAC_BASE (AHBPERIPH_BASE + 0x0B000UL)
  270. #define FMC_BASE (AHBPERIPH_BASE + 0x0C000UL)
  271. #define SDH0_BASE (AHBPERIPH_BASE + 0x0D000UL)
  272. #define SDH1_BASE (AHBPERIPH_BASE + 0x0E000UL)
  273. #define EBI_BASE (AHBPERIPH_BASE + 0x10000UL)
  274. #define HSUSBD_BASE (AHBPERIPH_BASE + 0x19000UL)
  275. #define CCAP_BASE (AHBPERIPH_BASE + 0x30000UL)
  276. #define CRC_BASE (AHBPERIPH_BASE + 0x31000UL)
  277. #define TAMPER_BASE (AHBPERIPH_BASE + 0xE1000UL)
  278. /*!< APB2 peripherals */
  279. #define WDT_BASE (APBPERIPH_BASE + 0x00000UL)
  280. #define WWDT_BASE (APBPERIPH_BASE + 0x00100UL)
  281. #define OPA_BASE (APBPERIPH_BASE + 0x06000UL)
  282. #define I2S_BASE (APBPERIPH_BASE + 0x08000UL)
  283. #define EADC1_BASE (APBPERIPH_BASE + 0x0B000UL)
  284. #define TIMER0_BASE (APBPERIPH_BASE + 0x10000UL)
  285. #define TIMER1_BASE (APBPERIPH_BASE + 0x10100UL)
  286. #define EPWM0_BASE (APBPERIPH_BASE + 0x18000UL)
  287. #define BPWM0_BASE (APBPERIPH_BASE + 0x1A000UL)
  288. #define QSPI0_BASE (APBPERIPH_BASE + 0x20000UL)
  289. #define SPI1_BASE (APBPERIPH_BASE + 0x22000UL)
  290. #define SPI3_BASE (APBPERIPH_BASE + 0x24000UL)
  291. #define UART0_BASE (APBPERIPH_BASE + 0x30000UL)
  292. #define UART2_BASE (APBPERIPH_BASE + 0x32000UL)
  293. #define UART4_BASE (APBPERIPH_BASE + 0x34000UL)
  294. #define UART6_BASE (APBPERIPH_BASE + 0x36000UL)
  295. #define I2C0_BASE (APBPERIPH_BASE + 0x40000UL)
  296. #define I2C2_BASE (APBPERIPH_BASE + 0x42000UL)
  297. #define CAN0_BASE (APBPERIPH_BASE + 0x60000UL)
  298. #define CAN2_BASE (APBPERIPH_BASE + 0x62000UL)
  299. #define QEI0_BASE (APBPERIPH_BASE + 0x70000UL)
  300. #define ECAP0_BASE (APBPERIPH_BASE + 0x74000UL)
  301. #define USCI0_BASE (APBPERIPH_BASE + 0x90000UL)
  302. /*!< APB1 peripherals */
  303. #define RTC_BASE (APBPERIPH_BASE + 0x01000UL)
  304. #define EADC_BASE (APBPERIPH_BASE + 0x03000UL)
  305. #define ACMP01_BASE (APBPERIPH_BASE + 0x05000UL)
  306. #define USBD_BASE (APBPERIPH_BASE + 0x80000UL)
  307. #define OTG_BASE (APBPERIPH_BASE + 0x0D000UL)
  308. #define HSOTG_BASE (APBPERIPH_BASE + 0x0F000UL)
  309. #define TIMER2_BASE (APBPERIPH_BASE + 0x11000UL)
  310. #define TIMER3_BASE (APBPERIPH_BASE + 0x11100UL)
  311. #define EPWM1_BASE (APBPERIPH_BASE + 0x19000UL)
  312. #define BPWM1_BASE (APBPERIPH_BASE + 0x1B000UL)
  313. #define SPI0_BASE (APBPERIPH_BASE + 0x21000UL)
  314. #define SPI2_BASE (APBPERIPH_BASE + 0x23000UL)
  315. #define QSPI1_BASE (APBPERIPH_BASE + 0x29000UL)
  316. #define UART1_BASE (APBPERIPH_BASE + 0x31000UL)
  317. #define UART3_BASE (APBPERIPH_BASE + 0x33000UL)
  318. #define UART5_BASE (APBPERIPH_BASE + 0x35000UL)
  319. #define UART7_BASE (APBPERIPH_BASE + 0x37000UL)
  320. #define I2C1_BASE (APBPERIPH_BASE + 0x41000UL)
  321. #define CAN1_BASE (APBPERIPH_BASE + 0x61000UL)
  322. #define QEI1_BASE (APBPERIPH_BASE + 0x71000UL)
  323. #define ECAP1_BASE (APBPERIPH_BASE + 0x75000UL)
  324. #define TRNG_BASE (APBPERIPH_BASE + 0x79000UL)
  325. #define USCI1_BASE (APBPERIPH_BASE + 0x91000UL)
  326. #define CRPT_BASE (0x50080000UL)
  327. #define SPIM_BASE (0x40007000UL)
  328. #define SC0_BASE (APBPERIPH_BASE + 0x50000UL)
  329. #define SC1_BASE (APBPERIPH_BASE + 0x51000UL)
  330. #define SC2_BASE (APBPERIPH_BASE + 0x52000UL)
  331. #define DAC0_BASE (APBPERIPH_BASE + 0x07000UL)
  332. #define DAC1_BASE (APBPERIPH_BASE + 0x07040UL)
  333. #define DACDBG_BASE (APBPERIPH_BASE + 0x07FECUL)
  334. #define OPA0_BASE (APBPERIPH_BASE + 0x06000UL)
  335. /*@}*/ /* end of group PERIPHERAL_MEM_MAP */
  336. /** @addtogroup PERIPHERAL_DECLARATION Peripheral Pointer
  337. The Declaration of Peripherals
  338. @{
  339. */
  340. #define SYS ((SYS_T *) SYS_BASE)
  341. #define CLK ((CLK_T *) CLK_BASE)
  342. #define NMI ((NMI_T *) NMI_BASE)
  343. #define PA ((GPIO_T *) GPIOA_BASE)
  344. #define PB ((GPIO_T *) GPIOB_BASE)
  345. #define PC ((GPIO_T *) GPIOC_BASE)
  346. #define PD ((GPIO_T *) GPIOD_BASE)
  347. #define PE ((GPIO_T *) GPIOE_BASE)
  348. #define PF ((GPIO_T *) GPIOF_BASE)
  349. #define PG ((GPIO_T *) GPIOG_BASE)
  350. #define PH ((GPIO_T *) GPIOH_BASE)
  351. #define GPA ((GPIO_T *) GPIOA_BASE)
  352. #define GPB ((GPIO_T *) GPIOB_BASE)
  353. #define GPC ((GPIO_T *) GPIOC_BASE)
  354. #define GPD ((GPIO_T *) GPIOD_BASE)
  355. #define GPE ((GPIO_T *) GPIOE_BASE)
  356. #define GPF ((GPIO_T *) GPIOF_BASE)
  357. #define GPG ((GPIO_T *) GPIOG_BASE)
  358. #define GPH ((GPIO_T *) GPIOH_BASE)
  359. #define GPIO ((GPIO_DBCTL_T *) GPIO_DBCTL_BASE)
  360. #define PDMA ((PDMA_T *) PDMA_BASE)
  361. #define USBH ((USBH_T *) USBH_BASE)
  362. #define HSUSBH ((HSUSBH_T *) HSUSBH_BASE)
  363. #define EMAC ((EMAC_T *) EMAC_BASE)
  364. #define FMC ((FMC_T *) FMC_BASE)
  365. #define SDH0 ((SDH_T *) SDH0_BASE)
  366. #define SDH1 ((SDH_T *) SDH1_BASE)
  367. #define EBI ((EBI_T *) EBI_BASE)
  368. #define CRC ((CRC_T *) CRC_BASE)
  369. #define TAMPER ((TAMPER_T *) TAMPER_BASE)
  370. #define WDT ((WDT_T *) WDT_BASE)
  371. #define WWDT ((WWDT_T *) WWDT_BASE)
  372. #define RTC ((RTC_T *) RTC_BASE)
  373. #define EADC ((EADC_T *) EADC_BASE)
  374. #define EADC0 ((EADC_T *) EADC_BASE)
  375. #define EADC1 ((EADC_T *) EADC1_BASE)
  376. #define ACMP01 ((ACMP_T *) ACMP01_BASE)
  377. #define I2S0 ((I2S_T *) I2S_BASE)
  378. #define USBD ((USBD_T *) USBD_BASE)
  379. #define OTG ((OTG_T *) OTG_BASE)
  380. #define HSUSBD ((HSUSBD_T *)HSUSBD_BASE)
  381. #define HSOTG ((HSOTG_T *) HSOTG_BASE)
  382. #define TIMER0 ((TIMER_T *) TIMER0_BASE)
  383. #define TIMER1 ((TIMER_T *) TIMER1_BASE)
  384. #define TIMER2 ((TIMER_T *) TIMER2_BASE)
  385. #define TIMER3 ((TIMER_T *) TIMER3_BASE)
  386. #define EPWM0 ((EPWM_T *) EPWM0_BASE)
  387. #define EPWM1 ((EPWM_T *) EPWM1_BASE)
  388. #define BPWM0 ((BPWM_T *) BPWM0_BASE)
  389. #define BPWM1 ((BPWM_T *) BPWM1_BASE)
  390. #define ECAP0 ((ECAP_T *) ECAP0_BASE)
  391. #define ECAP1 ((ECAP_T *) ECAP1_BASE)
  392. #define QEI0 ((QEI_T *) QEI0_BASE)
  393. #define QEI1 ((QEI_T *) QEI1_BASE)
  394. #define QSPI0 ((QSPI_T *) QSPI0_BASE)
  395. #define QSPI1 ((QSPI_T *) QSPI1_BASE)
  396. #define SPI0 ((SPI_T *) SPI0_BASE)
  397. #define SPI1 ((SPI_T *) SPI1_BASE)
  398. #define SPI2 ((SPI_T *) SPI2_BASE)
  399. #define SPI3 ((SPI_T *) SPI3_BASE)
  400. #define UART0 ((UART_T *) UART0_BASE)
  401. #define UART1 ((UART_T *) UART1_BASE)
  402. #define UART2 ((UART_T *) UART2_BASE)
  403. #define UART3 ((UART_T *) UART3_BASE)
  404. #define UART4 ((UART_T *) UART4_BASE)
  405. #define UART5 ((UART_T *) UART5_BASE)
  406. #define UART6 ((UART_T *) UART6_BASE)
  407. #define UART7 ((UART_T *) UART7_BASE)
  408. #define I2C0 ((I2C_T *) I2C0_BASE)
  409. #define I2C1 ((I2C_T *) I2C1_BASE)
  410. #define I2C2 ((I2C_T *) I2C2_BASE)
  411. #define SC0 ((SC_T *) SC0_BASE)
  412. #define SC1 ((SC_T *) SC1_BASE)
  413. #define SC2 ((SC_T *) SC2_BASE)
  414. #define CAN0 ((CAN_T *) CAN0_BASE)
  415. #define CAN1 ((CAN_T *) CAN1_BASE)
  416. #define CAN2 ((CAN_T *) CAN2_BASE)
  417. #define CRPT ((CRPT_T *) CRPT_BASE)
  418. #define TRNG ((TRNG_T *) TRNG_BASE)
  419. #define SPIM ((volatile SPIM_T *) SPIM_BASE)
  420. #define DAC0 ((DAC_T *) DAC0_BASE)
  421. #define DAC1 ((DAC_T *) DAC1_BASE)
  422. #define USPI0 ((USPI_T *) USCI0_BASE) /*!< USPI0 Configuration Struct */
  423. #define USPI1 ((USPI_T *) USCI1_BASE) /*!< USPI1 Configuration Struct */
  424. #define OPA ((OPA_T *) OPA_BASE)
  425. #define UI2C0 ((UI2C_T *) USCI0_BASE) /*!< UI2C0 Configuration Struct */
  426. #define UI2C1 ((UI2C_T *) USCI1_BASE) /*!< UI2C1 Configuration Struct */
  427. #define UUART0 ((UUART_T *) USCI0_BASE) /*!< UUART0 Configuration Struct */
  428. #define UUART1 ((UUART_T *) USCI1_BASE) /*!< UUART1 Configuration Struct */
  429. #define CCAP ((CCAP_T *) CCAP_BASE)
  430. /*@}*/ /* end of group ERIPHERAL_DECLARATION */
  431. /** @addtogroup IO_ROUTINE I/O Routines
  432. The Declaration of I/O Routines
  433. @{
  434. */
  435. typedef volatile unsigned char vu8; ///< Define 8-bit unsigned volatile data type
  436. typedef volatile unsigned short vu16; ///< Define 16-bit unsigned volatile data type
  437. typedef volatile unsigned long vu32; ///< Define 32-bit unsigned volatile data type
  438. /**
  439. * @brief Get a 8-bit unsigned value from specified address
  440. * @param[in] addr Address to get 8-bit data from
  441. * @return 8-bit unsigned value stored in specified address
  442. */
  443. #define M8(addr) (*((vu8 *) (addr)))
  444. /**
  445. * @brief Get a 16-bit unsigned value from specified address
  446. * @param[in] addr Address to get 16-bit data from
  447. * @return 16-bit unsigned value stored in specified address
  448. * @note The input address must be 16-bit aligned
  449. */
  450. #define M16(addr) (*((vu16 *) (addr)))
  451. /**
  452. * @brief Get a 32-bit unsigned value from specified address
  453. * @param[in] addr Address to get 32-bit data from
  454. * @return 32-bit unsigned value stored in specified address
  455. * @note The input address must be 32-bit aligned
  456. */
  457. #define M32(addr) (*((vu32 *) (addr)))
  458. /**
  459. * @brief Set a 32-bit unsigned value to specified I/O port
  460. * @param[in] port Port address to set 32-bit data
  461. * @param[in] value Value to write to I/O port
  462. * @return None
  463. * @note The output port must be 32-bit aligned
  464. */
  465. #define outpw(port,value) *((volatile unsigned int *)(port)) = (value)
  466. /**
  467. * @brief Get a 32-bit unsigned value from specified I/O port
  468. * @param[in] port Port address to get 32-bit data from
  469. * @return 32-bit unsigned value stored in specified I/O port
  470. * @note The input port must be 32-bit aligned
  471. */
  472. #define inpw(port) (*((volatile unsigned int *)(port)))
  473. /**
  474. * @brief Set a 16-bit unsigned value to specified I/O port
  475. * @param[in] port Port address to set 16-bit data
  476. * @param[in] value Value to write to I/O port
  477. * @return None
  478. * @note The output port must be 16-bit aligned
  479. */
  480. #define outps(port,value) *((volatile unsigned short *)(port)) = (value)
  481. /**
  482. * @brief Get a 16-bit unsigned value from specified I/O port
  483. * @param[in] port Port address to get 16-bit data from
  484. * @return 16-bit unsigned value stored in specified I/O port
  485. * @note The input port must be 16-bit aligned
  486. */
  487. #define inps(port) (*((volatile unsigned short *)(port)))
  488. /**
  489. * @brief Set a 8-bit unsigned value to specified I/O port
  490. * @param[in] port Port address to set 8-bit data
  491. * @param[in] value Value to write to I/O port
  492. * @return None
  493. */
  494. #define outpb(port,value) *((volatile unsigned char *)(port)) = (value)
  495. /**
  496. * @brief Get a 8-bit unsigned value from specified I/O port
  497. * @param[in] port Port address to get 8-bit data from
  498. * @return 8-bit unsigned value stored in specified I/O port
  499. */
  500. #define inpb(port) (*((volatile unsigned char *)(port)))
  501. /**
  502. * @brief Set a 32-bit unsigned value to specified I/O port
  503. * @param[in] port Port address to set 32-bit data
  504. * @param[in] value Value to write to I/O port
  505. * @return None
  506. * @note The output port must be 32-bit aligned
  507. */
  508. #define outp32(port,value) *((volatile unsigned int *)(port)) = (value)
  509. /**
  510. * @brief Get a 32-bit unsigned value from specified I/O port
  511. * @param[in] port Port address to get 32-bit data from
  512. * @return 32-bit unsigned value stored in specified I/O port
  513. * @note The input port must be 32-bit aligned
  514. */
  515. #define inp32(port) (*((volatile unsigned int *)(port)))
  516. /**
  517. * @brief Set a 16-bit unsigned value to specified I/O port
  518. * @param[in] port Port address to set 16-bit data
  519. * @param[in] value Value to write to I/O port
  520. * @return None
  521. * @note The output port must be 16-bit aligned
  522. */
  523. #define outp16(port,value) *((volatile unsigned short *)(port)) = (value)
  524. /**
  525. * @brief Get a 16-bit unsigned value from specified I/O port
  526. * @param[in] port Port address to get 16-bit data from
  527. * @return 16-bit unsigned value stored in specified I/O port
  528. * @note The input port must be 16-bit aligned
  529. */
  530. #define inp16(port) (*((volatile unsigned short *)(port)))
  531. /**
  532. * @brief Set a 8-bit unsigned value to specified I/O port
  533. * @param[in] port Port address to set 8-bit data
  534. * @param[in] value Value to write to I/O port
  535. * @return None
  536. */
  537. #define outp8(port,value) *((volatile unsigned char *)(port)) = (value)
  538. /**
  539. * @brief Get a 8-bit unsigned value from specified I/O port
  540. * @param[in] port Port address to get 8-bit data from
  541. * @return 8-bit unsigned value stored in specified I/O port
  542. */
  543. #define inp8(port) (*((volatile unsigned char *)(port)))
  544. /*@}*/ /* end of group IO_ROUTINE */
  545. /******************************************************************************/
  546. /* Legacy Constants */
  547. /******************************************************************************/
  548. /** @addtogroup Legacy_Constants Legacy Constants
  549. Legacy Constants
  550. @{
  551. */
  552. #ifndef NULL
  553. #define NULL (0) ///< NULL pointer
  554. #endif
  555. #define TRUE (1UL) ///< Boolean true, define to use in API parameters or return value
  556. #define FALSE (0UL) ///< Boolean false, define to use in API parameters or return value
  557. #define ENABLE (1UL) ///< Enable, define to use in API parameters
  558. #define DISABLE (0UL) ///< Disable, define to use in API parameters
  559. /* Define one bit mask */
  560. #define BIT0 (0x00000001UL) ///< Bit 0 mask of an 32 bit integer
  561. #define BIT1 (0x00000002UL) ///< Bit 1 mask of an 32 bit integer
  562. #define BIT2 (0x00000004UL) ///< Bit 2 mask of an 32 bit integer
  563. #define BIT3 (0x00000008UL) ///< Bit 3 mask of an 32 bit integer
  564. #define BIT4 (0x00000010UL) ///< Bit 4 mask of an 32 bit integer
  565. #define BIT5 (0x00000020UL) ///< Bit 5 mask of an 32 bit integer
  566. #define BIT6 (0x00000040UL) ///< Bit 6 mask of an 32 bit integer
  567. #define BIT7 (0x00000080UL) ///< Bit 7 mask of an 32 bit integer
  568. #define BIT8 (0x00000100UL) ///< Bit 8 mask of an 32 bit integer
  569. #define BIT9 (0x00000200UL) ///< Bit 9 mask of an 32 bit integer
  570. #define BIT10 (0x00000400UL) ///< Bit 10 mask of an 32 bit integer
  571. #define BIT11 (0x00000800UL) ///< Bit 11 mask of an 32 bit integer
  572. #define BIT12 (0x00001000UL) ///< Bit 12 mask of an 32 bit integer
  573. #define BIT13 (0x00002000UL) ///< Bit 13 mask of an 32 bit integer
  574. #define BIT14 (0x00004000UL) ///< Bit 14 mask of an 32 bit integer
  575. #define BIT15 (0x00008000UL) ///< Bit 15 mask of an 32 bit integer
  576. #define BIT16 (0x00010000UL) ///< Bit 16 mask of an 32 bit integer
  577. #define BIT17 (0x00020000UL) ///< Bit 17 mask of an 32 bit integer
  578. #define BIT18 (0x00040000UL) ///< Bit 18 mask of an 32 bit integer
  579. #define BIT19 (0x00080000UL) ///< Bit 19 mask of an 32 bit integer
  580. #define BIT20 (0x00100000UL) ///< Bit 20 mask of an 32 bit integer
  581. #define BIT21 (0x00200000UL) ///< Bit 21 mask of an 32 bit integer
  582. #define BIT22 (0x00400000UL) ///< Bit 22 mask of an 32 bit integer
  583. #define BIT23 (0x00800000UL) ///< Bit 23 mask of an 32 bit integer
  584. #define BIT24 (0x01000000UL) ///< Bit 24 mask of an 32 bit integer
  585. #define BIT25 (0x02000000UL) ///< Bit 25 mask of an 32 bit integer
  586. #define BIT26 (0x04000000UL) ///< Bit 26 mask of an 32 bit integer
  587. #define BIT27 (0x08000000UL) ///< Bit 27 mask of an 32 bit integer
  588. #define BIT28 (0x10000000UL) ///< Bit 28 mask of an 32 bit integer
  589. #define BIT29 (0x20000000UL) ///< Bit 29 mask of an 32 bit integer
  590. #define BIT30 (0x40000000UL) ///< Bit 30 mask of an 32 bit integer
  591. #define BIT31 (0x80000000UL) ///< Bit 31 mask of an 32 bit integer
  592. /* Byte Mask Definitions */
  593. #define BYTE0_Msk (0x000000FFUL) ///< Mask to get bit0~bit7 from a 32 bit integer
  594. #define BYTE1_Msk (0x0000FF00UL) ///< Mask to get bit8~bit15 from a 32 bit integer
  595. #define BYTE2_Msk (0x00FF0000UL) ///< Mask to get bit16~bit23 from a 32 bit integer
  596. #define BYTE3_Msk (0xFF000000UL) ///< Mask to get bit24~bit31 from a 32 bit integer
  597. #define GET_BYTE0(u32Param) (((u32Param) & BYTE0_Msk) ) /*!< Extract Byte 0 (Bit 0~ 7) from parameter u32Param */
  598. #define GET_BYTE1(u32Param) (((u32Param) & BYTE1_Msk) >> 8) /*!< Extract Byte 1 (Bit 8~15) from parameter u32Param */
  599. #define GET_BYTE2(u32Param) (((u32Param) & BYTE2_Msk) >> 16) /*!< Extract Byte 2 (Bit 16~23) from parameter u32Param */
  600. #define GET_BYTE3(u32Param) (((u32Param) & BYTE3_Msk) >> 24) /*!< Extract Byte 3 (Bit 24~31) from parameter u32Param */
  601. /*@}*/ /* end of group Legacy_Constants */
  602. /******************************************************************************/
  603. /* Peripheral header files */
  604. /******************************************************************************/
  605. #include "nu_sys.h"
  606. #include "nu_clk.h"
  607. #include "nu_acmp.h"
  608. #include "nu_dac.h"
  609. #include "nu_emac.h"
  610. #include "nu_uart.h"
  611. #include "nu_usci_spi.h"
  612. #include "nu_gpio.h"
  613. #include "nu_ccap.h"
  614. #include "nu_ecap.h"
  615. #include "nu_qei.h"
  616. #include "nu_timer.h"
  617. #include "nu_timer_pwm.h"
  618. #include "nu_pdma.h"
  619. #include "nu_crypto.h"
  620. #include "nu_trng.h"
  621. #include "nu_fmc.h"
  622. #include "nu_spim.h"
  623. #include "nu_i2c.h"
  624. #include "nu_i2s.h"
  625. #include "nu_epwm.h"
  626. #include "nu_eadc.h"
  627. #include "nu_bpwm.h"
  628. #include "nu_wdt.h"
  629. #include "nu_wwdt.h"
  630. #include "nu_opa.h"
  631. #include "nu_crc.h"
  632. #include "nu_ebi.h"
  633. #include "nu_usci_i2c.h"
  634. #include "nu_scuart.h"
  635. #include "nu_sc.h"
  636. #include "nu_spi.h"
  637. #include "nu_qspi.h"
  638. #include "nu_can.h"
  639. #include "nu_rtc.h"
  640. #include "nu_usci_uart.h"
  641. #include "nu_sdh.h"
  642. #include "nu_usbd.h"
  643. #include "nu_hsusbd.h"
  644. #include "nu_otg.h"
  645. #include "nu_hsotg.h"
  646. #ifdef __cplusplus
  647. }
  648. #endif
  649. #endif /* __M480_H__ */