diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h b/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h deleted file mode 100644 index e6eab20bc4..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/ES8P508x.h +++ /dev/null @@ -1,3117 +0,0 @@ -/******************************************************************* -* *file : ES8P508x.h -* *description: ES8P508x Device Head File -* *author : Eastsoft MCU Software Team -* *version : V0.01 -* *data : 7/11/2017 -* -* *Copyright (C) 2017 Shanghai Eastsoft Microelectronics Co., Ltd. -*******************************************************************/ -#ifndef __ES8P508x_H__ -#define __ES8P508x_H__ - -#define __I volatile const /* defines 'read only' permissions */ -#define __O volatile /* defines 'write only' permissions */ -#define __IO volatile /* defines 'read / write' permissions */ - -#define __CM0_REV 0 /* Core Revision r0p0 */ -#define __NVIC_PRIO_BITS 2 /* ES8P508x uses 2 Bits for the Priority Levels */ -#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */ - -typedef enum IRQn -{ - /****** Cortex-M0 Processor Exceptions Numbers ******************************************************/ - RST_IRQn = -15, - NonMaskableInt_IRQn = -14, - HardFault_IRQn = -13, - SVC_IRQn = -5, - PendSV_IRQn = -2, - SysTick_IRQn = -1, - PINT0_IRQn = 0, - PINT1_IRQn = 1, - PINT2_IRQn = 2, - PINT3_IRQn = 3, - PINT4_IRQn = 4, - PINT5_IRQn = 5, - PINT6_IRQn = 6, - PINT7_IRQn = 7, - T16N0_IRQn = 8, - T16N1_IRQn = 9, - T16N2_IRQn = 10, - T16N3_IRQn = 11, - T32N0_IRQn = 12, - Reserved0_IRQn = 13, - IWDT_IRQn = 14, - WWDT_IRQn = 15, - CCM_IRQn = 16, - PLK_IRQn = 17, - LVD_IRQn = 18, - KINT_IRQn = 19, - RTC_IRQn = 20, - ADC_IRQn = 21, - Reserved1_IRQn = 22, - AES_IRQn = 23, - UART0_IRQn = 24, - UART1_IRQn = 25, - UART2_IRQn = 26, - UART3_IRQn = 27, - UART4_IRQn = 28, - UART5_IRQn = 29, - SPI0_IRQn = 30, - I2C0_IRQn = 31, -} IRQn_Type; - - -#include "core_cm0.h" -#include - - -/******************************************************************************/ -/* 设备特殊寄存器结构定䷿ */ -/******************************************************************************/ - -/* 允许匿名结构和匿名联县 */ -#pragma anon_unions - -typedef union -{ - struct - { - uint32_t PROT: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_PROT_Typedef; - -typedef union -{ - struct - { - uint32_t NMIEN: 1; - uint32_t NMICS: 5; - uint32_t RESERVED0: 26; - }; - uint32_t Word; -} SCU_NMICON_Typedef; - -typedef union -{ - struct - { - uint32_t PORF: 1; - uint32_t PORRCF: 1; - uint32_t PORRSTF: 1; - uint32_t BORF: 1; - uint32_t WWDTRSTF: 1; - uint32_t IWDTRSTF: 1; - uint32_t MRSTF: 1; - uint32_t SOFT_RSTF: 1; - uint32_t POR_LOST: 1; - uint32_t CFG_RST: 1; - uint32_t LOCKUP_RST: 1; - uint32_t RESERVED0: 21; - }; - uint32_t Word; -} SCU_PWRC_Typedef; - -typedef union -{ - struct - { - uint32_t FLAG0: 1; - uint32_t FLAG1: 1; - uint32_t FLAG2: 1; - uint32_t FLAG3: 1; - uint32_t FLAG4: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} SCU_FAULTFLAG_Typedef; - -typedef union -{ - struct - { - uint32_t WAKEUPTIME: 12; - uint32_t MOSC_EN: 1; - uint32_t CLKFLT_EN: 1; - uint32_t FLASHPW_PD: 1; - uint32_t RESERVED0: 1; - uint32_t LDOLP_VOSEL: 3; - uint32_t LDOHP_SOFT: 1; - uint32_t RESERVED1: 12; - }; - uint32_t Word; -} SCU_WAKEUPTIME_Typedef; - -typedef union -{ - struct - { - uint32_t PINST: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_MRSTN_SOFT_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0HT: 1; - uint32_t T16N1HT: 1; - uint32_t T16N2HT: 1; - uint32_t T16N3HT: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0HT: 1; - uint32_t RESERVED1: 7; - uint32_t IWDTHT: 1; - uint32_t WWDTHT: 1; - uint32_t RESERVED2: 14; - }; - uint32_t Word; -} SCU_DBGHALT_Typedef; - -typedef union -{ - struct - { - uint32_t ACCT: 4; - uint32_t HS: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} SCU_FLASHWAIT_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 1; - uint32_t BORV: 4; - uint32_t BORFLT: 3; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} SCU_SOFTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t FLTEN: 1; - uint32_t RESERVED0: 2; - uint32_t VS: 4; - uint32_t IF: 1; - uint32_t IE: 1; - uint32_t IFS: 3; - uint32_t RESERVED1: 2; - uint32_t LVDO: 1; - uint32_t RESERVED2: 16; - }; - uint32_t Word; -} SCU_LVDCON_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RESERVED0: 3; - uint32_t IE: 1; - uint32_t IFS: 3; - uint32_t IF: 1; - uint32_t RESERVED1: 7; - uint32_t FLAG: 1; - uint32_t RESERVED2: 15; - }; - uint32_t Word; -} SCU_CCM_Typedef; - -typedef union -{ - struct - { - uint32_t IE: 1; - uint32_t RESERVED0: 3; - uint32_t LK_IFS: 3; - uint32_t RESERVED1: 1; - uint32_t IF: 1; - uint32_t RESERVED2: 7; - uint32_t LK_FLAG: 1; - uint32_t RESERVED3: 15; - }; - uint32_t Word; -} SCU_PLLLKCON_Typedef; - -typedef union -{ - struct - { - uint32_t CLK_SEL: 2; - uint32_t XTAL_LP: 1; - uint32_t RESERVED0: 5; - uint32_t PLL_MUX: 1; - uint32_t RESERVED1: 3; - uint32_t SYSCLK_DIV: 3; - uint32_t RESERVED2: 1; - uint32_t CLKFLT_BY: 8; - uint32_t CLKOUT0_SEL: 2; - uint32_t CLKOUT1_SEL: 2; - uint32_t RESERVED3: 4; - }; - uint32_t Word; -} SCU_SCLKEN0_Typedef; - -typedef union -{ - struct - { - uint32_t XTAL_EN: 1; - uint32_t HRC_EN: 1; - uint32_t RESERVED0: 6; - uint32_t PLL_REF_SEL: 3; - uint32_t PLL_48M_SEL: 1; - uint32_t PLL_EN: 1; - uint32_t PLL_BYLOCK: 1; - uint32_t RESERVED1: 2; - uint32_t XTAL_RDY: 1; - uint32_t HRC_RDY: 1; - uint32_t PLL_RDY: 1; - uint32_t RESERVED2: 13; - }; - uint32_t Word; -} SCU_SCLKEN1_Typedef; - -typedef union -{ - struct - { - uint32_t SCU_EN: 1; - uint32_t GPIO_EN: 1; - uint32_t IAP_EN: 1; - uint32_t CRC_EN: 1; - uint32_t ADC_EN: 1; - uint32_t RTC_EN: 1; - uint32_t RESERVED0: 1; - uint32_t IWDT_EN: 1; - uint32_t WWDT_EN: 1; - uint32_t AES_EN: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} SCU_PCLKEN0_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0_EN: 1; - uint32_t T16N1_EN: 1; - uint32_t T16N2_EN: 1; - uint32_t T16N3_EN: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0_EN: 1; - uint32_t RESERVED1: 7; - uint32_t UART0_EN: 1; - uint32_t UART1_EN: 1; - uint32_t UART2_EN: 1; - uint32_t UART3_EN: 1; - uint32_t UART4_EN: 1; - uint32_t UART5_EN: 1; - uint32_t RESERVED2: 2; - uint32_t SPI0_EN: 1; - uint32_t RESERVED3: 3; - uint32_t I2C0_EN: 1; - uint32_t RESERVED4: 3; - }; - uint32_t Word; -} SCU_PCLKEN1_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 1; - uint32_t GPIO_RST: 1; - uint32_t IAP_RST: 1; - uint32_t CRC_RST: 1; - uint32_t ADC_RST: 1; - uint32_t RTC_RST: 1; - uint32_t RESERVED1: 1; - uint32_t IWDT_RST: 1; - uint32_t WWDT_RST: 1; - uint32_t AES_RST: 1; - uint32_t RESERVED2: 22; - }; - uint32_t Word; -} SCU_PRSTEN0_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0_RST: 1; - uint32_t T16N1_RST: 1; - uint32_t T16N2_RST: 1; - uint32_t T16N3_RST: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0_RST: 1; - uint32_t RESERVED1: 7; - uint32_t UART0_RST: 1; - uint32_t UART1_RST: 1; - uint32_t UART2_RST: 1; - uint32_t UART3_RST: 1; - uint32_t UART4_RST: 1; - uint32_t UART5_RST: 1; - uint32_t RESERVED2: 2; - uint32_t SPI0_RST: 1; - uint32_t RESERVED3: 3; - uint32_t I2C0_RST: 1; - uint32_t RESERVED4: 3; - }; - uint32_t Word; -} SCU_PRSTEN1_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0EN: 1; - uint32_t T16N1EN: 1; - uint32_t T16N2EN: 1; - uint32_t T16N3EN: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0EN: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} SCU_TIMEREN_Typedef; - -typedef union -{ - struct - { - uint32_t T16N0DIS: 1; - uint32_t T16N1DIS: 1; - uint32_t T16N2DIS: 1; - uint32_t T16N3DIS: 1; - uint32_t RESERVED0: 4; - uint32_t T32N0DIS: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} SCU_TIMERDIS_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} SCU_TBLREMAPEN_Typedef; - -typedef union -{ - struct - { - uint32_t TBLOFF: 32; - }; - uint32_t Word; -} SCU_TBLOFF_Typedef; - -typedef struct -{ - __IO SCU_PROT_Typedef PROT; - __IO SCU_NMICON_Typedef NMICON; - __IO SCU_PWRC_Typedef PWRC; - __IO SCU_FAULTFLAG_Typedef FAULTFLAG; - __IO SCU_WAKEUPTIME_Typedef WAKEUPTIME; - __IO SCU_MRSTN_SOFT_Typedef MRSTN_SOFT; - __IO SCU_DBGHALT_Typedef DBGHALT; - uint32_t RESERVED0 ; - __IO SCU_FLASHWAIT_Typedef FLASHWAIT; - __IO SCU_SOFTCFG_Typedef SOFTCFG; - __IO SCU_LVDCON_Typedef LVDCON; - __IO SCU_CCM_Typedef CCM; - __IO SCU_PLLLKCON_Typedef PLLLKCON; - uint32_t RESERVED1[3] ; - __IO SCU_SCLKEN0_Typedef SCLKEN0; - __IO SCU_SCLKEN1_Typedef SCLKEN1; - __IO SCU_PCLKEN0_Typedef PCLKEN0; - __IO SCU_PCLKEN1_Typedef PCLKEN1; - __IO SCU_PRSTEN0_Typedef PRSTEN0; - __IO SCU_PRSTEN1_Typedef PRSTEN1; - __O SCU_TIMEREN_Typedef TIMEREN; - __IO SCU_TIMERDIS_Typedef TIMERDIS; - __IO SCU_TBLREMAPEN_Typedef TBLREMAPEN; - __IO SCU_TBLOFF_Typedef TBLOFF; -} SCU_TypeDef; - -typedef union -{ - struct - { - uint32_t UL: 32; - }; - uint32_t Word; -} CRC_UL_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t HS: 1; - uint32_t DS: 1; - uint32_t REQ: 1; - uint32_t ACK: 1; - uint32_t RESERVED0: 2; - uint32_t MOD: 2; - uint32_t BYTE: 2; - uint32_t REFIN: 1; - uint32_t REFOUT: 1; - uint32_t XOROUT: 1; - uint32_t RESERVED1: 17; - }; - uint32_t Word; -} CRC_CON_Typedef; - -typedef union -{ - struct - { - uint32_t TRIG: 32; - }; - uint32_t Word; -} CRC_TRIG_Typedef; - -typedef union -{ - struct - { - uint32_t ADDR: 17; - uint32_t RESERVED0: 3; - uint32_t IFREN: 1; - uint32_t RESERVED1: 11; - }; - uint32_t Word; -} CRC_ADDR_Typedef; - -typedef union -{ - struct - { - uint32_t CRC_SIZE: 15; - uint32_t RESERVED0: 17; - }; - uint32_t Word; -} CRC_SIZE_Typedef; - -typedef union -{ - struct - { - uint32_t DI: 32; - }; - uint32_t Word; -} CRC_DI_Typedef; - -typedef union -{ - struct - { - uint32_t DO: 32; - }; - uint32_t Word; -} CRC_DO_Typedef; - -typedef union -{ - struct - { - uint32_t BUSY: 1; - uint32_t RSTF: 1; - uint32_t EMPTY_ERR: 1; - uint32_t RESERVED0: 29; - }; - uint32_t Word; -} CRC_STA_Typedef; - -typedef union -{ - struct - { - uint32_t FADR: 15; - uint32_t RESERVED0: 5; - uint32_t IFREN: 1; - uint32_t RESERVED1: 11; - }; - uint32_t Word; -} CRC_FA_Typedef; - -typedef struct -{ - __IO CRC_UL_Typedef UL; - __IO CRC_CON_Typedef CON; - __IO CRC_TRIG_Typedef TRIG; - __IO CRC_ADDR_Typedef ADDR; - __IO CRC_SIZE_Typedef SIZE; - __IO CRC_DI_Typedef DI; - __I CRC_DO_Typedef DO; - __IO CRC_STA_Typedef STA; - __I CRC_FA_Typedef FA; -} CRC_TypeDef; - -typedef union -{ - struct - { - uint32_t PORT_0: 1; - uint32_t PORT_1: 1; - uint32_t PORT_2: 1; - uint32_t PORT_3: 1; - uint32_t PORT_4: 1; - uint32_t PORT_5: 1; - uint32_t PORT_6: 1; - uint32_t PORT_7: 1; - uint32_t PORT_8: 1; - uint32_t PORT_9: 1; - uint32_t PORT_10: 1; - uint32_t PORT_11: 1; - uint32_t PORT_12: 1; - uint32_t PORT_13: 1; - uint32_t PORT_14: 1; - uint32_t PORT_15: 1; - uint32_t PORT_16: 1; - uint32_t PORT_17: 1; - uint32_t PORT_18: 1; - uint32_t PORT_19: 1; - uint32_t PORT_20: 1; - uint32_t PORT_21: 1; - uint32_t PORT_22: 1; - uint32_t PORT_23: 1; - uint32_t PORT_24: 1; - uint32_t PORT_25: 1; - uint32_t PORT_26: 1; - uint32_t PORT_27: 1; - uint32_t PORT_28: 1; - uint32_t PORT_29: 1; - uint32_t PORT_30: 1; - uint32_t PORT_31: 1; - }; - uint32_t Word; -} GPIO_PAPORT_Typedef; - -typedef union -{ - struct - { - uint32_t DATA_0: 1; - uint32_t DATA_1: 1; - uint32_t DATA_2: 1; - uint32_t DATA_3: 1; - uint32_t DATA_4: 1; - uint32_t DATA_5: 1; - uint32_t DATA_6: 1; - uint32_t DATA_7: 1; - uint32_t DATA_8: 1; - uint32_t DATA_9: 1; - uint32_t DATA_10: 1; - uint32_t DATA_11: 1; - uint32_t DATA_12: 1; - uint32_t DATA_13: 1; - uint32_t DATA_14: 1; - uint32_t DATA_15: 1; - uint32_t DATA_16: 1; - uint32_t DATA_17: 1; - uint32_t DATA_18: 1; - uint32_t DATA_19: 1; - uint32_t DATA_20: 1; - uint32_t DATA_21: 1; - uint32_t DATA_22: 1; - uint32_t DATA_23: 1; - uint32_t DATA_24: 1; - uint32_t DATA_25: 1; - uint32_t DATA_26: 1; - uint32_t DATA_27: 1; - uint32_t DATA_28: 1; - uint32_t DATA_29: 1; - uint32_t DATA_30: 1; - uint32_t DATA_31: 1; - }; - uint32_t Word; -} GPIO_PADATA_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADATABRR_Typedef; - -typedef union -{ - struct - { - uint32_t DIR_0: 1; - uint32_t DIR_1: 1; - uint32_t DIR_2: 1; - uint32_t DIR_3: 1; - uint32_t DIR_4: 1; - uint32_t DIR_5: 1; - uint32_t DIR_6: 1; - uint32_t DIR_7: 1; - uint32_t DIR_8: 1; - uint32_t DIR_9: 1; - uint32_t DIR_10: 1; - uint32_t DIR_11: 1; - uint32_t DIR_12: 1; - uint32_t DIR_13: 1; - uint32_t DIR_14: 1; - uint32_t DIR_15: 1; - uint32_t DIR_16: 1; - uint32_t DIR_17: 1; - uint32_t DIR_18: 1; - uint32_t DIR_19: 1; - uint32_t DIR_20: 1; - uint32_t DIR_21: 1; - uint32_t DIR_22: 1; - uint32_t DIR_23: 1; - uint32_t DIR_24: 1; - uint32_t DIR_25: 1; - uint32_t DIR_26: 1; - uint32_t DIR_27: 1; - uint32_t DIR_28: 1; - uint32_t DIR_29: 1; - uint32_t DIR_30: 1; - uint32_t DIR_31: 1; - }; - uint32_t Word; -} GPIO_PADIR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PADIRBRR_Typedef; - -typedef union -{ - struct - { - uint32_t PA0: 2; - uint32_t RESERVED0: 2; - uint32_t PA1: 2; - uint32_t RESERVED1: 2; - uint32_t PA2: 2; - uint32_t RESERVED2: 2; - uint32_t PA3: 2; - uint32_t RESERVED3: 2; - uint32_t PA4: 2; - uint32_t RESERVED4: 2; - uint32_t PA5: 2; - uint32_t RESERVED5: 2; - uint32_t PA6: 2; - uint32_t RESERVED6: 2; - uint32_t PA7: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC0_Typedef; - -typedef union -{ - struct - { - uint32_t PA8: 2; - uint32_t RESERVED0: 2; - uint32_t PA9: 2; - uint32_t RESERVED1: 2; - uint32_t PA10: 2; - uint32_t RESERVED2: 2; - uint32_t PA11: 2; - uint32_t RESERVED3: 2; - uint32_t PA12: 2; - uint32_t RESERVED4: 2; - uint32_t PA13: 2; - uint32_t RESERVED5: 2; - uint32_t PA14: 2; - uint32_t RESERVED6: 2; - uint32_t PA15: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC1_Typedef; - -typedef union -{ - struct - { - uint32_t PA16: 2; - uint32_t RESERVED0: 2; - uint32_t PA17: 2; - uint32_t RESERVED1: 2; - uint32_t PA18: 2; - uint32_t RESERVED2: 2; - uint32_t PA19: 2; - uint32_t RESERVED3: 2; - uint32_t PA20: 2; - uint32_t RESERVED4: 2; - uint32_t PA21: 2; - uint32_t RESERVED5: 2; - uint32_t PA22: 2; - uint32_t RESERVED6: 2; - uint32_t PA23: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC2_Typedef; - -typedef union -{ - struct - { - uint32_t PA24: 2; - uint32_t RESERVED0: 2; - uint32_t PA25: 2; - uint32_t RESERVED1: 2; - uint32_t PA26: 2; - uint32_t RESERVED2: 2; - uint32_t PA27: 2; - uint32_t RESERVED3: 2; - uint32_t PA28: 2; - uint32_t RESERVED4: 2; - uint32_t PA29: 2; - uint32_t RESERVED5: 2; - uint32_t PA30: 2; - uint32_t RESERVED6: 2; - uint32_t PA31: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PAFUNC3_Typedef; - -typedef union -{ - struct - { - uint32_t INEB_0: 1; - uint32_t INEB_1: 1; - uint32_t INEB_2: 1; - uint32_t INEB_3: 1; - uint32_t INEB_4: 1; - uint32_t INEB_5: 1; - uint32_t INEB_6: 1; - uint32_t INEB_7: 1; - uint32_t INEB_8: 1; - uint32_t INEB_9: 1; - uint32_t INEB_10: 1; - uint32_t INEB_11: 1; - uint32_t INEB_12: 1; - uint32_t INEB_13: 1; - uint32_t INEB_14: 1; - uint32_t INEB_15: 1; - uint32_t INEB_16: 1; - uint32_t INEB_17: 1; - uint32_t INEB_18: 1; - uint32_t INEB_19: 1; - uint32_t INEB_20: 1; - uint32_t INEB_21: 1; - uint32_t INEB_22: 1; - uint32_t INEB_23: 1; - uint32_t INEB_24: 1; - uint32_t INEB_25: 1; - uint32_t INEB_26: 1; - uint32_t INEB_27: 1; - uint32_t INEB_28: 1; - uint32_t INEB_29: 1; - uint32_t INEB_30: 1; - uint32_t INEB_31: 1; - }; - uint32_t Word; -} GPIO_PAINEB_Typedef; - -typedef union -{ - struct - { - uint32_t ODE_0: 1; - uint32_t ODE_1: 1; - uint32_t ODE_2: 1; - uint32_t ODE_3: 1; - uint32_t ODE_4: 1; - uint32_t ODE_5: 1; - uint32_t ODE_6: 1; - uint32_t ODE_7: 1; - uint32_t ODE_8: 1; - uint32_t ODE_9: 1; - uint32_t ODE_10: 1; - uint32_t ODE_11: 1; - uint32_t ODE_12: 1; - uint32_t ODE_13: 1; - uint32_t ODE_14: 1; - uint32_t ODE_15: 1; - uint32_t ODE_16: 1; - uint32_t ODE_17: 1; - uint32_t ODE_18: 1; - uint32_t ODE_19: 1; - uint32_t ODE_20: 1; - uint32_t ODE_21: 1; - uint32_t ODE_22: 1; - uint32_t ODE_23: 1; - uint32_t ODE_24: 1; - uint32_t ODE_25: 1; - uint32_t ODE_26: 1; - uint32_t ODE_27: 1; - uint32_t ODE_28: 1; - uint32_t ODE_29: 1; - uint32_t ODE_30: 1; - uint32_t ODE_31: 1; - }; - uint32_t Word; -} GPIO_PAODE_Typedef; - -typedef union -{ - struct - { - uint32_t PUE_0: 1; - uint32_t PUE_1: 1; - uint32_t PUE_2: 1; - uint32_t PUE_3: 1; - uint32_t PUE_4: 1; - uint32_t PUE_5: 1; - uint32_t PUE_6: 1; - uint32_t PUE_7: 1; - uint32_t PUE_8: 1; - uint32_t PUE_9: 1; - uint32_t PUE_10: 1; - uint32_t PUE_11: 1; - uint32_t PUE_12: 1; - uint32_t PUE_13: 1; - uint32_t PUE_14: 1; - uint32_t PUE_15: 1; - uint32_t PUE_16: 1; - uint32_t PUE_17: 1; - uint32_t PUE_18: 1; - uint32_t PUE_19: 1; - uint32_t PUE_20: 1; - uint32_t PUE_21: 1; - uint32_t PUE_22: 1; - uint32_t PUE_23: 1; - uint32_t PUE_24: 1; - uint32_t PUE_25: 1; - uint32_t PUE_26: 1; - uint32_t PUE_27: 1; - uint32_t PUE_28: 1; - uint32_t PUE_29: 1; - uint32_t PUE_30: 1; - uint32_t PUE_31: 1; - }; - uint32_t Word; -} GPIO_PAPUE_Typedef; - -typedef union -{ - struct - { - uint32_t PDE_0: 1; - uint32_t PDE_1: 1; - uint32_t PDE_2: 1; - uint32_t PDE_3: 1; - uint32_t PDE_4: 1; - uint32_t PDE_5: 1; - uint32_t PDE_6: 1; - uint32_t PDE_7: 1; - uint32_t PDE_8: 1; - uint32_t PDE_9: 1; - uint32_t PDE_10: 1; - uint32_t PDE_11: 1; - uint32_t PDE_12: 1; - uint32_t PDE_13: 1; - uint32_t PDE_14: 1; - uint32_t PDE_15: 1; - uint32_t PDE_16: 1; - uint32_t PDE_17: 1; - uint32_t PDE_18: 1; - uint32_t PDE_19: 1; - uint32_t PDE_20: 1; - uint32_t PDE_21: 1; - uint32_t PDE_22: 1; - uint32_t PDE_23: 1; - uint32_t PDE_24: 1; - uint32_t PDE_25: 1; - uint32_t PDE_26: 1; - uint32_t PDE_27: 1; - uint32_t PDE_28: 1; - uint32_t PDE_29: 1; - uint32_t PDE_30: 1; - uint32_t PDE_31: 1; - }; - uint32_t Word; -} GPIO_PAPDE_Typedef; - -typedef union -{ - struct - { - uint32_t DS_0: 1; - uint32_t DS_1: 1; - uint32_t DS_2: 1; - uint32_t DS_3: 1; - uint32_t DS_4: 1; - uint32_t DS_5: 1; - uint32_t DS_6: 1; - uint32_t DS_7: 1; - uint32_t DS_8: 1; - uint32_t DS_9: 1; - uint32_t DS_10: 1; - uint32_t DS_11: 1; - uint32_t DS_12: 1; - uint32_t DS_13: 1; - uint32_t DS_14: 1; - uint32_t DS_15: 1; - uint32_t DS_16: 1; - uint32_t DS_17: 1; - uint32_t DS_18: 1; - uint32_t DS_19: 1; - uint32_t DS_20: 1; - uint32_t DS_21: 1; - uint32_t DS_22: 1; - uint32_t DS_23: 1; - uint32_t DS_24: 1; - uint32_t DS_25: 1; - uint32_t DS_26: 1; - uint32_t DS_27: 1; - uint32_t DS_28: 1; - uint32_t DS_29: 1; - uint32_t DS_30: 1; - uint32_t DS_31: 1; - }; - uint32_t Word; -} GPIO_PADS_Typedef; - -typedef union -{ - struct - { - uint32_t PORT_0: 1; - uint32_t PORT_1: 1; - uint32_t PORT_2: 1; - uint32_t PORT_3: 1; - uint32_t PORT_4: 1; - uint32_t PORT_5: 1; - uint32_t PORT_6: 1; - uint32_t PORT_7: 1; - uint32_t PORT_8: 1; - uint32_t PORT_9: 1; - uint32_t PORT_10: 1; - uint32_t PORT_11: 1; - uint32_t PORT_12: 1; - uint32_t PORT_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPORT_Typedef; - -typedef union -{ - struct - { - uint32_t DATA_0: 1; - uint32_t DATA_1: 1; - uint32_t DATA_2: 1; - uint32_t DATA_3: 1; - uint32_t DATA_4: 1; - uint32_t DATA_5: 1; - uint32_t DATA_6: 1; - uint32_t DATA_7: 1; - uint32_t DATA_8: 1; - uint32_t DATA_9: 1; - uint32_t DATA_10: 1; - uint32_t DATA_11: 1; - uint32_t DATA_12: 1; - uint32_t DATA_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDATA_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDATABRR_Typedef; - -typedef union -{ - struct - { - uint32_t DIR_0: 1; - uint32_t DIR_1: 1; - uint32_t DIR_2: 1; - uint32_t DIR_3: 1; - uint32_t DIR_4: 1; - uint32_t DIR_5: 1; - uint32_t DIR_6: 1; - uint32_t DIR_7: 1; - uint32_t DIR_8: 1; - uint32_t DIR_9: 1; - uint32_t DIR_10: 1; - uint32_t DIR_11: 1; - uint32_t DIR_12: 1; - uint32_t DIR_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDIR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBSR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBCR_Typedef; - -typedef union -{ - uint32_t Word; -} GPIO_PBDIRBRR_Typedef; - -typedef union -{ - struct - { - uint32_t PB0: 2; - uint32_t RESERVED0: 2; - uint32_t PB1: 2; - uint32_t RESERVED1: 2; - uint32_t PB2: 2; - uint32_t RESERVED2: 2; - uint32_t PB3: 2; - uint32_t RESERVED3: 2; - uint32_t PB4: 2; - uint32_t RESERVED4: 2; - uint32_t PB5: 2; - uint32_t RESERVED5: 2; - uint32_t PB6: 2; - uint32_t RESERVED6: 2; - uint32_t PB7: 2; - uint32_t RESERVED7: 2; - }; - uint32_t Word; -} GPIO_PBFUNC0_Typedef; - -typedef union -{ - struct - { - uint32_t PB8: 2; - uint32_t RESERVED0: 2; - uint32_t PB9: 2; - uint32_t RESERVED1: 2; - uint32_t PB10: 2; - uint32_t RESERVED2: 2; - uint32_t PB11: 2; - uint32_t RESERVED3: 2; - uint32_t PB12: 2; - uint32_t RESERVED4: 2; - uint32_t PB13: 2; - uint32_t RESERVED5: 10; - }; - uint32_t Word; -} GPIO_PBFUNC1_Typedef; - -typedef union -{ - struct - { - uint32_t INEB_0: 1; - uint32_t INEB_1: 1; - uint32_t INEB_2: 1; - uint32_t INEB_3: 1; - uint32_t INEB_4: 1; - uint32_t INEB_5: 1; - uint32_t INEB_6: 1; - uint32_t INEB_7: 1; - uint32_t INEB_8: 1; - uint32_t INEB_9: 1; - uint32_t INEB_10: 1; - uint32_t INEB_11: 1; - uint32_t INEB_12: 1; - uint32_t INEB_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBINEB_Typedef; - -typedef union -{ - struct - { - uint32_t ODE_0: 1; - uint32_t ODE_1: 1; - uint32_t ODE_2: 1; - uint32_t ODE_3: 1; - uint32_t ODE_4: 1; - uint32_t ODE_5: 1; - uint32_t ODE_6: 1; - uint32_t ODE_7: 1; - uint32_t ODE_8: 1; - uint32_t ODE_9: 1; - uint32_t ODE_10: 1; - uint32_t ODE_11: 1; - uint32_t ODE_12: 1; - uint32_t ODE_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBODE_Typedef; - -typedef union -{ - struct - { - uint32_t PUEN_0: 1; - uint32_t PUEN_1: 1; - uint32_t PUEN_2: 1; - uint32_t PUEN_3: 1; - uint32_t PUEN_4: 1; - uint32_t PUEN_5: 1; - uint32_t PUEN_6: 1; - uint32_t PUEN_7: 1; - uint32_t PUEN_8: 1; - uint32_t PUEN_9: 1; - uint32_t PUEN_10: 1; - uint32_t PUEN_11: 1; - uint32_t PUEN_12: 1; - uint32_t PUEN_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPUE_Typedef; - -typedef union -{ - struct - { - uint32_t PDEN_0: 1; - uint32_t PDEN_1: 1; - uint32_t PDEN_2: 1; - uint32_t PDEN_3: 1; - uint32_t PDEN_4: 1; - uint32_t PDEN_5: 1; - uint32_t PDEN_6: 1; - uint32_t PDEN_7: 1; - uint32_t PDEN_8: 1; - uint32_t PDEN_9: 1; - uint32_t PDEN_10: 1; - uint32_t PDEN_11: 1; - uint32_t PDEN_12: 1; - uint32_t PDEN_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBPDE_Typedef; - -typedef union -{ - struct - { - uint32_t DS_0: 1; - uint32_t DS_1: 1; - uint32_t DS_2: 1; - uint32_t DS_3: 1; - uint32_t DS_4: 1; - uint32_t DS_5: 1; - uint32_t DS_6: 1; - uint32_t DS_7: 1; - uint32_t DS_8: 1; - uint32_t DS_9: 1; - uint32_t DS_10: 1; - uint32_t DS_11: 1; - uint32_t DS_12: 1; - uint32_t DS_13: 1; - uint32_t RESERVED0: 18; - }; - uint32_t Word; -} GPIO_PBDS_Typedef; - -typedef union -{ - struct - { - uint32_t PINTIE: 8; - uint32_t PMASK: 8; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_PINTIE_Typedef; - -typedef union -{ - struct - { - uint32_t PINTIF_0: 1; - uint32_t PINTIF_1: 1; - uint32_t PINTIF_2: 1; - uint32_t PINTIF_3: 1; - uint32_t PINTIF_4: 1; - uint32_t PINTIF_5: 1; - uint32_t PINTIF_6: 1; - uint32_t PINTIF_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_PINTIF_Typedef; - -typedef union -{ - struct - { - uint32_t PINT0SEL: 3; - uint32_t RESERVED0: 1; - uint32_t PINT1SEL: 3; - uint32_t RESERVED1: 1; - uint32_t PINT2SEL: 3; - uint32_t RESERVED2: 1; - uint32_t PINT3SEL: 3; - uint32_t RESERVED3: 1; - uint32_t PINT4SEL: 3; - uint32_t RESERVED4: 1; - uint32_t PINT5SEL: 3; - uint32_t RESERVED5: 1; - uint32_t PINT6SEL: 3; - uint32_t RESERVED6: 1; - uint32_t PINT7SEL: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_PINTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t PINT0CFG: 3; - uint32_t RESERVED0: 1; - uint32_t PINT1CFG: 3; - uint32_t RESERVED1: 1; - uint32_t PINT2CFG: 3; - uint32_t RESERVED2: 1; - uint32_t PINT3CFG: 3; - uint32_t RESERVED3: 1; - uint32_t PINT4CFG: 3; - uint32_t RESERVED4: 1; - uint32_t PINT5CFG: 3; - uint32_t RESERVED5: 1; - uint32_t PINT6CFG: 3; - uint32_t RESERVED6: 1; - uint32_t PINT7CFG: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_PINTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t KINTIE: 8; - uint32_t KMASK: 8; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_KINTIE_Typedef; - -typedef union -{ - struct - { - uint32_t KINTIF_0: 1; - uint32_t KINTIF_1: 1; - uint32_t KINTIF_2: 1; - uint32_t KINTIF_3: 1; - uint32_t KINTIF_4: 1; - uint32_t KINTIF_5: 1; - uint32_t KINTIF_6: 1; - uint32_t KINTIF_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_KINTIF_Typedef; - -typedef union -{ - struct - { - uint32_t KINT0SEL: 3; - uint32_t RESERVED0: 1; - uint32_t KINT1SEL: 3; - uint32_t RESERVED1: 1; - uint32_t KINT2SEL: 3; - uint32_t RESERVED2: 1; - uint32_t KINT3SEL: 3; - uint32_t RESERVED3: 1; - uint32_t KINT4SEL: 3; - uint32_t RESERVED4: 1; - uint32_t KINT5SEL: 3; - uint32_t RESERVED5: 1; - uint32_t KINT6SEL: 3; - uint32_t RESERVED6: 1; - uint32_t KINT7SEL: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_KINTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t KINT0CFG: 3; - uint32_t RESERVED0: 1; - uint32_t KINT1CFG: 3; - uint32_t RESERVED1: 1; - uint32_t KINT2CFG: 3; - uint32_t RESERVED2: 1; - uint32_t KINT3CFG: 3; - uint32_t RESERVED3: 1; - uint32_t KINT4CFG: 3; - uint32_t RESERVED4: 1; - uint32_t KINT5CFG: 3; - uint32_t RESERVED5: 1; - uint32_t KINT6CFG: 3; - uint32_t RESERVED6: 1; - uint32_t KINT7CFG: 3; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_KINTCFG_Typedef; - -typedef union -{ - struct - { - uint32_t FLT_S_0: 1; - uint32_t FLT_S_1: 1; - uint32_t FLT_S_2: 1; - uint32_t FLT_S_3: 1; - uint32_t FLT_S_4: 1; - uint32_t FLT_S_5: 1; - uint32_t FLT_S_6: 1; - uint32_t FLT_S_7: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} GPIO_IOINTFLTS_Typedef; - -typedef union -{ - struct - { - uint32_t FLT0_SEL: 4; - uint32_t FLT1_SEL: 4; - uint32_t FLT2_SEL: 4; - uint32_t FLT3_SEL: 4; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} GPIO_TMRFLTSEL_Typedef; - -typedef union -{ - struct - { - uint32_t TX0PS: 2; - uint32_t RESERVED0: 2; - uint32_t TX0PLV: 1; - uint32_t TX0_S: 2; - uint32_t RESERVED1: 1; - uint32_t TX1PS: 2; - uint32_t RESERVED2: 2; - uint32_t TX1PLV: 1; - uint32_t TX1_S: 2; - uint32_t RESERVED3: 1; - uint32_t TX2PS: 2; - uint32_t RESERVED4: 2; - uint32_t TX2PLV: 1; - uint32_t TX2_S: 2; - uint32_t RESERVED5: 1; - uint32_t TX3PS: 2; - uint32_t RESERVED6: 2; - uint32_t TX3PLV: 1; - uint32_t TX3_S: 2; - uint32_t RESERVED7: 1; - }; - uint32_t Word; -} GPIO_TXPWM_Typedef; - -typedef union -{ - struct - { - uint32_t BUZEN: 1; - uint32_t RESERVED0: 7; - uint32_t BUZ_LOAD: 20; - uint32_t RESERVED1: 4; - }; - uint32_t Word; -} GPIO_BUZC_Typedef; - -typedef struct -{ - __I GPIO_PAPORT_Typedef PAPORT; - uint32_t RESERVED0[3] ; - __IO GPIO_PADATA_Typedef PADATA; - __O GPIO_PADATABSR_Typedef PADATABSR; - __O GPIO_PADATABCR_Typedef PADATABCR; - __O GPIO_PADATABRR_Typedef PADATABRR; - __IO GPIO_PADIR_Typedef PADIR; - __O GPIO_PADIRBSR_Typedef PADIRBSR; - __O GPIO_PADIRBCR_Typedef PADIRBCR; - __O GPIO_PADIRBRR_Typedef PADIRBRR; - __IO GPIO_PAFUNC0_Typedef PAFUNC0; - __IO GPIO_PAFUNC1_Typedef PAFUNC1; - __IO GPIO_PAFUNC2_Typedef PAFUNC2; - __IO GPIO_PAFUNC3_Typedef PAFUNC3; - __IO GPIO_PAINEB_Typedef PAINEB; - __IO GPIO_PAODE_Typedef PAODE; - __IO GPIO_PAPUE_Typedef PAPUE; - __IO GPIO_PAPDE_Typedef PAPDE; - __IO GPIO_PADS_Typedef PADS; - uint32_t RESERVED1[11] ; - __I GPIO_PBPORT_Typedef PBPORT; - uint32_t RESERVED2[3] ; - __IO GPIO_PBDATA_Typedef PBDATA; - __O GPIO_PBDATABSR_Typedef PBDATABSR; - __O GPIO_PBDATABCR_Typedef PBDATABCR; - __O GPIO_PBDATABRR_Typedef PBDATABRR; - __IO GPIO_PBDIR_Typedef PBDIR; - __O GPIO_PBDIRBSR_Typedef PBDIRBSR; - __O GPIO_PBDIRBCR_Typedef PBDIRBCR; - __O GPIO_PBDIRBRR_Typedef PBDIRBRR; - __IO GPIO_PBFUNC0_Typedef PBFUNC0; - __IO GPIO_PBFUNC1_Typedef PBFUNC1; - uint32_t RESERVED3[2] ; - __IO GPIO_PBINEB_Typedef PBINEB; - __IO GPIO_PBODE_Typedef PBODE; - __IO GPIO_PBPUE_Typedef PBPUE; - __IO GPIO_PBPDE_Typedef PBPDE; - __IO GPIO_PBDS_Typedef PBDS; - uint32_t RESERVED4[139] ; - __IO GPIO_PINTIE_Typedef PINTIE; - __IO GPIO_PINTIF_Typedef PINTIF; - __IO GPIO_PINTSEL_Typedef PINTSEL; - __IO GPIO_PINTCFG_Typedef PINTCFG; - __IO GPIO_KINTIE_Typedef KINTIE; - __IO GPIO_KINTIF_Typedef KINTIF; - __IO GPIO_KINTSEL_Typedef KINTSEL; - __IO GPIO_KINTCFG_Typedef KINTCFG; - uint32_t RESERVED5[4] ; - __IO GPIO_IOINTFLTS_Typedef IOINTFLTS; - uint32_t RESERVED6[3] ; - __IO GPIO_TMRFLTSEL_Typedef TMRFLTSEL; - uint32_t RESERVED7[15] ; - __IO GPIO_TXPWM_Typedef TXPWM; - uint32_t RESERVED8[3] ; - __IO GPIO_BUZC_Typedef BUZC; -} GPIO_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t RESERVED0: 2; - uint32_t FLASH_REQ: 1; - uint32_t FLASH_ACK: 1; - uint32_t RESERVED1: 1; - uint32_t FLASH_FAIL: 1; - uint32_t FEWE: 1; - uint32_t SEWE: 1; - uint32_t RESERVED2: 22; - }; - uint32_t Word; -} IAP_CON_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 2; - uint32_t IAPCA: 8; - uint32_t IAPPA: 7; - uint32_t RESERVED1: 3; - uint32_t IFREN: 1; - uint32_t RESERVED2: 11; - }; - uint32_t Word; -} IAP_ADDR_Typedef; - -typedef union -{ - struct - { - uint32_t DATA: 32; - }; - uint32_t Word; -} IAP_DATA_Typedef; - -typedef union -{ - struct - { - uint32_t TRIG: 32; - }; - uint32_t Word; -} IAP_TRIG_Typedef; - -typedef union -{ - struct - { - uint32_t UL: 32; - }; - uint32_t Word; -} IAP_UL_Typedef; - -typedef union -{ - struct - { - uint32_t BSY: 1; - uint32_t PERASE_END: 1; - uint32_t PROG_END: 1; - uint32_t TIMEOUT_ERR: 1; - uint32_t OP_ERR: 1; - uint32_t MERASE_END: 1; - uint32_t UERASE_END: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} IAP_STA_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 32; - }; - uint32_t Word; -} IAP_WPROT0_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 32; - }; - uint32_t Word; -} IAP_WPROT1_Typedef; - -typedef union -{ - struct - { - uint32_t IAP_WPROT: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IAP_WPROT2_Typedef; - -typedef struct -{ - __IO IAP_CON_Typedef CON; - __IO IAP_ADDR_Typedef ADDR; - __IO IAP_DATA_Typedef DATA; - __IO IAP_TRIG_Typedef TRIG; - __IO IAP_UL_Typedef UL; - __IO IAP_STA_Typedef STA; - __IO IAP_WPROT0_Typedef WPROT0; - __IO IAP_WPROT1_Typedef WPROT1; - __IO IAP_WPROT2_Typedef WPROT2; -} IAP_TypeDef; - -typedef union -{ - struct - { - uint32_t DR: 12; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} ADC_DR_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t TRIG: 1; - uint32_t ACP_EN: 1; - uint32_t RESERVED0: 1; - uint32_t BIT_SEL: 2; - uint32_t RESERVED1: 26; - }; - uint32_t Word; -} ADC_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CLKDIV: 3; - uint32_t RESERVED0: 1; - uint32_t CLKS: 2; - uint32_t RESERVED1: 2; - uint32_t VREFP: 2; - uint32_t VREFN: 1; - uint32_t VRBUF_EN: 1; - uint32_t SMPS: 1; - uint32_t SMPON: 1; - uint32_t HSEN: 1; - uint32_t RESERVED2: 1; - uint32_t ST: 5; - uint32_t RESERVED3: 3; - uint32_t VCMBUF_EN: 1; - uint32_t VCMBUF_HS: 1; - uint32_t RESERVED4: 6; - }; - uint32_t Word; -} ADC_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t CHS: 5; - uint32_t RESERVED0: 3; - uint32_t VDD5_FLAG_EN: 1; - uint32_t RESERVED1: 23; - }; - uint32_t Word; -} ADC_CHS_Typedef; - -typedef union -{ - struct - { - uint32_t IE: 1; - uint32_t ACPMINIE: 1; - uint32_t ACPMAXIE: 1; - uint32_t ACPOVIE: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} ADC_IE_Typedef; - -typedef union -{ - struct - { - uint32_t IF: 1; - uint32_t ACPMINIF: 1; - uint32_t ACPMAXIF: 1; - uint32_t ACPOVIF: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} ADC_IF_Typedef; - -typedef union -{ - struct - { - uint32_t OVFL_TIME: 12; - uint32_t RESERVED0: 4; - uint32_t TIMES: 2; - uint32_t RESERVED1: 2; - uint32_t CLKS: 1; - uint32_t RESERVED2: 11; - }; - uint32_t Word; -} ADC_ACPC_Typedef; - -typedef union -{ - struct - { - uint32_t CMP_MIN: 12; - uint32_t RESERVED0: 4; - uint32_t CMP_MAX: 12; - uint32_t RESERVED1: 4; - }; - uint32_t Word; -} ADC_ACPCMP_Typedef; - -typedef union -{ - struct - { - uint32_t MEAN_DATA: 12; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} ADC_ACPMEAN_Typedef; - -typedef union -{ - struct - { - uint32_t VREF_EN: 1; - uint32_t RESERVED2: 1; - uint32_t IREF_EN: 1; - uint32_t RESERVED0: 1; - uint32_t VDET_EN: 1; - uint32_t VDET_SEL: 1; - uint32_t RESERVED1: 26; - }; - uint32_t Word; -} ADC_VREFCON_Typedef; - -typedef struct -{ - __I ADC_DR_Typedef DR; - __IO ADC_CON0_Typedef CON0; - __IO ADC_CON1_Typedef CON1; - __IO ADC_CHS_Typedef CHS; - __IO ADC_IE_Typedef IE; - __IO ADC_IF_Typedef IF; - uint32_t RESERVED0[4] ; - __IO ADC_ACPC_Typedef ACPC; - uint32_t RESERVED1 ; - __IO ADC_ACPCMP_Typedef ACPCMP; - __I ADC_ACPMEAN_Typedef ACPMEAN; - uint32_t RESERVED2[2] ; - __IO ADC_VREFCON_Typedef VREFCON; -} ADC_TypeDef; - -typedef union -{ - struct - { - uint32_t TMUP: 1; - uint32_t TMWR: 1; - uint32_t HSWI: 1; - uint32_t RESERVED0: 1; - uint32_t CLKS: 2; - uint32_t XST: 1; - uint32_t PON: 1; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} RTC_CON_Typedef; - -typedef union -{ - struct - { - uint32_t CALF: 8; - uint32_t DEV: 1; - uint32_t COCR: 3; - uint32_t CLKC: 1; - uint32_t RESERVED0: 19; - }; - uint32_t Word; -} RTC_CAL_Typedef; - -typedef union -{ - struct - { - uint32_t WM: 7; - uint32_t RESERVED0: 1; - uint32_t WH: 6; - uint32_t RESERVED1: 2; - uint32_t WW: 7; - uint32_t RESERVED2: 9; - }; - uint32_t Word; -} RTC_WA_Typedef; - -typedef union -{ - struct - { - uint32_t DM: 7; - uint32_t RESERVED0: 1; - uint32_t DH: 6; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} RTC_DA_Typedef; - -typedef union -{ - struct - { - uint32_t SEC: 7; - uint32_t RESERVED0: 1; - uint32_t MIN: 7; - uint32_t RESERVED1: 1; - uint32_t HOUR: 6; - uint32_t RESERVED2: 10; - }; - uint32_t Word; -} RTC_HMS_Typedef; - -typedef union -{ - struct - { - uint32_t WEEK: 7; - uint32_t RESERVED0: 1; - uint32_t DAY: 6; - uint32_t RESERVED1: 2; - uint32_t MON: 5; - uint32_t RESERVED2: 3; - uint32_t YEAR: 8; - }; - uint32_t Word; -} RTC_YMDW_Typedef; - -typedef union -{ - struct - { - uint32_t SCDIE: 1; - uint32_t MINIE: 1; - uint32_t HORIE: 1; - uint32_t DAYIE: 1; - uint32_t MONIE: 1; - uint32_t RESERVED0: 3; - uint32_t DALE: 1; - uint32_t WALE: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} RTC_IE_Typedef; - -typedef union -{ - struct - { - uint32_t SCDIF: 1; - uint32_t MINIF: 1; - uint32_t HORIF: 1; - uint32_t DAYIF: 1; - uint32_t MONIF: 1; - uint32_t RESERVED0: 3; - uint32_t DAFG: 1; - uint32_t WAFG: 1; - uint32_t RESERVED1: 22; - }; - uint32_t Word; -} RTC_IF_Typedef; - -typedef union -{ - struct - { - uint32_t WP: 32; - }; - uint32_t Word; -} RTC_WP_Typedef; - -typedef struct -{ - __IO RTC_CON_Typedef CON; - __IO RTC_CAL_Typedef CAL; - __IO RTC_WA_Typedef WA; - __IO RTC_DA_Typedef DA; - __IO RTC_HMS_Typedef HMS; - __IO RTC_YMDW_Typedef YMDW; - __IO RTC_IE_Typedef IE; - __IO RTC_IF_Typedef IF; - __IO RTC_WP_Typedef WP; -} RTC_TypeDef; - -typedef union -{ - struct - { - uint32_t LOAD: 32; - }; - uint32_t Word; -} IWDT_LOAD_Typedef; - -typedef union -{ - struct - { - uint32_t VALUE: 32; - }; - uint32_t Word; -} IWDT_VALUE_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t IE: 1; - uint32_t RSTEN: 1; - uint32_t CLKS: 1; - uint32_t RESERVED0: 28; - }; - uint32_t Word; -} IWDT_CON_Typedef; - -typedef union -{ - struct - { - uint32_t INTCLR: 32; - }; - uint32_t Word; -} IWDT_INTCLR_Typedef; - -typedef union -{ - struct - { - uint32_t WDTIF: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IWDT_RIS_Typedef; - -typedef union -{ - struct - { - uint32_t LOCK: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} IWDT_LOCK_Typedef; - -typedef struct -{ - __O IWDT_LOAD_Typedef LOAD; - __I IWDT_VALUE_Typedef VALUE; - __IO IWDT_CON_Typedef CON; - __O IWDT_INTCLR_Typedef INTCLR; - __I IWDT_RIS_Typedef RIS; - uint32_t RESERVED0[59] ; - __IO IWDT_LOCK_Typedef LOCK; -} IWDT_TypeDef; - -typedef union -{ - struct - { - uint32_t LOAD: 32; - }; - uint32_t Word; -} WWDT_LOAD_Typedef; - -typedef union -{ - struct - { - uint32_t VALUE: 32; - }; - uint32_t Word; -} WWDT_VALUE_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t IE: 1; - uint32_t RSTEN: 1; - uint32_t CLKS: 1; - uint32_t WWDTWIN: 2; - uint32_t RESERVED0: 26; - }; - uint32_t Word; -} WWDT_CON_Typedef; - -typedef union -{ - struct - { - uint32_t INTCLR: 32; - }; - uint32_t Word; -} WWDT_INTCLR_Typedef; - -typedef union -{ - struct - { - uint32_t WWDTIF: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} WWDT_RIS_Typedef; - -typedef union -{ - struct - { - uint32_t LOCK: 1; - uint32_t RESERVED0: 31; - }; - uint32_t Word; -} WWDT_LOCK_Typedef; - -typedef struct -{ - __O WWDT_LOAD_Typedef LOAD; - __I WWDT_VALUE_Typedef VALUE; - __IO WWDT_CON_Typedef CON; - __O WWDT_INTCLR_Typedef INTCLR; - __I WWDT_RIS_Typedef RIS; - uint32_t RESERVED0[59] ; - __IO WWDT_LOCK_Typedef LOCK; -} WWDT_TypeDef; - -typedef union -{ - struct - { - uint32_t CNT: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_CNT_Typedef; - -typedef union -{ - struct - { - uint32_t PRECNT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_PRECNT_Typedef; - -typedef union -{ - struct - { - uint32_t PREMAT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_PREMAT_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t CS: 2; - uint32_t SYNC: 1; - uint32_t EDGE: 2; - uint32_t MOD: 2; - uint32_t MAT0S: 2; - uint32_t MAT1S: 2; - uint32_t MAT2S: 2; - uint32_t MAT3S: 2; - uint32_t ASYWEN: 1; - uint32_t RESERVED0: 15; - }; - uint32_t Word; -} T16N_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CAPPE: 1; - uint32_t CAPNE: 1; - uint32_t CAPIS0: 1; - uint32_t CAPIS1: 1; - uint32_t CAPT: 4; - uint32_t CAPL0: 1; - uint32_t CAPL1: 1; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} T16N_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t MOE0: 1; - uint32_t MOE1: 1; - uint32_t POL0: 1; - uint32_t POL1: 1; - uint32_t MOM0: 2; - uint32_t MOM1: 2; - uint32_t MOM2: 2; - uint32_t MOM3: 2; - uint32_t PBKEN: 1; - uint32_t PBKPS: 1; - uint32_t PBKF: 1; - uint32_t RESERVED0: 1; - uint32_t PBKS: 3; - uint32_t RESERVED1: 1; - uint32_t PBKL0: 1; - uint32_t PBKL1: 1; - uint32_t RESERVED2: 10; - }; - uint32_t Word; -} T16N_CON2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IE: 1; - uint32_t MAT1IE: 1; - uint32_t MAT2IE: 1; - uint32_t MAT3IE: 1; - uint32_t OVIE: 1; - uint32_t CAP0IE: 1; - uint32_t CAP1IE: 1; - uint32_t PBKIE: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_IE_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IF: 1; - uint32_t MAT1IF: 1; - uint32_t MAT2IF: 1; - uint32_t MAT3IF: 1; - uint32_t OVIF: 1; - uint32_t CAP0IF: 1; - uint32_t CAP1IF: 1; - uint32_t PBKIF: 1; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T16N_IF_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0TAR: 1; - uint32_t MAT1TAR: 1; - uint32_t MAT2TAR: 1; - uint32_t MAT3TAR: 1; - uint32_t OVTAR: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} T16N_TRG_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT0_Typedef; - -typedef union -{ - struct - { - uint32_t MAT1: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT1_Typedef; - -typedef union -{ - struct - { - uint32_t MAT2: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT3: 16; - uint32_t RESERVED0: 16; - }; - uint32_t Word; -} T16N_MAT3_Typedef; - -typedef struct -{ - __IO T16N_CNT_Typedef CNT; - uint32_t RESERVED0; - __IO T16N_PRECNT_Typedef PRECNT; - __IO T16N_PREMAT_Typedef PREMAT; - __IO T16N_CON0_Typedef CON0; - __IO T16N_CON1_Typedef CON1; - __IO T16N_CON2_Typedef CON2; - uint32_t RESERVED1; - __IO T16N_IE_Typedef IE; - __IO T16N_IF_Typedef IF; - __IO T16N_TRG_Typedef TRG; - uint32_t RESERVED2; - __IO T16N_MAT0_Typedef MAT0; - __IO T16N_MAT1_Typedef MAT1; - __IO T16N_MAT2_Typedef MAT2; - __IO T16N_MAT3_Typedef MAT3; -} T16N_TypeDef; - -typedef union -{ - struct - { - uint32_t CNT: 32; - }; - uint32_t Word; -} T32N_CNT_Typedef; - -typedef union -{ - struct - { - uint32_t PRECNT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T32N_PRECNT_Typedef; - -typedef union -{ - struct - { - uint32_t PREMAT: 8; - uint32_t RESERVED0: 24; - }; - uint32_t Word; -} T32N_PREMAT_Typedef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t CS: 2; - uint32_t SYNC: 1; - uint32_t EDGE: 2; - uint32_t MOD: 2; - uint32_t MAT0S: 2; - uint32_t MAT1S: 2; - uint32_t MAT2S: 2; - uint32_t MAT3S: 2; - uint32_t ASYNC_WREN: 1; - uint32_t RESERVED0: 15; - }; - uint32_t Word; -} T32N_CON0_Typedef; - -typedef union -{ - struct - { - uint32_t CAPPE: 1; - uint32_t CAPNE: 1; - uint32_t CAPIS0: 1; - uint32_t CAPIS1: 1; - uint32_t CAPT: 4; - uint32_t CAPL0: 1; - uint32_t CAPL1: 1; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} T32N_CON1_Typedef; - -typedef union -{ - struct - { - uint32_t MOE0: 1; - uint32_t MOE1: 1; - uint32_t POL0: 1; - uint32_t POL1: 1; - uint32_t MOM0: 2; - uint32_t MOM1: 2; - uint32_t MOM2: 2; - uint32_t MOM3: 2; - uint32_t RESERVED0: 20; - }; - uint32_t Word; -} T32N_CON2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IE: 1; - uint32_t MAT1IE: 1; - uint32_t MAT2IE: 1; - uint32_t MAT3IE: 1; - uint32_t OVIE: 1; - uint32_t CAP0IE: 1; - uint32_t CAP1IE: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} T32N_IE_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0IF: 1; - uint32_t MAT1IF: 1; - uint32_t MAT2IF: 1; - uint32_t MAT3IF: 1; - uint32_t OVIF: 1; - uint32_t CAP0IF: 1; - uint32_t CAP1IF: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} T32N_IF_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0TAR: 1; - uint32_t MAT1TAR: 1; - uint32_t MAT2TAR: 1; - uint32_t MAT3TAR: 1; - uint32_t OVTAR: 1; - uint32_t RESERVED0: 27; - }; - uint32_t Word; -} T32N_TRG_Typedef; - -typedef union -{ - struct - { - uint32_t MAT0: 32; - }; - uint32_t Word; -} T32N_MAT0_Typedef; - -typedef union -{ - struct - { - uint32_t MAT1: 32; - }; - uint32_t Word; -} T32N_MAT1_Typedef; - -typedef union -{ - struct - { - uint32_t MAT2: 32; - }; - uint32_t Word; -} T32N_MAT2_Typedef; - -typedef union -{ - struct - { - uint32_t MAT3: 32; - }; - uint32_t Word; -} T32N_MAT3_Typedef; - -typedef struct -{ - __IO T32N_CNT_Typedef CNT; - uint32_t RESERVED0; - __IO T32N_PRECNT_Typedef PRECNT; - __IO T32N_PREMAT_Typedef PREMAT; - __IO T32N_CON0_Typedef CON0; - __IO T32N_CON1_Typedef CON1; - __IO T32N_CON2_Typedef CON2; - uint32_t RESERVED1; - __IO T32N_IE_Typedef IE; - __IO T32N_IF_Typedef IF; - __IO T32N_TRG_Typedef TRG; - uint32_t RESERVED2; - __IO T32N_MAT0_Typedef MAT0; - __IO T32N_MAT1_Typedef MAT1; - __IO T32N_MAT2_Typedef MAT2; - __IO T32N_MAT3_Typedef MAT3; -} T32N_TypeDef; - -typedef union -{ - struct - { - uint32_t TXEN: 1; - uint32_t TRST: 1; - uint32_t TXFS: 1; - uint32_t RESERVED0: 1; - uint32_t TXMOD: 3; - uint32_t TXP: 1; - uint32_t RXEN: 1; - uint32_t RRST: 1; - uint32_t RESERVED1: 2; - uint32_t RXMOD: 3; - uint32_t RXP: 1; - uint32_t RESERVED2: 12; - uint32_t BCS: 3; - uint32_t RESERVED3: 1; - }; - uint32_t Word; -} UART_CON_Typedef; - -typedef union -{ - struct - { - uint32_t BRR: 11; - uint32_t RESERVED0: 21; - }; - uint32_t Word; -} UART_BRR_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} UART_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} UART_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 9; - uint32_t RESERVED0: 3; - uint32_t TP0: 1; - uint32_t TBEF0: 1; - uint32_t RESERVED1: 2; - uint32_t TB1: 9; - uint32_t RESERVED2: 3; - uint32_t TP1: 1; - uint32_t TBEF1: 1; - uint32_t RESERVED3: 2; - }; - uint32_t Word; -} UART_TB01_Typedef; - -typedef union -{ - struct - { - uint32_t TB2: 9; - uint32_t RESERVED0: 3; - uint32_t TP2: 1; - uint32_t TBEF2: 1; - uint32_t RESERVED1: 2; - uint32_t TB3: 9; - uint32_t RESERVED2: 3; - uint32_t TP3: 1; - uint32_t TBEF3: 1; - uint32_t RESERVED3: 2; - }; - uint32_t Word; -} UART_TB23_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 9; - uint32_t RESERVED0: 3; - uint32_t RP0: 1; - uint32_t RBFF0: 1; - uint32_t FE0: 1; - uint32_t PE0: 1; - uint32_t RB1: 9; - uint32_t RESERVED1: 3; - uint32_t RP1: 1; - uint32_t RBFF1: 1; - uint32_t FE1: 1; - uint32_t PE1: 1; - }; - uint32_t Word; -} UART_RB01_Typedef; - -typedef union -{ - struct - { - uint32_t RB2: 9; - uint32_t RESERVED0: 3; - uint32_t RP2: 1; - uint32_t RBFF2: 1; - uint32_t FE2: 1; - uint32_t PE2: 1; - uint32_t RB3: 9; - uint32_t RESERVED1: 3; - uint32_t RP3: 1; - uint32_t RBFF3: 1; - uint32_t FE3: 1; - uint32_t PE3: 1; - }; - uint32_t Word; -} UART_RB23_Typedef; - -typedef union -{ - struct - { - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t ROIE: 1; - uint32_t FEIE: 1; - uint32_t PEIE: 1; - uint32_t TBEIE: 1; - uint32_t RESERVED0: 2; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t TIDIE: 1; - uint32_t RIDIE: 1; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} UART_IE_Typedef; - -typedef union -{ - struct - { - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t ROIF: 1; - uint32_t FEIF: 1; - uint32_t PEIF: 1; - uint32_t TBEIF: 1; - uint32_t RESERVED0: 6; - uint32_t TIDIF: 1; - uint32_t RIDIF: 1; - uint32_t RESERVED1: 18; - }; - uint32_t Word; -} UART_IF_Typedef; - -typedef struct -{ - __IO UART_CON_Typedef CON; - __IO UART_BRR_Typedef BRR; - __O UART_TBW_Typedef TBW; - __I UART_RBR_Typedef RBR; - __I UART_TB01_Typedef TB01; - __I UART_TB23_Typedef TB23; - __I UART_RB01_Typedef RB01; - __I UART_RB23_Typedef RB23; - __IO UART_IE_Typedef IE; - __IO UART_IF_Typedef IF; -} UART_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t MS: 1; - uint32_t REN: 1; - uint32_t RESERVED0: 1; - uint32_t DRE: 1; - uint32_t DFS: 2; - uint32_t RESERVED1: 8; - uint32_t TME: 1; - uint32_t TMS: 1; - uint32_t TMP: 6; - uint32_t DW: 3; - uint32_t RESERVED2: 3; - uint32_t TXCLR: 1; - uint32_t RXCLR: 1; - }; - uint32_t Word; -} SPI_CON_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} SPI_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} SPI_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t TEIE: 1; - uint32_t ROIE: 1; - uint32_t IDIE: 1; - uint32_t NSSIE: 1; - uint32_t TBWEIE: 1; - uint32_t RESERVED0: 1; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t RESERVED1: 20; - }; - uint32_t Word; -} SPI_IE_Typedef; - -typedef union -{ - struct - { - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t TEIF: 1; - uint32_t ROIF: 1; - uint32_t IDIF: 1; - uint32_t NSSIF: 1; - uint32_t TBWEIF: 1; - uint32_t RESERVED0: 25; - }; - uint32_t Word; -} SPI_IF_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 8; - uint32_t TB1: 8; - uint32_t TB2: 8; - uint32_t TB3: 8; - }; - uint32_t Word; -} SPI_TB_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 8; - uint32_t RB1: 8; - uint32_t RB2: 8; - uint32_t RB3: 8; - }; - uint32_t Word; -} SPI_RB_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 7; - uint32_t NSS: 1; - uint32_t TBEF0: 1; - uint32_t TBEF1: 1; - uint32_t TBEF2: 1; - uint32_t TBEF3: 1; - uint32_t RBFF0: 1; - uint32_t RBFF1: 1; - uint32_t RBFF2: 1; - uint32_t RBFF3: 1; - uint32_t IDLE: 1; - uint32_t RESERVED1: 15; - }; - uint32_t Word; -} SPI_STA_Typedef; - -typedef union -{ - struct - { - uint32_t CKS: 10; - uint32_t RESERVED0: 22; - }; - uint32_t Word; -} SPI_CKS_Typedef; - -typedef struct -{ - __IO SPI_CON_Typedef CON; - uint32_t RESERVED0 ; - __O SPI_TBW_Typedef TBW; - __I SPI_RBR_Typedef RBR; - __IO SPI_IE_Typedef IE; - __IO SPI_IF_Typedef IF; - __I SPI_TB_Typedef TB; - __I SPI_RB_Typedef RB; - __I SPI_STA_Typedef STA; - __IO SPI_CKS_Typedef CKS; -} SPI_TypeDef; - -typedef union -{ - struct - { - uint32_t EN: 1; - uint32_t RST: 1; - uint32_t SCKOD: 1; - uint32_t SDAOD: 1; - uint32_t SCKSE: 1; - uint32_t SDASE: 1; - uint32_t RESERVED0: 1; - uint32_t TJE: 1; - uint32_t TJP: 8; - uint32_t RW: 1; - uint32_t SA: 7; - uint32_t RESERVED1: 8; - }; - uint32_t Word; -} I2C_CON_Typedef; - -typedef union -{ - struct - { - uint32_t MS: 1; - uint32_t RDM: 3; - uint32_t CSE: 1; - uint32_t ANAE: 1; - uint32_t SRAE: 1; - uint32_t SPAE: 1; - uint32_t ADLY: 3; - uint32_t ADE: 1; - uint32_t TIS: 4; - uint32_t SRT: 1; - uint32_t SPT: 1; - uint32_t RDT: 1; - uint32_t BLD: 1; - uint32_t RESERVED0: 4; - uint32_t TAS: 1; - uint32_t RESERVED1: 7; - }; - uint32_t Word; -} I2C_MOD_Typedef; - -typedef union -{ - struct - { - uint32_t SRIE: 1; - uint32_t SPIE: 1; - uint32_t TBIE: 1; - uint32_t RBIE: 1; - uint32_t TEIE: 1; - uint32_t ROIE: 1; - uint32_t NAIE: 1; - uint32_t TBWEIE: 1; - uint32_t TBIM: 2; - uint32_t RBIM: 2; - uint32_t TIDLEIE: 1; - uint32_t RESERVED0: 19; - }; - uint32_t Word; -} I2C_IE_Typedef; - -typedef union -{ - struct - { - uint32_t SRIF: 1; - uint32_t SPIF: 1; - uint32_t TBIF: 1; - uint32_t RBIF: 1; - uint32_t TEIF: 1; - uint32_t ROIF: 1; - uint32_t NAIF: 1; - uint32_t TBWEIF: 1; - uint32_t RESERVED0: 4; - uint32_t TIDLEIF: 1; - uint32_t RESERVED1: 19; - }; - uint32_t Word; -} I2C_IF_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} I2C_TBW_Typedef; - -typedef union -{ - uint8_t Byte[4]; - uint16_t HalfWord[2]; - uint32_t Word; -} I2C_RBR_Typedef; - -typedef union -{ - struct - { - uint32_t TB0: 8; - uint32_t TB1: 8; - uint32_t TB2: 8; - uint32_t TB3: 8; - }; - uint32_t Word; -} I2C_TB_Typedef; - -typedef union -{ - struct - { - uint32_t RB0: 8; - uint32_t RB1: 8; - uint32_t RB2: 8; - uint32_t RB3: 8; - }; - uint32_t Word; -} I2C_RB_Typedef; - -typedef union -{ - struct - { - uint32_t RESERVED0: 8; - uint32_t TBEF0: 1; - uint32_t TBEF1: 1; - uint32_t TBEF2: 1; - uint32_t TBEF3: 1; - uint32_t RBFF0: 1; - uint32_t RBFF1: 1; - uint32_t RBFF2: 1; - uint32_t RBFF3: 1; - uint32_t ACK: 1; - uint32_t IDLE: 1; - uint32_t RESERVED1: 14; - }; - uint32_t Word; -} I2C_STA_Typedef; - -typedef struct -{ - __IO I2C_CON_Typedef CON; - __IO I2C_MOD_Typedef MOD; - __IO I2C_IE_Typedef IE; - __IO I2C_IF_Typedef IF; - __O I2C_TBW_Typedef TBW; - __I I2C_RBR_Typedef RBR; - __I I2C_TB_Typedef TB; - __I I2C_RB_Typedef RB; - __I I2C_STA_Typedef STA; -} I2C_TypeDef; - -typedef union -{ - struct - { - uint32_t AES_DATA0: 32; - }; - uint32_t Word; -} AES_DATA0_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA1: 32; - }; - uint32_t Word; -} AES_DATA1_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA2: 32; - }; - uint32_t Word; -} AES_DATA2_Typedef; - -typedef union -{ - struct - { - uint32_t AES_DATA3: 32; - }; - uint32_t Word; -} AES_DATA3_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY0: 32; - }; - uint32_t Word; -} AES_KEY0_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY1: 32; - }; - uint32_t Word; -} AES_KEY1_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY2: 32; - }; - uint32_t Word; -} AES_KEY2_Typedef; - -typedef union -{ - struct - { - uint32_t AES_KEY3: 32; - }; - uint32_t Word; -} AES_KEY3_Typedef; - -typedef union -{ - struct - { - uint32_t GO_DONE: 1; - uint32_t ENCRYPT: 1; - uint32_t RESERVED0: 4; - uint32_t IE: 1; - uint32_t IF: 1; - uint32_t RESERVED1: 24; - }; - uint32_t Word; -} AES_CON_Typedef; - -typedef struct -{ - __IO AES_DATA0_Typedef DATA0; - __IO AES_DATA1_Typedef DATA1; - __IO AES_DATA2_Typedef DATA2; - __IO AES_DATA3_Typedef DATA3; - __IO AES_KEY0_Typedef KEY0; - __IO AES_KEY1_Typedef KEY1; - __IO AES_KEY2_Typedef KEY2; - __IO AES_KEY3_Typedef KEY3; - __IO AES_CON_Typedef CON; -} AES_TypeDef; - -/******************************************************************************/ -/* 物理地址映射 */ -/******************************************************************************/ - -/* Base addresses */ -#define FLASH_BASE (0x00000000UL) -#define SRAM_BASE (0x20000000UL) -#define APB_BASE (0x40000000UL) -#define RAM_BASE (0x60000000UL) - -/* APB peripherals */ -#define SCU_BASE (APB_BASE + 0x00000) -#define CRC_BASE (APB_BASE + 0x00C00) -#define GPIO_BASE (APB_BASE + 0x20000) -#define IAP_BASE (APB_BASE + 0x00800) -#define ADC_BASE (APB_BASE + 0x01000) -#define RTC_BASE (APB_BASE + 0x01400) -#define IWDT_BASE (APB_BASE + 0x01C00) -#define WWDT_BASE (APB_BASE + 0x01800) -#define T16N0_BASE (APB_BASE + 0x02000) -#define T16N1_BASE (APB_BASE + 0x02400) -#define T16N2_BASE (APB_BASE + 0x02800) -#define T16N3_BASE (APB_BASE + 0x02C00) -#define T32N0_BASE (APB_BASE + 0x04000) -#define UART0_BASE (APB_BASE + 0x06000) -#define UART1_BASE (APB_BASE + 0x06400) -#define UART2_BASE (APB_BASE + 0x06800) -#define UART3_BASE (APB_BASE + 0x06C00) -#define UART4_BASE (APB_BASE + 0x07000) -#define UART5_BASE (APB_BASE + 0x07400) -#define SPI0_BASE (APB_BASE + 0x08000) -#define I2C0_BASE (APB_BASE + 0x09000) -#define AES_BASE (APB_BASE + 0x0A000) - -/******************************************************************************/ -/* 外设定义 */ -/******************************************************************************/ -#define SCU ((SCU_TypeDef *) SCU_BASE ) -#define CRC ((CRC_TypeDef *) CRC_BASE ) -#define GPIO ((GPIO_TypeDef *) GPIO_BASE ) -#define IAP ((IAP_TypeDef *) IAP_BASE ) -#define ADC ((ADC_TypeDef *) ADC_BASE ) -#define RTC ((RTC_TypeDef *) RTC_BASE ) -#define IWDT ((IWDT_TypeDef *) IWDT_BASE ) -#define WWDT ((WWDT_TypeDef *) WWDT_BASE ) -#define T16N0 ((T16N_TypeDef *) T16N0_BASE ) -#define T16N1 ((T16N_TypeDef *) T16N1_BASE ) -#define T16N2 ((T16N_TypeDef *) T16N2_BASE ) -#define T16N3 ((T16N_TypeDef *) T16N3_BASE ) -#define T32N0 ((T32N_TypeDef *) T32N0_BASE ) -#define UART0 ((UART_TypeDef *) UART0_BASE ) -#define UART1 ((UART_TypeDef *) UART1_BASE ) -#define UART2 ((UART_TypeDef *) UART2_BASE ) -#define UART3 ((UART_TypeDef *) UART3_BASE ) -#define UART4 ((UART_TypeDef *) UART4_BASE ) -#define UART5 ((UART_TypeDef *) UART5_BASE ) -#define SPI0 ((SPI_TypeDef *) SPI0_BASE ) -#define I2C0 ((I2C_TypeDef *) I2C0_BASE ) -#define AES ((AES_TypeDef *) AES_BASE ) - - -#endif diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h deleted file mode 100644 index e788e0a60a..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cm0.h +++ /dev/null @@ -1,668 +0,0 @@ -/**************************************************************************//** - * @file core_cm0.h - * @brief CMSIS Cortex-M0 Core Peripheral Access Layer Header File - * @version V3.02 - * @date 16. July 2012 - * - * @note - * Copyright (C) 2009-2012 ARM Limited. All rights reserved. - * - * @par - * ARM Limited (ARM) is supplying this software for use with Cortex-M - * processor based microcontrollers. This file can be freely distributed - * within development tools that are supporting such ARM based processors. - * - * @par - * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED - * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. - * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR - * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. - * - ******************************************************************************/ -#if defined ( __ICCARM__ ) - #pragma system_include /* treat file as system include file for MISRA check */ -#endif - -#ifdef __cplusplus - extern "C" { -#endif - -#ifndef __CORE_CM0_H_GENERIC -#define __CORE_CM0_H_GENERIC - -/** \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions - CMSIS violates the following MISRA-C:2004 rules: - - \li Required Rule 8.5, object/function definition in header file.
- Function definitions in header files are used to allow 'inlining'. - - \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
- Unions are used for effective representation of core registers. - - \li Advisory Rule 19.7, Function-like macro defined.
- Function-like macros are used to allow more efficient code. - */ - - -/******************************************************************************* - * CMSIS definitions - ******************************************************************************/ -/** \ingroup Cortex_M0 - @{ - */ - -/* CMSIS CM0 definitions */ -#define __CM0_CMSIS_VERSION_MAIN (0x03) /*!< [31:16] CMSIS HAL main version */ -#define __CM0_CMSIS_VERSION_SUB (0x01) /*!< [15:0] CMSIS HAL sub version */ -#define __CM0_CMSIS_VERSION ((__CM0_CMSIS_VERSION_MAIN << 16) | \ - __CM0_CMSIS_VERSION_SUB ) /*!< CMSIS HAL version number */ - -#define __CORTEX_M (0x00) /*!< Cortex-M Core */ - - -#if defined ( __CC_ARM ) - #define __ASM __asm /*!< asm keyword for ARM Compiler */ - #define __INLINE __inline /*!< inline keyword for ARM Compiler */ - #define __STATIC_INLINE static __inline - -#elif defined ( __ICCARM__ ) - #define __ASM __asm /*!< asm keyword for IAR Compiler */ - #define __INLINE inline /*!< inline keyword for IAR Compiler. Only available in High optimization mode! */ - #define __STATIC_INLINE static inline - -#elif defined ( __GNUC__ ) - #define __ASM __asm /*!< asm keyword for GNU Compiler */ - #define __INLINE inline /*!< inline keyword for GNU Compiler */ - #define __STATIC_INLINE static inline - -#elif defined ( __TASKING__ ) - #define __ASM __asm /*!< asm keyword for TASKING Compiler */ - #define __INLINE inline /*!< inline keyword for TASKING Compiler */ - #define __STATIC_INLINE static inline - -#endif - -/** __FPU_USED indicates whether an FPU is used or not. This core does not support an FPU at all -*/ -#define __FPU_USED 0 - -#if defined ( __CC_ARM ) - #if defined __TARGET_FPU_VFP - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __ICCARM__ ) - #if defined __ARMVFP__ - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __GNUC__ ) - #if defined (__VFP_FP__) && !defined(__SOFTFP__) - #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif - -#elif defined ( __TASKING__ ) - #if defined __FPU_VFP__ - #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" - #endif -#endif - -#include /* standard types definitions */ -#include /* Core Instruction Access */ -#include /* Core Function Access */ - - -#endif /* __CORE_CM0_H_GENERIC */ - -#ifndef __CMSIS_GENERIC - -#ifndef __CORE_CM0_H_DEPENDANT -#define __CORE_CM0_H_DEPENDANT - -/* check device defines and use defaults */ -#if defined __CHECK_DEVICE_DEFINES - #ifndef __CM0_REV - #define __CM0_REV 0x0000 - #warning "__CM0_REV not defined in device header file; using default!" - #endif - - #ifndef __NVIC_PRIO_BITS - #define __NVIC_PRIO_BITS 2 - #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" - #endif - - #ifndef __Vendor_SysTickConfig - #define __Vendor_SysTickConfig 0 - #warning "__Vendor_SysTickConfig not defined in device header file; using default!" - #endif -#endif - -/* IO definitions (access restrictions to peripheral registers) */ -/** - \defgroup CMSIS_glob_defs CMSIS Global Defines - - IO Type Qualifiers are used - \li to specify the access to peripheral variables. - \li for automatic generation of peripheral register debug information. -*/ -#ifdef __cplusplus - #define __I volatile /*!< Defines 'read only' permissions */ -#else - #define __I volatile const /*!< Defines 'read only' permissions */ -#endif -#define __O volatile /*!< Defines 'write only' permissions */ -#define __IO volatile /*!< Defines 'read / write' permissions */ - -/*@} end of group Cortex_M0 */ - - - -/******************************************************************************* - * Register Abstraction - Core Register contain: - - Core Register - - Core NVIC Register - - Core SCB Register - - Core SysTick Register - ******************************************************************************/ -/** \defgroup CMSIS_core_register Defines and Type Definitions - \brief Type definitions and defines for Cortex-M processor based devices. -*/ - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_CORE Status and Control Registers - \brief Core Register type definitions. - @{ - */ - -/** \brief Union type to access the Application Program Status Register (APSR). - */ -typedef union -{ - struct - { -#if (__CORTEX_M != 0x04) - uint32_t _reserved0:27; /*!< bit: 0..26 Reserved */ -#else - uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ -#endif - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} APSR_Type; - - -/** \brief Union type to access the Interrupt Program Status Register (IPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ - uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} IPSR_Type; - - -/** \brief Union type to access the Special-Purpose Program Status Registers (xPSR). - */ -typedef union -{ - struct - { - uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ -#if (__CORTEX_M != 0x04) - uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ -#else - uint32_t _reserved0:7; /*!< bit: 9..15 Reserved */ - uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ - uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ -#endif - uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ - uint32_t IT:2; /*!< bit: 25..26 saved IT state (read 0) */ - uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ - uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ - uint32_t C:1; /*!< bit: 29 Carry condition code flag */ - uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ - uint32_t N:1; /*!< bit: 31 Negative condition code flag */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} xPSR_Type; - - -/** \brief Union type to access the Control Registers (CONTROL). - */ -typedef union -{ - struct - { - uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ - uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ - uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ - uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ - } b; /*!< Structure used for bit access */ - uint32_t w; /*!< Type used for word access */ -} CONTROL_Type; - -/*@} end of group CMSIS_CORE */ - - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) - \brief Type definitions for the NVIC Registers - @{ - */ - -/** \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). - */ -typedef struct -{ - __IO uint32_t ISER[1]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ - uint32_t RESERVED0[31]; - __IO uint32_t ICER[1]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ - uint32_t RSERVED1[31]; - __IO uint32_t ISPR[1]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ - uint32_t RESERVED2[31]; - __IO uint32_t ICPR[1]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ - uint32_t RESERVED3[31]; - uint32_t RESERVED4[64]; - __IO uint32_t IP[8]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register */ -} NVIC_Type; - -/*@} end of group CMSIS_NVIC */ - - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_SCB System Control Block (SCB) - \brief Type definitions for the System Control Block Registers - @{ - */ - -/** \brief Structure type to access the System Control Block (SCB). - */ -typedef struct -{ - __I uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ - __IO uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ - uint32_t RESERVED0; - __IO uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ - __IO uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ - __IO uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ - uint32_t RESERVED1; - __IO uint32_t SHP[2]; /*!< Offset: 0x01C (R/W) System Handlers Priority Registers. [0] is RESERVED */ - __IO uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ -} SCB_Type; - -/* SCB CPUID Register Definitions */ -#define SCB_CPUID_IMPLEMENTER_Pos 24 /*!< SCB CPUID: IMPLEMENTER Position */ -#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ - -#define SCB_CPUID_VARIANT_Pos 20 /*!< SCB CPUID: VARIANT Position */ -#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ - -#define SCB_CPUID_ARCHITECTURE_Pos 16 /*!< SCB CPUID: ARCHITECTURE Position */ -#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ - -#define SCB_CPUID_PARTNO_Pos 4 /*!< SCB CPUID: PARTNO Position */ -#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ - -#define SCB_CPUID_REVISION_Pos 0 /*!< SCB CPUID: REVISION Position */ -#define SCB_CPUID_REVISION_Msk (0xFUL << SCB_CPUID_REVISION_Pos) /*!< SCB CPUID: REVISION Mask */ - -/* SCB Interrupt Control State Register Definitions */ -#define SCB_ICSR_NMIPENDSET_Pos 31 /*!< SCB ICSR: NMIPENDSET Position */ -#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ - -#define SCB_ICSR_PENDSVSET_Pos 28 /*!< SCB ICSR: PENDSVSET Position */ -#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ - -#define SCB_ICSR_PENDSVCLR_Pos 27 /*!< SCB ICSR: PENDSVCLR Position */ -#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ - -#define SCB_ICSR_PENDSTSET_Pos 26 /*!< SCB ICSR: PENDSTSET Position */ -#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ - -#define SCB_ICSR_PENDSTCLR_Pos 25 /*!< SCB ICSR: PENDSTCLR Position */ -#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ - -#define SCB_ICSR_ISRPREEMPT_Pos 23 /*!< SCB ICSR: ISRPREEMPT Position */ -#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ - -#define SCB_ICSR_ISRPENDING_Pos 22 /*!< SCB ICSR: ISRPENDING Position */ -#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ - -#define SCB_ICSR_VECTPENDING_Pos 12 /*!< SCB ICSR: VECTPENDING Position */ -#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ - -#define SCB_ICSR_VECTACTIVE_Pos 0 /*!< SCB ICSR: VECTACTIVE Position */ -#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL << SCB_ICSR_VECTACTIVE_Pos) /*!< SCB ICSR: VECTACTIVE Mask */ - -/* SCB Application Interrupt and Reset Control Register Definitions */ -#define SCB_AIRCR_VECTKEY_Pos 16 /*!< SCB AIRCR: VECTKEY Position */ -#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ - -#define SCB_AIRCR_VECTKEYSTAT_Pos 16 /*!< SCB AIRCR: VECTKEYSTAT Position */ -#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ - -#define SCB_AIRCR_ENDIANESS_Pos 15 /*!< SCB AIRCR: ENDIANESS Position */ -#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ - -#define SCB_AIRCR_SYSRESETREQ_Pos 2 /*!< SCB AIRCR: SYSRESETREQ Position */ -#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ - -#define SCB_AIRCR_VECTCLRACTIVE_Pos 1 /*!< SCB AIRCR: VECTCLRACTIVE Position */ -#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ - -/* SCB System Control Register Definitions */ -#define SCB_SCR_SEVONPEND_Pos 4 /*!< SCB SCR: SEVONPEND Position */ -#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ - -#define SCB_SCR_SLEEPDEEP_Pos 2 /*!< SCB SCR: SLEEPDEEP Position */ -#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ - -#define SCB_SCR_SLEEPONEXIT_Pos 1 /*!< SCB SCR: SLEEPONEXIT Position */ -#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ - -/* SCB Configuration Control Register Definitions */ -#define SCB_CCR_STKALIGN_Pos 9 /*!< SCB CCR: STKALIGN Position */ -#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ - -#define SCB_CCR_UNALIGN_TRP_Pos 3 /*!< SCB CCR: UNALIGN_TRP Position */ -#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ - -/* SCB System Handler Control and State Register Definitions */ -#define SCB_SHCSR_SVCALLPENDED_Pos 15 /*!< SCB SHCSR: SVCALLPENDED Position */ -#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ - -/*@} end of group CMSIS_SCB */ - - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_SysTick System Tick Timer (SysTick) - \brief Type definitions for the System Timer Registers. - @{ - */ - -/** \brief Structure type to access the System Timer (SysTick). - */ -typedef struct -{ - __IO uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ - __IO uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ - __IO uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ - __I uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ -} SysTick_Type; - -/* SysTick Control / Status Register Definitions */ -#define SysTick_CTRL_COUNTFLAG_Pos 16 /*!< SysTick CTRL: COUNTFLAG Position */ -#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ - -#define SysTick_CTRL_CLKSOURCE_Pos 2 /*!< SysTick CTRL: CLKSOURCE Position */ -#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ - -#define SysTick_CTRL_TICKINT_Pos 1 /*!< SysTick CTRL: TICKINT Position */ -#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ - -#define SysTick_CTRL_ENABLE_Pos 0 /*!< SysTick CTRL: ENABLE Position */ -#define SysTick_CTRL_ENABLE_Msk (1UL << SysTick_CTRL_ENABLE_Pos) /*!< SysTick CTRL: ENABLE Mask */ - -/* SysTick Reload Register Definitions */ -#define SysTick_LOAD_RELOAD_Pos 0 /*!< SysTick LOAD: RELOAD Position */ -#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL << SysTick_LOAD_RELOAD_Pos) /*!< SysTick LOAD: RELOAD Mask */ - -/* SysTick Current Register Definitions */ -#define SysTick_VAL_CURRENT_Pos 0 /*!< SysTick VAL: CURRENT Position */ -#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick VAL: CURRENT Mask */ - -/* SysTick Calibration Register Definitions */ -#define SysTick_CALIB_NOREF_Pos 31 /*!< SysTick CALIB: NOREF Position */ -#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ - -#define SysTick_CALIB_SKEW_Pos 30 /*!< SysTick CALIB: SKEW Position */ -#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ - -#define SysTick_CALIB_TENMS_Pos 0 /*!< SysTick CALIB: TENMS Position */ -#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL << SysTick_VAL_CURRENT_Pos) /*!< SysTick CALIB: TENMS Mask */ - -/*@} end of group CMSIS_SysTick */ - - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) - \brief Cortex-M0 Core Debug Registers (DCB registers, SHCSR, and DFSR) - are only accessible over DAP and not via processor. Therefore - they are not covered by the Cortex-M0 header file. - @{ - */ -/*@} end of group CMSIS_CoreDebug */ - - -/** \ingroup CMSIS_core_register - \defgroup CMSIS_core_base Core Definitions - \brief Definitions for base addresses, unions, and structures. - @{ - */ - -/* Memory mapping of Cortex-M0 Hardware */ -#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ -#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ -#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ -#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ - -#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ -#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ -#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ - - -/*@} */ - - - -/******************************************************************************* - * Hardware Abstraction Layer - Core Function Interface contains: - - Core NVIC Functions - - Core SysTick Functions - - Core Register Access Functions - ******************************************************************************/ -/** \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference -*/ - - - -/* ########################## NVIC functions #################################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_NVICFunctions NVIC Functions - \brief Functions that manage interrupts and exceptions via the NVIC. - @{ - */ - -/* Interrupt Priorities are WORD accessible only under ARMv6M */ -/* The following MACROS handle generation of the register offset and byte masks */ -#define _BIT_SHIFT(IRQn) ( (((uint32_t)(IRQn) ) & 0x03) * 8 ) -#define _SHP_IDX(IRQn) ( ((((uint32_t)(IRQn) & 0x0F)-8) >> 2) ) -#define _IP_IDX(IRQn) ( ((uint32_t)(IRQn) >> 2) ) - - -/** \brief Enable External Interrupt - - The function enables a device-specific interrupt in the NVIC interrupt controller. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn) -{ - NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Disable External Interrupt - - The function disables a device-specific interrupt in the NVIC interrupt controller. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_DisableIRQ(IRQn_Type IRQn) -{ - NVIC->ICER[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Get Pending Interrupt - - The function reads the pending register in the NVIC and returns the pending bit - for the specified interrupt. - - \param [in] IRQn Interrupt number. - - \return 0 Interrupt status is not pending. - \return 1 Interrupt status is pending. - */ -__STATIC_INLINE uint32_t NVIC_GetPendingIRQ(IRQn_Type IRQn) -{ - return((uint32_t) ((NVIC->ISPR[0] & (1 << ((uint32_t)(IRQn) & 0x1F)))?1:0)); -} - - -/** \brief Set Pending Interrupt - - The function sets the pending bit of an external interrupt. - - \param [in] IRQn Interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_SetPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ISPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); -} - - -/** \brief Clear Pending Interrupt - - The function clears the pending bit of an external interrupt. - - \param [in] IRQn External interrupt number. Value cannot be negative. - */ -__STATIC_INLINE void NVIC_ClearPendingIRQ(IRQn_Type IRQn) -{ - NVIC->ICPR[0] = (1 << ((uint32_t)(IRQn) & 0x1F)); /* Clear pending interrupt */ -} - - -/** \brief Set Interrupt Priority - - The function sets the priority of an interrupt. - - \note The priority cannot be set for every core interrupt. - - \param [in] IRQn Interrupt number. - \param [in] priority Priority to set. - */ -__STATIC_INLINE void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) -{ - if(IRQn < 0) { - SCB->SHP[_SHP_IDX(IRQn)] = (SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | - (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } - else { - NVIC->IP[_IP_IDX(IRQn)] = (NVIC->IP[_IP_IDX(IRQn)] & ~(0xFF << _BIT_SHIFT(IRQn))) | - (((priority << (8 - __NVIC_PRIO_BITS)) & 0xFF) << _BIT_SHIFT(IRQn)); } -} - - -/** \brief Get Interrupt Priority - - The function reads the priority of an interrupt. The interrupt - number can be positive to specify an external (device specific) - interrupt, or negative to specify an internal (core) interrupt. - - - \param [in] IRQn Interrupt number. - \return Interrupt Priority. Value is aligned automatically to the implemented - priority bits of the microcontroller. - */ -__STATIC_INLINE uint32_t NVIC_GetPriority(IRQn_Type IRQn) -{ - - if(IRQn < 0) { - return((uint32_t)((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for Cortex-M0 system interrupts */ - else { - return((uint32_t)((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) >> (8 - __NVIC_PRIO_BITS))); } /* get priority for device specific interrupts */ -} - - -/** \brief System Reset - - The function initiates a system reset request to reset the MCU. - */ -__STATIC_INLINE void NVIC_SystemReset(void) -{ - __DSB(); /* Ensure all outstanding memory accesses included - buffered write are completed before reset */ - SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) | - SCB_AIRCR_SYSRESETREQ_Msk); - __DSB(); /* Ensure completion of memory access */ - while(1); /* wait until reset */ -} - -/*@} end of CMSIS_Core_NVICFunctions */ - - - -/* ################################## SysTick function ############################################ */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_SysTickFunctions SysTick Functions - \brief Functions that configure the System. - @{ - */ - -#if (__Vendor_SysTickConfig == 0) - -/** \brief System Tick Configuration - - The function initializes the System Timer and its interrupt, and starts the System Tick Timer. - Counter is in free running mode to generate periodic interrupts. - - \param [in] ticks Number of ticks between two interrupts. - - \return 0 Function succeeded. - \return 1 Function failed. - - \note When the variable __Vendor_SysTickConfig is set to 1, then the - function SysTick_Config is not included. In this case, the file device.h - must contain a vendor-specific implementation of this function. - - */ -__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) -{ - if ((ticks - 1) > SysTick_LOAD_RELOAD_Msk) return (1); /* Reload value impossible */ - - SysTick->LOAD = ticks - 1; /* set reload register */ - NVIC_SetPriority (SysTick_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority for Systick Interrupt */ - SysTick->VAL = 0; /* Load the SysTick Counter Value */ - SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | - SysTick_CTRL_TICKINT_Msk | - SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ - return (0); /* Function successful */ -} - -#endif - -/*@} end of CMSIS_Core_SysTickFunctions */ - - - - -#endif /* __CORE_CM0_H_DEPENDANT */ - -#endif /* __CMSIS_GENERIC */ - -#ifdef __cplusplus -} -#endif diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h deleted file mode 100644 index 0a18fafc30..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmFunc.h +++ /dev/null @@ -1,636 +0,0 @@ -/**************************************************************************//** - * @file core_cmFunc.h - * @brief CMSIS Cortex-M Core Function Access Header File - * @version V3.20 - * @date 25. February 2013 - * - * @note - * - ******************************************************************************/ -/* Copyright (c) 2009 - 2013 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of ARM nor the names of its contributors may be used - to endorse or promote products derived from this software without - specific prior written permission. - * - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#ifndef __CORE_CMFUNC_H -#define __CORE_CMFUNC_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ -/* ARM armcc specific functions */ - -#if (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - -/* intrinsic void __enable_irq(); */ -/* intrinsic void __disable_irq(); */ - -/** \brief Get Control Register - - This function returns the content of the Control Register. - - \return Control Register value - */ -__STATIC_INLINE uint32_t __get_CONTROL(void) -{ - register uint32_t __regControl __ASM("control"); - return(__regControl); -} - - -/** \brief Set Control Register - - This function writes the given value to the Control Register. - - \param [in] control Control Register value to set - */ -__STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - register uint32_t __regControl __ASM("control"); - __regControl = control; -} - - -/** \brief Get IPSR Register - - This function returns the content of the IPSR Register. - - \return IPSR Register value - */ -__STATIC_INLINE uint32_t __get_IPSR(void) -{ - register uint32_t __regIPSR __ASM("ipsr"); - return(__regIPSR); -} - - -/** \brief Get APSR Register - - This function returns the content of the APSR Register. - - \return APSR Register value - */ -__STATIC_INLINE uint32_t __get_APSR(void) -{ - register uint32_t __regAPSR __ASM("apsr"); - return(__regAPSR); -} - - -/** \brief Get xPSR Register - - This function returns the content of the xPSR Register. - - \return xPSR Register value - */ -__STATIC_INLINE uint32_t __get_xPSR(void) -{ - register uint32_t __regXPSR __ASM("xpsr"); - return(__regXPSR); -} - - -/** \brief Get Process Stack Pointer - - This function returns the current value of the Process Stack Pointer (PSP). - - \return PSP Register value - */ -__STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - return(__regProcessStackPointer); -} - - -/** \brief Set Process Stack Pointer - - This function assigns the given value to the Process Stack Pointer (PSP). - - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - __regProcessStackPointer = topOfProcStack; -} - - -/** \brief Get Main Stack Pointer - - This function returns the current value of the Main Stack Pointer (MSP). - - \return MSP Register value - */ -__STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - return(__regMainStackPointer); -} - - -/** \brief Set Main Stack Pointer - - This function assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - __regMainStackPointer = topOfMainStack; -} - - -/** \brief Get Priority Mask - - This function returns the current state of the priority mask bit from the Priority Mask Register. - - \return Priority Mask value - */ -__STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - register uint32_t __regPriMask __ASM("primask"); - return(__regPriMask); -} - - -/** \brief Set Priority Mask - - This function assigns the given value to the Priority Mask Register. - - \param [in] priMask Priority Mask - */ -__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - register uint32_t __regPriMask __ASM("primask"); - __regPriMask = (priMask); -} - - -#if (__CORTEX_M >= 0x03) - -/** \brief Enable FIQ - - This function enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __enable_fault_irq __enable_fiq - - -/** \brief Disable FIQ - - This function disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __disable_fault_irq __disable_fiq - - -/** \brief Get Base Priority - - This function returns the current value of the Base Priority register. - - \return Base Priority register value - */ -__STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - register uint32_t __regBasePri __ASM("basepri"); - return(__regBasePri); -} - - -/** \brief Set Base Priority - - This function assigns the given value to the Base Priority register. - - \param [in] basePri Base Priority value to set - */ -__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) -{ - register uint32_t __regBasePri __ASM("basepri"); - __regBasePri = (basePri & 0xff); -} - - -/** \brief Get Fault Mask - - This function returns the current value of the Fault Mask register. - - \return Fault Mask register value - */ -__STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - return(__regFaultMask); -} - - -/** \brief Set Fault Mask - - This function assigns the given value to the Fault Mask register. - - \param [in] faultMask Fault Mask value to set - */ -__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - __regFaultMask = (faultMask & (uint32_t)1); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - -#if (__CORTEX_M == 0x04) - -/** \brief Get FPSCR - - This function returns the current value of the Floating Point Status/Control register. - - \return Floating Point Status/Control register value - */ -__STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - return(__regfpscr); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function assigns the given value to the Floating Point Status/Control register. - - \param [in] fpscr Floating Point Status/Control value to set - */ -__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - __regfpscr = (fpscr); -#endif -} - -#endif /* (__CORTEX_M == 0x04) */ - - -#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ -/* IAR iccarm specific functions */ - -#include - - -#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ -/* TI CCS specific functions */ - -#include - - -#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ -/* GNU gcc specific functions */ - -/** \brief Enable IRQ Interrupts - - This function enables IRQ interrupts by clearing the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) -{ - __ASM volatile ("cpsie i" : : : "memory"); -} - - -/** \brief Disable IRQ Interrupts - - This function disables IRQ interrupts by setting the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) -{ - __ASM volatile ("cpsid i" : : : "memory"); -} - - -/** \brief Get Control Register - - This function returns the content of the Control Register. - - \return Control Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -/** \brief Set Control Register - - This function writes the given value to the Control Register. - - \param [in] control Control Register value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -/** \brief Get IPSR Register - - This function returns the content of the IPSR Register. - - \return IPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get APSR Register - - This function returns the content of the APSR Register. - - \return APSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get xPSR Register - - This function returns the content of the xPSR Register. - - \return xPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get Process Stack Pointer - - This function returns the current value of the Process Stack Pointer (PSP). - - \return PSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Process Stack Pointer - - This function assigns the given value to the Process Stack Pointer (PSP). - - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); -} - - -/** \brief Get Main Stack Pointer - - This function returns the current value of the Main Stack Pointer (MSP). - - \return MSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Main Stack Pointer - - This function assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : "sp"); -} - - -/** \brief Get Priority Mask - - This function returns the current state of the priority mask bit from the Priority Mask Register. - - \return Priority Mask value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Priority Mask - - This function assigns the given value to the Priority Mask Register. - - \param [in] priMask Priority Mask - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__CORTEX_M >= 0x03) - -/** \brief Enable FIQ - - This function enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) -{ - __ASM volatile ("cpsie f" : : : "memory"); -} - - -/** \brief Disable FIQ - - This function disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) -{ - __ASM volatile ("cpsid f" : : : "memory"); -} - - -/** \brief Get Base Priority - - This function returns the current value of the Base Priority register. - - \return Base Priority register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); - return(result); -} - - -/** \brief Set Base Priority - - This function assigns the given value to the Base Priority register. - - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -/** \brief Get Fault Mask - - This function returns the current value of the Fault Mask register. - - \return Fault Mask register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Fault Mask - - This function assigns the given value to the Fault Mask register. - - \param [in] faultMask Fault Mask value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - -#if (__CORTEX_M == 0x04) - -/** \brief Get FPSCR - - This function returns the current value of the Floating Point Status/Control register. - - \return Floating Point Status/Control register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - uint32_t result; - - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function assigns the given value to the Floating Point Status/Control register. - - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} - -#endif /* (__CORTEX_M == 0x04) */ - - -#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ -/* TASKING carm specific functions */ - -/* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all instrinsics, - * Including the CMSIS ones. - */ - -#endif - -/*@} end of CMSIS_Core_RegAccFunctions */ - - -#endif /* __CORE_CMFUNC_H */ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h b/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h deleted file mode 100644 index d213f0eed7..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/core_cmInstr.h +++ /dev/null @@ -1,688 +0,0 @@ -/**************************************************************************//** - * @file core_cmInstr.h - * @brief CMSIS Cortex-M Core Instruction Access Header File - * @version V3.20 - * @date 05. March 2013 - * - * @note - * - ******************************************************************************/ -/* Copyright (c) 2009 - 2013 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of ARM nor the names of its contributors may be used - to endorse or promote products derived from this software without - specific prior written permission. - * - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#ifndef __CORE_CMINSTR_H -#define __CORE_CMINSTR_H - - -/* ########################## Core Instruction Access ######################### */ -/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface - Access to dedicated instructions - @{ -*/ - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ -/* ARM armcc specific functions */ - -#if (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - - -/** \brief No Operation - - No Operation does nothing. This instruction can be used for code alignment purposes. - */ -#define __NOP __nop - - -/** \brief Wait For Interrupt - - Wait For Interrupt is a hint instruction that suspends execution - until one of a number of events occurs. - */ -#define __WFI __wfi - - -/** \brief Wait For Event - - Wait For Event is a hint instruction that permits the processor to enter - a low-power state until one of a number of events occurs. - */ -#define __WFE __wfe - - -/** \brief Send Event - - Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -#define __SEV __sev - - -/** \brief Instruction Synchronization Barrier - - Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or - memory, after the instruction has been completed. - */ -#define __ISB() __isb(0xF) - - -/** \brief Data Synchronization Barrier - - This function acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -#define __DSB() __dsb(0xF) - - -/** \brief Data Memory Barrier - - This function ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -#define __DMB() __dmb(0xF) - - -/** \brief Reverse byte order (32 bit) - - This function reverses the byte order in integer value. - - \param [in] value Value to reverse - \return Reversed value - */ -#define __REV __rev - - -/** \brief Reverse byte order (16 bit) - - This function reverses the byte order in two unsigned short values. - - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) -{ - rev16 r0, r0 - bx lr -} -#endif - -/** \brief Reverse byte order in signed short value - - This function reverses the byte order in a signed short value with sign extension to integer. - - \param [in] value Value to reverse - \return Reversed value - */ -#ifndef __NO_EMBEDDED_ASM -__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int32_t __REVSH(int32_t value) -{ - revsh r0, r0 - bx lr -} -#endif - - -/** \brief Rotate Right in unsigned value (32 bit) - - This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - - \param [in] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -#define __ROR __ror - - -/** \brief Breakpoint - - This function causes the processor to enter Debug state. - Debug tools can use this to investigate system state when the instruction at a particular address is reached. - - \param [in] value is ignored by the processor. - If required, a debugger can use it to store additional information about the breakpoint. - */ -#define __BKPT(value) __breakpoint(value) - - -#if (__CORTEX_M >= 0x03) - -/** \brief Reverse bit order of value - - This function reverses the bit order of the given value. - - \param [in] value Value to reverse - \return Reversed value - */ -#define __RBIT __rbit - - -/** \brief LDR Exclusive (8 bit) - - This function performs a exclusive LDR command for 8 bit value. - - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) - - -/** \brief LDR Exclusive (16 bit) - - This function performs a exclusive LDR command for 16 bit values. - - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) - - -/** \brief LDR Exclusive (32 bit) - - This function performs a exclusive LDR command for 32 bit values. - - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) - - -/** \brief STR Exclusive (8 bit) - - This function performs a exclusive STR command for 8 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXB(value, ptr) __strex(value, ptr) - - -/** \brief STR Exclusive (16 bit) - - This function performs a exclusive STR command for 16 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXH(value, ptr) __strex(value, ptr) - - -/** \brief STR Exclusive (32 bit) - - This function performs a exclusive STR command for 32 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -#define __STREXW(value, ptr) __strex(value, ptr) - - -/** \brief Remove the exclusive lock - - This function removes the exclusive lock which is created by LDREX. - - */ -#define __CLREX __clrex - - -/** \brief Signed Saturate - - This function saturates a signed value. - - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (1..32) - \return Saturated value - */ -#define __SSAT __ssat - - -/** \brief Unsigned Saturate - - This function saturates an unsigned value. - - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT __usat - - -/** \brief Count leading zeros - - This function counts the number of leading zeros of a data value. - - \param [in] value Value to count the leading zeros - \return number of leading zeros in value - */ -#define __CLZ __clz - -#endif /* (__CORTEX_M >= 0x03) */ - - - -#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ -/* IAR iccarm specific functions */ - -#include - - -#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ -/* TI CCS specific functions */ - -#include - - -#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ -/* GNU gcc specific functions */ - -/* Define macros for porting to both thumb1 and thumb2. - * For thumb1, use low register (r0-r7), specified by constrant "l" - * Otherwise, use general registers, specified by constrant "r" */ -#if defined (__thumb__) && !defined (__thumb2__) -#define __CMSIS_GCC_OUT_REG(r) "=l" (r) -#define __CMSIS_GCC_USE_REG(r) "l" (r) -#else -#define __CMSIS_GCC_OUT_REG(r) "=r" (r) -#define __CMSIS_GCC_USE_REG(r) "r" (r) -#endif - -/** \brief No Operation - - No Operation does nothing. This instruction can be used for code alignment purposes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __NOP(void) -{ - __ASM volatile ("nop"); -} - - -/** \brief Wait For Interrupt - - Wait For Interrupt is a hint instruction that suspends execution - until one of a number of events occurs. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFI(void) -{ - __ASM volatile ("wfi"); -} - - -/** \brief Wait For Event - - Wait For Event is a hint instruction that permits the processor to enter - a low-power state until one of a number of events occurs. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __WFE(void) -{ - __ASM volatile ("wfe"); -} - - -/** \brief Send Event - - Send Event is a hint instruction. It causes an event to be signaled to the CPU. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __SEV(void) -{ - __ASM volatile ("sev"); -} - - -/** \brief Instruction Synchronization Barrier - - Instruction Synchronization Barrier flushes the pipeline in the processor, - so that all instructions following the ISB are fetched from cache or - memory, after the instruction has been completed. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __ISB(void) -{ - __ASM volatile ("isb"); -} - - -/** \brief Data Synchronization Barrier - - This function acts as a special kind of Data Memory Barrier. - It completes when all explicit memory accesses before this instruction complete. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __DSB(void) -{ - __ASM volatile ("dsb"); -} - - -/** \brief Data Memory Barrier - - This function ensures the apparent order of the explicit memory operations before - and after the instruction, without ensuring their completion. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __DMB(void) -{ - __ASM volatile ("dmb"); -} - - -/** \brief Reverse byte order (32 bit) - - This function reverses the byte order in integer value. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV(uint32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) - return __builtin_bswap32(value); -#else - uint32_t result; - - __ASM volatile ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -#endif -} - - -/** \brief Reverse byte order (16 bit) - - This function reverses the byte order in two unsigned short values. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __REV16(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -} - - -/** \brief Reverse byte order in signed short value - - This function reverses the byte order in a signed short value with sign extension to integer. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE int32_t __REVSH(int32_t value) -{ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - return (short)__builtin_bswap16(value); -#else - uint32_t result; - - __ASM volatile ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); - return(result); -#endif -} - - -/** \brief Rotate Right in unsigned value (32 bit) - - This function Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. - - \param [in] value Value to rotate - \param [in] value Number of Bits to rotate - \return Rotated value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __ROR(uint32_t op1, uint32_t op2) -{ - return (op1 >> op2) | (op1 << (32 - op2)); -} - - -/** \brief Breakpoint - - This function causes the processor to enter Debug state. - Debug tools can use this to investigate system state when the instruction at a particular address is reached. - - \param [in] value is ignored by the processor. - If required, a debugger can use it to store additional information about the breakpoint. - */ -#define __BKPT(value) __ASM volatile ("bkpt "#value) - - -#if (__CORTEX_M >= 0x03) - -/** \brief Reverse bit order of value - - This function reverses the bit order of the given value. - - \param [in] value Value to reverse - \return Reversed value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __RBIT(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("rbit %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - - -/** \brief LDR Exclusive (8 bit) - - This function performs a exclusive LDR command for 8 bit value. - - \param [in] ptr Pointer to data - \return value of type uint8_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __LDREXB(volatile uint8_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return(result); -} - - -/** \brief LDR Exclusive (16 bit) - - This function performs a exclusive LDR command for 16 bit values. - - \param [in] ptr Pointer to data - \return value of type uint16_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint16_t __LDREXH(volatile uint16_t *addr) -{ - uint32_t result; - -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) - __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); -#else - /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not - accepted by assembler. So has to use following less efficient pattern. - */ - __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); -#endif - return(result); -} - - -/** \brief LDR Exclusive (32 bit) - - This function performs a exclusive LDR command for 32 bit values. - - \param [in] ptr Pointer to data - \return value of type uint32_t at (*ptr) - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __LDREXW(volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); - return(result); -} - - -/** \brief STR Exclusive (8 bit) - - This function performs a exclusive STR command for 8 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** \brief STR Exclusive (16 bit) - - This function performs a exclusive STR command for 16 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) -{ - uint32_t result; - - __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** \brief STR Exclusive (32 bit) - - This function performs a exclusive STR command for 32 bit values. - - \param [in] value Value to store - \param [in] ptr Pointer to location - \return 0 Function succeeded - \return 1 Function failed - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) -{ - uint32_t result; - - __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); - return(result); -} - - -/** \brief Remove the exclusive lock - - This function removes the exclusive lock which is created by LDREX. - - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __CLREX(void) -{ - __ASM volatile ("clrex" ::: "memory"); -} - - -/** \brief Signed Saturate - - This function saturates a signed value. - - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (1..32) - \return Saturated value - */ -#define __SSAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** \brief Unsigned Saturate - - This function saturates an unsigned value. - - \param [in] value Value to be saturated - \param [in] sat Bit position to saturate to (0..31) - \return Saturated value - */ -#define __USAT(ARG1,ARG2) \ -({ \ - uint32_t __RES, __ARG1 = (ARG1); \ - __ASM ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) ); \ - __RES; \ - }) - - -/** \brief Count leading zeros - - This function counts the number of leading zeros of a data value. - - \param [in] value Value to count the leading zeros - \return number of leading zeros in value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint8_t __CLZ(uint32_t value) -{ - uint32_t result; - - __ASM volatile ("clz %0, %1" : "=r" (result) : "r" (value) ); - return(result); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - - - -#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ -/* TASKING carm specific functions */ - -/* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all intrinsics, - * Including the CMSIS ones. - */ - -#endif - -/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ - -#endif /* __CORE_CMINSTR_H */ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s b/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s deleted file mode 100644 index 69e528223e..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/startup_ES8P508x.s +++ /dev/null @@ -1,233 +0,0 @@ -;******************************************************************************* -; *file : startup_ES8P508x.s -; *description: ES8P508x Device Startup File -; *author : Eastsoft MCU Software Team -; *version : V0.01 -; *data : 6/30/2017 -; -; *Copyright (C) 2017 Shanghai Eastsoft Microelectronics Co., Ltd. -; * -; * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED -; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF -; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. -; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR -; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. -;******************************************************************************* - - -; Stack Configuration -; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Stack_Size EQU 0x00000400 - - AREA STACK, NOINIT, READWRITE, ALIGN=3 -Stack_Mem SPACE Stack_Size -__initial_sp - - -; Heap Configuration -; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> -; - -Heap_Size EQU 0x00000400 - - AREA HEAP, NOINIT, READWRITE, ALIGN=3 -__heap_base -Heap_Mem SPACE Heap_Size -__heap_limit - - PRESERVE8 - THUMB - -; Vector Table Mapped to Address 0 at Reset - - AREA RESET, DATA, READONLY - EXPORT __Vectors - -__Vectors DCD __initial_sp ; Top of Stack - DCD Reset_IRQHandler ; Reset Handler - DCD NMI_IRQHandler ; NMI Handler - DCD HardFault_IRQHandler ; HardFault Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD SVC_IRQHandler ; SVCall Handler - DCD 0 ; Reserved - DCD 0 ; Reserved - DCD PendSV_Handler ; PendSV Handler - DCD SysTick_Handler ; SysTick Handler - - ; External Interrupts - DCD PINT0_IRQHandler ;16, PINT0 IRQHandler - DCD PINT1_IRQHandler ;17, PINT1 IRQHandler - DCD PINT2_IRQHandler ;18, PINT2 IRQHandler - DCD PINT3_IRQHandler ;19, PINT3 IRQHandler - DCD PINT4_IRQHandler ;20, PINT4 IRQHandler - DCD PINT5_IRQHandler ;21, PINT5 IRQHandler - DCD PINT6_IRQHandler ;22, PINT6 IRQHandler - DCD PINT7_IRQHandler ;23, PINT7 IRQHandler - DCD T16N0_IRQHandler ;24, T16N0 IRQHandler - DCD T16N1_IRQHandler ;25, T16N1 IRQHandler - DCD T16N2_IRQHandler ;26, T16N2 IRQHandler - DCD T16N3_IRQHandler ;27, T16N3 IRQHandler - DCD T32N0_IRQHandler ;28, T32N0 IRQHandler - DCD 0 ;29, Reserved - DCD IWDT_IRQHandler ;30, IWDT IRQHandler - DCD WWDT_IRQHandler ;31, WWDT IRQHandler - DCD CCM_IRQHandler ;32, WDT IRQHandler - DCD PLK_IRQHandler ;33, PLK IRQHandler - DCD LVD_IRQHandler ;34, LVD IRQHandler - DCD KINT_IRQHandler ;35, KINT IRQHandler - DCD RTC_IRQHandler ;36, RTC IRQHandler - DCD ADC_IRQHandler ;37, ADC IRQHandler - DCD 0 ;38, Reserved - DCD AES_IRQHandler ;39, AES IRQHandler - DCD UART0_IRQHandler ;40, UART0 IRQHandler - DCD UART1_IRQHandler ;41, UART1 IRQHandler - DCD UART2_IRQHandler ;42, UART2 IRQHandler - DCD UART3_IRQHandler ;43, UART3 IRQHandler - DCD UART4_IRQHandler ;44, UART4 IRQHandler - DCD UART5_IRQHandler ;45, UART5 IRQHandler - DCD SPI0_IRQHandler ;46, SPI0 IRQHandler - DCD I2C0_IRQHandler ;47, I2C0 IRQHandler - - AREA |.text|, CODE, READONLY - -; Reset Handler - -Reset_IRQHandler PROC - EXPORT Reset_IRQHandler [WEAK] - IMPORT __main - IMPORT SystemInit - LDR R0, =SystemInit - BLX R0 - LDR R0, =__main - BX R0 - ENDP - -; Dummy Exception IRQHandlers (infinite loops which can be modified) - -NMI_IRQHandler PROC - EXPORT NMI_IRQHandler [WEAK] - B . - ENDP -HardFault_IRQHandler PROC - EXPORT HardFault_IRQHandler [WEAK] - B . - ENDP -SVC_IRQHandler PROC - EXPORT SVC_IRQHandler [WEAK] - B . - ENDP -PendSV_Handler PROC - EXPORT PendSV_Handler [WEAK] - B . - ENDP -SysTick_Handler PROC - EXPORT SysTick_Handler [WEAK] - B . - ENDP - -Default_IRQHandler PROC - EXPORT PINT0_IRQHandler [WEAK] - EXPORT PINT1_IRQHandler [WEAK] - EXPORT PINT2_IRQHandler [WEAK] - EXPORT PINT3_IRQHandler [WEAK] - EXPORT PINT4_IRQHandler [WEAK] - EXPORT PINT5_IRQHandler [WEAK] - EXPORT PINT6_IRQHandler [WEAK] - EXPORT PINT7_IRQHandler [WEAK] - EXPORT T16N0_IRQHandler [WEAK] - EXPORT T16N1_IRQHandler [WEAK] - EXPORT T16N2_IRQHandler [WEAK] - EXPORT T16N3_IRQHandler [WEAK] - EXPORT T32N0_IRQHandler [WEAK] - EXPORT IWDT_IRQHandler [WEAK] - EXPORT WWDT_IRQHandler [WEAK] - EXPORT CCM_IRQHandler [WEAK] - EXPORT PLK_IRQHandler [WEAK] - EXPORT LVD_IRQHandler [WEAK] - EXPORT KINT_IRQHandler [WEAK] - EXPORT RTC_IRQHandler [WEAK] - EXPORT ADC_IRQHandler [WEAK] - EXPORT AES_IRQHandler [WEAK] - EXPORT UART0_IRQHandler [WEAK] - EXPORT UART1_IRQHandler [WEAK] - EXPORT UART2_IRQHandler [WEAK] - EXPORT UART3_IRQHandler [WEAK] - EXPORT UART4_IRQHandler [WEAK] - EXPORT UART5_IRQHandler [WEAK] - EXPORT SPI0_IRQHandler [WEAK] - EXPORT I2C0_IRQHandler [WEAK] - - - -PINT0_IRQHandler -PINT1_IRQHandler -PINT2_IRQHandler -PINT3_IRQHandler -PINT4_IRQHandler -PINT5_IRQHandler -PINT6_IRQHandler -PINT7_IRQHandler -T16N0_IRQHandler -T16N1_IRQHandler -T16N2_IRQHandler -T16N3_IRQHandler -T32N0_IRQHandler -IWDT_IRQHandler -WWDT_IRQHandler -CCM_IRQHandler -PLK_IRQHandler -LVD_IRQHandler -KINT_IRQHandler -RTC_IRQHandler -ADC_IRQHandler -AES_IRQHandler -UART0_IRQHandler -UART1_IRQHandler -UART2_IRQHandler -UART3_IRQHandler -UART4_IRQHandler -UART5_IRQHandler -SPI0_IRQHandler -I2C0_IRQHandler - - B . - - ENDP - - - - ALIGN - -; User Initial Stack & Heap - - IF :DEF:__MICROLIB - - EXPORT __initial_sp - EXPORT __heap_base - EXPORT __heap_limit - - ELSE - - IMPORT __use_two_region_memory - EXPORT __user_initial_stackheap -__user_initial_stackheap - - LDR R0, = Heap_Mem - LDR R1, =(Stack_Mem + Stack_Size) - LDR R2, = (Heap_Mem + Heap_Size) - LDR R3, = Stack_Mem - BX LR - - ALIGN - - ENDIF - - END diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c b/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c deleted file mode 100644 index eb22f8c9da..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.c +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************** -*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd -*ļ system_ES8P508x.c -* ߣ Liut -* V1.00 -* ڣ 2017/07/14 -* ⺯ļ -* ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ -***************************************************************/ -#include "system_ES8P508x.h" -#include "lib_config.h" - -uint32_t SystemCoreClock = 48000000; - - -/*************************************************************** -SystemCoreClockUpdate - ϵͳʱΪڲʱ20MHZͬʱSystemCoreClock -ֵ -ֵ -ֵ -***************************************************************/ -void SystemCoreClockUpdate (void) -{ - uint32_t Prot_Temp; - uint16_t Count=0; - SystemClockSelect(SCU_SysClk_HRC , CLK_SEL_HRC); //ѡϵͳʱΪHRCʱ - PLLClock_Config(DISABLE, SCU_PLL_HRC, SCU_PLL_48M,ENABLE); //PLLֹ - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - {SCU->PROT.Word = 0x55AA6996;} // - - SCU->SCLKEN1.HRC_EN = 1; //ʹڲ20MHZ - do - { - Count++; - } - while((SCU->SCLKEN1.HRC_RDY == 0)&&(Count != 0xFFF)); //ȴʱӿ - - if(Count == 0xFFF) - { - return ; - } - - SCU->SCLKEN0.SYSCLK_DIV = 0; //ϵͳʱӺƵ1:1 - - switch(SCU->SCLKEN0.CLK_SEL) - { - case 0: - SystemCoreClock = 20000000; //HRC - break; - case 1: - SystemCoreClock = 32000; //LRC - break; - default: - break; - } - - if(Prot_Temp != 0) //д - {SCU->PROT.Word = 0x00000000;} //д -} - -/*************************************************************** -SystemInit - ϵͳʼʱ -ֵ -ֵ -ֵ -***************************************************************/ -void SystemInit (void) -{ - SystemCoreClockUpdate(); -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h b/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h deleted file mode 100644 index b0fa1595c9..0000000000 --- a/bsp/essemi/es8p508x/libraries/CMSIS/system_ES8P508x.h +++ /dev/null @@ -1,23 +0,0 @@ -/*************************************************************** -*Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. -*ļ system_ES8P508x.h -* ߣ Liut -* V1.00 -* ڣ 2017/07/14 -* ⺯ļ -* ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ -***************************************************************/ -#ifndef __SYSTEMES8P508x_H__ -#define __SYSTEMES8P508x_H__ - -#include "ES8P508x.h" -#include "type.h" - -extern uint32_t SystemCoreClock; -extern void SystemInit(void); -extern void SystemCoreClockUpdate(void); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h b/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h deleted file mode 100644 index fec6f2d62d..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/irqhandler.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef __IRQHANDLER_H__ -#define __IRQHANDLER_H__ - -#include "ES8P508x.h" - -extern void systick_irq_cbk(void); - -/************жϺ***********/ -void NMI_IRQHandler(void); -void HardFault_IRQHandler(void); -void SVC_IRQHandler(void); -void PendSV_IRQHandler(void); -void SysTick_IRQHandler(void); - -#endif - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h deleted file mode 100644 index afcb552435..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_adc.h +++ /dev/null @@ -1,239 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ADCģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBADC_H__ -#define __LIBADC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ڲοѹѡ */ -typedef enum { - ADC_VREF_SEL_2_0 = 0, /* ڲοѹ2.048v*/ - ADC_VREF_SEL_1_6 = 1, /* ڲοѹ1.6v*/ - ADC_VREF_SEL_MAX = 1, -}ADC_TYPE_VREF_SEL; - -/* ADCʱԴѡ */ -typedef enum -{ - ADC_ClkS_PCLK = 0x0 , //ʱӣPCLK - ADC_ClkS_PLL = 0x1 , //ʱӣPLL - ADC_ClkS_32K = 0x2 , //ʱӣADCCLK(32KHZ) -}ADC_TYPE_CLKS; - -/* ADCʱԴԤƵ */ -typedef enum -{ - ADC_ClkDiv_1 = 0x0 , //ԤƵ1:1 - ADC_ClkDiv_2 = 0x1 , //ԤƵ1:2 - ADC_ClkDiv_4 = 0x2 , //ԤƵ1:4 - ADC_ClkDiv_8 = 0x3 , //ԤƵ1:8 - ADC_ClkDiv_16 = 0x4 , //ԤƵ1:16 - ADC_ClkDiv_32 = 0x5 , //ԤƵ1:32 - ADC_ClkDiv_64 = 0x6 , //ԤƵ1:64 - ADC_ClkDiv_256 = 0x7 , //ԤƵ1:256 -}ADC_TYPE_CLKDIV; - -/* οѹѡ */ -typedef enum -{ - ADC_VrefP_Vcc = 0x0 , //οѹVDDѹ - ADC_VrefP_Exter = 0x3 , //οѹⲿοѹ -}ADC_TYPE_VREFP; - -/* ģʽѡ */ -typedef enum -{ - ADC_SMPS_SOFT = 0, /* */ - ADC_SMPS_HARD = 1, /* Ӳ */ -}ADC_TYPE_SMPS; - - -/* תٶѡ */ -typedef enum -{ - ADC_ConvSpeed_Low = 0x0 , //ADתٶȣ - ADC_ConvSpeed_High = 0x1 , //ADתٶȣ -}ADC_TYPE_HSEN; - -/* ADCͨѡ */ -typedef enum -{ - ADC_CHS_AIN0 = 0, /* ͨ 0 */ - ADC_CHS_AIN1 = 1, /* ͨ 1 */ - ADC_CHS_AIN2 = 2, /* ͨ 2 */ - ADC_CHS_AIN3 = 3, /* ͨ 3 */ - ADC_CHS_AIN4 = 4, /* ͨ 4 */ - ADC_CHS_AIN5 = 5, /* ͨ 5 */ - ADC_CHS_AIN6 = 6, /* ͨ 6 */ - ADC_CHS_AIN7 = 7, /* ͨ 7 */ - ADC_CHS_AIN8 = 8, /* ͨ 8 */ - ADC_CHS_AIN9 = 9, /* ͨ 9 */ - ADC_CHS_AIN10 = 10, /* ͨ 10 */ - ADC_CHS_AIN11 = 11, /* ͨ 11 */ - ADC_CHS_AIN12 = 12, /* ͨ 12 */ - ADC_CHS_AIN13 = 13, /* ͨ 13 */ - ADC_CHS_AIN14 = 14, /* ͨ 14 */ - ADC_CHS_AIN15 = 15, /* ͨ 15 */ -}ADC_TYPE_CHS; - -/*ADC coreѡλ*/ -typedef enum -{ - ADC_LP_86ua = 2, //ADC Core Ϊ86Ƽʹ - ADC_LP_215ua = 0, //ADC Core Ϊ215uA - ADC_LP_120ua = 1, //ADC Core Ϊ120uA - ADC_LP_70ua = 3, //ADC Core Ϊ70uA -}ADC_TYPE_BUFLP; - -/*ADC buffѡλ*/ -typedef enum -{ - ADC_BUFF_0ua = 0, //ADC buffΪ0uAƼʹ - ADC_BUFF_34ua = 1, //ADC buffΪ34uA - ADC_BUFF_95ua = 2, //ADC buffΪ95uA -}ADC_TYPE_BUFEN; - -/* ADC IF ״̬ */ -typedef enum -{ - ADC_IF = 0x01, - ADC_IF_ACPMIN = 0x02, - ADC_IF_ACPMAX =0x04, - ADC_IF_ACPOVER = 0x08, -}ADC_TYPE_IF; - -/* ADC IE ״̬ */ -typedef enum -{ - ADC_IE = 0x01, - ADC_IE_ACPMIN = 0x02, - ADC_IE_ACPMAX =0x04, - ADC_IE_ACPOVER = 0x08, -}ADC_TYPE_IE; - -/* ADCʼýṹ嶨 */ -typedef struct -{ - ADC_TYPE_CLKS ADC_ClkS; //ADCCON1:bit3 ADCʱԴѡ - ADC_TYPE_CLKDIV ADC_ClkDiv; //ADCCON1:bit2-0 ADCʱԴԤƵ - ADC_TYPE_VREFP ADC_VrefP; //ADCCON1:bit9-8 ADCοѹѡ - ADC_TYPE_SMPS ADC_SampS; //ADCCON1:bit12 ADCģʽѡ - ADC_TYPE_CHS ADC_ChS; //ADCCHS:bit0-3 ADCģͨѡ - //ADC_TYPE_VREF_SEL VREF_SEL; //οѹѡ - uint8_t ST; //Ӳʱ (ģʽΪӲʱ) 0~31 - TYPE_FUNCEN ADC_VREFN; //οѹѡλ - TYPE_FUNCEN ADC_VRBUF_EN; -}ADC_InitStruType; - -/* ԶȽϵͷֵ ѡ*/ -typedef enum -{ - ADC_ACP_MIN_MIN = 0x0, /* Сͷֵ*/ - ADC_ACP_MIN_MAX = 0xfff, /* ͷֵ*/ -}ADC_TYPE_ACP_MIN; - -/* ԶȽϸ߷ֵ ѡ*/ -typedef enum -{ - ADC_ACP_MAX_MIN = 0x0, /* С߷ֵ*/ - ADC_ACP_MAX_MAX = 0xfff, /* ߷ֵ*/ -}ADC_TYPE_ACP_MAX; - -/* ÿԶתȽʱѡ */ -typedef enum -{ - ADC_ACPC_OVFL_TIME_MAX = 0x9c3, /* ʱ */ -}ADC_TYPE_ACPC_OVFL_TIME; - -/* ԶתȽϴ */ -typedef enum -{ - ADC_ACPC_TIMES_1 = 0, /* 1 */ - ADC_ACPC_TIMES_2 = 1, /* 2 */ - ADC_ACPC_TIMES_4 = 2, /* 4 */ - ADC_ACPC_TIMES_8 = 3, /* 8 */ - ADC_ACPC_TIMES_MAX = 3, -}ADC_TYPE_ACPC_TIMES; - -/* ACPʱӵʱԴ */ -typedef enum -{ - ADC_ACPC_CLKS_PCLK = 0, /* PCLK */ - ADC_ACPC_CLKS_LRC = 1, /* LRC(32KHz) */ -}ADC_TYPE_ACPC_CLKS; - -typedef FuncState ADC_TYPE_CHOP_EN1, ADC_TYPE_CHOP_EN; -typedef FuncState ADC_TYPE_VREF_EN,ADC_TYPE_IREF_EN; -typedef FuncState ADC_TYPE_EN,ADC_TYPE_ACP_EN; - -/* ԶȽϹܳʼṹ*/ -typedef struct -{ - ADC_TYPE_ACP_EN ACP_EN; /* ԶȽϹʹλ*/ - uint16_t ACPC_OVER_TIME; /* ԶȽʱ(ʹó0) 0~0x9c3 */ - ADC_TYPE_ACPC_TIMES ACPC_TIMES; /* ԶȽϴ(ȼʱ) */ - uint16_t ACPC_MIN_TARGET; /* ƽֵͷֵ (0xfffر) 0~0xfff */ - uint16_t ACPC_MAX_TARGET; /* ƽֵ߷ֵ (0x0ر) 0~0xfff */ -}ADC_ACP_TypeDef; - -/************ADCģ궨***********/ -/* ADCʹܿ */ -#define ADC_Enable() (ADC->CON0.EN = 0x1) -#define ADC_Disable() (ADC->CON0.EN = 0x0) - -/* ԶȽϹʹ*/ -#define ADC_ACP_Enable() (ADC->CON0.ACP_EN = 1) -#define ADC_ACP_Disable() (ADC->CON0.ACP_EN = 0) - -/* ADCʼת */ -#define ADC_Start() (ADC->CON0.TRIG = 0x1) - -/* ADC */ -#define ADC_SampStart() (ADC->CON1.SMPON = 0x1) -#define ADC_SampStop() (ADC->CON1.SMPON = 0x0) - -/* ADC VDD */ -#define ADC_VDD5_FLAG_Enable() (ADC->CHS.VDD5_FLAG_EN = 0x1) -#define ADC_VDD5_FLAG_Disable() (ADC->CHS.VDD5_FLAG_EN = 0x0) - -/* ADCжʹܿ */ -#define ADC_IE_Enable() (ADC->IE.IE = 0x1) -#define ADC_IE_Disable() (ADC->IE.IE = 0x0) - -#define ADC_ACPMINIE_Enable() (ADC->IE.ACPMINIE = 1) -#define ADC_ACPMINIE_Disable() (ADC->IE.ACPMINIE = 0) - -#define ADC_ACPMAXIE_Enable() (ADC->IE.ACPMAXIE = 1) -#define ADC_ACPMAXIE_Disable() (ADC->IE.ACPMAXIE = 0) - -#define ADC_ACPOVIE_Enable() (ADC->IE.ACPOVIE = 1) -#define ADC_ACPOVIE_Disable() (ADC->IE.ACPOVIE = 0) - -/************ADCģ麯***********/ -void ADC_Init(ADC_InitStruType * ADC_InitStruct); -void ADC_Set_CH(ADC_TYPE_CHS AdcCH); -uint16_t ADC_GetConvValue(void); -FlagStatus ADC_GetConvStatus(void); -ErrorStatus ADC_ACPConfig(ADC_ACP_TypeDef *ADC_ACP_InitStruct); -ErrorStatus ADC_SoftStart(void); -ErrorStatus ADC_SoftStop(void); -uint16_t ADC_GetACPMeanValue(void); -uint16_t ADC_GetACPMinValue(void); -uint16_t ADC_GetACPMaxValue(void); -FlagStatus ADC_GetFlagStatus(ADC_TYPE_IF IFName); -ITStatus ADC_GetITStatus(ADC_TYPE_IE IEName); -ErrorStatus ADC_ClearIFStatus(ADC_TYPE_IF IFName); -void ADC_Reset(void); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h deleted file mode 100644 index 13c8046278..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_aes.h +++ /dev/null @@ -1,74 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_aes.c - * ߣ zoux - * V1.00 - * ڣ 2017/07/14 - * AESģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBAES_H__ -#define __LIBAES_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ܽģʽѡλ */ -typedef enum { - AES_MODE_DECRYPT = 0, /* */ - AES_MODE_ENCRYPT = 1, /* */ -}AES_TYPE_MODE; - -/* /ܿλ */ -typedef enum { - AES_DONE_YES = 0, /* */ - AES_DONE_NO = 1, /* ڼ */ -}AES_TYPE_DONE; - -/* ӽݽṹ */ -typedef struct { - uint32_t DATA[4]; -}AES_DATA_TypeDef; - -typedef enum { - AES_IF_IF = 0x80, -}AES_TYPE_IF; - -typedef enum { - AES_IT_IT = 0x40, -}AES_TYPE_IT; - -/* ӽԿṹ */ -typedef struct { - uint32_t KEY[4]; -}AES_KEY_TypeDef; - -/* ӽܳʼṹ */ -typedef struct { - AES_TYPE_MODE MODE; /* ܻ߽ */ -}AES_InitStruType; - -/* ӽʹܣʼ */ -#define AES_Enable() (AES->CON.GO_DONE = 1) -/* ģر */ -#define AES_Disable() (AES->CON.GO_DONE = 0) - - -/********************* ADCģ麯 *********************/ -void AES_Init(AES_InitStruType * AES_InitStruct); -void AES_WriteKey(uint32_t *AES_KEY); -void AES_ReadKey(uint32_t * AES_KEY); - -void AES_WriteData(uint32_t *AES_DATA); -void AES_ReadData(uint32_t * AES_DATA); - -void AES_ITConfig(AES_TYPE_IT AES_IE, TYPE_FUNCEN NewState); -void AES_ClearITPendingBit(void); -FlagStatus AES_GetFlagStatus(AES_TYPE_IF Flag); - -AES_TYPE_DONE AES_GetDoneStatus(void); -void AES_Reset(void); - -#endif - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h deleted file mode 100644 index 8178813ca9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_config.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_config.h - * : Liut - * : V1.00 - * : 2017/07/14 - * ⺯ļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBCONFIG_H__ -#define __LIBCONFIG_H__ - -#include "lib_adc.h" -#include "lib_iic.h" -#include "lib_scs.h" -#include "lib_scu.h" -#include "lib_spi.h" -#include "lib_timer.h" -#include "lib_uart.h" -#include "lib_wdt.h" -#include "lib_flashiap.h" -#include "lib_gpio.h" -#include "lib_printf.h" -#include "lib_iap.h" -#include "lib_crc.h" -#include "lib_aes.h" -#include "lib_rtc.h" - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h deleted file mode 100644 index 1ab36cca7b..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_crc.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBCRC_H -#define __LIBCRC_H - -#include "ES8P508x.h" -#include "type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define CRC_EmptayCheck_addr 0x10000010 -#define CRC_FlashVerify_addr 0x10000014 -#define CRC_UserCal_addr 0x10000018 -#define CRC_CheckReset_addr 0x1000001C - -typedef uint32_t (*CRC_EM)(void* address, uint32_t data_len); -typedef uint32_t (*CRC_FL)(void* address, uint32_t data_len, uint32_t type); -typedef uint32_t (*CRC_US)(void* address, uint32_t data_len, uint32_t type); -typedef uint32_t (*CRC_CH)(void); - - -typedef enum -{ - CRC_XOROUT_NORMAL = 0x0, //ȡ - CRC_XOROUT_ANTI = (1U<<14), //ȡ -} CRC_XOROUT; - -typedef enum -{ - CRC_REFOUT_NORMAL = 0x0, // - CRC_REFOUT_REVERSE = (1U<<13), // -} CRC_REFOUT; - -typedef enum -{ - CRC_REFIN_NORMAL = 0x0, // - CRC_REFIN_REVERSE = (1U<<12), //뵹 -} CRC_REFIN; - - -typedef enum -{ - CRC_MOD_CRC32 = 0x0, //CRCλΪֽ - CRC_MOD_CRC16 = (2U<<8), //CRCλΪ - CRC_MOD_CRC16_CCITT = (3U<<8), //CRCλΪ -} CRC_MOD_TYPE; - -typedef enum -{ - CRC_INIT_DATA_ALL_0 = 0x0, //CRCʼȫΪ0 - CRC_INIT_DATA_ALL_1 = (1U<<3), //CRCʼȫΪ1 -} CRC_INIT_DATA; - -typedef enum -{ - CRC_HS_TYPE_DISABLE = 0x0, //CRCģʽֹ - CRC_HS_TYPE_ENABLE = (1U<<2), //CRCģʽʹܣCRCʱС24Mʱʹ -} CRC_HS_TYPE; - - -/*CRC_CON ֵṹʼ*/ -typedef struct -{ - CRC_XOROUT xorout; - CRC_REFOUT refout; - CRC_REFIN refin; - CRC_MOD_TYPE mode; - CRC_INIT_DATA init_data_type; - CRC_HS_TYPE hs_type; -} CRC_CONValueStruType; - -uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value); -uint32_t CRC_EmptayCheck(void* address, uint32_t data_len); -uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type); -uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type); -uint32_t CRC_CheckReset(void); - -#ifdef __cplusplus -} -#endif - -#endif -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h deleted file mode 100644 index b297e08712..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_flashiap.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_flashiap.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * flashд⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBIAP_H__ -#define __LIBIAP_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*************IAPģ궨************/ - -/* Ĵ */ -#define FlashIAP_RegUnLock() (IAP->UL.UL = 0x49415055) -#define FlashIAP_RegLock() (IAP->UL.UL = 0x00000000) - -/* ʹIAP */ -#define FlashIAP_Enable() (IAP->CON.EN = 0x1) -#define FlashIAP_Disable() (IAP->CON.EN = 0x0) - -/* IAP */ -#define FlashIAP_REQ() (IAP->CON.FLASH_REQ = 0x1) - -/************Flashģ麯***********/ -ErrorStatus FlashIap_Close_WPROT(uint8_t Page); -ErrorStatus FlashIap_Open_WPROT(uint8_t Page); -ErrorStatus FlashIap_CloseAll_WPROT(void); -ErrorStatus FlashIap_OpenAll_WPROT(void); -ErrorStatus FlashIap_Unlock(void); -ErrorStatus FlashIap_WriteEnd(void); -ErrorStatus FlashIap_ErasePage(uint8_t Page_Addr); -ErrorStatus FlashIap_WriteCont(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32); -ErrorStatus FlashIap_WriteWord(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32); -ErrorStatus Flash_Read(uint32_t * Ram_Addr, uint32_t Flash_Addr, uint8_t Len); - -#endif -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h deleted file mode 100644 index 301c6b286c..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_gpio.h +++ /dev/null @@ -1,243 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_gpio.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * GPIOģ鼰ⲿжϡжϿ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBGPIO_H__ -#define __LIBGPIO_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*״̬*/ - -/*˿ڶ*/ -typedef enum -{ - GPIOA = 0x0 , - GPIOB = 0x1 , -}GPIO_TYPE; - -/*Ŷ*/ -typedef enum -{ - GPIO_Pin_0 = 0x00, - GPIO_Pin_1 = 0x01, - GPIO_Pin_2 = 0x02, - GPIO_Pin_3 = 0x03, - GPIO_Pin_4 = 0x04, - GPIO_Pin_5 = 0x05, - GPIO_Pin_6 = 0x06, - GPIO_Pin_7 = 0x07, - GPIO_Pin_8 = 0x08, - GPIO_Pin_9 = 0x09, - GPIO_Pin_10 = 0x0A, - GPIO_Pin_11 = 0x0B, - GPIO_Pin_12 = 0x0C, - GPIO_Pin_13 = 0x0D, - GPIO_Pin_14 = 0x0E, - GPIO_Pin_15 = 0x0F, - GPIO_Pin_16 = 0x10, - GPIO_Pin_17 = 0x11, - GPIO_Pin_18 = 0x12, - GPIO_Pin_19 = 0x13, - GPIO_Pin_20 = 0x14, - GPIO_Pin_21 = 0x15, - GPIO_Pin_22 = 0x16, - GPIO_Pin_23 = 0x17, - GPIO_Pin_24 = 0x18, - GPIO_Pin_25 = 0x19, - GPIO_Pin_26 = 0x1A, - GPIO_Pin_27 = 0x1B, - GPIO_Pin_28 = 0x1C, - GPIO_Pin_29 = 0x1D, - GPIO_Pin_30 = 0x1E, - GPIO_Pin_31 = 0x1F, -}GPIO_TYPE_PIN; - -/* Źѡ */ -typedef enum -{ - GPIO_Func_0 = 0x0 , - GPIO_Func_1 = 0x1 , - GPIO_Func_2 = 0x2 , - GPIO_Func_3 = 0x3 , -}GPIO_TYPE_FUNC; - -/* ŷѡ */ -typedef enum -{ - GPIO_Dir_Out = 0x0 , - GPIO_Dir_In = 0x1 , -}GPIO_TYPE_DIR; - -/* ѡ */ -typedef enum -{ - GPIO_DS_Output_Normal = 0, // ͨ - GPIO_DS_Output_Strong = 1, // ǿ -} GPIO_TYPE_DS; - -/* ź */ -typedef enum { - GPIO_Pin_Signal_Digital = 0, // ź - GPIO_Pin_Signal_Analog = 1, // ģź -} GPIO_Pin_Signal; - -/* ʹ */ -typedef enum { - GPIO_PUE_Input_Disable = 0, // ֹ - GPIO_PUE_Input_Enable = 1, // ʹ -} GPIO_PUE_Input; - -/* ʹ */ -typedef enum { - GPIO_PDE_Input_Disable = 0, // ֹ - GPIO_PDE_Input_Enable = 1, // ʹ -} GPIO_PDE_Input; - - -/* ©ʹλ */ -typedef enum { - GPIO_ODE_Output_Disable = 0, // ©ֹ - GPIO_ODE_Output_Enable = 1, // ©ʹ -} GPIO_ODE_Output; - -/* GPIOʼýṹ嶨 */ -typedef struct -{ - GPIO_Pin_Signal GPIO_Signal; /* ϵźֻͣģ */ - GPIO_TYPE_FUNC GPIO_Func; //Źѡ - GPIO_TYPE_DIR GPIO_Direction; //ѡ - GPIO_PUE_Input GPIO_PUEN; //ʹ - GPIO_PDE_Input GPIO_PDEN; //ʹ - GPIO_ODE_Output GPIO_OD; //ģʽ©ʹ - GPIO_TYPE_DS GPIO_DS; // -}GPIO_InitStruType; - -/* PINT */ -typedef enum -{ - PINT0 = 0x0 , - PINT1 = 0x1 , - PINT2 = 0x2 , - PINT3 = 0x3 , - PINT4 = 0x4 , - PINT5 = 0x5 , - PINT6 = 0x6 , - PINT7 = 0x7 , -}PINT_TYPE; - -/* PINT SEL */ -typedef enum -{ - PINT_SEL0 = 0x0 , - PINT_SEL1 = 0x1 , - PINT_SEL2 = 0x2 , - PINT_SEL3 = 0x3 , - PINT_SEL4 = 0x4 , - PINT_SEL5 = 0x5 , - PINT_SEL6 = 0x6 , - PINT_SEL7 = 0x7 , -}PINT_TYPE_SEL; - -/* PINT Trigger */ -typedef enum -{ - PINT_Trig_Rise = 0x0 , - PINT_Trig_Fall = 0x1 , - PINT_Trig_High = 0x2 , - PINT_Trig_Low = 0x3 , - PINT_Trig_Change = 0x4 , -}PINT_TYPE_TRIG; - - -/* PINTжϱ־ */ -typedef enum -{ - PINT_IT_PINT0 = 0x01 , - PINT_IT_PINT1 = 0x02 , - PINT_IT_PINT2 = 0x04 , - PINT_IT_PINT3 = 0x08 , - PINT_IT_PINT4 = 0x10 , - PINT_IT_PINT5 = 0x20 , - PINT_IT_PINT6 = 0x40 , - PINT_IT_PINT7 = 0x80 , - PINT_IT_PINTAll = 0xFF , -}PINT_TYPE_IT; - -/* PINTʹܿ */ -#define PINT0_Enable() (GPIO->PINTIE.PINTIE |= 0X1) -#define PINT1_Enable() (GPIO->PINTIE.PINTIE |= 0x2) -#define PINT2_Enable() (GPIO->PINTIE.PINTIE |= 0x4) -#define PINT3_Enable() (GPIO->PINTIE.PINTIE |= 0x8) -#define PINT4_Enable() (GPIO->PINTIE.PINTIE |= 0x10) -#define PINT5_Enable() (GPIO->PINTIE.PINTIE |= 0x20) -#define PINT6_Enable() (GPIO->PINTIE.PINTIE |= 0x40) -#define PINT7_Enable() (GPIO->PINTIE.PINTIE |= 0x80) -#define PINT0_Disable() (GPIO->PINTIE.PINTIE &= ~0x01) -#define PINT1_Disable() (GPIO->PINTIE.PINTIE &= ~0x02) -#define PINT2_Disable() (GPIO->PINTIE.PINTIE &= ~0x04) -#define PINT3_Disable() (GPIO->PINTIE.PINTIE &= ~0x08) -#define PINT4_Disable() (GPIO->PINTIE.PINTIE &= ~0x10) -#define PINT5_Disable() (GPIO->PINTIE.PINTIE &= ~0x20) -#define PINT6_Disable() (GPIO->PINTIE.PINTIE &= ~0x40) -#define PINT7_Disable() (GPIO->PINTIE.PINTIE &= ~0x80) - -/* PINTʹܿ */ -#define PINT0_MaskEnable() (GPIO->PINTIE.PMASK |= 0X01) -#define PINT1_MaskEnable() (GPIO->PINTIE.PMASK |= 0x02) -#define PINT2_MaskEnable() (GPIO->PINTIE.PMASK |= 0x04) -#define PINT3_MaskEnable() (GPIO->PINTIE.PMASK |= 0x08) -#define PINT4_MaskEnable() (GPIO->PINTIE.PMASK |= 0x10) -#define PINT5_MaskEnable() (GPIO->PINTIE.PMASK |= 0x20) -#define PINT6_MaskEnable() (GPIO->PINTIE.PMASK |= 0x40) -#define PINT7_MaskEnable() (GPIO->PINTIE.PMASK |= 0x80) -#define PINT0_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x01) -#define PINT1_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x02) -#define PINT2_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x04) -#define PINT3_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x08) -#define PINT4_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x10) -#define PINT5_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x20) -#define PINT6_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x40) -#define PINT7_MaskDisable() (GPIO->PINTIE.PMASK &= ~0x80) - -/* PINTжϱ */ -#define PINT_ClearAllITPending() (GPIO->PIF.Word = (uint32_t)0xff) - -void GPIO_Init(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_InitStruType* GPIO_InitStruct); -void GPIO_Write(GPIO_TYPE GPIOx, uint32_t Value); -uint32_t GPIO_Read(GPIO_TYPE GPIOx); -PinStatus GPIO_ReadBit(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx); -void GPIOA_SetBit(GPIO_TYPE_PIN PINx); -void GPIOA_ResetBit(GPIO_TYPE_PIN PINx); -void GPIOA_ToggleBit(GPIO_TYPE_PIN PINx); -void GPIOB_SetBit(GPIO_TYPE_PIN PINx); -void GPIOB_ResetBit(GPIO_TYPE_PIN PINx); -void GPIOB_ToggleBit(GPIO_TYPE_PIN PINx); -void GPIOA_SetDirection(GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir_Type); -void GPIOB_SetDirection(GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir_Type); -void PINT_Config(PINT_TYPE PINTx, PINT_TYPE_SEL SELx, PINT_TYPE_TRIG TRIGx); -void GPIO_SetSingalTypeFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_Pin_Signal GPIO_Signal); -void GPIO_SetDirRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir); -void GPIO_SetODERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_ODE_Output ODE); -void GPIO_SetDSRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DS DS); -void GPIO_SetPUERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PUE_Input PUE); -void GPIO_SetPDERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PDE_Input PDE); -void GPIO_SetFuncxRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_FUNC Func); -FlagStatus PINT_GetIFStatus(PINT_TYPE_IT PINT_Flag); -FlagStatus PINT_GetITStatus(PINT_TYPE_IT PINT_Flag); -void PINT_ClearITPendingBit(PINT_TYPE_IT PINT_Flag); - -#endif - - - - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h deleted file mode 100644 index 61a404d3ea..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iap.h +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __ES8P508x_IAP_TABLE_H -#define __ES8P508x_IAP_TABLE_H - -#include "ES8P508x.h" -#include "type.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define IAP_PageProgram_addr 0x10000008 -#define IAP_PageErase_addr 0x10000000 -#define IAP_WordProgram_addr 0x10000004 - -typedef ErrorStatus (*IAP_PE)(uint32_t address); -typedef ErrorStatus (*IAP_WP)(uint32_t address, uint32_t data); -typedef ErrorStatus (*IAP_PP)(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase); - -ErrorStatus IAP_PageErase(uint32_t address); -ErrorStatus IAP_WordProgram(uint32_t address, uint32_t data); -ErrorStatus IAP_PageProgram(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase); -ErrorStatus IAPRead(uint32_t *Ram_Addr, uint32_t Flash_Addr, uint8_t Len); - -#define PageEraseEnable 0x00000001 -#define PageEraseDisable 0x00000000 - -#ifdef __cplusplus -} -#endif - -#endif -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h deleted file mode 100644 index dae43c1964..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_iic.h +++ /dev/null @@ -1,229 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_iic.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * I2Cģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBIIC_H__ -#define __LIBIIC_H__ - -#include "ES8P508x.h" -#include "type.h" -#include "system_ES8P508x.h" - -/* ſ© */ -typedef enum -{ - I2C_PinMode_PP = 0x0 , //˿ģʽ: - I2C_PinMode_OD = 0x1 , //˿ģʽ:© -}I2C_TYPE_PINOD; - -/* ģʽ */ -typedef enum -{ - I2C_Mode_Master = 0x0 , //ģʽ - I2C_Mode_Slave = 0x1 , //ģʽ -}I2C_TYPE_MODE; - -/* Ӧʱ */ -typedef enum -{ - I2C_AckDelay_0P5 = 0x0 , //Ӧʱ:0.5ʱ - I2C_AckDelay_1 = 0x1 , //Ӧʱ:1ʱ - I2C_AckDelay_1P5 = 0x2 , //Ӧʱ:1.5ʱ - I2C_AckDelay_2 = 0x3 , //Ӧʱ:2ʱ - I2C_AckDelay_2P5 = 0x4 , //Ӧʱ:2.5ʱ - I2C_AckDelay_3 = 0x5 , //Ӧʱ:3ʱ - I2C_AckDelay_3P5 = 0x6 , //Ӧʱ:3.5ʱ - I2C_AckDelay_4 = 0x7 , //Ӧʱ:4ʱ -}I2C_TYPE_ADLY; - -/* ģʽ */ -typedef enum -{ - I2C_RecMode_0 = 0x0 , //ģʽ1ֽڣACK - I2C_RecMode_1 = 0x1 , //ģʽ1ֽڣNACK - I2C_RecMode_2 = 0x2 , //ģʽ2ֽڣÿֽڷACK - I2C_RecMode_3 = 0x3 , //ģʽ2ֽڣǰһֽڷACKһֽڷNACK - I2C_RecMode_4 = 0x4 , //ģʽ4ֽڣÿֽڷACK - I2C_RecMode_5 = 0x5 , //ģʽ4ֽڣǰ3ֽڷACKһֽڷNACK - I2C_RecMode_6 = 0x6, //ģʽգÿֽڷACK - I2C_RecMode_7 = 0x7, //ģʽɸֽڽգNACK -}I2C_TYPE_RECMODE; - -/* ֡ */ -typedef enum -{ - I2C_TI_Disable = 0x0 , //֡:0 - I2C_TI_1 = 0x1 , //֡:1 - I2C_TI_2 = 0x2 , //֡:2 - I2C_TI_3 = 0x3 , //֡:3 - I2C_TI_4 = 0x4 , //֡:4 - I2C_TI_5 = 0x5 , //֡:5 - I2C_TI_6 = 0x6 , //֡:6 - I2C_TI_7 = 0x7 , //֡:7 - I2C_TI_8 = 0x8 , //֡:8 - I2C_TI_9 = 0x9 , //֡:9 - I2C_TI_10 = 0xA , //֡:10 - I2C_TI_11 = 0xB , //֡:11 - I2C_TI_12 = 0xC , //֡:12 - I2C_TI_13 = 0xD , //֡:13 - I2C_TI_14 = 0xE , //֡:14 - I2C_TI_15 = 0xF , //֡:15 -}I2C_TYPE_TIS; - -/* I2Cʼýṹ嶨 */ -typedef struct -{ - I2C_TYPE_PINOD I2C_SclOd; //SCL˿ģʽ - - I2C_TYPE_PINOD I2C_SdaOd; //SDA˿ģʽ - - TYPE_FUNCEN I2C_16XSamp; //˿16ٲʹ - - uint32_t I2C_Clk; //I2CƵ - - I2C_TYPE_MODE I2C_Mode; //ģʽ - - TYPE_FUNCEN I2C_AutoStop; //Զֹͣ - - TYPE_FUNCEN I2C_AutoCall; //ԶѰ -}I2C_InitStruType; - -/* ͡жģʽ */ -typedef enum -{ - I2C_TRBIM_Byte = 0x0 , //ֽж - I2C_TRBIM_HalfWord = 0x1 , //ж - I2C_TRBIM_Word = 0x2 , //ж -}I2C_TYPE_TRBIM; - - -/* дģʽ */ -typedef enum -{ - I2C_Mode_Write = 0x0 , - I2C_Mode_Read = 0x1 , -}I2C_TYPE_RWMODE; - -/* жʹܱ־λ */ -typedef enum -{ - I2C_IT_SR = 0x0001 , //ʼλ - I2C_IT_SP = 0x0002 , //ֹͣλ - I2C_IT_TB = 0x0004 , //ͻ - I2C_IT_RB = 0x0008 , //ջ - I2C_IT_TE = 0x0010 , //ݴ - I2C_IT_RO = 0x0020 , // - I2C_IT_NA = 0x0040 , //δӦNACK - I2C_IT_TBWE = 0x0080 , //д - I2C_IT_TIDLE = 0x01000 , //Ϳж -}I2C_TYPE_IT; - -/* жϱ־λ */ -typedef enum -{ - I2C_Flag_SR = 0x0001 , //ʼλ - I2C_Flag_SP = 0x0002 , //ֹͣλ - I2C_Flag_TB = 0x0004 , //ͻ - I2C_Flag_RB = 0x0008 , //ջ - I2C_Flag_TE = 0x0010 , //ݴ - I2C_Flag_RO = 0x0020 , // - I2C_Flag_NA = 0x0040 , //δӦNACK - I2C_Flag_TBWE = 0x0080, //джϱ־λ - I2C_Flag_TIDLE= 0X1000, //I2C Ϳжϱ־λ -}I2C_TYPE_FLAG; - - -/* ־ */ -typedef enum -{ - I2C_Clr_SR = 0x0001 , //ʼλ - I2C_Clr_SP = 0x0002 , //ֹͣλ - I2C_Clr_TE = 0x0010 , //ݴ - I2C_Clr_RO = 0x0020 , // - I2C_Clr_NA = 0x0040 , //δӦNACK - I2C_Clr_TBWE = 0x0080 , //д - I2C_Clr_TIDLE= 0X01000, //I2C Ϳ -}I2C_CLR_IF; - - -/*************I2Cģ궨************/ - -/* I2Cģʹܿ */ -#define I2C_Enable() (I2C0->CON.EN = 1) -#define I2C_Disable() (I2C0->CON.EN = 0) - -/* I2Cģ鸴λ */ -#define I2C_Reset() (I2C0->CON.RST = 1) - -/* I2Cʱʹܿ */ -#define I2C_TJEnable() (I2C0->CON.TJE = 1) -#define I2C_TJDisable() (I2C0->CON.TJE = 0) - -/* I2Cģʽд */ -#define I2C_Read() (I2C0->CON.RW = 1) -#define I2C_Write() (I2C0->CON.RW = 0) - -/* I2CʱԶȴʹܿƣӻģʽ֧֣ */ -#define I2C_CSEnable() (I2C0->MOD.CSE = 1) -#define I2C_CSDisable() (I2C0->MOD.CSE = 0) - -/* I2CԶδӦʹܿƣӻģʽ֧֣ */ -#define I2C_ANAEnable() (I2C0->MOD.ANAE = 1) -#define I2C_ANADisable() (I2C0->MOD.ANAE = 0) - -/* I2CԶѰʹܿƣģʽ֧֣ */ -#define I2C_SRAEnable() (I2C0->MOD.SRAE = 1) -#define I2C_SRADisable() (I2C0->MOD.SRAE = 0) - -/* I2CԶʹܿƣģʽ֧֣ */ -#define I2C_SPAEnable() (I2C0->MOD.SPAE = 1) -#define I2C_SPADisable() (I2C0->MOD.SPAE = 0) - -/* I2Cʼλģʽ֧֣ */ -#define I2C_SRTrigger() (I2C0->MOD.SRT=1) - -/* I2Cֹͣλģʽ֧֣ */ -#define I2C_SPTrigger() (I2C0->MOD.SPT = 1) - -/* I2Cݴģʽ֧֣ */ -#define I2C_RDTrigger() (I2C0->MOD.RDT = 1) - - -/* I2Cͷ */ -#define I2C_Release() (I2C0->MOD.BLD = 1) - -/* I2CӦãӻģʽ֧֣ */ -#define I2C_TACK() (I2C0->MOD.TAS = 1) -#define I2C_TNACK() (I2C0->MOD.TAS = 0) - -/************I2Cģ麯***********/ -void I2C_Init(I2C_InitStruType* I2C_InitStruct); -void I2C_ITConfig(I2C_TYPE_IT I2C_IT,TYPE_FUNCEN NewState); -void I2C_SendAddress(uint8_t I2C_Address,I2C_TYPE_RWMODE Mode); -void I2C_SetAddress(uint8_t I2C_Address); -void I2C_RecModeConfig(I2C_TYPE_RECMODE RecType); -void I2C_TBIMConfig(I2C_TYPE_TRBIM Type); -void I2C_RBIMConfig(I2C_TYPE_TRBIM Type); -void I2C_AckDelay(I2C_TYPE_ADLY Type,TYPE_FUNCEN NewStatus); -void I2C_TISConfig(I2C_TYPE_TIS Time); -void I2C_SendByte(uint8_t Byte); -void I2C_SendHalfWord(uint16_t HalfWord); -void I2C_SendWord(uint32_t Word); -uint8_t I2C_RecByte(void); -uint16_t I2C_RecHalfWord(void); -uint32_t I2C_RecWord(void); -I2C_TYPE_RWMODE I2C_GetRWMode(void); -FlagStatus I2C_GetTBStatus(void); -FlagStatus I2C_GetFlagStatus(I2C_TYPE_FLAG I2C_Flag); -FlagStatus I2C_GetITStatus( I2C_TYPE_IT I2C_Flag); -void I2C_ClearITPendingBit(I2C_CLR_IF I2C_IT); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h deleted file mode 100644 index 7bee613c8a..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_printf.h +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_printf.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ڴӡ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBPRINTF_H__ -#define __LIBPRINTF_H__ - -#include "lib_uart.h" -#include -#include "type.h" - -int fputc(int ch, FILE *f); -static char *itoa(int value, char *string, int radix); -ErrorStatus UART_printf(uint8_t *Data,...); - -#ifdef __clang__ -ErrorStatus UART_printf(uint8_t *Data, ...); - -#elif defined __CC_ARM - -#define UART_printf printf - -#endif - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h deleted file mode 100644 index 86dbb5bcc4..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_rtc.h +++ /dev/null @@ -1,84 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: lib_rtc.h - * : WangMX - * : V1.00 - * : 2017/07/14 - * : RTCģͷļ - * ע: HRSDK-GDB-ES8P508x V1.1 - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#ifndef __LIBRTC_H__ -#define __LIBRTC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/*RTCʱԴѡ*/ -typedef enum -{ - RTC_LOSC = 0x0, //ⲿ32768HZʱ RTCȷʱ - RTC_LRC = 0x1, //ڲLRCʱ RTCǾȷʱ - RTC_PLCK_256 = 0x2, //PLCLK/256 RTCͨ - RTC_PLCK = 0x3, //PCLK RTCͨ -}RTC_TYPE_CLKS; - -/*RTCʱ12/24Сʱѡ*/ -typedef enum -{ - RTC_HOUR12 = 0x0, //12Сʱ - RTC_HOUR24 = 0x1, //24Сʱ -}RTC_TYPE_TIME; - -/* RTCжԴѡ */ -typedef enum { - RTC_Interrupt_Source_Second = 0x001, // ж - RTC_Interrupt_Source_Minute = 0x002, // ж - RTC_Interrupt_Source_Hour = 0x004, // Сʱж - RTC_Interrupt_Source_Day = 0x008, // ж - RTC_Interrupt_Source_Month = 0x010, // ж - RTC_Interrupt_Source_DayALE = 0x100, // ж - RTC_Interrupt_Source_WeekALE = 0x200, // ж -} RTC_Interrupt_Source; - - -/********************* RTCģ麯 *********************/ -void RTC_Init(RTC_TYPE_CLKS CLKx,RTC_TYPE_TIME HOURx); -uint32_t RTC_ReadHourmode(void); -uint32_t RTC_ReadSecond(void); -uint32_t RTC_ReadMinute(void); -uint32_t RTC_ReadHour(uint32_t *meridiem); -uint32_t RTC_ReadDay(void); -uint32_t RTC_ReadMonth(void); -uint32_t RTC_ReadYear(void); -uint32_t RTC_ReadWeek(void); - -ErrorStatus RTC_WriteSecond(uint32_t second); -ErrorStatus RTC_WriteMinute(uint32_t minute); -ErrorStatus RTC_WriteHour(uint32_t hour, uint32_t meridiem); -ErrorStatus RTC_WriteDay(uint32_t day); -ErrorStatus RTC_WriteMonth(uint32_t month); -ErrorStatus RTC_WriteYear(uint32_t year); -ErrorStatus RTC_WriteWeek(uint32_t week); - -uint32_t RTC_ReadWeekAlarmMinute(void); -uint32_t RTC_ReadWeekAlarmHour(uint32_t *meridiem); -uint32_t RTC_ReadWeekAlarmWeek(void); -uint32_t RTC_ReadDayAlarmMinute(void); -uint32_t RTC_ReadDayAlarmHour(uint32_t *meridiem); - -ErrorStatus RTC_WriteWeekAlarmMinute(uint32_t minute); -ErrorStatus RTC_WriteWeekAlarmHour(uint32_t hour, uint32_t meridiem); -ErrorStatus RTC_WriteWeekAlarmWeek(uint32_t week); -ErrorStatus RTC_WriteDayAlarmMinute(uint32_t minute); -ErrorStatus RTC_WriteDayAlarmHour(uint32_t hour, uint32_t meridiem); - -void RTC_InterruptEnable(RTC_Interrupt_Source src); -void RTC_InterruptDisable(RTC_Interrupt_Source src); -ITStatus RTC_GetITStatus(RTC_Interrupt_Source src); -FlagStatus RTC_GetFlagStatus(RTC_Interrupt_Source src); -void RTC_ClearITPendingBit(RTC_Interrupt_Source src); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h deleted file mode 100644 index e69c9a674f..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scs.h +++ /dev/null @@ -1,98 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_scs.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBNVIC_H__ -#define __LIBNVIC_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* жԴѡ */ -typedef enum -{ - NVIC_PINT0_IRQn = 0, - NVIC_PINT1_IRQn = 1, - NVIC_PINT2_IRQn = 2, - NVIC_PINT3_IRQn = 3, - NVIC_PINT4_IRQn = 4, - NVIC_PINT5_IRQn = 5, - NVIC_PINT6_IRQn = 6, - NVIC_PINT7_IRQn = 7, - NVIC_T16N0_IRQn = 8, - NVIC_T16N1_IRQn = 9, - NVIC_T16N2_IRQn = 10, - NVIC_T16N3_IRQn = 11, - NVIC_T32N0_IRQn = 12, - NVIC_IWDT_IRQn = 14, - NVIC_WWDT_IRQn = 15, - NVIC_CCM_IRQn = 16, - NVIC_PLK_IRQn = 17, - NVIC_LVD_IRQn = 18, - NVIC_KINT_IRQn = 19, - NVIC_RTC_IRQn = 20, - NVIC_ADC_IRQn = 21, - NVIC_AES_IRQn = 23, - NVIC_UART0_IRQn = 24, - NVIC_UART1_IRQn = 25, - NVIC_UART2_IRQn = 26, - NVIC_UART3_IRQn = 27, - NVIC_UART4_IRQn = 28, - NVIC_UART5_IRQn = 29, - NVIC_SPI0_IRQn = 30, - NVIC_I2C0_IRQn = 31, -}NVIC_IRQChannel; - -/* ȼ */ -typedef enum -{ - NVIC_Priority_0 = 0x0 , - NVIC_Priority_1 = 0x1 , - NVIC_Priority_2 = 0x2 , - NVIC_Priority_3 = 0x3 , -}NVIC_IRQPriority; - -/* ģʽ */ -typedef enum -{ - SCB_LP_SleepOnExit = 0x02 , //ISRжϴ򷵻ص߳ģʽʱǷ - SCB_LP_SleepDeep = 0x04 , //˯ - SCB_LP_SEVOPend = 0x10 , //жϹʱǷΪѵѡλ -}SCB_TYPE_SCR; - -/* SysTickʱԴѡ */ -typedef enum -{ - SysTick_ClkS_Base = 0x0 , //׼ʱ(Hclk/3) - SysTick_ClkS_Cpu = 0x1 , //ʱ(Hclk) -}SYST_TYPE_CLKS; - -/* SysTickʼýṹ嶨 */ -typedef struct -{ - uint32_t SysTick_Value; //ݼֵ24λҶ - SYST_TYPE_CLKS SysTick_ClkSource; //ʱԴѡ - TYPE_FUNCEN SysTick_ITEnable; //жʹܡʧ -}SYSTICK_InitStruType; - -/**************ģ궨*************/ - -/*SysTickʹ*/ -#define SysTick_Enable() (SysTick->CTRL |= 0x00000001) -#define SysTick_Disable() (SysTick->CTRL &= 0xFFFFFFFE) - -/************SCSģ麯***********/ -void NVIC_Init(NVIC_IRQChannel Channel,NVIC_IRQPriority Priority,TYPE_FUNCEN Cmd); -void SCB_SystemLPConfig(SCB_TYPE_SCR LowPowerMode, TYPE_FUNCEN NewState); -uint32_t SCB_GetCpuID(void); -void SysTick_Init(SYSTICK_InitStruType* SysT_InitStruct); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h deleted file mode 100644 index a07440153b..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_scu.h +++ /dev/null @@ -1,314 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_scu.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBSCU_H -#define __LIBSCU_H - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* NMIжѡ */ -typedef enum -{ - SCU_PINT0_IRQn = 0, - SCU_PINT1_IRQn = 1, - SCU_PINT2_IRQn = 2, - SCU_PINT3_IRQn = 3, - SCU_PINT4_IRQn = 4, - SCU_PINT5_IRQn = 5, - SCU_PINT6_IRQn = 6, - SCU_PINT7_IRQn = 7, - SCU_T16N0_IRQn = 8, - SCU_T16N1_IRQn = 9, - SCU_T16N2_IRQn = 10, - SCU_T16N3_IRQn = 11, - SCU_T32N0_IRQn = 12, - SCU_IWDT_IRQn = 14, - SCU_WWDT_IRQn = 15, - SCU_CCM_IRQn = 16, - SCU_PLK_IRQn = 17, - SCU_LVD_IRQn = 18, - SCU_KINT_IRQn = 19, - SCU_RTC_IRQn = 20, - SCU_ADC_IRQn = 21, - SCU_AES_IRQn = 23, - SCU_UART0_IRQn = 24, - SCU_UART1_IRQn = 25, - SCU_UART2_IRQn = 26, - SCU_UART3_IRQn = 27, - SCU_UART4_IRQn = 28, - SCU_UART5_IRQn = 29, - SCU_SPI0_IRQn = 30, - SCU_I2C0_IRQn = 31, -}SCU_TYPE_NMICS; - -/* PWRCλ״̬Ĵ־λ */ -typedef enum -{ - SCU_PWRC_PORF= 0X00001, //PORλ־λ - SCU_PWRC_RRCF = 0X00002, //PORCλ־λ - SCU_PWRC_PORRSTF = 0x00004, //PORܸλ־ - SCU_PWRC_BORF = 0x00008, //BORܸλ־ - SCU_PWRC_WWDTRSTF = 0x00010, //WWDTλ־ - SCU_PWRC_IWDTRSTF = 0x00020, //IWDTλ־ - SCU_PWRC_MRSTF = 0x00040, //MRSTnλ־ - SCU_PWRC_SOFTRSTF = 0x00080, //λ־ -}SCU_TYPE_PWRC; - -/* LVDĴ־λ */ -typedef enum -{ - SCU_LVDFlag_IF = 0x0100, //LVDжϱ־ - SCU_LVDFlag_Out = 0x8000, //״̬λ -}SCU_TYPE_LVD0CON; - -/* ʱѡ */ -typedef enum -{ - SCU_SysClk_HRC = 0x0 , //ڲ20MHZ RCʱ - SCU_SysClk_XTAL = 0x1 , //ⲿʱ - SCU_SysClk_PLL = 0x2 , //PLL -}SCU_TYPE_SYSCLK; - -/*clk_selʱԴѡ*/ -typedef enum -{ - CLK_SEL_HRC = 0x0, //HRC 20M - CLK_SEL_LRC = 0x1, //LRC 32KHz - CLK_SEL_XTAL = 0x2, //ӾXTAL -}SCU_TYPE_CLK_SEL; - -/* PLLʱԴѡ */ -typedef enum -{ - SCU_PLL_HRC = 0x0 , //PLLʱԴHRC - SCU_PLL_LRC = 0x2 , //PLLʱԴLRC - SCU_PLL_XTAL_32K = 0x3 , //PLLʱԴXTAL - SCU_PLL_XTAL_4M = 0x4 , //PLLʱԴXTAL - SCU_PLL_XTAL_8M = 0x5, //PLLʱԴXTAL - SCU_PLL_XTAL_16M = 0x6, //PLLʱԴXTAL - SCU_PLL_XTAL_20M = 0x7, //PLLʱԴXTAL -} SCU_PLL_Origin; - -/* PLLʱƵ */ -typedef enum -{ - SCU_PLL_32M = 0x0 , //PLLʱΪ32MHz - SCU_PLL_48M = 0x1 , //PLLʱΪ48Mhz -} SCU_PLL_Out; - -/************SCUģ궨***********/ -/* SCUд */ -#define SCU_RegUnLock() (SCU->PROT.Word = 0x55AA6996) -#define SCU_RegLock() (SCU->PROT.Word = 0x00000000) - -/* NMIʹܿ */ -#define SCU_NMI_Enable() (SCU->NMICON.NMIEN = 0x1) -#define SCU_NMI_Disable() (SCU->NMICON.NMIEN = 0x0) - -/*-------LVDģ-------*/ - -/* LVDʹܿ */ -#define SCU_LVD_Enable() (SCU->LVDCON.EN = 0x1) -#define SCU_LVD_Disable() (SCU->LVDCON.EN = 0x0) - -/* LVD˲ʹܿ */ -#define SCU_LVDFLT_Enable() (SCU->LVDCON.FLTEN = 0x1) -#define SCU_LVDFLT_Disable() (SCU->LVDCON.FLTEN = 0x0) - -/* LVDѹѡ */ -#define SCU_LVDVS_2V0() (SCU->LVDCON.VS = 0x0) -#define SCU_LVDVS_2V1() (SCU->LVDCON.VS = 0x1) -#define SCU_LVDVS_2V2() (SCU->LVDCON.VS = 0x2) -#define SCU_LVDVS_2V4() (SCU->LVDCON.VS = 0x3) -#define SCU_LVDVS_2V6() (SCU->LVDCON.VS = 0x4) -#define SCU_LVDVS_2V8() (SCU->LVDCON.VS = 0x5) -#define SCU_LVDVS_3V0() (SCU->LVDCON.VS = 0x6) -#define SCU_LVDVS_3V6() (SCU->LVDCON.VS = 0x7) -#define SCU_LVDVS_4V() (SCU->LVDCON.VS = 0x8) -#define SCU_LVDVS_4V6() (SCU->LVDCON.VS = 0x9) -#define SCU_LVDVS_2V3() (SCU->LVDCON.VS = 0xA) -#define SCU_LVDVS_LVDIN() (SCU->LVDCON.VS = 0xE) - -/* LVDжʹܿ */ -#define SCU_LVDIT_Enable() (SCU->LVDCON.IE = 0x1) -#define SCU_LVDIT_Disable() (SCU->LVDCON.IE = 0x0) - -/* LVDжϱ־λ */ -#define SCU_LVDClearIFBit() (SCU->LVDCON.IF = 1) - -/* LVDжϲģʽѡ */ -#define SCU_LVDIFS_Rise() (SCU->LVDCON.IFS = 0x0) //LVDOزж -#define SCU_LVDIFS_Fall() (SCU->LVDCON.IFS = 0x1) //LVDO½زж -#define SCU_LVDIFS_High() (SCU->LVDCON.IFS = 0x2) //LVDOߵƽж -#define SCU_LVDIFS_Low() (SCU->LVDCON.IFS = 0x3) //LVDO͵ƽж -#define SCU_LVDIFS_Change() (SCU->LVDCON.IFS = 0x4) //LVDOƽ仯ж - -/* FLASHʵȴʱѡ */ -#define SCU_FlashWait_1Tclk() (SCU->FLASHWAIT.ACCT = 0x0) -#define SCU_FlashWait_2Tclk() (SCU->FLASHWAIT.ACCT = 0x1) -#define SCU_FlashWait_3Tclk() (SCU->FLASHWAIT.ACCT = 0x2) -#define SCU_FlashWait_4Tclk() (SCU->FLASHWAIT.ACCT = 0x3) -#define SCU_FlashWait_5Tclk() (SCU->FLASHWAIT.ACCT = 0x4) -#define SCU_FlashWait_6Tclk() (SCU->FLASHWAIT.ACCT = 0x5) -#define SCU_FlashWait_7Tclk() (SCU->FLASHWAIT.ACCT = 0x6) -#define SCU_FlashWait_8Tclk() (SCU->FLASHWAIT.ACCT = 0x7) -#define SCU_FlashWait_9Tclk() (SCU->FLASHWAIT.ACCT = 0x8) -#define SCU_FlashWait_10Tclk() (SCU->FLASHWAIT.ACCT = 0x9) -#define SCU_FlashWait_11Tclk() (SCU->FLASHWAIT.ACCT = 0xA) -#define SCU_FlashWait_12Tclk() (SCU->FLASHWAIT.ACCT = 0xB) -#define SCU_FlashWait_13Tclk() (SCU->FLASHWAIT.ACCT = 0xC) -#define SCU_FlashWait_14Tclk() (SCU->FLASHWAIT.ACCT = 0xD) -#define SCU_FlashWait_15Tclk() (SCU->FLASHWAIT.ACCT = 0xE) -#define SCU_FlashWait_16Tclk() (SCU->FLASHWAIT.ACCT = 0xF) - -/* ϵͳʱӺƵѡ */ -#define SCU_SysClk_Div1() (SCU->SCLKEN0.SYSCLK_DIV = 0) -#define SCU_SysClk_Div2() (SCU->SCLKEN0.SYSCLK_DIV = 1) -#define SCU_SysClk_Div4() (SCU->SCLKEN0.SYSCLK_DIV = 2) -#define SCU_SysClk_Div8() (SCU->SCLKEN0.SYSCLK_DIV = 3) -#define SCU_SysClk_Div16() (SCU->SCLKEN0.SYSCLK_DIV = 4) -#define SCU_SysClk_Div32() (SCU->SCLKEN0.SYSCLK_DIV = 5) -#define SCU_SysClk_Div64() (SCU->SCLKEN0.SYSCLK_DIV = 6) -#define SCU_SysClk_Div128() (SCU->SCLKEN0.SYSCLK_DIV = 7) - -/* HRCʹܿ (ڲ20Mhz) */ -#define SCU_HRC_Enable() (SCU->SCLKEN1.HRC_EN = 1) -#define SCU_HRC_Disable() (SCU->SCLKEN1.HRC_EN = 0) - -/* XTALʹܿ */ -#define SCU_XTAL_Enable() (SCU->SCLKEN1.XTAL_EN = 1) -#define SCU_XTAL_Disable() (SCU->SCLKEN1.XTAL_EN = 0) - -/* PLLģʽʹܿ */ -#define SCU_PLL_Enable() (SCU->SCLKEN1.PLL_EN = 1) -#define SCU_PLL_Disable() (SCU->SCLKEN1.PLL_EN = 0) - -/*-------ʱӿ-------*/ -/* SCUʱʹܿ */ -#define SCU_SCUCLK_Enable() (SCU->PCLKEN0.SCU_EN = 1) -#define SCU_SCUCLK_Disable() (SCU->PCLKEN0.SCU_EN = 0) - -/* GPIOʱʹܿ */ -#define SCU_GPIOCLK_Enable() (SCU->PCLKEN0.GPIO_EN = 1) -#define SCU_GPIOCLK_Disable() (SCU->PCLKEN0.GPIO_EN = 0) - -/* FLASH IAPʱʹܿ */ -#define SCU_IAPCLK_Enable() (SCU->PCLKEN0.IAP_EN = 1) -#define SCU_IAPCLK_Disable() (SCU->PCLKEN0.IAP_EN = 0) - -/* CRCʱʹܿ */ -#define SCU_CRCCLK_Enable() (SCU->PCLKEN0.CRC_EN = 1) -#define SCU_CRCCLK_Disable() (SCU->PCLKEN0.CRC_EN = 0) - -/* ADCʱʹܿ */ -#define SCU_ADCCLK_Enable() (SCU->PCLKEN0.ADC_EN = 1) -#define SCU_ADCCLK_Disable() (SCU->PCLKEN0.ADC_EN = 0) - -/* RTCʱʹܿ */ -#define SCU_RTCCLK_Enable() (SCU->PCLKEN0.RTC_EN = 1) -#define SCU_RTCCLK_Disable() (SCU->PCLKEN0.RTC_EN = 0) - -/* IWDTʱʹܿ */ -#define SCU_IWDTCLK_Enable() (SCU->PCLKEN0.IWDT_EN = 1) -#define SCU_IWDTCLK_Disable() (SCU->PCLKEN0.IWDT_EN = 0) - -/* WWDTʱʹܿ */ -#define SCU_WWDTCLK_Enable() (SCU->PCLKEN0.WWDT_EN = 1) -#define SCU_WWDTCLK_Disable() (SCU->PCLKEN0.WWDT_EN = 0) - -/* AESʱʹܿ */ -#define SCU_AESCLK_Enable() (SCU->PCLKEN0.AES_EN = 1) -#define SCU_AESCLK_Disable() (SCU->PCLKEN0.AES_EN = 0) - -/* T16N0ʱʹܿ */ -#define SCU_T16N0CLK_Enable() (SCU->PCLKEN1.T16N0_EN = 1) -#define SCU_T16N0CLK_Disable() (SCU->PCLKEN1.T16N0_EN = 0) - -/* T16N1ʱʹܿ */ -#define SCU_T16N1CLK_Enable() (SCU->PCLKEN1.T16N1_EN = 1) -#define SCU_T16N1CLK_Disable() (SCU->PCLKEN1.T16N1_EN = 0) - -/* T16N2ʱʹܿ */ -#define SCU_T16N2CLK_Enable() (SCU->PCLKEN1.T16N2_EN = 1) -#define SCU_T16N2CLK_Disable() (SCU->PCLKEN1.T16N2_EN = 0) - -/* T16N3ʱʹܿ */ -#define SCU_T16N3CLK_Enable() (SCU->PCLKEN1.T16N3_EN = 1) -#define SCU_T16N3CLK_Disable() (SCU->PCLKEN1.T16N3_EN = 0) - -/* T32N0ʱʹܿ */ -#define SCU_T32N0CLK_Enable() (SCU->PCLKEN1.T32N0_EN = 1) -#define SCU_T32N0CLK_Disable() (SCU->PCLKEN1.T32N0_EN = 0) - -/* UART0ʱʹܿ */ -#define SCU_UART0CLK_Enable() (SCU->PCLKEN1.UART0_EN = 1) -#define SCU_UART0CLK_Disable() (SCU->PCLKEN1.UART0_EN = 0) - -/* UART1ʱʹܿ */ -#define SCU_UART1CLK_Enable() (SCU->PCLKEN1.UART1_EN = 1) -#define SCU_UART1CLK_Disable() (SCU->PCLKEN1.UART1_EN = 0) - -/* UART2ʱʹܿ */ -#define SCU_UART2CLK_Enable() (SCU->PCLKEN1.UART2_EN = 1) -#define SCU_UART2CLK_Disable() (SCU->PCLKEN1.UART2_EN = 0) - -/* UART3ʱʹܿ */ -#define SCU_UART3CLK_Enable() (SCU->PCLKEN1.UART3_EN = 1) -#define SCU_UART3CLK_Disable() (SCU->PCLKEN1.UART3_EN = 0) - -/* UART4ʱʹܿ */ -#define SCU_UART4CLK_Enable() (SCU->PCLKEN1.UART4_EN = 1) -#define SCU_UART4CLK_Disable() (SCU->PCLKEN1.UART4_EN = 0) - -/* UART5ʱʹܿ */ -#define SCU_UART5CLK_Enable() (SCU->PCLKEN1.UART5_EN = 1) -#define SCU_UART5CLK_Disable() (SCU->PCLKEN1.UART5_EN = 0) - -/* SPI0ʱʹܿ */ -#define SCU_SPI0CLK_Enable() (SCU->PCLKEN1.SPI0_EN = 1) -#define SCU_SPI0CLK_Disable() (SCU->PCLKEN1.SPI0_EN = 0) - -/* IIC0ʱʹܿ */ -#define SCU_IIC0CLK_Enable() (SCU->PCLKEN1.I2C0_EN = 1) -#define SCU_IIC0CLK_Disable() (SCU->PCLKEN1.I2C0_EN = 0) - -/* жӳʹܿ */ -#define SCU_TBLRemap_Enable() (SCU->TBLREMAPEN.EN= 1) -#define SCU_TBLRemap_Disable() (SCU->TBLREMAPEN.EN= 0) - -/* жƫƼĴ xΪ2^24=16777216 */ -#define SCU_TBL_Offset(x) (SCU->TBLOFF.TBLOFF = (uint32_t)x) - -/************SCUģ麯***********/ -void SCU_OpenXTAL(void); -void SCU_NMISelect(SCU_TYPE_NMICS NMI_Type); -FlagStatus SCU_GetPWRCFlagStatus(SCU_TYPE_PWRC PWRC_Flag); -void SCU_ClearPWRCFlagBit(SCU_TYPE_PWRC PWRC_Flag); -FlagStatus SCU_GetLVDFlagStatus(SCU_TYPE_LVD0CON LVD_Flag); -void SCU_SysClkSelect(SCU_TYPE_SYSCLK Sysclk); -SCU_TYPE_SYSCLK SCU_GetSysClk(void); -FlagStatus SCU_HRCReadyFlag(void); -FlagStatus SCU_XTALReadyFlag(void); -FlagStatus SCU_PLLReadyFlag(void); -void SystemClockConfig(void); -void SystemClockConfig_1(void); -void DeviceClockAllEnable(void); -void DeviceClockAllDisable(void); -void SystemClockSelect(SCU_TYPE_SYSCLK SYSCLKx , SCU_TYPE_CLK_SEL CLK_SEL); -void PLLClock_Config(TYPE_FUNCEN pll_en , SCU_PLL_Origin pll_origin ,SCU_PLL_Out pll_out,TYPE_FUNCEN sys_pll); -#endif -/*************************END OF FILE**********************/ - - - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h deleted file mode 100644 index 8089ae8b66..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_spi.h +++ /dev/null @@ -1,141 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_spi.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * SPIģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBSPI_H__ -#define __LIBSPI_H__ - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* ͨݸʽ */ -typedef enum -{ - SPI_RiseSendFallRec = 0x0 , //ͨݸʽطͣȣ½ؽգ - SPI_FallSendRiseRec = 0x1 , //ͨݸʽ½طͣȣؽգ - SPI_RiseRecFallSend = 0x2 , //ͨݸʽؽգȣ½طͣ - SPI_FallRecRiseSend = 0x3 , //ͨݸʽ½ؽգȣطͣ -}SPI_TYPE_DFS; - -/* ͨѶģʽ */ -typedef enum -{ - SPI_Mode_Master = 0x0 , //ͨѶģʽ - SPI_Mode_Slave = 0x1 , //ͨѶģʽӶ -}SPI_TYPE_MODE; - -/* ADCʼýṹ嶨 */ -typedef struct -{ - uint32_t SPI_Freq; //SPIƵ - - SPI_TYPE_DFS SPI_Df; //ͨѶݸʽ - - SPI_TYPE_MODE SPI_Mode; //ͨѶģʽ - - uint8_t SPI_DW; //֡λ - - TYPE_FUNCEN SPI_DelayRec; //ʱʹ - - TYPE_FUNCEN SPI_DelaySend; //ͼʹ - - uint8_t SPI_SendDelayPeroid;//ͼ - -}SPI_InitStruType; - -/* ־λ */ -typedef enum -{ - SPI_Flag_TB = 0x00000001, - SPI_Flag_RB = 0x00000002, - SPI_Flag_TE = 0x00000004, - SPI_Flag_RO = 0x00000008, - SPI_Flag_ID = 0x00000010, - SPI_Flag_NSSIF = 0x00000020, - SPI_Flag_TBWE = 0x00000040, - SPI_Flag_NSS = 0x00000080, - SPI_Flag_TBEF0 = 0x00000100, - SPI_Flag_TBEF1 = 0x00000200, - SPI_Flag_TBEF2 = 0x00000400, - SPI_Flag_TBEF3 = 0x00000800, - SPI_Flag_RBFF0 = 0x00001000, - SPI_Flag_RBFF1 = 0x00002000, - SPI_Flag_RBFF2 = 0x00004000, - SPI_Flag_RBFF3 = 0x00008000, - SPI_Flag_IDLE = 0x00010000, - SPI_Flag_TMS = 0x00020000, -}SPI_TYPE_FLAG; - -/* жģʽѡ */ -typedef enum -{ - SPI_IType_BYTE = 0x0 , - SPI_IType_HALFWORD = 0x1 , - SPI_IType_WORD = 0x2 , -}SPI_TYPE_TRBIM; - -/* SPIж */ -typedef enum -{ - SPI_IT_TB = 0x01 , - SPI_IT_RB = 0x02 , - SPI_IT_TE = 0x04 , - SPI_IT_RO = 0x08 , - SPI_IT_ID = 0x10 , - SPI_IT_NSS = 0x20 , - SPI_IT_TBWE = 0x40 , -}SPI_TYPE_IT; - -/* SPIжϱ־ */ -typedef enum -{ - SPI_Clr_TE = 0x04 , - SPI_Clr_RO = 0x08 , - SPI_Clr_ID = 0x10 , - SPI_Clr_NSS = 0x20 , - SPI_Clr_TBWE = 0x40 , -}SPI_CLR_IF; - -/************SPIģ궨***********/ - -/* SPIʹܿ */ -#define SPI_Enable() (SPI0->CON.EN = 1) -#define SPI_Disable() (SPI0->CON.EN = 0) - -/* SPIʹܿ */ -#define SPI_RecEnable() (SPI0->CON.REN = 1) -#define SPI_RecDisable() (SPI0->CON.REN = 0) - -/* SPIλ */ -#define SPI_Rst() (SPI0->CON.RST = 1) - -/* SPI */ -#define SPI_RX_CLR() (SPI0->CON.RXCLR = 1) -#define SPI_TX_CLR() (SPI0->CON.TXCLR = 1) - -/************SPIģ麯***********/ -void SPI_Init(SPI_InitStruType* SPI_InitStruct); -void SPI_ITConfig(SPI_TYPE_IT SPI_IE,TYPE_FUNCEN NewState); -void SPI_DataFormatConfig(SPI_TYPE_DFS Type); -void SPI_SendByte(uint8_t Temp); -void SPI_SendHalfWord(uint16_t Temp); -void SPI_SendWord(uint32_t Temp); -uint8_t SPI_RecByte(void); -uint16_t SPI_RecHalfWord(void); -uint32_t SPI_RecWord(void); -void SPI_TBIMConfig(SPI_TYPE_TRBIM Type); -void SPI_RBIMConfig(SPI_TYPE_TRBIM Type); -FlagStatus SPI_GetFlagStatus(SPI_TYPE_FLAG Flag); -ITStatus SPI_GetITStatus(SPI_TYPE_IT Flag); -void SPI_ClearITPendingBit(SPI_CLR_IF Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h deleted file mode 100644 index d5493c8e3a..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_timer.h +++ /dev/null @@ -1,310 +0,0 @@ -/****************************************************************************************** - * Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - * ļ: lib_timer.h - * : Liut - * : V1.00 - * : 2017/07/14 - * : 16λʱ/32λʱ/⺯ͷļ - * ע: ES8P508xϵоƬ - * ѧϰʾʹãûֱôķջеκηΡ - *******************************************************************************************/ -#ifndef __LIBTIMER_H__ -#define __LIBTIMER_H__ - -#include "ES8P508x.h" -#include "type.h" - -/* ʱԴѡ */ -typedef enum -{ - TIM_ClkS_PCLK = 0x0 , //ʱԴѡ:ڲPCLK - TIM_ClkS_CK0 = 0x1 , //ʱԴѡ:ⲿCK0ʱ - TIM_ClkS_CK1 = 0x2 , //ʱԴѡ:ⲿCK1ʱ -}TIM_TYPE_CLKS; - -/* ⲿʱӼѡ */ -typedef enum -{ - TIM_EDGE_Rise = 0x0 , //ⲿʱӼѡ: - TIM_EDGE_Fall = 0x1 , //ⲿʱӼѡ:½ - TIM_EDGE_All = 0x2 , //ⲿʱӼѡ: -}TIM_TYPE_EDGE; - - -/* ģʽѡ */ -typedef enum -{ - TIM_Mode_TC0 = 0x0 , //ģʽ:ʱģʽ - TIM_Mode_TC1 = 0x1 , //ģʽ:ʱģʽ - TIM_Mode_CAP = 0x2 , //ģʽ:׽ģʽ - TIM_Mode_PWM = 0x3 , //ģʽ:ģʽ -}TIM_TYPE_MODE; - -/* TIMʼýṹ嶨 */ -typedef struct -{ - TIM_TYPE_CLKS TIM_ClkS; //ʱԴѡ - TYPE_FUNCEN TIM_SYNC; //ⲿʱͬ - TIM_TYPE_EDGE TIM_EDGE; //ⲿʱӼѡ - TIM_TYPE_MODE TIM_Mode; //ģʽѡ -}TIM_BaseInitStruType; - -/* ƥĴֵƥĹģʽ */ -typedef enum -{ - TIM_Go_No = 0x0 , //ƥĴֵƥĹģʽ:ж - TIM_Hold_Int = 0x1 , //ƥĴֵƥĹģʽ:ּж - TIM_Clr_Int = 0x2 , //ƥĴֵƥĹģʽ:㲢¼ж - TIM_Go_Int = 0x3 , //ƥĴֵƥĹģʽ:ж -}TIM_TYPE_MATCON; - -/* ƥĴֵƥ˿ڵĹģʽ */ -typedef enum -{ - TIM_Out_Hold = 0x0 , //ƥĴֵƥ˿ڵĹģʽ - TIM_Out_Low = 0x1 , //ƥĴֵƥ˿ڵĹģʽ0 - TIM_Out_High = 0x2 , //ƥĴֵƥ˿ڵĹģʽ1 - TIM_Out_Switch = 0x3 , //ƥĴֵƥ˿ڵĹģʽȡ -}TIM_TYPE_MATOUT; - -/* ׽ */ -typedef enum -{ - TIM_CapTime_1 = 0x0 , //׽:1 - TIM_CapTime_2 = 0x1 , //׽:2 - TIM_CapTime_3 = 0x2 , //׽:3 - TIM_CapTime_4 = 0x3 , //׽:4 - TIM_CapTime_5 = 0x4 , //׽:5 - TIM_CapTime_6 = 0x5 , //׽:6 - TIM_CapTime_7 = 0x6 , //׽:7 - TIM_CapTime_8 = 0x7 , //׽:8 - TIM_CapTime_9 = 0x8 , //׽:9 - TIM_CapTime_10 = 0x9 , //׽:10 - TIM_CapTime_11 = 0xA , //׽:11 - TIM_CapTime_12 = 0xB , //׽:12 - TIM_CapTime_13 = 0xC , //׽:13 - TIM_CapTime_14 = 0xD , //׽:14 - TIM_CapTime_15 = 0xE , //׽:15 - TIM_CapTime_16 = 0xF , //׽:16 -}TIM_TYPE_CAPT; - -/* PWM */ -typedef enum -{ - POSITIVE = 0X00, // - NEGATIVE = 0X01, // -}T16Nx_PWMOUT_POLAR_Type; - -/* ƹܳʼṹ嶨 */ -typedef struct -{ - TYPE_FUNCEN T16Nx_MOE0; //˿0ʹ - TYPE_FUNCEN T16Nx_MOE1; //˿1ʹ - T16Nx_PWMOUT_POLAR_Type T16Nx_POL0; //T16NxOUT0ѡλ - T16Nx_PWMOUT_POLAR_Type T16Nx_POL1; //T16NxOUT1ѡλ -}T16Nx_PWMInitStruType; - -/* ׽ܳʼṹ嶨 */ -typedef struct -{ - TYPE_FUNCEN TIM_CapRise; //ز׽ʹ - TYPE_FUNCEN TIM_CapFall; //½ز׽ʹ - TYPE_FUNCEN TIM_CapIS0; //˿0ʹ - TYPE_FUNCEN TIM_CapIS1; //˿1ʹ - TIM_TYPE_CAPT TIM_CapTime; //׽ -}TIM_CapInitStruType; - -/* PWMɲƽ */ -typedef enum -{ - PWMBKOUT_Low = 0, - PWMBKOUT_High = 1, -}T16Nx_PWMBKOUT_LEVEl; - -/* PWMɲźżѡ */ -typedef enum -{ - PWMBKP_High = 0, - PWMBKP_Low = 1, -}T16Nx_PWMBKP_LEVEl; - -/*PWMɲźԴѡ*/ -typedef enum -{ - PWMBKPS_PINT0 = 0, - PWMBKPS_PINT1 = 1, - PWMBKPS_PINT2 = 2, - PWMBKPS_PINT3 = 3, - PWMBKPS_PINT4 = 4, - PWMBKPS_PINT5 = 5, - PWMBKPS_PINT6 = 6, - PWMBKPS_PINT7 = 7, -}T16Nx_PWMBKP_S; - -/*PWMɲ*/ -typedef struct -{ - - T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL0; //PWMͨ0ɲƽѡ - T16Nx_PWMBKOUT_LEVEl T16Nx_PWMBKL1; //PWMͨ1ɲƽѡ - T16Nx_PWMBKP_S T16Nx_PWMBKS; //PWMͨźԴѡ - T16Nx_PWMBKP_LEVEl T16Nx_PWMBKPS; //PWMͨɲźżѡ - TYPE_FUNCEN T16Nx_PWMBKEN; //PWMɲʹ -}T16Nx_PWMBK_Type; - -/* ж */ -typedef enum -{ - TIM_IT_MAT0 = 0x01 , - TIM_IT_MAT1 = 0x02 , - TIM_IT_MAT2 = 0x04 , - TIM_IT_MAT3 = 0x08 , - TIM_IT_N = 0x10 , - TIM_IT_CAP0 = 0x20 , - TIM_IT_CAP1 = 0x40 , - TIM_IT_PBK = 0x80 , -}TIM_TYPE_IT; - -typedef enum -{ - TIM_IF_MAT0 = 0x01 , - TIM_IF_MAT1 = 0x02 , - TIM_IF_MAT2 = 0x04 , - TIM_IF_MAT3 = 0x08 , - TIM_IF_N = 0x10 , - TIM_IF_CAP0 = 0x20 , - TIM_IF_CAP1 = 0x40 , - TIM_IF_PBK = 0x80 , -}TIM_TYPE_IF; - -/* ƥĴ */ -typedef enum -{ - TIM_MAT0 = 0x00 , - TIM_MAT1 = 0x01 , - TIM_MAT2 = 0x02 , - TIM_MAT3 = 0x03 , -}TIM_TYPE_MATX; - -/*T16N ADCʹܿ*/ -typedef enum -{ - T16Nx_MAT0 = 0x02, //PWMͨ0ƥ0ʹ - T16Nx_MAT1 = 0x04, //PWMͨ0ƥ1ʹ - T16Nx_MAT2 = 0x20, //PWMͨ1ƥ2ʹ - T16Nx_MAT3 = 0x40, //PWMͨ1ƥ3ʹ -}T16Nx_PWMTRG_type; - -/*************TIMģ궨************/ - -/* TIMģʹܿ */ -#define T16N0_Enable() (T16N0->CON0.EN = 1) -#define T16N1_Enable() (T16N1->CON0.EN = 1) -#define T16N2_Enable() (T16N2->CON0.EN = 1) -#define T16N3_Enable() (T16N3->CON0.EN = 1) -#define T32N0_Enable() (T32N0->CON0.EN = 1) -#define T16N0_Disable() (T16N0->CON0.EN = 0) -#define T16N1_Disable() (T16N1->CON0.EN = 0) -#define T16N2_Disable() (T16N2->CON0.EN = 0) -#define T16N3_Disable() (T16N3->CON0.EN = 0) -#define T32N0_Disable() (T32N0->CON0.EN = 0) - -/* 첽дʹܿ */ -#define T16N0_ASYNCWR_Enable() (T16N0->CON0.ASYWEN = 1) -#define T16N1_ASYNCWR_Enable() (T16N1->CON0.ASYWEN = 1) -#define T16N2_ASYNCWR_Enable() (T16N2->CON0.ASYWEN = 1) -#define T16N3_ASYNCWR_Enable() (T16N3->CON0.ASYWEN = 1) -#define T32N0_ASYNCWR_Enable() (T32N0->CON0.ASYNCWREN = 1) -#define T16N0_ASYNCWR_Disable() (T16N0->CON0.ASYWEN= 0) -#define T16N1_ASYNCWR_Disable() (T16N1->CON0.ASYWEN = 0) -#define T16N2_ASYNCWR_Disable() (T16N2->CON0.ASYWEN = 0) -#define T16N3_ASYNCWR_Disable() (T16N3->CON0.ASYWEN = 0) -#define T32N0_ASYNCWR_Disable() (T32N0->CON0.ASYNCWREN = 0) - -/* PWMʹܿ */ -#define T16N0_PwmOut0_Enable() (T16N0->CON2.MOE0 = 1) -#define T16N1_PwmOut0_Enable() (T16N1->CON2.MOE0 = 1) -#define T16N2_PwmOut0_Enable() (T16N2->CON2.MOE0 = 1) -#define T16N3_PwmOut0_Enable() (T16N3->CON2.MOE0 = 1) -#define T32N0_PwmOut0_Enable() (T32N0->CON2.MOE0 = 1) -#define T16N0_PwmOut1_Enable() (T16N0->CON2.MOE1 = 1) -#define T16N1_PwmOut1_Enable() (T16N1->CON2.MOE1 = 1) -#define T16N2_PwmOut1_Enable() (T16N2->CON2.MOE1 = 1) -#define T16N3_PwmOut1_Enable() (T16N3->CON2.MOE1 = 1) -#define T32N0_PwmOut1_Enable() (T32N0->CON2.MOE1 = 1) -#define T16N0_PwmOut0_Disable() (T16N0->CON2.MOE0 = 0) -#define T16N1_PwmOut0_Disable() (T16N1->CON2.MOE0 = 0) -#define T16N2_PwmOut0_Disable() (T16N2->CON2.MOE0 = 0) -#define T16N3_PwmOut0_Disable() (T16N3->CON2.MOE0 = 0) -#define T32N0_PwmOut0_Disable() (T32N0->CON2.MOE0 = 0) -#define T16N0_PwmOut1_Disable() (T16N0->CON2.MOE1 = 0) -#define T16N1_PwmOut1_Disable() (T16N1->CON2.MOE1 = 0) -#define T16N2_PwmOut1_Disable() (T16N2->CON2.MOE1 = 0) -#define T16N3_PwmOut1_Disable() (T16N3->CON2.MOE1 = 0) -#define T32N0_PwmOut1_Disable() (T32N0->CON2.MOE1 = 0) - -/************T16ģ麯***********/ -void T16Nx_BaseInit(T16N_TypeDef* T16Nx,TIM_BaseInitStruType* TIM_BaseInitStruct); -void T16Nx_CapInit(T16N_TypeDef* T16Nx,TIM_CapInitStruType* TIM_CapInitStruct); -void T16Nx_MAT0ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT1ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT2ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT3ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type); -void T16Nx_MAT0Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT1Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT2Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_MAT3Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type); -void T16Nx_ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState); -void T16Nx_PWMOutConfig(T16N_TypeDef* T16Nx,T16Nx_PWMInitStruType* T16Nx_PWMInitStruct); -void T16Nx_PWMBK_Config(T16N_TypeDef* T16Nx,T16Nx_PWMBK_Type* type); -void T16Nx_TRG_Config(T16N_TypeDef* T16Nx,T16Nx_PWMTRG_type Type,TYPE_FUNCEN NewState); -FlagStatus T16Nx_GetPWMBKF(T16N_TypeDef* T16Nx); -void T16Nx_ResetPWMBKF(T16N_TypeDef* T16Nx); -void T16Nx_SetCNT(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetPRECNT(T16N_TypeDef* T16Nx,uint8_t Value); -void T16Nx_SetPREMAT(T16N_TypeDef* T16Nx,uint8_t Value); -void T16Nx_SetMAT0(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT1(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT2(T16N_TypeDef* T16Nx,uint16_t Value); -void T16Nx_SetMAT3(T16N_TypeDef* T16Nx,uint16_t Value); -uint16_t T16Nx_GetMAT0(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT1(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT2(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetMAT3(T16N_TypeDef* T16Nx); -uint16_t T16Nx_GetCNT(T16N_TypeDef* T16Nx); -uint8_t T16Nx_GetPRECNT(T16N_TypeDef* T16Nx); -FlagStatus T16Nx_GetFlagStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag); -ITStatus T16Nx_GetITStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IT TIM_Flag); -void T16Nx_ClearIFPendingBit(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag); -/************************************T32ģ麯********************************************************/ -void T32Nx_BaseInit(T32N_TypeDef* T32Nx,TIM_BaseInitStruType* TIM_BaseInitStruct); -void T32Nx_CapInit(T32N_TypeDef* T32Nx,TIM_CapInitStruType* TIM_CapInitStruct); -void T32Nx_MAT0ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT1ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT2ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT3ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type); -void T32Nx_MAT0Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT1Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT2Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_MAT3Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type); -void T32Nx_ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState); -void T32Nx_SetCNT(T32N_TypeDef* T16Nx,uint32_t Value); -void T32Nx_SetPRECNT(T32N_TypeDef* T32Nx,uint8_t Value); -void T32Nx_SetPREMAT(T32N_TypeDef* T32Nx,uint8_t Value); -void T32Nx_SetMAT0(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT1(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT2(T32N_TypeDef* T32Nx,uint32_t Value); -void T32Nx_SetMAT3(T32N_TypeDef* T32Nx,uint32_t Value); -uint32_t T32Nx_GetMAT0(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT1(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT2(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetMAT3(T32N_TypeDef* T32Nx); -uint32_t T32Nx_GetCNT(T32N_TypeDef* T32Nx); -uint8_t T32Nx_GetPRECNT(T32N_TypeDef* T32Nx); -FlagStatus T32Nx_GetFlagStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag); -ITStatus T32Nx_GetITStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IT TIM_Flag); -void T32Nx_ClearIFPendingBit(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h deleted file mode 100644 index 7b0d0fe1df..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_uart.h +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ lib_uart.h - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * UARTģ⺯ͷļ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBUART_H__ -#define __LIBUART_H__ - -#include "ES8P508x.h" -#include "type.h" -#include "system_ES8P508x.h" - -/* ֹ֡ͣλѡ */ -typedef enum -{ - UART_StopBits_1 = 0x0 , //ֹ֡ͣλ1λ - UART_StopBits_2 = 0x1 , //ֹ֡ͣλ2λ -}UART_TYPE_TXFS; - -/* ݸʽ */ -typedef enum -{ - UART_DataMode_7 = 0x0 , //ݸʽ:7λ - UART_DataMode_8 = 0x1 , //ݸʽ:8λ - UART_DataMode_9 = 0x2 , //ݸʽ:9λ - UART_DataMode_7Odd = 0x4 , //ݸʽ:7λ+У - UART_DataMode_7Even = 0x5 , //ݸʽ:7λ+żУ - UART_DataMode_8Odd = 0x6 , //ݸʽ:8λ+У - UART_DataMode_8Even = 0x7 , //ݸʽ:8λ+żУ -}UART_TYPE_DATAMOD; - -/* ˿ڼ */ -typedef enum -{ - UART_Polar_Normal = 0x0 , //Ͷ˿ڼ: - UART_Polar_Opposite = 0x1 , //Ͷ˿ڼ: -}UART_TYPE_RTXP; - -/* ʷʱѡ */ -typedef enum -{ - UART_Clock_1 = 0x1 , //ʷʱ:PCLK - UART_Clock_2 = 0x2 , //ʷʱ:PCLK/2 - UART_Clock_4 = 0x3 , //ʷʱ:PCLK/4 - UART_Clock_8 = 0x4 , //ʷʱ:PCLK/8 - -}UART_TYPE_BCS; - -/* UARTʼýṹ嶨 */ -typedef struct -{ - UART_TYPE_TXFS UART_StopBits; //ֹ֡ͣλѡ - UART_TYPE_DATAMOD UART_TxMode; //֡ʽ - UART_TYPE_RTXP UART_TxPolar; //Ͷ˿ڼ - UART_TYPE_DATAMOD UART_RxMode; //֡ʽ - UART_TYPE_RTXP UART_RxPolar; //ն˿ڼ - uint32_t UART_BaudRate; //䲨 - UART_TYPE_BCS UART_ClockSet; //ʷʱѡ -}UART_InitStruType; - -/* жѡ */ -typedef enum -{ - UART_IT_TB = 0x0001 , - UART_IT_RB = 0x0002 , - UART_IT_RO = 0x0004 , - UART_IT_FE = 0x0008 , - UART_IT_PE = 0x0010 , - UART_IT_TBWE = 0x0020 , - UART_IT_TXIDLE = 0x1000 , - UART_IT_RXIDLE = 0x2000 , -}UART_TYPE_IT; - -/* ־λ */ -typedef enum -{ - UART_FLAG_TB = 0x0001 , - UART_FLAG_RB = 0x0002 , - UART_FLAG_RO = 0x0004 , - UART_FLAG_FE = 0x0008 , - UART_FLAG_PE = 0x0010 , - UART_FLAG_TBWE = 0x0020 , - UART_FLAG_TXIDLE = 0x1000 , - UART_FLAG_RXIDLE = 0x2000 , -}UART_TYPE_FLAG; - -/* жϱ־λ */ -typedef enum -{ - UART_Clr_RO = 0x0004 , - UART_Clr_FE = 0x0008 , - UART_Clr_PE = 0x0010 , - UART_Clr_TBWE = 0x0020 , -}UART_CLR_IF; - -/* ͡жģʽ */ -typedef enum -{ - UART_TRBIM_Byte = 0x0 , //ж:ֽ - UART_TRBIM_HalfWord = 0x1 , //ж: - UART_TRBIM_Word = 0x2 , //ж: -}UART_TYPE_TRBIM; - -/*************UARTģ궨************/ -/* ʹܿ */ -#define UART0_TxEnable() (UART0->CON.TXEN = 1) -#define UART1_TxEnable() (UART1->CON.TXEN = 1) -#define UART2_TxEnable() (UART2->CON.TXEN = 1) -#define UART3_TxEnable() (UART3->CON.TXEN = 1) -#define UART4_TxEnable() (UART4->CON.TXEN = 1) -#define UART5_TxEnable() (UART5->CON.TXEN = 1) -#define UART0_TxDisable() (UART0->CON.TXEN = 0) -#define UART1_TxDisable() (UART1->CON.TXEN = 0) -#define UART2_TxDisable() (UART2->CON.TXEN = 0) -#define UART3_TxDisable() (UART3->CON.TXEN = 0) -#define UART4_TxDisable() (UART4->CON.TXEN = 0) -#define UART5_TxDisable() (UART5->CON.TXEN = 0) - -/* ʹܿ */ -#define UART0_RxEnable() (UART0->CON.RXEN = 1) -#define UART1_RxEnable() (UART1->CON.RXEN = 1) -#define UART2_RxEnable() (UART2->CON.RXEN = 1) -#define UART3_RxEnable() (UART3->CON.RXEN = 1) -#define UART4_RxEnable() (UART4->CON.RXEN = 1) -#define UART5_RxEnable() (UART5->CON.RXEN = 1) -#define UART0_RxDisable() (UART0->CON.RXEN = 0) -#define UART1_RxDisable() (UART1->CON.RXEN = 0) -#define UART2_RxDisable() (UART2->CON.RXEN = 0) -#define UART3_RxDisable() (UART3->CON.RXEN = 0) -#define UART4_RxDisable() (UART4->CON.RXEN = 0) -#define UART5_RxDisable() (UART5->CON.RXEN = 0) - -/* λ */ -#define UART0_TxRst() (UART0->CON.TRST = 1) -#define UART1_TxRst() (UART1->CON.TRST = 1) -#define UART2_TxRst() (UART2->CON.TRST = 1) -#define UART3_TxRst() (UART3->CON.TRST = 1) -#define UART4_TxRst() (UART4->CON.TRST = 1) -#define UART5_TxRst() (UART5->CON.TRST = 1) - -/* λ */ -#define UART0_RxRst() (UART0->CON.RRST = 1) -#define UART1_RxRst() (UART1->CON.RRST = 1) -#define UART2_RxRst() (UART2->CON.RRST = 1) -#define UART3_RxRst() (UART3->CON.RRST = 1) -#define UART4_RxRst() (UART4->CON.RRST = 1) -#define UART5_RxRst() (UART5->CON.RRST = 1) - -/************UARTģ麯***********/ -void UART_Init(UART_TypeDef* UARTx,UART_InitStruType* UART_InitStruct); -void UART_ITConfig(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT,TYPE_FUNCEN NewState); -void UART_TBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type); -void UART_RBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type); -void UART_SendByte(UART_TypeDef* UARTx,uint8_t Temp08); -void UART_SendHalfWord(UART_TypeDef* UARTx,uint16_t Temp16); -void UART_SendWord(UART_TypeDef* UARTx,uint32_t Temp32); -uint8_t UART_RecByte(UART_TypeDef* UARTx); -uint16_t UART_RecHalfWord(UART_TypeDef* UARTx); -uint32_t UART_RecWord(UART_TypeDef* UARTx); -FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx,UART_TYPE_FLAG UART_Flag); -ITStatus UART_GetITStatus(UART_TypeDef* UARTx,UART_TYPE_IT UART_Flag); -void UART_ClearITPendingBit(UART_TypeDef* UARTx,UART_CLR_IF UART_Flag); - -#endif - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h b/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h deleted file mode 100644 index 45ad9d4287..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/lib_wdt.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_wdt.c - * ߣ Liut - * V1.00 - * ڣ 2017/02/04 - * Źģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#ifndef __LIBWDT_H__ -#define __LIBWDT_H__ - -#include "system_ES8P508x.h" -#include "ES8P508x.h" -#include "type.h" - -/* WDTʱѡ */ -typedef enum -{ - WDT_CLOCK_PCLK = 0x0, //PCLK - WDT_CLOCK_WDT = 0x1, //WDTʱԴ32kHz -} WDT_TYPE_CLKS; - -/* ʼṹ */ -typedef struct -{ - uint32_t WDT_Tms; //ʱʱ䣬λms - TYPE_FUNCEN WDT_IE; //жʹ - TYPE_FUNCEN WDT_Rst; //λʹ - WDT_TYPE_CLKS WDT_Clock;//ʱѡ -} IWDT_InitStruType; - -typedef enum -{ - WDT_WIN_25 = 0x0, //25%ڽֹιιλ - WDT_WIN_50 = 0x1, //50%ڽֹιιλ - WDT_WIN_75 = 0x2, //75%ڽֹιιλ - WDT_WIN_100 = 0x3, //ֹιιʹŹ -} WDT_TYPE_WIN; - -/* ʼṹ */ -typedef struct -{ - uint32_t WDT_Tms; //ʱʱ䣬λms - TYPE_FUNCEN WDT_IE; //жʹ - TYPE_FUNCEN WDT_Rst; //λʹ - WDT_TYPE_CLKS WDT_Clock;//ʱѡ - WDT_TYPE_WIN WDT_Win; //ֹι -} WWDT_InitStruType; - -#define IWDT_RegUnLock() (IWDT->LOCK.Word = 0x1ACCE551) -#define IWDT_RegLock() (IWDT->LOCK.Word = 0x0) - -#define IWDT_Enable() {IWDT_RegUnLock();IWDT->CON.EN = 1;IWDT_RegLock();} -#define IWDT_Disable() {IWDT_RegUnLock();IWDT->CON.EN = 0;IWDT_RegLock();} - -#define IWDT_Clear() {IWDT_RegUnLock();IWDT->INTCLR.INTCLR = 0;IWDT_RegLock();} - -#define IWDT_ITEnable() {IWDT_RegUnLock();IWDT->CON.IE = 1;IWDT_RegLock();} -#define IWDT_ITDisable() {IWDT_RegUnLock();IWDT->CON.IE = 0;IWDT_RegLock();} - -#define IWDT_RstEnable() {IWDT_RegUnLock();IWDT->CON.RSTEN = 1;IWDT_RegLock();} -#define IWDT_RstDisable() {IWDT_RegUnLock();IWDT->CON.RSTEN = 0;IWDT_RegLock();} - -#define IWDT_CLOCK_PCLK() {IWDT_RegUnLock();IWDT->CON.CLKS = 0;IWDT_RegLock();} -#define IWDT_CLOCK_WDT() {IWDT_RegUnLock();IWDT->CON.CLKS = 1;IWDT_RegLock();} - -#define WWDT_RegUnLock() (WWDT->LOCK.Word = 0x1ACCE551) -#define WWDT_RegLock() (WWDT->LOCK.Word = 0x0) - -#define WWDT_Enable() {WWDT_RegUnLock();WWDT->CON.EN = 1;WWDT_RegLock();} -#define WWDT_Disable() {WWDT_RegUnLock();WWDT->CON.EN = 0;WWDT_RegLock();} - -#define WWDT_Clear() {WWDT_RegUnLock();WWDT->INTCLR.INTCLR = 0;WWDT_RegLock();} - -#define WWDT_ITEnable() {WWDT_RegUnLock();WWDT->CON.IE = 1;WWDT_RegLock();} -#define WWDT_ITDisable() {WWDT_RegUnLock();WWDT->CON.IE = 0;WWDT_RegLock();} - -#define WWDT_RstEnable() {WWDT_RegUnLock();WWDT->CON.RSTEN = 1;WWDT_RegLock();} -#define WWDT_RstDisable() {WWDT_RegUnLock();WWDT->CON.RSTEN = 0;WWDT_RegLock();} - -#define WWDT_CLOCK_PCLK() {WWDT_RegUnLock();WWDT->CON.CLKS = 0;WWDT_RegLock();} -#define WWDT_CLOCK_WDT() {WWDT_RegUnLock();WWDT->CON.CLKS = 1;WWDT_RegLock();} - -void IWDT_Init(IWDT_InitStruType *IWDT_InitStruct); -void IWDT_SetReloadValue(uint32_t Value); -uint32_t IWDT_GetValue(void); -FlagStatus IWDT_GetFlagStatus(void); -FlagStatus IWDT_GetITStatus(void); -void WWDT_Init(WWDT_InitStruType *WDT_InitStruct); -void WWDT_SetReloadValue(uint32_t Value); -uint32_t WWDT_GetValue(void); -FlagStatus WWDT_GetFlagStatus(void); -FlagStatus WWDT_GetITStatus(void); - -#endif - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Include/type.h b/bsp/essemi/es8p508x/libraries/Library/Include/type.h deleted file mode 100644 index a23d72e8bd..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Include/type.h +++ /dev/null @@ -1,19 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: type.h - * : Liut - * : V1.01 - * : 2017/11/01 - * : type define - * ע: HRSDK-GDB-8P508x - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#ifndef __TYPE_H__ -#define __TYPE_H__ - -typedef enum {DISABLE = 0, ENABLE = !DISABLE} TYPE_FUNCEN,FuncState,TYPE_PINTIE,TYPE_PINTMASK,TYPE_BUZZEN; -typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus, PinStatus; -typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrorStatus; - - -#endif diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c b/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c deleted file mode 100644 index bd0d9b0f14..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/irqhandler.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "irqhandler.h" - -void NMI_IRQHandler(void) -{ - -} - -void HardFault_IRQHandler(void) -{ - while(1) - { - } -} - -void SVC_IRQHandler(void) -{ - -} - -void PendSV_IRQHandler(void) -{ - -} -void SysTick_Handler(void) -{ - systick_irq_cbk(); -} diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c deleted file mode 100644 index 23aea8a229..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_adc.c +++ /dev/null @@ -1,301 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ADCģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_adc.h" - -/*************************************************************** - ADC_Init - ʼADCģ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void ADC_Init(ADC_InitStruType * ADC_InitStruct) -{ - ADC->VREFCON.VREF_EN = ENABLE; //ڲVREFPʹ - ADC->VREFCON.IREF_EN = ENABLE; //IREFʹλ - ADC->CON1.VCMBUF_EN = ENABLE; //ADCģѹVCM BUFʹ - ADC ->CON1.VCMBUF_HS = ENABLE; //ADCģѹVCM BUFģʽʹ - ADC->CON1.HSEN = ENABLE; //ADCתٶȣ - ADC->CHS.VDD5_FLAG_EN = DISABLE; //VDD - - ADC->CON1.CLKS = ADC_InitStruct->ADC_ClkS; //ADCCON1:bit3 ADCʱԴѡ - ADC->CON1.CLKDIV = ADC_InitStruct->ADC_ClkDiv; //ADCCON1:bit2-0 ADCʱԴԤƵ - ADC->CON1.VREFP = ADC_InitStruct->ADC_VrefP; //ADCCON1:bit9-8 ADCοѹѡ - ADC->CON1.SMPS = ADC_InitStruct->ADC_SampS; //ADCCON1:bit12 ADCģʽѡ - ADC->CHS.CHS = ADC_InitStruct->ADC_ChS; //ADCCHS:bit0-3 ADCģͨѡ - ADC->CON1.ST = ADC_InitStruct->ST; //ADCCON1:bit20-16 ADCʱѡ ST*2+1Tadclk - //ADC->VREFCON.VREF_SEL=ADC_InitStruct->VREF_SEL;//ڲοѹѡ - - ADC->CON1.VREFN = ADC_InitStruct->ADC_VREFN; //οѹʹλ - ADC->CON1.VRBUF_EN = ADC_InitStruct->ADC_VRBUF_EN; //VREF BUFʹλ -} - - -/*************************************************************** - ADC_Set_CH - ѡADCģͨ - ֵͨ - ֵ - ֵ - ***************************************************************/ -void ADC_Set_CH(ADC_TYPE_CHS AdcCH) -{ - ADC->CHS.CHS = AdcCH; -} - -/*************************************************************** - ADC_GetConvValue - ȡADCת - ֵ - ֵ - ֵתֵ - ***************************************************************/ -uint16_t ADC_GetConvValue(void) -{ - return ((uint16_t)ADC->DR.DR); -} - -/*************************************************************** - ADC_GetConvStatus - ȡADCת״̬ - ֵ - ֵ - ֵRESET()/SET(ת) - ***************************************************************/ -FlagStatus ADC_GetConvStatus(void) -{ - FlagStatus bitstatus = RESET; - - /* ת״̬Ĵ */ - if ((ADC->CON0.TRIG != (uint32_t)RESET)) - bitstatus = SET; //ת - else - bitstatus = RESET; //ת - - return bitstatus; -} - -/*************************************************************** - ADC_ACPConfig - ADC ԶȽϹܳʼ - ֵADC_ACP_InitStruct ԶȽϹܳʼṹ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_ACPConfig(ADC_ACP_TypeDef *ADC_ACP_InitStruct) -{ - if(ADC_ACP_InitStruct->ACPC_OVER_TIME > ADC_ACPC_OVFL_TIME_MAX - ||ADC_ACP_InitStruct->ACPC_TIMES > ADC_ACPC_TIMES_MAX - ||ADC_ACP_InitStruct->ACPC_MIN_TARGET > ADC_ACP_MIN_MAX - ||ADC_ACP_InitStruct->ACPC_MAX_TARGET > ADC_ACP_MAX_MAX) - { - return ERROR; - } - - if(ADC_ACP_InitStruct->ACP_EN == ENABLE) - { - if(ADC->CON1.CLKS == ADC_ClkS_PCLK) - { - ADC->ACPC.CLKS = ADC_ACPC_CLKS_PCLK; - } - else - { - ADC->ACPC.CLKS = ADC_ACPC_CLKS_LRC; - } - - ADC->ACPC.OVFL_TIME = ADC_ACP_InitStruct ->ACPC_OVER_TIME; - ADC->ACPC.TIMES = ADC_ACP_InitStruct->ACPC_TIMES; - ADC->IE.ACPOVIE = ENABLE; - - /* û߷ֵó0(Сֵ)ǿΪرոù */ - if(ADC_ACP_InitStruct ->ACPC_MAX_TARGET ==0x0) - { - ADC->IE.ACPMAXIE = DISABLE; - } - else - { - ADC->ACPCMP.CMP_MAX =ADC_ACP_InitStruct ->ACPC_MAX_TARGET; - ADC->IE.ACPMAXIE = ENABLE; - } - - /* ûͷֵó0xfff(ֵ)ǿΪرոù */ - if(ADC_ACP_InitStruct ->ACPC_MIN_TARGET == 0xfff) - { - ADC->IE.ACPMINIE = DISABLE; - } - else - { - ADC->ACPCMP.CMP_MIN =ADC_ACP_InitStruct ->ACPC_MIN_TARGET; - ADC->IE.ACPMINIE = ENABLE; - } - - ADC->CON0.ACP_EN = ENABLE; - - } - else - { - ADC->CON0.ACP_EN = DISABLE; - } - - return SUCCESS; -} - -/*************************************************************** - ADC_SampStart - ADC - - ֵ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_SoftStart(void) -{ - if(ADC->CON1.SMPS == ADC_SMPS_HARD) - return ERROR; - - ADC ->CON1.SMPON = SET; - return SUCCESS; -} - -/*************************************************************** - ADC_SampStop - ADC -ֹͣ - ֵ - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_SoftStop(void) -{ - if(ADC->CON1.SMPS == ADC_SMPS_HARD) - return ERROR; - - ADC->CON1.SMPON = RESET; - return SUCCESS; -} - -/*************************************************************** - ADC_GetACPMeanValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMeanValue(void) -{ - return ((uint16_t)ADC->ACPMEAN.MEAN_DATA); -} - -/*************************************************************** - ADC_GetACPMINValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMinValue(void) -{ - return ((uint16_t)ADC->ACPCMP.CMP_MIN); -} - -/*************************************************************** - ADC_GetACPMAXValue - ADC õԶȽƽֵ - ֵ - ֵ - ֵ - ***************************************************************/ -uint16_t ADC_GetACPMaxValue(void) -{ - return ((uint16_t)ADC->ACPCMP.CMP_MAX); -} - -/*************************************************************** - ADC_GetFlagStatus - ȡADC־λ״̬ - ֵIFNameADCжϱ־ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus ADC_GetFlagStatus(ADC_TYPE_IF IFName) -{ - FlagStatus bitstatus = RESET; - - /* жϱ־λ */ - if (((ADC->IF.Word & IFName) != (uint32_t)RESET)) - bitstatus = SET; //ת - else - bitstatus = RESET; //ж - - return bitstatus; -} - -/*************************************************************** - ADC_GetITStatus - ȡADCж״̬δʹӦжʱ᷵SET - ֵ - ֵ - ֵSETжϣ/RESETжϣ - ***************************************************************/ -ITStatus ADC_GetITStatus(ADC_TYPE_IE IEName) -{ - ITStatus bitstatus = RESET; - - /* жϱ־λ */ - if (((ADC->IE.Word & IEName) != (uint32_t)RESET)) - bitstatus = SET; //תɣж - else - bitstatus = RESET; //ж - - return bitstatus; -} - -/*************************************************************** - ADC_ClearIFStatus - ADC ضж - ֵIFName жѡ - ADC_IF ADCж - ADC_IF_ACPMIN Զתͷֵж - ADC_IF_ACPMAX Զת߷ֵж - ADC_IF_ACPOVER Զתж - ֵ - ֵSUCCESS ɹ - ERROR ʧ - ***************************************************************/ -ErrorStatus ADC_ClearIFStatus(ADC_TYPE_IF IFName) -{ - ADC->IF.Word = (uint32_t)IFName; - - return SUCCESS; -} -/*************************************************************** - ADC_Reset - ADCλ - ֵ - ֵ - ֵ - ***************************************************************/ -void ADC_Reset(void) -{ - ADC->CON0.Word = 0x00000030; - ADC->CON1.Word = 0x00041000; - ADC->CHS.Word = 0x00000100; - ADC->IE.Word = 0x00000000; - ADC->IF.Word = 0x00000000; - ADC->ACPC.Word = 0x00000000; - ADC->ACPCMP.Word = 0x0FFF0000; - ADC->VREFCON.Word = 0x00000000; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c deleted file mode 100644 index e8f07e8bba..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_aes.c +++ /dev/null @@ -1,222 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : AE - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508оƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_aes.h" - -/*************************************************************** -AES_Init - AESܳʼ -ֵAES_InitStruct ʼṹ -ֵ -ֵ -***************************************************************/ -void AES_Init(AES_InitStruType * AES_InitStruct) -{ - - - AES_Reset(); - - AES->CON.ENCRYPT = AES_InitStruct->MODE; - return; -} - -/*************************************************************** -AES_WriteKey - AESдԿ -ֵAES_KEY дԿ -ֵ -ֵ -***************************************************************/ -void AES_WriteKey(uint32_t *AES_KEY) -{ - uint32_t *address = AES_KEY; - - AES->KEY3.AES_KEY3 = *address; - address ++; - AES->KEY2.AES_KEY2 = *address; - address ++; - AES->KEY1.AES_KEY1 = *address; - address ++; - AES->KEY0.AES_KEY0 = *address; -} - -/*************************************************************** -AES_ReadKey - AESԿ -ֵ -ֵAES_DATAԿλ -ֵ -***************************************************************/ -void AES_ReadKey(uint32_t * AES_KEY) -{ - uint32_t *address = AES_KEY; - - *address = AES->KEY3.AES_KEY3; - address ++; - *address = AES->KEY2.AES_KEY2; - address ++; - *address = AES->KEY1.AES_KEY1; - address ++; - *address = AES->KEY0.AES_KEY0; - return; -} - -/*************************************************************** -AES_WriteData - AESдݺ -ֵAES_DATA д -ֵ -ֵ -***************************************************************/ -void AES_WriteData(uint32_t *AES_DATA) -{ - uint32_t *address = AES_DATA; - - AES->DATA3.AES_DATA3 = *address; - address ++; - AES->DATA2.AES_DATA2 = *address; - address ++; - AES->DATA1.AES_DATA1 = *address; - address ++; - AES->DATA0.AES_DATA0 = *address; -} - -/*************************************************************** -AES_WriteData - AESݺ -ֵ -ֵAES_DATAݴλ -ֵ -***************************************************************/ -void AES_ReadData(uint32_t * AES_DATA) -{ - uint32_t *address = AES_DATA; - - *address = AES->DATA3.AES_DATA3; - address ++; - *address = AES->DATA2.AES_DATA2; - address ++; - *address = AES->DATA1.AES_DATA1; - address ++; - *address = AES->DATA0.AES_DATA0; - return; -} - -/*************************************************************** -AES_ITConfig - AESжʹ -ֵAES_IE - NewState Enable/Disable -ֵ -ֵ -***************************************************************/ -void AES_ITConfig(AES_TYPE_IT AES_IE, TYPE_FUNCEN NewState) -{ - uint32_t Word = AES->CON.Word&0xffffff8e; - - if(AES->CON.GO_DONE == 1) - { - return; - } - - if (NewState == ENABLE) - Word |= (uint32_t)AES_IE; - else - - Word &= ~(uint32_t)AES_IE; - - AES->CON.Word = Word; - return; - -} - -/*************************************************************** -AES_GetFlagStatus - AESضжϱ־ -ֵIFName - AES_IF_IF ӽж -ֵ -ֵжϱ־ -***************************************************************/ -FlagStatus AES_GetFlagStatus(AES_TYPE_IF IFName) -{ - - if(AES->CON.Word & IFName) { - return SET; - } - return RESET; -} - -/*************************************************************** -AES_ClearITPendingBit - AESضжϱ־ -ֵIFName - AES_IF_DONE ӽж -ֵ -ֵ -***************************************************************/ -void AES_ClearITPendingBit(void) -{ - /* ǵIFGO_DONEͬһwordУIFֵܻһЩ - * GO_DONE1ʱȡֵGO_DONE0ֵԭ1ٶиֵ - * òҪв - */ - - if(AES->CON.GO_DONE == SET) - { - return; - } - - AES->CON.IF = SET; - - return; -} - -/*************************************************************** -AES_GetDoneStatus - AESǷ/ -ֵ -ֵ -ֵAES_DONE_NO δ - AES_DONE_YES δܻ߼Ѿ -***************************************************************/ -AES_TYPE_DONE AES_GetDoneStatus(void) -{ - if(AES->CON.GO_DONE == 1) - { - return AES_DONE_NO; - } - - return AES_DONE_YES; -} - -/*************************************************************** -AES_Reset - AESλ -ֵ -ֵ -ֵ -***************************************************************/ -void AES_Reset(void) -{ - AES->DATA0.Word = 0x00000000; - AES->DATA1.Word = 0x00000000; - AES->DATA2.Word = 0x00000000; - AES->DATA3.Word = 0x00000000; - - AES->KEY0.Word = 0x00000000; - AES->KEY1.Word = 0x00000000; - AES->KEY2.Word = 0x00000000; - AES->KEY3.Word = 0x00000000; - - AES->CON.Word = 0x00000000; -} - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c deleted file mode 100644 index 547d50fddf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_crc.c +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_crc.h" - - /*************************************************************** - CRC_getTypeValue - òһCRC_CONò - ֵcon_value CRC_CON ֵṹ - ֵCRC_CONֵ - ***************************************************************/ -uint32_t CRC_getTypeValue(CRC_CONValueStruType con_value) -{ - uint32_t type =0; - type = (con_value.xorout | con_value.refout | con_value.refin |\ - con_value.mode|con_value.hs_type|con_value.init_data_type); - return type; -} - - /*************************************************************** - CRC_EmptayCheck - պ - ֵaddress: ׵ַ data_lenֽڳ - ֵ1ɹ0 ʧ - ***************************************************************/ -uint32_t CRC_EmptayCheck(void* address, uint32_t data_len) -{ - CRC_EM CRC_EmptayCheck = (CRC_EM)(*(uint32_t *)CRC_EmptayCheck_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_EmptayCheck)(address, data_len); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_FlashVerify - FLASHУ麯 - ֵaddress: У׵ַ data_lenУֽڳȣ type:У鷽ʽ - ֵCRCУ - ***************************************************************/ -uint32_t CRC_FlashVerify(void* address, uint32_t data_len, uint32_t type) -{ - CRC_FL CRC_FlashVerify = (CRC_FL)(*(uint32_t *)CRC_FlashVerify_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_FlashVerify)(address, data_len, type); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_UserCal - ûУ麯 - ֵaddress: ûУ׵ַ data_lenУֽڳȣ type:У鷽ʽ - ֵCRCУ - ***************************************************************/ -uint32_t CRC_UserCal(void* address, uint32_t data_len, uint32_t type) -{ - CRC_US CRC_UserCal = (CRC_US)(*(uint32_t *)CRC_UserCal_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_UserCal)(address, data_len, type); - __ASM("CPSIE i"); - return result; -} - - /*************************************************************** - CRC_CheckReset - CRCλѯ - ֵ - ֵλ־1иλ־0޸λ־ - ***************************************************************/ -uint32_t CRC_CheckReset(void) -{ - CRC_CH CRC_CheckReset = (CRC_CH)(*(uint32_t *)CRC_CheckReset_addr); - - uint32_t result; - __ASM("CPSID i"); - result = (*CRC_CheckReset)(); - __ASM("CPSIE i"); - return result; -} - -/************************END OF FILE**************************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c deleted file mode 100644 index 599478b164..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_flashiap.c +++ /dev/null @@ -1,355 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_flashiap.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * flashд⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_flashiap.h" - -/*************************************************************** - FlashIap_Close_WPROT - IAPرд - ֵPage:0-63,ÿpageӦ2Kֽ,64 ΪINFO - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Close_WPROT(uint8_t Page) -{ - if(Page > 64) - return ERROR; - - if(Page == 64) - { - IAP->WPROT2.Word = 0x00000000; - return SUCCESS; - } - - if(Page < 32) - { - IAP->WPROT0.Word &=~ ((uint32_t)0x1 << Page); - } - else - { - Page -= 32; - IAP->WPROT1.Word &=~ ((uint32_t)0x1 << Page); - } - - return SUCCESS; -} - -/*************************************************************** - FlashIap_Open_WPROT - IAPд - ֵPage:0-63,ÿpageӦ2Kֽ,,64 ΪINFO - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Open_WPROT(uint8_t Page) -{ - if(Page > 64) - return ERROR; - - if(Page == 64) - { - IAP->WPROT2.Word = 0x00000001; - return SUCCESS; - } - - if(Page < 32) - { - IAP->WPROT0.Word &=~ ((uint32_t)0x1 << Page); - IAP->WPROT0.Word |= ((uint32_t)0x1 << Page); - } - else - { - Page -= 32; - IAP->WPROT1.Word &=~ ((uint32_t)0x1 << Page); - IAP->WPROT1.Word |= ((uint32_t)0x1 << Page); - } - - return SUCCESS; -} - -/*************************************************************** - FlashIap_CloseAll_WPROT - IAPرд - ֵPage:0-63,ÿpageӦ2Kֽ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_CloseAll_WPROT(void) -{ - IAP->WPROT0.Word = 0x00000000; - IAP->WPROT1.Word = 0x00000000; - IAP->WPROT2.Word = 0x00000000; - - return SUCCESS; -} -/*************************************************************** - FlashIap_OpenAll_WPROT - IAPд - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_OpenAll_WPROT(void) -{ - IAP->WPROT0.Word = 0xFFFFFFFF; - IAP->WPROT1.Word = 0xFFFFFFFF; - IAP->WPROT2.Word = 0xFFFFFFFF; - - return SUCCESS; -} - -/*************************************************************** - FlashIap_Unlock - IAP - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_Unlock(void) -{ - uint16_t Temp16; - - FlashIAP_RegUnLock(); // IAP - - FlashIAP_Enable(); //ʹIAP - - FlashIAP_REQ(); // - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) //ȴFLASHӦź - { - if(IAP->CON.FLASH_ACK != 0) - break; - } - - if(Temp16 == 0xFFFF) - return ERROR; - else - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteEnd - IAPд - ֵ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteEnd(void) -{ - uint32_t Temp32; - - FlashIAP_RegUnLock(); //IAP - - IAP->CON.Word &= 0xFFFFFFEE; //IAPFLASH() - - for(Temp32 = 0; Temp32 < 0xFFFF; Temp32++) //ȴFLASHӦź() - { - if(IAP->CON.FLASH_ACK == 0) - break; - } - - if(Temp32 == 0xFFFF) - return ERROR; - else - return SUCCESS; -} - -/*************************************************************** - FlashIap_ErasePage - IAPҳ - ֵPage_Addrҳַ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_ErasePage(uint8_t Page_Addr) -{ - uint16_t Temp16; - uint32_t temp; - - temp = __get_PRIMASK(); //ȡPRIMASKĴǰ״̬ - __disable_irq(); //ж - - if(FlashIap_Unlock() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_CloseAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); - return ERROR; - } - - IAP->ADDR.IAPPA = Page_Addr; //ҳַ - - IAP->TRIG.TRIG = 0x00005EA1; // - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) - { //жIAP״̬ - if((IAP->STA.Word & (uint32_t)0x01) == (uint32_t)0x00) - break; - } - - if(Temp16 == 0xFFFF) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - for(Temp16 = 0; Temp16 < 0xFFFF; Temp16++) - { - if((IAP->STA.Word & (uint32_t)0x02) == (uint32_t)0x02) //жIAPҳ־ - break; - } - - if(Temp16 == 0xFFFF) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_WriteEnd() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_OpenAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); - return ERROR; - } - - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteCont - IAPд - ֵUnit_addrԪַ Page_addrҳַ Data32 - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteCont(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32) -{ - uint16_t temp16; - - IAP->ADDR.IAPPA = Page_addr; //ַ - IAP->ADDR.IAPCA = Unit_addr; - - IAP->DATA.DATA = Data32; // - IAP->TRIG.TRIG = 0x00005DA2; // - - for(temp16 = 0; temp16 < 0xFFFF; temp16++) - { - if((IAP->STA.Word & (uint32_t)0x01) == (uint32_t)0x00) //жIAP״̬ - break; - } - - if(temp16 == 0xFFFF) - return ERROR; - - for(temp16 = 0; temp16 < 0xFFFF; temp16++) - { - if((IAP->STA.Word & 0x04)==0x04) //жIAP̽־ - break; - } - - if(temp16 == 0xFFFF) - return ERROR; - - return SUCCESS; -} - -/*************************************************************** - FlashIap_WriteWord - IAPдһ - ֵUnit_addrԪַ Page_addrҳַ Data32 - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus FlashIap_WriteWord(uint8_t Unit_addr, uint8_t Page_addr, uint32_t Data32) -{ - uint32_t temp; - - temp = __get_PRIMASK(); //ȡPRIMASKĴǰ״̬ - __disable_irq(); //ж - - if(FlashIap_Unlock() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_CloseAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); //رд״̬ - return ERROR; - } - - if(FlashIap_WriteCont(Unit_addr, Page_addr, Data32) == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_WriteEnd() == ERROR) - { - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - return ERROR; - } - - if(FlashIap_OpenAll_WPROT() == ERROR) - { - __set_PRIMASK(temp); //д״̬ - return ERROR; - } - - __set_PRIMASK(temp); //ָPRIMASKĴ״̬ - - return SUCCESS; -} - -/*************************************************************** - Flash_Read - Flash - ֵRam_AddrݵĴŵַ Flash_AddrFlashַ0x00000000 ~ 0x0001FFFF Lenȡֳ - ֵ - ֵɹʧ - ***************************************************************/ -ErrorStatus Flash_Read(uint32_t * Ram_Addr, uint32_t Flash_Addr, uint8_t Len) -{ - uint8_t i; - uint32_t *ram_addr32; - const uint32_t *flash_addr32; - - ram_addr32 = (uint32_t *)Ram_Addr; - flash_addr32 = (const uint32_t *)Flash_Addr; - - if((Len == 0) & (Len>(0x20000 - Flash_Addr) / 4)) //ж϶ȡǷϷ - { - return ERROR; - } - - for(i=0; iGPIO_Signal == GPIO_Pin_Signal_Analog) { - GPIO_SetSingalTypeFromPin(GPIOx, PINx, GPIO_Pin_Signal_Analog); - GPIO_SetDirRegFromPin(GPIOx, PINx, GPIO_Dir_In); - GPIO_SetFuncxRegFromPin(GPIOx, PINx, GPIO_Func_0); - } - else { - GPIO_SetSingalTypeFromPin(GPIOx, PINx, GPIO_Pin_Signal_Digital); - GPIO_SetDirRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_Direction); - GPIO_SetFuncxRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_Func); - - if (GPIO_InitStruct->GPIO_Direction == GPIO_Dir_Out) { - GPIO_SetODERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_OD); - GPIO_SetDSRegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_DS); - } - GPIO_SetPUERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_PUEN); - GPIO_SetPDERegFromPin(GPIOx, PINx, GPIO_InitStruct->GPIO_PDEN); - } -} - -/*************************************************************** - GPIO_SetFuncxRegFromPin - GPIOŵĹܸ - ֵPinĿ - Funcܸñ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetFuncxRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_FUNC Func) -{ - uint32_t value; - - switch (Func) { - case GPIO_Func_0: - value = 0; - break; - case GPIO_Func_1: - value = 1; - break; - case GPIO_Func_2: - value = 2; - break; - case GPIO_Func_3: - value = 3; - break; - default: - value = 0; - break; - } - - /* Ź */ - if(GPIOx == GPIOB){ - switch (PINx) { - case GPIO_Pin_0: - GPIO->PBFUNC0.PB0 = value; - break; - case GPIO_Pin_1: - GPIO->PBFUNC0.PB1 = value; - break; - case GPIO_Pin_2: - GPIO->PBFUNC0.PB2 = value; - break; - case GPIO_Pin_3: - GPIO->PBFUNC0.PB3 = value; - break; - case GPIO_Pin_4: - GPIO->PBFUNC0.PB4 = value; - break; - case GPIO_Pin_5: - GPIO->PBFUNC0.PB5 = value; - break; - case GPIO_Pin_6: - GPIO->PBFUNC0.PB6 = value; - break; - case GPIO_Pin_7: - GPIO->PBFUNC0.PB7 = value; - break; - case GPIO_Pin_8: - GPIO->PBFUNC1.PB8 = value; - break; - case GPIO_Pin_9: - GPIO->PBFUNC1.PB9 = value; - break; - case GPIO_Pin_10: - GPIO->PBFUNC1.PB10 = value; - break; - case GPIO_Pin_11: - GPIO->PBFUNC1.PB11 = value; - break; - case GPIO_Pin_12: - GPIO->PBFUNC1.PB12 = value; - break; - case GPIO_Pin_13: - GPIO->PBFUNC1.PB13 = value; - break; - default: - break; - } - } - - else{ - switch (PINx) { - case GPIO_Pin_0: - GPIO->PAFUNC0.PA0 = value; - break; - case GPIO_Pin_1: - GPIO->PAFUNC0.PA1 = value; - break; - case GPIO_Pin_2: - GPIO->PAFUNC0.PA2 = value; - break; - case GPIO_Pin_3: - GPIO->PAFUNC0.PA3 = value; - break; - case GPIO_Pin_4: - GPIO->PAFUNC0.PA4 = value; - break; - case GPIO_Pin_5: - GPIO->PAFUNC0.PA5 = value; - break; - case GPIO_Pin_6: - GPIO->PAFUNC0.PA6 = value; - break; - case GPIO_Pin_7: - GPIO->PAFUNC0.PA7 = value; - break; - case GPIO_Pin_8: - GPIO->PAFUNC1.PA8 = value; - break; - case GPIO_Pin_9: - GPIO->PAFUNC1.PA9 = value; - break; - case GPIO_Pin_10: - GPIO->PAFUNC1.PA10 = value; - break; - case GPIO_Pin_11: - GPIO->PAFUNC1.PA11 = value; - break; - case GPIO_Pin_12: - GPIO->PAFUNC1.PA12 = value; - break; - case GPIO_Pin_13: - GPIO->PAFUNC1.PA13 = value; - break; - case GPIO_Pin_14: - GPIO->PAFUNC1.PA14 = value; - break; - case GPIO_Pin_15: - GPIO->PAFUNC1.PA15 = value; - break; - case GPIO_Pin_16: - GPIO->PAFUNC2.PA16 = value; - break; - case GPIO_Pin_17: - GPIO->PAFUNC2.PA17 = value; - break; - case GPIO_Pin_18: - GPIO->PAFUNC2.PA18 = value; - break; - case GPIO_Pin_19: - GPIO->PAFUNC2.PA19 = value; - break; - case GPIO_Pin_20: - GPIO->PAFUNC2.PA20 = value; - break; - case GPIO_Pin_21: - GPIO->PAFUNC2.PA21 = value; - break; - case GPIO_Pin_22: - GPIO->PAFUNC2.PA22 = value; - break; - case GPIO_Pin_23: - GPIO->PAFUNC2.PA23 = value; - break; - case GPIO_Pin_24: - GPIO->PAFUNC3.PA24 = value; - break; - case GPIO_Pin_25: - GPIO->PAFUNC3.PA25 = value; - break; - case GPIO_Pin_26: - GPIO->PAFUNC3.PA26 = value; - break; - case GPIO_Pin_27: - GPIO->PAFUNC3.PA27 = value; - break; - case GPIO_Pin_28: - GPIO->PAFUNC3.PA28 = value; - break; - case GPIO_Pin_29: - GPIO->PAFUNC3.PA29 = value; - break; - case GPIO_Pin_30: - GPIO->PAFUNC3.PA30 = value; - break; - case GPIO_Pin_31: - GPIO->PAFUNC3.PA31 = value; - break; - default: - break; - } - } - return; -} - -/*************************************************************** - GPIO_SetSingalTypeFromPin - ŵź - ֵPin: Ŀ - Signal: ŵź - ֵ - ֵ - ***************************************************************/ -void GPIO_SetSingalTypeFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_Pin_Signal GPIO_Signal) -{ - if(GPIOx == GPIOB) { - if (GPIO_Signal == GPIO_Pin_Signal_Digital) - GPIO->PBINEB.Word &= (~(1 << PINx)); - else - GPIO->PBINEB.Word |= (1 << PINx); - } - else{ - if (GPIO_Signal == GPIO_Pin_Signal_Digital) - GPIO->PAINEB.Word &= (~(1 << PINx)); - else - GPIO->PAINEB.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetDirRegFromPin - ŵ - ֵPin: Ŀ - Dirŷ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetDirRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DIR Dir) -{ - if (GPIOx == GPIOB) { - if (Dir == GPIO_Dir_In) - GPIO->PBDIRBSR.Word = (1 << PINx); - else - GPIO->PBDIRBCR.Word = (1 << PINx); - } - else { - if (Dir == GPIO_Dir_In) - GPIO->PADIRBSR.Word = (1 << PINx); - else - GPIO->PADIRBCR.Word = (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetODERegFromPin - ŵ©ʽ - ֵPin: Ŀ -ODE: ©ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetODERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_ODE_Output ODE) -{ - if (GPIOx == GPIOB) { - if (ODE == GPIO_ODE_Output_Disable) - GPIO->PBODE.Word &= (~(1 << PINx)); - else - GPIO->PBODE.Word |= (1 << PINx); - } - else { - if (ODE == GPIO_ODE_Output_Disable) - GPIO->PAODE.Word &= (~(1 << PINx)); - else - GPIO->PAODE.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetDSRegFromPin - ŵ - ֵPin: Ŀ -DS: ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetDSRegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_TYPE_DS DS) -{ - if (GPIOx == GPIOB) { - if (DS == GPIO_DS_Output_Normal) - GPIO->PBDS.Word &= (~(1 << PINx)); - else - GPIO->PBDS.Word |= (1 << PINx); - } - else { - if (DS == GPIO_DS_Output_Normal) - GPIO->PADS.Word &= (~(1 << PINx)); - else - GPIO->PADS.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_SetPUERegFromPin - ŵʽ - ֵPin: Ŀ -PUE: ʽ -ֵ -ֵ - ***************************************************************/ -void GPIO_SetPUERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PUE_Input PUE) -{ - if (GPIOx == GPIOB) { - if (PUE == GPIO_PUE_Input_Disable) - GPIO->PBPUE.Word &= (~(1 << PINx)); - else - GPIO->PBPUE.Word |= (1 << PINx); - } - else { - if (PUE == GPIO_PUE_Input_Disable) - GPIO->PAPUE.Word &= (~(1 << PINx)); - else - GPIO->PAPUE.Word |= (1 << PINx); - } -} - -/*************************************************************** - GPIO_SetPDERegFromPin - ŵʽ - ֵPin: Ŀ - PDEʽ - ֵ - ֵ - ***************************************************************/ -void GPIO_SetPDERegFromPin(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx, GPIO_PDE_Input PDE) -{ - if (GPIOx == GPIOB) { - if (PDE == GPIO_PDE_Input_Disable) - GPIO->PBPDE.Word &= (~(1 << PINx)); - else - GPIO->PBPDE.Word |= (1 << PINx); - } - else { - if (PDE == GPIO_PDE_Input_Disable) - GPIO->PAPDE.Word &= (~(1 << PINx)); - else - GPIO->PAPDE.Word |= (1 << PINx); - } - - return; -} - -/*************************************************************** - GPIO_Write - GPIO˿д - ֵGPIOxGPIOA/GPIOB ValueҪдݡע⣺ЩڵţõֵӦλõ - ֵ - ֵ - ***************************************************************/ -void GPIO_Write(GPIO_TYPE GPIOx, uint32_t Value) -{ - if(GPIOx == GPIOA) - GPIO->PADATA.Word = Value; - else if(GPIOx == GPIOB) - GPIO->PBDATA.Word = Value; -} - -/*************************************************************** - GPIO_Read - GPIO˿ڶ - ֵGPIOxGPIOA/GPIOB - ֵ - ֵݡע⣺ЩڵţֵӦλЧ - ***************************************************************/ -uint32_t GPIO_Read(GPIO_TYPE GPIOx) -{ - if(GPIOx == GPIOA) - return GPIO->PAPORT.Word; - else if(GPIOx == GPIOB) - return GPIO->PBPORT.Word; - - return 0; -} - -/*************************************************************** - GPIO_ReadBit - GPIO˿ڶijλ - ֵGPIOxGPIOA/GPIOB PINx:GPIO_Pin_0 GPIO_Pin_31 - ֵ - ֵݡע⣺ЩڵţֵЧ - ***************************************************************/ -PinStatus GPIO_ReadBit(GPIO_TYPE GPIOx,GPIO_TYPE_PIN PINx) -{ - PinStatus bitstatus = RESET; - - if(GPIOx == GPIOA) - { - if((GPIO->PAPORT.Word&((uint32_t)0x1<PBPORT.Word&((uint32_t)0x1<PADATABSR.Word = (uint32_t)0x1<PADATABCR.Word = (uint32_t)0x1<PADATABRR.Word = (uint32_t)0x1<PBDATABSR.Word = (uint32_t)0x1<PBDATABCR.Word = (uint32_t)0x1<PBDATABRR.Word = (uint32_t)0x1<PADIR.Word &=~((uint32_t)0x1 << PINx); - GPIO->PADIR.Word |= ((uint32_t)Dir_Type <PBDIR.Word &=~((uint32_t)0x1 << PINx); - GPIO->PBDIR.Word |= ((uint32_t)Dir_Type <BUZC.BUZ_LOAD = (SystemCoreClock/(freq*2)) - 1; - GPIO->BUZC.BUZEN = buzz_en; -} -/*************************************************************** - PINT_Config - PINT - ֵPINTxѡPINT0 PINT7 SELxѡ TRIGxѡ - ֵ - ֵ - ***************************************************************/ -void PINT_Config(PINT_TYPE PINTx, PINT_TYPE_SEL SELx, PINT_TYPE_TRIG TRIGx) -{ - GPIO->PINTSEL.Word &= ~((uint32_t)0x07<<(PINTx*4)); - GPIO->PINTSEL.Word |=((uint32_t)SELx << (PINTx*4)); //selѡ - - GPIO->PINTCFG.Word &= ~((uint32_t)0x07<<(PINTx*4)); - GPIO->PINTCFG.Word |=((uint32_t)TRIGx << (PINTx*4)); //ʽѡ -} - -/*************************************************************** - PINT_GetIFStatus - PINTȡжϱ־ - ֵPINTxPINT0-PINT7 - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus PINT_GetIFStatus(PINT_TYPE_IT PINT_Flag) -{ - FlagStatus bitstatus = RESET; - - if((GPIO->PINTIF.Word & (uint32_t)PINT_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - PINT_GetITStatus - PINTȡжϱ־ - ֵPINTxPINT0-PINT7 - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus PINT_GetITStatus(PINT_TYPE_IT PINT_Flag) -{ - FlagStatus bitstatus = RESET; - - if((GPIO->PINTIF.Word & (uint32_t)PINT_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - PINT_ClearITPendingBit - PINTжϱ־ - ֵPINTж - ֵ - ֵ - ***************************************************************/ -void PINT_ClearITPendingBit(PINT_TYPE_IT PINT_Flag) -{ - GPIO->PINTIF.Word = (uint32_t)PINT_Flag; -} - -/*************************END OF FILE**********************/ - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c deleted file mode 100644 index 9cd1bb4daf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iap.c +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ - * : Liut - * : V1.00 - * : 2017/07/14 - * - * ע ES8P508оƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_iap.h" - -/************************************************* - * @brief IAP ҳ.ص̻ROMеij - * @param address: ҳ׵ַ - * @retval None - ***********************************************/ -ErrorStatus IAP_PageErase(uint32_t address) -{ - IAP_PE IAPPageErase = (IAP_PE)(*(uint32_t *)IAP_PageErase_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPPageErase)(address); - __ASM("CPSIE i"); - return result; -} - -/************************************************* - * @brief IAP Ա.ص̻ROMеij - * @param address: ׵ַ - * @param data: - * @retval None - ************************************************/ -ErrorStatus IAP_WordProgram(uint32_t address, uint32_t data) -{ - IAP_WP IAPWordProgram = (IAP_WP)(*(uint32_t *)IAP_WordProgram_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPWordProgram)( address, data); - __ASM("CPSIE i"); - return result; -} - -/************************************************ - * @brief IAP Ա.ص̻ROMеij - * @param address: ׵ַ - * @param data[]: - * @param length: ݳȣֽڣ - * @param address: ҳǷȲ - * @arg 0: - * @arg 1: - * @retval None - **********************************************/ -ErrorStatus IAP_PageProgram(uint32_t address, uint32_t data[], uint32_t length, uint32_t erase) //@0x100001c5 -{ - IAP_PP IAPPageProgram = (IAP_PP)(*(uint32_t *)IAP_PageProgram_addr); - - ErrorStatus result; - __ASM("CPSID i"); - result = (*IAPPageProgram)(address,data,length,erase); - __ASM("CPSIE i"); - return result; -} -/************************************* - IARead - Flash - ֵڴַ--ȡݵĴŵַ - Flashַ - ȡݵijȣλΪ֣4ֽڣ - ֵɹ/ʧ - **************************************/ -ErrorStatus IAPRead(uint32_t *Ram_Addr, uint32_t Flash_Addr, uint8_t Len) -{ - uint8_t i; - uint32_t *ram_addr; - const uint32_t *flash_addr; - - ram_addr = Ram_Addr; - flash_addr = (const uint32_t *)Flash_Addr; - - if (Len == 0) - return ERROR; - - for (i = 0; i < Len; ++i) - { - *ram_addr = *flash_addr; - ++ram_addr; - ++flash_addr; - } - - return SUCCESS; -} - -/************************END OF FILE**************************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c deleted file mode 100644 index ab987843f1..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_iic.c +++ /dev/null @@ -1,311 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_iic.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * IICģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_iic.h" - -/*************************************************************** - I2C_Init - I2Cʼ - ֵI2C_InitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void I2C_Init(I2C_InitStruType* I2C_InitStruct) -{ - uint32_t temp; - - if(I2C_InitStruct->I2C_Mode == I2C_Mode_Master) - { - if(I2C_InitStruct->I2C_16XSamp != DISABLE) - temp = SystemCoreClock/24/I2C_InitStruct->I2C_Clk - 1; - else - temp = SystemCoreClock/16/I2C_InitStruct->I2C_Clk - 1; - - if(temp > 254) - temp = 255; - - I2C0->CON.TJP = temp; //ʱʱ - - I2C0->CON.TJE = 0x1; //ʹʱʱ - } - - I2C0->CON.SDASE = I2C_InitStruct->I2C_16XSamp; //16 - I2C0->CON.SCKSE = I2C_InitStruct->I2C_16XSamp; - I2C0->CON.SCKOD = I2C_InitStruct->I2C_SclOd; //˿ڿ© - I2C0->CON.SDAOD = I2C_InitStruct->I2C_SdaOd; - I2C0->MOD.MS = I2C_InitStruct->I2C_Mode; //ģʽ - I2C0->MOD.SPAE = I2C_InitStruct->I2C_AutoStop; //Զֹͣ - I2C0->MOD.SRAE = I2C_InitStruct->I2C_AutoCall; //ԶѰ -} - -/*************************************************************** - I2C_ITConfig - I2Cж - ֵI2C_ITҪõж NewStateʹܻر - ֵ - ֵ - ***************************************************************/ -void I2C_ITConfig(I2C_TYPE_IT I2C_IT,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - I2C0->IE.Word |= (uint32_t)I2C_IT; - else - I2C0->IE.Word &= ~((uint32_t)I2C_IT); -} - -/*************************************************************** - I2C_SendAddress - I2Cʹӻַ - ֵI2C_Address7λӻַ 0x00~0xfe Modeд - ֵ - ֵ - ***************************************************************/ -void I2C_SendAddress(uint8_t I2C_Address,I2C_TYPE_RWMODE Mode) -{ - I2C0->CON.SA = I2C_Address>>1; - I2C0->CON.RW = Mode; -} - -/*************************************************************** - I2C_SetAddress - I2Cõַڴӻģʽ - ֵI2C_Address7λӻַ 0x00~0xfe - ֵ - ֵ - ***************************************************************/ -void I2C_SetAddress(uint8_t I2C_Address) -{ - I2C0->CON.SA = I2C_Address>>1; -} - -/*************************************************************** - I2C_RecModeConfig - I2Cýģʽ - ֵRecTypeģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_RecModeConfig(I2C_TYPE_RECMODE RecType) -{ - I2C0->MOD.RDM = RecType; -} - -/*************************************************************** - I2C_TBIMConfig - I2Cͻжģʽѡ - ֵTypeжģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_TBIMConfig(I2C_TYPE_TRBIM Type) -{ - I2C0->IE.TBIM = Type; -} - -/*************************************************************** - I2C_RBIMConfig - I2Cջжģʽѡ - ֵTypeжģʽ - ֵ - ֵ - ***************************************************************/ -void I2C_RBIMConfig(I2C_TYPE_TRBIM Type) -{ - I2C0->IE.RBIM = Type; -} - -/*************************************************************** - I2C_AckDelay - I2CӦʱ - ֵTypeʱʱ NewStatusʹܡʧ - ֵ - ֵ - ***************************************************************/ -void I2C_AckDelay(I2C_TYPE_ADLY Type,TYPE_FUNCEN NewStatus) -{ - I2C0->MOD.ADLY = Type; - I2C0->MOD.ADE = NewStatus; -} - -/*************************************************************** - I2C_TISConfig - I2C֡ - ֵTime - ֵ - ֵ - ***************************************************************/ -void I2C_TISConfig(I2C_TYPE_TIS Time) -{ - I2C0->MOD.TIS = Time; -} - -/*************************************************************** - I2C_SendByte - I2Cֽڷ - ֵByteֽ - ֵ - ֵ - ***************************************************************/ -void I2C_SendByte(uint8_t Byte) -{ - I2C0->TBW.Byte[0] = Byte; -} - -/*************************************************************** - I2C_SendHalfWord - I2Cַ - ֵHalfWord - ֵ - ֵ - ***************************************************************/ -void I2C_SendHalfWord(uint16_t HalfWord) -{ - I2C0->TBW.HalfWord[0] = HalfWord; -} - -/*************************************************************** - I2C_SendWord - I2Cַ - ֵWord - ֵ - ֵ - ***************************************************************/ -void I2C_SendWord(uint32_t Word) -{ - I2C0->TBW.Word = Word; -} - -/*************************************************************** - I2C_RecByte - I2C-ֽ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint8_t I2C_RecByte(void) -{ - return I2C0->RBR.Byte[0] ; -} - -/*************************************************************** - I2C_RecHalfWord - I2C- - ֵ - ֵ - ֵյ - ***************************************************************/ -uint16_t I2C_RecHalfWord(void) -{ - return I2C0->RBR.HalfWord[0]; -} - -/*************************************************************** - I2C_RecWord - I2C- - ֵ - ֵ - ֵյ - ***************************************************************/ -uint32_t I2C_RecWord(void) -{ - return I2C0->RBR.Word ; -} - -/*************************************************************** - I2C_GetRWMode - I2Cд״̬ȡ - ֵ - ֵ - ֵ/д - ***************************************************************/ -I2C_TYPE_RWMODE I2C_GetRWMode(void) -{ - I2C_TYPE_RWMODE Status = I2C_Mode_Write; - - if(I2C0->CON.RW != 0) - Status = I2C_Mode_Read; - else - Status = I2C_Mode_Write; - - return Status; -} - -/*************************************************************** - I2C_GetTBStatus - I2CȡͻĴ״̬,TB0-TB3ȫ򷵻SET,򷵻RESET - ֵ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus I2C_GetTBStatus(void) -{ - FlagStatus bitstatus = RESET; - - if((I2C0->STA.Word&(uint32_t)0x0f00) != (uint32_t)0x0f00) - bitstatus = RESET; - else - bitstatus = SET; - - return bitstatus; -} - -/*************************************************************** - I2C_GetFlagStatus - I2Cȡ־λ״̬ - ֵI2C_FlagѡҪı־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus I2C_GetFlagStatus(I2C_TYPE_FLAG I2C_Flag) -{ - FlagStatus bitstatus = RESET; - - if ((I2C0->IF.Word & (uint32_t)I2C_Flag) != RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/************************************* - I2C_GetITStatus - ȡжʹ״̬ - ֵI2C_Flag жʹλ - ж - ֵSET/RESET - **************************************/ -FlagStatus I2C_GetITStatus( I2C_TYPE_IT I2C_Flag) -{ - FlagStatus status = RESET; - - if ((I2C0->IE.Word & (uint32_t)I2C_Flag) == RESET) - return status; - - if ((I2C0->IF.Word & (uint32_t)I2C_Flag) != RESET) - status = SET; - - return status; -} - -/*************************************************************** - I2C_ClearITPendingBit - I2Cжϱ־ - ֵI2C_IT־λ - ֵ - ֵ - ***************************************************************/ -void I2C_ClearITPendingBit(I2C_CLR_IF I2C_IT) -{ - I2C0->IF.Word = (uint32_t)I2C_IT; -} - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c deleted file mode 100644 index f2afdc3142..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_printf.c +++ /dev/null @@ -1,283 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_printf.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ڴӡ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_printf.h" -#include - -/*************************************************************** - fputc - ضc⺯printfUART - ֵ - ֵ - ֵ - ***************************************************************/ -/*ʹprintf()Ҫ΢⣺Use MicroLIB*/ -int fputc(int ch, FILE *f) -{ - FlagStatus Status = RESET; - uint32_t Count=0; - -#if defined __PRINTF_USE_UART3__ - UART_SendByte(UART3, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART3,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#elif defined __PRINTF_USE_UART2__ - UART_SendByte(UART2, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART2,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#elif defined __PRINTF_USE_UART1__ - UART_SendByte(UART1, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART1,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#else - UART_SendByte(UART0, (unsigned char) ch); - do - { - Status = UART_GetFlagStatus(UART0,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - return (EOF); - -#endif - return (ch); -} - -#ifdef __clang__ //ʹõidesignerʱ򲻵΢ -/*************************************************************** - תַ - ֵ -radix =10 ʾ10ƣΪ0 - * -value Ҫת - * -buf תַ - * -radix = 10 - ֵ - ***************************************************************/ -static char *itoa(int value, char *string, int radix) -{ - int i, d; - int flag = 0; - char *ptr = string; - - /* This implementation only works for decimal numbers. */ - if (radix != 10) - { - *ptr = 0; - return string; - } - - if (!value) - { - *ptr++ = 0x30; - *ptr = 0; - return string; - } - - /* if this is a negative value insert the minus sign. */ - if (value < 0) - { - *ptr++ = '-'; - - /* Make the value positive. */ - value *= -1; - } - - for (i = 10000; i > 0; i /= 10) - { - d = value / i; - - if (d || flag) - { - *ptr++ = (char)(d + 0x30); - value -= (d * i); - flag = 1; - } - } - - /* Null terminate the string. */ - *ptr = 0; - - return string; -} -/*************************************************************** - ʽCеprintfûõC - ֵ -UARTx ͨ - * -Data Ҫ͵ڵݵָ - * -... - ֵ - Ӧã UART_printf("\r\n this is a demo \r\n" ); - * UART1_printf("\r\n %d \r\n", i ); - * UART1_printf("\r\n %s \r\n", j ); - ***************************************************************/ -/* δCʱʹô˺Cеprintfprintfȫ - ֻ֧\r \n %d %s */ -ErrorStatus UART_printf(uint8_t *Data,...) -{ - UART_TypeDef *UARTx; - const char *s; - int d; - char buf[16]; - ErrorStatus RET = SUCCESS; - FlagStatus Status = RESET; - uint32_t Count=0; - va_list ap; - -/** - ** - **ʹú궨ѡʹһ - ** -***/ -#if defined __PRINTF_USE_UART3__ - - UARTx = UART3; - -#elif defined __PRINTF_USE_UART2__ - - UARTx = UART2; - -#elif defined __PRINTF_USE_UART1__ - - UARTx = UART1; - -#else - - UARTx = UART0; - -#endif - - va_start(ap, Data); - - while ( *Data != 0) // жǷ񵽴ַ - { - if ( *Data == 0x5c ) //'\' - { - switch ( *++Data ) - { - case 'r': //س - Count=0; - UART_SendByte(UARTx, 0x0d); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - - Data ++; - break; - - case 'n': //з - Count=0; - UART_SendByte(UARTx, 0x0a); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - - Data ++; - break; - - default: - Data ++; - break; - } - } - else if ( *Data == '%') - { - switch ( *++Data ) - { - case 's': //ַ - s = va_arg(ap, const char *); - for ( ; *s; s++) - { - Count=0; - UART_SendByte(UARTx,*s); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - Data++; - break; - - case 'd': //ʮ - d = va_arg(ap, int); - itoa(d, buf, 10); - for (s = buf; *s; s++) - { - Count=0; - UART_SendByte(UARTx,*s); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - Data++; - break; - default: - Data++; - break; - } - } /* end of else if */ - else - { - Count=0; - UART_SendByte(UARTx, *Data++); - do - { - Status = UART_GetFlagStatus(UARTx,UART_FLAG_TXIDLE); - Count++; - }while((Status == RESET)&&(Count != 0x1CE2)); - - if(Count == 0x1CE2) - RET = ERROR; - } - } - return RET; -} - -#endif -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c deleted file mode 100644 index dfede6ca29..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_rtc.c +++ /dev/null @@ -1,1906 +0,0 @@ -/********************************************************* - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd. - *ļ: lib_rtc.c - * : Liut - * : V1.00 - * : 2017/07/14 - * : RTCģ - * ע: HRSDK-GDB-ES8P508 V1.1 - ѧϰʾʹãûֱôķջеκηΡ - **********************************************************/ -#include "lib_rtc.h" -#include "lib_scu.h" - -/*************************************************************** - RTC_Init - ʵʱʱӳʼ - ֵCLKx:RTCʱԴѡHOURx12Сʱ/24Сʱѡ - ֵ - ֵ - ***************************************************************/ -void RTC_Init(RTC_TYPE_CLKS CLKx,RTC_TYPE_TIME HOURx) -{ - uint32_t flag; - - if(CLKx == RTC_LOSC ) - { - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU_XTAL_Enable(); //ʹⲿ32kHZ - while(SCU_XTALReadyFlag() != SET); //ȴʱӿ - - if(Prot_Temp != 0) - SCU_RegLock(); //д - } - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - RTC->CON.PON = 0; // 㣬ʹRTC - RTC->CON.HSWI = HOURx; // 24Сʱģʽ - RTC->CON.CLKS = CLKx; // ʱԴѡ32768Hz - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; -} -/*************************************************************** - RTC_StartRead - ʵʱʱӶ - ֵ - ֵ - ֵ - ***************************************************************/ -void RTC_StartRead(void) -{ - RTC->CON.TMWR = 0; // Ƕ - RTC->CON.TMUP = 1; // - while (RTC->CON.TMUP == 1); //ȴ -} - -/*************************************************************** - RTC_ReadHourmode - ȡСʱģʽ - ֵ - ֵ - ֵǰСʱģʽ - ***************************************************************/ -uint32_t RTC_ReadHourmode(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - result = RTC->CON.HSWI; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} -/*************************************************************** - RTC_ReadSecond - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadSecond(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.SEC & (uint32_t)0x01) * 1); - result += (((RTC->HMS.SEC >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.SEC >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.SEC >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.SEC >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->HMS.SEC >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->HMS.SEC >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.MIN & (uint32_t)0x01) * 1); - result += (((RTC->HMS.MIN >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.MIN >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.MIN >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.MIN >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->HMS.MIN >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->HMS.MIN >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->HMS.HOUR & (uint32_t)0x01) * 1); - result += (((RTC->HMS.HOUR >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->HMS.HOUR >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->HMS.HOUR >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->HMS.HOUR >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->HMS.HOUR >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->HMS.HOUR >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadDay - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadDay(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.DAY & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.DAY >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.DAY >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.DAY >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.DAY >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->YMDW.DAY >> 5) & (uint32_t)0x01) * 20); - - /* RTCд */ - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return result; -} - -/*************************************************************** - RTC_ReadMonth - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadMonth(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.MON & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.MON >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.MON >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.MON >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.MON >> 4) & (uint32_t)0x01) * 10); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadYear - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadYear(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->YMDW.YEAR & (uint32_t)0x01) * 1); - result += (((RTC->YMDW.YEAR >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->YMDW.YEAR >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->YMDW.YEAR >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->YMDW.YEAR >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->YMDW.YEAR >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->YMDW.YEAR >> 6) & (uint32_t)0x01) * 40); - result += (((RTC->YMDW.YEAR >> 7) & (uint32_t)0x01) * 80); - result += 2000; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} -/*************************************************************** - RTC_ReadWeek - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadWeek(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - switch(RTC->YMDW.WEEK) - { - case 0x00: result = 0;break; - case 0x01: result = 1;break; - case 0x02: result = 2;break; - case 0x03: result = 3;break; - case 0x04: result = 4;break; - case 0x05: result = 5;break; - case 0x06: result = 6;break; - default: result = 0;break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_StartRead - ʵʱʱд - ֵ - ֵ - ֵ - ***************************************************************/ -void RTC_StartWrite(void) -{ - /* д */ - RTC->CON.TMWR = 1; // д - RTC->CON.TMUP = 1; // д - while (RTC->CON.TMUP == 1); //ȴд -} - -/*************************************************************** - RTC_WriteSecond - ޸ - ֵsecond: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteSecond(uint32_t second) -{ - uint32_t flag = 0; - uint32_t sec_buf = 0; - - /* */ - if (second >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (second >= 40) - { - sec_buf |= (uint32_t)1<<6; - second -= 40; - } - else - { - sec_buf &= ~(uint32_t)1<<6; - } - - if (second >= 20) - { - sec_buf |= (uint32_t)1<<5; - second -= 20; - } - else - { - sec_buf &= ~(uint32_t)1<<5; - } - - if (second >= 10) - { - sec_buf |= (uint32_t)1<<4; - second -= 10; - } - else - { - sec_buf &= ~(uint32_t)1<<4; - } - - if (second >= 8) - { - sec_buf |= (uint32_t)1<<3; - second -= 8; - } - else - { - sec_buf &= ~(uint32_t)1<<3; - } - - if (second >= 4) - { - sec_buf |= (uint32_t)1<<2; - second -= 4; - } - else - { - sec_buf &= ~(uint32_t)1<<2; - } - - if (second >= 2) - { - sec_buf |= (uint32_t)1<<1; - second -= 2; - } - else - { - sec_buf &= ~(uint32_t)1<<1; - } - - if (second >= 1) - { - sec_buf |= (uint32_t)1; - second -= 1; - } - else - { - sec_buf &= ~(uint32_t)1; - } - - RTC->HMS.SEC = sec_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteMinute - ޸ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteMinute(uint32_t minute) -{ - uint32_t flag; - uint32_t min_buf = 0; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - min_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - min_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - min_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - min_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - min_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - min_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - min_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - min_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - min_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - min_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - min_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - min_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - min_buf |= (uint32_t)1; - minute -= 1; - } - else - { - min_buf &= ~(uint32_t)1; - } - - RTC->HMS.MIN = min_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_WriteHour - ޸ʱ - ֵhour: ʱ - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->HMS.HOUR = hour_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDay - ޸ - ֵday: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDay(uint32_t day) -{ - uint32_t flag; - uint32_t day_buf = 0; - - /* */ - if ((day == 0) || (day >= 32)) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (day >= 20) - { - day_buf |= (uint32_t)1<<5; - day -= 20; - } - else - { - day_buf &= ~((uint32_t)1<<5); - } - - if (day >= 10) - { - day_buf |= (uint32_t)1<<4; - day -= 10; - } - else - { - day_buf &= ~((uint32_t)1<<4); - } - - if (day >= 8) - { - day_buf |= (uint32_t)1<<3; - day -= 8; - } - else - { - day_buf &= ~((uint32_t)1<<3); - } - - if (day >= 4) - { - day_buf |= (uint32_t)1<<2; - day -= 4; - } - else - { - day_buf &= ~((uint32_t)1<<2); - } - - if (day >= 2) - { - day_buf |= (uint32_t)1<<1; - day -= 2; - } - else - { - day_buf &= ~((uint32_t)1<<1); - } - - if (day >= 1) - { - day_buf |= (uint32_t)1; - day -= 1; - } - else - { - day_buf &= ~(uint32_t)1; - } - - RTC->YMDW.DAY = day_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_WriteMonth - ޸ - ֵmonth: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteMonth(uint32_t month) -{ - uint32_t flag; - uint32_t month_buf = 0; - - /* */ - if ((month == 0) || (month >= 13)) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (month >= 10) - { - month_buf |= (uint32_t)1<<4; - month -= 10; - } - else - { - month_buf &= ~((uint32_t)1<<4); - } - - if (month >= 8) - { - month_buf |= (uint32_t)1<<3; - month -= 8; - } - else - { - month_buf &= ~((uint32_t)1<<3); - } - - if (month >= 4) - { - month_buf |= (uint32_t)1<<2; - month -= 4; - } - else - { - month_buf &= ~((uint32_t)1<<2); - } - - if (month >= 2) - { - month_buf |= (uint32_t)1<<1; - month -= 2; - } - else - { - month_buf &= ~((uint32_t)1<<1); - } - - if (month >= 1) - { - month_buf |= (uint32_t)1; - month -= 1; - } - else - { - month_buf &= ~(uint32_t)1; - } - - RTC->YMDW.MON = month_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteYear - ޸ - ֵyear: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteYear(uint32_t year) -{ - uint32_t flag; - uint32_t year_buf = 0; - - /* */ - if ((year < 2000) || (year > 2099)) - return ERROR; - - /* ת */ - year -= 2000; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (year >= 80) - { - year_buf |= (uint32_t)1<<7; - year -= 80; - } - else - { - year_buf &= ~((uint32_t)1<<7); - } - - if (year >= 40) - { - year_buf |= (uint32_t)1<<6; - year -= 40; - } - else - { - year_buf &= ~((uint32_t)1<<6); - } - - if (year >= 20) - { - year_buf |= (uint32_t)1<<5; - year -= 20; - } - else - { - year_buf &= ~((uint32_t)1<<5); - } - - if (year >= 10) - { - year_buf |= (uint32_t)1<<4; - year -= 10; - } - else - { - year_buf &= ~((uint32_t)1<<4); - } - - if (year >= 8) - { - year_buf |= (uint32_t)1<<3; - year -= 8; - } - else - { - year_buf &= ~((uint32_t)1<<3); - } - - if (year >= 4) - { - year_buf |= (uint32_t)1<<2; - year -= 4; - } - else - { - year_buf &= ~((uint32_t)1<<2); - } - - if (year >= 2) - { - year_buf |= (uint32_t)1<<1; - year -= 2; - } - else - { - year_buf &= ~((uint32_t)1<<1); - } - - if (year >= 1) - { - year_buf |= (uint32_t)1; - year -= 1; - } - else - { - year_buf &= ~(uint32_t)1; - } - - RTC->YMDW.YEAR = year_buf; - - /* д */ - RTC_StartWrite(); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteWeek - ޸ - ֵweek: ڣ0-6 - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeek(uint32_t week) -{ - uint32_t flag; - - /* */ - if (week > 6) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - RTC->YMDW.WEEK = week; - - /* д */ - RTC->CON.TMWR = 1; // д - RTC->CON.TMUP = 1; // д - while (RTC->CON.TMUP == 1); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_ReadWeekAlarmMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->WA.WM & (uint32_t)0x01) * 1); - result += (((RTC->WA.WM >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->WA.WM >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->WA.WM >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->WA.WM >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->WA.WM >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->WA.WM >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadWeekAlarmHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->WA.WH & (uint32_t)0x01) * 1); - result += (((RTC->WA.WH >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->WA.WH >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->WA.WH >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->WA.WH >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->WA.WH >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->WA.WH >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadWeekAlarmWeek - ȡ - ֵ - ֵ - ֵǰ - ***************************************************************/ -uint32_t RTC_ReadWeekAlarmWeek(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - switch(RTC->WA.WW) - { - case 0x00: result = 0;break; - case 0x01: result = 1;break; - case 0x02: result = 2;break; - case 0x03: result = 3;break; - case 0x04: result = 4;break; - case 0x05: result = 5;break; - case 0x06: result = 6;break; - default: result = 0;break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - - -/*************************************************************** - RTC_ReadDayAlarmMinute - ȡ - ֵ - ֵ - ֵǰķ - ***************************************************************/ -uint32_t RTC_ReadDayAlarmMinute(void) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->DA.DM & (uint32_t)0x01) * 1); - result += (((RTC->DA.DM >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->DA.DM >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->DA.DM >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->DA.DM >> 4) & (uint32_t)0x01) * 10); - result += (((RTC->DA.DM >> 5) & (uint32_t)0x01) * 20); - result += (((RTC->DA.DM >> 6) & (uint32_t)0x01) * 40); - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_ReadDaykAlarmHour - ȡСʱ - ֵ - ֵ - ֵǰСʱ - ***************************************************************/ -uint32_t RTC_ReadDayAlarmHour(uint32_t *meridiem) -{ - uint32_t flag; - uint32_t result; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* */ - RTC_StartRead(); - - /* ʱ */ - result = ((RTC->DA.DH & (uint32_t)0x01) * 1); - result += (((RTC->DA.DH >> 1) & (uint32_t)0x01) * 2); - result += (((RTC->DA.DH >> 2) & (uint32_t)0x01) * 4); - result += (((RTC->DA.DH >> 3) & (uint32_t)0x01) * 8); - result += (((RTC->DA.DH >> 4) & (uint32_t)0x01) * 10); - - if(RTC_ReadHourmode() == RTC_HOUR24) //24Сʱģʽ20Сʱ - { - result += (((RTC->DA.DH >> 5) & (uint32_t)0x01) * 20); - } - else //12Сʱģʽ1 PM,0 AM - { - *meridiem = (((RTC->DA.DH >> 5) & (uint32_t)0x01)); - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - return result; -} - -/*************************************************************** - RTC_WriteWeekAlarmMinute - ޸ķ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmMinute(uint32_t minute) -{ - uint32_t flag; - uint32_t minute_buf = 0; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - minute_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - minute_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - minute_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - minute_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - minute_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - minute_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - minute_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - minute_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - minute_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - minute_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - minute_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - minute_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - minute_buf |= (uint32_t)1; - minute -= 1; - } - else - { - minute_buf &= ~(uint32_t)1; - } - - RTC->WA.WM = minute_buf; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteWeekAlarmHour - ޸Сʱ - ֵhour: Сʱ - meridiem(12СʱģʽʱЧ) - 0 AM - 1 PM - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->WA.WH = hour_buf; - - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} -/*************************************************************** - RTC_WriteWeekAlarmWeek - ޸ - ֵweek: ڣ0-6 - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteWeekAlarmWeek(uint32_t week) -{ - uint32_t flag; - - /* */ - if (week > 6) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - RTC->WA.WW = week; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDayAlarmMinute - ޸ķ - ֵminute: - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDayAlarmMinute(uint32_t minute) -{ - uint32_t flag,minute_buf; - - /* */ - if (minute >= 60) - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if (minute >= 40) - { - minute_buf |= (uint32_t)1<<6; - minute -= 40; - } - else - { - minute_buf &= ~(uint32_t)1<<6; - } - - if (minute >= 20) - { - minute_buf |= (uint32_t)1<<5; - minute -= 20; - } - else - { - minute_buf &= ~(uint32_t)1<<5; - } - - if (minute >= 10) - { - minute_buf |= (uint32_t)1<<4; - minute -= 10; - } - else - { - minute_buf &= ~(uint32_t)1<<4; - } - - if (minute >= 8) - { - minute_buf |= (uint32_t)1<<3; - minute -= 8; - } - else - { - minute_buf &= ~(uint32_t)1<<3; - } - - if (minute >= 4) - { - minute_buf |= (uint32_t)1<<2; - minute -= 4; - } - else - { - minute_buf &= ~(uint32_t)1<<2; - } - - if (minute >= 2) - { - minute_buf |= (uint32_t)1<<1; - minute -= 2; - } - else - { - minute_buf &= ~(uint32_t)1<<1; - } - - if (minute >= 1) - { - minute_buf |= (uint32_t)1; - minute -= 1; - } - else - { - minute_buf &= ~(uint32_t)1; - } - - RTC->DA.DM = minute_buf; - - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - -/*************************************************************** - RTC_WriteDayAlarmHour - ޸Сʱ - ֵhour: Сʱ - meridiem(12СʱģʽʱЧ) - 0 AM - 1 PM - ֵ - ֵ - ***************************************************************/ -ErrorStatus RTC_WriteDayAlarmHour(uint32_t hour, uint32_t meridiem) -{ - uint32_t flag,mode; - uint32_t hour_buf = 0; - - /* */ - if (hour >= 24) - return ERROR; - - mode = RTC_ReadHourmode(); - - if(mode == RTC_HOUR12 && hour > 12) //12Сʱģʽɴ12Сʱ - return ERROR; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - if(mode == RTC_HOUR24) - { - if (hour >= 20) - { - hour_buf |= (uint32_t)1<<5; - hour -= 20; - } - else - { - hour_buf &= ~((uint32_t)1<<5); - } - } - else - { - if(meridiem == 1) - hour_buf |= (uint32_t)1<<5; - else - hour_buf &= ~((uint32_t)1<<5); - } - - if (hour >= 10) - { - hour_buf |= (uint32_t)1<<4; - hour -= 10; - } - else - { - hour_buf &= ~((uint32_t)1<<4); - } - - if (hour >= 8) - { - hour_buf |= (uint32_t)1<<3; - hour -= 8; - } - else - { - hour_buf &= ~((uint32_t)1<<3); - } - - if (hour >= 4) - { - hour_buf |= (uint32_t)1<<2; - hour -= 4; - } - else - { - hour_buf &= ~((uint32_t)1<<2); - } - - if (hour >= 2) - { - hour_buf |= (uint32_t)1<<1; - hour -= 2; - } - else - { - hour_buf &= ~((uint32_t)1<<1); - } - - if (hour >= 1) - { - hour_buf |= (uint32_t)1; - hour -= 1; - } - else - { - hour_buf &= ~(uint32_t)1; - } - - RTC->DA.DH = hour_buf; - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return SUCCESS; -} - - -/*************************************************************** - RTC_InterruptEnable - ʹʵʱʱӵijЩж - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_InterruptEnable(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IE.SCDIE = 1; - break; - case RTC_Interrupt_Source_Minute: - RTC->IE.MINIE = 1; - break; - case RTC_Interrupt_Source_Hour: - RTC->IE.HORIE = 1; - break; - case RTC_Interrupt_Source_Day: - RTC->IE.DAYIE = 1; - break; - case RTC_Interrupt_Source_Month: - RTC->IE.MONIE = 1; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IE.DALE = 1; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IE.WALE = 1; - break; - default: - break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - - NVIC->ISER[0] |= (1 << 20); // ʹNVICж - return; -} - -/*************************************************************** - RTC_InterruptDisable - ʵʱʱӵijЩж - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_InterruptDisable(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - /* µֵ */ - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IE.SCDIE = 0; - break; - case RTC_Interrupt_Source_Minute: - RTC->IE.MINIE = 0; - break; - case RTC_Interrupt_Source_Hour: - RTC->IE.HORIE = 0; - break; - case RTC_Interrupt_Source_Day: - RTC->IE.DAYIE = 0; - break; - case RTC_Interrupt_Source_Month: - RTC->IE.MONIE = 0; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IE.DALE = 0; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IE.WALE = 0; - break; - default: - break; - } - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return; -} - -/*************************************************************** - RTC_GetITStatus - ȡʵʱʱӵijЩж״̬ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵжϱ־ - ***************************************************************/ -ITStatus RTC_GetITStatus(RTC_Interrupt_Source src) -{ - ITStatus result = RESET; - - switch (src) - { - case RTC_Interrupt_Source_Second: - if(RTC->IE.SCDIE) - result = SET; - break; - case RTC_Interrupt_Source_Minute: - if(RTC->IE.MINIE) - result = SET; - break; - case RTC_Interrupt_Source_Hour: - if(RTC->IE.HORIE) - result = SET; - break; - case RTC_Interrupt_Source_Day: - if(RTC->IE.DAYIE) - result = SET; - break; - case RTC_Interrupt_Source_Month: - if(RTC->IE.MONIE) - result = SET; - break; - case RTC_Interrupt_Source_DayALE: - if(RTC->IE.DALE) - result = SET; - break; - case RTC_Interrupt_Source_WeekALE: - if(RTC->IE.WALE) - result = SET; - break; - default: - result = RESET; - break; - } - - return result; -} - -/*************************************************************** - RTC_GetFlagStatus - ȡʵʱʱӵijЩжϱ־ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵжϱ־ - ***************************************************************/ -FlagStatus RTC_GetFlagStatus(RTC_Interrupt_Source src) -{ - FlagStatus result = RESET; - - switch (src) - { - case RTC_Interrupt_Source_Second: - if(RTC->IF.SCDIF) - result = SET; - break; - case RTC_Interrupt_Source_Minute: - if(RTC->IF.MINIF) - result = SET; - break; - case RTC_Interrupt_Source_Hour: - if(RTC->IF.HORIF) - result = SET; - break; - case RTC_Interrupt_Source_Day: - if(RTC->IF.DAYIF) - result = SET; - break; - case RTC_Interrupt_Source_Month: - if(RTC->IF.MONIF) - result = SET; - break; - case RTC_Interrupt_Source_DayALE: - if(RTC->IF.DAFG) - result = SET; - break; - case RTC_Interrupt_Source_WeekALE: - if(RTC->IF.WAFG) - result = SET; - break; - default: - result = RESET; - break; - } - - return result; -} - -/*************************************************************** - RTC_ClearITPendingBit - ָжϱ־λ - ֵsrc: ʵʱʱӵжԴ - ֵ - ֵ - ***************************************************************/ -void RTC_ClearITPendingBit(RTC_Interrupt_Source src) -{ - uint32_t flag; - - /* RTCд */ - flag = RTC->WP.WP; - if (flag == 0x00000000) - RTC->WP.WP = 0x55AAAA55; - - switch (src) - { - case RTC_Interrupt_Source_Second: - RTC->IF.Word = RTC_Interrupt_Source_Second; - break; - case RTC_Interrupt_Source_Minute: - RTC->IF.Word = RTC_Interrupt_Source_Minute; - break; - case RTC_Interrupt_Source_Hour: - RTC->IF.Word = RTC_Interrupt_Source_Hour; - break; - case RTC_Interrupt_Source_Day: - RTC->IF.Word = RTC_Interrupt_Source_Day; - break; - case RTC_Interrupt_Source_Month: - RTC->IF.Word = RTC_Interrupt_Source_Month; - break; - case RTC_Interrupt_Source_DayALE: - RTC->IF.Word = RTC_Interrupt_Source_DayALE; - break; - case RTC_Interrupt_Source_WeekALE: - RTC->IF.Word = RTC_Interrupt_Source_WeekALE; - break; - default: - - break; - } - - /* RTCд */ - if (flag == 0x00000000) - RTC->WP.WP = 0x00000000; - return; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c deleted file mode 100644 index 6579ddaee1..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scs.c +++ /dev/null @@ -1,97 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_scs.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ںģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_scs.h" - -/*************************************************************** - NVIC_Init - NVICʼ - ֵChannelжͨ Priorityжȼ Cmdʧܻʹ - ֵ - ֵ - ***************************************************************/ -void NVIC_Init(NVIC_IRQChannel Channel,NVIC_IRQPriority Priority,TYPE_FUNCEN Cmd) -{ - uint32_t tmppriority = 0x00; - - if (Cmd != DISABLE) - { - /* Compute the Corresponding IRQ Priority */ - tmppriority = NVIC->IP[Channel >> 0x02]; - tmppriority &= (uint32_t)(~(((uint32_t)0xFF) << ((Channel & 0x03) * 8))); - tmppriority |= (uint32_t)((((uint32_t)Priority << 6) & 0xFF) << ((Channel & 0x03) * 8)); - - NVIC->IP[Channel >> 0x02] = tmppriority; - - /* Enable the Selected IRQ Channels */ - NVIC->ISER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F); - } - else - { - /* Disable the Selected IRQ Channels */ - NVIC->ICER[0] = (uint32_t)0x01 << (Channel & (uint8_t)0x1F); - } -} - -/*************************************************************** - SCB_SystemLPConfig - ϵͳģʽ - ֵLowPowerModeģʽ NewStateʹܡʹ - ֵ - ֵ - ***************************************************************/ -void SCB_SystemLPConfig(SCB_TYPE_SCR LowPowerMode, TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - SCB->SCR |= LowPowerMode; - else - SCB->SCR &= (uint32_t)(~(uint32_t)LowPowerMode); -} - -/*************************************************************** - SCB_GetCpuID - ȡCPUID - ֵ - ֵ - ֵ32λIDֵ - ***************************************************************/ -uint32_t SCB_GetCpuID(void) -{ - return (SCB->CPUID); -} - -/*************************************************************** - SysTick_Init - SysTickʼ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void SysTick_Init(SYSTICK_InitStruType* SysT_InitStruct) -{ - uint32_t temp32 = 0; - - SysTick->LOAD = SysT_InitStruct->SysTick_Value; - SysTick->VAL = (uint32_t)0; - - if(SysT_InitStruct->SysTick_ClkSource != SysTick_ClkS_Base) - temp32 |= 0x00000004; - else - temp32 &= 0xFFFFFFFB; - - if(SysT_InitStruct->SysTick_ITEnable != DISABLE) - temp32 |= 0x00000002; - else - temp32 &= 0xFFFFFFFD; - - SysTick->CTRL = temp32; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c deleted file mode 100644 index 48a3b51ac9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_scu.c +++ /dev/null @@ -1,387 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_scu.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ϵͳģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_scu.h" - -/*************************************************************** - SCU_OpenXTAL - : ⲿʱ - ֵ - ֵ - ֵϵͳʱԴ - ***************************************************************/ -void SCU_OpenXTAL(void) -{ - SCU_RegUnLock(); - SCU->SCLKEN1.XTAL_EN = 1; - SCU->SCLKEN0.XTAL_LP = 0; - while(SCU->SCLKEN1.XTAL_RDY == 0); //ȴⲿʱȶ - SCU_RegLock() ; -} - -/*************************************************************** - SCU_NMISelect - NMIж - ֵж - ֵ - ֵ - ***************************************************************/ -void SCU_NMISelect(SCU_TYPE_NMICS NMI_Type) -{ - SCU_RegUnLock(); - SCU->NMICON.NMICS = NMI_Type; - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetPWRCFlagStatus - ȡPWRCλ״̬Ĵ־λ״̬ - ֵPWRCĴ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus SCU_GetPWRCFlagStatus(SCU_TYPE_PWRC PWRC_Flag) -{ - FlagStatus bitstatus = RESET; - if((SCU->PWRC.Word & (uint32_t)PWRC_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_ClearPWRCFlagBit - PWRCλ״̬Ĵ־λ - ֵPWRCĴ־λ - ֵ - ֵ - ***************************************************************/ -void SCU_ClearPWRCFlagBit(SCU_TYPE_PWRC PWRC_Flag) -{ - SCU_RegUnLock() ; - SCU->PWRC.Word &= ~((uint32_t)PWRC_Flag); - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetLVDFlagStatus - ȡLVDDĴ־λ״̬ - ֵLVDĴ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus SCU_GetLVDFlagStatus(SCU_TYPE_LVD0CON LVD_Flag) -{ - FlagStatus bitstatus = RESET; - - if((SCU->LVDCON.Word & (uint32_t)LVD_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_SysClkSelect - ѡϵͳʱ - ֵʱԴ - ֵ - ֵ - ***************************************************************/ -void SCU_SysClkSelect(SCU_TYPE_SYSCLK Sysclk) -{ - SCU_RegUnLock() ; - SCU->SCLKEN0.CLK_SEL = Sysclk; - SCU_RegLock() ; -} - -/*************************************************************** - SCU_GetSysClk - ȡϵͳʱԴ - ֵ - ֵ - ֵϵͳʱԴ - ***************************************************************/ -SCU_TYPE_SYSCLK SCU_GetSysClk(void) -{ - return (SCU_TYPE_SYSCLK)(SCU->SCLKEN0.CLK_SEL); -} - -/*************************************************************** - SCU_HRCReadyFlag - ȡHRCȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_HRCReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.HRC_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_XTALReadyFlag - ȡXTALȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_XTALReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.XTAL_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SCU_LOSCReadyFlag - ȡLOSCȶ־λ - ֵ - ֵ - ֵRESETȶ/SETȶ - ***************************************************************/ -FlagStatus SCU_PLLReadyFlag(void) -{ - FlagStatus bitstatus = RESET; - - if((SCU->SCLKEN1.PLL_RDY) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SystemClockConfig - ϵͳʱãڲʱӣ20MHZʱ - ֵ - ֵ - ֵ -***************************************************************/ -void SystemClockConfig(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU_HRC_Enable(); //ʹڲ20MHZ - while(SCU_HRCReadyFlag() != SET); //ȴʱӿ - SCU_SysClkSelect(SCU_SysClk_HRC); //ѡڲ20MHZΪϵͳʱ - - SCU_SysClk_Div1(); //ϵͳʱӺƵ1:1 - - SystemCoreClock = 20000000; - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - DeviceClockAllEnable - ʱ - ֵ - ֵ - ֵ - ***************************************************************/ -void DeviceClockAllEnable(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU->PCLKEN0.Word = 0xFFFFFFFF; - SCU->PCLKEN1.Word = 0xFFFFFFFF; //ʱ - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - DeviceClockAllDisable - رʱ - ֵ - ֵ - ֵ - ***************************************************************/ -void DeviceClockAllDisable(void) -{ - uint32_t Prot_Temp; - - Prot_Temp = SCU->PROT.PROT; - if(Prot_Temp != 0) //д - SCU_RegUnLock(); // - - SCU->PCLKEN0.Word = 0x00000000; //رʱӣscu޷ر - SCU->PCLKEN1.Word = 0x00000000; - - if(Prot_Temp != 0) //д - SCU_RegLock(); //д -} - -/*************************************************************** - SystemClockConfig - ϵͳʱѡ - ֵCLKx ϵͳʱԴѡ - ֵ - ֵ - ***************************************************************/ -void SystemClockSelect(SCU_TYPE_SYSCLK SYSCLKx , SCU_TYPE_CLK_SEL CLK_SEL) -{ - SCU_RegUnLock(); // - - switch(SYSCLKx) - { - case 0: - SCU_HRC_Enable(); - while(SCU_HRCReadyFlag() != SET); - break; - case 1: - SCU_XTAL_Enable(); - while(SCU_XTALReadyFlag() != SET); - break; - case 2: - SCU_PLL_Enable(); - while(SCU_PLLReadyFlag() != SET); - break; - default:break; - } - - SCU->SCLKEN0.SYSCLK_DIV = 0; - SCU->SCLKEN0.CLK_SEL = CLK_SEL; - - SCU_RegLock(); -} - - -/*************************************************************** - PLLClock_Config - PLLʱ,PLLʱΪϵͳʱ - ֵpll_en:ǷPLLpll_originpllʱԴѡpll_outpllƵѡsys_pllϵͳʱǷʹPLLʱ - ֵ - ֵ - ***************************************************************/ -void PLLClock_Config(TYPE_FUNCEN pll_en , SCU_PLL_Origin pll_origin ,SCU_PLL_Out pll_out,TYPE_FUNCEN sys_pll) -{ - SCU_RegUnLock(); - - if(pll_en == DISABLE) //PLLΪֱֹӽֹPLL - { - SCU->SCLKEN0.PLL_MUX = 0; - SCU->SCLKEN1.PLL_BYLOCK = 0; - SCU->SCLKEN0.CLKFLT_BY = 0x00; - SCU->SCLKEN1.PLL_EN = 0; - return; - } - - if((pll_origin == SCU_PLL_HRC)) //ʹڲʱӣ迪ڲʱ - { - if(SCU->SCLKEN1.HRC_RDY == 0) - { - SCU->SCLKEN1.HRC_EN = 1; - while(SCU->SCLKEN1.HRC_RDY == 0); //ȴHRC - } - } - - if((pll_origin == SCU_PLL_XTAL_32K) - || (pll_origin == SCU_PLL_XTAL_4M) - ||(pll_origin == SCU_PLL_XTAL_8M) - || (pll_origin == SCU_PLL_XTAL_16M) - || (pll_origin == SCU_PLL_XTAL_20M)) //ʹⲿʱӣ迪ⲿʱ - { - if(SCU->SCLKEN1.XTAL_RDY == 0) - { - SCU->SCLKEN1.XTAL_EN = 1; - SCU->SCLKEN0.XTAL_LP = 0; - while(SCU->SCLKEN1.XTAL_RDY == 0); //ȴXTAL - } - } - - switch(pll_origin) - { - case SCU_PLL_HRC: - SCU->SCLKEN1.PLL_REF_SEL = 0x00; - break; - case SCU_PLL_LRC: - SCU->SCLKEN1.PLL_REF_SEL = 0x02; - break; - case SCU_PLL_XTAL_32K: - SCU->SCLKEN1.PLL_REF_SEL = 0x03; - break; - case SCU_PLL_XTAL_4M: - SCU->SCLKEN1.PLL_REF_SEL = 0x04; - break; - case SCU_PLL_XTAL_8M: - SCU->SCLKEN1.PLL_REF_SEL = 0x05; - break; - case SCU_PLL_XTAL_16M: - SCU->SCLKEN1.PLL_REF_SEL = 0x06; - break; - case SCU_PLL_XTAL_20M: - SCU->SCLKEN1.PLL_REF_SEL = 0x07; - break; - default: - break; - } - - SCU->SCLKEN1.PLL_48M_SEL = pll_out; //PLLΪ3248Mhz - - SCU->SCLKEN1.PLL_EN = 1; - while(SCU->SCLKEN1.PLL_RDY == 0); - - - if(sys_pll == ENABLE) - { - - if(pll_out == SCU_PLL_32M) - { - SCU->SCLKEN0.CLKFLT_BY = 0; - } - else - { - SCU->SCLKEN0.CLKFLT_BY = 0x55; //48M ʱ˲· - } - SCU->SCLKEN1.PLL_BYLOCK = 1; - SCU->SCLKEN0.PLL_MUX = 1; - } - else - { - SCU->SCLKEN0.PLL_MUX = 0; - SCU->SCLKEN1.PLL_BYLOCK = 0; - SCU->SCLKEN0.CLKFLT_BY = 0x00; - } - - SCU_RegLock(); -} - -/*************************END OF FILE**********************/ - - - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c deleted file mode 100644 index 666c142dcf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_spi.c +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_spi.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * SPIģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_spi.h" - -/*************************************************************** - SPI0_Init - SPIʼ - ֵʼýṹַ - ֵ - ֵ - ***************************************************************/ -void SPI_Init(SPI_InitStruType* SPI_InitStruct) -{ - uint32_t Temp = 0; - - Temp = SystemCoreClock / (SPI_InitStruct->SPI_Freq * 2); - if(Temp > 254) - Temp = 255; - - SPI0->CKS.CKS = Temp; - - SPI0->CON.DFS = SPI_InitStruct->SPI_Df; - SPI0->CON.MS = SPI_InitStruct->SPI_Mode; - SPI0->CON.DW = SPI_InitStruct->SPI_DW; - SPI0->CON.DRE = SPI_InitStruct->SPI_DelayRec; - SPI0->CON.TME = SPI_InitStruct->SPI_DelaySend; - - Temp = (uint32_t)SPI_InitStruct->SPI_SendDelayPeroid - 1; - if(Temp > 62) - Temp = 63; - - SPI0->CON.TMP = Temp; -} - -/*************************************************************** - SPI0_ITConfig - SPIж - ֵSPI_IEж NewStateʹܡʧ - ֵ - ֵ - ***************************************************************/ -void SPI_ITConfig(SPI_TYPE_IT SPI_IE,TYPE_FUNCEN NewState) -{ - if(NewState != DISABLE) - SPI0->IE.Word |= (uint32_t)SPI_IE; - else - SPI0->IE.Word &= ~((uint32_t)SPI_IE); -} - -/*************************************************************** - SPI0_DataFormatConfig - SPIݸʽ - ֵݸʽ - ֵ - ֵ - ***************************************************************/ -void SPI_DataFormatConfig(SPI_TYPE_DFS Type) -{ - SPI0->CON.DFS = Type; -} - -/*************************************************************** - SPI0_SendByte - SPIһֽڣ8λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendByte(uint8_t Temp) -{ - SPI0->TBW.Byte[0] = Temp; -} - -/*************************************************************** - SPI0_SendHalfWord - SPIһ֣16λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendHalfWord(uint16_t Temp) -{ - SPI0->TBW.HalfWord[0] = Temp; -} - -/*************************************************************** - SPI0_SendWord - SPIһ֣32λ - ֵҪ͵ - ֵ - ֵ - ***************************************************************/ -void SPI_SendWord(uint32_t Temp) -{ - SPI0->TBW.Word = Temp; -} - -/*************************************************************** - SPI0_RecByte - SPIһֽ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint8_t SPI_RecByte(void) -{ - return SPI0->RBR.Byte[0]; -} - -/*************************************************************** - SPI0_RecHalfWord - SPIһ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint16_t SPI_RecHalfWord(void) -{ - return SPI0->RBR.HalfWord[0]; -} - -/*************************************************************** - SPI0_RecWord - SPIһ - ֵ - ֵ - ֵյ - ***************************************************************/ -uint32_t SPI_RecWord(void) -{ - return SPI0->RBR.Word; -} - -/*************************************************************** - SPI0_TBIMConfig - SPIͻжģʽѡ - ֵжģʽ - ֵ - ֵ - ***************************************************************/ -void SPI_TBIMConfig(SPI_TYPE_TRBIM Type) -{ - SPI0->IE.TBIM = Type; -} - -/*************************************************************** - SPI0_RBIMConfig - SPIջжģʽѡ - ֵжģʽ - ֵ - ֵ - ***************************************************************/ -void SPI_RBIMConfig(SPI_TYPE_TRBIM Type) -{ - SPI0->IE.RBIM = Type; -} - -/*************************************************************** - SPI0_GetFlagStatus - SPI־λ״̬ - ֵ־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus SPI_GetFlagStatus(SPI_TYPE_FLAG Flag) -{ - FlagStatus bitstatus = RESET; - - /* ȡĴ */ - if((uint32_t)Flag <= 0x00000040) - { - if ((SPI0->IF.Word & Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - } - - else - { - if ((SPI0->STA.Word & Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - } - - return bitstatus; -} - -/*************************************************************** - SPI0_GetITStatus - SPIж״̬,δʹӦжʱ᷵SET - ֵжϱ־λ - ֵ - ֵSET/RESET - ***************************************************************/ -ITStatus SPI_GetITStatus(SPI_TYPE_IT Flag) -{ - FlagStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = SPI0->IF.Word & (uint32_t)Flag; - itenable = SPI0->IE.Word & (uint32_t)Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - SPI0_ClearITPendingBit - SPIжϱ־ - ֵ־λ - ֵ - ֵ - ***************************************************************/ -void SPI_ClearITPendingBit(SPI_CLR_IF Flag) -{ - SPI0->IF.Word = (uint32_t)Flag; -} - -/*************************END OF FILE**********************/ - diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c deleted file mode 100644 index 495e53b4cf..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_timer.c +++ /dev/null @@ -1,569 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_timer.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * ʱģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_timer.h" - -/*************************************************************** - T16Nx_BaseInit - T16Nxʼ - ֵT16NxT16N0/1/2/3 TIM_BaseInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T16Nx_BaseInit(T16N_TypeDef* T16Nx,TIM_BaseInitStruType* TIM_BaseInitStruct) -{ - T16Nx->CON0.CS = TIM_BaseInitStruct->TIM_ClkS; - T16Nx->CON0.SYNC = TIM_BaseInitStruct->TIM_SYNC; - T16Nx->CON0.EDGE = TIM_BaseInitStruct->TIM_EDGE; - T16Nx->CON0.MOD = TIM_BaseInitStruct->TIM_Mode; -} -/*************************************************************** - T32Nx_BaseInit - T32Nxʼ - ֵT32NxT32N0 TIM_BaseInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T32Nx_BaseInit(T32N_TypeDef* T32Nx,TIM_BaseInitStruType* TIM_BaseInitStruct) -{ - T32Nx->CON0.CS = TIM_BaseInitStruct->TIM_ClkS; - T32Nx->CON0.SYNC = TIM_BaseInitStruct->TIM_SYNC; - T32Nx->CON0.EDGE = TIM_BaseInitStruct->TIM_EDGE; - T32Nx->CON0.MOD = TIM_BaseInitStruct->TIM_Mode; -} -/*************************************************************** - T16Nx_CapInit - T16Nx׽ʼ - ֵT16NxT16N0/1/2/3 TIM_CapInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T16Nx_CapInit(T16N_TypeDef* T16Nx,TIM_CapInitStruType* TIM_CapInitStruct) -{ - T16Nx->CON1.CAPPE = TIM_CapInitStruct->TIM_CapRise; - T16Nx->CON1.CAPNE = TIM_CapInitStruct->TIM_CapFall; - T16Nx->CON1.CAPIS0 = TIM_CapInitStruct->TIM_CapIS0; - T16Nx->CON1.CAPIS1 = TIM_CapInitStruct->TIM_CapIS1; - T16Nx->CON1.CAPT = TIM_CapInitStruct->TIM_CapTime; -} -/*************************************************************** - T32Nx_CapInit - T32Nx׽ʼ - ֵT32NxT32N0 TIM_CapInitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void T32Nx_CapInit(T32N_TypeDef* T32Nx,TIM_CapInitStruType* TIM_CapInitStruct) -{ - T32Nx->CON1.CAPPE = TIM_CapInitStruct->TIM_CapRise; - T32Nx->CON1.CAPNE = TIM_CapInitStruct->TIM_CapFall; - T32Nx->CON1.CAPIS0 = TIM_CapInitStruct->TIM_CapIS0; - T32Nx->CON1.CAPIS1 = TIM_CapInitStruct->TIM_CapIS1; - T32Nx->CON1.CAPT = TIM_CapInitStruct->TIM_CapTime; -} -/*************************************************************** - T16Nx_MATxITConfig - T16NxƥĹģʽ - ֵT16NxT16N0/1/2/3 TypeƥĹģʽ - ֵ - ֵ - ***************************************************************/ -void T16Nx_MAT0ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT0S = Type; -} -void T16Nx_MAT1ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT1S = Type; -} -void T16Nx_MAT2ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT2S = Type; -} -void T16Nx_MAT3ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_MATCON Type) -{ - T16Nx->CON0.MAT3S = Type; -} -/*************************************************************** - T32Nx_MATxITConfig - T32NxƥĹģʽ - ֵT32NxT32N0 TypeƥĹģʽ - ֵ - ֵ - ***************************************************************/ -void T32Nx_MAT0ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT0S = Type; -} -void T32Nx_MAT1ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT1S = Type; -} -void T32Nx_MAT2ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT2S = Type; -} -void T32Nx_MAT3ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_MATCON Type) -{ - T32Nx->CON0.MAT3S = Type; -} -/*************************************************************** - T16Nx_MATxOutxConfig - T16Nxƥ˿ڵģʽ - ֵT16NxT16N0/1/2/3 Typeƥ˿ڵĹģʽ - ֵ - ֵ - ***************************************************************/ -void T16Nx_MAT0Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM0 = Type; -} -void T16Nx_MAT1Out0Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM1 = Type; -} -void T16Nx_MAT2Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM2 = Type; -} -void T16Nx_MAT3Out1Config(T16N_TypeDef* T16Nx,TIM_TYPE_MATOUT Type) -{ - T16Nx->CON2.MOM3 = Type; -} -/*************************************************************** - T32Nx_MATxOutxConfig - T32Nxƥ˿ڵģʽ - ֵT32NxT32N0 Typeƥ˿ڵĹģʽ - ֵ - ֵ - ***************************************************************/ -void T32Nx_MAT0Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM0 = Type; -} -void T32Nx_MAT1Out0Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM1 = Type; -} -void T32Nx_MAT2Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM2 = Type; -} -void T32Nx_MAT3Out1Config(T32N_TypeDef* T32Nx,TIM_TYPE_MATOUT Type) -{ - T32Nx->CON2.MOM3 = Type; -} -/*************************************************************** - T16Nx_ITConfig - T16Nж - ֵT16NxT16N0/1/2/3 Typeж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void T16Nx_ITConfig(T16N_TypeDef* T16Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - T16Nx->IE.Word |= (uint32_t)Type; - else - T16Nx->IE.Word &= (~(uint32_t)Type); -} -/*************************************************************** - T32Nx_ITConfig - T32Nж - ֵT32NxT32N0 Typeж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void T32Nx_ITConfig(T32N_TypeDef* T32Nx,TIM_TYPE_IT Type,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - T32Nx->IE.Word|= (uint32_t)Type; - else - T32Nx->IE.Word &= (~(uint32_t)Type); -} -/*************************************************************** - T16Nx_PWMOutConfig - T16N0OUT0,T16N1OUT0T16N2OUT0T16N3OUT0 áԭΪʹuartƣ˲uartͬʱʹá - ֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_PWMOutConfig(T16N_TypeDef* T16Nx,T16Nx_PWMInitStruType* T16Nx_PWMInitStruct) -{ - T16Nx->CON2.MOE0 = T16Nx_PWMInitStruct->T16Nx_MOE0; //˿0Ƿʹ - T16Nx->CON2.MOE1 = T16Nx_PWMInitStruct->T16Nx_MOE1; //˿1Ƿʹ - T16Nx->CON2.POL0 = T16Nx_PWMInitStruct->T16Nx_POL0; //T16NxOut0 - T16Nx->CON2.POL1 = T16Nx_PWMInitStruct->T16Nx_POL1; //T16NxOut1 -} -/*************************************************************** - T16Nx_PWMBK_Config - PWMɲ - ֵT16NxT16N0/1/2/3 ,Type PWMɲṹ - ֵ - ֵ - ***************************************************************/ -void T16Nx_PWMBK_Config(T16N_TypeDef* T16Nx,T16Nx_PWMBK_Type* type) -{ - T16Nx->CON2.PBKL0 = type->T16Nx_PWMBKL0; //PWMͨ0ɲƽѡ - T16Nx->CON2.PBKL1 = type->T16Nx_PWMBKL1; //PWMͨ1ɲƽѡ - T16Nx->CON2.PBKS = type->T16Nx_PWMBKS; //PWMźԴѡ - T16Nx->CON2.PBKPS = type->T16Nx_PWMBKPS; //PWMͨɲźżѡ - T16Nx->CON2.PBKEN = type->T16Nx_PWMBKEN; //PWMͨɲʹ -} -/*************************************************************** - T16Nx_TRG_Config - : T16N ADCʹ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ - ***************************************************************/ -void T16Nx_TRG_Config(T16N_TypeDef* T16Nx,T16Nx_PWMTRG_type Type,TYPE_FUNCEN NewState) -{ - if(Type == T16Nx_MAT0) - T16Nx->TRG.MAT0TAR = 1; - else if(Type == T16Nx_MAT1) - T16Nx->TRG.MAT1TAR = 1; - else if(Type == T16Nx_MAT2) - T16Nx->TRG.MAT2TAR = 1; - else if(Type == T16Nx_MAT3) - T16Nx->TRG.MAT3TAR = 1; - - T16Nx->TRG.OVTAR = NewState; -} -/*************************************************************** - T16Nx_GetPWMBKF - ȡPWMBKFɲ־λ - ֵT16NxT16N0/1/2/3 - ֵPWMBKF־λֵSETɲ¼RESETδɲ¼ - ֵ - ***************************************************************/ -FlagStatus T16Nx_GetPWMBKF(T16N_TypeDef* T16Nx) -{ - if(T16Nx->CON2.PBKF == 1) - return SET; - else - return RESET; -} -/*************************************************************** - T16Nx_ResetPWMBKF - : PWMBKF־־PWM˿ڻָshuc - ֵT16NxT16N0/1/2/3 - ֵ - ֵ - ***************************************************************/ -void T16Nx_ResetPWMBKF(T16N_TypeDef* T16Nx) -{ - T16Nx->CON2.PBKF = 1; -} -/*************************************************************** - T16Nx_SetCNT - üֵ - ֵT16NxT16N0/1/2/3 Value16λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetCNT(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->CNT.CNT = Value; -} -/*************************************************************** - T32Nx_SetCNT - üֵ - ֵT32NxT32N0 Value32λֵ16λʱҶ룩 - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetCNT(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->CNT.CNT = Value; -} -/*************************************************************** - T16Nx_SetPRECNT - ԤƵĴֵ - ֵT16NxT16N0/1/2/3 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetPRECNT(T16N_TypeDef* T16Nx,uint8_t Value) -{ - T16Nx->PRECNT.PRECNT = Value; -} -/*************************************************************** - T32Nx_SetPRECNT - ԤƵĴֵ - ֵT32NxT32N0 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetPRECNT(T32N_TypeDef* T32Nx,uint8_t Value) -{ - T32Nx->PRECNT.PRECNT = Value - 1; -} -/*************************************************************** - T16Nx_SetPREMAT - ԤƵƥĴֵ - ֵT16NxT16N0/1/2/3 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetPREMAT(T16N_TypeDef* T16Nx,uint8_t Value) -{ - T16Nx->PREMAT.PREMAT = Value - 1; -} -/*************************************************************** - T32Nx_SetPREMAT - ԤƵƥĴֵ - ֵT32NxT32N0 Value8λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetPREMAT(T32N_TypeDef* T32Nx,uint8_t Value) -{ - T32Nx->PREMAT.PREMAT = Value - 1; -} -/*************************************************************** - T16Nx_SetMATx - ƥĴ - ֵT16NxT16N0/1/2/3 MATxTIM_MAT0/1/2/3 Value16λֵ - ֵ - ֵ - ***************************************************************/ -void T16Nx_SetMAT0(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT0.MAT0 = Value; -} -void T16Nx_SetMAT1(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT1.MAT1 = Value; -} -void T16Nx_SetMAT2(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT2.MAT2 = Value; -} -void T16Nx_SetMAT3(T16N_TypeDef* T16Nx,uint16_t Value) -{ - T16Nx->MAT3.MAT3 = Value; -} -/*************************************************************** - T32Nx_SetMATx - ƥĴ - ֵT32NxT32N0 MATxTIM_MAT0/1/2/3 Value32λֵ - ֵ - ֵ - ***************************************************************/ -void T32Nx_SetMAT0(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT0.MAT0 = Value; -} -void T32Nx_SetMAT1(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT1.MAT1 = Value; -} -void T32Nx_SetMAT2(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT2.MAT2 = Value; -} -void T32Nx_SetMAT3(T32N_TypeDef* T32Nx,uint32_t Value) -{ - T32Nx->MAT3.MAT3 = Value; -} -/*************************************************************** - T16Nx_GetMATx - ȡƥĴֵ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ16λֵ - ***************************************************************/ -uint16_t T16Nx_GetMAT0(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT0.MAT0); -} -uint16_t T16Nx_GetMAT1(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT1.MAT1); -} -uint16_t T16Nx_GetMAT2(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT2.MAT2); -} -uint16_t T16Nx_GetMAT3(T16N_TypeDef* T16Nx) -{ - return (T16Nx->MAT3.MAT3); -} -/*************************************************************** - T32Nx_GetMATx - ȡƥĴֵ - ֵT32NxT32N0/3 MATxTIM_MAT0/1/2/3 - ֵ - ֵ32λֵ - ***************************************************************/ -uint32_t T32Nx_GetMAT0(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT0.MAT0); -} -uint32_t T32Nx_GetMAT1(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT1.MAT1); -} -uint32_t T32Nx_GetMAT2(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT2.MAT2); -} -uint32_t T32Nx_GetMAT3(T32N_TypeDef* T32Nx) -{ - return (T32Nx->MAT3.MAT3); -} -/*************************************************************** - T16Nx_GetCNT - ȡĴֵ - ֵT16NxT16N0/1/2/3 - ֵ16λֵ - ***************************************************************/ -uint16_t T16Nx_GetCNT(T16N_TypeDef* T16Nx) -{ - return (T16Nx->CNT.CNT); -} -/*************************************************************** - T32Nx_GetCNT - ȡĴֵ - ֵT32NxT32N0/3 - ֵ16/32λֵ - ***************************************************************/ -uint32_t T32Nx_GetCNT(T32N_TypeDef* T32Nx) -{ - return (T32Nx->CNT.CNT); -} -/*************************************************************** - T16Nx_GetPRECNT - ȡԤƵĴֵ - ֵT16NxT16N0/1/2/3 - ֵ - ֵ8λֵ - ***************************************************************/ -uint8_t T16Nx_GetPRECNT(T16N_TypeDef* T16Nx) -{ - return (uint8_t)(T16Nx->PRECNT.PRECNT); -} -/*************************************************************** - T32Nx_GetPRECNT - ȡԤƵĴֵ - ֵT32NxT32N0 - ֵ - ֵ8λֵ - ***************************************************************/ -uint8_t T32Nx_GetPRECNT(T32N_TypeDef* T32Nx) -{ - return (uint8_t)(T32Nx->PRECNT.PRECNT); -} -/*************************************************************** - T16Nx_GetFlagStatus - ȡָ־λ - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus T16Nx_GetFlagStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag) -{ - FlagStatus bitstatus = RESET; - - if((T16Nx->IF.Word & (uint32_t)TIM_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T32Nx_GetFlagStatus - ȡָ־λ - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -FlagStatus T32Nx_GetFlagStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag) -{ - FlagStatus bitstatus = RESET; - - if((T32Nx->IF.Word & (uint32_t)TIM_Flag) != (uint32_t)RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - T16Nx_GetITStatus - ȡָжϱ־λ,δʹӦжʱ᷵SET - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -ITStatus T16Nx_GetITStatus(T16N_TypeDef* T16Nx,TIM_TYPE_IT TIM_Flag) -{ - ITStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = T16Nx->IF.Word & (uint32_t)TIM_Flag; - itenable = T16Nx->IE.Word & (uint32_t)TIM_Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T32Nx_GetITStatus - ȡָжϱ־λ,δʹӦжʱ᷵SET - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵRESET/SET - ***************************************************************/ -ITStatus T32Nx_GetITStatus(T32N_TypeDef* T32Nx,TIM_TYPE_IT TIM_Flag) -{ - ITStatus bitstatus = RESET; - uint32_t itstatus = 0x0, itenable = 0x0; - - itstatus = T32Nx->IF.Word & (uint32_t)TIM_Flag; - itenable = T32Nx->IE.Word & (uint32_t)TIM_Flag; - - if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET)) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} -/*************************************************************** - T16Nx_ClearIFPendingBit - ָжϱ־λ - ֵT16NxT16N0/1/2/3 TIM_Flagжϱ־λ - ֵ - ֵ - ***************************************************************/ -void T16Nx_ClearIFPendingBit(T16N_TypeDef* T16Nx,TIM_TYPE_IF TIM_Flag) -{ - T16Nx->IF.Word = (uint32_t)TIM_Flag; -} -/*************************************************************** - T32Nx_ClearIFPendingBit - ָжϱ־λ - ֵT32NxT32N0 TIM_Flagжϱ־λ - ֵ - ֵ - ***************************************************************/ -void T32Nx_ClearIFPendingBit(T32N_TypeDef* T32Nx,TIM_TYPE_IF TIM_Flag) -{ - T32Nx->IF.Word = (uint32_t)TIM_Flag; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c deleted file mode 100644 index 0314562ff0..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_uart.c +++ /dev/null @@ -1,198 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_uart.c - * ߣ Liut - * V1.00 - * ڣ 2017/07/14 - * UARTģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_uart.h" - -/*************************************************************** - UART_Init - UARTʼ - ֵUARTxUART0/1/2/3/4/5 UART_InitStructʼýṹַ - ֵ - ֵ - ***************************************************************/ -void UART_Init(UART_TypeDef* UARTx,UART_InitStruType* UART_InitStruct) -{ - uint32_t BaudClockTemp = 0, BaudTemp = 0; - - if(UART_InitStruct->UART_ClockSet == UART_Clock_1) - { - BaudClockTemp = (SystemCoreClock/16)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/16/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/16/UART_InitStruct->UART_BaudRate; - } - } - else if(UART_InitStruct->UART_ClockSet == UART_Clock_2) - { - BaudClockTemp = (SystemCoreClock/32)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/32/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/32/UART_InitStruct->UART_BaudRate; - } - } - else if(UART_InitStruct->UART_ClockSet == UART_Clock_4) - { - BaudClockTemp = (SystemCoreClock/64)%UART_InitStruct->UART_BaudRate; - if(UART_InitStruct->UART_BaudRate >= (2*BaudClockTemp)) - { - BaudTemp = (SystemCoreClock/64/UART_InitStruct->UART_BaudRate)-1; - } - else - { - BaudTemp = SystemCoreClock/64/UART_InitStruct->UART_BaudRate; - } - } - - if(BaudTemp > 2046) - { - BaudTemp = 2047; - } - - UARTx->CON.BCS = UART_InitStruct->UART_ClockSet; - UARTx->BRR.BRR = BaudTemp ; - - UARTx->CON.TXFS = UART_InitStruct->UART_StopBits; - UARTx->CON.TXMOD = UART_InitStruct->UART_TxMode; - UARTx->CON.TXP = UART_InitStruct->UART_TxPolar; - UARTx->CON.RXMOD = UART_InitStruct->UART_RxMode; - UARTx->CON.RXP = UART_InitStruct->UART_RxPolar; -} -/*************************************************************** - UART_ITConfig - UARTж - ֵUARTxUART0/1/2/3/4/5 UART_ITж NewStateʹ/ʧ - ֵ - ֵ - ***************************************************************/ -void UART_ITConfig(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT,TYPE_FUNCEN NewState) -{ - if (NewState != DISABLE) - UARTx->IE.Word = (UARTx->IE.Word & (uint32_t)0x0000FFFF) | (uint32_t) UART_IT; - else - UARTx->IE.Word = (UARTx->IE.Word & (uint32_t)0x0000FFFF) & (~((uint32_t) UART_IT)); -} -/*************************************************************** - UART_TBIMConfig - UARTͻжģʽѡ - ֵUARTxUART0/1/2/3/4/5 Typeжģʽ - ֵ - ֵ - ***************************************************************/ -void UART_TBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type) -{ - UARTx->IE.TBIM = Type; -} -/*************************************************************** - UART_RBIMConfig - UARTջжģʽѡ - ֵUARTxUART0/1/2/3 Typeжģʽ - ֵ - ֵ - ***************************************************************/ -void UART_RBIMConfig(UART_TypeDef* UARTx,UART_TYPE_TRBIM Type) -{ - UARTx->IE.RBIM = Type; -} -/*************************************************************** - UART_Sendxxxx - UARTֽڡ֡ - ֵUARTxUART0/1/2/3/4/5 - ֵ - ֵ - ***************************************************************/ -void UART_SendByte(UART_TypeDef* UARTx,uint8_t Temp08) -{ - UARTx->TBW.Byte[0] = Temp08; -} -void UART_SendHalfWord(UART_TypeDef* UARTx,uint16_t Temp16) -{ - UARTx->TBW.HalfWord[0] = Temp16; -} -void UART_SendWord(UART_TypeDef* UARTx,uint32_t Temp32) -{ - UARTx->TBW.Word = Temp32; -} -/*************************************************************** - UART_Recxxxx - UARTֽڡ֡ - ֵUARTxUART0/1/2/3/4/5 - ֵ - ֵ - ***************************************************************/ -uint8_t UART_RecByte(UART_TypeDef* UARTx) -{ - return UARTx->RBR.Byte[0]; -} -uint16_t UART_RecHalfWord(UART_TypeDef* UARTx) -{ - return UARTx->RBR.HalfWord[0]; -} -uint32_t UART_RecWord(UART_TypeDef* UARTx) -{ - return UARTx->RBR.Word; -} -/*************************************************************** - UART_GetFlagStatus - UARTȡ־λ״̬ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵSET/RESET - ***************************************************************/ -FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx,UART_TYPE_FLAG UART_Flag) -{ - FlagStatus bitstatus = RESET; - - if ((UARTx->IF.Word & ((uint32_t)UART_Flag)) != RESET) - bitstatus = SET; - else - bitstatus = RESET; - - return bitstatus; -} - -/*************************************************************** - UART_GetITStatus - UARTȡж״̬ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵSET/RESET - ***************************************************************/ -ITStatus UART_GetITStatus(UART_TypeDef* UARTx,UART_TYPE_IT UART_IT) -{ - FlagStatus bitstatus = RESET; - - if((UARTx->IE.Word & ((uint32_t)UART_IT)) == 0) - bitstatus = RESET; - else - bitstatus = SET; - - return bitstatus; -} -/*************************************************************** - UART_ClearIFPendingBit - UART־λ - ֵUARTxUART0/1/2/3/4/5 UART_Flag־λ - ֵ - ֵ - ***************************************************************/ -void UART_ClearIFPendingBit(UART_TypeDef* UARTx,UART_CLR_IF UART_Flag) -{ - UARTx->IF.Word = (uint32_t)UART_Flag; -} - -/*************************END OF FILE**********************/ diff --git a/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c b/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c deleted file mode 100644 index 2218a204a9..0000000000 --- a/bsp/essemi/es8p508x/libraries/Library/Source/lib_wdt.c +++ /dev/null @@ -1,172 +0,0 @@ -/*************************************************************** - *Copyright (C), 2017, Shanghai Eastsoft Microelectronics Co., Ltd - *ļ lib_wdt.c - * ߣ Liut - * V1.00 - * ڣ 2017/02/04 - * Źģ⺯ - * ע ES8P508xоƬ - ѧϰʾʹãûֱôķջеκηΡ - ***************************************************************/ -#include "lib_wdt.h" - -/************************************* - IWDT_Init - IWDTʼ - ֵʼṹ - ֵ - **************************************/ -void IWDT_Init(IWDT_InitStruType *WDT_InitStruct) -{ - uint32_t tmp; - - if (WDT_InitStruct->WDT_Clock != WDT_CLOCK_PCLK) - tmp = (uint32_t)(32 * WDT_InitStruct->WDT_Tms); - else - tmp = SystemCoreClock / 1000 * WDT_InitStruct->WDT_Tms; - - IWDT->LOAD.LOAD = tmp; - IWDT->CON.CLKS = WDT_InitStruct->WDT_Clock; - IWDT->CON.IE = WDT_InitStruct->WDT_IE; - IWDT->CON.RSTEN = WDT_InitStruct->WDT_Rst; - - return; -} - -/************************************* - IWDT_SetReloadValue - WDTصijֵ - ֵʼֵ32-bit޷ - ֵ - **************************************/ -void IWDT_SetReloadValue(uint32_t Value) -{ - IWDT->LOAD.LOAD = Value; - return; -} - -/************************************* - IWDT_GetValue - ȡWDTǰֵ - ֵ - ֵǰֵ - **************************************/ -uint32_t IWDT_GetValue(void) -{ - return (uint32_t)IWDT->VALUE.VALUE; -} - -/************************************* - IWDT_GetFlagStatus - ȡWDTж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus IWDT_GetFlagStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (IWDT->RIS.WDTIF != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - IWDT_GetITStatus - ȡWDTʹж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus IWDT_GetITStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (IWDT->CON.IE != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - WWDT_Init - WWDTʼ - ֵʼṹ - ֵ - **************************************/ -void WWDT_Init(WWDT_InitStruType *WDT_InitStruct) -{ - uint32_t tmp; - - if (WDT_InitStruct->WDT_Clock != WDT_CLOCK_PCLK) - tmp = (uint32_t)(32 * WDT_InitStruct->WDT_Tms); - else - tmp = SystemCoreClock / 1000 * WDT_InitStruct->WDT_Tms; - - WWDT->LOAD.LOAD = tmp; - WWDT->CON.CLKS = WDT_InitStruct->WDT_Clock; - WWDT->CON.IE = WDT_InitStruct->WDT_IE; - WWDT->CON.RSTEN = WDT_InitStruct->WDT_Rst; - WWDT->CON.WWDTWIN = WDT_InitStruct->WDT_Win; - - return; -} - -/************************************* - WWDT_SetReloadValue - WDTصijֵ - ֵʼֵ32-bit޷ - ֵ - **************************************/ -void WWDT_SetReloadValue(uint32_t Value) -{ - WWDT->LOAD.LOAD = Value; - return; -} - -/************************************* - WWDT_GetValue - ȡWDTǰֵ - ֵ - ֵǰֵ - **************************************/ -uint32_t WWDT_GetValue(void) -{ - return (uint32_t)WWDT->VALUE.VALUE; -} - -/************************************* - WWDT_GetFlagStatus - ȡWDTж״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus WWDT_GetFlagStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (WWDT->RIS.WWDTIF != RESET) - bitstatus = SET; - - return bitstatus; -} - -/************************************* - WWDT_GetIEStatus - ȡWDTжʹ״̬ - ֵ - ֵSET/RESET - **************************************/ -FlagStatus WWDT_GetITStatus(void) -{ - FlagStatus bitstatus = RESET; - - if (WWDT->CON.IE != RESET) - bitstatus = SET; - - return bitstatus; -} - -/*************************END OF FILE**********************/ - - diff --git a/bsp/essemi/es8p508x/libraries/SConscript b/bsp/essemi/es8p508x/libraries/SConscript deleted file mode 100644 index e67dc9e4e3..0000000000 --- a/bsp/essemi/es8p508x/libraries/SConscript +++ /dev/null @@ -1,27 +0,0 @@ -import rtconfig -Import('RTT_ROOT') -from building import * - -# get current directory -cwd = GetCurrentDir() - -# The set of source files associated with this SConscript file. -src = [] - -src += Glob('Library/Source/*.c') -src += ['CMSIS/system_ES8P508x.c'] - -#add for startup script -if rtconfig.CROSS_TOOL == 'gcc': - src = src -elif rtconfig.CROSS_TOOL == 'keil': - src = src + ['CMSIS/startup_ES8P508x.s'] -elif rtconfig.CROSS_TOOL == 'iar': - src = src - -path = [cwd + '/CMSIS', - cwd + '/Library/Include',] - -group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path) - -Return('group')