123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681 |
-
- #ifndef __AP_CP_H__
- #define __AP_CP_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifdef CFG_CP
- #include "ARMCM0.h"
- #endif
- #ifdef CFG_AP
- #if defined (ARMCM4)
- #include "ARMCM4.h"
- #elif defined (ARMCM4_FP)
- #include "ARMCM4_FP.h"
- #else
- #error device not specified!
- #endif
- #endif
- typedef struct{
- __IO uint32_t CH0_AP_MBOX;
- __IO uint32_t CH0_CP_MBOX;
- __IO uint32_t CH1_AP_MBOX;
- __IO uint32_t CH1_CP_MBOX;
- __IO uint32_t AP_STATUS;
- __IO uint32_t CP_STATUS;
- __IO uint32_t AP_INTEN;
- __IO uint32_t CP_INTEN;
- __IO uint32_t remap;
- __IO uint32_t RXEV_EN;
- __IO uint32_t STCALIB;
- __IO uint32_t PERI_MASTER_SELECT;
- }AP_COM_TypeDef;
- typedef struct
- {
- __IO uint8_t CR;
- uint8_t RESERVED0[3];
- __IO uint32_t TORR;
- __O uint32_t CCVR;
- __IO uint32_t CRR;
- uint8_t STAT;
- uint8_t reserverd1[3];
- __IO uint8_t EOI;
- uint8_t reserverd2[3];
- } AP_WDT_TypeDef;
- typedef struct
- {
- __IO uint32_t RESET;
- __IO uint32_t RESET1;
- __IO uint32_t CLKG;
- __IO uint32_t RESET2;
- __IO uint32_t RESET3;
- __IO uint32_t CLKG1;
- __IO uint32_t APB_CLK;
- __IO uint32_t APB_CLK_U;
-
- } AP_PCR_TypeDef;
- typedef struct
- {
- __IO uint32_t LoadCount;
- __IO uint32_t CurrentCount;
- __IO uint32_t ControlReg;
- __IO uint32_t EOI;
- __IO uint32_t status;
-
- } AP_TIM_TypeDef;
- typedef struct
- {
- __IO uint32_t IntStatus;
- __IO uint32_t EOI;
- __IO uint32_t unMaskIntStatus;
- __IO uint32_t version;
- } AP_TIM_SYS_TypeDef;
- #if defined ( __CC_ARM )
- #pragma anon_unions
- #endif
- typedef struct
- {
- union
- {
- __I uint8_t RBR;
- __IO uint8_t THR;
- __IO uint8_t DLL;
- uint32_t RESERVED0;
- };
- union
- {
- __IO uint8_t DLM;
- __IO uint32_t IER;
- };
- union
- {
- __I uint32_t IIR;
- __IO uint8_t FCR;
- };
- __IO uint8_t LCR;
- uint8_t RESERVED1[3];
- __IO uint32_t MCR;
-
- __I uint8_t LSR;
- uint8_t RESERVED2[3];
- __IO uint32_t MSR;
-
- __IO uint8_t SCR;
- uint8_t RESERVED3[3];
-
- __IO uint32_t LPDLL;
-
- __IO uint32_t LPDLH;
-
- __IO uint32_t recerved[2];
-
- union
- {
- __IO uint32_t SRBR[16];
- __IO uint32_t STHR[16];
- };
- __IO uint32_t FAR;
-
- __IO uint32_t TFR;
-
- __IO uint32_t RFW;
-
- __IO uint32_t USR;
-
- __IO uint32_t TFL;
-
- __IO uint32_t RFL;
-
- __IO uint32_t SRR;
-
- __IO uint32_t SRTS;
-
- __IO uint32_t SBCR;
-
- __IO uint32_t SDMAM;
-
- __IO uint32_t SFE;
-
- __IO uint32_t SRT;
-
- __IO uint32_t STET;
-
- __IO uint32_t HTX;
-
- __IO uint32_t DMASA;
-
- __IO uint32_t reserved[18];
-
- __IO uint32_t CPR;
-
- __IO uint32_t UCV;
-
- __IO uint32_t CTR;
- }AP_UART_TypeDef;
- typedef struct
- {
- __IO uint32_t IC_CON;
- __IO uint32_t IC_TAR;
- __IO uint32_t IC_SAR;
- __IO uint32_t IC_HS_MADDR;
- __IO uint32_t IC_DATA_CMD;
- __IO uint32_t IC_SS_SCL_HCNT;
- __IO uint32_t IC_SS_SCL_LCNT;
- __IO uint32_t IC_FS_SCL_HCNT;
- __IO uint32_t IC_FS_SCL_LCNT;
- __IO uint32_t IC_HS_SCL_HCNT;
- __IO uint32_t IC_HS_SCL_LCNT;
- __IO uint32_t IC_INTR_STAT;
- __IO uint32_t IC_INTR_MASK;
- __IO uint32_t IC_RAW_INTR_STAT;
- __IO uint32_t IC_RX_TL;
- __IO uint32_t IC_TX_TL;
- __IO uint32_t IC_CLR_INTR;
- __IO uint32_t IC_CLR_UNDER;
- __IO uint32_t IC_CLR_RX_OVER;
- __IO uint32_t IC_CLR_TX_OVER;
- __IO uint32_t IC_CLR_RD_REG;
- __IO uint32_t IC_CLR_TX_ABRT;
- __IO uint32_t IC_CLR_RX_DONE;
- __IO uint32_t IC_CLR_ACTIVITY;
- __IO uint32_t IC_CLR_STOP_DET;
- __IO uint32_t IC_CLR_START_DET;
- __IO uint32_t IC_CLR_GEN_CALL;
- __IO uint32_t IC_ENABLE;
- __IO uint32_t IC_STATUS;
- __IO uint32_t IC_TXFLR;
- __IO uint32_t IC_RXFLR;
- __IO uint32_t IC_SDA_HOLD;
- __IO uint32_t IC_TX_ABRT_SOURCE;
- __IO uint32_t IC_SLV_DATA_NACK_ONLY;
- __IO uint32_t IC_DMA_CR;
- __IO uint32_t IC_DMA_TDLR;
- __IO uint32_t IC_DMA_RDLR;
- __IO uint32_t IC_SDA_SETUP;
- __IO uint32_t IC_ACK_GENERAL_CALL;
- __IO uint32_t IC_ENABLE_STATUS;
- __IO uint32_t IC_FS_SPKLEN;
- __IO uint32_t IC_HS_SPKLEN;
-
- } AP_I2C_TypeDef;
- typedef struct
- {
- __IO uint32_t IER;
- __IO uint32_t IRER;
- __IO uint32_t ITER;
- __IO uint32_t CER;
- __IO uint32_t CCR;
- __IO uint32_t RXFFR;
- __IO uint32_t TXFFR;
-
- }AP_I2S_BLOCK_TypeDef;
- typedef struct
- {
- union{
- __IO uint32_t LRBR;
- __IO uint32_t LTHR;
- };
- union{
- __IO uint32_t RRBR;
- __IO uint32_t RTHR;
- };
- __IO uint32_t RER;
- __IO uint32_t TER;
- __IO uint32_t RCR;
- __IO uint32_t TCR;
- __IO uint32_t ISR;
- __IO uint32_t IMR;
- __IO uint32_t ROR;
- __IO uint32_t TOR;
- __IO uint32_t RFCR;
- __IO uint32_t TFCR;
- __IO uint32_t RFF;
- __IO uint32_t TFF;
-
- } AP_I2S_TypeDef;
- typedef struct
- {
- __IO uint32_t swporta_dr;
- __IO uint32_t swporta_ddr;
- __IO uint32_t swporta_ctl;
- __IO uint32_t swportb_dr;
- __IO uint32_t swportb_ddr;
- __IO uint32_t swportb_ctl;
- uint32_t reserved8[6];
- __IO uint32_t inten;
- __IO uint32_t intmask;
- __IO uint32_t inttype_level;
- __IO uint32_t int_polarity;
- __I uint32_t int_status;
- __IO uint32_t raw_instatus;
- __IO uint32_t debounce;
- __O uint32_t porta_eoi;
- __I uint32_t ext_porta;
- __I uint32_t ext_portb;
- uint32_t reserved9[2];
- __IO uint32_t ls_sync;
- __I uint32_t id_code;
- uint32_t reserved10[1];
- __I uint32_t ver_id_code;
- __I uint32_t config_reg2;
- __I uint32_t config_reg1;
- } AP_GPIO_TypeDef;
- typedef struct
- {
- __IO uint16_t CR0;
- uint16_t reserved1;
- __IO uint16_t CR1;
- uint16_t reserved2;
- __IO uint8_t SSIEN;
- uint8_t reserved3[3];
- __IO uint8_t MWCR;
- uint8_t reserved4[3];
- __IO uint8_t SER;
- uint8_t reserved5[3];
- __IO uint16_t BAUDR;
- uint16_t reserved6;
- __IO uint32_t TXFTLR;
- __IO uint32_t RXFTLR;
- __O uint32_t TXFLR;
- __O uint32_t RXFLR;
-
- __IO uint8_t SR;
- uint8_t reserved7[3];
- __IO uint32_t IMR;
- __IO uint32_t ISR;
- __IO uint32_t RISR;
- __IO uint32_t TXOICR;
- __IO uint32_t RXOICR;
- __IO uint32_t RXUICR;
- __IO uint32_t MSTICR;
- __IO uint32_t ICR;
- __IO uint32_t DMACR;
- __IO uint32_t DMATDLR;
- __IO uint32_t DMARDLR;
- __IO uint32_t IDR;
- __IO uint32_t SSI_COM_VER;
- __IO uint32_t DataReg;
-
- } AP_SSI_TypeDef;
- typedef struct{
-
- __IO uint32_t Analog_IO_en;
- __IO uint32_t SPI_debug_en;
- __IO uint32_t debug_mux_en;
- __IO uint32_t full_mux0_en;
- __IO uint32_t full_mux1_en;
- __IO uint32_t gpio_pad_en;
- __IO uint32_t gpio_0_3_sel;
- __IO uint32_t gpio_4_7_sel;
- __IO uint32_t gpio_8_11_sel;
- __IO uint32_t gpio_12_15_sel;
- __IO uint32_t gpio_16_19_sel;
- __IO uint32_t gpio_20_23_sel;
- __IO uint32_t gpio_24_27_sel;
- __IO uint32_t gpio_28_31_sel;
- __IO uint32_t gpio_32_34_sel;
- __IO uint32_t pad_pe0;
- __IO uint32_t pad_pe1;
- __IO uint32_t pad_ps0;
- __IO uint32_t pad_ps1;
- __IO uint32_t keyscan_in_en;
- __IO uint32_t keyscan_out_en;
-
- }IOMUX_TypeDef;
- typedef struct{
-
- __IO uint32_t PWROFF;
- __IO uint32_t PWRSLP;
- __IO uint32_t IOCTL0;
- __IO uint32_t IOCTL1;
- __IO uint32_t IOCTL2;
- __IO uint32_t PMCTL0;
- __IO uint32_t PMCTL1;
- __IO uint32_t PMCTL2_0;
- __IO uint32_t PMCTL2_1;
- }AP_AON_TypeDef;
- typedef struct{
- __IO uint32_t RTCCTL;
- __IO uint32_t RTCCNT;
- __IO uint32_t RTCCC0;
- __IO uint32_t RTCCC1;
- __IO uint32_t RTCCC2;
- __IO uint32_t RTCFLAG;
- }AP_RTC_TypeDef;
- typedef struct{
- __IO uint32_t io_wu_mask_31_0;
- __IO uint32_t io_wu_mask_34_32;
- }AP_Wakeup_TypeDef;
- typedef struct{
- __IO uint32_t CLKSEL;
- __IO uint32_t CLKHF_CTL0;
- __IO uint32_t CLKHF_CTL1;
- __IO uint32_t ANA_CTL;
- __IO uint32_t mem_0_1_dvs;
- __IO uint32_t mem_2_3_4_dvs;
- __IO uint32_t efuse_cfg;
- __IO uint32_t chip_state;
- __IO uint32_t cal_rw;
- __IO uint32_t cal_ro0;
- __IO uint32_t cal_ro1;
- __IO uint32_t cal_ro2;
- __IO uint32_t ADC_CTL0;
- __IO uint32_t ADC_CTL1;
- __IO uint32_t ADC_CTL2;
- __IO uint32_t ADC_CTL3;
- __IO uint32_t ADC_CTL4;
- }AP_PCRM_TypeDef;
- typedef struct{
- __IO uint32_t enable;
- __IO uint32_t reserve[2];
- __IO uint32_t control_1;
- __IO uint32_t control_2;
- __IO uint32_t control_3;
- __IO uint32_t control_4;
- __IO uint32_t reserve1[6];
- __IO uint32_t intr_mask;
- __IO uint32_t intr_clear;
- __IO uint32_t intr_status;
- }AP_ADCC_TypeDef;
- #if defined ( __CC_ARM )
- #pragma no_anon_unions
- #endif
- #define AP_APB0_BASE (0x40000000UL)
- #define AP_APB1_BASE (0x40020000UL)
- #define AP_APB2_BASE (0x4000F000UL)
- #define AP_PCR_BASE (AP_APB0_BASE + 0x0000)
- #define AP_TIM1_BASE (AP_APB0_BASE + 0x1000)
- #define AP_TIM2_BASE (AP_APB0_BASE + 0x1014)
- #define AP_TIM3_BASE (AP_APB0_BASE + 0x1028)
- #define AP_TIM4_BASE (AP_APB0_BASE + 0x103c)
- #define AP_TIM_SYS_BASE (AP_APB0_BASE + 0x10a0)
- #define AP_WDT_BASE (AP_APB0_BASE + 0x2000)
- #define AP_COM_BASE (AP_APB0_BASE + 0x3000)
- #define AP_IOMUX_BASE (AP_APB0_BASE + 0x3800)
- #define AP_UART0_BASE (AP_APB0_BASE + 0x4000)
- #define AP_I2C0_BASE (AP_APB0_BASE + 0x5000)
- #define AP_I2C1_BASE (AP_APB0_BASE + 0x5800)
- #define AP_SPI0_BASE (AP_APB0_BASE + 0x6000)
- #define AP_SPI1_BASE (AP_APB0_BASE + 0x7000)
- #define AP_GPIOA_BASE (AP_APB0_BASE + 0x8000)
- #define AP_GPIOB_BASE (AP_APB0_BASE + 0x8080)
- #define AP_I2S_BASE (AP_APB0_BASE + 0x9000)
- #define AP_DMIC_BASE (AP_APB0_BASE + 0xA000)
- #define AP_QDEC_BASE (AP_APB0_BASE + 0xB000)
- #define AP_RNG_BASE (AP_APB0_BASE + 0xC000)
- #define AP_PWM_BASE (AP_APB0_BASE + 0xE000)
- #define AP_AON_BASE (AP_APB0_BASE + 0xF000)
- #define AP_RTC_BASE (AP_APB0_BASE + 0xF024)
- #define AP_PCRM_BASE (AP_APB0_BASE + 0xF03c)
- #define AP_WAKEUP_BASE (AP_APB0_BASE + 0xF0a0)
-
- #define SRAM0_BASE_ADDRESS 0x1FFF0000
- #define SRAM1_BASE_ADDRESS 0x1FFF8000
- #define SRAM2_BASE_ADDRESS 0x20000000
- #define SRAM3_BASE_ADDRESS 0x20010000
- #define SRAM4_BASE_ADDRESS 0x20012000
- #define FLASH_BASE_ADDR 0x11000000
-
- #define PCR_BASE_ADDR 0x40000000
- #define PCRM_BASE_ADDR 0x4000F000
- #define IOMUX_BASE_ADDR 0x40003800
- #define AON_BASE_ADDR 0x4000F000
- #define COM_BASE_ADDR 0x40003000
- #define AES_BASE_ADDR 0x40040000
- #define ADCC_BASE_ADDR 0x40050000
- #define BBTOP_BASE_ADDR 0x40030000
- #define LL_BASE_ADDR 0x40031000
- #define PWM_BASE_ADDR 0x400E0000
- #define KSCAN_BASE_ADDR 0x40024000
- #define QDEC_BASE_ADDR 0x4000B000
- #define RNG_BASE_ADDR 0x4000C000
- #define AP_PCR ((AP_PCR_TypeDef *) AP_PCR_BASE )
- #define AP_WDT ((AP_WDT_TypeDef *) AP_WDT_BASE )
- #define AP_COM ((AP_COM_TypeDef *) AP_COM_BASE)
- #define AP_TIM1 ((AP_TIM_TypeDef *) AP_TIM1_BASE )
- #define AP_TIM2 ((AP_TIM_TypeDef *) AP_TIM2_BASE )
- #define AP_TIM3 ((AP_TIM_TypeDef *) AP_TIM3_BASE )
- #define AP_TIM4 ((AP_TIM_TypeDef *) AP_TIM4_BASE )
- #define AP_TIMS ((AP_TIM_SYS_TypeDef *) AP_TIM_SYS_BASE )
- #define AP_IOMUX ((IOMUX_TypeDef *) AP_IOMUX_BASE)
- #define AP_SPI0 ((AP_SSI_TypeDef *) AP_SPI0_BASE)
- #define AP_SPI1 ((AP_SSI_TypeDef *) AP_SPI1_BASE)
- #define AP_UART0 ((AP_UART_TypeDef *) AP_UART0_BASE)
- #define AP_I2C0 ((AP_I2C_TypeDef *) AP_I2C0_BASE)
- #define AP_I2C1 ((AP_I2C_TypeDef *) AP_I2C1_BASE)
- #define AP_I2S_BLOCK ((AP_I2S_BLOCK_TypeDef *) AP_I2S_BASE)
- #define AP_I2S0 ((AP_I2S_TypeDef *) (AP_I2S_BASE+0x20))
- #define AP_RTC ((AP_RTC_TypeDef *) AP_RTC_BASE)
- #define AP_GPIOA ((AP_GPIO_TypeDef *) AP_GPIOA_BASE )
- #define AP_AON ((AP_AON_TypeDef *) AP_AON_BASE)
- #define AP_PCRM ((AP_PCRM_TypeDef *) AP_PCRM_BASE)
- #define AP_WAKEUP ((AP_Wakeup_TypeDef*) AP_WAKEUP_BASE)
- #define AP_ADCC ((AP_ADCC_TypeDef *) ADCC_BASE_ADDR)
- #define I2S_COMP_VER (unsigned int *)(AP_I2S_BASE+0x1f8)
- #define I2S_COMP_TYPE (unsigned int *)(AP_I2S_BASE+0x1fc)
- #define I2S_COM_PARA1 (unsigned int *)(AP_I2S_BASE+0x1f4)
- #define I2S_COM_PARA2 (unsigned int *)(AP_I2S_BASE+0x1f0)
-
- #define AP_STATUS1_REG (unsigned int *) 0x40003010
- #define AP_STATUS2_REG (unsigned int *) 0x40003014
- #define AP_EVENT_REC_REG (unsigned int *) 0x40003024
- #define AP_STCALIB (unsigned int *) 0x40003028
- #define AP_PERI_MASTER_SELECT *(volatile unsigned int *)0x4000302C
- #define CP_PCR_BASE (0x40020000UL)
- #define CP_TIM1_BASE (0x40021000UL)
- #define CP_TIM2_BASE (0x40021014UL)
- #define CP_TIM3_BASE (0x40021028UL)
- #define CP_TIM4_BASE (0x4002103cUL)
- #define CP_TIM_SYS_BASE (0x400210a0UL)
- #define CP_WDT_BASE (0x40022000UL)
- #define CP_COM_BASE (0x40023000UL)
- #define CP_BASEBAND_BASE (0x40030000UL)
- #define CP_PCR ((AP_PCR_TypeDef *) CP_PCR_BASE )
- #define CP_WDT ((AP_WDT_TypeDef *) CP_WDT_BASE )
- #define CP_TIM1 ((AP_TIM_TypeDef *) CP_TIM1_BASE )
- #define CP_TIM2 ((AP_TIM_TypeDef *) CP_TIM2_BASE )
- #define CP_TIM3 ((AP_TIM_TypeDef *) CP_TIM3_BASE )
- #define CP_TIM4 ((AP_TIM_TypeDef *) CP_TIM4_BASE )
- #define CP_TIMS ((AP_TIM_SYS_TypeDef *) CP_TIM_SYS_BASE )
- #define CP_COM ((AP_COM_TypeDef *) CP_COM_BASE)
- #define CP_STATUS1_REG (unsigned int *) 0x40023010
- #define CP_STATUS2_REG (unsigned int *) 0x40023014
- #define CP_EVENT_REC_REG (unsigned int *) 0x40023024
- #define CP_STCALIB (unsigned int *) 0x40023028
- #define CP_PERI_MASTER_SELECT (unsigned int *) 0x4002302C
- #define PM_BASE 0x4000F000
- #define M0_ONLY 1
- #define M4_ONLY 2
- #define COMBO 3
- #define IRQ_PRIO_REALTIME 0
- #define IRQ_PRIO_HIGH 1
- #define IRQ_PRIO_HAL 2
- #define IRQ_PRIO_THREAD 3
- #define IRQ_PRIO_APP 3
- enum{
- APCOM_CP_IPC_IRQ = 0,
- CPCOM_CP_IPC_IRQ = 1,
- CP_TIMER_IRQ = 2,
- CP_WDT_IRQ = 3,
- BB_IRQ = 4,
- KSCAN_IRQ = 5,
- RTC_IRQ = 6,
- CPCOM_AP_IPC_IRQ = 7,
- APCOM_AP_IPC_IRQ = 8,
- TIMER_IRQ = 9,
- WDT_IRQ = 10,
- UART_IRQ = 11,
- I2C0_IRQ = 12,
- I2C1_IRQ = 13,
- SPI0_IRQ = 14,
- SPI1_IRQ = 15,
- GPIO_IRQ = 16,
- I2S_IRQ = 17,
- SPIF_IRQ = 18,
- DMAC_INTR_IRQ = 19,
- DMAC_INTTC_IRQ = 20,
- DMAC_INTERR_IRQ = 21,
- FPIDC_IRQ = 22,
- FPDZC_IRQ = 23,
- FPIOC_IRQ = 24,
- FPUFC_IRQ = 25,
- FPOFC_IRQ = 26,
- FPIXC_IRQ = 27,
- AES_IRQ = 28,
- ADCC_IRQ = 29,
- QDEC_IRQ = 30,
- RNG_IRQ = 31
- };
- #endif
|