ap_cp.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. /**************************************************************************************************
  29. Filename: ap_cp.h
  30. Revised:
  31. Revision:
  32. Description: This file contains the SoC MCU relate definitions
  33. **************************************************************************************************/
  34. #ifndef __AP_CP_H__
  35. #define __AP_CP_H__
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. #ifdef CFG_CP
  40. #include "ARMCM0.h"
  41. #endif
  42. #ifdef CFG_AP
  43. #if defined (ARMCM4)
  44. #include "ARMCM4.h"
  45. #elif defined (ARMCM4_FP)
  46. #include "ARMCM4_FP.h"
  47. #else
  48. #error device not specified!
  49. #endif
  50. #endif
  51. /*******************************************************************************
  52. * TYPEDEFS
  53. */
  54. /******************************************************************************/
  55. /* Device Specific Peripheral registers structures */
  56. /******************************************************************************/
  57. typedef struct{
  58. __IO uint32_t CH0_AP_MBOX;
  59. __IO uint32_t CH0_CP_MBOX;
  60. __IO uint32_t CH1_AP_MBOX;
  61. __IO uint32_t CH1_CP_MBOX;
  62. __IO uint32_t AP_STATUS;
  63. __IO uint32_t CP_STATUS;
  64. __IO uint32_t AP_INTEN;
  65. __IO uint32_t CP_INTEN;
  66. __IO uint32_t remap;
  67. __IO uint32_t RXEV_EN;
  68. __IO uint32_t STCALIB;
  69. __IO uint32_t PERI_MASTER_SELECT;
  70. }AP_COM_TypeDef;
  71. typedef struct
  72. {
  73. __IO uint8_t CR; //0x0
  74. uint8_t RESERVED0[3];
  75. __IO uint32_t TORR; //0x4
  76. __O uint32_t CCVR; //0x8
  77. __IO uint32_t CRR; //0xc
  78. uint8_t STAT; //0x10
  79. uint8_t reserverd1[3];
  80. __IO uint8_t EOI; //0x14
  81. uint8_t reserverd2[3];
  82. } AP_WDT_TypeDef;
  83. typedef struct
  84. {
  85. __IO uint32_t RESET; //0x0
  86. __IO uint32_t RESET1; //0x4
  87. __IO uint32_t CLKG; //0x8
  88. __IO uint32_t RESET2; //0xc
  89. __IO uint32_t RESET3; //0x10
  90. __IO uint32_t CLKG1; //0x14
  91. __IO uint32_t APB_CLK; //0x18
  92. __IO uint32_t APB_CLK_U; //0x1c
  93. } AP_PCR_TypeDef;
  94. typedef struct
  95. {
  96. __IO uint32_t LoadCount; //0x0
  97. __IO uint32_t CurrentCount; //0x4
  98. __IO uint32_t ControlReg; //0x8
  99. __IO uint32_t EOI; //0xc
  100. __IO uint32_t status; //0x10
  101. } AP_TIM_TypeDef;
  102. typedef struct
  103. {
  104. __IO uint32_t IntStatus;
  105. __IO uint32_t EOI;
  106. __IO uint32_t unMaskIntStatus;
  107. __IO uint32_t version;
  108. } AP_TIM_SYS_TypeDef;
  109. #if defined ( __CC_ARM )
  110. #pragma anon_unions
  111. #endif
  112. /*------------- Universal Asynchronous Receiver Transmitter (UARTx) -----------*/
  113. typedef struct
  114. {
  115. union
  116. {
  117. __I uint8_t RBR;
  118. __IO uint8_t THR;
  119. __IO uint8_t DLL;
  120. uint32_t RESERVED0; //0x0
  121. };
  122. union
  123. {
  124. __IO uint8_t DLM;
  125. __IO uint32_t IER; //0x4
  126. };
  127. union
  128. {
  129. __I uint32_t IIR; //0x8
  130. __IO uint8_t FCR;
  131. };
  132. __IO uint8_t LCR; //0xc
  133. uint8_t RESERVED1[3];//Reserved
  134. __IO uint32_t MCR; //0x10
  135. __I uint8_t LSR; //0x14
  136. uint8_t RESERVED2[3];//Reserved
  137. __IO uint32_t MSR; //0x18
  138. __IO uint8_t SCR; //0x1c
  139. uint8_t RESERVED3[3];//Reserved
  140. __IO uint32_t LPDLL; //0x20
  141. __IO uint32_t LPDLH; //0x24
  142. __IO uint32_t recerved[2];
  143. union
  144. {
  145. __IO uint32_t SRBR[16]; // 0x30~60xc
  146. __IO uint32_t STHR[16];
  147. };
  148. __IO uint32_t FAR; //0x70
  149. __IO uint32_t TFR; //0x74
  150. __IO uint32_t RFW; // 0x78
  151. __IO uint32_t USR; // 0x7c
  152. __IO uint32_t TFL;
  153. __IO uint32_t RFL;
  154. __IO uint32_t SRR;
  155. __IO uint32_t SRTS;
  156. __IO uint32_t SBCR;
  157. __IO uint32_t SDMAM;
  158. __IO uint32_t SFE;
  159. __IO uint32_t SRT;
  160. __IO uint32_t STET; //0xa0
  161. __IO uint32_t HTX;
  162. __IO uint32_t DMASA; //0xa8
  163. __IO uint32_t reserved[18];
  164. __IO uint32_t CPR; //0xf4
  165. __IO uint32_t UCV;
  166. __IO uint32_t CTR;
  167. }AP_UART_TypeDef;
  168. /*------------- Inter-Integrated Circuit (I2C) setup by zjp-------------------------------*/
  169. typedef struct
  170. {
  171. __IO uint32_t IC_CON;
  172. __IO uint32_t IC_TAR;
  173. __IO uint32_t IC_SAR;
  174. __IO uint32_t IC_HS_MADDR;
  175. __IO uint32_t IC_DATA_CMD; //0x10
  176. __IO uint32_t IC_SS_SCL_HCNT;
  177. __IO uint32_t IC_SS_SCL_LCNT;
  178. __IO uint32_t IC_FS_SCL_HCNT;
  179. __IO uint32_t IC_FS_SCL_LCNT; //0x20
  180. __IO uint32_t IC_HS_SCL_HCNT;
  181. __IO uint32_t IC_HS_SCL_LCNT;
  182. __IO uint32_t IC_INTR_STAT;
  183. __IO uint32_t IC_INTR_MASK; //0x30
  184. __IO uint32_t IC_RAW_INTR_STAT;
  185. __IO uint32_t IC_RX_TL;
  186. __IO uint32_t IC_TX_TL;
  187. __IO uint32_t IC_CLR_INTR; //0x40
  188. __IO uint32_t IC_CLR_UNDER;
  189. __IO uint32_t IC_CLR_RX_OVER;
  190. __IO uint32_t IC_CLR_TX_OVER;
  191. __IO uint32_t IC_CLR_RD_REG; //0x50
  192. __IO uint32_t IC_CLR_TX_ABRT;
  193. __IO uint32_t IC_CLR_RX_DONE;
  194. __IO uint32_t IC_CLR_ACTIVITY;
  195. __IO uint32_t IC_CLR_STOP_DET; //0x60
  196. __IO uint32_t IC_CLR_START_DET;
  197. __IO uint32_t IC_CLR_GEN_CALL;
  198. __IO uint32_t IC_ENABLE;
  199. __IO uint32_t IC_STATUS; //0x70
  200. __IO uint32_t IC_TXFLR;
  201. __IO uint32_t IC_RXFLR;
  202. __IO uint32_t IC_SDA_HOLD;
  203. __IO uint32_t IC_TX_ABRT_SOURCE; //0x80
  204. __IO uint32_t IC_SLV_DATA_NACK_ONLY;
  205. __IO uint32_t IC_DMA_CR;
  206. __IO uint32_t IC_DMA_TDLR;
  207. __IO uint32_t IC_DMA_RDLR; //0x90
  208. __IO uint32_t IC_SDA_SETUP;
  209. __IO uint32_t IC_ACK_GENERAL_CALL;
  210. __IO uint32_t IC_ENABLE_STATUS;
  211. __IO uint32_t IC_FS_SPKLEN; //0xa0
  212. __IO uint32_t IC_HS_SPKLEN;
  213. } AP_I2C_TypeDef;
  214. /*------------- Inter IC Sound (I2S) -----------------------------------------*/
  215. typedef struct
  216. {
  217. __IO uint32_t IER;
  218. __IO uint32_t IRER;
  219. __IO uint32_t ITER;
  220. __IO uint32_t CER;
  221. __IO uint32_t CCR;
  222. __IO uint32_t RXFFR;
  223. __IO uint32_t TXFFR;
  224. }AP_I2S_BLOCK_TypeDef;
  225. typedef struct
  226. {
  227. union{
  228. __IO uint32_t LRBR; //0x20
  229. __IO uint32_t LTHR; //0x20
  230. };
  231. union{
  232. __IO uint32_t RRBR; // 0x24
  233. __IO uint32_t RTHR; //0x24
  234. };
  235. __IO uint32_t RER; //0x28
  236. __IO uint32_t TER; //0x2c
  237. __IO uint32_t RCR; //0x30
  238. __IO uint32_t TCR; //0x34
  239. __IO uint32_t ISR; //0x38
  240. __IO uint32_t IMR; //0x3c
  241. __IO uint32_t ROR; //0x40
  242. __IO uint32_t TOR; //0x44
  243. __IO uint32_t RFCR; //0x48
  244. __IO uint32_t TFCR; //0x4c
  245. __IO uint32_t RFF; //0x50
  246. __IO uint32_t TFF; //0x54
  247. } AP_I2S_TypeDef;
  248. /*------------- General Purpose Input/Output (GPIO) --------------------------*/
  249. typedef struct
  250. {
  251. __IO uint32_t swporta_dr; //0x00
  252. __IO uint32_t swporta_ddr; //0x04
  253. __IO uint32_t swporta_ctl; //0x08
  254. __IO uint32_t swportb_dr; //0x0c
  255. __IO uint32_t swportb_ddr; //0x10
  256. __IO uint32_t swportb_ctl; //0x14
  257. uint32_t reserved8[6]; //0x18-0x2c portC&D
  258. __IO uint32_t inten; //0x30
  259. __IO uint32_t intmask; //0x34
  260. __IO uint32_t inttype_level; //0x38
  261. __IO uint32_t int_polarity; //0x3c
  262. __I uint32_t int_status; //0x40
  263. __IO uint32_t raw_instatus; //0x44
  264. __IO uint32_t debounce; //0x48
  265. __O uint32_t porta_eoi; //0x4c
  266. __I uint32_t ext_porta; //0x50
  267. __I uint32_t ext_portb; //0x54
  268. uint32_t reserved9[2]; //0x58 0x5c
  269. __IO uint32_t ls_sync; //0x60
  270. __I uint32_t id_code; //0x64
  271. uint32_t reserved10[1]; //0x68
  272. __I uint32_t ver_id_code; //0x6c
  273. __I uint32_t config_reg2; //0x70
  274. __I uint32_t config_reg1; //0x74
  275. } AP_GPIO_TypeDef;
  276. /*-------------------- (SPI) --------------------------------*/
  277. typedef struct
  278. {
  279. __IO uint16_t CR0; //0x0 /*!< Offset: 0x000 Control Register 0 (R/W) */
  280. uint16_t reserved1;
  281. __IO uint16_t CR1; //0x04 /*!< Offset: 0x004 Control Register 1 (R/W) */
  282. uint16_t reserved2;
  283. __IO uint8_t SSIEN; //0x08
  284. uint8_t reserved3[3];
  285. __IO uint8_t MWCR; // 0x0c
  286. uint8_t reserved4[3];
  287. __IO uint8_t SER; //0x10
  288. uint8_t reserved5[3];
  289. __IO uint16_t BAUDR; //0x14
  290. uint16_t reserved6;
  291. __IO uint32_t TXFTLR; //0x18
  292. __IO uint32_t RXFTLR; //0x1c
  293. __O uint32_t TXFLR; //0x20
  294. __O uint32_t RXFLR; //0x24
  295. __IO uint8_t SR; //0x28
  296. uint8_t reserved7[3];
  297. __IO uint32_t IMR; //0x2c
  298. __IO uint32_t ISR; //0x30
  299. __IO uint32_t RISR; //0x34
  300. __IO uint32_t TXOICR; //0x38
  301. __IO uint32_t RXOICR; //0x3c
  302. __IO uint32_t RXUICR; //0x40
  303. __IO uint32_t MSTICR; //0x44
  304. __IO uint32_t ICR; //0x48
  305. __IO uint32_t DMACR; //0x4c
  306. __IO uint32_t DMATDLR; //0x50
  307. __IO uint32_t DMARDLR; //0x54
  308. __IO uint32_t IDR; //0x5c
  309. __IO uint32_t SSI_COM_VER; //0x5c
  310. __IO uint32_t DataReg;
  311. } AP_SSI_TypeDef;
  312. typedef struct{
  313. __IO uint32_t Analog_IO_en;
  314. __IO uint32_t SPI_debug_en;
  315. __IO uint32_t debug_mux_en;
  316. __IO uint32_t full_mux0_en; // 0xc
  317. __IO uint32_t full_mux1_en; // 0x10
  318. __IO uint32_t gpio_pad_en;
  319. __IO uint32_t gpio_0_3_sel;
  320. __IO uint32_t gpio_4_7_sel;
  321. __IO uint32_t gpio_8_11_sel; //0x20
  322. __IO uint32_t gpio_12_15_sel;
  323. __IO uint32_t gpio_16_19_sel;
  324. __IO uint32_t gpio_20_23_sel;
  325. __IO uint32_t gpio_24_27_sel; //0x30
  326. __IO uint32_t gpio_28_31_sel;
  327. __IO uint32_t gpio_32_34_sel;
  328. __IO uint32_t pad_pe0;
  329. __IO uint32_t pad_pe1; //0x40
  330. __IO uint32_t pad_ps0;
  331. __IO uint32_t pad_ps1;
  332. __IO uint32_t keyscan_in_en;
  333. __IO uint32_t keyscan_out_en; //0x50
  334. }IOMUX_TypeDef;
  335. typedef struct{
  336. __IO uint32_t PWROFF; //0x00
  337. __IO uint32_t PWRSLP; //0x04
  338. __IO uint32_t IOCTL0; //0x08
  339. __IO uint32_t IOCTL1; // 0x0c
  340. __IO uint32_t IOCTL2; // 0x10
  341. __IO uint32_t PMCTL0; // 0x14
  342. __IO uint32_t PMCTL1; //0x18
  343. __IO uint32_t PMCTL2_0; //0x1c
  344. __IO uint32_t PMCTL2_1; //0x20
  345. }AP_AON_TypeDef;
  346. typedef struct{
  347. __IO uint32_t RTCCTL; //0x24
  348. __IO uint32_t RTCCNT; //0x28
  349. __IO uint32_t RTCCC0; //0x2c
  350. __IO uint32_t RTCCC1; //0x30
  351. __IO uint32_t RTCCC2; //0x34
  352. __IO uint32_t RTCFLAG; //0x38
  353. }AP_RTC_TypeDef;
  354. typedef struct{
  355. __IO uint32_t io_wu_mask_31_0; //0xa0
  356. __IO uint32_t io_wu_mask_34_32; //0xa4
  357. }AP_Wakeup_TypeDef;
  358. typedef struct{
  359. __IO uint32_t CLKSEL; //0x3c
  360. __IO uint32_t CLKHF_CTL0; //0x40
  361. __IO uint32_t CLKHF_CTL1; //0x44
  362. __IO uint32_t ANA_CTL; //0x48
  363. __IO uint32_t mem_0_1_dvs; //0x4c
  364. __IO uint32_t mem_2_3_4_dvs; //0x50
  365. __IO uint32_t efuse_cfg; //0x54
  366. __IO uint32_t chip_state; //0x58
  367. __IO uint32_t cal_rw; //0x58
  368. __IO uint32_t cal_ro0; //0x5c
  369. __IO uint32_t cal_ro1; //0x60
  370. __IO uint32_t cal_ro2; //0x64
  371. __IO uint32_t ADC_CTL0; //0x68
  372. __IO uint32_t ADC_CTL1; //0x6c
  373. __IO uint32_t ADC_CTL2; //0x70
  374. __IO uint32_t ADC_CTL3; //0x74
  375. __IO uint32_t ADC_CTL4; //0x7c
  376. }AP_PCRM_TypeDef;
  377. typedef struct{
  378. __IO uint32_t enable; //0
  379. __IO uint32_t reserve[2]; //4~8
  380. __IO uint32_t control_1; //c
  381. __IO uint32_t control_2; //10
  382. __IO uint32_t control_3; //14
  383. __IO uint32_t control_4; //18
  384. __IO uint32_t reserve1[6]; //1c~30
  385. __IO uint32_t intr_mask; //34
  386. __IO uint32_t intr_clear; //38
  387. __IO uint32_t intr_status; //3c
  388. }AP_ADCC_TypeDef;
  389. #if defined ( __CC_ARM )
  390. #pragma no_anon_unions
  391. #endif
  392. /******************************************************************************/
  393. /* Peripheral memory map(AP) */
  394. /******************************************************************************/
  395. /* Base addresses */
  396. #define AP_APB0_BASE (0x40000000UL)
  397. #define AP_APB1_BASE (0x40020000UL)
  398. #define AP_APB2_BASE (0x4000F000UL)
  399. /* APB0 peripherals */
  400. #define AP_PCR_BASE (AP_APB0_BASE + 0x0000)
  401. #define AP_TIM1_BASE (AP_APB0_BASE + 0x1000)
  402. #define AP_TIM2_BASE (AP_APB0_BASE + 0x1014)
  403. #define AP_TIM3_BASE (AP_APB0_BASE + 0x1028)
  404. #define AP_TIM4_BASE (AP_APB0_BASE + 0x103c)
  405. #define AP_TIM_SYS_BASE (AP_APB0_BASE + 0x10a0)
  406. #define AP_WDT_BASE (AP_APB0_BASE + 0x2000)
  407. #define AP_COM_BASE (AP_APB0_BASE + 0x3000)
  408. #define AP_IOMUX_BASE (AP_APB0_BASE + 0x3800)
  409. #define AP_UART0_BASE (AP_APB0_BASE + 0x4000)
  410. #define AP_I2C0_BASE (AP_APB0_BASE + 0x5000)
  411. #define AP_I2C1_BASE (AP_APB0_BASE + 0x5800)
  412. #define AP_SPI0_BASE (AP_APB0_BASE + 0x6000)
  413. #define AP_SPI1_BASE (AP_APB0_BASE + 0x7000)
  414. #define AP_GPIOA_BASE (AP_APB0_BASE + 0x8000)
  415. #define AP_GPIOB_BASE (AP_APB0_BASE + 0x8080)
  416. #define AP_I2S_BASE (AP_APB0_BASE + 0x9000)
  417. #define AP_DMIC_BASE (AP_APB0_BASE + 0xA000)
  418. #define AP_QDEC_BASE (AP_APB0_BASE + 0xB000)
  419. #define AP_RNG_BASE (AP_APB0_BASE + 0xC000)
  420. #define AP_PWM_BASE (AP_APB0_BASE + 0xE000)
  421. #define AP_AON_BASE (AP_APB0_BASE + 0xF000)
  422. #define AP_RTC_BASE (AP_APB0_BASE + 0xF024)
  423. #define AP_PCRM_BASE (AP_APB0_BASE + 0xF03c)
  424. #define AP_WAKEUP_BASE (AP_APB0_BASE + 0xF0a0)
  425. #define SRAM0_BASE_ADDRESS 0x1FFF0000
  426. #define SRAM1_BASE_ADDRESS 0x1FFF8000
  427. #define SRAM2_BASE_ADDRESS 0x20000000
  428. #define SRAM3_BASE_ADDRESS 0x20010000
  429. #define SRAM4_BASE_ADDRESS 0x20012000
  430. #define FLASH_BASE_ADDR 0x11000000
  431. #define PCR_BASE_ADDR 0x40000000
  432. #define PCRM_BASE_ADDR 0x4000F000
  433. #define IOMUX_BASE_ADDR 0x40003800
  434. #define AON_BASE_ADDR 0x4000F000
  435. #define COM_BASE_ADDR 0x40003000
  436. #define AES_BASE_ADDR 0x40040000
  437. #define ADCC_BASE_ADDR 0x40050000
  438. #define BBTOP_BASE_ADDR 0x40030000
  439. #define LL_BASE_ADDR 0x40031000
  440. #define PWM_BASE_ADDR 0x400E0000
  441. #define KSCAN_BASE_ADDR 0x40024000
  442. #define QDEC_BASE_ADDR 0x4000B000
  443. #define RNG_BASE_ADDR 0x4000C000
  444. /////////////////////////////////////////////////////////////
  445. #define AP_PCR ((AP_PCR_TypeDef *) AP_PCR_BASE )
  446. #define AP_WDT ((AP_WDT_TypeDef *) AP_WDT_BASE )
  447. #define AP_COM ((AP_COM_TypeDef *) AP_COM_BASE)
  448. #define AP_TIM1 ((AP_TIM_TypeDef *) AP_TIM1_BASE )
  449. #define AP_TIM2 ((AP_TIM_TypeDef *) AP_TIM2_BASE )
  450. #define AP_TIM3 ((AP_TIM_TypeDef *) AP_TIM3_BASE )
  451. #define AP_TIM4 ((AP_TIM_TypeDef *) AP_TIM4_BASE )
  452. #define AP_TIMS ((AP_TIM_SYS_TypeDef *) AP_TIM_SYS_BASE )
  453. #define AP_IOMUX ((IOMUX_TypeDef *) AP_IOMUX_BASE)
  454. #define AP_SPI0 ((AP_SSI_TypeDef *) AP_SPI0_BASE)
  455. #define AP_SPI1 ((AP_SSI_TypeDef *) AP_SPI1_BASE)
  456. #define AP_UART0 ((AP_UART_TypeDef *) AP_UART0_BASE)
  457. #define AP_I2C0 ((AP_I2C_TypeDef *) AP_I2C0_BASE)
  458. #define AP_I2C1 ((AP_I2C_TypeDef *) AP_I2C1_BASE)
  459. #define AP_I2S_BLOCK ((AP_I2S_BLOCK_TypeDef *) AP_I2S_BASE)
  460. #define AP_I2S0 ((AP_I2S_TypeDef *) (AP_I2S_BASE+0x20))
  461. #define AP_RTC ((AP_RTC_TypeDef *) AP_RTC_BASE)
  462. #define AP_GPIOA ((AP_GPIO_TypeDef *) AP_GPIOA_BASE )
  463. #define AP_AON ((AP_AON_TypeDef *) AP_AON_BASE)
  464. #define AP_PCRM ((AP_PCRM_TypeDef *) AP_PCRM_BASE)
  465. #define AP_WAKEUP ((AP_Wakeup_TypeDef*) AP_WAKEUP_BASE)
  466. #define AP_ADCC ((AP_ADCC_TypeDef *) ADCC_BASE_ADDR)
  467. #define I2S_COMP_VER (unsigned int *)(AP_I2S_BASE+0x1f8)
  468. #define I2S_COMP_TYPE (unsigned int *)(AP_I2S_BASE+0x1fc)
  469. #define I2S_COM_PARA1 (unsigned int *)(AP_I2S_BASE+0x1f4)
  470. #define I2S_COM_PARA2 (unsigned int *)(AP_I2S_BASE+0x1f0)
  471. #define AP_STATUS1_REG (unsigned int *) 0x40003010
  472. #define AP_STATUS2_REG (unsigned int *) 0x40003014
  473. #define AP_EVENT_REC_REG (unsigned int *) 0x40003024
  474. #define AP_STCALIB (unsigned int *) 0x40003028
  475. #define AP_PERI_MASTER_SELECT *(volatile unsigned int *)0x4000302C
  476. /******************************************************************************/
  477. /* Peripheral memory map(CP) */
  478. /******************************************************************************/
  479. /* Base addresses */
  480. #define CP_PCR_BASE (0x40020000UL) // change from 0x40020000UL to 0x40000000UL by HZF
  481. #define CP_TIM1_BASE (0x40021000UL)
  482. #define CP_TIM2_BASE (0x40021014UL)
  483. #define CP_TIM3_BASE (0x40021028UL)
  484. #define CP_TIM4_BASE (0x4002103cUL)
  485. #define CP_TIM_SYS_BASE (0x400210a0UL)
  486. #define CP_WDT_BASE (0x40022000UL)
  487. #define CP_COM_BASE (0x40023000UL)
  488. #define CP_BASEBAND_BASE (0x40030000UL)
  489. #define CP_PCR ((AP_PCR_TypeDef *) CP_PCR_BASE )
  490. #define CP_WDT ((AP_WDT_TypeDef *) CP_WDT_BASE )
  491. #define CP_TIM1 ((AP_TIM_TypeDef *) CP_TIM1_BASE )
  492. #define CP_TIM2 ((AP_TIM_TypeDef *) CP_TIM2_BASE )
  493. #define CP_TIM3 ((AP_TIM_TypeDef *) CP_TIM3_BASE )
  494. #define CP_TIM4 ((AP_TIM_TypeDef *) CP_TIM4_BASE )
  495. #define CP_TIMS ((AP_TIM_SYS_TypeDef *) CP_TIM_SYS_BASE )
  496. #define CP_COM ((AP_COM_TypeDef *) CP_COM_BASE)
  497. #define CP_STATUS1_REG (unsigned int *) 0x40023010
  498. #define CP_STATUS2_REG (unsigned int *) 0x40023014
  499. #define CP_EVENT_REC_REG (unsigned int *) 0x40023024
  500. #define CP_STCALIB (unsigned int *) 0x40023028
  501. #define CP_PERI_MASTER_SELECT (unsigned int *) 0x4002302C
  502. #define PM_BASE 0x4000F000
  503. //////////////////////////////////////////////////////////
  504. #define M0_ONLY 1
  505. #define M4_ONLY 2
  506. #define COMBO 3
  507. #define IRQ_PRIO_REALTIME 0
  508. #define IRQ_PRIO_HIGH 1
  509. #define IRQ_PRIO_HAL 2
  510. #define IRQ_PRIO_THREAD 3
  511. #define IRQ_PRIO_APP 3
  512. enum{
  513. APCOM_CP_IPC_IRQ = 0,
  514. CPCOM_CP_IPC_IRQ = 1,
  515. CP_TIMER_IRQ = 2,
  516. CP_WDT_IRQ = 3,
  517. BB_IRQ = 4,
  518. KSCAN_IRQ = 5,
  519. RTC_IRQ = 6,
  520. CPCOM_AP_IPC_IRQ = 7,
  521. APCOM_AP_IPC_IRQ = 8,
  522. TIMER_IRQ = 9,
  523. WDT_IRQ = 10,
  524. UART_IRQ = 11,
  525. I2C0_IRQ = 12,
  526. I2C1_IRQ = 13,
  527. SPI0_IRQ = 14,
  528. SPI1_IRQ = 15,
  529. GPIO_IRQ = 16,
  530. I2S_IRQ = 17,
  531. SPIF_IRQ = 18,
  532. DMAC_INTR_IRQ = 19,
  533. DMAC_INTTC_IRQ = 20,
  534. DMAC_INTERR_IRQ = 21,
  535. FPIDC_IRQ = 22,
  536. FPDZC_IRQ = 23,
  537. FPIOC_IRQ = 24,
  538. FPUFC_IRQ = 25,
  539. FPOFC_IRQ = 26,
  540. FPIXC_IRQ = 27,
  541. AES_IRQ = 28,
  542. ADCC_IRQ = 29,
  543. QDEC_IRQ = 30,
  544. RNG_IRQ = 31
  545. };
  546. #endif