diff --git a/bsp/swm320/libraries/CMSIS/DeviceSupport/SWM320.h b/bsp/swm320/libraries/CMSIS/DeviceSupport/SWM320.h index 55eb7812f0..4ac927b7b9 100644 --- a/bsp/swm320/libraries/CMSIS/DeviceSupport/SWM320.h +++ b/bsp/swm320/libraries/CMSIS/DeviceSupport/SWM320.h @@ -8,83 +8,83 @@ */ typedef enum IRQn { - /****** Cortex-M0 Processor Exceptions Numbers **********************************************/ - NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ - MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */ - BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */ - UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */ - SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */ - DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */ - PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */ - SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */ - - /****** Cortex-M4 specific Interrupt Numbers ************************************************/ - GPIOA0_IRQn = 0, - GPIOA1_IRQn = 1, - GPIOA2_IRQn = 2, - GPIOA3_IRQn = 3, - GPIOA4_IRQn = 4, - GPIOA5_IRQn = 5, - GPIOA6_IRQn = 6, - GPIOA7_IRQn = 7, - GPIOB0_IRQn = 8, - GPIOB1_IRQn = 9, - GPIOB2_IRQn = 10, - GPIOB3_IRQn = 11, - GPIOB4_IRQn = 12, - GPIOB5_IRQn = 13, - GPIOB6_IRQn = 14, - GPIOB7_IRQn = 15, - GPIOC0_IRQn = 16, - GPIOC1_IRQn = 17, - GPIOC2_IRQn = 18, - GPIOC3_IRQn = 19, - GPIOC4_IRQn = 20, - GPIOC5_IRQn = 21, - GPIOC6_IRQn = 22, - GPIOC7_IRQn = 23, - GPIOM0_IRQn = 24, - GPIOM1_IRQn = 25, - GPIOM2_IRQn = 26, - GPIOM3_IRQn = 27, - GPIOM4_IRQn = 28, - GPIOM5_IRQn = 29, - GPIOM6_IRQn = 30, - GPIOM7_IRQn = 31, - DMA_IRQn = 32, - LCD_IRQn = 33, - NORFLC_IRQn = 34, - CAN_IRQn = 35, - PULSE_IRQn = 36, - WDT_IRQn = 37, - PWM_IRQn = 38, - UART0_IRQn = 39, - UART1_IRQn = 40, - UART2_IRQn = 41, - UART3_IRQn = 42, - UART4_IRQn = 43, - I2C0_IRQn = 44, - I2C1_IRQn = 45, - SPI0_IRQn = 46, - ADC0_IRQn = 47, - RTC_IRQn = 48, - BOD_IRQn = 49, - SDIO_IRQn = 50, - GPIOA_IRQn = 51, - GPIOB_IRQn = 52, - GPIOC_IRQn = 53, - GPIOM_IRQn = 54, - GPION_IRQn = 55, - GPIOP_IRQn = 56, - ADC1_IRQn = 57, - FPU_IRQn = 58, - SPI1_IRQn = 59, - TIMR0_IRQn = 60, - TIMR1_IRQn = 61, - TIMR2_IRQn = 62, - TIMR3_IRQn = 63, - TIMR4_IRQn = 64, - TIMR5_IRQn = 65, +/****** Cortex-M0 Processor Exceptions Numbers **********************************************/ + NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ + MemoryManagement_IRQn = -12, /*!< 4 Cortex-M4 Memory Management Interrupt */ + BusFault_IRQn = -11, /*!< 5 Cortex-M4 Bus Fault Interrupt */ + UsageFault_IRQn = -10, /*!< 6 Cortex-M4 Usage Fault Interrupt */ + SVCall_IRQn = -5, /*!< 11 Cortex-M4 SV Call Interrupt */ + DebugMonitor_IRQn = -4, /*!< 12 Cortex-M4 Debug Monitor Interrupt */ + PendSV_IRQn = -2, /*!< 14 Cortex-M4 Pend SV Interrupt */ + SysTick_IRQn = -1, /*!< 15 Cortex-M4 System Tick Interrupt */ + +/****** Cortex-M4 specific Interrupt Numbers ************************************************/ + GPIOA0_IRQn = 0, + GPIOA1_IRQn = 1, + GPIOA2_IRQn = 2, + GPIOA3_IRQn = 3, + GPIOA4_IRQn = 4, + GPIOA5_IRQn = 5, + GPIOA6_IRQn = 6, + GPIOA7_IRQn = 7, + GPIOB0_IRQn = 8, + GPIOB1_IRQn = 9, + GPIOB2_IRQn = 10, + GPIOB3_IRQn = 11, + GPIOB4_IRQn = 12, + GPIOB5_IRQn = 13, + GPIOB6_IRQn = 14, + GPIOB7_IRQn = 15, + GPIOC0_IRQn = 16, + GPIOC1_IRQn = 17, + GPIOC2_IRQn = 18, + GPIOC3_IRQn = 19, + GPIOC4_IRQn = 20, + GPIOC5_IRQn = 21, + GPIOC6_IRQn = 22, + GPIOC7_IRQn = 23, + GPIOM0_IRQn = 24, + GPIOM1_IRQn = 25, + GPIOM2_IRQn = 26, + GPIOM3_IRQn = 27, + GPIOM4_IRQn = 28, + GPIOM5_IRQn = 29, + GPIOM6_IRQn = 30, + GPIOM7_IRQn = 31, + DMA_IRQn = 32, + LCD_IRQn = 33, + NORFLC_IRQn = 34, + CAN_IRQn = 35, + PULSE_IRQn = 36, + WDT_IRQn = 37, + PWM_IRQn = 38, + UART0_IRQn = 39, + UART1_IRQn = 40, + UART2_IRQn = 41, + UART3_IRQn = 42, + UART4_IRQn = 43, + I2C0_IRQn = 44, + I2C1_IRQn = 45, + SPI0_IRQn = 46, + ADC0_IRQn = 47, + RTC_IRQn = 48, + BOD_IRQn = 49, + SDIO_IRQn = 50, + GPIOA_IRQn = 51, + GPIOB_IRQn = 52, + GPIOC_IRQn = 53, + GPIOM_IRQn = 54, + GPION_IRQn = 55, + GPIOP_IRQn = 56, + ADC1_IRQn = 57, + FPU_IRQn = 58, + SPI1_IRQn = 59, + TIMR0_IRQn = 60, + TIMR1_IRQn = 61, + TIMR2_IRQn = 62, + TIMR3_IRQn = 63, + TIMR4_IRQn = 64, + TIMR5_IRQn = 65, } IRQn_Type; /* @@ -94,3454 +94,3512 @@ typedef enum IRQn */ /* Configuration of the Cortex-M0 Processor and Core Peripherals */ -#define __CM4_REV 0x0001 /*!< Core revision r0p1 */ -#define __MPU_PRESENT 1 /*!< SWM320 provides an MPU */ -#define __NVIC_PRIO_BITS 3 /*!< SWM320 uses 3 Bits for the Priority Levels */ -#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ -#define __FPU_PRESENT 0 /*!< FPU present */ +#define __CM4_REV 0x0001 /*!< Core revision r0p1 */ +#define __MPU_PRESENT 1 /*!< SWM320 provides an MPU */ +#define __NVIC_PRIO_BITS 3 /*!< SWM320 uses 3 Bits for the Priority Levels */ +#define __Vendor_SysTickConfig 0 /*!< Set to 1 if different SysTick Config is used */ +#define __FPU_PRESENT 0 /*!< FPU present */ -#if defined(__CC_ARM) -#pragma anon_unions +#if defined ( __CC_ARM ) + #pragma anon_unions #endif #include -#include "core_cm4.h" /* Cortex-M0 processor and core peripherals */ +#include "core_cm4.h" /* Cortex-M0 processor and core peripherals */ #include "system_SWM320.h" + /******************************************************************************/ /* Device Specific Peripheral registers structures */ /******************************************************************************/ -typedef struct -{ - __IO uint32_t CLKSEL; //Clock Select +typedef struct { + __IO uint32_t CLKSEL; //Clock Select - __IO uint32_t CLKDIV; + __IO uint32_t CLKDIV; - __IO uint32_t CLKEN; //Clock Enable + __IO uint32_t CLKEN; //Clock Enable - __IO uint32_t SLEEP; + __IO uint32_t SLEEP; + + uint32_t RESERVED0[6]; + + __IO uint32_t RTCBKP_ISO; //[0] 1 RTC备份电源域处于隔离状态 0 RTC备份电源域可访问 + + __IO uint32_t RTCWKEN; //[0] 1 使能RTC唤醒功能 - uint32_t RESERVED0[6]; + uint32_t RESERVED[52+64]; - __IO uint32_t RTCBKP_ISO; //[0] 1 RTC澶囦唤鐢垫簮鍩熷浜庨殧绂荤姸鎬 0 RTC澶囦唤鐢垫簮鍩熷彲璁块棶 + __IO uint32_t PAWKEN; //Port A Wakeup Enable + __IO uint32_t PBWKEN; + __IO uint32_t PCWKEN; + + uint32_t RESERVED2[1+4]; - __IO uint32_t RTCWKEN; //[0] 1 浣胯兘RTC鍞ら啋鍔熻兘 + __IO uint32_t PAWKSR; //Port A Wakeup Status Register,写1清零 + __IO uint32_t PBWKSR; + __IO uint32_t PCWKSR; - uint32_t RESERVED[52 + 64]; + uint32_t RESERVED3[64-10]; - __IO uint32_t PAWKEN; //Port A Wakeup Enable - __IO uint32_t PBWKEN; - __IO uint32_t PCWKEN; + __IO uint32_t RSTCR; //Reset Control Register + __IO uint32_t RSTSR; //Reset Status Register - uint32_t RESERVED2[1 + 4]; - - __IO uint32_t PAWKSR; //Port A Wakeup Status Register锛屽啓1娓呴浂 - __IO uint32_t PBWKSR; - __IO uint32_t PCWKSR; - - uint32_t RESERVED3[64 - 10]; - - __IO uint32_t RSTCR; //Reset Control Register - __IO uint32_t RSTSR; //Reset Status Register - - uint32_t RESERVED4[61 + 64]; - - __IO uint32_t BKP[3]; //鏁版嵁澶囦唤瀵勫瓨鍣 + uint32_t RESERVED4[61+64]; + __IO uint32_t BKP[3]; //数据备份寄存器 + //RTC Power Domain: 0x4001E000 - uint32_t RESERVED5[(0x4001E000 - 0x40000508) / 4 - 1]; - - __IO uint32_t RTCBKP[8]; //RTC鐢垫簮鍩熸暟鎹浠藉瘎瀛樺櫒 - - __IO uint32_t LRCCR; //Low speed RC Control Register - __IO uint32_t LRCTRIM0; //Low speed RC Trim + uint32_t RESERVED5[(0x4001E000-0x40000508)/4-1]; + + __IO uint32_t RTCBKP[8]; //RTC电源域数据备份寄存器 + + __IO uint32_t LRCCR; //Low speed RC Control Register + __IO uint32_t LRCTRIM0; //Low speed RC Trim __IO uint32_t LRCTRIM1; - - uint32_t RESERVED6; - - __IO uint32_t RTCLDOTRIM; //RTC Power Domain LDO Trim - + + uint32_t RESERVED6; + + __IO uint32_t RTCLDOTRIM; //RTC Power Domain LDO Trim + //Analog Control: 0x40031000 - uint32_t RESERVED7[(0x40031000 - 0x4001E030) / 4 - 1]; - - __IO uint32_t HRCCR; //High speed RC Control Register - - uint32_t RESERVED8[7]; - + uint32_t RESERVED7[(0x40031000-0x4001E030)/4-1]; + + __IO uint32_t HRCCR; //High speed RC Control Register + + uint32_t RESERVED8[7]; + __IO uint32_t XTALCR; - + __IO uint32_t PLLCR; __IO uint32_t PLLDIV; __IO uint32_t PLLSET; - __IO uint32_t PLLLOCK; //[0] 1 PLL宸查攣瀹 - + __IO uint32_t PLLLOCK; //[0] 1 PLL已锁定 + __IO uint32_t BODIE; __IO uint32_t BODIF; - - __IO uint32_t ADC1IN7; + + __IO uint32_t ADC1IN7; } SYS_TypeDef; -#define SYS_CLKSEL_LFCK_Pos 0 //Low Frequency Clock Source 0 LRC 1 PLL -#define SYS_CLKSEL_LFCK_Msk (0x01 << SYS_CLKSEL_LFCK_Pos) -#define SYS_CLKSEL_HFCK_Pos 1 //High Frequency Clock Source 0 HRC 1 XTAL -#define SYS_CLKSEL_HFCK_Msk (0x01 << SYS_CLKSEL_HFCK_Pos) -#define SYS_CLKSEL_SYS_Pos 2 //绯荤粺鏃堕挓閫夋嫨 0 LFCK 1 HFCK -#define SYS_CLKSEL_SYS_Msk (0x01 << SYS_CLKSEL_SYS_Pos) -#define SYS_CLKDIV_SYS_Pos 0 //绯荤粺鏃堕挓鍒嗛 0 1鍒嗛 1 2鍒嗛 -#define SYS_CLKDIV_SYS_Msk (0x01 << SYS_CLKDIV_SYS_Pos) -#define SYS_CLKDIV_PWM_Pos 1 //PWM 鏃堕挓鍒嗛 0 1鍒嗛 1 8鍒嗛 -#define SYS_CLKDIV_PWM_Msk (0x01 << SYS_CLKDIV_PWM_Pos) -#define SYS_CLKDIV_SDRAM_Pos 2 //SDRAM鏃堕挓鍒嗛 0 1鍒嗛 1 2鍒嗛 2 4鍒嗛 -#define SYS_CLKDIV_SDRAM_Msk (0x03 << SYS_CLKDIV_SDRAM_Pos) -#define SYS_CLKDIV_SDIO_Pos 4 //SDIO鏃堕挓鍒嗛 0 1鍒嗛 1 2鍒嗛 2 4鍒嗛 3 8鍒嗛 -#define SYS_CLKDIV_SDIO_Msk (0x03 << SYS_CLKDIV_SDIO_Pos) +#define SYS_CLKSEL_LFCK_Pos 0 //Low Frequency Clock Source 0 LRC 1 PLL +#define SYS_CLKSEL_LFCK_Msk (0x01 << SYS_CLKSEL_LFCK_Pos) +#define SYS_CLKSEL_HFCK_Pos 1 //High Frequency Clock Source 0 HRC 1 XTAL +#define SYS_CLKSEL_HFCK_Msk (0x01 << SYS_CLKSEL_HFCK_Pos) +#define SYS_CLKSEL_SYS_Pos 2 //系统时钟选择 0 LFCK 1 HFCK +#define SYS_CLKSEL_SYS_Msk (0x01 << SYS_CLKSEL_SYS_Pos) -#define SYS_CLKEN_GPIOA_Pos 0 -#define SYS_CLKEN_GPIOA_Msk (0x01 << SYS_CLKEN_GPIOA_Pos) -#define SYS_CLKEN_GPIOB_Pos 1 -#define SYS_CLKEN_GPIOB_Msk (0x01 << SYS_CLKEN_GPIOB_Pos) -#define SYS_CLKEN_GPIOC_Pos 2 -#define SYS_CLKEN_GPIOC_Msk (0x01 << SYS_CLKEN_GPIOC_Pos) -#define SYS_CLKEN_GPIOM_Pos 4 -#define SYS_CLKEN_GPIOM_Msk (0x01 << SYS_CLKEN_GPIOM_Pos) -#define SYS_CLKEN_GPION_Pos 5 -#define SYS_CLKEN_GPION_Msk (0x01 << SYS_CLKEN_GPION_Pos) -#define SYS_CLKEN_TIMR_Pos 6 -#define SYS_CLKEN_TIMR_Msk (0x01 << SYS_CLKEN_TIMR_Pos) -#define SYS_CLKEN_WDT_Pos 7 -#define SYS_CLKEN_WDT_Msk (0x01 << SYS_CLKEN_WDT_Pos) -#define SYS_CLKEN_ADC0_Pos 8 -#define SYS_CLKEN_ADC0_Msk (0x01 << SYS_CLKEN_ADC0_Pos) -#define SYS_CLKEN_PWM_Pos 9 -#define SYS_CLKEN_PWM_Msk (0x01 << SYS_CLKEN_PWM_Pos) -#define SYS_CLKEN_RTC_Pos 10 -#define SYS_CLKEN_RTC_Msk (0x01 << SYS_CLKEN_RTC_Pos) -#define SYS_CLKEN_UART0_Pos 11 -#define SYS_CLKEN_UART0_Msk (0x01 << SYS_CLKEN_UART0_Pos) -#define SYS_CLKEN_UART1_Pos 12 -#define SYS_CLKEN_UART1_Msk (0x01 << SYS_CLKEN_UART1_Pos) -#define SYS_CLKEN_UART2_Pos 13 -#define SYS_CLKEN_UART2_Msk (0x01 << SYS_CLKEN_UART2_Pos) -#define SYS_CLKEN_UART3_Pos 14 -#define SYS_CLKEN_UART3_Msk (0x01 << SYS_CLKEN_UART3_Pos) -#define SYS_CLKEN_UART4_Pos 15 -#define SYS_CLKEN_UART4_Msk (0x01 << SYS_CLKEN_UART4_Pos) -#define SYS_CLKEN_SPI0_Pos 16 -#define SYS_CLKEN_SPI0_Msk (0x01 << SYS_CLKEN_SPI0_Pos) -#define SYS_CLKEN_I2C0_Pos 17 -#define SYS_CLKEN_I2C0_Msk (0x01 << SYS_CLKEN_I2C0_Pos) -#define SYS_CLKEN_I2C1_Pos 18 -#define SYS_CLKEN_I2C1_Msk (0x01 << SYS_CLKEN_I2C1_Pos) -#define SYS_CLKEN_I2C2_Pos 19 -#define SYS_CLKEN_I2C2_Msk (0x01 << SYS_CLKEN_I2C2_Pos) -#define SYS_CLKEN_LCD_Pos 20 -#define SYS_CLKEN_LCD_Msk (0x01 << SYS_CLKEN_LCD_Pos) -#define SYS_CLKEN_GPIOP_Pos 21 -#define SYS_CLKEN_GPIOP_Msk (0x01 << SYS_CLKEN_GPIOP_Pos) -#define SYS_CLKEN_ANAC_Pos 22 //妯℃嫙鎺у埗鍗曞厓鏃堕挓浣胯兘 -#define SYS_CLKEN_ANAC_Msk (0x01 << SYS_CLKEN_ANAC_Pos) -#define SYS_CLKEN_CRC_Pos 23 -#define SYS_CLKEN_CRC_Msk (0x01 << SYS_CLKEN_CRC_Pos) -#define SYS_CLKEN_RTCBKP_Pos 24 -#define SYS_CLKEN_RTCBKP_Msk (0x01 << SYS_CLKEN_RTCBKP_Pos) -#define SYS_CLKEN_CAN_Pos 25 -#define SYS_CLKEN_CAN_Msk (0x01 << SYS_CLKEN_CAN_Pos) -#define SYS_CLKEN_SDRAM_Pos 26 -#define SYS_CLKEN_SDRAM_Msk (0x01 << SYS_CLKEN_SDRAM_Pos) -#define SYS_CLKEN_NORFL_Pos 27 //NOR Flash -#define SYS_CLKEN_NORFL_Msk (0x01 << SYS_CLKEN_NORFL_Pos) -#define SYS_CLKEN_RAMC_Pos 28 -#define SYS_CLKEN_RAMC_Msk (0x01 << SYS_CLKEN_RAMC_Pos) -#define SYS_CLKEN_SDIO_Pos 29 -#define SYS_CLKEN_SDIO_Msk (0x01 << SYS_CLKEN_SDIO_Pos) -#define SYS_CLKEN_ADC1_Pos 30 -#define SYS_CLKEN_ADC1_Msk (0x01 << SYS_CLKEN_ADC1_Pos) -#define SYS_CLKEN_ALIVE_Pos 31 //CHIPALIVE鐢垫簮鍩熺郴缁熸椂閽熶娇鑳 -#define SYS_CLKEN_ALIVE_Msk (0x01 << SYS_CLKEN_ALIVE_Pos) +#define SYS_CLKDIV_SYS_Pos 0 //系统时钟分频 0 1分频 1 2分频 +#define SYS_CLKDIV_SYS_Msk (0x01 << SYS_CLKDIV_SYS_Pos) +#define SYS_CLKDIV_PWM_Pos 1 //PWM 时钟分频 0 1分频 1 8分频 +#define SYS_CLKDIV_PWM_Msk (0x01 << SYS_CLKDIV_PWM_Pos) +#define SYS_CLKDIV_SDRAM_Pos 2 //SDRAM时钟分频 0 1分频 1 2分频 2 4分频 +#define SYS_CLKDIV_SDRAM_Msk (0x03 << SYS_CLKDIV_SDRAM_Pos) +#define SYS_CLKDIV_SDIO_Pos 4 //SDIO时钟分频 0 1分频 1 2分频 2 4分频 3 8分频 +#define SYS_CLKDIV_SDIO_Msk (0x03 << SYS_CLKDIV_SDIO_Pos) -#define SYS_SLEEP_SLEEP_Pos 0 //灏嗚浣嶇疆1鍚庯紝绯荤粺灏嗚繘鍏LEEP妯″紡 -#define SYS_SLEEP_SLEEP_Msk (0x01 << SYS_SLEEP_SLEEP_Pos) -#define SYS_SLEEP_DEEP_Pos 1 //灏嗚浣嶇疆1鍚庯紝绯荤粺灏嗚繘鍏TOP SLEEP妯″紡 -#define SYS_SLEEP_DEEP_Msk (0x01 << SYS_SLEEP_DEEP_Pos) +#define SYS_CLKEN_GPIOA_Pos 0 +#define SYS_CLKEN_GPIOA_Msk (0x01 << SYS_CLKEN_GPIOA_Pos) +#define SYS_CLKEN_GPIOB_Pos 1 +#define SYS_CLKEN_GPIOB_Msk (0x01 << SYS_CLKEN_GPIOB_Pos) +#define SYS_CLKEN_GPIOC_Pos 2 +#define SYS_CLKEN_GPIOC_Msk (0x01 << SYS_CLKEN_GPIOC_Pos) +#define SYS_CLKEN_GPIOM_Pos 4 +#define SYS_CLKEN_GPIOM_Msk (0x01 << SYS_CLKEN_GPIOM_Pos) +#define SYS_CLKEN_GPION_Pos 5 +#define SYS_CLKEN_GPION_Msk (0x01 << SYS_CLKEN_GPION_Pos) +#define SYS_CLKEN_TIMR_Pos 6 +#define SYS_CLKEN_TIMR_Msk (0x01 << SYS_CLKEN_TIMR_Pos) +#define SYS_CLKEN_WDT_Pos 7 +#define SYS_CLKEN_WDT_Msk (0x01 << SYS_CLKEN_WDT_Pos) +#define SYS_CLKEN_ADC0_Pos 8 +#define SYS_CLKEN_ADC0_Msk (0x01 << SYS_CLKEN_ADC0_Pos) +#define SYS_CLKEN_PWM_Pos 9 +#define SYS_CLKEN_PWM_Msk (0x01 << SYS_CLKEN_PWM_Pos) +#define SYS_CLKEN_RTC_Pos 10 +#define SYS_CLKEN_RTC_Msk (0x01 << SYS_CLKEN_RTC_Pos) +#define SYS_CLKEN_UART0_Pos 11 +#define SYS_CLKEN_UART0_Msk (0x01 << SYS_CLKEN_UART0_Pos) +#define SYS_CLKEN_UART1_Pos 12 +#define SYS_CLKEN_UART1_Msk (0x01 << SYS_CLKEN_UART1_Pos) +#define SYS_CLKEN_UART2_Pos 13 +#define SYS_CLKEN_UART2_Msk (0x01 << SYS_CLKEN_UART2_Pos) +#define SYS_CLKEN_UART3_Pos 14 +#define SYS_CLKEN_UART3_Msk (0x01 << SYS_CLKEN_UART3_Pos) +#define SYS_CLKEN_UART4_Pos 15 +#define SYS_CLKEN_UART4_Msk (0x01 << SYS_CLKEN_UART4_Pos) +#define SYS_CLKEN_SPI0_Pos 16 +#define SYS_CLKEN_SPI0_Msk (0x01 << SYS_CLKEN_SPI0_Pos) +#define SYS_CLKEN_I2C0_Pos 17 +#define SYS_CLKEN_I2C0_Msk (0x01 << SYS_CLKEN_I2C0_Pos) +#define SYS_CLKEN_I2C1_Pos 18 +#define SYS_CLKEN_I2C1_Msk (0x01 << SYS_CLKEN_I2C1_Pos) +#define SYS_CLKEN_I2C2_Pos 19 +#define SYS_CLKEN_I2C2_Msk (0x01 << SYS_CLKEN_I2C2_Pos) +#define SYS_CLKEN_LCD_Pos 20 +#define SYS_CLKEN_LCD_Msk (0x01 << SYS_CLKEN_LCD_Pos) +#define SYS_CLKEN_GPIOP_Pos 21 +#define SYS_CLKEN_GPIOP_Msk (0x01 << SYS_CLKEN_GPIOP_Pos) +#define SYS_CLKEN_ANAC_Pos 22 //模拟控制单元时钟使能 +#define SYS_CLKEN_ANAC_Msk (0x01 << SYS_CLKEN_ANAC_Pos) +#define SYS_CLKEN_CRC_Pos 23 +#define SYS_CLKEN_CRC_Msk (0x01 << SYS_CLKEN_CRC_Pos) +#define SYS_CLKEN_RTCBKP_Pos 24 +#define SYS_CLKEN_RTCBKP_Msk (0x01 << SYS_CLKEN_RTCBKP_Pos) +#define SYS_CLKEN_CAN_Pos 25 +#define SYS_CLKEN_CAN_Msk (0x01 << SYS_CLKEN_CAN_Pos) +#define SYS_CLKEN_SDRAM_Pos 26 +#define SYS_CLKEN_SDRAM_Msk (0x01 << SYS_CLKEN_SDRAM_Pos) +#define SYS_CLKEN_NORFL_Pos 27 //NOR Flash +#define SYS_CLKEN_NORFL_Msk (0x01 << SYS_CLKEN_NORFL_Pos) +#define SYS_CLKEN_RAMC_Pos 28 +#define SYS_CLKEN_RAMC_Msk (0x01 << SYS_CLKEN_RAMC_Pos) +#define SYS_CLKEN_SDIO_Pos 29 +#define SYS_CLKEN_SDIO_Msk (0x01 << SYS_CLKEN_SDIO_Pos) +#define SYS_CLKEN_ADC1_Pos 30 +#define SYS_CLKEN_ADC1_Msk (0x01 << SYS_CLKEN_ADC1_Pos) +#define SYS_CLKEN_ALIVE_Pos 31 //CHIPALIVE电源域系统时钟使能 +#define SYS_CLKEN_ALIVE_Msk (0x01 << SYS_CLKEN_ALIVE_Pos) -#define SYS_RSTCR_SYS_Pos 0 //鍐1杩涜绯荤粺澶嶄綅锛岀‖浠惰嚜鍔ㄦ竻闆 -#define SYS_RSTCR_SYS_Msk (0x01 << SYS_RSTCR_SYS_Pos) -#define SYS_RSTCR_FLASH_Pos 1 //鍐1瀵笷LASH鎺у埗鍣ㄨ繘琛屼竴娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_FLASH_Msk (0x01 << SYS_RSTCR_FLASH_Pos) -#define SYS_RSTCR_PWM_Pos 2 //鍐1瀵筆WM杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_PWM_Msk (0x01 << SYS_RSTCR_PWM_Pos) -#define SYS_RSTCR_CPU_Pos 3 //鍐1瀵笴PU杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_CPU_Msk (0x01 << SYS_RSTCR_CPU_Pos) -#define SYS_RSTCR_DMA_Pos 4 //鍐1瀵笵MA杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_DMA_Msk (0x01 << SYS_RSTCR_DMA_Pos) -#define SYS_RSTCR_NORFLASH_Pos 5 //鍐1瀵筃OR Flash鎺у埗鍣ㄨ繘琛屼竴娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_NORFLASH_Msk (0x01 << SYS_RSTCR_NORFLASH_Pos) -#define SYS_RSTCR_SRAM_Pos 6 //鍐1瀵筍RAM鎺у埗鍣ㄨ繘琛屼竴娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_SRAM_Msk (0x01 << SYS_RSTCR_SRAM_Pos) -#define SYS_RSTCR_SDRAM_Pos 7 //鍐1瀵筍DRAM鎺у埗鍣ㄨ繘琛屼竴娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_SDRAM_Msk (0x01 << SYS_RSTCR_SDRAM_Pos) -#define SYS_RSTCR_SDIO_Pos 8 //鍐1瀵筍DIO杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_SDIO_Msk (0x01 << SYS_RSTCR_SDIO_Pos) -#define SYS_RSTCR_LCD_Pos 9 //鍐1瀵筁CD杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_LCD_Msk (0x01 << SYS_RSTCR_LCD_Pos) -#define SYS_RSTCR_CAN_Pos 10 //鍐1瀵笴AN杩涜涓娆″浣嶏紝纭欢鑷姩娓呴浂 -#define SYS_RSTCR_CAN_Msk (0x01 << SYS_RSTCR_CAN_Pos) +#define SYS_SLEEP_SLEEP_Pos 0 //将该位置1后,系统将进入SLEEP模式 +#define SYS_SLEEP_SLEEP_Msk (0x01 << SYS_SLEEP_SLEEP_Pos) +#define SYS_SLEEP_DEEP_Pos 1 //将该位置1后,系统将进入STOP SLEEP模式 +#define SYS_SLEEP_DEEP_Msk (0x01 << SYS_SLEEP_DEEP_Pos) -#define SYS_RSTSR_POR_Pos 0 //1 鍑虹幇杩嘝OR澶嶄綅锛屽啓1娓呴浂 -#define SYS_RSTSR_POR_Msk (0x01 << SYS_RSTSR_POR_Pos) -#define SYS_RSTSR_BOD_Pos 1 //1 鍑虹幇杩嘊OD澶嶄綅锛屽啓1娓呴浂 -#define SYS_RSTSR_BOD_Msk (0x01 << SYS_RSTSR_BOD_Pos) -#define SYS_RSTSR_PIN_Pos 2 //1 鍑虹幇杩囧閮ㄥ紩鑴氬浣嶏紝鍐1娓呴浂 -#define SYS_RSTSR_PIN_Msk (0x01 << SYS_RSTSR_PIN_Pos) -#define SYS_RSTSR_WDT_Pos 3 //1 鍑虹幇杩嘩DT澶嶄綅锛屽啓1娓呴浂 -#define SYS_RSTSR_WDT_Msk (0x01 << SYS_RSTSR_WDT_Pos) -#define SYS_RSTSR_SWRST_Pos 4 //Software Reset, 1 鍑虹幇杩囪蒋浠跺浣嶏紝鍐1娓呴浂 -#define SYS_RSTSR_SWRST_Msk (0x01 << SYS_RSTSR_SWRST_Pos) +#define SYS_RSTCR_SYS_Pos 0 //写1进行系统复位,硬件自动清零 +#define SYS_RSTCR_SYS_Msk (0x01 << SYS_RSTCR_SYS_Pos) +#define SYS_RSTCR_FLASH_Pos 1 //写1对FLASH控制器进行一次复位,硬件自动清零 +#define SYS_RSTCR_FLASH_Msk (0x01 << SYS_RSTCR_FLASH_Pos) +#define SYS_RSTCR_PWM_Pos 2 //写1对PWM进行一次复位,硬件自动清零 +#define SYS_RSTCR_PWM_Msk (0x01 << SYS_RSTCR_PWM_Pos) +#define SYS_RSTCR_CPU_Pos 3 //写1对CPU进行一次复位,硬件自动清零 +#define SYS_RSTCR_CPU_Msk (0x01 << SYS_RSTCR_CPU_Pos) +#define SYS_RSTCR_DMA_Pos 4 //写1对DMA进行一次复位,硬件自动清零 +#define SYS_RSTCR_DMA_Msk (0x01 << SYS_RSTCR_DMA_Pos) +#define SYS_RSTCR_NORFLASH_Pos 5 //写1对NOR Flash控制器进行一次复位,硬件自动清零 +#define SYS_RSTCR_NORFLASH_Msk (0x01 << SYS_RSTCR_NORFLASH_Pos) +#define SYS_RSTCR_SRAM_Pos 6 //写1对SRAM控制器进行一次复位,硬件自动清零 +#define SYS_RSTCR_SRAM_Msk (0x01 << SYS_RSTCR_SRAM_Pos) +#define SYS_RSTCR_SDRAM_Pos 7 //写1对SDRAM控制器进行一次复位,硬件自动清零 +#define SYS_RSTCR_SDRAM_Msk (0x01 << SYS_RSTCR_SDRAM_Pos) +#define SYS_RSTCR_SDIO_Pos 8 //写1对SDIO进行一次复位,硬件自动清零 +#define SYS_RSTCR_SDIO_Msk (0x01 << SYS_RSTCR_SDIO_Pos) +#define SYS_RSTCR_LCD_Pos 9 //写1对LCD进行一次复位,硬件自动清零 +#define SYS_RSTCR_LCD_Msk (0x01 << SYS_RSTCR_LCD_Pos) +#define SYS_RSTCR_CAN_Pos 10 //写1对CAN进行一次复位,硬件自动清零 +#define SYS_RSTCR_CAN_Msk (0x01 << SYS_RSTCR_CAN_Pos) -#define SYS_LRCCR_OFF_Pos 0 //Low Speed RC Off -#define SYS_LRCCR_OFF_Msk (0x01 << SYS_LRCCR_OFF_Pos) +#define SYS_RSTSR_POR_Pos 0 //1 出现过POR复位,写1清零 +#define SYS_RSTSR_POR_Msk (0x01 << SYS_RSTSR_POR_Pos) +#define SYS_RSTSR_BOD_Pos 1 //1 出现过BOD复位,写1清零 +#define SYS_RSTSR_BOD_Msk (0x01 << SYS_RSTSR_BOD_Pos) +#define SYS_RSTSR_PIN_Pos 2 //1 出现过外部引脚复位,写1清零 +#define SYS_RSTSR_PIN_Msk (0x01 << SYS_RSTSR_PIN_Pos) +#define SYS_RSTSR_WDT_Pos 3 //1 出现过WDT复位,写1清零 +#define SYS_RSTSR_WDT_Msk (0x01 << SYS_RSTSR_WDT_Pos) +#define SYS_RSTSR_SWRST_Pos 4 //Software Reset, 1 出现过软件复位,写1清零 +#define SYS_RSTSR_SWRST_Msk (0x01 << SYS_RSTSR_SWRST_Pos) -#define SYS_LRCTRIM0_R_Pos 0 //LRC绮楄皟鎺у埗浣 -#define SYS_LRCTRIM0_R_Msk (0x7FFF << SYS_LRCTRIM0_R_Pos) -#define SYS_LRCTRIM0_M_Pos 15 //LRC涓皟鎺у埗浣 -#define SYS_LRCTRIM0_M_Msk (0x3F << SYS_LRCTRIM2_M_Pos) -#define SYS_LRCTRIM0_F_Pos 21 //LRC缁嗚皟鎺у埗浣 -#define SYS_LRCTRIM0_F_Msk (0x7FF << SYS_LRCTRIM0_F_Pos) +#define SYS_LRCCR_OFF_Pos 0 //Low Speed RC Off +#define SYS_LRCCR_OFF_Msk (0x01 << SYS_LRCCR_OFF_Pos) -#define SYS_LRCTRIM1_U_Pos 0 //LRC U璋冩帶鍒朵綅 -#define SYS_LRCTRIM1_U_Msk (0x7FFF << SYS_LRCTRIM1_U_Pos) +#define SYS_LRCTRIM0_R_Pos 0 //LRC粗调控制位 +#define SYS_LRCTRIM0_R_Msk (0x7FFF << SYS_LRCTRIM0_R_Pos) +#define SYS_LRCTRIM0_M_Pos 15 //LRC中调控制位 +#define SYS_LRCTRIM0_M_Msk (0x3F << SYS_LRCTRIM2_M_Pos) +#define SYS_LRCTRIM0_F_Pos 21 //LRC细调控制位 +#define SYS_LRCTRIM0_F_Msk (0x7FF << SYS_LRCTRIM0_F_Pos) -#define SYS_HRCCR_DBL_Pos 0 //Double Frequency 0 20MHz 1 40MHz -#define SYS_HRCCR_DBL_Msk (0x01 << SYS_HRCCR_DBL_Pos) -#define SYS_HRCCR_OFF_Pos 1 //High speed RC Off -#define SYS_HRCCR_OFF_Msk (0x01 << SYS_HRCCR_OFF_Pos) +#define SYS_LRCTRIM1_U_Pos 0 //LRC U调控制位 +#define SYS_LRCTRIM1_U_Msk (0x7FFF << SYS_LRCTRIM1_U_Pos) -#define SYS_XTALCR_EN_Pos 0 -#define SYS_XTALCR_EN_Msk (0x01 << SYS_XTALCR_EN_Pos) -#define SYS_PLLCR_OUTEN_Pos 0 //鍙兘LOCK鍚庤缃 -#define SYS_PLLCR_OUTEN_Msk (0x01 << SYS_PLLCR_OUTEN_Pos) -#define SYS_PLLCR_INSEL_Pos 1 //0 XTAL 1 HRC -#define SYS_PLLCR_INSEL_Msk (0x01 << SYS_PLLCR_INSEL_Pos) -#define SYS_PLLCR_OFF_Pos 2 -#define SYS_PLLCR_OFF_Msk (0x01 << SYS_PLLCR_OFF_Pos) +#define SYS_HRCCR_DBL_Pos 0 //Double Frequency 0 20MHz 1 40MHz +#define SYS_HRCCR_DBL_Msk (0x01 << SYS_HRCCR_DBL_Pos) +#define SYS_HRCCR_OFF_Pos 1 //High speed RC Off +#define SYS_HRCCR_OFF_Msk (0x01 << SYS_HRCCR_OFF_Pos) -#define SYS_PLLDIV_FBDIV_Pos 0 //PLL FeedBack鍒嗛瀵勫瓨鍣 \ - //VCO杈撳嚭棰戠巼 = PLL杈撳叆鏃堕挓 / INDIV * 4 * FBDIV \ - //PLL杈撳嚭棰戠巼 = PLL杈撳叆鏃堕挓 / INDIV * 4 * FBDIV / OUTDIV = VCO杈撳嚭棰戠巼 / OUTDIV -#define SYS_PLLDIV_FBDIV_Msk (0x1FF << SYS_PLLDIV_FBDIV_Pos) -#define SYS_PLLDIV_ADDIV_Pos 9 //ADC鏃堕挓鍩猴紙鍗砎CO杈撳嚭鍒嗛鍚庣殑鏃堕挓锛夌粡ADDIV鍒嗛鍚庝綔涓篈DC鐨勮浆鎹㈡椂閽 -#define SYS_PLLDIV_ADDIV_Msk (0x1F << SYS_PLLDIV_ADDIV_Pos) -#define SYS_PLLDIV_ADVCO_Pos 14 //0 VCO杈撳嚭16鍒嗛浣滀负ADC鏃堕挓鍩 1 VCO杈撳嚭缁忚繃32鍒嗛浣滀负ADC鏃堕挓鍩 2 VCO杈撳嚭缁忚繃64鍒嗛浣滀负ADC鏃堕挓鍩 -#define SYS_PLLDIV_ADVCO_Msk (0x03 << SYS_PLLDIV_ADVCO_Pos) -#define SYS_PLLDIV_INDIV_Pos 16 //PLL 杈撳叆婧愭椂閽熷垎棰 -#define SYS_PLLDIV_INDIV_Msk (0x1F << SYS_PLLDIV_INDIV_Pos) -#define SYS_PLLDIV_OUTDIV_Pos 24 //PLL 杈撳嚭鍒嗛锛0 8鍒嗛 1 4鍒嗛 0 2鍒嗛 -#define SYS_PLLDIV_OUTDIV_Msk (0x03 << SYS_PLLDIV_OUTDIV_Pos) +#define SYS_XTALCR_EN_Pos 0 +#define SYS_XTALCR_EN_Msk (0x01 << SYS_XTALCR_EN_Pos) -#define SYS_PLLSET_LPFBW_Pos 0 //PLL Low Pass Filter Bandwidth -#define SYS_PLLSET_LPFBW_Msk (0x0F << SYS_PLLSET_LPFBW_Pos) -#define SYS_PLLSET_BIASADJ_Pos 4 //PLL Current Bias Adjustment -#define SYS_PLLSET_BIASADJ_Msk (0x03 << SYS_PLLSET_BIASADJ_Pos) -#define SYS_PLLSET_REFVSEL_Pos 6 //PLL Reference Voltage Select -#define SYS_PLLSET_REFVSEL_Msk (0x03 << SYS_PLLSET_REFVSEL_Pos) -#define SYS_PLLSET_CHPADJL_Pos 8 //PLL charge pump LSB current Adjustment -#define SYS_PLLSET_CHPADJL_Msk (0x07 << SYS_PLLSET_CHPADJL_Pos) -#define SYS_PLLSET_CHPADJM_Pos 11 //PLL charge pump MSB current Adjustment -#define SYS_PLLSET_CHPADJM_Msk (0x03 << SYS_PLLSET_CHPADJM_Pos) +#define SYS_PLLCR_OUTEN_Pos 0 //只能LOCK后设置 +#define SYS_PLLCR_OUTEN_Msk (0x01 << SYS_PLLCR_OUTEN_Pos) +#define SYS_PLLCR_INSEL_Pos 1 //0 XTAL 1 HRC +#define SYS_PLLCR_INSEL_Msk (0x01 << SYS_PLLCR_INSEL_Pos) +#define SYS_PLLCR_OFF_Pos 2 +#define SYS_PLLCR_OFF_Msk (0x01 << SYS_PLLCR_OFF_Pos) -#define SYS_BODIE_2V2_Pos 1 //BOD 2.2V绛夌骇瑙﹀彂涓柇浣胯兘 -#define SYS_BODIE_2V2_Msk (0x01 << SYS_BODIE_2V2_Pos) +#define SYS_PLLDIV_FBDIV_Pos 0 //PLL FeedBack分频寄存器 + //VCO输出频率 = PLL输入时钟 / INDIV * 4 * FBDIV + //PLL输出频率 = PLL输入时钟 / INDIV * 4 * FBDIV / OUTDIV = VCO输出频率 / OUTDIV +#define SYS_PLLDIV_FBDIV_Msk (0x1FF << SYS_PLLDIV_FBDIV_Pos) +#define SYS_PLLDIV_ADDIV_Pos 9 //ADC时钟基(即VCO输出分频后的时钟)经ADDIV分频后作为ADC的转换时钟 +#define SYS_PLLDIV_ADDIV_Msk (0x1F << SYS_PLLDIV_ADDIV_Pos) +#define SYS_PLLDIV_ADVCO_Pos 14 //0 VCO输出16分频作为ADC时钟基 1 VCO输出经过32分频作为ADC时钟基 2 VCO输出经过64分频作为ADC时钟基 +#define SYS_PLLDIV_ADVCO_Msk (0x03 << SYS_PLLDIV_ADVCO_Pos) +#define SYS_PLLDIV_INDIV_Pos 16 //PLL 输入源时钟分频 +#define SYS_PLLDIV_INDIV_Msk (0x1F << SYS_PLLDIV_INDIV_Pos) +#define SYS_PLLDIV_OUTDIV_Pos 24 //PLL 输出分频,0 8分频 1 4分频 0 2分频 +#define SYS_PLLDIV_OUTDIV_Msk (0x03 << SYS_PLLDIV_OUTDIV_Pos) -#define SYS_BODIF_2V2_Pos 1 //BOD 2.2V绛夌骇瑙﹀彂涓柇鐘舵侊紝鍐1娓呴浂 -#define SYS_BODIF_2V2_Msk (0x01 << SYS_BODIF_2V2_Pos) +#define SYS_PLLSET_LPFBW_Pos 0 //PLL Low Pass Filter Bandwidth +#define SYS_PLLSET_LPFBW_Msk (0x0F << SYS_PLLSET_LPFBW_Pos) +#define SYS_PLLSET_BIASADJ_Pos 4 //PLL Current Bias Adjustment +#define SYS_PLLSET_BIASADJ_Msk (0x03 << SYS_PLLSET_BIASADJ_Pos) +#define SYS_PLLSET_REFVSEL_Pos 6 //PLL Reference Voltage Select +#define SYS_PLLSET_REFVSEL_Msk (0x03 << SYS_PLLSET_REFVSEL_Pos) +#define SYS_PLLSET_CHPADJL_Pos 8 //PLL charge pump LSB current Adjustment +#define SYS_PLLSET_CHPADJL_Msk (0x07 << SYS_PLLSET_CHPADJL_Pos) +#define SYS_PLLSET_CHPADJM_Pos 11 //PLL charge pump MSB current Adjustment +#define SYS_PLLSET_CHPADJM_Msk (0x03 << SYS_PLLSET_CHPADJM_Pos) -#define SYS_ADC1IN7_SEL_Pos 0 //ADC1妯″潡妯℃嫙閫氶亾7锛1 娓╁害浼犳劅鍣 2 鐢垫睜鐢靛帇 3 RTC鐢垫簮鍩烞G 4 涓荤數婧愬煙BG 5 PDM33 -#define SYS_ADC1IN7_SEL_Msk (0x0F << SYS_ADC1IN7_SEL_Pos) -#define SYS_ADC1IN7_IOON_Pos 4 //ADC1妯″潡妯℃嫙閫氶亾7鎵鐢↖O寮鍏 -#define SYS_ADC1IN7_IOON_Msk (0x01 << SYS_ADC1IN7_IOON_Pos) +#define SYS_BODIE_2V2_Pos 1 //BOD 2.2V等级触发中断使能 +#define SYS_BODIE_2V2_Msk (0x01 << SYS_BODIE_2V2_Pos) -typedef struct -{ - __IO uint32_t PORTA_SEL; //缁橮ORTA_SEL[2n+2:2n]璧嬬浉搴旂殑鍊硷紝灏哖ORTA.PINn寮曡剼閰嶇疆鎴怗PIO銆佹ā鎷熴佹暟瀛楃瓑鍔熻兘 - //褰撹祴鍊间负PORTA_PINn_FUNMUX鏃讹紝PORTA.PINn寮曡剼鍙氳繃PORTA_MUX瀵勫瓨鍣ㄨ繛鎺ュ埌鍚勭鏁板瓧澶栬 - __IO uint32_t PORTB_SEL; +#define SYS_BODIF_2V2_Pos 1 //BOD 2.2V等级触发中断状态,写1清零 +#define SYS_BODIF_2V2_Msk (0x01 << SYS_BODIF_2V2_Pos) +#define SYS_ADC1IN7_SEL_Pos 0 //ADC1模块模拟通道7,1 温度传感器 2 电池电压 3 RTC电源域BG 4 主电源域BG 5 PDM33 +#define SYS_ADC1IN7_SEL_Msk (0x0F << SYS_ADC1IN7_SEL_Pos) +#define SYS_ADC1IN7_IOON_Pos 4 //ADC1模块模拟通道7所用IO开关 +#define SYS_ADC1IN7_IOON_Msk (0x01 << SYS_ADC1IN7_IOON_Pos) + + + + +typedef struct { + __IO uint32_t PORTA_SEL; //给PORTA_SEL[2n+2:2n]赋相应的值,将PORTA.PINn引脚配置成GPIO、模拟、数字等功能 + //当赋值为PORTA_PINn_FUNMUX时,PORTA.PINn引脚可通过PORTA_MUX寄存器连接到各种数字外设 + __IO uint32_t PORTB_SEL; + __IO uint32_t PORTC_SEL; - - uint32_t RESERVED[5]; - - __IO uint32_t PORTM_SEL0; - + + uint32_t RESERVED[5]; + + __IO uint32_t PORTM_SEL0; + __IO uint32_t PORTM_SEL1; - - uint32_t RESERVED2[2]; - + + uint32_t RESERVED2[2]; + __IO uint32_t PORTN_SEL0; - + __IO uint32_t PORTN_SEL1; - - uint32_t RESERVED3[2]; - + + uint32_t RESERVED3[2]; + __IO uint32_t PORTP_SEL0; - + __IO uint32_t PORTP_SEL1; - - uint32_t RESERVED4[46]; - + + uint32_t RESERVED4[46]; + __IO uint32_t PORTA_MUX0; - + __IO uint32_t PORTA_MUX1; - - uint32_t RESERVED5[2]; - + + uint32_t RESERVED5[2]; + __IO uint32_t PORTB_MUX0; - + __IO uint32_t PORTB_MUX1; - - uint32_t RESERVED6[2]; - + + uint32_t RESERVED6[2]; + __IO uint32_t PORTC_MUX0; - + __IO uint32_t PORTC_MUX1; - - uint32_t RESERVED7[14]; - + + uint32_t RESERVED7[14]; + __IO uint32_t PORTM_MUX0; - + __IO uint32_t PORTM_MUX1; __IO uint32_t PORTM_MUX2; - + __IO uint32_t PORTM_MUX3; - + __IO uint32_t PORTN_MUX0; - + __IO uint32_t PORTN_MUX1; - + __IO uint32_t PORTN_MUX2; - - uint32_t RESERVED8; - + + uint32_t RESERVED8; + __IO uint32_t PORTP_MUX0; - + __IO uint32_t PORTP_MUX1; - + __IO uint32_t PORTP_MUX2; - + __IO uint32_t PORTP_MUX3; - - uint32_t RESERVED9[28]; - - __IO uint32_t PORTA_PULLU; //涓婃媺浣胯兘 - - uint32_t RESERVED10[3]; - + + uint32_t RESERVED9[28]; + + __IO uint32_t PORTA_PULLU; //上拉使能 + + uint32_t RESERVED10[3]; + __IO uint32_t PORTC_PULLU; - - uint32_t RESERVED11[3]; + + uint32_t RESERVED11[3]; __IO uint32_t PORTM_PULLU; - - uint32_t RESERVED12[3]; + + uint32_t RESERVED12[3]; __IO uint32_t PORTP_PULLU; - - uint32_t RESERVED13[51]; - - __IO uint32_t PORTB_PULLD; //涓嬫媺浣胯兘 - - uint32_t RESERVED14[3]; + + uint32_t RESERVED13[51]; + + __IO uint32_t PORTB_PULLD; //下拉使能 + + uint32_t RESERVED14[3]; __IO uint32_t PORTD_PULLD; - - uint32_t RESERVED15[3]; + + uint32_t RESERVED15[3]; __IO uint32_t PORTN_PULLD; - - uint32_t RESERVED16[135]; - - __IO uint32_t PORTM_DRIVS; //椹卞姩寮哄害 - - uint32_t RESERVED17[3]; + + uint32_t RESERVED16[135]; + + __IO uint32_t PORTM_DRIVS; //驱动强度 + + uint32_t RESERVED17[3]; __IO uint32_t PORTN_DRIVS; - - uint32_t RESERVED18[3]; + + uint32_t RESERVED18[3]; __IO uint32_t PORTP_DRIVS; - - uint32_t RESERVED19[39]; - - __IO uint32_t PORTA_INEN; //杈撳叆浣胯兘 - - uint32_t RESERVED20[3]; - + + uint32_t RESERVED19[39]; + + __IO uint32_t PORTA_INEN; //输入使能 + + uint32_t RESERVED20[3]; + __IO uint32_t PORTB_INEN; - - uint32_t RESERVED21[3]; + + uint32_t RESERVED21[3]; __IO uint32_t PORTC_INEN; - - uint32_t RESERVED22[7]; + + uint32_t RESERVED22[7]; __IO uint32_t PORTM_INEN; - - uint32_t RESERVED23[3]; - + + uint32_t RESERVED23[3]; + __IO uint32_t PORTN_INEN; - - uint32_t RESERVED24[3]; + + uint32_t RESERVED24[3]; __IO uint32_t PORTP_INEN; } PORT_TypeDef; -#define PORT_PORTA_PULLU_PIN0_Pos 0 -#define PORT_PORTA_PULLU_PIN0_Msk (0x01 << PORT_PORTA_PULLU_PIN0_Pos) -#define PORT_PORTA_PULLU_PIN1_Pos 1 -#define PORT_PORTA_PULLU_PIN1_Msk (0x01 << PORT_PORTA_PULLU_PIN1_Pos) -#define PORT_PORTA_PULLU_PIN2_Pos 2 -#define PORT_PORTA_PULLU_PIN2_Msk (0x01 << PORT_PORTA_PULLU_PIN2_Pos) -#define PORT_PORTA_PULLU_PIN3_Pos 3 -#define PORT_PORTA_PULLU_PIN3_Msk (0x01 << PORT_PORTA_PULLU_PIN3_Pos) -#define PORT_PORTA_PULLU_PIN4_Pos 4 -#define PORT_PORTA_PULLU_PIN4_Msk (0x01 << PORT_PORTA_PULLU_PIN4_Pos) -#define PORT_PORTA_PULLU_PIN5_Pos 5 -#define PORT_PORTA_PULLU_PIN5_Msk (0x01 << PORT_PORTA_PULLU_PIN5_Pos) -#define PORT_PORTA_PULLU_PIN6_Pos 6 -#define PORT_PORTA_PULLU_PIN6_Msk (0x01 << PORT_PORTA_PULLU_PIN6_Pos) -#define PORT_PORTA_PULLU_PIN7_Pos 7 -#define PORT_PORTA_PULLU_PIN7_Msk (0x01 << PORT_PORTA_PULLU_PIN7_Pos) -#define PORT_PORTA_PULLU_PIN8_Pos 8 -#define PORT_PORTA_PULLU_PIN8_Msk (0x01 << PORT_PORTA_PULLU_PIN8_Pos) -#define PORT_PORTA_PULLU_PIN9_Pos 9 -#define PORT_PORTA_PULLU_PIN9_Msk (0x01 << PORT_PORTA_PULLU_PIN9_Pos) -#define PORT_PORTA_PULLU_PIN10_Pos 10 -#define PORT_PORTA_PULLU_PIN10_Msk (0x01 << PORT_PORTA_PULLU_PIN10_Pos) -#define PORT_PORTA_PULLU_PIN11_Pos 11 -#define PORT_PORTA_PULLU_PIN11_Msk (0x01 << PORT_PORTA_PULLU_PIN11_Pos) -#define PORT_PORTA_PULLU_PIN12_Pos 12 -#define PORT_PORTA_PULLU_PIN12_Msk (0x01 << PORT_PORTA_PULLU_PIN12_Pos) -#define PORT_PORTA_PULLU_PIN13_Pos 13 -#define PORT_PORTA_PULLU_PIN13_Msk (0x01 << PORT_PORTA_PULLU_PIN13_Pos) -#define PORT_PORTA_PULLU_PIN14_Pos 14 -#define PORT_PORTA_PULLU_PIN14_Msk (0x01 << PORT_PORTA_PULLU_PIN14_Pos) -#define PORT_PORTA_PULLU_PIN15_Pos 15 -#define PORT_PORTA_PULLU_PIN15_Msk (0x01 << PORT_PORTA_PULLU_PIN15_Pos) -#define PORT_PORTC_PULLU_PIN0_Pos 0 -#define PORT_PORTC_PULLU_PIN0_Msk (0x01 << PORT_PORTC_PULLU_PIN0_Pos) -#define PORT_PORTC_PULLU_PIN1_Pos 1 -#define PORT_PORTC_PULLU_PIN1_Msk (0x01 << PORT_PORTC_PULLU_PIN1_Pos) -#define PORT_PORTC_PULLU_PIN2_Pos 2 -#define PORT_PORTC_PULLU_PIN2_Msk (0x01 << PORT_PORTC_PULLU_PIN2_Pos) -#define PORT_PORTC_PULLU_PIN3_Pos 3 -#define PORT_PORTC_PULLU_PIN3_Msk (0x01 << PORT_PORTC_PULLU_PIN3_Pos) -#define PORT_PORTC_PULLU_PIN4_Pos 4 -#define PORT_PORTC_PULLU_PIN4_Msk (0x01 << PORT_PORTC_PULLU_PIN4_Pos) -#define PORT_PORTC_PULLU_PIN5_Pos 5 -#define PORT_PORTC_PULLU_PIN5_Msk (0x01 << PORT_PORTC_PULLU_PIN5_Pos) -#define PORT_PORTC_PULLU_PIN6_Pos 6 -#define PORT_PORTC_PULLU_PIN6_Msk (0x01 << PORT_PORTC_PULLU_PIN6_Pos) -#define PORT_PORTC_PULLU_PIN7_Pos 7 -#define PORT_PORTC_PULLU_PIN7_Msk (0x01 << PORT_PORTC_PULLU_PIN7_Pos) -#define PORT_PORTC_PULLU_PIN8_Pos 8 -#define PORT_PORTC_PULLU_PIN8_Msk (0x01 << PORT_PORTC_PULLU_PIN8_Pos) -#define PORT_PORTC_PULLU_PIN9_Pos 9 -#define PORT_PORTC_PULLU_PIN9_Msk (0x01 << PORT_PORTC_PULLU_PIN9_Pos) -#define PORT_PORTC_PULLU_PIN10_Pos 10 -#define PORT_PORTC_PULLU_PIN10_Msk (0x01 << PORT_PORTC_PULLU_PIN10_Pos) -#define PORT_PORTC_PULLU_PIN11_Pos 11 -#define PORT_PORTC_PULLU_PIN11_Msk (0x01 << PORT_PORTC_PULLU_PIN11_Pos) -#define PORT_PORTC_PULLU_PIN12_Pos 12 -#define PORT_PORTC_PULLU_PIN12_Msk (0x01 << PORT_PORTC_PULLU_PIN12_Pos) -#define PORT_PORTC_PULLU_PIN13_Pos 13 -#define PORT_PORTC_PULLU_PIN13_Msk (0x01 << PORT_PORTC_PULLU_PIN13_Pos) -#define PORT_PORTC_PULLU_PIN14_Pos 14 -#define PORT_PORTC_PULLU_PIN14_Msk (0x01 << PORT_PORTC_PULLU_PIN14_Pos) -#define PORT_PORTC_PULLU_PIN15_Pos 15 -#define PORT_PORTC_PULLU_PIN15_Msk (0x01 << PORT_PORTC_PULLU_PIN15_Pos) +#define PORT_PORTA_PULLU_PIN0_Pos 0 +#define PORT_PORTA_PULLU_PIN0_Msk (0x01 << PORT_PORTA_PULLU_PIN0_Pos) +#define PORT_PORTA_PULLU_PIN1_Pos 1 +#define PORT_PORTA_PULLU_PIN1_Msk (0x01 << PORT_PORTA_PULLU_PIN1_Pos) +#define PORT_PORTA_PULLU_PIN2_Pos 2 +#define PORT_PORTA_PULLU_PIN2_Msk (0x01 << PORT_PORTA_PULLU_PIN2_Pos) +#define PORT_PORTA_PULLU_PIN3_Pos 3 +#define PORT_PORTA_PULLU_PIN3_Msk (0x01 << PORT_PORTA_PULLU_PIN3_Pos) +#define PORT_PORTA_PULLU_PIN4_Pos 4 +#define PORT_PORTA_PULLU_PIN4_Msk (0x01 << PORT_PORTA_PULLU_PIN4_Pos) +#define PORT_PORTA_PULLU_PIN5_Pos 5 +#define PORT_PORTA_PULLU_PIN5_Msk (0x01 << PORT_PORTA_PULLU_PIN5_Pos) +#define PORT_PORTA_PULLU_PIN6_Pos 6 +#define PORT_PORTA_PULLU_PIN6_Msk (0x01 << PORT_PORTA_PULLU_PIN6_Pos) +#define PORT_PORTA_PULLU_PIN7_Pos 7 +#define PORT_PORTA_PULLU_PIN7_Msk (0x01 << PORT_PORTA_PULLU_PIN7_Pos) +#define PORT_PORTA_PULLU_PIN8_Pos 8 +#define PORT_PORTA_PULLU_PIN8_Msk (0x01 << PORT_PORTA_PULLU_PIN8_Pos) +#define PORT_PORTA_PULLU_PIN9_Pos 9 +#define PORT_PORTA_PULLU_PIN9_Msk (0x01 << PORT_PORTA_PULLU_PIN9_Pos) +#define PORT_PORTA_PULLU_PIN10_Pos 10 +#define PORT_PORTA_PULLU_PIN10_Msk (0x01 << PORT_PORTA_PULLU_PIN10_Pos) +#define PORT_PORTA_PULLU_PIN11_Pos 11 +#define PORT_PORTA_PULLU_PIN11_Msk (0x01 << PORT_PORTA_PULLU_PIN11_Pos) +#define PORT_PORTA_PULLU_PIN12_Pos 12 +#define PORT_PORTA_PULLU_PIN12_Msk (0x01 << PORT_PORTA_PULLU_PIN12_Pos) +#define PORT_PORTA_PULLU_PIN13_Pos 13 +#define PORT_PORTA_PULLU_PIN13_Msk (0x01 << PORT_PORTA_PULLU_PIN13_Pos) +#define PORT_PORTA_PULLU_PIN14_Pos 14 +#define PORT_PORTA_PULLU_PIN14_Msk (0x01 << PORT_PORTA_PULLU_PIN14_Pos) +#define PORT_PORTA_PULLU_PIN15_Pos 15 +#define PORT_PORTA_PULLU_PIN15_Msk (0x01 << PORT_PORTA_PULLU_PIN15_Pos) -#define PORT_PORTM_PULLU_PIN0_Pos 0 -#define PORT_PORTM_PULLU_PIN0_Msk (0x01 << PORT_PORTM_PULLU_PIN0_Pos) -#define PORT_PORTM_PULLU_PIN1_Pos 1 -#define PORT_PORTM_PULLU_PIN1_Msk (0x01 << PORT_PORTM_PULLU_PIN1_Pos) -#define PORT_PORTM_PULLU_PIN2_Pos 2 -#define PORT_PORTM_PULLU_PIN2_Msk (0x01 << PORT_PORTM_PULLU_PIN2_Pos) -#define PORT_PORTM_PULLU_PIN3_Pos 3 -#define PORT_PORTM_PULLU_PIN3_Msk (0x01 << PORT_PORTM_PULLU_PIN3_Pos) -#define PORT_PORTM_PULLU_PIN4_Pos 4 -#define PORT_PORTM_PULLU_PIN4_Msk (0x01 << PORT_PORTM_PULLU_PIN4_Pos) -#define PORT_PORTM_PULLU_PIN5_Pos 5 -#define PORT_PORTM_PULLU_PIN5_Msk (0x01 << PORT_PORTM_PULLU_PIN5_Pos) -#define PORT_PORTM_PULLU_PIN6_Pos 6 -#define PORT_PORTM_PULLU_PIN6_Msk (0x01 << PORT_PORTM_PULLU_PIN6_Pos) -#define PORT_PORTM_PULLU_PIN7_Pos 7 -#define PORT_PORTM_PULLU_PIN7_Msk (0x01 << PORT_PORTM_PULLU_PIN7_Pos) -#define PORT_PORTM_PULLU_PIN8_Pos 8 -#define PORT_PORTM_PULLU_PIN8_Msk (0x01 << PORT_PORTM_PULLU_PIN8_Pos) -#define PORT_PORTM_PULLU_PIN9_Pos 9 -#define PORT_PORTM_PULLU_PIN9_Msk (0x01 << PORT_PORTM_PULLU_PIN9_Pos) -#define PORT_PORTM_PULLU_PIN10_Pos 10 -#define PORT_PORTM_PULLU_PIN10_Msk (0x01 << PORT_PORTM_PULLU_PIN10_Pos) -#define PORT_PORTM_PULLU_PIN11_Pos 11 -#define PORT_PORTM_PULLU_PIN11_Msk (0x01 << PORT_PORTM_PULLU_PIN11_Pos) -#define PORT_PORTM_PULLU_PIN12_Pos 12 -#define PORT_PORTM_PULLU_PIN12_Msk (0x01 << PORT_PORTM_PULLU_PIN12_Pos) -#define PORT_PORTM_PULLU_PIN13_Pos 13 -#define PORT_PORTM_PULLU_PIN13_Msk (0x01 << PORT_PORTM_PULLU_PIN13_Pos) -#define PORT_PORTM_PULLU_PIN14_Pos 14 -#define PORT_PORTM_PULLU_PIN14_Msk (0x01 << PORT_PORTM_PULLU_PIN14_Pos) -#define PORT_PORTM_PULLU_PIN15_Pos 15 -#define PORT_PORTM_PULLU_PIN15_Msk (0x01 << PORT_PORTM_PULLU_PIN15_Pos) -#define PORT_PORTM_PULLU_PIN16_Pos 16 -#define PORT_PORTM_PULLU_PIN16_Msk (0x01 << PORT_PORTM_PULLU_PIN16_Pos) -#define PORT_PORTM_PULLU_PIN17_Pos 17 -#define PORT_PORTM_PULLU_PIN17_Msk (0x01 << PORT_PORTM_PULLU_PIN17_Pos) -#define PORT_PORTM_PULLU_PIN18_Pos 18 -#define PORT_PORTM_PULLU_PIN18_Msk (0x01 << PORT_PORTM_PULLU_PIN18_Pos) -#define PORT_PORTM_PULLU_PIN19_Pos 19 -#define PORT_PORTM_PULLU_PIN19_Msk (0x01 << PORT_PORTM_PULLU_PIN19_Pos) -#define PORT_PORTM_PULLU_PIN20_Pos 20 -#define PORT_PORTM_PULLU_PIN20_Msk (0x01 << PORT_PORTM_PULLU_PIN20_Pos) -#define PORT_PORTM_PULLU_PIN21_Pos 21 -#define PORT_PORTM_PULLU_PIN21_Msk (0x01 << PORT_PORTM_PULLU_PIN21_Pos) -#define PORT_PORTM_PULLU_PIN22_Pos 22 -#define PORT_PORTM_PULLU_PIN22_Msk (0x01 << PORT_PORTM_PULLU_PIN22_Pos) -#define PORT_PORTM_PULLU_PIN23_Pos 23 -#define PORT_PORTM_PULLU_PIN23_Msk (0x01 << PORT_PORTM_PULLU_PIN23_Pos) +#define PORT_PORTC_PULLU_PIN0_Pos 0 +#define PORT_PORTC_PULLU_PIN0_Msk (0x01 << PORT_PORTC_PULLU_PIN0_Pos) +#define PORT_PORTC_PULLU_PIN1_Pos 1 +#define PORT_PORTC_PULLU_PIN1_Msk (0x01 << PORT_PORTC_PULLU_PIN1_Pos) +#define PORT_PORTC_PULLU_PIN2_Pos 2 +#define PORT_PORTC_PULLU_PIN2_Msk (0x01 << PORT_PORTC_PULLU_PIN2_Pos) +#define PORT_PORTC_PULLU_PIN3_Pos 3 +#define PORT_PORTC_PULLU_PIN3_Msk (0x01 << PORT_PORTC_PULLU_PIN3_Pos) +#define PORT_PORTC_PULLU_PIN4_Pos 4 +#define PORT_PORTC_PULLU_PIN4_Msk (0x01 << PORT_PORTC_PULLU_PIN4_Pos) +#define PORT_PORTC_PULLU_PIN5_Pos 5 +#define PORT_PORTC_PULLU_PIN5_Msk (0x01 << PORT_PORTC_PULLU_PIN5_Pos) +#define PORT_PORTC_PULLU_PIN6_Pos 6 +#define PORT_PORTC_PULLU_PIN6_Msk (0x01 << PORT_PORTC_PULLU_PIN6_Pos) +#define PORT_PORTC_PULLU_PIN7_Pos 7 +#define PORT_PORTC_PULLU_PIN7_Msk (0x01 << PORT_PORTC_PULLU_PIN7_Pos) +#define PORT_PORTC_PULLU_PIN8_Pos 8 +#define PORT_PORTC_PULLU_PIN8_Msk (0x01 << PORT_PORTC_PULLU_PIN8_Pos) +#define PORT_PORTC_PULLU_PIN9_Pos 9 +#define PORT_PORTC_PULLU_PIN9_Msk (0x01 << PORT_PORTC_PULLU_PIN9_Pos) +#define PORT_PORTC_PULLU_PIN10_Pos 10 +#define PORT_PORTC_PULLU_PIN10_Msk (0x01 << PORT_PORTC_PULLU_PIN10_Pos) +#define PORT_PORTC_PULLU_PIN11_Pos 11 +#define PORT_PORTC_PULLU_PIN11_Msk (0x01 << PORT_PORTC_PULLU_PIN11_Pos) +#define PORT_PORTC_PULLU_PIN12_Pos 12 +#define PORT_PORTC_PULLU_PIN12_Msk (0x01 << PORT_PORTC_PULLU_PIN12_Pos) +#define PORT_PORTC_PULLU_PIN13_Pos 13 +#define PORT_PORTC_PULLU_PIN13_Msk (0x01 << PORT_PORTC_PULLU_PIN13_Pos) +#define PORT_PORTC_PULLU_PIN14_Pos 14 +#define PORT_PORTC_PULLU_PIN14_Msk (0x01 << PORT_PORTC_PULLU_PIN14_Pos) +#define PORT_PORTC_PULLU_PIN15_Pos 15 +#define PORT_PORTC_PULLU_PIN15_Msk (0x01 << PORT_PORTC_PULLU_PIN15_Pos) -#define PORT_PORTP_PULLU_PIN0_Pos 0 -#define PORT_PORTP_PULLU_PIN0_Msk (0x01 << PORT_PORTP_PULLU_PIN0_Pos) -#define PORT_PORTP_PULLU_PIN1_Pos 1 -#define PORT_PORTP_PULLU_PIN1_Msk (0x01 << PORT_PORTP_PULLU_PIN1_Pos) -#define PORT_PORTP_PULLU_PIN2_Pos 2 -#define PORT_PORTP_PULLU_PIN2_Msk (0x01 << PORT_PORTP_PULLU_PIN2_Pos) -#define PORT_PORTP_PULLU_PIN3_Pos 3 -#define PORT_PORTP_PULLU_PIN3_Msk (0x01 << PORT_PORTP_PULLU_PIN3_Pos) -#define PORT_PORTP_PULLU_PIN4_Pos 4 -#define PORT_PORTP_PULLU_PIN4_Msk (0x01 << PORT_PORTP_PULLU_PIN4_Pos) -#define PORT_PORTP_PULLU_PIN5_Pos 5 -#define PORT_PORTP_PULLU_PIN5_Msk (0x01 << PORT_PORTP_PULLU_PIN5_Pos) -#define PORT_PORTP_PULLU_PIN6_Pos 6 -#define PORT_PORTP_PULLU_PIN6_Msk (0x01 << PORT_PORTP_PULLU_PIN6_Pos) -#define PORT_PORTP_PULLU_PIN7_Pos 7 -#define PORT_PORTP_PULLU_PIN7_Msk (0x01 << PORT_PORTP_PULLU_PIN7_Pos) -#define PORT_PORTP_PULLU_PIN8_Pos 8 -#define PORT_PORTP_PULLU_PIN8_Msk (0x01 << PORT_PORTP_PULLU_PIN8_Pos) -#define PORT_PORTP_PULLU_PIN9_Pos 9 -#define PORT_PORTP_PULLU_PIN9_Msk (0x01 << PORT_PORTP_PULLU_PIN9_Pos) -#define PORT_PORTP_PULLU_PIN10_Pos 10 -#define PORT_PORTP_PULLU_PIN10_Msk (0x01 << PORT_PORTP_PULLU_PIN10_Pos) -#define PORT_PORTP_PULLU_PIN11_Pos 11 -#define PORT_PORTP_PULLU_PIN11_Msk (0x01 << PORT_PORTP_PULLU_PIN11_Pos) -#define PORT_PORTP_PULLU_PIN12_Pos 12 -#define PORT_PORTP_PULLU_PIN12_Msk (0x01 << PORT_PORTP_PULLU_PIN12_Pos) -#define PORT_PORTP_PULLU_PIN13_Pos 13 -#define PORT_PORTP_PULLU_PIN13_Msk (0x01 << PORT_PORTP_PULLU_PIN13_Pos) -#define PORT_PORTP_PULLU_PIN14_Pos 14 -#define PORT_PORTP_PULLU_PIN14_Msk (0x01 << PORT_PORTP_PULLU_PIN14_Pos) -#define PORT_PORTP_PULLU_PIN15_Pos 15 -#define PORT_PORTP_PULLU_PIN15_Msk (0x01 << PORT_PORTP_PULLU_PIN15_Pos) -#define PORT_PORTP_PULLU_PIN16_Pos 16 -#define PORT_PORTP_PULLU_PIN16_Msk (0x01 << PORT_PORTP_PULLU_PIN16_Pos) -#define PORT_PORTP_PULLU_PIN17_Pos 17 -#define PORT_PORTP_PULLU_PIN17_Msk (0x01 << PORT_PORTP_PULLU_PIN17_Pos) -#define PORT_PORTP_PULLU_PIN18_Pos 18 -#define PORT_PORTP_PULLU_PIN18_Msk (0x01 << PORT_PORTP_PULLU_PIN18_Pos) -#define PORT_PORTP_PULLU_PIN19_Pos 19 -#define PORT_PORTP_PULLU_PIN19_Msk (0x01 << PORT_PORTP_PULLU_PIN19_Pos) -#define PORT_PORTP_PULLU_PIN20_Pos 20 -#define PORT_PORTP_PULLU_PIN20_Msk (0x01 << PORT_PORTP_PULLU_PIN20_Pos) -#define PORT_PORTP_PULLU_PIN21_Pos 21 -#define PORT_PORTP_PULLU_PIN21_Msk (0x01 << PORT_PORTP_PULLU_PIN21_Pos) -#define PORT_PORTP_PULLU_PIN22_Pos 22 -#define PORT_PORTP_PULLU_PIN22_Msk (0x01 << PORT_PORTP_PULLU_PIN22_Pos) -#define PORT_PORTP_PULLU_PIN23_Pos 23 -#define PORT_PORTP_PULLU_PIN23_Msk (0x01 << PORT_PORTP_PULLU_PIN23_Pos) +#define PORT_PORTM_PULLU_PIN0_Pos 0 +#define PORT_PORTM_PULLU_PIN0_Msk (0x01 << PORT_PORTM_PULLU_PIN0_Pos) +#define PORT_PORTM_PULLU_PIN1_Pos 1 +#define PORT_PORTM_PULLU_PIN1_Msk (0x01 << PORT_PORTM_PULLU_PIN1_Pos) +#define PORT_PORTM_PULLU_PIN2_Pos 2 +#define PORT_PORTM_PULLU_PIN2_Msk (0x01 << PORT_PORTM_PULLU_PIN2_Pos) +#define PORT_PORTM_PULLU_PIN3_Pos 3 +#define PORT_PORTM_PULLU_PIN3_Msk (0x01 << PORT_PORTM_PULLU_PIN3_Pos) +#define PORT_PORTM_PULLU_PIN4_Pos 4 +#define PORT_PORTM_PULLU_PIN4_Msk (0x01 << PORT_PORTM_PULLU_PIN4_Pos) +#define PORT_PORTM_PULLU_PIN5_Pos 5 +#define PORT_PORTM_PULLU_PIN5_Msk (0x01 << PORT_PORTM_PULLU_PIN5_Pos) +#define PORT_PORTM_PULLU_PIN6_Pos 6 +#define PORT_PORTM_PULLU_PIN6_Msk (0x01 << PORT_PORTM_PULLU_PIN6_Pos) +#define PORT_PORTM_PULLU_PIN7_Pos 7 +#define PORT_PORTM_PULLU_PIN7_Msk (0x01 << PORT_PORTM_PULLU_PIN7_Pos) +#define PORT_PORTM_PULLU_PIN8_Pos 8 +#define PORT_PORTM_PULLU_PIN8_Msk (0x01 << PORT_PORTM_PULLU_PIN8_Pos) +#define PORT_PORTM_PULLU_PIN9_Pos 9 +#define PORT_PORTM_PULLU_PIN9_Msk (0x01 << PORT_PORTM_PULLU_PIN9_Pos) +#define PORT_PORTM_PULLU_PIN10_Pos 10 +#define PORT_PORTM_PULLU_PIN10_Msk (0x01 << PORT_PORTM_PULLU_PIN10_Pos) +#define PORT_PORTM_PULLU_PIN11_Pos 11 +#define PORT_PORTM_PULLU_PIN11_Msk (0x01 << PORT_PORTM_PULLU_PIN11_Pos) +#define PORT_PORTM_PULLU_PIN12_Pos 12 +#define PORT_PORTM_PULLU_PIN12_Msk (0x01 << PORT_PORTM_PULLU_PIN12_Pos) +#define PORT_PORTM_PULLU_PIN13_Pos 13 +#define PORT_PORTM_PULLU_PIN13_Msk (0x01 << PORT_PORTM_PULLU_PIN13_Pos) +#define PORT_PORTM_PULLU_PIN14_Pos 14 +#define PORT_PORTM_PULLU_PIN14_Msk (0x01 << PORT_PORTM_PULLU_PIN14_Pos) +#define PORT_PORTM_PULLU_PIN15_Pos 15 +#define PORT_PORTM_PULLU_PIN15_Msk (0x01 << PORT_PORTM_PULLU_PIN15_Pos) +#define PORT_PORTM_PULLU_PIN16_Pos 16 +#define PORT_PORTM_PULLU_PIN16_Msk (0x01 << PORT_PORTM_PULLU_PIN16_Pos) +#define PORT_PORTM_PULLU_PIN17_Pos 17 +#define PORT_PORTM_PULLU_PIN17_Msk (0x01 << PORT_PORTM_PULLU_PIN17_Pos) +#define PORT_PORTM_PULLU_PIN18_Pos 18 +#define PORT_PORTM_PULLU_PIN18_Msk (0x01 << PORT_PORTM_PULLU_PIN18_Pos) +#define PORT_PORTM_PULLU_PIN19_Pos 19 +#define PORT_PORTM_PULLU_PIN19_Msk (0x01 << PORT_PORTM_PULLU_PIN19_Pos) +#define PORT_PORTM_PULLU_PIN20_Pos 20 +#define PORT_PORTM_PULLU_PIN20_Msk (0x01 << PORT_PORTM_PULLU_PIN20_Pos) +#define PORT_PORTM_PULLU_PIN21_Pos 21 +#define PORT_PORTM_PULLU_PIN21_Msk (0x01 << PORT_PORTM_PULLU_PIN21_Pos) +#define PORT_PORTM_PULLU_PIN22_Pos 22 +#define PORT_PORTM_PULLU_PIN22_Msk (0x01 << PORT_PORTM_PULLU_PIN22_Pos) +#define PORT_PORTM_PULLU_PIN23_Pos 23 +#define PORT_PORTM_PULLU_PIN23_Msk (0x01 << PORT_PORTM_PULLU_PIN23_Pos) -#define PORT_PORTB_PULLD_PIN0_Pos 0 -#define PORT_PORTB_PULLD_PIN0_Msk (0x01 << PORT_PORTB_PULLD_PIN0_Pos) -#define PORT_PORTB_PULLD_PIN1_Pos 1 -#define PORT_PORTB_PULLD_PIN1_Msk (0x01 << PORT_PORTB_PULLD_PIN1_Pos) -#define PORT_PORTB_PULLD_PIN2_Pos 2 -#define PORT_PORTB_PULLD_PIN2_Msk (0x01 << PORT_PORTB_PULLD_PIN2_Pos) -#define PORT_PORTB_PULLD_PIN3_Pos 3 -#define PORT_PORTB_PULLD_PIN3_Msk (0x01 << PORT_PORTB_PULLD_PIN3_Pos) -#define PORT_PORTB_PULLD_PIN4_Pos 4 -#define PORT_PORTB_PULLD_PIN4_Msk (0x01 << PORT_PORTB_PULLD_PIN4_Pos) -#define PORT_PORTB_PULLD_PIN5_Pos 5 -#define PORT_PORTB_PULLD_PIN5_Msk (0x01 << PORT_PORTB_PULLD_PIN5_Pos) -#define PORT_PORTB_PULLD_PIN6_Pos 6 -#define PORT_PORTB_PULLD_PIN6_Msk (0x01 << PORT_PORTB_PULLD_PIN6_Pos) -#define PORT_PORTB_PULLD_PIN7_Pos 7 -#define PORT_PORTB_PULLD_PIN7_Msk (0x01 << PORT_PORTB_PULLD_PIN7_Pos) -#define PORT_PORTB_PULLD_PIN8_Pos 8 -#define PORT_PORTB_PULLD_PIN8_Msk (0x01 << PORT_PORTB_PULLD_PIN8_Pos) -#define PORT_PORTB_PULLD_PIN9_Pos 9 -#define PORT_PORTB_PULLD_PIN9_Msk (0x01 << PORT_PORTB_PULLD_PIN9_Pos) -#define PORT_PORTB_PULLD_PIN10_Pos 10 -#define PORT_PORTB_PULLD_PIN10_Msk (0x01 << PORT_PORTB_PULLD_PIN10_Pos) -#define PORT_PORTB_PULLD_PIN11_Pos 11 -#define PORT_PORTB_PULLD_PIN11_Msk (0x01 << PORT_PORTB_PULLD_PIN11_Pos) -#define PORT_PORTB_PULLD_PIN12_Pos 12 -#define PORT_PORTB_PULLD_PIN12_Msk (0x01 << PORT_PORTB_PULLD_PIN12_Pos) -#define PORT_PORTB_PULLD_PIN13_Pos 13 -#define PORT_PORTB_PULLD_PIN13_Msk (0x01 << PORT_PORTB_PULLD_PIN13_Pos) -#define PORT_PORTB_PULLD_PIN14_Pos 14 -#define PORT_PORTB_PULLD_PIN14_Msk (0x01 << PORT_PORTB_PULLD_PIN14_Pos) -#define PORT_PORTB_PULLD_PIN15_Pos 15 -#define PORT_PORTB_PULLD_PIN15_Msk (0x01 << PORT_PORTB_PULLD_PIN15_Pos) +#define PORT_PORTP_PULLU_PIN0_Pos 0 +#define PORT_PORTP_PULLU_PIN0_Msk (0x01 << PORT_PORTP_PULLU_PIN0_Pos) +#define PORT_PORTP_PULLU_PIN1_Pos 1 +#define PORT_PORTP_PULLU_PIN1_Msk (0x01 << PORT_PORTP_PULLU_PIN1_Pos) +#define PORT_PORTP_PULLU_PIN2_Pos 2 +#define PORT_PORTP_PULLU_PIN2_Msk (0x01 << PORT_PORTP_PULLU_PIN2_Pos) +#define PORT_PORTP_PULLU_PIN3_Pos 3 +#define PORT_PORTP_PULLU_PIN3_Msk (0x01 << PORT_PORTP_PULLU_PIN3_Pos) +#define PORT_PORTP_PULLU_PIN4_Pos 4 +#define PORT_PORTP_PULLU_PIN4_Msk (0x01 << PORT_PORTP_PULLU_PIN4_Pos) +#define PORT_PORTP_PULLU_PIN5_Pos 5 +#define PORT_PORTP_PULLU_PIN5_Msk (0x01 << PORT_PORTP_PULLU_PIN5_Pos) +#define PORT_PORTP_PULLU_PIN6_Pos 6 +#define PORT_PORTP_PULLU_PIN6_Msk (0x01 << PORT_PORTP_PULLU_PIN6_Pos) +#define PORT_PORTP_PULLU_PIN7_Pos 7 +#define PORT_PORTP_PULLU_PIN7_Msk (0x01 << PORT_PORTP_PULLU_PIN7_Pos) +#define PORT_PORTP_PULLU_PIN8_Pos 8 +#define PORT_PORTP_PULLU_PIN8_Msk (0x01 << PORT_PORTP_PULLU_PIN8_Pos) +#define PORT_PORTP_PULLU_PIN9_Pos 9 +#define PORT_PORTP_PULLU_PIN9_Msk (0x01 << PORT_PORTP_PULLU_PIN9_Pos) +#define PORT_PORTP_PULLU_PIN10_Pos 10 +#define PORT_PORTP_PULLU_PIN10_Msk (0x01 << PORT_PORTP_PULLU_PIN10_Pos) +#define PORT_PORTP_PULLU_PIN11_Pos 11 +#define PORT_PORTP_PULLU_PIN11_Msk (0x01 << PORT_PORTP_PULLU_PIN11_Pos) +#define PORT_PORTP_PULLU_PIN12_Pos 12 +#define PORT_PORTP_PULLU_PIN12_Msk (0x01 << PORT_PORTP_PULLU_PIN12_Pos) +#define PORT_PORTP_PULLU_PIN13_Pos 13 +#define PORT_PORTP_PULLU_PIN13_Msk (0x01 << PORT_PORTP_PULLU_PIN13_Pos) +#define PORT_PORTP_PULLU_PIN14_Pos 14 +#define PORT_PORTP_PULLU_PIN14_Msk (0x01 << PORT_PORTP_PULLU_PIN14_Pos) +#define PORT_PORTP_PULLU_PIN15_Pos 15 +#define PORT_PORTP_PULLU_PIN15_Msk (0x01 << PORT_PORTP_PULLU_PIN15_Pos) +#define PORT_PORTP_PULLU_PIN16_Pos 16 +#define PORT_PORTP_PULLU_PIN16_Msk (0x01 << PORT_PORTP_PULLU_PIN16_Pos) +#define PORT_PORTP_PULLU_PIN17_Pos 17 +#define PORT_PORTP_PULLU_PIN17_Msk (0x01 << PORT_PORTP_PULLU_PIN17_Pos) +#define PORT_PORTP_PULLU_PIN18_Pos 18 +#define PORT_PORTP_PULLU_PIN18_Msk (0x01 << PORT_PORTP_PULLU_PIN18_Pos) +#define PORT_PORTP_PULLU_PIN19_Pos 19 +#define PORT_PORTP_PULLU_PIN19_Msk (0x01 << PORT_PORTP_PULLU_PIN19_Pos) +#define PORT_PORTP_PULLU_PIN20_Pos 20 +#define PORT_PORTP_PULLU_PIN20_Msk (0x01 << PORT_PORTP_PULLU_PIN20_Pos) +#define PORT_PORTP_PULLU_PIN21_Pos 21 +#define PORT_PORTP_PULLU_PIN21_Msk (0x01 << PORT_PORTP_PULLU_PIN21_Pos) +#define PORT_PORTP_PULLU_PIN22_Pos 22 +#define PORT_PORTP_PULLU_PIN22_Msk (0x01 << PORT_PORTP_PULLU_PIN22_Pos) +#define PORT_PORTP_PULLU_PIN23_Pos 23 +#define PORT_PORTP_PULLU_PIN23_Msk (0x01 << PORT_PORTP_PULLU_PIN23_Pos) -#define PORT_PORTN_PULLD_PIN0_Pos 0 -#define PORT_PORTN_PULLD_PIN0_Msk (0x01 << PORT_PORTN_PULLD_PIN0_Pos) -#define PORT_PORTN_PULLD_PIN1_Pos 1 -#define PORT_PORTN_PULLD_PIN1_Msk (0x01 << PORT_PORTN_PULLD_PIN1_Pos) -#define PORT_PORTN_PULLD_PIN2_Pos 2 -#define PORT_PORTN_PULLD_PIN2_Msk (0x01 << PORT_PORTN_PULLD_PIN2_Pos) -#define PORT_PORTN_PULLD_PIN3_Pos 3 -#define PORT_PORTN_PULLD_PIN3_Msk (0x01 << PORT_PORTN_PULLD_PIN3_Pos) -#define PORT_PORTN_PULLD_PIN4_Pos 4 -#define PORT_PORTN_PULLD_PIN4_Msk (0x01 << PORT_PORTN_PULLD_PIN4_Pos) -#define PORT_PORTN_PULLD_PIN5_Pos 5 -#define PORT_PORTN_PULLD_PIN5_Msk (0x01 << PORT_PORTN_PULLD_PIN5_Pos) -#define PORT_PORTN_PULLD_PIN6_Pos 6 -#define PORT_PORTN_PULLD_PIN6_Msk (0x01 << PORT_PORTN_PULLD_PIN6_Pos) -#define PORT_PORTN_PULLD_PIN7_Pos 7 -#define PORT_PORTN_PULLD_PIN7_Msk (0x01 << PORT_PORTN_PULLD_PIN7_Pos) -#define PORT_PORTN_PULLD_PIN8_Pos 8 -#define PORT_PORTN_PULLD_PIN8_Msk (0x01 << PORT_PORTN_PULLD_PIN8_Pos) -#define PORT_PORTN_PULLD_PIN9_Pos 9 -#define PORT_PORTN_PULLD_PIN9_Msk (0x01 << PORT_PORTN_PULLD_PIN9_Pos) -#define PORT_PORTN_PULLD_PIN10_Pos 10 -#define PORT_PORTN_PULLD_PIN10_Msk (0x01 << PORT_PORTN_PULLD_PIN10_Pos) -#define PORT_PORTN_PULLD_PIN11_Pos 11 -#define PORT_PORTN_PULLD_PIN11_Msk (0x01 << PORT_PORTN_PULLD_PIN11_Pos) -#define PORT_PORTN_PULLD_PIN12_Pos 12 -#define PORT_PORTN_PULLD_PIN12_Msk (0x01 << PORT_PORTN_PULLD_PIN12_Pos) -#define PORT_PORTN_PULLD_PIN13_Pos 13 -#define PORT_PORTN_PULLD_PIN13_Msk (0x01 << PORT_PORTN_PULLD_PIN13_Pos) -#define PORT_PORTN_PULLD_PIN14_Pos 14 -#define PORT_PORTN_PULLD_PIN14_Msk (0x01 << PORT_PORTN_PULLD_PIN14_Pos) -#define PORT_PORTN_PULLD_PIN15_Pos 15 -#define PORT_PORTN_PULLD_PIN15_Msk (0x01 << PORT_PORTN_PULLD_PIN15_Pos) -#define PORT_PORTN_PULLD_PIN16_Pos 16 -#define PORT_PORTN_PULLD_PIN16_Msk (0x01 << PORT_PORTN_PULLD_PIN16_Pos) -#define PORT_PORTN_PULLD_PIN17_Pos 17 -#define PORT_PORTN_PULLD_PIN17_Msk (0x01 << PORT_PORTN_PULLD_PIN17_Pos) -#define PORT_PORTN_PULLD_PIN18_Pos 18 -#define PORT_PORTN_PULLD_PIN18_Msk (0x01 << PORT_PORTN_PULLD_PIN18_Pos) -#define PORT_PORTN_PULLD_PIN19_Pos 19 -#define PORT_PORTN_PULLD_PIN19_Msk (0x01 << PORT_PORTN_PULLD_PIN19_Pos) -#define PORT_PORTN_PULLD_PIN20_Pos 20 -#define PORT_PORTN_PULLD_PIN20_Msk (0x01 << PORT_PORTN_PULLD_PIN20_Pos) -#define PORT_PORTN_PULLD_PIN21_Pos 21 -#define PORT_PORTN_PULLD_PIN21_Msk (0x01 << PORT_PORTN_PULLD_PIN21_Pos) -#define PORT_PORTN_PULLD_PIN22_Pos 22 -#define PORT_PORTN_PULLD_PIN22_Msk (0x01 << PORT_PORTN_PULLD_PIN22_Pos) -#define PORT_PORTN_PULLD_PIN23_Pos 23 -#define PORT_PORTN_PULLD_PIN23_Msk (0x01 << PORT_PORTN_PULLD_PIN23_Pos) +#define PORT_PORTB_PULLD_PIN0_Pos 0 +#define PORT_PORTB_PULLD_PIN0_Msk (0x01 << PORT_PORTB_PULLD_PIN0_Pos) +#define PORT_PORTB_PULLD_PIN1_Pos 1 +#define PORT_PORTB_PULLD_PIN1_Msk (0x01 << PORT_PORTB_PULLD_PIN1_Pos) +#define PORT_PORTB_PULLD_PIN2_Pos 2 +#define PORT_PORTB_PULLD_PIN2_Msk (0x01 << PORT_PORTB_PULLD_PIN2_Pos) +#define PORT_PORTB_PULLD_PIN3_Pos 3 +#define PORT_PORTB_PULLD_PIN3_Msk (0x01 << PORT_PORTB_PULLD_PIN3_Pos) +#define PORT_PORTB_PULLD_PIN4_Pos 4 +#define PORT_PORTB_PULLD_PIN4_Msk (0x01 << PORT_PORTB_PULLD_PIN4_Pos) +#define PORT_PORTB_PULLD_PIN5_Pos 5 +#define PORT_PORTB_PULLD_PIN5_Msk (0x01 << PORT_PORTB_PULLD_PIN5_Pos) +#define PORT_PORTB_PULLD_PIN6_Pos 6 +#define PORT_PORTB_PULLD_PIN6_Msk (0x01 << PORT_PORTB_PULLD_PIN6_Pos) +#define PORT_PORTB_PULLD_PIN7_Pos 7 +#define PORT_PORTB_PULLD_PIN7_Msk (0x01 << PORT_PORTB_PULLD_PIN7_Pos) +#define PORT_PORTB_PULLD_PIN8_Pos 8 +#define PORT_PORTB_PULLD_PIN8_Msk (0x01 << PORT_PORTB_PULLD_PIN8_Pos) +#define PORT_PORTB_PULLD_PIN9_Pos 9 +#define PORT_PORTB_PULLD_PIN9_Msk (0x01 << PORT_PORTB_PULLD_PIN9_Pos) +#define PORT_PORTB_PULLD_PIN10_Pos 10 +#define PORT_PORTB_PULLD_PIN10_Msk (0x01 << PORT_PORTB_PULLD_PIN10_Pos) +#define PORT_PORTB_PULLD_PIN11_Pos 11 +#define PORT_PORTB_PULLD_PIN11_Msk (0x01 << PORT_PORTB_PULLD_PIN11_Pos) +#define PORT_PORTB_PULLD_PIN12_Pos 12 +#define PORT_PORTB_PULLD_PIN12_Msk (0x01 << PORT_PORTB_PULLD_PIN12_Pos) +#define PORT_PORTB_PULLD_PIN13_Pos 13 +#define PORT_PORTB_PULLD_PIN13_Msk (0x01 << PORT_PORTB_PULLD_PIN13_Pos) +#define PORT_PORTB_PULLD_PIN14_Pos 14 +#define PORT_PORTB_PULLD_PIN14_Msk (0x01 << PORT_PORTB_PULLD_PIN14_Pos) +#define PORT_PORTB_PULLD_PIN15_Pos 15 +#define PORT_PORTB_PULLD_PIN15_Msk (0x01 << PORT_PORTB_PULLD_PIN15_Pos) -#define PORT_PORTM_DRIVS_PIN0_Pos 0 -#define PORT_PORTM_DRIVS_PIN0_Msk (0x01 << PORT_PORTM_DRIVS_PIN0_Pos) -#define PORT_PORTM_DRIVS_PIN1_Pos 1 -#define PORT_PORTM_DRIVS_PIN1_Msk (0x01 << PORT_PORTM_DRIVS_PIN1_Pos) -#define PORT_PORTM_DRIVS_PIN2_Pos 2 -#define PORT_PORTM_DRIVS_PIN2_Msk (0x01 << PORT_PORTM_DRIVS_PIN2_Pos) -#define PORT_PORTM_DRIVS_PIN3_Pos 3 -#define PORT_PORTM_DRIVS_PIN3_Msk (0x01 << PORT_PORTM_DRIVS_PIN3_Pos) -#define PORT_PORTM_DRIVS_PIN4_Pos 4 -#define PORT_PORTM_DRIVS_PIN4_Msk (0x01 << PORT_PORTM_DRIVS_PIN4_Pos) -#define PORT_PORTM_DRIVS_PIN5_Pos 5 -#define PORT_PORTM_DRIVS_PIN5_Msk (0x01 << PORT_PORTM_DRIVS_PIN5_Pos) -#define PORT_PORTM_DRIVS_PIN6_Pos 6 -#define PORT_PORTM_DRIVS_PIN6_Msk (0x01 << PORT_PORTM_DRIVS_PIN6_Pos) -#define PORT_PORTM_DRIVS_PIN7_Pos 7 -#define PORT_PORTM_DRIVS_PIN7_Msk (0x01 << PORT_PORTM_DRIVS_PIN7_Pos) -#define PORT_PORTM_DRIVS_PIN8_Pos 8 -#define PORT_PORTM_DRIVS_PIN8_Msk (0x01 << PORT_PORTM_DRIVS_PIN8_Pos) -#define PORT_PORTM_DRIVS_PIN9_Pos 9 -#define PORT_PORTM_DRIVS_PIN9_Msk (0x01 << PORT_PORTM_DRIVS_PIN9_Pos) -#define PORT_PORTM_DRIVS_PIN10_Pos 10 -#define PORT_PORTM_DRIVS_PIN10_Msk (0x01 << PORT_PORTM_DRIVS_PIN10_Pos) -#define PORT_PORTM_DRIVS_PIN11_Pos 11 -#define PORT_PORTM_DRIVS_PIN11_Msk (0x01 << PORT_PORTM_DRIVS_PIN11_Pos) -#define PORT_PORTM_DRIVS_PIN12_Pos 12 -#define PORT_PORTM_DRIVS_PIN12_Msk (0x01 << PORT_PORTM_DRIVS_PIN12_Pos) -#define PORT_PORTM_DRIVS_PIN13_Pos 13 -#define PORT_PORTM_DRIVS_PIN13_Msk (0x01 << PORT_PORTM_DRIVS_PIN13_Pos) -#define PORT_PORTM_DRIVS_PIN14_Pos 14 -#define PORT_PORTM_DRIVS_PIN14_Msk (0x01 << PORT_PORTM_DRIVS_PIN14_Pos) -#define PORT_PORTM_DRIVS_PIN15_Pos 15 -#define PORT_PORTM_DRIVS_PIN15_Msk (0x01 << PORT_PORTM_DRIVS_PIN15_Pos) -#define PORT_PORTM_DRIVS_PIN16_Pos 16 -#define PORT_PORTM_DRIVS_PIN16_Msk (0x01 << PORT_PORTM_DRIVS_PIN16_Pos) -#define PORT_PORTM_DRIVS_PIN17_Pos 17 -#define PORT_PORTM_DRIVS_PIN17_Msk (0x01 << PORT_PORTM_DRIVS_PIN17_Pos) -#define PORT_PORTM_DRIVS_PIN18_Pos 18 -#define PORT_PORTM_DRIVS_PIN18_Msk (0x01 << PORT_PORTM_DRIVS_PIN18_Pos) -#define PORT_PORTM_DRIVS_PIN19_Pos 19 -#define PORT_PORTM_DRIVS_PIN19_Msk (0x01 << PORT_PORTM_DRIVS_PIN19_Pos) -#define PORT_PORTM_DRIVS_PIN20_Pos 20 -#define PORT_PORTM_DRIVS_PIN20_Msk (0x01 << PORT_PORTM_DRIVS_PIN20_Pos) -#define PORT_PORTM_DRIVS_PIN21_Pos 21 -#define PORT_PORTM_DRIVS_PIN21_Msk (0x01 << PORT_PORTM_DRIVS_PIN21_Pos) -#define PORT_PORTM_DRIVS_PIN22_Pos 22 -#define PORT_PORTM_DRIVS_PIN22_Msk (0x01 << PORT_PORTM_DRIVS_PIN22_Pos) -#define PORT_PORTM_DRIVS_PIN23_Pos 23 -#define PORT_PORTM_DRIVS_PIN23_Msk (0x01 << PORT_PORTM_DRIVS_PIN23_Pos) +#define PORT_PORTN_PULLD_PIN0_Pos 0 +#define PORT_PORTN_PULLD_PIN0_Msk (0x01 << PORT_PORTN_PULLD_PIN0_Pos) +#define PORT_PORTN_PULLD_PIN1_Pos 1 +#define PORT_PORTN_PULLD_PIN1_Msk (0x01 << PORT_PORTN_PULLD_PIN1_Pos) +#define PORT_PORTN_PULLD_PIN2_Pos 2 +#define PORT_PORTN_PULLD_PIN2_Msk (0x01 << PORT_PORTN_PULLD_PIN2_Pos) +#define PORT_PORTN_PULLD_PIN3_Pos 3 +#define PORT_PORTN_PULLD_PIN3_Msk (0x01 << PORT_PORTN_PULLD_PIN3_Pos) +#define PORT_PORTN_PULLD_PIN4_Pos 4 +#define PORT_PORTN_PULLD_PIN4_Msk (0x01 << PORT_PORTN_PULLD_PIN4_Pos) +#define PORT_PORTN_PULLD_PIN5_Pos 5 +#define PORT_PORTN_PULLD_PIN5_Msk (0x01 << PORT_PORTN_PULLD_PIN5_Pos) +#define PORT_PORTN_PULLD_PIN6_Pos 6 +#define PORT_PORTN_PULLD_PIN6_Msk (0x01 << PORT_PORTN_PULLD_PIN6_Pos) +#define PORT_PORTN_PULLD_PIN7_Pos 7 +#define PORT_PORTN_PULLD_PIN7_Msk (0x01 << PORT_PORTN_PULLD_PIN7_Pos) +#define PORT_PORTN_PULLD_PIN8_Pos 8 +#define PORT_PORTN_PULLD_PIN8_Msk (0x01 << PORT_PORTN_PULLD_PIN8_Pos) +#define PORT_PORTN_PULLD_PIN9_Pos 9 +#define PORT_PORTN_PULLD_PIN9_Msk (0x01 << PORT_PORTN_PULLD_PIN9_Pos) +#define PORT_PORTN_PULLD_PIN10_Pos 10 +#define PORT_PORTN_PULLD_PIN10_Msk (0x01 << PORT_PORTN_PULLD_PIN10_Pos) +#define PORT_PORTN_PULLD_PIN11_Pos 11 +#define PORT_PORTN_PULLD_PIN11_Msk (0x01 << PORT_PORTN_PULLD_PIN11_Pos) +#define PORT_PORTN_PULLD_PIN12_Pos 12 +#define PORT_PORTN_PULLD_PIN12_Msk (0x01 << PORT_PORTN_PULLD_PIN12_Pos) +#define PORT_PORTN_PULLD_PIN13_Pos 13 +#define PORT_PORTN_PULLD_PIN13_Msk (0x01 << PORT_PORTN_PULLD_PIN13_Pos) +#define PORT_PORTN_PULLD_PIN14_Pos 14 +#define PORT_PORTN_PULLD_PIN14_Msk (0x01 << PORT_PORTN_PULLD_PIN14_Pos) +#define PORT_PORTN_PULLD_PIN15_Pos 15 +#define PORT_PORTN_PULLD_PIN15_Msk (0x01 << PORT_PORTN_PULLD_PIN15_Pos) +#define PORT_PORTN_PULLD_PIN16_Pos 16 +#define PORT_PORTN_PULLD_PIN16_Msk (0x01 << PORT_PORTN_PULLD_PIN16_Pos) +#define PORT_PORTN_PULLD_PIN17_Pos 17 +#define PORT_PORTN_PULLD_PIN17_Msk (0x01 << PORT_PORTN_PULLD_PIN17_Pos) +#define PORT_PORTN_PULLD_PIN18_Pos 18 +#define PORT_PORTN_PULLD_PIN18_Msk (0x01 << PORT_PORTN_PULLD_PIN18_Pos) +#define PORT_PORTN_PULLD_PIN19_Pos 19 +#define PORT_PORTN_PULLD_PIN19_Msk (0x01 << PORT_PORTN_PULLD_PIN19_Pos) +#define PORT_PORTN_PULLD_PIN20_Pos 20 +#define PORT_PORTN_PULLD_PIN20_Msk (0x01 << PORT_PORTN_PULLD_PIN20_Pos) +#define PORT_PORTN_PULLD_PIN21_Pos 21 +#define PORT_PORTN_PULLD_PIN21_Msk (0x01 << PORT_PORTN_PULLD_PIN21_Pos) +#define PORT_PORTN_PULLD_PIN22_Pos 22 +#define PORT_PORTN_PULLD_PIN22_Msk (0x01 << PORT_PORTN_PULLD_PIN22_Pos) +#define PORT_PORTN_PULLD_PIN23_Pos 23 +#define PORT_PORTN_PULLD_PIN23_Msk (0x01 << PORT_PORTN_PULLD_PIN23_Pos) -#define PORT_PORTN_DRIVS_PIN0_Pos 0 -#define PORT_PORTN_DRIVS_PIN0_Msk (0x01 << PORT_PORTN_DRIVS_PIN0_Pos) -#define PORT_PORTN_DRIVS_PIN1_Pos 1 -#define PORT_PORTN_DRIVS_PIN1_Msk (0x01 << PORT_PORTN_DRIVS_PIN1_Pos) -#define PORT_PORTN_DRIVS_PIN2_Pos 2 -#define PORT_PORTN_DRIVS_PIN2_Msk (0x01 << PORT_PORTN_DRIVS_PIN2_Pos) -#define PORT_PORTN_DRIVS_PIN3_Pos 3 -#define PORT_PORTN_DRIVS_PIN3_Msk (0x01 << PORT_PORTN_DRIVS_PIN3_Pos) -#define PORT_PORTN_DRIVS_PIN4_Pos 4 -#define PORT_PORTN_DRIVS_PIN4_Msk (0x01 << PORT_PORTN_DRIVS_PIN4_Pos) -#define PORT_PORTN_DRIVS_PIN5_Pos 5 -#define PORT_PORTN_DRIVS_PIN5_Msk (0x01 << PORT_PORTN_DRIVS_PIN5_Pos) -#define PORT_PORTN_DRIVS_PIN6_Pos 6 -#define PORT_PORTN_DRIVS_PIN6_Msk (0x01 << PORT_PORTN_DRIVS_PIN6_Pos) -#define PORT_PORTN_DRIVS_PIN7_Pos 7 -#define PORT_PORTN_DRIVS_PIN7_Msk (0x01 << PORT_PORTN_DRIVS_PIN7_Pos) -#define PORT_PORTN_DRIVS_PIN8_Pos 8 -#define PORT_PORTN_DRIVS_PIN8_Msk (0x01 << PORT_PORTN_DRIVS_PIN8_Pos) -#define PORT_PORTN_DRIVS_PIN9_Pos 9 -#define PORT_PORTN_DRIVS_PIN9_Msk (0x01 << PORT_PORTN_DRIVS_PIN9_Pos) -#define PORT_PORTN_DRIVS_PIN10_Pos 10 -#define PORT_PORTN_DRIVS_PIN10_Msk (0x01 << PORT_PORTN_DRIVS_PIN10_Pos) -#define PORT_PORTN_DRIVS_PIN11_Pos 11 -#define PORT_PORTN_DRIVS_PIN11_Msk (0x01 << PORT_PORTN_DRIVS_PIN11_Pos) -#define PORT_PORTN_DRIVS_PIN12_Pos 12 -#define PORT_PORTN_DRIVS_PIN12_Msk (0x01 << PORT_PORTN_DRIVS_PIN12_Pos) -#define PORT_PORTN_DRIVS_PIN13_Pos 13 -#define PORT_PORTN_DRIVS_PIN13_Msk (0x01 << PORT_PORTN_DRIVS_PIN13_Pos) -#define PORT_PORTN_DRIVS_PIN14_Pos 14 -#define PORT_PORTN_DRIVS_PIN14_Msk (0x01 << PORT_PORTN_DRIVS_PIN14_Pos) -#define PORT_PORTN_DRIVS_PIN15_Pos 15 -#define PORT_PORTN_DRIVS_PIN15_Msk (0x01 << PORT_PORTN_DRIVS_PIN15_Pos) -#define PORT_PORTN_DRIVS_PIN16_Pos 16 -#define PORT_PORTN_DRIVS_PIN16_Msk (0x01 << PORT_PORTN_DRIVS_PIN16_Pos) -#define PORT_PORTN_DRIVS_PIN17_Pos 17 -#define PORT_PORTN_DRIVS_PIN17_Msk (0x01 << PORT_PORTN_DRIVS_PIN17_Pos) -#define PORT_PORTN_DRIVS_PIN18_Pos 18 -#define PORT_PORTN_DRIVS_PIN18_Msk (0x01 << PORT_PORTN_DRIVS_PIN18_Pos) -#define PORT_PORTN_DRIVS_PIN19_Pos 19 -#define PORT_PORTN_DRIVS_PIN19_Msk (0x01 << PORT_PORTN_DRIVS_PIN19_Pos) -#define PORT_PORTN_DRIVS_PIN20_Pos 20 -#define PORT_PORTN_DRIVS_PIN20_Msk (0x01 << PORT_PORTN_DRIVS_PIN20_Pos) -#define PORT_PORTN_DRIVS_PIN21_Pos 21 -#define PORT_PORTN_DRIVS_PIN21_Msk (0x01 << PORT_PORTN_DRIVS_PIN21_Pos) -#define PORT_PORTN_DRIVS_PIN22_Pos 22 -#define PORT_PORTN_DRIVS_PIN22_Msk (0x01 << PORT_PORTN_DRIVS_PIN22_Pos) -#define PORT_PORTN_DRIVS_PIN23_Pos 23 -#define PORT_PORTN_DRIVS_PIN23_Msk (0x01 << PORT_PORTN_DRIVS_PIN23_Pos) +#define PORT_PORTM_DRIVS_PIN0_Pos 0 +#define PORT_PORTM_DRIVS_PIN0_Msk (0x01 << PORT_PORTM_DRIVS_PIN0_Pos) +#define PORT_PORTM_DRIVS_PIN1_Pos 1 +#define PORT_PORTM_DRIVS_PIN1_Msk (0x01 << PORT_PORTM_DRIVS_PIN1_Pos) +#define PORT_PORTM_DRIVS_PIN2_Pos 2 +#define PORT_PORTM_DRIVS_PIN2_Msk (0x01 << PORT_PORTM_DRIVS_PIN2_Pos) +#define PORT_PORTM_DRIVS_PIN3_Pos 3 +#define PORT_PORTM_DRIVS_PIN3_Msk (0x01 << PORT_PORTM_DRIVS_PIN3_Pos) +#define PORT_PORTM_DRIVS_PIN4_Pos 4 +#define PORT_PORTM_DRIVS_PIN4_Msk (0x01 << PORT_PORTM_DRIVS_PIN4_Pos) +#define PORT_PORTM_DRIVS_PIN5_Pos 5 +#define PORT_PORTM_DRIVS_PIN5_Msk (0x01 << PORT_PORTM_DRIVS_PIN5_Pos) +#define PORT_PORTM_DRIVS_PIN6_Pos 6 +#define PORT_PORTM_DRIVS_PIN6_Msk (0x01 << PORT_PORTM_DRIVS_PIN6_Pos) +#define PORT_PORTM_DRIVS_PIN7_Pos 7 +#define PORT_PORTM_DRIVS_PIN7_Msk (0x01 << PORT_PORTM_DRIVS_PIN7_Pos) +#define PORT_PORTM_DRIVS_PIN8_Pos 8 +#define PORT_PORTM_DRIVS_PIN8_Msk (0x01 << PORT_PORTM_DRIVS_PIN8_Pos) +#define PORT_PORTM_DRIVS_PIN9_Pos 9 +#define PORT_PORTM_DRIVS_PIN9_Msk (0x01 << PORT_PORTM_DRIVS_PIN9_Pos) +#define PORT_PORTM_DRIVS_PIN10_Pos 10 +#define PORT_PORTM_DRIVS_PIN10_Msk (0x01 << PORT_PORTM_DRIVS_PIN10_Pos) +#define PORT_PORTM_DRIVS_PIN11_Pos 11 +#define PORT_PORTM_DRIVS_PIN11_Msk (0x01 << PORT_PORTM_DRIVS_PIN11_Pos) +#define PORT_PORTM_DRIVS_PIN12_Pos 12 +#define PORT_PORTM_DRIVS_PIN12_Msk (0x01 << PORT_PORTM_DRIVS_PIN12_Pos) +#define PORT_PORTM_DRIVS_PIN13_Pos 13 +#define PORT_PORTM_DRIVS_PIN13_Msk (0x01 << PORT_PORTM_DRIVS_PIN13_Pos) +#define PORT_PORTM_DRIVS_PIN14_Pos 14 +#define PORT_PORTM_DRIVS_PIN14_Msk (0x01 << PORT_PORTM_DRIVS_PIN14_Pos) +#define PORT_PORTM_DRIVS_PIN15_Pos 15 +#define PORT_PORTM_DRIVS_PIN15_Msk (0x01 << PORT_PORTM_DRIVS_PIN15_Pos) +#define PORT_PORTM_DRIVS_PIN16_Pos 16 +#define PORT_PORTM_DRIVS_PIN16_Msk (0x01 << PORT_PORTM_DRIVS_PIN16_Pos) +#define PORT_PORTM_DRIVS_PIN17_Pos 17 +#define PORT_PORTM_DRIVS_PIN17_Msk (0x01 << PORT_PORTM_DRIVS_PIN17_Pos) +#define PORT_PORTM_DRIVS_PIN18_Pos 18 +#define PORT_PORTM_DRIVS_PIN18_Msk (0x01 << PORT_PORTM_DRIVS_PIN18_Pos) +#define PORT_PORTM_DRIVS_PIN19_Pos 19 +#define PORT_PORTM_DRIVS_PIN19_Msk (0x01 << PORT_PORTM_DRIVS_PIN19_Pos) +#define PORT_PORTM_DRIVS_PIN20_Pos 20 +#define PORT_PORTM_DRIVS_PIN20_Msk (0x01 << PORT_PORTM_DRIVS_PIN20_Pos) +#define PORT_PORTM_DRIVS_PIN21_Pos 21 +#define PORT_PORTM_DRIVS_PIN21_Msk (0x01 << PORT_PORTM_DRIVS_PIN21_Pos) +#define PORT_PORTM_DRIVS_PIN22_Pos 22 +#define PORT_PORTM_DRIVS_PIN22_Msk (0x01 << PORT_PORTM_DRIVS_PIN22_Pos) +#define PORT_PORTM_DRIVS_PIN23_Pos 23 +#define PORT_PORTM_DRIVS_PIN23_Msk (0x01 << PORT_PORTM_DRIVS_PIN23_Pos) -#define PORT_PORTP_DRIVS_PIN0_Pos 0 -#define PORT_PORTP_DRIVS_PIN0_Msk (0x01 << PORT_PORTP_DRIVS_PIN0_Pos) -#define PORT_PORTP_DRIVS_PIN1_Pos 1 -#define PORT_PORTP_DRIVS_PIN1_Msk (0x01 << PORT_PORTP_DRIVS_PIN1_Pos) -#define PORT_PORTP_DRIVS_PIN2_Pos 2 -#define PORT_PORTP_DRIVS_PIN2_Msk (0x01 << PORT_PORTP_DRIVS_PIN2_Pos) -#define PORT_PORTP_DRIVS_PIN3_Pos 3 -#define PORT_PORTP_DRIVS_PIN3_Msk (0x01 << PORT_PORTP_DRIVS_PIN3_Pos) -#define PORT_PORTP_DRIVS_PIN4_Pos 4 -#define PORT_PORTP_DRIVS_PIN4_Msk (0x01 << PORT_PORTP_DRIVS_PIN4_Pos) -#define PORT_PORTP_DRIVS_PIN5_Pos 5 -#define PORT_PORTP_DRIVS_PIN5_Msk (0x01 << PORT_PORTP_DRIVS_PIN5_Pos) -#define PORT_PORTP_DRIVS_PIN6_Pos 6 -#define PORT_PORTP_DRIVS_PIN6_Msk (0x01 << PORT_PORTP_DRIVS_PIN6_Pos) -#define PORT_PORTP_DRIVS_PIN7_Pos 7 -#define PORT_PORTP_DRIVS_PIN7_Msk (0x01 << PORT_PORTP_DRIVS_PIN7_Pos) -#define PORT_PORTP_DRIVS_PIN8_Pos 8 -#define PORT_PORTP_DRIVS_PIN8_Msk (0x01 << PORT_PORTP_DRIVS_PIN8_Pos) -#define PORT_PORTP_DRIVS_PIN9_Pos 9 -#define PORT_PORTP_DRIVS_PIN9_Msk (0x01 << PORT_PORTP_DRIVS_PIN9_Pos) -#define PORT_PORTP_DRIVS_PIN10_Pos 10 -#define PORT_PORTP_DRIVS_PIN10_Msk (0x01 << PORT_PORTP_DRIVS_PIN10_Pos) -#define PORT_PORTP_DRIVS_PIN11_Pos 11 -#define PORT_PORTP_DRIVS_PIN11_Msk (0x01 << PORT_PORTP_DRIVS_PIN11_Pos) -#define PORT_PORTP_DRIVS_PIN12_Pos 12 -#define PORT_PORTP_DRIVS_PIN12_Msk (0x01 << PORT_PORTP_DRIVS_PIN12_Pos) -#define PORT_PORTP_DRIVS_PIN13_Pos 13 -#define PORT_PORTP_DRIVS_PIN13_Msk (0x01 << PORT_PORTP_DRIVS_PIN13_Pos) -#define PORT_PORTP_DRIVS_PIN14_Pos 14 -#define PORT_PORTP_DRIVS_PIN14_Msk (0x01 << PORT_PORTP_DRIVS_PIN14_Pos) -#define PORT_PORTP_DRIVS_PIN15_Pos 15 -#define PORT_PORTP_DRIVS_PIN15_Msk (0x01 << PORT_PORTP_DRIVS_PIN15_Pos) -#define PORT_PORTP_DRIVS_PIN16_Pos 16 -#define PORT_PORTP_DRIVS_PIN16_Msk (0x01 << PORT_PORTP_DRIVS_PIN16_Pos) -#define PORT_PORTP_DRIVS_PIN17_Pos 17 -#define PORT_PORTP_DRIVS_PIN17_Msk (0x01 << PORT_PORTP_DRIVS_PIN17_Pos) -#define PORT_PORTP_DRIVS_PIN18_Pos 18 -#define PORT_PORTP_DRIVS_PIN18_Msk (0x01 << PORT_PORTP_DRIVS_PIN18_Pos) -#define PORT_PORTP_DRIVS_PIN19_Pos 19 -#define PORT_PORTP_DRIVS_PIN19_Msk (0x01 << PORT_PORTP_DRIVS_PIN19_Pos) -#define PORT_PORTP_DRIVS_PIN20_Pos 20 -#define PORT_PORTP_DRIVS_PIN20_Msk (0x01 << PORT_PORTP_DRIVS_PIN20_Pos) -#define PORT_PORTP_DRIVS_PIN21_Pos 21 -#define PORT_PORTP_DRIVS_PIN21_Msk (0x01 << PORT_PORTP_DRIVS_PIN21_Pos) -#define PORT_PORTP_DRIVS_PIN22_Pos 22 -#define PORT_PORTP_DRIVS_PIN22_Msk (0x01 << PORT_PORTP_DRIVS_PIN22_Pos) -#define PORT_PORTP_DRIVS_PIN23_Pos 23 -#define PORT_PORTP_DRIVS_PIN23_Msk (0x01 << PORT_PORTP_DRIVS_PIN23_Pos) +#define PORT_PORTN_DRIVS_PIN0_Pos 0 +#define PORT_PORTN_DRIVS_PIN0_Msk (0x01 << PORT_PORTN_DRIVS_PIN0_Pos) +#define PORT_PORTN_DRIVS_PIN1_Pos 1 +#define PORT_PORTN_DRIVS_PIN1_Msk (0x01 << PORT_PORTN_DRIVS_PIN1_Pos) +#define PORT_PORTN_DRIVS_PIN2_Pos 2 +#define PORT_PORTN_DRIVS_PIN2_Msk (0x01 << PORT_PORTN_DRIVS_PIN2_Pos) +#define PORT_PORTN_DRIVS_PIN3_Pos 3 +#define PORT_PORTN_DRIVS_PIN3_Msk (0x01 << PORT_PORTN_DRIVS_PIN3_Pos) +#define PORT_PORTN_DRIVS_PIN4_Pos 4 +#define PORT_PORTN_DRIVS_PIN4_Msk (0x01 << PORT_PORTN_DRIVS_PIN4_Pos) +#define PORT_PORTN_DRIVS_PIN5_Pos 5 +#define PORT_PORTN_DRIVS_PIN5_Msk (0x01 << PORT_PORTN_DRIVS_PIN5_Pos) +#define PORT_PORTN_DRIVS_PIN6_Pos 6 +#define PORT_PORTN_DRIVS_PIN6_Msk (0x01 << PORT_PORTN_DRIVS_PIN6_Pos) +#define PORT_PORTN_DRIVS_PIN7_Pos 7 +#define PORT_PORTN_DRIVS_PIN7_Msk (0x01 << PORT_PORTN_DRIVS_PIN7_Pos) +#define PORT_PORTN_DRIVS_PIN8_Pos 8 +#define PORT_PORTN_DRIVS_PIN8_Msk (0x01 << PORT_PORTN_DRIVS_PIN8_Pos) +#define PORT_PORTN_DRIVS_PIN9_Pos 9 +#define PORT_PORTN_DRIVS_PIN9_Msk (0x01 << PORT_PORTN_DRIVS_PIN9_Pos) +#define PORT_PORTN_DRIVS_PIN10_Pos 10 +#define PORT_PORTN_DRIVS_PIN10_Msk (0x01 << PORT_PORTN_DRIVS_PIN10_Pos) +#define PORT_PORTN_DRIVS_PIN11_Pos 11 +#define PORT_PORTN_DRIVS_PIN11_Msk (0x01 << PORT_PORTN_DRIVS_PIN11_Pos) +#define PORT_PORTN_DRIVS_PIN12_Pos 12 +#define PORT_PORTN_DRIVS_PIN12_Msk (0x01 << PORT_PORTN_DRIVS_PIN12_Pos) +#define PORT_PORTN_DRIVS_PIN13_Pos 13 +#define PORT_PORTN_DRIVS_PIN13_Msk (0x01 << PORT_PORTN_DRIVS_PIN13_Pos) +#define PORT_PORTN_DRIVS_PIN14_Pos 14 +#define PORT_PORTN_DRIVS_PIN14_Msk (0x01 << PORT_PORTN_DRIVS_PIN14_Pos) +#define PORT_PORTN_DRIVS_PIN15_Pos 15 +#define PORT_PORTN_DRIVS_PIN15_Msk (0x01 << PORT_PORTN_DRIVS_PIN15_Pos) +#define PORT_PORTN_DRIVS_PIN16_Pos 16 +#define PORT_PORTN_DRIVS_PIN16_Msk (0x01 << PORT_PORTN_DRIVS_PIN16_Pos) +#define PORT_PORTN_DRIVS_PIN17_Pos 17 +#define PORT_PORTN_DRIVS_PIN17_Msk (0x01 << PORT_PORTN_DRIVS_PIN17_Pos) +#define PORT_PORTN_DRIVS_PIN18_Pos 18 +#define PORT_PORTN_DRIVS_PIN18_Msk (0x01 << PORT_PORTN_DRIVS_PIN18_Pos) +#define PORT_PORTN_DRIVS_PIN19_Pos 19 +#define PORT_PORTN_DRIVS_PIN19_Msk (0x01 << PORT_PORTN_DRIVS_PIN19_Pos) +#define PORT_PORTN_DRIVS_PIN20_Pos 20 +#define PORT_PORTN_DRIVS_PIN20_Msk (0x01 << PORT_PORTN_DRIVS_PIN20_Pos) +#define PORT_PORTN_DRIVS_PIN21_Pos 21 +#define PORT_PORTN_DRIVS_PIN21_Msk (0x01 << PORT_PORTN_DRIVS_PIN21_Pos) +#define PORT_PORTN_DRIVS_PIN22_Pos 22 +#define PORT_PORTN_DRIVS_PIN22_Msk (0x01 << PORT_PORTN_DRIVS_PIN22_Pos) +#define PORT_PORTN_DRIVS_PIN23_Pos 23 +#define PORT_PORTN_DRIVS_PIN23_Msk (0x01 << PORT_PORTN_DRIVS_PIN23_Pos) -#define PORT_PORTA_INEN_PIN0_Pos 0 -#define PORT_PORTA_INEN_PIN0_Msk (0x01 << PORT_PORTA_INEN_PIN0_Pos) -#define PORT_PORTA_INEN_PIN1_Pos 1 -#define PORT_PORTA_INEN_PIN1_Msk (0x01 << PORT_PORTA_INEN_PIN1_Pos) -#define PORT_PORTA_INEN_PIN2_Pos 2 -#define PORT_PORTA_INEN_PIN2_Msk (0x01 << PORT_PORTA_INEN_PIN2_Pos) -#define PORT_PORTA_INEN_PIN3_Pos 3 -#define PORT_PORTA_INEN_PIN3_Msk (0x01 << PORT_PORTA_INEN_PIN3_Pos) -#define PORT_PORTA_INEN_PIN4_Pos 4 -#define PORT_PORTA_INEN_PIN4_Msk (0x01 << PORT_PORTA_INEN_PIN4_Pos) -#define PORT_PORTA_INEN_PIN5_Pos 5 -#define PORT_PORTA_INEN_PIN5_Msk (0x01 << PORT_PORTA_INEN_PIN5_Pos) -#define PORT_PORTA_INEN_PIN6_Pos 6 -#define PORT_PORTA_INEN_PIN6_Msk (0x01 << PORT_PORTA_INEN_PIN6_Pos) -#define PORT_PORTA_INEN_PIN7_Pos 7 -#define PORT_PORTA_INEN_PIN7_Msk (0x01 << PORT_PORTA_INEN_PIN7_Pos) -#define PORT_PORTA_INEN_PIN8_Pos 8 -#define PORT_PORTA_INEN_PIN8_Msk (0x01 << PORT_PORTA_INEN_PIN8_Pos) -#define PORT_PORTA_INEN_PIN9_Pos 9 -#define PORT_PORTA_INEN_PIN9_Msk (0x01 << PORT_PORTA_INEN_PIN9_Pos) -#define PORT_PORTA_INEN_PIN10_Pos 10 -#define PORT_PORTA_INEN_PIN10_Msk (0x01 << PORT_PORTA_INEN_PIN10_Pos) -#define PORT_PORTA_INEN_PIN11_Pos 11 -#define PORT_PORTA_INEN_PIN11_Msk (0x01 << PORT_PORTA_INEN_PIN11_Pos) -#define PORT_PORTA_INEN_PIN12_Pos 12 -#define PORT_PORTA_INEN_PIN12_Msk (0x01 << PORT_PORTA_INEN_PIN12_Pos) -#define PORT_PORTA_INEN_PIN13_Pos 13 -#define PORT_PORTA_INEN_PIN13_Msk (0x01 << PORT_PORTA_INEN_PIN13_Pos) -#define PORT_PORTA_INEN_PIN14_Pos 14 -#define PORT_PORTA_INEN_PIN14_Msk (0x01 << PORT_PORTA_INEN_PIN14_Pos) -#define PORT_PORTA_INEN_PIN15_Pos 15 -#define PORT_PORTA_INEN_PIN15_Msk (0x01 << PORT_PORTA_INEN_PIN15_Pos) +#define PORT_PORTP_DRIVS_PIN0_Pos 0 +#define PORT_PORTP_DRIVS_PIN0_Msk (0x01 << PORT_PORTP_DRIVS_PIN0_Pos) +#define PORT_PORTP_DRIVS_PIN1_Pos 1 +#define PORT_PORTP_DRIVS_PIN1_Msk (0x01 << PORT_PORTP_DRIVS_PIN1_Pos) +#define PORT_PORTP_DRIVS_PIN2_Pos 2 +#define PORT_PORTP_DRIVS_PIN2_Msk (0x01 << PORT_PORTP_DRIVS_PIN2_Pos) +#define PORT_PORTP_DRIVS_PIN3_Pos 3 +#define PORT_PORTP_DRIVS_PIN3_Msk (0x01 << PORT_PORTP_DRIVS_PIN3_Pos) +#define PORT_PORTP_DRIVS_PIN4_Pos 4 +#define PORT_PORTP_DRIVS_PIN4_Msk (0x01 << PORT_PORTP_DRIVS_PIN4_Pos) +#define PORT_PORTP_DRIVS_PIN5_Pos 5 +#define PORT_PORTP_DRIVS_PIN5_Msk (0x01 << PORT_PORTP_DRIVS_PIN5_Pos) +#define PORT_PORTP_DRIVS_PIN6_Pos 6 +#define PORT_PORTP_DRIVS_PIN6_Msk (0x01 << PORT_PORTP_DRIVS_PIN6_Pos) +#define PORT_PORTP_DRIVS_PIN7_Pos 7 +#define PORT_PORTP_DRIVS_PIN7_Msk (0x01 << PORT_PORTP_DRIVS_PIN7_Pos) +#define PORT_PORTP_DRIVS_PIN8_Pos 8 +#define PORT_PORTP_DRIVS_PIN8_Msk (0x01 << PORT_PORTP_DRIVS_PIN8_Pos) +#define PORT_PORTP_DRIVS_PIN9_Pos 9 +#define PORT_PORTP_DRIVS_PIN9_Msk (0x01 << PORT_PORTP_DRIVS_PIN9_Pos) +#define PORT_PORTP_DRIVS_PIN10_Pos 10 +#define PORT_PORTP_DRIVS_PIN10_Msk (0x01 << PORT_PORTP_DRIVS_PIN10_Pos) +#define PORT_PORTP_DRIVS_PIN11_Pos 11 +#define PORT_PORTP_DRIVS_PIN11_Msk (0x01 << PORT_PORTP_DRIVS_PIN11_Pos) +#define PORT_PORTP_DRIVS_PIN12_Pos 12 +#define PORT_PORTP_DRIVS_PIN12_Msk (0x01 << PORT_PORTP_DRIVS_PIN12_Pos) +#define PORT_PORTP_DRIVS_PIN13_Pos 13 +#define PORT_PORTP_DRIVS_PIN13_Msk (0x01 << PORT_PORTP_DRIVS_PIN13_Pos) +#define PORT_PORTP_DRIVS_PIN14_Pos 14 +#define PORT_PORTP_DRIVS_PIN14_Msk (0x01 << PORT_PORTP_DRIVS_PIN14_Pos) +#define PORT_PORTP_DRIVS_PIN15_Pos 15 +#define PORT_PORTP_DRIVS_PIN15_Msk (0x01 << PORT_PORTP_DRIVS_PIN15_Pos) +#define PORT_PORTP_DRIVS_PIN16_Pos 16 +#define PORT_PORTP_DRIVS_PIN16_Msk (0x01 << PORT_PORTP_DRIVS_PIN16_Pos) +#define PORT_PORTP_DRIVS_PIN17_Pos 17 +#define PORT_PORTP_DRIVS_PIN17_Msk (0x01 << PORT_PORTP_DRIVS_PIN17_Pos) +#define PORT_PORTP_DRIVS_PIN18_Pos 18 +#define PORT_PORTP_DRIVS_PIN18_Msk (0x01 << PORT_PORTP_DRIVS_PIN18_Pos) +#define PORT_PORTP_DRIVS_PIN19_Pos 19 +#define PORT_PORTP_DRIVS_PIN19_Msk (0x01 << PORT_PORTP_DRIVS_PIN19_Pos) +#define PORT_PORTP_DRIVS_PIN20_Pos 20 +#define PORT_PORTP_DRIVS_PIN20_Msk (0x01 << PORT_PORTP_DRIVS_PIN20_Pos) +#define PORT_PORTP_DRIVS_PIN21_Pos 21 +#define PORT_PORTP_DRIVS_PIN21_Msk (0x01 << PORT_PORTP_DRIVS_PIN21_Pos) +#define PORT_PORTP_DRIVS_PIN22_Pos 22 +#define PORT_PORTP_DRIVS_PIN22_Msk (0x01 << PORT_PORTP_DRIVS_PIN22_Pos) +#define PORT_PORTP_DRIVS_PIN23_Pos 23 +#define PORT_PORTP_DRIVS_PIN23_Msk (0x01 << PORT_PORTP_DRIVS_PIN23_Pos) -#define PORT_PORTB_INEN_PIN0_Pos 0 -#define PORT_PORTB_INEN_PIN0_Msk (0x01 << PORT_PORTB_INEN_PIN0_Pos) -#define PORT_PORTB_INEN_PIN1_Pos 1 -#define PORT_PORTB_INEN_PIN1_Msk (0x01 << PORT_PORTB_INEN_PIN1_Pos) -#define PORT_PORTB_INEN_PIN2_Pos 2 -#define PORT_PORTB_INEN_PIN2_Msk (0x01 << PORT_PORTB_INEN_PIN2_Pos) -#define PORT_PORTB_INEN_PIN3_Pos 3 -#define PORT_PORTB_INEN_PIN3_Msk (0x01 << PORT_PORTB_INEN_PIN3_Pos) -#define PORT_PORTB_INEN_PIN4_Pos 4 -#define PORT_PORTB_INEN_PIN4_Msk (0x01 << PORT_PORTB_INEN_PIN4_Pos) -#define PORT_PORTB_INEN_PIN5_Pos 5 -#define PORT_PORTB_INEN_PIN5_Msk (0x01 << PORT_PORTB_INEN_PIN5_Pos) -#define PORT_PORTB_INEN_PIN6_Pos 6 -#define PORT_PORTB_INEN_PIN6_Msk (0x01 << PORT_PORTB_INEN_PIN6_Pos) -#define PORT_PORTB_INEN_PIN7_Pos 7 -#define PORT_PORTB_INEN_PIN7_Msk (0x01 << PORT_PORTB_INEN_PIN7_Pos) -#define PORT_PORTB_INEN_PIN8_Pos 8 -#define PORT_PORTB_INEN_PIN8_Msk (0x01 << PORT_PORTB_INEN_PIN8_Pos) -#define PORT_PORTB_INEN_PIN9_Pos 9 -#define PORT_PORTB_INEN_PIN9_Msk (0x01 << PORT_PORTB_INEN_PIN9_Pos) -#define PORT_PORTB_INEN_PIN10_Pos 10 -#define PORT_PORTB_INEN_PIN10_Msk (0x01 << PORT_PORTB_INEN_PIN10_Pos) -#define PORT_PORTB_INEN_PIN11_Pos 11 -#define PORT_PORTB_INEN_PIN11_Msk (0x01 << PORT_PORTB_INEN_PIN11_Pos) -#define PORT_PORTB_INEN_PIN12_Pos 12 -#define PORT_PORTB_INEN_PIN12_Msk (0x01 << PORT_PORTB_INEN_PIN12_Pos) -#define PORT_PORTB_INEN_PIN13_Pos 13 -#define PORT_PORTB_INEN_PIN13_Msk (0x01 << PORT_PORTB_INEN_PIN13_Pos) -#define PORT_PORTB_INEN_PIN14_Pos 14 -#define PORT_PORTB_INEN_PIN14_Msk (0x01 << PORT_PORTB_INEN_PIN14_Pos) -#define PORT_PORTB_INEN_PIN15_Pos 15 -#define PORT_PORTB_INEN_PIN15_Msk (0x01 << PORT_PORTB_INEN_PIN15_Pos) +#define PORT_PORTA_INEN_PIN0_Pos 0 +#define PORT_PORTA_INEN_PIN0_Msk (0x01 << PORT_PORTA_INEN_PIN0_Pos) +#define PORT_PORTA_INEN_PIN1_Pos 1 +#define PORT_PORTA_INEN_PIN1_Msk (0x01 << PORT_PORTA_INEN_PIN1_Pos) +#define PORT_PORTA_INEN_PIN2_Pos 2 +#define PORT_PORTA_INEN_PIN2_Msk (0x01 << PORT_PORTA_INEN_PIN2_Pos) +#define PORT_PORTA_INEN_PIN3_Pos 3 +#define PORT_PORTA_INEN_PIN3_Msk (0x01 << PORT_PORTA_INEN_PIN3_Pos) +#define PORT_PORTA_INEN_PIN4_Pos 4 +#define PORT_PORTA_INEN_PIN4_Msk (0x01 << PORT_PORTA_INEN_PIN4_Pos) +#define PORT_PORTA_INEN_PIN5_Pos 5 +#define PORT_PORTA_INEN_PIN5_Msk (0x01 << PORT_PORTA_INEN_PIN5_Pos) +#define PORT_PORTA_INEN_PIN6_Pos 6 +#define PORT_PORTA_INEN_PIN6_Msk (0x01 << PORT_PORTA_INEN_PIN6_Pos) +#define PORT_PORTA_INEN_PIN7_Pos 7 +#define PORT_PORTA_INEN_PIN7_Msk (0x01 << PORT_PORTA_INEN_PIN7_Pos) +#define PORT_PORTA_INEN_PIN8_Pos 8 +#define PORT_PORTA_INEN_PIN8_Msk (0x01 << PORT_PORTA_INEN_PIN8_Pos) +#define PORT_PORTA_INEN_PIN9_Pos 9 +#define PORT_PORTA_INEN_PIN9_Msk (0x01 << PORT_PORTA_INEN_PIN9_Pos) +#define PORT_PORTA_INEN_PIN10_Pos 10 +#define PORT_PORTA_INEN_PIN10_Msk (0x01 << PORT_PORTA_INEN_PIN10_Pos) +#define PORT_PORTA_INEN_PIN11_Pos 11 +#define PORT_PORTA_INEN_PIN11_Msk (0x01 << PORT_PORTA_INEN_PIN11_Pos) +#define PORT_PORTA_INEN_PIN12_Pos 12 +#define PORT_PORTA_INEN_PIN12_Msk (0x01 << PORT_PORTA_INEN_PIN12_Pos) +#define PORT_PORTA_INEN_PIN13_Pos 13 +#define PORT_PORTA_INEN_PIN13_Msk (0x01 << PORT_PORTA_INEN_PIN13_Pos) +#define PORT_PORTA_INEN_PIN14_Pos 14 +#define PORT_PORTA_INEN_PIN14_Msk (0x01 << PORT_PORTA_INEN_PIN14_Pos) +#define PORT_PORTA_INEN_PIN15_Pos 15 +#define PORT_PORTA_INEN_PIN15_Msk (0x01 << PORT_PORTA_INEN_PIN15_Pos) -#define PORT_PORTC_INEN_PIN0_Pos 0 -#define PORT_PORTC_INEN_PIN0_Msk (0x01 << PORT_PORTC_INEN_PIN0_Pos) -#define PORT_PORTC_INEN_PIN1_Pos 1 -#define PORT_PORTC_INEN_PIN1_Msk (0x01 << PORT_PORTC_INEN_PIN1_Pos) -#define PORT_PORTC_INEN_PIN2_Pos 2 -#define PORT_PORTC_INEN_PIN2_Msk (0x01 << PORT_PORTC_INEN_PIN2_Pos) -#define PORT_PORTC_INEN_PIN3_Pos 3 -#define PORT_PORTC_INEN_PIN3_Msk (0x01 << PORT_PORTC_INEN_PIN3_Pos) -#define PORT_PORTC_INEN_PIN4_Pos 4 -#define PORT_PORTC_INEN_PIN4_Msk (0x01 << PORT_PORTC_INEN_PIN4_Pos) -#define PORT_PORTC_INEN_PIN5_Pos 5 -#define PORT_PORTC_INEN_PIN5_Msk (0x01 << PORT_PORTC_INEN_PIN5_Pos) -#define PORT_PORTC_INEN_PIN6_Pos 6 -#define PORT_PORTC_INEN_PIN6_Msk (0x01 << PORT_PORTC_INEN_PIN6_Pos) -#define PORT_PORTC_INEN_PIN7_Pos 7 -#define PORT_PORTC_INEN_PIN7_Msk (0x01 << PORT_PORTC_INEN_PIN7_Pos) -#define PORT_PORTC_INEN_PIN8_Pos 8 -#define PORT_PORTC_INEN_PIN8_Msk (0x01 << PORT_PORTC_INEN_PIN8_Pos) -#define PORT_PORTC_INEN_PIN9_Pos 9 -#define PORT_PORTC_INEN_PIN9_Msk (0x01 << PORT_PORTC_INEN_PIN9_Pos) -#define PORT_PORTC_INEN_PIN10_Pos 10 -#define PORT_PORTC_INEN_PIN10_Msk (0x01 << PORT_PORTC_INEN_PIN10_Pos) -#define PORT_PORTC_INEN_PIN11_Pos 11 -#define PORT_PORTC_INEN_PIN11_Msk (0x01 << PORT_PORTC_INEN_PIN11_Pos) -#define PORT_PORTC_INEN_PIN12_Pos 12 -#define PORT_PORTC_INEN_PIN12_Msk (0x01 << PORT_PORTC_INEN_PIN12_Pos) -#define PORT_PORTC_INEN_PIN13_Pos 13 -#define PORT_PORTC_INEN_PIN13_Msk (0x01 << PORT_PORTC_INEN_PIN13_Pos) -#define PORT_PORTC_INEN_PIN14_Pos 14 -#define PORT_PORTC_INEN_PIN14_Msk (0x01 << PORT_PORTC_INEN_PIN14_Pos) -#define PORT_PORTC_INEN_PIN15_Pos 15 -#define PORT_PORTC_INEN_PIN15_Msk (0x01 << PORT_PORTC_INEN_PIN15_Pos) +#define PORT_PORTB_INEN_PIN0_Pos 0 +#define PORT_PORTB_INEN_PIN0_Msk (0x01 << PORT_PORTB_INEN_PIN0_Pos) +#define PORT_PORTB_INEN_PIN1_Pos 1 +#define PORT_PORTB_INEN_PIN1_Msk (0x01 << PORT_PORTB_INEN_PIN1_Pos) +#define PORT_PORTB_INEN_PIN2_Pos 2 +#define PORT_PORTB_INEN_PIN2_Msk (0x01 << PORT_PORTB_INEN_PIN2_Pos) +#define PORT_PORTB_INEN_PIN3_Pos 3 +#define PORT_PORTB_INEN_PIN3_Msk (0x01 << PORT_PORTB_INEN_PIN3_Pos) +#define PORT_PORTB_INEN_PIN4_Pos 4 +#define PORT_PORTB_INEN_PIN4_Msk (0x01 << PORT_PORTB_INEN_PIN4_Pos) +#define PORT_PORTB_INEN_PIN5_Pos 5 +#define PORT_PORTB_INEN_PIN5_Msk (0x01 << PORT_PORTB_INEN_PIN5_Pos) +#define PORT_PORTB_INEN_PIN6_Pos 6 +#define PORT_PORTB_INEN_PIN6_Msk (0x01 << PORT_PORTB_INEN_PIN6_Pos) +#define PORT_PORTB_INEN_PIN7_Pos 7 +#define PORT_PORTB_INEN_PIN7_Msk (0x01 << PORT_PORTB_INEN_PIN7_Pos) +#define PORT_PORTB_INEN_PIN8_Pos 8 +#define PORT_PORTB_INEN_PIN8_Msk (0x01 << PORT_PORTB_INEN_PIN8_Pos) +#define PORT_PORTB_INEN_PIN9_Pos 9 +#define PORT_PORTB_INEN_PIN9_Msk (0x01 << PORT_PORTB_INEN_PIN9_Pos) +#define PORT_PORTB_INEN_PIN10_Pos 10 +#define PORT_PORTB_INEN_PIN10_Msk (0x01 << PORT_PORTB_INEN_PIN10_Pos) +#define PORT_PORTB_INEN_PIN11_Pos 11 +#define PORT_PORTB_INEN_PIN11_Msk (0x01 << PORT_PORTB_INEN_PIN11_Pos) +#define PORT_PORTB_INEN_PIN12_Pos 12 +#define PORT_PORTB_INEN_PIN12_Msk (0x01 << PORT_PORTB_INEN_PIN12_Pos) +#define PORT_PORTB_INEN_PIN13_Pos 13 +#define PORT_PORTB_INEN_PIN13_Msk (0x01 << PORT_PORTB_INEN_PIN13_Pos) +#define PORT_PORTB_INEN_PIN14_Pos 14 +#define PORT_PORTB_INEN_PIN14_Msk (0x01 << PORT_PORTB_INEN_PIN14_Pos) +#define PORT_PORTB_INEN_PIN15_Pos 15 +#define PORT_PORTB_INEN_PIN15_Msk (0x01 << PORT_PORTB_INEN_PIN15_Pos) -#define PORT_PORTM_INEN_PIN0_Pos 0 -#define PORT_PORTM_INEN_PIN0_Msk (0x01 << PORT_PORTM_INEN_PIN0_Pos) -#define PORT_PORTM_INEN_PIN1_Pos 1 -#define PORT_PORTM_INEN_PIN1_Msk (0x01 << PORT_PORTM_INEN_PIN1_Pos) -#define PORT_PORTM_INEN_PIN2_Pos 2 -#define PORT_PORTM_INEN_PIN2_Msk (0x01 << PORT_PORTM_INEN_PIN2_Pos) -#define PORT_PORTM_INEN_PIN3_Pos 3 -#define PORT_PORTM_INEN_PIN3_Msk (0x01 << PORT_PORTM_INEN_PIN3_Pos) -#define PORT_PORTM_INEN_PIN4_Pos 4 -#define PORT_PORTM_INEN_PIN4_Msk (0x01 << PORT_PORTM_INEN_PIN4_Pos) -#define PORT_PORTM_INEN_PIN5_Pos 5 -#define PORT_PORTM_INEN_PIN5_Msk (0x01 << PORT_PORTM_INEN_PIN5_Pos) -#define PORT_PORTM_INEN_PIN6_Pos 6 -#define PORT_PORTM_INEN_PIN6_Msk (0x01 << PORT_PORTM_INEN_PIN6_Pos) -#define PORT_PORTM_INEN_PIN7_Pos 7 -#define PORT_PORTM_INEN_PIN7_Msk (0x01 << PORT_PORTM_INEN_PIN7_Pos) -#define PORT_PORTM_INEN_PIN8_Pos 8 -#define PORT_PORTM_INEN_PIN8_Msk (0x01 << PORT_PORTM_INEN_PIN8_Pos) -#define PORT_PORTM_INEN_PIN9_Pos 9 -#define PORT_PORTM_INEN_PIN9_Msk (0x01 << PORT_PORTM_INEN_PIN9_Pos) -#define PORT_PORTM_INEN_PIN10_Pos 10 -#define PORT_PORTM_INEN_PIN10_Msk (0x01 << PORT_PORTM_INEN_PIN10_Pos) -#define PORT_PORTM_INEN_PIN11_Pos 11 -#define PORT_PORTM_INEN_PIN11_Msk (0x01 << PORT_PORTM_INEN_PIN11_Pos) -#define PORT_PORTM_INEN_PIN12_Pos 12 -#define PORT_PORTM_INEN_PIN12_Msk (0x01 << PORT_PORTM_INEN_PIN12_Pos) -#define PORT_PORTM_INEN_PIN13_Pos 13 -#define PORT_PORTM_INEN_PIN13_Msk (0x01 << PORT_PORTM_INEN_PIN13_Pos) -#define PORT_PORTM_INEN_PIN14_Pos 14 -#define PORT_PORTM_INEN_PIN14_Msk (0x01 << PORT_PORTM_INEN_PIN14_Pos) -#define PORT_PORTM_INEN_PIN15_Pos 15 -#define PORT_PORTM_INEN_PIN15_Msk (0x01 << PORT_PORTM_INEN_PIN15_Pos) -#define PORT_PORTM_INEN_PIN16_Pos 16 -#define PORT_PORTM_INEN_PIN16_Msk (0x01 << PORT_PORTM_INEN_PIN16_Pos) -#define PORT_PORTM_INEN_PIN17_Pos 17 -#define PORT_PORTM_INEN_PIN17_Msk (0x01 << PORT_PORTM_INEN_PIN17_Pos) -#define PORT_PORTM_INEN_PIN18_Pos 18 -#define PORT_PORTM_INEN_PIN18_Msk (0x01 << PORT_PORTM_INEN_PIN18_Pos) -#define PORT_PORTM_INEN_PIN19_Pos 19 -#define PORT_PORTM_INEN_PIN19_Msk (0x01 << PORT_PORTM_INEN_PIN19_Pos) -#define PORT_PORTM_INEN_PIN20_Pos 20 -#define PORT_PORTM_INEN_PIN20_Msk (0x01 << PORT_PORTM_INEN_PIN20_Pos) -#define PORT_PORTM_INEN_PIN21_Pos 21 -#define PORT_PORTM_INEN_PIN21_Msk (0x01 << PORT_PORTM_INEN_PIN21_Pos) -#define PORT_PORTM_INEN_PIN22_Pos 22 -#define PORT_PORTM_INEN_PIN22_Msk (0x01 << PORT_PORTM_INEN_PIN22_Pos) -#define PORT_PORTM_INEN_PIN23_Pos 23 -#define PORT_PORTM_INEN_PIN23_Msk (0x01 << PORT_PORTM_INEN_PIN23_Pos) +#define PORT_PORTC_INEN_PIN0_Pos 0 +#define PORT_PORTC_INEN_PIN0_Msk (0x01 << PORT_PORTC_INEN_PIN0_Pos) +#define PORT_PORTC_INEN_PIN1_Pos 1 +#define PORT_PORTC_INEN_PIN1_Msk (0x01 << PORT_PORTC_INEN_PIN1_Pos) +#define PORT_PORTC_INEN_PIN2_Pos 2 +#define PORT_PORTC_INEN_PIN2_Msk (0x01 << PORT_PORTC_INEN_PIN2_Pos) +#define PORT_PORTC_INEN_PIN3_Pos 3 +#define PORT_PORTC_INEN_PIN3_Msk (0x01 << PORT_PORTC_INEN_PIN3_Pos) +#define PORT_PORTC_INEN_PIN4_Pos 4 +#define PORT_PORTC_INEN_PIN4_Msk (0x01 << PORT_PORTC_INEN_PIN4_Pos) +#define PORT_PORTC_INEN_PIN5_Pos 5 +#define PORT_PORTC_INEN_PIN5_Msk (0x01 << PORT_PORTC_INEN_PIN5_Pos) +#define PORT_PORTC_INEN_PIN6_Pos 6 +#define PORT_PORTC_INEN_PIN6_Msk (0x01 << PORT_PORTC_INEN_PIN6_Pos) +#define PORT_PORTC_INEN_PIN7_Pos 7 +#define PORT_PORTC_INEN_PIN7_Msk (0x01 << PORT_PORTC_INEN_PIN7_Pos) +#define PORT_PORTC_INEN_PIN8_Pos 8 +#define PORT_PORTC_INEN_PIN8_Msk (0x01 << PORT_PORTC_INEN_PIN8_Pos) +#define PORT_PORTC_INEN_PIN9_Pos 9 +#define PORT_PORTC_INEN_PIN9_Msk (0x01 << PORT_PORTC_INEN_PIN9_Pos) +#define PORT_PORTC_INEN_PIN10_Pos 10 +#define PORT_PORTC_INEN_PIN10_Msk (0x01 << PORT_PORTC_INEN_PIN10_Pos) +#define PORT_PORTC_INEN_PIN11_Pos 11 +#define PORT_PORTC_INEN_PIN11_Msk (0x01 << PORT_PORTC_INEN_PIN11_Pos) +#define PORT_PORTC_INEN_PIN12_Pos 12 +#define PORT_PORTC_INEN_PIN12_Msk (0x01 << PORT_PORTC_INEN_PIN12_Pos) +#define PORT_PORTC_INEN_PIN13_Pos 13 +#define PORT_PORTC_INEN_PIN13_Msk (0x01 << PORT_PORTC_INEN_PIN13_Pos) +#define PORT_PORTC_INEN_PIN14_Pos 14 +#define PORT_PORTC_INEN_PIN14_Msk (0x01 << PORT_PORTC_INEN_PIN14_Pos) +#define PORT_PORTC_INEN_PIN15_Pos 15 +#define PORT_PORTC_INEN_PIN15_Msk (0x01 << PORT_PORTC_INEN_PIN15_Pos) -#define PORT_PORTN_INEN_PIN0_Pos 0 -#define PORT_PORTN_INEN_PIN0_Msk (0x01 << PORT_PORTN_INEN_PIN0_Pos) -#define PORT_PORTN_INEN_PIN1_Pos 1 -#define PORT_PORTN_INEN_PIN1_Msk (0x01 << PORT_PORTN_INEN_PIN1_Pos) -#define PORT_PORTN_INEN_PIN2_Pos 2 -#define PORT_PORTN_INEN_PIN2_Msk (0x01 << PORT_PORTN_INEN_PIN2_Pos) -#define PORT_PORTN_INEN_PIN3_Pos 3 -#define PORT_PORTN_INEN_PIN3_Msk (0x01 << PORT_PORTN_INEN_PIN3_Pos) -#define PORT_PORTN_INEN_PIN4_Pos 4 -#define PORT_PORTN_INEN_PIN4_Msk (0x01 << PORT_PORTN_INEN_PIN4_Pos) -#define PORT_PORTN_INEN_PIN5_Pos 5 -#define PORT_PORTN_INEN_PIN5_Msk (0x01 << PORT_PORTN_INEN_PIN5_Pos) -#define PORT_PORTN_INEN_PIN6_Pos 6 -#define PORT_PORTN_INEN_PIN6_Msk (0x01 << PORT_PORTN_INEN_PIN6_Pos) -#define PORT_PORTN_INEN_PIN7_Pos 7 -#define PORT_PORTN_INEN_PIN7_Msk (0x01 << PORT_PORTN_INEN_PIN7_Pos) -#define PORT_PORTN_INEN_PIN8_Pos 8 -#define PORT_PORTN_INEN_PIN8_Msk (0x01 << PORT_PORTN_INEN_PIN8_Pos) -#define PORT_PORTN_INEN_PIN9_Pos 9 -#define PORT_PORTN_INEN_PIN9_Msk (0x01 << PORT_PORTN_INEN_PIN9_Pos) -#define PORT_PORTN_INEN_PIN10_Pos 10 -#define PORT_PORTN_INEN_PIN10_Msk (0x01 << PORT_PORTN_INEN_PIN10_Pos) -#define PORT_PORTN_INEN_PIN11_Pos 11 -#define PORT_PORTN_INEN_PIN11_Msk (0x01 << PORT_PORTN_INEN_PIN11_Pos) -#define PORT_PORTN_INEN_PIN12_Pos 12 -#define PORT_PORTN_INEN_PIN12_Msk (0x01 << PORT_PORTN_INEN_PIN12_Pos) -#define PORT_PORTN_INEN_PIN13_Pos 13 -#define PORT_PORTN_INEN_PIN13_Msk (0x01 << PORT_PORTN_INEN_PIN13_Pos) -#define PORT_PORTN_INEN_PIN14_Pos 14 -#define PORT_PORTN_INEN_PIN14_Msk (0x01 << PORT_PORTN_INEN_PIN14_Pos) -#define PORT_PORTN_INEN_PIN15_Pos 15 -#define PORT_PORTN_INEN_PIN15_Msk (0x01 << PORT_PORTN_INEN_PIN15_Pos) -#define PORT_PORTN_INEN_PIN16_Pos 16 -#define PORT_PORTN_INEN_PIN16_Msk (0x01 << PORT_PORTN_INEN_PIN16_Pos) -#define PORT_PORTN_INEN_PIN17_Pos 17 -#define PORT_PORTN_INEN_PIN17_Msk (0x01 << PORT_PORTN_INEN_PIN17_Pos) -#define PORT_PORTN_INEN_PIN18_Pos 18 -#define PORT_PORTN_INEN_PIN18_Msk (0x01 << PORT_PORTN_INEN_PIN18_Pos) -#define PORT_PORTN_INEN_PIN19_Pos 19 -#define PORT_PORTN_INEN_PIN19_Msk (0x01 << PORT_PORTN_INEN_PIN19_Pos) -#define PORT_PORTN_INEN_PIN20_Pos 20 -#define PORT_PORTN_INEN_PIN20_Msk (0x01 << PORT_PORTN_INEN_PIN20_Pos) -#define PORT_PORTN_INEN_PIN21_Pos 21 -#define PORT_PORTN_INEN_PIN21_Msk (0x01 << PORT_PORTN_INEN_PIN21_Pos) -#define PORT_PORTN_INEN_PIN22_Pos 22 -#define PORT_PORTN_INEN_PIN22_Msk (0x01 << PORT_PORTN_INEN_PIN22_Pos) -#define PORT_PORTN_INEN_PIN23_Pos 23 -#define PORT_PORTN_INEN_PIN23_Msk (0x01 << PORT_PORTN_INEN_PIN23_Pos) +#define PORT_PORTM_INEN_PIN0_Pos 0 +#define PORT_PORTM_INEN_PIN0_Msk (0x01 << PORT_PORTM_INEN_PIN0_Pos) +#define PORT_PORTM_INEN_PIN1_Pos 1 +#define PORT_PORTM_INEN_PIN1_Msk (0x01 << PORT_PORTM_INEN_PIN1_Pos) +#define PORT_PORTM_INEN_PIN2_Pos 2 +#define PORT_PORTM_INEN_PIN2_Msk (0x01 << PORT_PORTM_INEN_PIN2_Pos) +#define PORT_PORTM_INEN_PIN3_Pos 3 +#define PORT_PORTM_INEN_PIN3_Msk (0x01 << PORT_PORTM_INEN_PIN3_Pos) +#define PORT_PORTM_INEN_PIN4_Pos 4 +#define PORT_PORTM_INEN_PIN4_Msk (0x01 << PORT_PORTM_INEN_PIN4_Pos) +#define PORT_PORTM_INEN_PIN5_Pos 5 +#define PORT_PORTM_INEN_PIN5_Msk (0x01 << PORT_PORTM_INEN_PIN5_Pos) +#define PORT_PORTM_INEN_PIN6_Pos 6 +#define PORT_PORTM_INEN_PIN6_Msk (0x01 << PORT_PORTM_INEN_PIN6_Pos) +#define PORT_PORTM_INEN_PIN7_Pos 7 +#define PORT_PORTM_INEN_PIN7_Msk (0x01 << PORT_PORTM_INEN_PIN7_Pos) +#define PORT_PORTM_INEN_PIN8_Pos 8 +#define PORT_PORTM_INEN_PIN8_Msk (0x01 << PORT_PORTM_INEN_PIN8_Pos) +#define PORT_PORTM_INEN_PIN9_Pos 9 +#define PORT_PORTM_INEN_PIN9_Msk (0x01 << PORT_PORTM_INEN_PIN9_Pos) +#define PORT_PORTM_INEN_PIN10_Pos 10 +#define PORT_PORTM_INEN_PIN10_Msk (0x01 << PORT_PORTM_INEN_PIN10_Pos) +#define PORT_PORTM_INEN_PIN11_Pos 11 +#define PORT_PORTM_INEN_PIN11_Msk (0x01 << PORT_PORTM_INEN_PIN11_Pos) +#define PORT_PORTM_INEN_PIN12_Pos 12 +#define PORT_PORTM_INEN_PIN12_Msk (0x01 << PORT_PORTM_INEN_PIN12_Pos) +#define PORT_PORTM_INEN_PIN13_Pos 13 +#define PORT_PORTM_INEN_PIN13_Msk (0x01 << PORT_PORTM_INEN_PIN13_Pos) +#define PORT_PORTM_INEN_PIN14_Pos 14 +#define PORT_PORTM_INEN_PIN14_Msk (0x01 << PORT_PORTM_INEN_PIN14_Pos) +#define PORT_PORTM_INEN_PIN15_Pos 15 +#define PORT_PORTM_INEN_PIN15_Msk (0x01 << PORT_PORTM_INEN_PIN15_Pos) +#define PORT_PORTM_INEN_PIN16_Pos 16 +#define PORT_PORTM_INEN_PIN16_Msk (0x01 << PORT_PORTM_INEN_PIN16_Pos) +#define PORT_PORTM_INEN_PIN17_Pos 17 +#define PORT_PORTM_INEN_PIN17_Msk (0x01 << PORT_PORTM_INEN_PIN17_Pos) +#define PORT_PORTM_INEN_PIN18_Pos 18 +#define PORT_PORTM_INEN_PIN18_Msk (0x01 << PORT_PORTM_INEN_PIN18_Pos) +#define PORT_PORTM_INEN_PIN19_Pos 19 +#define PORT_PORTM_INEN_PIN19_Msk (0x01 << PORT_PORTM_INEN_PIN19_Pos) +#define PORT_PORTM_INEN_PIN20_Pos 20 +#define PORT_PORTM_INEN_PIN20_Msk (0x01 << PORT_PORTM_INEN_PIN20_Pos) +#define PORT_PORTM_INEN_PIN21_Pos 21 +#define PORT_PORTM_INEN_PIN21_Msk (0x01 << PORT_PORTM_INEN_PIN21_Pos) +#define PORT_PORTM_INEN_PIN22_Pos 22 +#define PORT_PORTM_INEN_PIN22_Msk (0x01 << PORT_PORTM_INEN_PIN22_Pos) +#define PORT_PORTM_INEN_PIN23_Pos 23 +#define PORT_PORTM_INEN_PIN23_Msk (0x01 << PORT_PORTM_INEN_PIN23_Pos) -#define PORT_PORTP_INEN_PIN0_Pos 0 -#define PORT_PORTP_INEN_PIN0_Msk (0x01 << PORT_PORTP_INEN_PIN0_Pos) -#define PORT_PORTP_INEN_PIN1_Pos 1 -#define PORT_PORTP_INEN_PIN1_Msk (0x01 << PORT_PORTP_INEN_PIN1_Pos) -#define PORT_PORTP_INEN_PIN2_Pos 2 -#define PORT_PORTP_INEN_PIN2_Msk (0x01 << PORT_PORTP_INEN_PIN2_Pos) -#define PORT_PORTP_INEN_PIN3_Pos 3 -#define PORT_PORTP_INEN_PIN3_Msk (0x01 << PORT_PORTP_INEN_PIN3_Pos) -#define PORT_PORTP_INEN_PIN4_Pos 4 -#define PORT_PORTP_INEN_PIN4_Msk (0x01 << PORT_PORTP_INEN_PIN4_Pos) -#define PORT_PORTP_INEN_PIN5_Pos 5 -#define PORT_PORTP_INEN_PIN5_Msk (0x01 << PORT_PORTP_INEN_PIN5_Pos) -#define PORT_PORTP_INEN_PIN6_Pos 6 -#define PORT_PORTP_INEN_PIN6_Msk (0x01 << PORT_PORTP_INEN_PIN6_Pos) -#define PORT_PORTP_INEN_PIN7_Pos 7 -#define PORT_PORTP_INEN_PIN7_Msk (0x01 << PORT_PORTP_INEN_PIN7_Pos) -#define PORT_PORTP_INEN_PIN8_Pos 8 -#define PORT_PORTP_INEN_PIN8_Msk (0x01 << PORT_PORTP_INEN_PIN8_Pos) -#define PORT_PORTP_INEN_PIN9_Pos 9 -#define PORT_PORTP_INEN_PIN9_Msk (0x01 << PORT_PORTP_INEN_PIN9_Pos) -#define PORT_PORTP_INEN_PIN10_Pos 10 -#define PORT_PORTP_INEN_PIN10_Msk (0x01 << PORT_PORTP_INEN_PIN10_Pos) -#define PORT_PORTP_INEN_PIN11_Pos 11 -#define PORT_PORTP_INEN_PIN11_Msk (0x01 << PORT_PORTP_INEN_PIN11_Pos) -#define PORT_PORTP_INEN_PIN12_Pos 12 -#define PORT_PORTP_INEN_PIN12_Msk (0x01 << PORT_PORTP_INEN_PIN12_Pos) -#define PORT_PORTP_INEN_PIN13_Pos 13 -#define PORT_PORTP_INEN_PIN13_Msk (0x01 << PORT_PORTP_INEN_PIN13_Pos) -#define PORT_PORTP_INEN_PIN14_Pos 14 -#define PORT_PORTP_INEN_PIN14_Msk (0x01 << PORT_PORTP_INEN_PIN14_Pos) -#define PORT_PORTP_INEN_PIN15_Pos 15 -#define PORT_PORTP_INEN_PIN15_Msk (0x01 << PORT_PORTP_INEN_PIN15_Pos) -#define PORT_PORTP_INEN_PIN16_Pos 16 -#define PORT_PORTP_INEN_PIN16_Msk (0x01 << PORT_PORTP_INEN_PIN16_Pos) -#define PORT_PORTP_INEN_PIN17_Pos 17 -#define PORT_PORTP_INEN_PIN17_Msk (0x01 << PORT_PORTP_INEN_PIN17_Pos) -#define PORT_PORTP_INEN_PIN18_Pos 18 -#define PORT_PORTP_INEN_PIN18_Msk (0x01 << PORT_PORTP_INEN_PIN18_Pos) -#define PORT_PORTP_INEN_PIN19_Pos 19 -#define PORT_PORTP_INEN_PIN19_Msk (0x01 << PORT_PORTP_INEN_PIN19_Pos) -#define PORT_PORTP_INEN_PIN20_Pos 20 -#define PORT_PORTP_INEN_PIN20_Msk (0x01 << PORT_PORTP_INEN_PIN20_Pos) -#define PORT_PORTP_INEN_PIN21_Pos 21 -#define PORT_PORTP_INEN_PIN21_Msk (0x01 << PORT_PORTP_INEN_PIN21_Pos) -#define PORT_PORTP_INEN_PIN22_Pos 22 -#define PORT_PORTP_INEN_PIN22_Msk (0x01 << PORT_PORTP_INEN_PIN22_Pos) -#define PORT_PORTP_INEN_PIN23_Pos 23 -#define PORT_PORTP_INEN_PIN23_Msk (0x01 << PORT_PORTP_INEN_PIN23_Pos) +#define PORT_PORTN_INEN_PIN0_Pos 0 +#define PORT_PORTN_INEN_PIN0_Msk (0x01 << PORT_PORTN_INEN_PIN0_Pos) +#define PORT_PORTN_INEN_PIN1_Pos 1 +#define PORT_PORTN_INEN_PIN1_Msk (0x01 << PORT_PORTN_INEN_PIN1_Pos) +#define PORT_PORTN_INEN_PIN2_Pos 2 +#define PORT_PORTN_INEN_PIN2_Msk (0x01 << PORT_PORTN_INEN_PIN2_Pos) +#define PORT_PORTN_INEN_PIN3_Pos 3 +#define PORT_PORTN_INEN_PIN3_Msk (0x01 << PORT_PORTN_INEN_PIN3_Pos) +#define PORT_PORTN_INEN_PIN4_Pos 4 +#define PORT_PORTN_INEN_PIN4_Msk (0x01 << PORT_PORTN_INEN_PIN4_Pos) +#define PORT_PORTN_INEN_PIN5_Pos 5 +#define PORT_PORTN_INEN_PIN5_Msk (0x01 << PORT_PORTN_INEN_PIN5_Pos) +#define PORT_PORTN_INEN_PIN6_Pos 6 +#define PORT_PORTN_INEN_PIN6_Msk (0x01 << PORT_PORTN_INEN_PIN6_Pos) +#define PORT_PORTN_INEN_PIN7_Pos 7 +#define PORT_PORTN_INEN_PIN7_Msk (0x01 << PORT_PORTN_INEN_PIN7_Pos) +#define PORT_PORTN_INEN_PIN8_Pos 8 +#define PORT_PORTN_INEN_PIN8_Msk (0x01 << PORT_PORTN_INEN_PIN8_Pos) +#define PORT_PORTN_INEN_PIN9_Pos 9 +#define PORT_PORTN_INEN_PIN9_Msk (0x01 << PORT_PORTN_INEN_PIN9_Pos) +#define PORT_PORTN_INEN_PIN10_Pos 10 +#define PORT_PORTN_INEN_PIN10_Msk (0x01 << PORT_PORTN_INEN_PIN10_Pos) +#define PORT_PORTN_INEN_PIN11_Pos 11 +#define PORT_PORTN_INEN_PIN11_Msk (0x01 << PORT_PORTN_INEN_PIN11_Pos) +#define PORT_PORTN_INEN_PIN12_Pos 12 +#define PORT_PORTN_INEN_PIN12_Msk (0x01 << PORT_PORTN_INEN_PIN12_Pos) +#define PORT_PORTN_INEN_PIN13_Pos 13 +#define PORT_PORTN_INEN_PIN13_Msk (0x01 << PORT_PORTN_INEN_PIN13_Pos) +#define PORT_PORTN_INEN_PIN14_Pos 14 +#define PORT_PORTN_INEN_PIN14_Msk (0x01 << PORT_PORTN_INEN_PIN14_Pos) +#define PORT_PORTN_INEN_PIN15_Pos 15 +#define PORT_PORTN_INEN_PIN15_Msk (0x01 << PORT_PORTN_INEN_PIN15_Pos) +#define PORT_PORTN_INEN_PIN16_Pos 16 +#define PORT_PORTN_INEN_PIN16_Msk (0x01 << PORT_PORTN_INEN_PIN16_Pos) +#define PORT_PORTN_INEN_PIN17_Pos 17 +#define PORT_PORTN_INEN_PIN17_Msk (0x01 << PORT_PORTN_INEN_PIN17_Pos) +#define PORT_PORTN_INEN_PIN18_Pos 18 +#define PORT_PORTN_INEN_PIN18_Msk (0x01 << PORT_PORTN_INEN_PIN18_Pos) +#define PORT_PORTN_INEN_PIN19_Pos 19 +#define PORT_PORTN_INEN_PIN19_Msk (0x01 << PORT_PORTN_INEN_PIN19_Pos) +#define PORT_PORTN_INEN_PIN20_Pos 20 +#define PORT_PORTN_INEN_PIN20_Msk (0x01 << PORT_PORTN_INEN_PIN20_Pos) +#define PORT_PORTN_INEN_PIN21_Pos 21 +#define PORT_PORTN_INEN_PIN21_Msk (0x01 << PORT_PORTN_INEN_PIN21_Pos) +#define PORT_PORTN_INEN_PIN22_Pos 22 +#define PORT_PORTN_INEN_PIN22_Msk (0x01 << PORT_PORTN_INEN_PIN22_Pos) +#define PORT_PORTN_INEN_PIN23_Pos 23 +#define PORT_PORTN_INEN_PIN23_Msk (0x01 << PORT_PORTN_INEN_PIN23_Pos) -typedef struct -{ - __IO uint32_t DATA; -#define PIN0 0 -#define PIN1 1 -#define PIN2 2 -#define PIN3 3 -#define PIN4 4 -#define PIN5 5 -#define PIN6 6 -#define PIN7 7 -#define PIN8 8 -#define PIN9 9 -#define PIN10 10 -#define PIN11 11 -#define PIN12 12 -#define PIN13 13 -#define PIN14 14 -#define PIN15 15 -#define PIN16 16 -#define PIN17 17 -#define PIN18 18 -#define PIN19 19 -#define PIN20 20 -#define PIN21 21 -#define PIN22 22 -#define PIN23 23 -#define PIN24 24 +#define PORT_PORTP_INEN_PIN0_Pos 0 +#define PORT_PORTP_INEN_PIN0_Msk (0x01 << PORT_PORTP_INEN_PIN0_Pos) +#define PORT_PORTP_INEN_PIN1_Pos 1 +#define PORT_PORTP_INEN_PIN1_Msk (0x01 << PORT_PORTP_INEN_PIN1_Pos) +#define PORT_PORTP_INEN_PIN2_Pos 2 +#define PORT_PORTP_INEN_PIN2_Msk (0x01 << PORT_PORTP_INEN_PIN2_Pos) +#define PORT_PORTP_INEN_PIN3_Pos 3 +#define PORT_PORTP_INEN_PIN3_Msk (0x01 << PORT_PORTP_INEN_PIN3_Pos) +#define PORT_PORTP_INEN_PIN4_Pos 4 +#define PORT_PORTP_INEN_PIN4_Msk (0x01 << PORT_PORTP_INEN_PIN4_Pos) +#define PORT_PORTP_INEN_PIN5_Pos 5 +#define PORT_PORTP_INEN_PIN5_Msk (0x01 << PORT_PORTP_INEN_PIN5_Pos) +#define PORT_PORTP_INEN_PIN6_Pos 6 +#define PORT_PORTP_INEN_PIN6_Msk (0x01 << PORT_PORTP_INEN_PIN6_Pos) +#define PORT_PORTP_INEN_PIN7_Pos 7 +#define PORT_PORTP_INEN_PIN7_Msk (0x01 << PORT_PORTP_INEN_PIN7_Pos) +#define PORT_PORTP_INEN_PIN8_Pos 8 +#define PORT_PORTP_INEN_PIN8_Msk (0x01 << PORT_PORTP_INEN_PIN8_Pos) +#define PORT_PORTP_INEN_PIN9_Pos 9 +#define PORT_PORTP_INEN_PIN9_Msk (0x01 << PORT_PORTP_INEN_PIN9_Pos) +#define PORT_PORTP_INEN_PIN10_Pos 10 +#define PORT_PORTP_INEN_PIN10_Msk (0x01 << PORT_PORTP_INEN_PIN10_Pos) +#define PORT_PORTP_INEN_PIN11_Pos 11 +#define PORT_PORTP_INEN_PIN11_Msk (0x01 << PORT_PORTP_INEN_PIN11_Pos) +#define PORT_PORTP_INEN_PIN12_Pos 12 +#define PORT_PORTP_INEN_PIN12_Msk (0x01 << PORT_PORTP_INEN_PIN12_Pos) +#define PORT_PORTP_INEN_PIN13_Pos 13 +#define PORT_PORTP_INEN_PIN13_Msk (0x01 << PORT_PORTP_INEN_PIN13_Pos) +#define PORT_PORTP_INEN_PIN14_Pos 14 +#define PORT_PORTP_INEN_PIN14_Msk (0x01 << PORT_PORTP_INEN_PIN14_Pos) +#define PORT_PORTP_INEN_PIN15_Pos 15 +#define PORT_PORTP_INEN_PIN15_Msk (0x01 << PORT_PORTP_INEN_PIN15_Pos) +#define PORT_PORTP_INEN_PIN16_Pos 16 +#define PORT_PORTP_INEN_PIN16_Msk (0x01 << PORT_PORTP_INEN_PIN16_Pos) +#define PORT_PORTP_INEN_PIN17_Pos 17 +#define PORT_PORTP_INEN_PIN17_Msk (0x01 << PORT_PORTP_INEN_PIN17_Pos) +#define PORT_PORTP_INEN_PIN18_Pos 18 +#define PORT_PORTP_INEN_PIN18_Msk (0x01 << PORT_PORTP_INEN_PIN18_Pos) +#define PORT_PORTP_INEN_PIN19_Pos 19 +#define PORT_PORTP_INEN_PIN19_Msk (0x01 << PORT_PORTP_INEN_PIN19_Pos) +#define PORT_PORTP_INEN_PIN20_Pos 20 +#define PORT_PORTP_INEN_PIN20_Msk (0x01 << PORT_PORTP_INEN_PIN20_Pos) +#define PORT_PORTP_INEN_PIN21_Pos 21 +#define PORT_PORTP_INEN_PIN21_Msk (0x01 << PORT_PORTP_INEN_PIN21_Pos) +#define PORT_PORTP_INEN_PIN22_Pos 22 +#define PORT_PORTP_INEN_PIN22_Msk (0x01 << PORT_PORTP_INEN_PIN22_Pos) +#define PORT_PORTP_INEN_PIN23_Pos 23 +#define PORT_PORTP_INEN_PIN23_Msk (0x01 << PORT_PORTP_INEN_PIN23_Pos) - __IO uint32_t DIR; //0 杈撳叆 1 杈撳嚭 - __IO uint32_t INTLVLTRG; //Interrupt Level Trigger 1 鐢靛钩瑙﹀彂涓柇 0 杈规部瑙﹀彂涓柇 - __IO uint32_t INTBE; //Both Edge锛屽綋INTLVLTRG璁句负杈规部瑙﹀彂涓柇鏃讹紝姝や綅缃1琛ㄧず涓婂崌娌垮拰涓嬮檷娌块兘瑙﹀彂涓柇锛岀疆0鏃惰Е鍙戣竟娌跨敱INTRISEEN閫夋嫨 - __IO uint32_t INTRISEEN; //Interrupt Rise Edge Enable 1 涓婂崌娌/楂樼數骞宠Е鍙戜腑鏂 0 涓嬮檷娌/浣庣數骞宠Е鍙戜腑鏂 +typedef struct { + __IO uint32_t DATA; +#define PIN0 0 +#define PIN1 1 +#define PIN2 2 +#define PIN3 3 +#define PIN4 4 +#define PIN5 5 +#define PIN6 6 +#define PIN7 7 +#define PIN8 8 +#define PIN9 9 +#define PIN10 10 +#define PIN11 11 +#define PIN12 12 +#define PIN13 13 +#define PIN14 14 +#define PIN15 15 +#define PIN16 16 +#define PIN17 17 +#define PIN18 18 +#define PIN19 19 +#define PIN20 20 +#define PIN21 21 +#define PIN22 22 +#define PIN23 23 +#define PIN24 24 - __IO uint32_t INTEN; //1 涓柇浣胯兘 0 涓柇绂佹 + __IO uint32_t DIR; //0 输入 1 输出 - __IO uint32_t INTRAWSTAT; //涓柇妫娴嬪崟鍏冩槸鍚︽娴嬪埌浜嗚Е鍙戜腑鏂殑鏉′欢 1 妫娴嬪埌浜嗕腑鏂Е鍙戞潯浠 0 娌℃湁妫娴嬪埌涓柇瑙﹀彂鏉′欢 + __IO uint32_t INTLVLTRG; //Interrupt Level Trigger 1 电平触发中断 0 边沿触发中断 - __IO uint32_t INTSTAT; //INTSTAT.PIN0 = INTRAWSTAT.PIN0 & INTEN.PIN0 + __IO uint32_t INTBE; //Both Edge,当INTLVLTRG设为边沿触发中断时,此位置1表示上升沿和下降沿都触发中断,置0时触发边沿由INTRISEEN选择 - __IO uint32_t INTCLR; //鍐1娓呴櫎涓柇鏍囧織锛屽彧瀵硅竟娌胯Е鍙戜腑鏂湁鐢 + __IO uint32_t INTRISEEN; //Interrupt Rise Edge Enable 1 上升沿/高电平触发中断 0 下降沿/低电平触发中断 + + __IO uint32_t INTEN; //1 中断使能 0 中断禁止 + + __IO uint32_t INTRAWSTAT; //中断检测单元是否检测到了触发中断的条件 1 检测到了中断触发条件 0 没有检测到中断触发条件 + + __IO uint32_t INTSTAT; //INTSTAT.PIN0 = INTRAWSTAT.PIN0 & INTEN.PIN0 + + __IO uint32_t INTCLR; //写1清除中断标志,只对边沿触发中断有用 } GPIO_TypeDef; -#define GPIO_DATA_PIN0_Pos 0 -#define GPIO_DATA_PIN0_Msk (0x01 << GPIO_DATA_PIN0_Pos) -#define GPIO_DATA_PIN1_Pos 1 -#define GPIO_DATA_PIN1_Msk (0x01 << GPIO_DATA_PIN1_Pos) -#define GPIO_DATA_PIN2_Pos 2 -#define GPIO_DATA_PIN2_Msk (0x01 << GPIO_DATA_PIN2_Pos) -#define GPIO_DATA_PIN3_Pos 3 -#define GPIO_DATA_PIN3_Msk (0x01 << GPIO_DATA_PIN3_Pos) -#define GPIO_DATA_PIN4_Pos 4 -#define GPIO_DATA_PIN4_Msk (0x01 << GPIO_DATA_PIN4_Pos) -#define GPIO_DATA_PIN5_Pos 5 -#define GPIO_DATA_PIN5_Msk (0x01 << GPIO_DATA_PIN5_Pos) -#define GPIO_DATA_PIN6_Pos 6 -#define GPIO_DATA_PIN6_Msk (0x01 << GPIO_DATA_PIN6_Pos) -#define GPIO_DATA_PIN7_Pos 7 -#define GPIO_DATA_PIN7_Msk (0x01 << GPIO_DATA_PIN7_Pos) -#define GPIO_DATA_PIN8_Pos 8 -#define GPIO_DATA_PIN8_Msk (0x01 << GPIO_DATA_PIN8_Pos) -#define GPIO_DATA_PIN9_Pos 9 -#define GPIO_DATA_PIN9_Msk (0x01 << GPIO_DATA_PIN9_Pos) -#define GPIO_DATA_PIN10_Pos 10 -#define GPIO_DATA_PIN10_Msk (0x01 << GPIO_DATA_PIN10_Pos) -#define GPIO_DATA_PIN11_Pos 11 -#define GPIO_DATA_PIN11_Msk (0x01 << GPIO_DATA_PIN11_Pos) -#define GPIO_DATA_PIN12_Pos 12 -#define GPIO_DATA_PIN12_Msk (0x01 << GPIO_DATA_PIN12_Pos) -#define GPIO_DATA_PIN13_Pos 13 -#define GPIO_DATA_PIN13_Msk (0x01 << GPIO_DATA_PIN13_Pos) -#define GPIO_DATA_PIN14_Pos 14 -#define GPIO_DATA_PIN14_Msk (0x01 << GPIO_DATA_PIN14_Pos) -#define GPIO_DATA_PIN15_Pos 15 -#define GPIO_DATA_PIN15_Msk (0x01 << GPIO_DATA_PIN15_Pos) -#define GPIO_DATA_PIN16_Pos 16 -#define GPIO_DATA_PIN16_Msk (0x01 << GPIO_DATA_PIN16_Pos) -#define GPIO_DATA_PIN17_Pos 17 -#define GPIO_DATA_PIN17_Msk (0x01 << GPIO_DATA_PIN17_Pos) -#define GPIO_DATA_PIN18_Pos 18 -#define GPIO_DATA_PIN18_Msk (0x01 << GPIO_DATA_PIN18_Pos) -#define GPIO_DATA_PIN19_Pos 19 -#define GPIO_DATA_PIN19_Msk (0x01 << GPIO_DATA_PIN19_Pos) -#define GPIO_DATA_PIN20_Pos 20 -#define GPIO_DATA_PIN20_Msk (0x01 << GPIO_DATA_PIN20_Pos) -#define GPIO_DATA_PIN21_Pos 21 -#define GPIO_DATA_PIN21_Msk (0x01 << GPIO_DATA_PIN21_Pos) -#define GPIO_DATA_PIN22_Pos 22 -#define GPIO_DATA_PIN22_Msk (0x01 << GPIO_DATA_PIN22_Pos) -#define GPIO_DATA_PIN23_Pos 23 -#define GPIO_DATA_PIN23_Msk (0x01 << GPIO_DATA_PIN23_Pos) -#define GPIO_DIR_PIN0_Pos 0 -#define GPIO_DIR_PIN0_Msk (0x01 << GPIO_DIR_PIN0_Pos) -#define GPIO_DIR_PIN1_Pos 1 -#define GPIO_DIR_PIN1_Msk (0x01 << GPIO_DIR_PIN1_Pos) -#define GPIO_DIR_PIN2_Pos 2 -#define GPIO_DIR_PIN2_Msk (0x01 << GPIO_DIR_PIN2_Pos) -#define GPIO_DIR_PIN3_Pos 3 -#define GPIO_DIR_PIN3_Msk (0x01 << GPIO_DIR_PIN3_Pos) -#define GPIO_DIR_PIN4_Pos 4 -#define GPIO_DIR_PIN4_Msk (0x01 << GPIO_DIR_PIN4_Pos) -#define GPIO_DIR_PIN5_Pos 5 -#define GPIO_DIR_PIN5_Msk (0x01 << GPIO_DIR_PIN5_Pos) -#define GPIO_DIR_PIN6_Pos 6 -#define GPIO_DIR_PIN6_Msk (0x01 << GPIO_DIR_PIN6_Pos) -#define GPIO_DIR_PIN7_Pos 7 -#define GPIO_DIR_PIN7_Msk (0x01 << GPIO_DIR_PIN7_Pos) -#define GPIO_DIR_PIN8_Pos 8 -#define GPIO_DIR_PIN8_Msk (0x01 << GPIO_DIR_PIN8_Pos) -#define GPIO_DIR_PIN9_Pos 9 -#define GPIO_DIR_PIN9_Msk (0x01 << GPIO_DIR_PIN9_Pos) -#define GPIO_DIR_PIN10_Pos 10 -#define GPIO_DIR_PIN10_Msk (0x01 << GPIO_DIR_PIN10_Pos) -#define GPIO_DIR_PIN11_Pos 11 -#define GPIO_DIR_PIN11_Msk (0x01 << GPIO_DIR_PIN11_Pos) -#define GPIO_DIR_PIN12_Pos 12 -#define GPIO_DIR_PIN12_Msk (0x01 << GPIO_DIR_PIN12_Pos) -#define GPIO_DIR_PIN13_Pos 13 -#define GPIO_DIR_PIN13_Msk (0x01 << GPIO_DIR_PIN13_Pos) -#define GPIO_DIR_PIN14_Pos 14 -#define GPIO_DIR_PIN14_Msk (0x01 << GPIO_DIR_PIN14_Pos) -#define GPIO_DIR_PIN15_Pos 15 -#define GPIO_DIR_PIN15_Msk (0x01 << GPIO_DIR_PIN15_Pos) -#define GPIO_DIR_PIN16_Pos 16 -#define GPIO_DIR_PIN16_Msk (0x01 << GPIO_DIR_PIN16_Pos) -#define GPIO_DIR_PIN17_Pos 17 -#define GPIO_DIR_PIN17_Msk (0x01 << GPIO_DIR_PIN17_Pos) -#define GPIO_DIR_PIN18_Pos 18 -#define GPIO_DIR_PIN18_Msk (0x01 << GPIO_DIR_PIN18_Pos) -#define GPIO_DIR_PIN19_Pos 19 -#define GPIO_DIR_PIN19_Msk (0x01 << GPIO_DIR_PIN19_Pos) -#define GPIO_DIR_PIN20_Pos 20 -#define GPIO_DIR_PIN20_Msk (0x01 << GPIO_DIR_PIN20_Pos) -#define GPIO_DIR_PIN21_Pos 21 -#define GPIO_DIR_PIN21_Msk (0x01 << GPIO_DIR_PIN21_Pos) -#define GPIO_DIR_PIN22_Pos 22 -#define GPIO_DIR_PIN22_Msk (0x01 << GPIO_DIR_PIN22_Pos) -#define GPIO_DIR_PIN23_Pos 23 -#define GPIO_DIR_PIN23_Msk (0x01 << GPIO_DIR_PIN23_Pos) +#define GPIO_DATA_PIN0_Pos 0 +#define GPIO_DATA_PIN0_Msk (0x01 << GPIO_DATA_PIN0_Pos) +#define GPIO_DATA_PIN1_Pos 1 +#define GPIO_DATA_PIN1_Msk (0x01 << GPIO_DATA_PIN1_Pos) +#define GPIO_DATA_PIN2_Pos 2 +#define GPIO_DATA_PIN2_Msk (0x01 << GPIO_DATA_PIN2_Pos) +#define GPIO_DATA_PIN3_Pos 3 +#define GPIO_DATA_PIN3_Msk (0x01 << GPIO_DATA_PIN3_Pos) +#define GPIO_DATA_PIN4_Pos 4 +#define GPIO_DATA_PIN4_Msk (0x01 << GPIO_DATA_PIN4_Pos) +#define GPIO_DATA_PIN5_Pos 5 +#define GPIO_DATA_PIN5_Msk (0x01 << GPIO_DATA_PIN5_Pos) +#define GPIO_DATA_PIN6_Pos 6 +#define GPIO_DATA_PIN6_Msk (0x01 << GPIO_DATA_PIN6_Pos) +#define GPIO_DATA_PIN7_Pos 7 +#define GPIO_DATA_PIN7_Msk (0x01 << GPIO_DATA_PIN7_Pos) +#define GPIO_DATA_PIN8_Pos 8 +#define GPIO_DATA_PIN8_Msk (0x01 << GPIO_DATA_PIN8_Pos) +#define GPIO_DATA_PIN9_Pos 9 +#define GPIO_DATA_PIN9_Msk (0x01 << GPIO_DATA_PIN9_Pos) +#define GPIO_DATA_PIN10_Pos 10 +#define GPIO_DATA_PIN10_Msk (0x01 << GPIO_DATA_PIN10_Pos) +#define GPIO_DATA_PIN11_Pos 11 +#define GPIO_DATA_PIN11_Msk (0x01 << GPIO_DATA_PIN11_Pos) +#define GPIO_DATA_PIN12_Pos 12 +#define GPIO_DATA_PIN12_Msk (0x01 << GPIO_DATA_PIN12_Pos) +#define GPIO_DATA_PIN13_Pos 13 +#define GPIO_DATA_PIN13_Msk (0x01 << GPIO_DATA_PIN13_Pos) +#define GPIO_DATA_PIN14_Pos 14 +#define GPIO_DATA_PIN14_Msk (0x01 << GPIO_DATA_PIN14_Pos) +#define GPIO_DATA_PIN15_Pos 15 +#define GPIO_DATA_PIN15_Msk (0x01 << GPIO_DATA_PIN15_Pos) +#define GPIO_DATA_PIN16_Pos 16 +#define GPIO_DATA_PIN16_Msk (0x01 << GPIO_DATA_PIN16_Pos) +#define GPIO_DATA_PIN17_Pos 17 +#define GPIO_DATA_PIN17_Msk (0x01 << GPIO_DATA_PIN17_Pos) +#define GPIO_DATA_PIN18_Pos 18 +#define GPIO_DATA_PIN18_Msk (0x01 << GPIO_DATA_PIN18_Pos) +#define GPIO_DATA_PIN19_Pos 19 +#define GPIO_DATA_PIN19_Msk (0x01 << GPIO_DATA_PIN19_Pos) +#define GPIO_DATA_PIN20_Pos 20 +#define GPIO_DATA_PIN20_Msk (0x01 << GPIO_DATA_PIN20_Pos) +#define GPIO_DATA_PIN21_Pos 21 +#define GPIO_DATA_PIN21_Msk (0x01 << GPIO_DATA_PIN21_Pos) +#define GPIO_DATA_PIN22_Pos 22 +#define GPIO_DATA_PIN22_Msk (0x01 << GPIO_DATA_PIN22_Pos) +#define GPIO_DATA_PIN23_Pos 23 +#define GPIO_DATA_PIN23_Msk (0x01 << GPIO_DATA_PIN23_Pos) -#define GPIO_INTLVLTRG_PIN0_Pos 0 -#define GPIO_INTLVLTRG_PIN0_Msk (0x01 << GPIO_INTLVLTRG_PIN0_Pos) -#define GPIO_INTLVLTRG_PIN1_Pos 1 -#define GPIO_INTLVLTRG_PIN1_Msk (0x01 << GPIO_INTLVLTRG_PIN1_Pos) -#define GPIO_INTLVLTRG_PIN2_Pos 2 -#define GPIO_INTLVLTRG_PIN2_Msk (0x01 << GPIO_INTLVLTRG_PIN2_Pos) -#define GPIO_INTLVLTRG_PIN3_Pos 3 -#define GPIO_INTLVLTRG_PIN3_Msk (0x01 << GPIO_INTLVLTRG_PIN3_Pos) -#define GPIO_INTLVLTRG_PIN4_Pos 4 -#define GPIO_INTLVLTRG_PIN4_Msk (0x01 << GPIO_INTLVLTRG_PIN4_Pos) -#define GPIO_INTLVLTRG_PIN5_Pos 5 -#define GPIO_INTLVLTRG_PIN5_Msk (0x01 << GPIO_INTLVLTRG_PIN5_Pos) -#define GPIO_INTLVLTRG_PIN6_Pos 6 -#define GPIO_INTLVLTRG_PIN6_Msk (0x01 << GPIO_INTLVLTRG_PIN6_Pos) -#define GPIO_INTLVLTRG_PIN7_Pos 7 -#define GPIO_INTLVLTRG_PIN7_Msk (0x01 << GPIO_INTLVLTRG_PIN7_Pos) -#define GPIO_INTLVLTRG_PIN8_Pos 8 -#define GPIO_INTLVLTRG_PIN8_Msk (0x01 << GPIO_INTLVLTRG_PIN8_Pos) -#define GPIO_INTLVLTRG_PIN9_Pos 9 -#define GPIO_INTLVLTRG_PIN9_Msk (0x01 << GPIO_INTLVLTRG_PIN9_Pos) -#define GPIO_INTLVLTRG_PIN10_Pos 10 -#define GPIO_INTLVLTRG_PIN10_Msk (0x01 << GPIO_INTLVLTRG_PIN10_Pos) -#define GPIO_INTLVLTRG_PIN11_Pos 11 -#define GPIO_INTLVLTRG_PIN11_Msk (0x01 << GPIO_INTLVLTRG_PIN11_Pos) -#define GPIO_INTLVLTRG_PIN12_Pos 12 -#define GPIO_INTLVLTRG_PIN12_Msk (0x01 << GPIO_INTLVLTRG_PIN12_Pos) -#define GPIO_INTLVLTRG_PIN13_Pos 13 -#define GPIO_INTLVLTRG_PIN13_Msk (0x01 << GPIO_INTLVLTRG_PIN13_Pos) -#define GPIO_INTLVLTRG_PIN14_Pos 14 -#define GPIO_INTLVLTRG_PIN14_Msk (0x01 << GPIO_INTLVLTRG_PIN14_Pos) -#define GPIO_INTLVLTRG_PIN15_Pos 15 -#define GPIO_INTLVLTRG_PIN15_Msk (0x01 << GPIO_INTLVLTRG_PIN15_Pos) -#define GPIO_INTLVLTRG_PIN16_Pos 16 -#define GPIO_INTLVLTRG_PIN16_Msk (0x01 << GPIO_INTLVLTRG_PIN16_Pos) -#define GPIO_INTLVLTRG_PIN17_Pos 17 -#define GPIO_INTLVLTRG_PIN17_Msk (0x01 << GPIO_INTLVLTRG_PIN17_Pos) -#define GPIO_INTLVLTRG_PIN18_Pos 18 -#define GPIO_INTLVLTRG_PIN18_Msk (0x01 << GPIO_INTLVLTRG_PIN18_Pos) -#define GPIO_INTLVLTRG_PIN19_Pos 19 -#define GPIO_INTLVLTRG_PIN19_Msk (0x01 << GPIO_INTLVLTRG_PIN19_Pos) -#define GPIO_INTLVLTRG_PIN20_Pos 20 -#define GPIO_INTLVLTRG_PIN20_Msk (0x01 << GPIO_INTLVLTRG_PIN20_Pos) -#define GPIO_INTLVLTRG_PIN21_Pos 21 -#define GPIO_INTLVLTRG_PIN21_Msk (0x01 << GPIO_INTLVLTRG_PIN21_Pos) -#define GPIO_INTLVLTRG_PIN22_Pos 22 -#define GPIO_INTLVLTRG_PIN22_Msk (0x01 << GPIO_INTLVLTRG_PIN22_Pos) -#define GPIO_INTLVLTRG_PIN23_Pos 23 -#define GPIO_INTLVLTRG_PIN23_Msk (0x01 << GPIO_INTLVLTRG_PIN23_Pos) +#define GPIO_DIR_PIN0_Pos 0 +#define GPIO_DIR_PIN0_Msk (0x01 << GPIO_DIR_PIN0_Pos) +#define GPIO_DIR_PIN1_Pos 1 +#define GPIO_DIR_PIN1_Msk (0x01 << GPIO_DIR_PIN1_Pos) +#define GPIO_DIR_PIN2_Pos 2 +#define GPIO_DIR_PIN2_Msk (0x01 << GPIO_DIR_PIN2_Pos) +#define GPIO_DIR_PIN3_Pos 3 +#define GPIO_DIR_PIN3_Msk (0x01 << GPIO_DIR_PIN3_Pos) +#define GPIO_DIR_PIN4_Pos 4 +#define GPIO_DIR_PIN4_Msk (0x01 << GPIO_DIR_PIN4_Pos) +#define GPIO_DIR_PIN5_Pos 5 +#define GPIO_DIR_PIN5_Msk (0x01 << GPIO_DIR_PIN5_Pos) +#define GPIO_DIR_PIN6_Pos 6 +#define GPIO_DIR_PIN6_Msk (0x01 << GPIO_DIR_PIN6_Pos) +#define GPIO_DIR_PIN7_Pos 7 +#define GPIO_DIR_PIN7_Msk (0x01 << GPIO_DIR_PIN7_Pos) +#define GPIO_DIR_PIN8_Pos 8 +#define GPIO_DIR_PIN8_Msk (0x01 << GPIO_DIR_PIN8_Pos) +#define GPIO_DIR_PIN9_Pos 9 +#define GPIO_DIR_PIN9_Msk (0x01 << GPIO_DIR_PIN9_Pos) +#define GPIO_DIR_PIN10_Pos 10 +#define GPIO_DIR_PIN10_Msk (0x01 << GPIO_DIR_PIN10_Pos) +#define GPIO_DIR_PIN11_Pos 11 +#define GPIO_DIR_PIN11_Msk (0x01 << GPIO_DIR_PIN11_Pos) +#define GPIO_DIR_PIN12_Pos 12 +#define GPIO_DIR_PIN12_Msk (0x01 << GPIO_DIR_PIN12_Pos) +#define GPIO_DIR_PIN13_Pos 13 +#define GPIO_DIR_PIN13_Msk (0x01 << GPIO_DIR_PIN13_Pos) +#define GPIO_DIR_PIN14_Pos 14 +#define GPIO_DIR_PIN14_Msk (0x01 << GPIO_DIR_PIN14_Pos) +#define GPIO_DIR_PIN15_Pos 15 +#define GPIO_DIR_PIN15_Msk (0x01 << GPIO_DIR_PIN15_Pos) +#define GPIO_DIR_PIN16_Pos 16 +#define GPIO_DIR_PIN16_Msk (0x01 << GPIO_DIR_PIN16_Pos) +#define GPIO_DIR_PIN17_Pos 17 +#define GPIO_DIR_PIN17_Msk (0x01 << GPIO_DIR_PIN17_Pos) +#define GPIO_DIR_PIN18_Pos 18 +#define GPIO_DIR_PIN18_Msk (0x01 << GPIO_DIR_PIN18_Pos) +#define GPIO_DIR_PIN19_Pos 19 +#define GPIO_DIR_PIN19_Msk (0x01 << GPIO_DIR_PIN19_Pos) +#define GPIO_DIR_PIN20_Pos 20 +#define GPIO_DIR_PIN20_Msk (0x01 << GPIO_DIR_PIN20_Pos) +#define GPIO_DIR_PIN21_Pos 21 +#define GPIO_DIR_PIN21_Msk (0x01 << GPIO_DIR_PIN21_Pos) +#define GPIO_DIR_PIN22_Pos 22 +#define GPIO_DIR_PIN22_Msk (0x01 << GPIO_DIR_PIN22_Pos) +#define GPIO_DIR_PIN23_Pos 23 +#define GPIO_DIR_PIN23_Msk (0x01 << GPIO_DIR_PIN23_Pos) -#define GPIO_INTBE_PIN0_Pos 0 -#define GPIO_INTBE_PIN0_Msk (0x01 << GPIO_INTBE_PIN0_Pos) -#define GPIO_INTBE_PIN1_Pos 1 -#define GPIO_INTBE_PIN1_Msk (0x01 << GPIO_INTBE_PIN1_Pos) -#define GPIO_INTBE_PIN2_Pos 2 -#define GPIO_INTBE_PIN2_Msk (0x01 << GPIO_INTBE_PIN2_Pos) -#define GPIO_INTBE_PIN3_Pos 3 -#define GPIO_INTBE_PIN3_Msk (0x01 << GPIO_INTBE_PIN3_Pos) -#define GPIO_INTBE_PIN4_Pos 4 -#define GPIO_INTBE_PIN4_Msk (0x01 << GPIO_INTBE_PIN4_Pos) -#define GPIO_INTBE_PIN5_Pos 5 -#define GPIO_INTBE_PIN5_Msk (0x01 << GPIO_INTBE_PIN5_Pos) -#define GPIO_INTBE_PIN6_Pos 6 -#define GPIO_INTBE_PIN6_Msk (0x01 << GPIO_INTBE_PIN6_Pos) -#define GPIO_INTBE_PIN7_Pos 7 -#define GPIO_INTBE_PIN7_Msk (0x01 << GPIO_INTBE_PIN7_Pos) -#define GPIO_INTBE_PIN8_Pos 8 -#define GPIO_INTBE_PIN8_Msk (0x01 << GPIO_INTBE_PIN8_Pos) -#define GPIO_INTBE_PIN9_Pos 9 -#define GPIO_INTBE_PIN9_Msk (0x01 << GPIO_INTBE_PIN9_Pos) -#define GPIO_INTBE_PIN10_Pos 10 -#define GPIO_INTBE_PIN10_Msk (0x01 << GPIO_INTBE_PIN10_Pos) -#define GPIO_INTBE_PIN11_Pos 11 -#define GPIO_INTBE_PIN11_Msk (0x01 << GPIO_INTBE_PIN11_Pos) -#define GPIO_INTBE_PIN12_Pos 12 -#define GPIO_INTBE_PIN12_Msk (0x01 << GPIO_INTBE_PIN12_Pos) -#define GPIO_INTBE_PIN13_Pos 13 -#define GPIO_INTBE_PIN13_Msk (0x01 << GPIO_INTBE_PIN13_Pos) -#define GPIO_INTBE_PIN14_Pos 14 -#define GPIO_INTBE_PIN14_Msk (0x01 << GPIO_INTBE_PIN14_Pos) -#define GPIO_INTBE_PIN15_Pos 15 -#define GPIO_INTBE_PIN15_Msk (0x01 << GPIO_INTBE_PIN15_Pos) -#define GPIO_INTBE_PIN16_Pos 16 -#define GPIO_INTBE_PIN16_Msk (0x01 << GPIO_INTBE_PIN16_Pos) -#define GPIO_INTBE_PIN17_Pos 17 -#define GPIO_INTBE_PIN17_Msk (0x01 << GPIO_INTBE_PIN17_Pos) -#define GPIO_INTBE_PIN18_Pos 18 -#define GPIO_INTBE_PIN18_Msk (0x01 << GPIO_INTBE_PIN18_Pos) -#define GPIO_INTBE_PIN19_Pos 19 -#define GPIO_INTBE_PIN19_Msk (0x01 << GPIO_INTBE_PIN19_Pos) -#define GPIO_INTBE_PIN20_Pos 20 -#define GPIO_INTBE_PIN20_Msk (0x01 << GPIO_INTBE_PIN20_Pos) -#define GPIO_INTBE_PIN21_Pos 21 -#define GPIO_INTBE_PIN21_Msk (0x01 << GPIO_INTBE_PIN21_Pos) -#define GPIO_INTBE_PIN22_Pos 22 -#define GPIO_INTBE_PIN22_Msk (0x01 << GPIO_INTBE_PIN22_Pos) -#define GPIO_INTBE_PIN23_Pos 23 -#define GPIO_INTBE_PIN23_Msk (0x01 << GPIO_INTBE_PIN23_Pos) +#define GPIO_INTLVLTRG_PIN0_Pos 0 +#define GPIO_INTLVLTRG_PIN0_Msk (0x01 << GPIO_INTLVLTRG_PIN0_Pos) +#define GPIO_INTLVLTRG_PIN1_Pos 1 +#define GPIO_INTLVLTRG_PIN1_Msk (0x01 << GPIO_INTLVLTRG_PIN1_Pos) +#define GPIO_INTLVLTRG_PIN2_Pos 2 +#define GPIO_INTLVLTRG_PIN2_Msk (0x01 << GPIO_INTLVLTRG_PIN2_Pos) +#define GPIO_INTLVLTRG_PIN3_Pos 3 +#define GPIO_INTLVLTRG_PIN3_Msk (0x01 << GPIO_INTLVLTRG_PIN3_Pos) +#define GPIO_INTLVLTRG_PIN4_Pos 4 +#define GPIO_INTLVLTRG_PIN4_Msk (0x01 << GPIO_INTLVLTRG_PIN4_Pos) +#define GPIO_INTLVLTRG_PIN5_Pos 5 +#define GPIO_INTLVLTRG_PIN5_Msk (0x01 << GPIO_INTLVLTRG_PIN5_Pos) +#define GPIO_INTLVLTRG_PIN6_Pos 6 +#define GPIO_INTLVLTRG_PIN6_Msk (0x01 << GPIO_INTLVLTRG_PIN6_Pos) +#define GPIO_INTLVLTRG_PIN7_Pos 7 +#define GPIO_INTLVLTRG_PIN7_Msk (0x01 << GPIO_INTLVLTRG_PIN7_Pos) +#define GPIO_INTLVLTRG_PIN8_Pos 8 +#define GPIO_INTLVLTRG_PIN8_Msk (0x01 << GPIO_INTLVLTRG_PIN8_Pos) +#define GPIO_INTLVLTRG_PIN9_Pos 9 +#define GPIO_INTLVLTRG_PIN9_Msk (0x01 << GPIO_INTLVLTRG_PIN9_Pos) +#define GPIO_INTLVLTRG_PIN10_Pos 10 +#define GPIO_INTLVLTRG_PIN10_Msk (0x01 << GPIO_INTLVLTRG_PIN10_Pos) +#define GPIO_INTLVLTRG_PIN11_Pos 11 +#define GPIO_INTLVLTRG_PIN11_Msk (0x01 << GPIO_INTLVLTRG_PIN11_Pos) +#define GPIO_INTLVLTRG_PIN12_Pos 12 +#define GPIO_INTLVLTRG_PIN12_Msk (0x01 << GPIO_INTLVLTRG_PIN12_Pos) +#define GPIO_INTLVLTRG_PIN13_Pos 13 +#define GPIO_INTLVLTRG_PIN13_Msk (0x01 << GPIO_INTLVLTRG_PIN13_Pos) +#define GPIO_INTLVLTRG_PIN14_Pos 14 +#define GPIO_INTLVLTRG_PIN14_Msk (0x01 << GPIO_INTLVLTRG_PIN14_Pos) +#define GPIO_INTLVLTRG_PIN15_Pos 15 +#define GPIO_INTLVLTRG_PIN15_Msk (0x01 << GPIO_INTLVLTRG_PIN15_Pos) +#define GPIO_INTLVLTRG_PIN16_Pos 16 +#define GPIO_INTLVLTRG_PIN16_Msk (0x01 << GPIO_INTLVLTRG_PIN16_Pos) +#define GPIO_INTLVLTRG_PIN17_Pos 17 +#define GPIO_INTLVLTRG_PIN17_Msk (0x01 << GPIO_INTLVLTRG_PIN17_Pos) +#define GPIO_INTLVLTRG_PIN18_Pos 18 +#define GPIO_INTLVLTRG_PIN18_Msk (0x01 << GPIO_INTLVLTRG_PIN18_Pos) +#define GPIO_INTLVLTRG_PIN19_Pos 19 +#define GPIO_INTLVLTRG_PIN19_Msk (0x01 << GPIO_INTLVLTRG_PIN19_Pos) +#define GPIO_INTLVLTRG_PIN20_Pos 20 +#define GPIO_INTLVLTRG_PIN20_Msk (0x01 << GPIO_INTLVLTRG_PIN20_Pos) +#define GPIO_INTLVLTRG_PIN21_Pos 21 +#define GPIO_INTLVLTRG_PIN21_Msk (0x01 << GPIO_INTLVLTRG_PIN21_Pos) +#define GPIO_INTLVLTRG_PIN22_Pos 22 +#define GPIO_INTLVLTRG_PIN22_Msk (0x01 << GPIO_INTLVLTRG_PIN22_Pos) +#define GPIO_INTLVLTRG_PIN23_Pos 23 +#define GPIO_INTLVLTRG_PIN23_Msk (0x01 << GPIO_INTLVLTRG_PIN23_Pos) -#define GPIO_INTRISEEN_PIN0_Pos 0 -#define GPIO_INTRISEEN_PIN0_Msk (0x01 << GPIO_INTRISEEN_PIN0_Pos) -#define GPIO_INTRISEEN_PIN1_Pos 1 -#define GPIO_INTRISEEN_PIN1_Msk (0x01 << GPIO_INTRISEEN_PIN1_Pos) -#define GPIO_INTRISEEN_PIN2_Pos 2 -#define GPIO_INTRISEEN_PIN2_Msk (0x01 << GPIO_INTRISEEN_PIN2_Pos) -#define GPIO_INTRISEEN_PIN3_Pos 3 -#define GPIO_INTRISEEN_PIN3_Msk (0x01 << GPIO_INTRISEEN_PIN3_Pos) -#define GPIO_INTRISEEN_PIN4_Pos 4 -#define GPIO_INTRISEEN_PIN4_Msk (0x01 << GPIO_INTRISEEN_PIN4_Pos) -#define GPIO_INTRISEEN_PIN5_Pos 5 -#define GPIO_INTRISEEN_PIN5_Msk (0x01 << GPIO_INTRISEEN_PIN5_Pos) -#define GPIO_INTRISEEN_PIN6_Pos 6 -#define GPIO_INTRISEEN_PIN6_Msk (0x01 << GPIO_INTRISEEN_PIN6_Pos) -#define GPIO_INTRISEEN_PIN7_Pos 7 -#define GPIO_INTRISEEN_PIN7_Msk (0x01 << GPIO_INTRISEEN_PIN7_Pos) -#define GPIO_INTRISEEN_PIN8_Pos 8 -#define GPIO_INTRISEEN_PIN8_Msk (0x01 << GPIO_INTRISEEN_PIN8_Pos) -#define GPIO_INTRISEEN_PIN9_Pos 9 -#define GPIO_INTRISEEN_PIN9_Msk (0x01 << GPIO_INTRISEEN_PIN9_Pos) -#define GPIO_INTRISEEN_PIN10_Pos 10 -#define GPIO_INTRISEEN_PIN10_Msk (0x01 << GPIO_INTRISEEN_PIN10_Pos) -#define GPIO_INTRISEEN_PIN11_Pos 11 -#define GPIO_INTRISEEN_PIN11_Msk (0x01 << GPIO_INTRISEEN_PIN11_Pos) -#define GPIO_INTRISEEN_PIN12_Pos 12 -#define GPIO_INTRISEEN_PIN12_Msk (0x01 << GPIO_INTRISEEN_PIN12_Pos) -#define GPIO_INTRISEEN_PIN13_Pos 13 -#define GPIO_INTRISEEN_PIN13_Msk (0x01 << GPIO_INTRISEEN_PIN13_Pos) -#define GPIO_INTRISEEN_PIN14_Pos 14 -#define GPIO_INTRISEEN_PIN14_Msk (0x01 << GPIO_INTRISEEN_PIN14_Pos) -#define GPIO_INTRISEEN_PIN15_Pos 15 -#define GPIO_INTRISEEN_PIN15_Msk (0x01 << GPIO_INTRISEEN_PIN15_Pos) -#define GPIO_INTRISEEN_PIN16_Pos 16 -#define GPIO_INTRISEEN_PIN16_Msk (0x01 << GPIO_INTRISEEN_PIN16_Pos) -#define GPIO_INTRISEEN_PIN17_Pos 17 -#define GPIO_INTRISEEN_PIN17_Msk (0x01 << GPIO_INTRISEEN_PIN17_Pos) -#define GPIO_INTRISEEN_PIN18_Pos 18 -#define GPIO_INTRISEEN_PIN18_Msk (0x01 << GPIO_INTRISEEN_PIN18_Pos) -#define GPIO_INTRISEEN_PIN19_Pos 19 -#define GPIO_INTRISEEN_PIN19_Msk (0x01 << GPIO_INTRISEEN_PIN19_Pos) -#define GPIO_INTRISEEN_PIN20_Pos 20 -#define GPIO_INTRISEEN_PIN20_Msk (0x01 << GPIO_INTRISEEN_PIN20_Pos) -#define GPIO_INTRISEEN_PIN21_Pos 21 -#define GPIO_INTRISEEN_PIN21_Msk (0x01 << GPIO_INTRISEEN_PIN21_Pos) -#define GPIO_INTRISEEN_PIN22_Pos 22 -#define GPIO_INTRISEEN_PIN22_Msk (0x01 << GPIO_INTRISEEN_PIN22_Pos) -#define GPIO_INTRISEEN_PIN23_Pos 23 -#define GPIO_INTRISEEN_PIN23_Msk (0x01 << GPIO_INTRISEEN_PIN23_Pos) +#define GPIO_INTBE_PIN0_Pos 0 +#define GPIO_INTBE_PIN0_Msk (0x01 << GPIO_INTBE_PIN0_Pos) +#define GPIO_INTBE_PIN1_Pos 1 +#define GPIO_INTBE_PIN1_Msk (0x01 << GPIO_INTBE_PIN1_Pos) +#define GPIO_INTBE_PIN2_Pos 2 +#define GPIO_INTBE_PIN2_Msk (0x01 << GPIO_INTBE_PIN2_Pos) +#define GPIO_INTBE_PIN3_Pos 3 +#define GPIO_INTBE_PIN3_Msk (0x01 << GPIO_INTBE_PIN3_Pos) +#define GPIO_INTBE_PIN4_Pos 4 +#define GPIO_INTBE_PIN4_Msk (0x01 << GPIO_INTBE_PIN4_Pos) +#define GPIO_INTBE_PIN5_Pos 5 +#define GPIO_INTBE_PIN5_Msk (0x01 << GPIO_INTBE_PIN5_Pos) +#define GPIO_INTBE_PIN6_Pos 6 +#define GPIO_INTBE_PIN6_Msk (0x01 << GPIO_INTBE_PIN6_Pos) +#define GPIO_INTBE_PIN7_Pos 7 +#define GPIO_INTBE_PIN7_Msk (0x01 << GPIO_INTBE_PIN7_Pos) +#define GPIO_INTBE_PIN8_Pos 8 +#define GPIO_INTBE_PIN8_Msk (0x01 << GPIO_INTBE_PIN8_Pos) +#define GPIO_INTBE_PIN9_Pos 9 +#define GPIO_INTBE_PIN9_Msk (0x01 << GPIO_INTBE_PIN9_Pos) +#define GPIO_INTBE_PIN10_Pos 10 +#define GPIO_INTBE_PIN10_Msk (0x01 << GPIO_INTBE_PIN10_Pos) +#define GPIO_INTBE_PIN11_Pos 11 +#define GPIO_INTBE_PIN11_Msk (0x01 << GPIO_INTBE_PIN11_Pos) +#define GPIO_INTBE_PIN12_Pos 12 +#define GPIO_INTBE_PIN12_Msk (0x01 << GPIO_INTBE_PIN12_Pos) +#define GPIO_INTBE_PIN13_Pos 13 +#define GPIO_INTBE_PIN13_Msk (0x01 << GPIO_INTBE_PIN13_Pos) +#define GPIO_INTBE_PIN14_Pos 14 +#define GPIO_INTBE_PIN14_Msk (0x01 << GPIO_INTBE_PIN14_Pos) +#define GPIO_INTBE_PIN15_Pos 15 +#define GPIO_INTBE_PIN15_Msk (0x01 << GPIO_INTBE_PIN15_Pos) +#define GPIO_INTBE_PIN16_Pos 16 +#define GPIO_INTBE_PIN16_Msk (0x01 << GPIO_INTBE_PIN16_Pos) +#define GPIO_INTBE_PIN17_Pos 17 +#define GPIO_INTBE_PIN17_Msk (0x01 << GPIO_INTBE_PIN17_Pos) +#define GPIO_INTBE_PIN18_Pos 18 +#define GPIO_INTBE_PIN18_Msk (0x01 << GPIO_INTBE_PIN18_Pos) +#define GPIO_INTBE_PIN19_Pos 19 +#define GPIO_INTBE_PIN19_Msk (0x01 << GPIO_INTBE_PIN19_Pos) +#define GPIO_INTBE_PIN20_Pos 20 +#define GPIO_INTBE_PIN20_Msk (0x01 << GPIO_INTBE_PIN20_Pos) +#define GPIO_INTBE_PIN21_Pos 21 +#define GPIO_INTBE_PIN21_Msk (0x01 << GPIO_INTBE_PIN21_Pos) +#define GPIO_INTBE_PIN22_Pos 22 +#define GPIO_INTBE_PIN22_Msk (0x01 << GPIO_INTBE_PIN22_Pos) +#define GPIO_INTBE_PIN23_Pos 23 +#define GPIO_INTBE_PIN23_Msk (0x01 << GPIO_INTBE_PIN23_Pos) -#define GPIO_INTEN_PIN0_Pos 0 -#define GPIO_INTEN_PIN0_Msk (0x01 << GPIO_INTEN_PIN0_Pos) -#define GPIO_INTEN_PIN1_Pos 1 -#define GPIO_INTEN_PIN1_Msk (0x01 << GPIO_INTEN_PIN1_Pos) -#define GPIO_INTEN_PIN2_Pos 2 -#define GPIO_INTEN_PIN2_Msk (0x01 << GPIO_INTEN_PIN2_Pos) -#define GPIO_INTEN_PIN3_Pos 3 -#define GPIO_INTEN_PIN3_Msk (0x01 << GPIO_INTEN_PIN3_Pos) -#define GPIO_INTEN_PIN4_Pos 4 -#define GPIO_INTEN_PIN4_Msk (0x01 << GPIO_INTEN_PIN4_Pos) -#define GPIO_INTEN_PIN5_Pos 5 -#define GPIO_INTEN_PIN5_Msk (0x01 << GPIO_INTEN_PIN5_Pos) -#define GPIO_INTEN_PIN6_Pos 6 -#define GPIO_INTEN_PIN6_Msk (0x01 << GPIO_INTEN_PIN6_Pos) -#define GPIO_INTEN_PIN7_Pos 7 -#define GPIO_INTEN_PIN7_Msk (0x01 << GPIO_INTEN_PIN7_Pos) -#define GPIO_INTEN_PIN8_Pos 8 -#define GPIO_INTEN_PIN8_Msk (0x01 << GPIO_INTEN_PIN8_Pos) -#define GPIO_INTEN_PIN9_Pos 9 -#define GPIO_INTEN_PIN9_Msk (0x01 << GPIO_INTEN_PIN9_Pos) -#define GPIO_INTEN_PIN10_Pos 10 -#define GPIO_INTEN_PIN10_Msk (0x01 << GPIO_INTEN_PIN10_Pos) -#define GPIO_INTEN_PIN11_Pos 11 -#define GPIO_INTEN_PIN11_Msk (0x01 << GPIO_INTEN_PIN11_Pos) -#define GPIO_INTEN_PIN12_Pos 12 -#define GPIO_INTEN_PIN12_Msk (0x01 << GPIO_INTEN_PIN12_Pos) -#define GPIO_INTEN_PIN13_Pos 13 -#define GPIO_INTEN_PIN13_Msk (0x01 << GPIO_INTEN_PIN13_Pos) -#define GPIO_INTEN_PIN14_Pos 14 -#define GPIO_INTEN_PIN14_Msk (0x01 << GPIO_INTEN_PIN14_Pos) -#define GPIO_INTEN_PIN15_Pos 15 -#define GPIO_INTEN_PIN15_Msk (0x01 << GPIO_INTEN_PIN15_Pos) -#define GPIO_INTEN_PIN16_Pos 16 -#define GPIO_INTEN_PIN16_Msk (0x01 << GPIO_INTEN_PIN16_Pos) -#define GPIO_INTEN_PIN17_Pos 17 -#define GPIO_INTEN_PIN17_Msk (0x01 << GPIO_INTEN_PIN17_Pos) -#define GPIO_INTEN_PIN18_Pos 18 -#define GPIO_INTEN_PIN18_Msk (0x01 << GPIO_INTEN_PIN18_Pos) -#define GPIO_INTEN_PIN19_Pos 19 -#define GPIO_INTEN_PIN19_Msk (0x01 << GPIO_INTEN_PIN19_Pos) -#define GPIO_INTEN_PIN20_Pos 20 -#define GPIO_INTEN_PIN20_Msk (0x01 << GPIO_INTEN_PIN20_Pos) -#define GPIO_INTEN_PIN21_Pos 21 -#define GPIO_INTEN_PIN21_Msk (0x01 << GPIO_INTEN_PIN21_Pos) -#define GPIO_INTEN_PIN22_Pos 22 -#define GPIO_INTEN_PIN22_Msk (0x01 << GPIO_INTEN_PIN22_Pos) -#define GPIO_INTEN_PIN23_Pos 23 -#define GPIO_INTEN_PIN23_Msk (0x01 << GPIO_INTEN_PIN23_Pos) +#define GPIO_INTRISEEN_PIN0_Pos 0 +#define GPIO_INTRISEEN_PIN0_Msk (0x01 << GPIO_INTRISEEN_PIN0_Pos) +#define GPIO_INTRISEEN_PIN1_Pos 1 +#define GPIO_INTRISEEN_PIN1_Msk (0x01 << GPIO_INTRISEEN_PIN1_Pos) +#define GPIO_INTRISEEN_PIN2_Pos 2 +#define GPIO_INTRISEEN_PIN2_Msk (0x01 << GPIO_INTRISEEN_PIN2_Pos) +#define GPIO_INTRISEEN_PIN3_Pos 3 +#define GPIO_INTRISEEN_PIN3_Msk (0x01 << GPIO_INTRISEEN_PIN3_Pos) +#define GPIO_INTRISEEN_PIN4_Pos 4 +#define GPIO_INTRISEEN_PIN4_Msk (0x01 << GPIO_INTRISEEN_PIN4_Pos) +#define GPIO_INTRISEEN_PIN5_Pos 5 +#define GPIO_INTRISEEN_PIN5_Msk (0x01 << GPIO_INTRISEEN_PIN5_Pos) +#define GPIO_INTRISEEN_PIN6_Pos 6 +#define GPIO_INTRISEEN_PIN6_Msk (0x01 << GPIO_INTRISEEN_PIN6_Pos) +#define GPIO_INTRISEEN_PIN7_Pos 7 +#define GPIO_INTRISEEN_PIN7_Msk (0x01 << GPIO_INTRISEEN_PIN7_Pos) +#define GPIO_INTRISEEN_PIN8_Pos 8 +#define GPIO_INTRISEEN_PIN8_Msk (0x01 << GPIO_INTRISEEN_PIN8_Pos) +#define GPIO_INTRISEEN_PIN9_Pos 9 +#define GPIO_INTRISEEN_PIN9_Msk (0x01 << GPIO_INTRISEEN_PIN9_Pos) +#define GPIO_INTRISEEN_PIN10_Pos 10 +#define GPIO_INTRISEEN_PIN10_Msk (0x01 << GPIO_INTRISEEN_PIN10_Pos) +#define GPIO_INTRISEEN_PIN11_Pos 11 +#define GPIO_INTRISEEN_PIN11_Msk (0x01 << GPIO_INTRISEEN_PIN11_Pos) +#define GPIO_INTRISEEN_PIN12_Pos 12 +#define GPIO_INTRISEEN_PIN12_Msk (0x01 << GPIO_INTRISEEN_PIN12_Pos) +#define GPIO_INTRISEEN_PIN13_Pos 13 +#define GPIO_INTRISEEN_PIN13_Msk (0x01 << GPIO_INTRISEEN_PIN13_Pos) +#define GPIO_INTRISEEN_PIN14_Pos 14 +#define GPIO_INTRISEEN_PIN14_Msk (0x01 << GPIO_INTRISEEN_PIN14_Pos) +#define GPIO_INTRISEEN_PIN15_Pos 15 +#define GPIO_INTRISEEN_PIN15_Msk (0x01 << GPIO_INTRISEEN_PIN15_Pos) +#define GPIO_INTRISEEN_PIN16_Pos 16 +#define GPIO_INTRISEEN_PIN16_Msk (0x01 << GPIO_INTRISEEN_PIN16_Pos) +#define GPIO_INTRISEEN_PIN17_Pos 17 +#define GPIO_INTRISEEN_PIN17_Msk (0x01 << GPIO_INTRISEEN_PIN17_Pos) +#define GPIO_INTRISEEN_PIN18_Pos 18 +#define GPIO_INTRISEEN_PIN18_Msk (0x01 << GPIO_INTRISEEN_PIN18_Pos) +#define GPIO_INTRISEEN_PIN19_Pos 19 +#define GPIO_INTRISEEN_PIN19_Msk (0x01 << GPIO_INTRISEEN_PIN19_Pos) +#define GPIO_INTRISEEN_PIN20_Pos 20 +#define GPIO_INTRISEEN_PIN20_Msk (0x01 << GPIO_INTRISEEN_PIN20_Pos) +#define GPIO_INTRISEEN_PIN21_Pos 21 +#define GPIO_INTRISEEN_PIN21_Msk (0x01 << GPIO_INTRISEEN_PIN21_Pos) +#define GPIO_INTRISEEN_PIN22_Pos 22 +#define GPIO_INTRISEEN_PIN22_Msk (0x01 << GPIO_INTRISEEN_PIN22_Pos) +#define GPIO_INTRISEEN_PIN23_Pos 23 +#define GPIO_INTRISEEN_PIN23_Msk (0x01 << GPIO_INTRISEEN_PIN23_Pos) -#define GPIO_INTRAWSTAT_PIN0_Pos 0 -#define GPIO_INTRAWSTAT_PIN0_Msk (0x01 << GPIO_INTRAWSTAT_PIN0_Pos) -#define GPIO_INTRAWSTAT_PIN1_Pos 1 -#define GPIO_INTRAWSTAT_PIN1_Msk (0x01 << GPIO_INTRAWSTAT_PIN1_Pos) -#define GPIO_INTRAWSTAT_PIN2_Pos 2 -#define GPIO_INTRAWSTAT_PIN2_Msk (0x01 << GPIO_INTRAWSTAT_PIN2_Pos) -#define GPIO_INTRAWSTAT_PIN3_Pos 3 -#define GPIO_INTRAWSTAT_PIN3_Msk (0x01 << GPIO_INTRAWSTAT_PIN3_Pos) -#define GPIO_INTRAWSTAT_PIN4_Pos 4 -#define GPIO_INTRAWSTAT_PIN4_Msk (0x01 << GPIO_INTRAWSTAT_PIN4_Pos) -#define GPIO_INTRAWSTAT_PIN5_Pos 5 -#define GPIO_INTRAWSTAT_PIN5_Msk (0x01 << GPIO_INTRAWSTAT_PIN5_Pos) -#define GPIO_INTRAWSTAT_PIN6_Pos 6 -#define GPIO_INTRAWSTAT_PIN6_Msk (0x01 << GPIO_INTRAWSTAT_PIN6_Pos) -#define GPIO_INTRAWSTAT_PIN7_Pos 7 -#define GPIO_INTRAWSTAT_PIN7_Msk (0x01 << GPIO_INTRAWSTAT_PIN7_Pos) -#define GPIO_INTRAWSTAT_PIN8_Pos 8 -#define GPIO_INTRAWSTAT_PIN8_Msk (0x01 << GPIO_INTRAWSTAT_PIN8_Pos) -#define GPIO_INTRAWSTAT_PIN9_Pos 9 -#define GPIO_INTRAWSTAT_PIN9_Msk (0x01 << GPIO_INTRAWSTAT_PIN9_Pos) -#define GPIO_INTRAWSTAT_PIN10_Pos 10 -#define GPIO_INTRAWSTAT_PIN10_Msk (0x01 << GPIO_INTRAWSTAT_PIN10_Pos) -#define GPIO_INTRAWSTAT_PIN11_Pos 11 -#define GPIO_INTRAWSTAT_PIN11_Msk (0x01 << GPIO_INTRAWSTAT_PIN11_Pos) -#define GPIO_INTRAWSTAT_PIN12_Pos 12 -#define GPIO_INTRAWSTAT_PIN12_Msk (0x01 << GPIO_INTRAWSTAT_PIN12_Pos) -#define GPIO_INTRAWSTAT_PIN13_Pos 13 -#define GPIO_INTRAWSTAT_PIN13_Msk (0x01 << GPIO_INTRAWSTAT_PIN13_Pos) -#define GPIO_INTRAWSTAT_PIN14_Pos 14 -#define GPIO_INTRAWSTAT_PIN14_Msk (0x01 << GPIO_INTRAWSTAT_PIN14_Pos) -#define GPIO_INTRAWSTAT_PIN15_Pos 15 -#define GPIO_INTRAWSTAT_PIN15_Msk (0x01 << GPIO_INTRAWSTAT_PIN15_Pos) -#define GPIO_INTRAWSTAT_PIN16_Pos 16 -#define GPIO_INTRAWSTAT_PIN16_Msk (0x01 << GPIO_INTRAWSTAT_PIN16_Pos) -#define GPIO_INTRAWSTAT_PIN17_Pos 17 -#define GPIO_INTRAWSTAT_PIN17_Msk (0x01 << GPIO_INTRAWSTAT_PIN17_Pos) -#define GPIO_INTRAWSTAT_PIN18_Pos 18 -#define GPIO_INTRAWSTAT_PIN18_Msk (0x01 << GPIO_INTRAWSTAT_PIN18_Pos) -#define GPIO_INTRAWSTAT_PIN19_Pos 19 -#define GPIO_INTRAWSTAT_PIN19_Msk (0x01 << GPIO_INTRAWSTAT_PIN19_Pos) -#define GPIO_INTRAWSTAT_PIN20_Pos 20 -#define GPIO_INTRAWSTAT_PIN20_Msk (0x01 << GPIO_INTRAWSTAT_PIN20_Pos) -#define GPIO_INTRAWSTAT_PIN21_Pos 21 -#define GPIO_INTRAWSTAT_PIN21_Msk (0x01 << GPIO_INTRAWSTAT_PIN21_Pos) -#define GPIO_INTRAWSTAT_PIN22_Pos 22 -#define GPIO_INTRAWSTAT_PIN22_Msk (0x01 << GPIO_INTRAWSTAT_PIN22_Pos) -#define GPIO_INTRAWSTAT_PIN23_Pos 23 -#define GPIO_INTRAWSTAT_PIN23_Msk (0x01 << GPIO_INTRAWSTAT_PIN23_Pos) +#define GPIO_INTEN_PIN0_Pos 0 +#define GPIO_INTEN_PIN0_Msk (0x01 << GPIO_INTEN_PIN0_Pos) +#define GPIO_INTEN_PIN1_Pos 1 +#define GPIO_INTEN_PIN1_Msk (0x01 << GPIO_INTEN_PIN1_Pos) +#define GPIO_INTEN_PIN2_Pos 2 +#define GPIO_INTEN_PIN2_Msk (0x01 << GPIO_INTEN_PIN2_Pos) +#define GPIO_INTEN_PIN3_Pos 3 +#define GPIO_INTEN_PIN3_Msk (0x01 << GPIO_INTEN_PIN3_Pos) +#define GPIO_INTEN_PIN4_Pos 4 +#define GPIO_INTEN_PIN4_Msk (0x01 << GPIO_INTEN_PIN4_Pos) +#define GPIO_INTEN_PIN5_Pos 5 +#define GPIO_INTEN_PIN5_Msk (0x01 << GPIO_INTEN_PIN5_Pos) +#define GPIO_INTEN_PIN6_Pos 6 +#define GPIO_INTEN_PIN6_Msk (0x01 << GPIO_INTEN_PIN6_Pos) +#define GPIO_INTEN_PIN7_Pos 7 +#define GPIO_INTEN_PIN7_Msk (0x01 << GPIO_INTEN_PIN7_Pos) +#define GPIO_INTEN_PIN8_Pos 8 +#define GPIO_INTEN_PIN8_Msk (0x01 << GPIO_INTEN_PIN8_Pos) +#define GPIO_INTEN_PIN9_Pos 9 +#define GPIO_INTEN_PIN9_Msk (0x01 << GPIO_INTEN_PIN9_Pos) +#define GPIO_INTEN_PIN10_Pos 10 +#define GPIO_INTEN_PIN10_Msk (0x01 << GPIO_INTEN_PIN10_Pos) +#define GPIO_INTEN_PIN11_Pos 11 +#define GPIO_INTEN_PIN11_Msk (0x01 << GPIO_INTEN_PIN11_Pos) +#define GPIO_INTEN_PIN12_Pos 12 +#define GPIO_INTEN_PIN12_Msk (0x01 << GPIO_INTEN_PIN12_Pos) +#define GPIO_INTEN_PIN13_Pos 13 +#define GPIO_INTEN_PIN13_Msk (0x01 << GPIO_INTEN_PIN13_Pos) +#define GPIO_INTEN_PIN14_Pos 14 +#define GPIO_INTEN_PIN14_Msk (0x01 << GPIO_INTEN_PIN14_Pos) +#define GPIO_INTEN_PIN15_Pos 15 +#define GPIO_INTEN_PIN15_Msk (0x01 << GPIO_INTEN_PIN15_Pos) +#define GPIO_INTEN_PIN16_Pos 16 +#define GPIO_INTEN_PIN16_Msk (0x01 << GPIO_INTEN_PIN16_Pos) +#define GPIO_INTEN_PIN17_Pos 17 +#define GPIO_INTEN_PIN17_Msk (0x01 << GPIO_INTEN_PIN17_Pos) +#define GPIO_INTEN_PIN18_Pos 18 +#define GPIO_INTEN_PIN18_Msk (0x01 << GPIO_INTEN_PIN18_Pos) +#define GPIO_INTEN_PIN19_Pos 19 +#define GPIO_INTEN_PIN19_Msk (0x01 << GPIO_INTEN_PIN19_Pos) +#define GPIO_INTEN_PIN20_Pos 20 +#define GPIO_INTEN_PIN20_Msk (0x01 << GPIO_INTEN_PIN20_Pos) +#define GPIO_INTEN_PIN21_Pos 21 +#define GPIO_INTEN_PIN21_Msk (0x01 << GPIO_INTEN_PIN21_Pos) +#define GPIO_INTEN_PIN22_Pos 22 +#define GPIO_INTEN_PIN22_Msk (0x01 << GPIO_INTEN_PIN22_Pos) +#define GPIO_INTEN_PIN23_Pos 23 +#define GPIO_INTEN_PIN23_Msk (0x01 << GPIO_INTEN_PIN23_Pos) -#define GPIO_INTSTAT_PIN0_Pos 0 -#define GPIO_INTSTAT_PIN0_Msk (0x01 << GPIO_INTSTAT_PIN0_Pos) -#define GPIO_INTSTAT_PIN1_Pos 1 -#define GPIO_INTSTAT_PIN1_Msk (0x01 << GPIO_INTSTAT_PIN1_Pos) -#define GPIO_INTSTAT_PIN2_Pos 2 -#define GPIO_INTSTAT_PIN2_Msk (0x01 << GPIO_INTSTAT_PIN2_Pos) -#define GPIO_INTSTAT_PIN3_Pos 3 -#define GPIO_INTSTAT_PIN3_Msk (0x01 << GPIO_INTSTAT_PIN3_Pos) -#define GPIO_INTSTAT_PIN4_Pos 4 -#define GPIO_INTSTAT_PIN4_Msk (0x01 << GPIO_INTSTAT_PIN4_Pos) -#define GPIO_INTSTAT_PIN5_Pos 5 -#define GPIO_INTSTAT_PIN5_Msk (0x01 << GPIO_INTSTAT_PIN5_Pos) -#define GPIO_INTSTAT_PIN6_Pos 6 -#define GPIO_INTSTAT_PIN6_Msk (0x01 << GPIO_INTSTAT_PIN6_Pos) -#define GPIO_INTSTAT_PIN7_Pos 7 -#define GPIO_INTSTAT_PIN7_Msk (0x01 << GPIO_INTSTAT_PIN7_Pos) -#define GPIO_INTSTAT_PIN8_Pos 8 -#define GPIO_INTSTAT_PIN8_Msk (0x01 << GPIO_INTSTAT_PIN8_Pos) -#define GPIO_INTSTAT_PIN9_Pos 9 -#define GPIO_INTSTAT_PIN9_Msk (0x01 << GPIO_INTSTAT_PIN9_Pos) -#define GPIO_INTSTAT_PIN10_Pos 10 -#define GPIO_INTSTAT_PIN10_Msk (0x01 << GPIO_INTSTAT_PIN10_Pos) -#define GPIO_INTSTAT_PIN11_Pos 11 -#define GPIO_INTSTAT_PIN11_Msk (0x01 << GPIO_INTSTAT_PIN11_Pos) -#define GPIO_INTSTAT_PIN12_Pos 12 -#define GPIO_INTSTAT_PIN12_Msk (0x01 << GPIO_INTSTAT_PIN12_Pos) -#define GPIO_INTSTAT_PIN13_Pos 13 -#define GPIO_INTSTAT_PIN13_Msk (0x01 << GPIO_INTSTAT_PIN13_Pos) -#define GPIO_INTSTAT_PIN14_Pos 14 -#define GPIO_INTSTAT_PIN14_Msk (0x01 << GPIO_INTSTAT_PIN14_Pos) -#define GPIO_INTSTAT_PIN15_Pos 15 -#define GPIO_INTSTAT_PIN15_Msk (0x01 << GPIO_INTSTAT_PIN15_Pos) -#define GPIO_INTSTAT_PIN16_Pos 16 -#define GPIO_INTSTAT_PIN16_Msk (0x01 << GPIO_INTSTAT_PIN16_Pos) -#define GPIO_INTSTAT_PIN17_Pos 17 -#define GPIO_INTSTAT_PIN17_Msk (0x01 << GPIO_INTSTAT_PIN17_Pos) -#define GPIO_INTSTAT_PIN18_Pos 18 -#define GPIO_INTSTAT_PIN18_Msk (0x01 << GPIO_INTSTAT_PIN18_Pos) -#define GPIO_INTSTAT_PIN19_Pos 19 -#define GPIO_INTSTAT_PIN19_Msk (0x01 << GPIO_INTSTAT_PIN19_Pos) -#define GPIO_INTSTAT_PIN20_Pos 20 -#define GPIO_INTSTAT_PIN20_Msk (0x01 << GPIO_INTSTAT_PIN20_Pos) -#define GPIO_INTSTAT_PIN21_Pos 21 -#define GPIO_INTSTAT_PIN21_Msk (0x01 << GPIO_INTSTAT_PIN21_Pos) -#define GPIO_INTSTAT_PIN22_Pos 22 -#define GPIO_INTSTAT_PIN22_Msk (0x01 << GPIO_INTSTAT_PIN22_Pos) -#define GPIO_INTSTAT_PIN23_Pos 23 -#define GPIO_INTSTAT_PIN23_Msk (0x01 << GPIO_INTSTAT_PIN23_Pos) +#define GPIO_INTRAWSTAT_PIN0_Pos 0 +#define GPIO_INTRAWSTAT_PIN0_Msk (0x01 << GPIO_INTRAWSTAT_PIN0_Pos) +#define GPIO_INTRAWSTAT_PIN1_Pos 1 +#define GPIO_INTRAWSTAT_PIN1_Msk (0x01 << GPIO_INTRAWSTAT_PIN1_Pos) +#define GPIO_INTRAWSTAT_PIN2_Pos 2 +#define GPIO_INTRAWSTAT_PIN2_Msk (0x01 << GPIO_INTRAWSTAT_PIN2_Pos) +#define GPIO_INTRAWSTAT_PIN3_Pos 3 +#define GPIO_INTRAWSTAT_PIN3_Msk (0x01 << GPIO_INTRAWSTAT_PIN3_Pos) +#define GPIO_INTRAWSTAT_PIN4_Pos 4 +#define GPIO_INTRAWSTAT_PIN4_Msk (0x01 << GPIO_INTRAWSTAT_PIN4_Pos) +#define GPIO_INTRAWSTAT_PIN5_Pos 5 +#define GPIO_INTRAWSTAT_PIN5_Msk (0x01 << GPIO_INTRAWSTAT_PIN5_Pos) +#define GPIO_INTRAWSTAT_PIN6_Pos 6 +#define GPIO_INTRAWSTAT_PIN6_Msk (0x01 << GPIO_INTRAWSTAT_PIN6_Pos) +#define GPIO_INTRAWSTAT_PIN7_Pos 7 +#define GPIO_INTRAWSTAT_PIN7_Msk (0x01 << GPIO_INTRAWSTAT_PIN7_Pos) +#define GPIO_INTRAWSTAT_PIN8_Pos 8 +#define GPIO_INTRAWSTAT_PIN8_Msk (0x01 << GPIO_INTRAWSTAT_PIN8_Pos) +#define GPIO_INTRAWSTAT_PIN9_Pos 9 +#define GPIO_INTRAWSTAT_PIN9_Msk (0x01 << GPIO_INTRAWSTAT_PIN9_Pos) +#define GPIO_INTRAWSTAT_PIN10_Pos 10 +#define GPIO_INTRAWSTAT_PIN10_Msk (0x01 << GPIO_INTRAWSTAT_PIN10_Pos) +#define GPIO_INTRAWSTAT_PIN11_Pos 11 +#define GPIO_INTRAWSTAT_PIN11_Msk (0x01 << GPIO_INTRAWSTAT_PIN11_Pos) +#define GPIO_INTRAWSTAT_PIN12_Pos 12 +#define GPIO_INTRAWSTAT_PIN12_Msk (0x01 << GPIO_INTRAWSTAT_PIN12_Pos) +#define GPIO_INTRAWSTAT_PIN13_Pos 13 +#define GPIO_INTRAWSTAT_PIN13_Msk (0x01 << GPIO_INTRAWSTAT_PIN13_Pos) +#define GPIO_INTRAWSTAT_PIN14_Pos 14 +#define GPIO_INTRAWSTAT_PIN14_Msk (0x01 << GPIO_INTRAWSTAT_PIN14_Pos) +#define GPIO_INTRAWSTAT_PIN15_Pos 15 +#define GPIO_INTRAWSTAT_PIN15_Msk (0x01 << GPIO_INTRAWSTAT_PIN15_Pos) +#define GPIO_INTRAWSTAT_PIN16_Pos 16 +#define GPIO_INTRAWSTAT_PIN16_Msk (0x01 << GPIO_INTRAWSTAT_PIN16_Pos) +#define GPIO_INTRAWSTAT_PIN17_Pos 17 +#define GPIO_INTRAWSTAT_PIN17_Msk (0x01 << GPIO_INTRAWSTAT_PIN17_Pos) +#define GPIO_INTRAWSTAT_PIN18_Pos 18 +#define GPIO_INTRAWSTAT_PIN18_Msk (0x01 << GPIO_INTRAWSTAT_PIN18_Pos) +#define GPIO_INTRAWSTAT_PIN19_Pos 19 +#define GPIO_INTRAWSTAT_PIN19_Msk (0x01 << GPIO_INTRAWSTAT_PIN19_Pos) +#define GPIO_INTRAWSTAT_PIN20_Pos 20 +#define GPIO_INTRAWSTAT_PIN20_Msk (0x01 << GPIO_INTRAWSTAT_PIN20_Pos) +#define GPIO_INTRAWSTAT_PIN21_Pos 21 +#define GPIO_INTRAWSTAT_PIN21_Msk (0x01 << GPIO_INTRAWSTAT_PIN21_Pos) +#define GPIO_INTRAWSTAT_PIN22_Pos 22 +#define GPIO_INTRAWSTAT_PIN22_Msk (0x01 << GPIO_INTRAWSTAT_PIN22_Pos) +#define GPIO_INTRAWSTAT_PIN23_Pos 23 +#define GPIO_INTRAWSTAT_PIN23_Msk (0x01 << GPIO_INTRAWSTAT_PIN23_Pos) -#define GPIO_INTCLR_PIN0_Pos 0 -#define GPIO_INTCLR_PIN0_Msk (0x01 << GPIO_INTCLR_PIN0_Pos) -#define GPIO_INTCLR_PIN1_Pos 1 -#define GPIO_INTCLR_PIN1_Msk (0x01 << GPIO_INTCLR_PIN1_Pos) -#define GPIO_INTCLR_PIN2_Pos 2 -#define GPIO_INTCLR_PIN2_Msk (0x01 << GPIO_INTCLR_PIN2_Pos) -#define GPIO_INTCLR_PIN3_Pos 3 -#define GPIO_INTCLR_PIN3_Msk (0x01 << GPIO_INTCLR_PIN3_Pos) -#define GPIO_INTCLR_PIN4_Pos 4 -#define GPIO_INTCLR_PIN4_Msk (0x01 << GPIO_INTCLR_PIN4_Pos) -#define GPIO_INTCLR_PIN5_Pos 5 -#define GPIO_INTCLR_PIN5_Msk (0x01 << GPIO_INTCLR_PIN5_Pos) -#define GPIO_INTCLR_PIN6_Pos 6 -#define GPIO_INTCLR_PIN6_Msk (0x01 << GPIO_INTCLR_PIN6_Pos) -#define GPIO_INTCLR_PIN7_Pos 7 -#define GPIO_INTCLR_PIN7_Msk (0x01 << GPIO_INTCLR_PIN7_Pos) -#define GPIO_INTCLR_PIN8_Pos 8 -#define GPIO_INTCLR_PIN8_Msk (0x01 << GPIO_INTCLR_PIN8_Pos) -#define GPIO_INTCLR_PIN9_Pos 9 -#define GPIO_INTCLR_PIN9_Msk (0x01 << GPIO_INTCLR_PIN9_Pos) -#define GPIO_INTCLR_PIN10_Pos 10 -#define GPIO_INTCLR_PIN10_Msk (0x01 << GPIO_INTCLR_PIN10_Pos) -#define GPIO_INTCLR_PIN11_Pos 11 -#define GPIO_INTCLR_PIN11_Msk (0x01 << GPIO_INTCLR_PIN11_Pos) -#define GPIO_INTCLR_PIN12_Pos 12 -#define GPIO_INTCLR_PIN12_Msk (0x01 << GPIO_INTCLR_PIN12_Pos) -#define GPIO_INTCLR_PIN13_Pos 13 -#define GPIO_INTCLR_PIN13_Msk (0x01 << GPIO_INTCLR_PIN13_Pos) -#define GPIO_INTCLR_PIN14_Pos 14 -#define GPIO_INTCLR_PIN14_Msk (0x01 << GPIO_INTCLR_PIN14_Pos) -#define GPIO_INTCLR_PIN15_Pos 15 -#define GPIO_INTCLR_PIN15_Msk (0x01 << GPIO_INTCLR_PIN15_Pos) -#define GPIO_INTCLR_PIN16_Pos 16 -#define GPIO_INTCLR_PIN16_Msk (0x01 << GPIO_INTCLR_PIN16_Pos) -#define GPIO_INTCLR_PIN17_Pos 17 -#define GPIO_INTCLR_PIN17_Msk (0x01 << GPIO_INTCLR_PIN17_Pos) -#define GPIO_INTCLR_PIN18_Pos 18 -#define GPIO_INTCLR_PIN18_Msk (0x01 << GPIO_INTCLR_PIN18_Pos) -#define GPIO_INTCLR_PIN19_Pos 19 -#define GPIO_INTCLR_PIN19_Msk (0x01 << GPIO_INTCLR_PIN19_Pos) -#define GPIO_INTCLR_PIN20_Pos 20 -#define GPIO_INTCLR_PIN20_Msk (0x01 << GPIO_INTCLR_PIN20_Pos) -#define GPIO_INTCLR_PIN21_Pos 21 -#define GPIO_INTCLR_PIN21_Msk (0x01 << GPIO_INTCLR_PIN21_Pos) -#define GPIO_INTCLR_PIN22_Pos 22 -#define GPIO_INTCLR_PIN22_Msk (0x01 << GPIO_INTCLR_PIN22_Pos) -#define GPIO_INTCLR_PIN23_Pos 23 -#define GPIO_INTCLR_PIN23_Msk (0x01 << GPIO_INTCLR_PIN23_Pos) +#define GPIO_INTSTAT_PIN0_Pos 0 +#define GPIO_INTSTAT_PIN0_Msk (0x01 << GPIO_INTSTAT_PIN0_Pos) +#define GPIO_INTSTAT_PIN1_Pos 1 +#define GPIO_INTSTAT_PIN1_Msk (0x01 << GPIO_INTSTAT_PIN1_Pos) +#define GPIO_INTSTAT_PIN2_Pos 2 +#define GPIO_INTSTAT_PIN2_Msk (0x01 << GPIO_INTSTAT_PIN2_Pos) +#define GPIO_INTSTAT_PIN3_Pos 3 +#define GPIO_INTSTAT_PIN3_Msk (0x01 << GPIO_INTSTAT_PIN3_Pos) +#define GPIO_INTSTAT_PIN4_Pos 4 +#define GPIO_INTSTAT_PIN4_Msk (0x01 << GPIO_INTSTAT_PIN4_Pos) +#define GPIO_INTSTAT_PIN5_Pos 5 +#define GPIO_INTSTAT_PIN5_Msk (0x01 << GPIO_INTSTAT_PIN5_Pos) +#define GPIO_INTSTAT_PIN6_Pos 6 +#define GPIO_INTSTAT_PIN6_Msk (0x01 << GPIO_INTSTAT_PIN6_Pos) +#define GPIO_INTSTAT_PIN7_Pos 7 +#define GPIO_INTSTAT_PIN7_Msk (0x01 << GPIO_INTSTAT_PIN7_Pos) +#define GPIO_INTSTAT_PIN8_Pos 8 +#define GPIO_INTSTAT_PIN8_Msk (0x01 << GPIO_INTSTAT_PIN8_Pos) +#define GPIO_INTSTAT_PIN9_Pos 9 +#define GPIO_INTSTAT_PIN9_Msk (0x01 << GPIO_INTSTAT_PIN9_Pos) +#define GPIO_INTSTAT_PIN10_Pos 10 +#define GPIO_INTSTAT_PIN10_Msk (0x01 << GPIO_INTSTAT_PIN10_Pos) +#define GPIO_INTSTAT_PIN11_Pos 11 +#define GPIO_INTSTAT_PIN11_Msk (0x01 << GPIO_INTSTAT_PIN11_Pos) +#define GPIO_INTSTAT_PIN12_Pos 12 +#define GPIO_INTSTAT_PIN12_Msk (0x01 << GPIO_INTSTAT_PIN12_Pos) +#define GPIO_INTSTAT_PIN13_Pos 13 +#define GPIO_INTSTAT_PIN13_Msk (0x01 << GPIO_INTSTAT_PIN13_Pos) +#define GPIO_INTSTAT_PIN14_Pos 14 +#define GPIO_INTSTAT_PIN14_Msk (0x01 << GPIO_INTSTAT_PIN14_Pos) +#define GPIO_INTSTAT_PIN15_Pos 15 +#define GPIO_INTSTAT_PIN15_Msk (0x01 << GPIO_INTSTAT_PIN15_Pos) +#define GPIO_INTSTAT_PIN16_Pos 16 +#define GPIO_INTSTAT_PIN16_Msk (0x01 << GPIO_INTSTAT_PIN16_Pos) +#define GPIO_INTSTAT_PIN17_Pos 17 +#define GPIO_INTSTAT_PIN17_Msk (0x01 << GPIO_INTSTAT_PIN17_Pos) +#define GPIO_INTSTAT_PIN18_Pos 18 +#define GPIO_INTSTAT_PIN18_Msk (0x01 << GPIO_INTSTAT_PIN18_Pos) +#define GPIO_INTSTAT_PIN19_Pos 19 +#define GPIO_INTSTAT_PIN19_Msk (0x01 << GPIO_INTSTAT_PIN19_Pos) +#define GPIO_INTSTAT_PIN20_Pos 20 +#define GPIO_INTSTAT_PIN20_Msk (0x01 << GPIO_INTSTAT_PIN20_Pos) +#define GPIO_INTSTAT_PIN21_Pos 21 +#define GPIO_INTSTAT_PIN21_Msk (0x01 << GPIO_INTSTAT_PIN21_Pos) +#define GPIO_INTSTAT_PIN22_Pos 22 +#define GPIO_INTSTAT_PIN22_Msk (0x01 << GPIO_INTSTAT_PIN22_Pos) +#define GPIO_INTSTAT_PIN23_Pos 23 +#define GPIO_INTSTAT_PIN23_Msk (0x01 << GPIO_INTSTAT_PIN23_Pos) -typedef struct -{ - __IO uint32_t LDVAL; //瀹氭椂鍣ㄥ姞杞藉硷紝浣胯兘鍚庡畾鏃跺櫒浠庢鏁板煎紑濮嬪悜涓嬮掑噺璁℃暟 +#define GPIO_INTCLR_PIN0_Pos 0 +#define GPIO_INTCLR_PIN0_Msk (0x01 << GPIO_INTCLR_PIN0_Pos) +#define GPIO_INTCLR_PIN1_Pos 1 +#define GPIO_INTCLR_PIN1_Msk (0x01 << GPIO_INTCLR_PIN1_Pos) +#define GPIO_INTCLR_PIN2_Pos 2 +#define GPIO_INTCLR_PIN2_Msk (0x01 << GPIO_INTCLR_PIN2_Pos) +#define GPIO_INTCLR_PIN3_Pos 3 +#define GPIO_INTCLR_PIN3_Msk (0x01 << GPIO_INTCLR_PIN3_Pos) +#define GPIO_INTCLR_PIN4_Pos 4 +#define GPIO_INTCLR_PIN4_Msk (0x01 << GPIO_INTCLR_PIN4_Pos) +#define GPIO_INTCLR_PIN5_Pos 5 +#define GPIO_INTCLR_PIN5_Msk (0x01 << GPIO_INTCLR_PIN5_Pos) +#define GPIO_INTCLR_PIN6_Pos 6 +#define GPIO_INTCLR_PIN6_Msk (0x01 << GPIO_INTCLR_PIN6_Pos) +#define GPIO_INTCLR_PIN7_Pos 7 +#define GPIO_INTCLR_PIN7_Msk (0x01 << GPIO_INTCLR_PIN7_Pos) +#define GPIO_INTCLR_PIN8_Pos 8 +#define GPIO_INTCLR_PIN8_Msk (0x01 << GPIO_INTCLR_PIN8_Pos) +#define GPIO_INTCLR_PIN9_Pos 9 +#define GPIO_INTCLR_PIN9_Msk (0x01 << GPIO_INTCLR_PIN9_Pos) +#define GPIO_INTCLR_PIN10_Pos 10 +#define GPIO_INTCLR_PIN10_Msk (0x01 << GPIO_INTCLR_PIN10_Pos) +#define GPIO_INTCLR_PIN11_Pos 11 +#define GPIO_INTCLR_PIN11_Msk (0x01 << GPIO_INTCLR_PIN11_Pos) +#define GPIO_INTCLR_PIN12_Pos 12 +#define GPIO_INTCLR_PIN12_Msk (0x01 << GPIO_INTCLR_PIN12_Pos) +#define GPIO_INTCLR_PIN13_Pos 13 +#define GPIO_INTCLR_PIN13_Msk (0x01 << GPIO_INTCLR_PIN13_Pos) +#define GPIO_INTCLR_PIN14_Pos 14 +#define GPIO_INTCLR_PIN14_Msk (0x01 << GPIO_INTCLR_PIN14_Pos) +#define GPIO_INTCLR_PIN15_Pos 15 +#define GPIO_INTCLR_PIN15_Msk (0x01 << GPIO_INTCLR_PIN15_Pos) +#define GPIO_INTCLR_PIN16_Pos 16 +#define GPIO_INTCLR_PIN16_Msk (0x01 << GPIO_INTCLR_PIN16_Pos) +#define GPIO_INTCLR_PIN17_Pos 17 +#define GPIO_INTCLR_PIN17_Msk (0x01 << GPIO_INTCLR_PIN17_Pos) +#define GPIO_INTCLR_PIN18_Pos 18 +#define GPIO_INTCLR_PIN18_Msk (0x01 << GPIO_INTCLR_PIN18_Pos) +#define GPIO_INTCLR_PIN19_Pos 19 +#define GPIO_INTCLR_PIN19_Msk (0x01 << GPIO_INTCLR_PIN19_Pos) +#define GPIO_INTCLR_PIN20_Pos 20 +#define GPIO_INTCLR_PIN20_Msk (0x01 << GPIO_INTCLR_PIN20_Pos) +#define GPIO_INTCLR_PIN21_Pos 21 +#define GPIO_INTCLR_PIN21_Msk (0x01 << GPIO_INTCLR_PIN21_Pos) +#define GPIO_INTCLR_PIN22_Pos 22 +#define GPIO_INTCLR_PIN22_Msk (0x01 << GPIO_INTCLR_PIN22_Pos) +#define GPIO_INTCLR_PIN23_Pos 23 +#define GPIO_INTCLR_PIN23_Msk (0x01 << GPIO_INTCLR_PIN23_Pos) - __I uint32_t CVAL; //瀹氭椂鍣ㄥ綋鍓嶅硷紝LDVAL-CVAL 鍙绠楀嚭璁℃椂鏃堕暱 - __IO uint32_t CTRL; + + +typedef struct { + __IO uint32_t LDVAL; //定时器加载值,使能后定时器从此数值开始向下递减计数 + + __I uint32_t CVAL; //定时器当前值,LDVAL-CVAL 可计算出计时时长 + + __IO uint32_t CTRL; } TIMR_TypeDef; -#define TIMR_CTRL_EN_Pos 0 //姝や綅璧1瀵艰嚧TIMR浠嶭DVAL寮濮嬪悜涓嬮掑噺璁℃暟 -#define TIMR_CTRL_EN_Msk (0x01 << TIMR_CTRL_EN_Pos) -#define TIMR_CTRL_CLKSRC_Pos 1 //鏃堕挓婧愶細0 鍐呴儴绯荤粺鏃堕挓 1 澶栭儴寮曡剼鑴夊啿璁℃暟 -#define TIMR_CTRL_CLKSRC_Msk (0x01 << TIMR_CTRL_CLKSRC_Pos) -#define TIMR_CTRL_CASCADE_Pos 2 //1 TIMRx鐨勮鏁版椂閽熶负TIMRx-1鐨勬孩鍑轰俊鍙 -#define TIMR_CTRL_CASCADE_Msk (0x01 << TIMR_CTRL_CASCADE_Pos) -typedef struct -{ - __IO uint32_t PCTRL; //Pulse Control锛岃剦瀹芥祴閲忔ā鍧楁帶鍒跺瘎瀛樺櫒 +#define TIMR_CTRL_EN_Pos 0 //此位赋1导致TIMR从LDVAL开始向下递减计数 +#define TIMR_CTRL_EN_Msk (0x01 << TIMR_CTRL_EN_Pos) +#define TIMR_CTRL_CLKSRC_Pos 1 //时钟源:0 内部系统时钟 1 外部引脚脉冲计数 +#define TIMR_CTRL_CLKSRC_Msk (0x01 << TIMR_CTRL_CLKSRC_Pos) +#define TIMR_CTRL_CASCADE_Pos 2 //1 TIMRx的计数时钟为TIMRx-1的溢出信号 +#define TIMR_CTRL_CASCADE_Msk (0x01 << TIMR_CTRL_CASCADE_Pos) - __I uint32_t PCVAL; //鑴夊娴嬮噺瀹氭椂鍣ㄥ綋鍓嶅 - uint32_t RESERVED[2]; +typedef struct { + __IO uint32_t PCTRL; //Pulse Control,脉宽测量模块控制寄存器 - __IO uint32_t IE; + __I uint32_t PCVAL; //脉宽测量定时器当前值 - __IO uint32_t IF; + uint32_t RESERVED[2]; - __IO uint32_t HALT; + __IO uint32_t IE; + + __IO uint32_t IF; + + __IO uint32_t HALT; } TIMRG_TypeDef; -#define TIMRG_PCTRL_EN_Pos 0 //寮濮嬫祴閲忚剦瀹斤紝鑴夊鍐32浣嶈鏁板櫒浠0寮濮嬪悜涓婅鏁 -#define TIMRG_PCTRL_EN_Msk (0x01 << TIMRG_PCTRL_EN_Pos) -#define TIMRG_PCTRL_HIGH_Pos 1 //0 娴嬮噺浣庣數骞抽暱搴 1 娴嬮噺楂樼數骞抽暱搴 -#define TIMRG_PCTRL_HIGH_Msk (0x01 << TIMRG_PCTRL_HIGH_Pos) -#define TIMRG_PCTRL_CLKSRC_Pos 2 //鏃堕挓婧愶細0 鍐呴儴绯荤粺鏃堕挓 1 鑴夊娴嬮噺妯″潡鍙樻垚涓涓鏁板櫒锛屼笉鍐嶅叿鏈夎剦瀹芥祴閲忓姛鑳 -#define TIMRG_PCTRL_CLKSRC_Msk (0x01 << TIMRG_PCTRL_CLKSRC_Pos) -#define TIMRG_IE_TIMR0_Pos 0 -#define TIMRG_IE_TIMR0_Msk (0x01 << TIMRG_IE_TIMR0_Pos) -#define TIMRG_IE_TIMR1_Pos 1 -#define TIMRG_IE_TIMR1_Msk (0x01 << TIMRG_IE_TIMR1_Pos) -#define TIMRG_IE_TIMR2_Pos 2 -#define TIMRG_IE_TIMR2_Msk (0x01 << TIMRG_IE_TIMR2_Pos) -#define TIMRG_IE_TIMR3_Pos 3 -#define TIMRG_IE_TIMR3_Msk (0x01 << TIMRG_IE_TIMR3_Pos) -#define TIMRG_IE_TIMR4_Pos 4 -#define TIMRG_IE_TIMR4_Msk (0x01 << TIMRG_IE_TIMR4_Pos) -#define TIMRG_IE_TIMR5_Pos 5 -#define TIMRG_IE_TIMR5_Msk (0x01 << TIMRG_IE_TIMR5_Pos) -#define TIMRG_IE_PULSE_Pos 16 -#define TIMRG_IE_PULSE_Msk (0x01 << TIMRG_IE_PULSE_Pos) +#define TIMRG_PCTRL_EN_Pos 0 //开始测量脉宽,脉宽内32位计数器从0开始向上计数 +#define TIMRG_PCTRL_EN_Msk (0x01 << TIMRG_PCTRL_EN_Pos) +#define TIMRG_PCTRL_HIGH_Pos 1 //0 测量低电平长度 1 测量高电平长度 +#define TIMRG_PCTRL_HIGH_Msk (0x01 << TIMRG_PCTRL_HIGH_Pos) +#define TIMRG_PCTRL_CLKSRC_Pos 2 //时钟源:0 内部系统时钟 1 脉宽测量模块变成一个计数器,不再具有脉宽测量功能 +#define TIMRG_PCTRL_CLKSRC_Msk (0x01 << TIMRG_PCTRL_CLKSRC_Pos) -#define TIMRG_IF_TIMR0_Pos 0 //鍐1娓呴浂 -#define TIMRG_IF_TIMR0_Msk (0x01 << TIMRG_IF_TIMR0_Pos) -#define TIMRG_IF_TIMR1_Pos 1 -#define TIMRG_IF_TIMR1_Msk (0x01 << TIMRG_IF_TIMR1_Pos) -#define TIMRG_IF_TIMR2_Pos 2 -#define TIMRG_IF_TIMR2_Msk (0x01 << TIMRG_IF_TIMR2_Pos) -#define TIMRG_IF_TIMR3_Pos 3 -#define TIMRG_IF_TIMR3_Msk (0x01 << TIMRG_IF_TIMR3_Pos) -#define TIMRG_IF_TIMR4_Pos 4 -#define TIMRG_IF_TIMR4_Msk (0x01 << TIMRG_IF_TIMR4_Pos) -#define TIMRG_IF_TIMR5_Pos 5 -#define TIMRG_IF_TIMR5_Msk (0x01 << TIMRG_IF_TIMR5_Pos) -#define TIMRG_IF_PULSE_Pos 16 -#define TIMRG_IF_PULSE_Msk (0x01 << TIMRG_IF_PULSE_Pos) +#define TIMRG_IE_TIMR0_Pos 0 +#define TIMRG_IE_TIMR0_Msk (0x01 << TIMRG_IE_TIMR0_Pos) +#define TIMRG_IE_TIMR1_Pos 1 +#define TIMRG_IE_TIMR1_Msk (0x01 << TIMRG_IE_TIMR1_Pos) +#define TIMRG_IE_TIMR2_Pos 2 +#define TIMRG_IE_TIMR2_Msk (0x01 << TIMRG_IE_TIMR2_Pos) +#define TIMRG_IE_TIMR3_Pos 3 +#define TIMRG_IE_TIMR3_Msk (0x01 << TIMRG_IE_TIMR3_Pos) +#define TIMRG_IE_TIMR4_Pos 4 +#define TIMRG_IE_TIMR4_Msk (0x01 << TIMRG_IE_TIMR4_Pos) +#define TIMRG_IE_TIMR5_Pos 5 +#define TIMRG_IE_TIMR5_Msk (0x01 << TIMRG_IE_TIMR5_Pos) +#define TIMRG_IE_PULSE_Pos 16 +#define TIMRG_IE_PULSE_Msk (0x01 << TIMRG_IE_PULSE_Pos) -#define TIMRG_HALT_TIMR0_Pos 0 //1 鏆傚仠璁℃暟 -#define TIMRG_HALT_TIMR0_Msk (0x01 << TIMRG_HALT_TIMR0_Pos) -#define TIMRG_HALT_TIMR1_Pos 1 -#define TIMRG_HALT_TIMR1_Msk (0x01 << TIMRG_HALT_TIMR1_Pos) -#define TIMRG_HALT_TIMR2_Pos 2 -#define TIMRG_HALT_TIMR2_Msk (0x01 << TIMRG_HALT_TIMR2_Pos) -#define TIMRG_HALT_TIMR3_Pos 3 -#define TIMRG_HALT_TIMR3_Msk (0x01 << TIMRG_HALT_TIMR3_Pos) -#define TIMRG_HALT_TIMR4_Pos 4 -#define TIMRG_HALT_TIMR4_Msk (0x01 << TIMRG_HALT_TIMR4_Pos) -#define TIMRG_HALT_TIMR5_Pos 5 -#define TIMRG_HALT_TIMR5_Msk (0x01 << TIMRG_HALT_TIMR5_Pos) +#define TIMRG_IF_TIMR0_Pos 0 //写1清零 +#define TIMRG_IF_TIMR0_Msk (0x01 << TIMRG_IF_TIMR0_Pos) +#define TIMRG_IF_TIMR1_Pos 1 +#define TIMRG_IF_TIMR1_Msk (0x01 << TIMRG_IF_TIMR1_Pos) +#define TIMRG_IF_TIMR2_Pos 2 +#define TIMRG_IF_TIMR2_Msk (0x01 << TIMRG_IF_TIMR2_Pos) +#define TIMRG_IF_TIMR3_Pos 3 +#define TIMRG_IF_TIMR3_Msk (0x01 << TIMRG_IF_TIMR3_Pos) +#define TIMRG_IF_TIMR4_Pos 4 +#define TIMRG_IF_TIMR4_Msk (0x01 << TIMRG_IF_TIMR4_Pos) +#define TIMRG_IF_TIMR5_Pos 5 +#define TIMRG_IF_TIMR5_Msk (0x01 << TIMRG_IF_TIMR5_Pos) +#define TIMRG_IF_PULSE_Pos 16 +#define TIMRG_IF_PULSE_Msk (0x01 << TIMRG_IF_PULSE_Pos) -typedef struct -{ - __IO uint32_t DATA; +#define TIMRG_HALT_TIMR0_Pos 0 //1 暂停计数 +#define TIMRG_HALT_TIMR0_Msk (0x01 << TIMRG_HALT_TIMR0_Pos) +#define TIMRG_HALT_TIMR1_Pos 1 +#define TIMRG_HALT_TIMR1_Msk (0x01 << TIMRG_HALT_TIMR1_Pos) +#define TIMRG_HALT_TIMR2_Pos 2 +#define TIMRG_HALT_TIMR2_Msk (0x01 << TIMRG_HALT_TIMR2_Pos) +#define TIMRG_HALT_TIMR3_Pos 3 +#define TIMRG_HALT_TIMR3_Msk (0x01 << TIMRG_HALT_TIMR3_Pos) +#define TIMRG_HALT_TIMR4_Pos 4 +#define TIMRG_HALT_TIMR4_Msk (0x01 << TIMRG_HALT_TIMR4_Pos) +#define TIMRG_HALT_TIMR5_Pos 5 +#define TIMRG_HALT_TIMR5_Msk (0x01 << TIMRG_HALT_TIMR5_Pos) - __IO uint32_t CTRL; - __IO uint32_t BAUD; - __IO uint32_t FIFO; - __IO uint32_t LINCR; - - union { - __IO uint32_t CTSCR; - - __IO uint32_t RTSCR; - }; +typedef struct { + __IO uint32_t DATA; + + __IO uint32_t CTRL; + + __IO uint32_t BAUD; + + __IO uint32_t FIFO; + + __IO uint32_t LINCR; + + union { + __IO uint32_t CTSCR; + + __IO uint32_t RTSCR; + }; } UART_TypeDef; -#define UART_DATA_DATA_Pos 0 -#define UART_DATA_DATA_Msk (0x1FF << UART_DATA_DATA_Pos) -#define UART_DATA_VALID_Pos 9 //褰揇ATA瀛楁鏈夋湁鏁堢殑鎺ユ敹鏁版嵁鏃讹紝璇ヤ綅纭欢缃1锛岃鍙栨暟鎹悗鑷姩娓呴浂 -#define UART_DATA_VALID_Msk (0x01 << UART_DATA_VALID_Pos) -#define UART_DATA_PAERR_Pos 10 //Parity Error -#define UART_DATA_PAERR_Msk (0x01 << UART_DATA_PAERR_Pos) -#define UART_CTRL_TXIDLE_Pos 0 //TX IDLE: 0 姝e湪鍙戦佹暟鎹 1 绌洪棽鐘舵侊紝娌℃湁鏁版嵁鍙戦 -#define UART_CTRL_TXIDLE_Msk (0x01 << UART_CTRL_TXIDLE_Pos) -#define UART_CTRL_TXFF_Pos 1 //TX FIFO Full -#define UART_CTRL_TXFF_Msk (0x01 << UART_CTRL_TXFF_Pos) -#define UART_CTRL_TXIE_Pos 2 //TX 涓柇浣胯兘: 1 TX FF 涓暟鎹皯浜庤瀹氫釜鏁版椂浜х敓涓柇 -#define UART_CTRL_TXIE_Msk (0x01 << UART_CTRL_TXIE_Pos) -#define UART_CTRL_RXNE_Pos 3 //RX FIFO Not Empty -#define UART_CTRL_RXNE_Msk (0x01 << UART_CTRL_RXNE_Pos) -#define UART_CTRL_RXIE_Pos 4 //RX 涓柇浣胯兘: 1 RX FF 涓暟鎹揪鍒拌瀹氫釜鏁版椂浜х敓涓柇 -#define UART_CTRL_RXIE_Msk (0x01 << UART_CTRL_RXIE_Pos) -#define UART_CTRL_RXOV_Pos 5 //RX FIFO Overflow锛屽啓1娓呴浂 -#define UART_CTRL_RXOV_Msk (0x01 << UART_CTRL_RXOV_Pos) -#define UART_CTRL_TXDOIE_Pos 6 //TX Done 涓柇浣胯兘锛屽彂閫丗IFO绌轰笖鍙戦佸彂閫佺Щ浣嶅瘎瀛樺櫒宸插皢鏈鍚庝竴浣嶅彂閫佸嚭鍘 -#define UART_CTRL_TXDOIE_Msk (0x01 << UART_CTRL_TXDOIE_Pos) -#define UART_CTRL_EN_Pos 9 -#define UART_CTRL_EN_Msk (0x01 << UART_CTRL_EN_Pos) -#define UART_CTRL_LOOP_Pos 10 -#define UART_CTRL_LOOP_Msk (0x01 << UART_CTRL_LOOP_Pos) -#define UART_CTRL_BAUDEN_Pos 13 //蹇呴』鍐1 -#define UART_CTRL_BAUDEN_Msk (0x01 << UART_CTRL_BAUDEN_Pos) -#define UART_CTRL_TOIE_Pos 14 //TimeOut 涓柇浣胯兘锛屾帴鏀跺埌涓婁釜瀛楃鍚庯紝瓒呰繃 TOTIME/BAUDRAUD 绉掓病鏈夋帴鏀跺埌鏂扮殑鏁版嵁 -#define UART_CTRL_TOIE_Msk (0x01 << UART_CTRL_TOIE_Pos) -#define UART_CTRL_BRKDET_Pos 15 //LIN Break Detect锛屾娴嬪埌LIN Break锛屽嵆RX绾夸笂妫娴嬪埌杩炵画11浣嶄綆鐢靛钩 -#define UART_CTRL_BRKDET_Msk (0x01 << UART_CTRL_BRKDET_Pos) -#define UART_CTRL_BRKIE_Pos 16 //LIN Break Detect 涓柇浣胯兘 -#define UART_CTRL_BRKIE_Msk (0x01 << UART_CTRL_BRKIE_Pos) -#define UART_CTRL_GENBRK_Pos 17 //Generate LIN Break锛屽彂閫丩IN Break -#define UART_CTRL_GENBRK_Msk (0x01 << UART_CTRL_GENBRK_Pos) -#define UART_CTRL_DATA9b_Pos 18 //1 9浣嶆暟鎹綅 0 8浣嶆暟鎹綅 -#define UART_CTRL_DATA9b_Msk (0x01 << UART_CTRL_DATA9b_Pos) -#define UART_CTRL_PARITY_Pos 19 //000 鏃犳牎楠 001 濂囨牎楠 011 鍋舵牎楠 101 鍥哄畾涓1 111 鍥哄畾涓0 -#define UART_CTRL_PARITY_Msk (0x07 << UART_CTRL_PARITY_Pos) -#define UART_CTRL_STOP2b_Pos 22 //1 2浣嶅仠姝綅 0 1浣嶅仠姝綅 -#define UART_CTRL_STOP2b_Msk (0x03 << UART_CTRL_STOP2b_Pos) -#define UART_CTRL_TOTIME_Pos 24 //TimeOut 鏃堕暱 = TOTIME/(BAUDRAUD/10) 绉 -#define UART_CTRL_TOTIME_Msk (0xFFu << UART_CTRL_TOTIME_Pos) +#define UART_DATA_DATA_Pos 0 +#define UART_DATA_DATA_Msk (0x1FF << UART_DATA_DATA_Pos) +#define UART_DATA_VALID_Pos 9 //当DATA字段有有效的接收数据时,该位硬件置1,读取数据后自动清零 +#define UART_DATA_VALID_Msk (0x01 << UART_DATA_VALID_Pos) +#define UART_DATA_PAERR_Pos 10 //Parity Error +#define UART_DATA_PAERR_Msk (0x01 << UART_DATA_PAERR_Pos) -#define UART_BAUD_BAUD_Pos 0 //涓插彛娉㈢壒鐜 = SYS_Freq/16/BAUD - 1 -#define UART_BAUD_BAUD_Msk (0x3FFF << UART_BAUD_BAUD_Pos) -#define UART_BAUD_TXD_Pos 14 //閫氳繃姝や綅鍙洿鎺ヨ鍙栦覆鍙XD寮曡剼涓婄殑鐢靛钩 -#define UART_BAUD_TXD_Msk (0x01 << UART_BAUD_TXD_Pos) -#define UART_BAUD_RXD_Pos 15 //閫氳繃姝や綅鍙洿鎺ヨ鍙栦覆鍙XD寮曡剼涓婄殑鐢靛钩 -#define UART_BAUD_RXD_Msk (0x01 << UART_BAUD_RXD_Pos) -#define UART_BAUD_RXTOIF_Pos 16 //鎺ユ敹&瓒呮椂鐨勪腑鏂爣蹇 = RXIF | TOIF -#define UART_BAUD_RXTOIF_Msk (0x01 << UART_BAUD_RXTOIF_Pos) -#define UART_BAUD_TXIF_Pos 17 //鍙戦佷腑鏂爣蹇 = TXTHRF & TXIE -#define UART_BAUD_TXIF_Msk (0x01 << UART_BAUD_TXIF_Pos) -#define UART_BAUD_BRKIF_Pos 18 //LIN Break Detect 涓柇鏍囧織锛屾娴嬪埌LIN Break鏃惰嫢BRKIE=1锛屾浣嶇敱纭欢缃綅 -#define UART_BAUD_BRKIF_Msk (0x01 << UART_BAUD_BRKIF_Pos) -#define UART_BAUD_RXTHRF_Pos 19 //RX FIFO Threshold Flag锛孯X FIFO涓暟鎹揪鍒拌瀹氫釜鏁帮紙RXLVL >= RXTHR锛夋椂纭欢缃1 -#define UART_BAUD_RXTHRF_Msk (0x01 << UART_BAUD_RXTHRF_Pos) -#define UART_BAUD_TXTHRF_Pos 20 //TX FIFO Threshold Flag锛孴X FIFO涓暟鎹皯浜庤瀹氫釜鏁帮紙TXLVL <= TXTHR锛夋椂纭欢缃1 -#define UART_BAUD_TXTHRF_Msk (0x01 << UART_BAUD_TXTHRF_Pos) -#define UART_BAUD_TOIF_Pos 21 //TimeOut 涓柇鏍囧織锛岃秴杩 TOTIME/BAUDRAUD 绉掓病鏈夋帴鏀跺埌鏂扮殑鏁版嵁鏃惰嫢TOIE=1锛屾浣嶇敱纭欢缃綅 -#define UART_BAUD_TOIF_Msk (0x01 << UART_BAUD_TOIF_Pos) -#define UART_BAUD_RXIF_Pos 22 //鎺ユ敹涓柇鏍囧織 = RXTHRF & RXIE -#define UART_BAUD_RXIF_Msk (0x01 << UART_BAUD_RXIF_Pos) -#define UART_BAUD_ABREN_Pos 23 //Auto Baudrate Enable锛屽啓1鍚姩鑷姩娉㈢壒鐜囨牎鍑嗭紝瀹屾垚鍚庤嚜鍔ㄦ竻闆 -#define UART_BAUD_ABREN_Msk (0x01 << UART_BAUD_ABREN_Pos) -#define UART_BAUD_ABRBIT_Pos 24 //Auto Baudrate Bit锛岀敤浜庤绠楁尝鐗圭巼鐨勬娴嬩綅闀匡紝0 1浣嶏紝閫氳繃娴嬭捣濮嬩綅 鑴夊璁$畻娉㈢壒鐜囷紝瑕佹眰鍙戦佺鍙戦0xFF \ - // 1 2浣嶏紝閫氳繃娴嬭捣濮嬩綅鍔1浣嶆暟鎹綅鑴夊璁$畻娉㈢壒鐜囷紝瑕佹眰鍙戦佺鍙戦0xFE \ - // 1 4浣嶏紝閫氳繃娴嬭捣濮嬩綅鍔3浣嶆暟鎹綅鑴夊璁$畻娉㈢壒鐜囷紝瑕佹眰鍙戦佺鍙戦0xF8 \ - // 1 8浣嶏紝閫氳繃娴嬭捣濮嬩綅鍔7浣嶆暟鎹綅鑴夊璁$畻娉㈢壒鐜囷紝瑕佹眰鍙戦佺鍙戦0x80 -#define UART_BAUD_ABRBIT_Msk (0x03 << UART_BAUD_ABRBIT_Pos) -#define UART_BAUD_ABRERR_Pos 26 //Auto Baudrate Error锛0 鑷姩娉㈢壒鐜囨牎鍑嗘垚鍔 1 鑷姩娉㈢壒鐜囨牎鍑嗗け璐 -#define UART_BAUD_ABRERR_Msk (0x01 << UART_BAUD_ABRERR_Pos) -#define UART_BAUD_TXDOIF_Pos 27 //TX Done 涓柇鏍囧織锛屽彂閫丗IFO绌轰笖鍙戦佸彂閫佺Щ浣嶅瘎瀛樺櫒宸插皢鏈鍚庝竴浣嶅彂閫佸嚭鍘 -#define UART_BAUD_TXDOIF_Msk (0x01 << UART_BAUD_TXDOIF_Pos) +#define UART_CTRL_TXIDLE_Pos 0 //TX IDLE: 0 正在发送数据 1 空闲状态,没有数据发送 +#define UART_CTRL_TXIDLE_Msk (0x01 << UART_CTRL_TXIDLE_Pos) +#define UART_CTRL_TXFF_Pos 1 //TX FIFO Full +#define UART_CTRL_TXFF_Msk (0x01 << UART_CTRL_TXFF_Pos) +#define UART_CTRL_TXIE_Pos 2 //TX 中断使能: 1 TX FF 中数据少于设定个数时产生中断 +#define UART_CTRL_TXIE_Msk (0x01 << UART_CTRL_TXIE_Pos) +#define UART_CTRL_RXNE_Pos 3 //RX FIFO Not Empty +#define UART_CTRL_RXNE_Msk (0x01 << UART_CTRL_RXNE_Pos) +#define UART_CTRL_RXIE_Pos 4 //RX 中断使能: 1 RX FF 中数据达到设定个数时产生中断 +#define UART_CTRL_RXIE_Msk (0x01 << UART_CTRL_RXIE_Pos) +#define UART_CTRL_RXOV_Pos 5 //RX FIFO Overflow,写1清零 +#define UART_CTRL_RXOV_Msk (0x01 << UART_CTRL_RXOV_Pos) +#define UART_CTRL_TXDOIE_Pos 6 //TX Done 中断使能,发送FIFO空且发送发送移位寄存器已将最后一位发送出去 +#define UART_CTRL_TXDOIE_Msk (0x01 << UART_CTRL_TXDOIE_Pos) +#define UART_CTRL_EN_Pos 9 +#define UART_CTRL_EN_Msk (0x01 << UART_CTRL_EN_Pos) +#define UART_CTRL_LOOP_Pos 10 +#define UART_CTRL_LOOP_Msk (0x01 << UART_CTRL_LOOP_Pos) +#define UART_CTRL_BAUDEN_Pos 13 //必须写1 +#define UART_CTRL_BAUDEN_Msk (0x01 << UART_CTRL_BAUDEN_Pos) +#define UART_CTRL_TOIE_Pos 14 //TimeOut 中断使能,接收到上个字符后,超过 TOTIME/BAUDRAUD 秒没有接收到新的数据 +#define UART_CTRL_TOIE_Msk (0x01 << UART_CTRL_TOIE_Pos) +#define UART_CTRL_BRKDET_Pos 15 //LIN Break Detect,检测到LIN Break,即RX线上检测到连续11位低电平 +#define UART_CTRL_BRKDET_Msk (0x01 << UART_CTRL_BRKDET_Pos) +#define UART_CTRL_BRKIE_Pos 16 //LIN Break Detect 中断使能 +#define UART_CTRL_BRKIE_Msk (0x01 << UART_CTRL_BRKIE_Pos) +#define UART_CTRL_GENBRK_Pos 17 //Generate LIN Break,发送LIN Break +#define UART_CTRL_GENBRK_Msk (0x01 << UART_CTRL_GENBRK_Pos) +#define UART_CTRL_DATA9b_Pos 18 //1 9位数据位 0 8位数据位 +#define UART_CTRL_DATA9b_Msk (0x01 << UART_CTRL_DATA9b_Pos) +#define UART_CTRL_PARITY_Pos 19 //000 无校验 001 奇校验 011 偶校验 101 固定为1 111 固定为0 +#define UART_CTRL_PARITY_Msk (0x07 << UART_CTRL_PARITY_Pos) +#define UART_CTRL_STOP2b_Pos 22 //1 2位停止位 0 1位停止位 +#define UART_CTRL_STOP2b_Msk (0x03 << UART_CTRL_STOP2b_Pos) +#define UART_CTRL_TOTIME_Pos 24 //TimeOut 时长 = TOTIME/(BAUDRAUD/10) 秒 +#define UART_CTRL_TOTIME_Msk (0xFFu<< UART_CTRL_TOTIME_Pos) -#define UART_FIFO_RXLVL_Pos 0 //RX FIFO Level锛孯X FIFO 涓瓧绗︿釜鏁 -#define UART_FIFO_RXLVL_Msk (0xFF << UART_FIFO_RXLVL_Pos) -#define UART_FIFO_TXLVL_Pos 8 //TX FIFO Level锛孴X FIFO 涓瓧绗︿釜鏁 -#define UART_FIFO_TXLVL_Msk (0xFF << UART_FIFO_TXLVL_Pos) -#define UART_FIFO_RXTHR_Pos 16 //RX FIFO Threshold锛孯X涓柇瑙﹀彂闂ㄩ檺锛屼腑鏂娇鑳芥椂 RXLVL >= RXTHR 瑙﹀彂RX涓柇 -#define UART_FIFO_RXTHR_Msk (0xFF << UART_FIFO_RXTHR_Pos) -#define UART_FIFO_TXTHR_Pos 24 //TX FIFO Threshold锛孴X涓柇瑙﹀彂闂ㄩ檺锛屼腑鏂娇鑳芥椂 TXLVL <= TXTHR 瑙﹀彂TX涓柇 -#define UART_FIFO_TXTHR_Msk (0xFFu << UART_FIFO_TXTHR_Pos) +#define UART_BAUD_BAUD_Pos 0 //串口波特率 = SYS_Freq/16/BAUD - 1 +#define UART_BAUD_BAUD_Msk (0x3FFF << UART_BAUD_BAUD_Pos) +#define UART_BAUD_TXD_Pos 14 //通过此位可直接读取串口TXD引脚上的电平 +#define UART_BAUD_TXD_Msk (0x01 << UART_BAUD_TXD_Pos) +#define UART_BAUD_RXD_Pos 15 //通过此位可直接读取串口RXD引脚上的电平 +#define UART_BAUD_RXD_Msk (0x01 << UART_BAUD_RXD_Pos) +#define UART_BAUD_RXTOIF_Pos 16 //接收&超时的中断标志 = RXIF | TOIF +#define UART_BAUD_RXTOIF_Msk (0x01 << UART_BAUD_RXTOIF_Pos) +#define UART_BAUD_TXIF_Pos 17 //发送中断标志 = TXTHRF & TXIE +#define UART_BAUD_TXIF_Msk (0x01 << UART_BAUD_TXIF_Pos) +#define UART_BAUD_BRKIF_Pos 18 //LIN Break Detect 中断标志,检测到LIN Break时若BRKIE=1,此位由硬件置位 +#define UART_BAUD_BRKIF_Msk (0x01 << UART_BAUD_BRKIF_Pos) +#define UART_BAUD_RXTHRF_Pos 19 //RX FIFO Threshold Flag,RX FIFO中数据达到设定个数(RXLVL >= RXTHR)时硬件置1 +#define UART_BAUD_RXTHRF_Msk (0x01 << UART_BAUD_RXTHRF_Pos) +#define UART_BAUD_TXTHRF_Pos 20 //TX FIFO Threshold Flag,TX FIFO中数据少于设定个数(TXLVL <= TXTHR)时硬件置1 +#define UART_BAUD_TXTHRF_Msk (0x01 << UART_BAUD_TXTHRF_Pos) +#define UART_BAUD_TOIF_Pos 21 //TimeOut 中断标志,超过 TOTIME/BAUDRAUD 秒没有接收到新的数据时若TOIE=1,此位由硬件置位 +#define UART_BAUD_TOIF_Msk (0x01 << UART_BAUD_TOIF_Pos) +#define UART_BAUD_RXIF_Pos 22 //接收中断标志 = RXTHRF & RXIE +#define UART_BAUD_RXIF_Msk (0x01 << UART_BAUD_RXIF_Pos) +#define UART_BAUD_ABREN_Pos 23 //Auto Baudrate Enable,写1启动自动波特率校准,完成后自动清零 +#define UART_BAUD_ABREN_Msk (0x01 << UART_BAUD_ABREN_Pos) +#define UART_BAUD_ABRBIT_Pos 24 //Auto Baudrate Bit,用于计算波特率的检测位长,0 1位,通过测起始位 脉宽计算波特率,要求发送端发送0xFF + // 1 2位,通过测起始位加1位数据位脉宽计算波特率,要求发送端发送0xFE + // 1 4位,通过测起始位加3位数据位脉宽计算波特率,要求发送端发送0xF8 + // 1 8位,通过测起始位加7位数据位脉宽计算波特率,要求发送端发送0x80 +#define UART_BAUD_ABRBIT_Msk (0x03 << UART_BAUD_ABRBIT_Pos) +#define UART_BAUD_ABRERR_Pos 26 //Auto Baudrate Error,0 自动波特率校准成功 1 自动波特率校准失败 +#define UART_BAUD_ABRERR_Msk (0x01 << UART_BAUD_ABRERR_Pos) +#define UART_BAUD_TXDOIF_Pos 27 //TX Done 中断标志,发送FIFO空且发送发送移位寄存器已将最后一位发送出去 +#define UART_BAUD_TXDOIF_Msk (0x01 << UART_BAUD_TXDOIF_Pos) -#define UART_LINCR_BRKDETIE_Pos 0 //妫娴嬪埌LIN Break涓柇浣胯兘 -#define UART_LINCR_BRKDETIE_Msk (0x01 << UART_LINCR_BRKDETIE_Pos) -#define UART_LINCR_BRKDETIF_Pos 1 //妫娴嬪埌LIN Break涓柇鐘舵 -#define UART_LINCR_BRKDETIF_Msk (0x01 << UART_LINCR_BRKDETIF_Pos) -#define UART_LINCR_GENBRKIE_Pos 2 //鍙戦丩IN Break瀹屾垚涓柇浣胯兘 -#define UART_LINCR_GENBRKIE_Msk (0x01 << UART_LINCR_GENBRKIE_Pos) -#define UART_LINCR_GENBRKIF_Pos 3 //鍙戦丩IN Break瀹屾垚涓柇鐘舵 -#define UART_LINCR_GENBRKIF_Msk (0x01 << UART_LINCR_GENBRKIF_Pos) -#define UART_LINCR_GENBRK_Pos 4 //鍙戦丩IN Break锛屽彂閫佸畬鎴愯嚜鍔ㄦ竻闆 -#define UART_LINCR_GENBRK_Msk (0x01 << UART_LINCR_GENBRK_Pos) +#define UART_FIFO_RXLVL_Pos 0 //RX FIFO Level,RX FIFO 中字符个数 +#define UART_FIFO_RXLVL_Msk (0xFF << UART_FIFO_RXLVL_Pos) +#define UART_FIFO_TXLVL_Pos 8 //TX FIFO Level,TX FIFO 中字符个数 +#define UART_FIFO_TXLVL_Msk (0xFF << UART_FIFO_TXLVL_Pos) +#define UART_FIFO_RXTHR_Pos 16 //RX FIFO Threshold,RX中断触发门限,中断使能时 RXLVL >= RXTHR 触发RX中断 +#define UART_FIFO_RXTHR_Msk (0xFF << UART_FIFO_RXTHR_Pos) +#define UART_FIFO_TXTHR_Pos 24 //TX FIFO Threshold,TX中断触发门限,中断使能时 TXLVL <= TXTHR 触发TX中断 +#define UART_FIFO_TXTHR_Msk (0xFFu<< UART_FIFO_TXTHR_Pos) -#define UART_CTSCR_EN_Pos 0 //CTS娴佹帶浣胯兘 -#define UART_CTSCR_EN_Msk (0x01 << UART_CTSCR_EN_Pos) -#define UART_CTSCR_POL_Pos 2 //CTS淇″彿鏋佹э紝0 浣庢湁鏁堬紝CTS杈撳叆涓轰綆琛ㄧず鍙互鍙戦佹暟鎹 -#define UART_CTSCR_POL_Msk (0x01 << UART_CTSCR_POL_Pos) -#define UART_CTSCR_STAT_Pos 7 //CTS淇″彿鐨勫綋鍓嶇姸鎬 -#define UART_CTSCR_STAT_Msk (0x01 << UART_CTSCR_STAT_Pos) +#define UART_LINCR_BRKDETIE_Pos 0 //检测到LIN Break中断使能 +#define UART_LINCR_BRKDETIE_Msk (0x01 << UART_LINCR_BRKDETIE_Pos) +#define UART_LINCR_BRKDETIF_Pos 1 //检测到LIN Break中断状态 +#define UART_LINCR_BRKDETIF_Msk (0x01 << UART_LINCR_BRKDETIF_Pos) +#define UART_LINCR_GENBRKIE_Pos 2 //发送LIN Break完成中断使能 +#define UART_LINCR_GENBRKIE_Msk (0x01 << UART_LINCR_GENBRKIE_Pos) +#define UART_LINCR_GENBRKIF_Pos 3 //发送LIN Break完成中断状态 +#define UART_LINCR_GENBRKIF_Msk (0x01 << UART_LINCR_GENBRKIF_Pos) +#define UART_LINCR_GENBRK_Pos 4 //发送LIN Break,发送完成自动清零 +#define UART_LINCR_GENBRK_Msk (0x01 << UART_LINCR_GENBRK_Pos) -#define UART_RTSCR_EN_Pos 1 //RTS娴佹帶浣胯兘 -#define UART_RTSCR_EN_Msk (0x01 << UART_RTSCR_EN_Pos) -#define UART_RTSCR_POL_Pos 3 //RTS淇″彿鏋佹 0 浣庢湁鏁堬紝RTS杈撳叆涓轰綆琛ㄧず鍙互鎺ユ敹鏁版嵁 -#define UART_RTSCR_POL_Msk (0x01 << UART_RTSCR_POL_Pos) -#define UART_RTSCR_THR_Pos 4 //RTS娴佹帶鐨勮Е鍙戦槇鍊 0 1瀛楄妭 1 2瀛楄妭 2 4瀛楄妭 3 6瀛楄妭 -#define UART_RTSCR_THR_Msk (0x07 << UART_RTSCR_THR_Pos) -#define UART_RTSCR_STAT_Pos 8 //RTS淇″彿鐨勫綋鍓嶇姸鎬 -#define UART_RTSCR_STAT_Msk (0x01 << UART_RTSCR_STAT_Pos) +#define UART_CTSCR_EN_Pos 0 //CTS流控使能 +#define UART_CTSCR_EN_Msk (0x01 << UART_CTSCR_EN_Pos) +#define UART_CTSCR_POL_Pos 2 //CTS信号极性,0 低有效,CTS输入为低表示可以发送数据 +#define UART_CTSCR_POL_Msk (0x01 << UART_CTSCR_POL_Pos) +#define UART_CTSCR_STAT_Pos 7 //CTS信号的当前状态 +#define UART_CTSCR_STAT_Msk (0x01 << UART_CTSCR_STAT_Pos) -typedef struct -{ - __IO uint32_t CTRL; +#define UART_RTSCR_EN_Pos 1 //RTS流控使能 +#define UART_RTSCR_EN_Msk (0x01 << UART_RTSCR_EN_Pos) +#define UART_RTSCR_POL_Pos 3 //RTS信号极性 0 低有效,RTS输入为低表示可以接收数据 +#define UART_RTSCR_POL_Msk (0x01 << UART_RTSCR_POL_Pos) +#define UART_RTSCR_THR_Pos 4 //RTS流控的触发阈值 0 1字节 1 2字节 2 4字节 3 6字节 +#define UART_RTSCR_THR_Msk (0x07 << UART_RTSCR_THR_Pos) +#define UART_RTSCR_STAT_Pos 8 //RTS信号的当前状态 +#define UART_RTSCR_STAT_Msk (0x01 << UART_RTSCR_STAT_Pos) - __IO uint32_t DATA; - __IO uint32_t STAT; - __IO uint32_t IE; - __IO uint32_t IF; +typedef struct { + __IO uint32_t CTRL; + + __IO uint32_t DATA; + + __IO uint32_t STAT; + + __IO uint32_t IE; + + __IO uint32_t IF; } SPI_TypeDef; -#define SPI_CTRL_CLKDIV_Pos 0 //Clock Divider, SPI宸ヤ綔鏃堕挓 = SYS_Freq/pow(2, CLKDIV+2) -#define SPI_CTRL_CLKDIV_Msk (0x07 << SPI_CTRL_CLKDIV_Pos) -#define SPI_CTRL_EN_Pos 3 -#define SPI_CTRL_EN_Msk (0x01 << SPI_CTRL_EN_Pos) -#define SPI_CTRL_SIZE_Pos 4 //Data Size Select, 鍙栧3--15锛岃〃绀4--16浣 -#define SPI_CTRL_SIZE_Msk (0x0F << SPI_CTRL_SIZE_Pos) -#define SPI_CTRL_CPHA_Pos 8 //0 鍦⊿CLK鐨勭涓涓烦鍙樻部閲囨牱鏁版嵁 1 鍦⊿CLK鐨勭浜屼釜璺冲彉娌块噰鏍锋暟鎹 -#define SPI_CTRL_CPHA_Msk (0x01 << SPI_CTRL_CPHA_Pos) -#define SPI_CTRL_CPOL_Pos 9 //0 绌洪棽鐘舵佷笅SCLK涓轰綆鐢靛钩 1 绌洪棽鐘舵佷笅SCLK涓洪珮鐢靛钩 -#define SPI_CTRL_CPOL_Msk (0x01 << SPI_CTRL_CPOL_Pos) -#define SPI_CTRL_FFS_Pos 10 //Frame Format Select, 0 SPI 1 TI SSI 2 SPI 3 SPI -#define SPI_CTRL_FFS_Msk (0x03 << SPI_CTRL_FFS_Pos) -#define SPI_CTRL_MSTR_Pos 12 //Master, 1 涓绘ā寮 0 浠庢ā寮 -#define SPI_CTRL_MSTR_Msk (0x01 << SPI_CTRL_MSTR_Pos) -#define SPI_CTRL_FAST_Pos 13 //1 SPI宸ヤ綔鏃堕挓 = SYS_Freq/2 0 SPI宸ヤ綔鏃堕挓鐢盨PI->CTRL.CLKDIV璁剧疆 -#define SPI_CTRL_FAST_Msk (0x01 << SPI_CTRL_FAST_Pos) -#define SPI_CTRL_FILTE_Pos 16 //1 瀵筍PI杈撳叆淇″彿杩涜鍘绘姈鎿嶄綔 0 瀵筍PI杈撳叆淇″彿涓嶈繘琛屽幓鎶栨搷浣 -#define SPI_CTRL_FILTE_Msk (0x01 << SPI_CTRL_FILTE_Pos) -#define SPI_CTRL_SSN_H_Pos 17 //0 浼犺緭杩囩▼涓璖SN濮嬬粓涓0 1 浼犺緭杩囩▼涓瘡瀛楃涔嬮棿浼氬皢SSN鎷夐珮鍗婁釜SCLK鍛ㄦ湡 -#define SPI_CTRL_SSN_H_Msk (0x01 << SPI_CTRL_SSN_H_Pos) -#define SPI_CTRL_TFCLR_Pos 24 //TX FIFO Clear -#define SPI_CTRL_TFCLR_Msk (0x01 << SPI_CTRL_TFCLR_Pos) -#define SPI_CTRL_RFCLR_Pos 25 //RX FIFO Clear -#define SPI_CTRL_RFCLR_Msk (0x01 << SPI_CTRL_RFCLR_Pos) -#define SPI_STAT_WTC_Pos 0 //Word Transmit Complete锛屾瘡浼犺緭瀹屾垚涓涓暟鎹瓧鐢辩‖浠剁疆1锛岃蒋浠跺啓1娓呴浂 -#define SPI_STAT_WTC_Msk (0x01 << SPI_STAT_WTC_Pos) -#define SPI_STAT_TFE_Pos 1 //鍙戦丗IFO Empty -#define SPI_STAT_TFE_Msk (0x01 << SPI_STAT_TFE_Pos) -#define SPI_STAT_TFNF_Pos 2 //鍙戦丗IFO Not Full -#define SPI_STAT_TFNF_Msk (0x01 << SPI_STAT_TFNF_Pos) -#define SPI_STAT_RFNE_Pos 3 //鎺ユ敹FIFO Not Empty -#define SPI_STAT_RFNE_Msk (0x01 << SPI_STAT_RFNE_Pos) -#define SPI_STAT_RFF_Pos 4 //鎺ユ敹FIFO Full -#define SPI_STAT_RFF_Msk (0x01 << SPI_STAT_RFF_Pos) -#define SPI_STAT_RFOVF_Pos 5 //鎺ユ敹FIFO Overflow -#define SPI_STAT_RFOVF_Msk (0x01 << SPI_STAT_RFOVF_Pos) -#define SPI_STAT_TFLVL_Pos 6 //鍙戦丗IFO涓暟鎹釜鏁帮紝 0 TFNF=0鏃惰〃绀篎IFO鍐呮湁8涓暟鎹紝TFNF=1鏃惰〃绀篎IFO鍐呮湁0涓暟鎹 1--7 FIFO鍐呮湁1--7涓暟鎹 -#define SPI_STAT_TFLVL_Msk (0x07 << SPI_STAT_TFLVL_Pos) -#define SPI_STAT_RFLVL_Pos 9 //鎺ユ敹FIFO涓暟鎹釜鏁帮紝 0 RFF=1鏃惰〃绀篎IFO鍐呮湁8涓暟鎹紝 RFF=0鏃惰〃绀篎IFO鍐呮湁0涓暟鎹 1--7 FIFO鍐呮湁1--7涓暟鎹 -#define SPI_STAT_RFLVL_Msk (0x07 << SPI_STAT_RFLVL_Pos) -#define SPI_STAT_BUSY_Pos 15 -#define SPI_STAT_BUSY_Msk (0x01 << SPI_STAT_BUSY_Pos) +#define SPI_CTRL_CLKDIV_Pos 0 //Clock Divider, SPI工作时钟 = SYS_Freq/pow(2, CLKDIV+2) +#define SPI_CTRL_CLKDIV_Msk (0x07 << SPI_CTRL_CLKDIV_Pos) +#define SPI_CTRL_EN_Pos 3 +#define SPI_CTRL_EN_Msk (0x01 << SPI_CTRL_EN_Pos) +#define SPI_CTRL_SIZE_Pos 4 //Data Size Select, 取值3--15,表示4--16位 +#define SPI_CTRL_SIZE_Msk (0x0F << SPI_CTRL_SIZE_Pos) +#define SPI_CTRL_CPHA_Pos 8 //0 在SCLK的第一个跳变沿采样数据 1 在SCLK的第二个跳变沿采样数据 +#define SPI_CTRL_CPHA_Msk (0x01 << SPI_CTRL_CPHA_Pos) +#define SPI_CTRL_CPOL_Pos 9 //0 空闲状态下SCLK为低电平 1 空闲状态下SCLK为高电平 +#define SPI_CTRL_CPOL_Msk (0x01 << SPI_CTRL_CPOL_Pos) +#define SPI_CTRL_FFS_Pos 10 //Frame Format Select, 0 SPI 1 TI SSI 2 SPI 3 SPI +#define SPI_CTRL_FFS_Msk (0x03 << SPI_CTRL_FFS_Pos) +#define SPI_CTRL_MSTR_Pos 12 //Master, 1 主模式 0 从模式 +#define SPI_CTRL_MSTR_Msk (0x01 << SPI_CTRL_MSTR_Pos) +#define SPI_CTRL_FAST_Pos 13 //1 SPI工作时钟 = SYS_Freq/2 0 SPI工作时钟由SPI->CTRL.CLKDIV设置 +#define SPI_CTRL_FAST_Msk (0x01 << SPI_CTRL_FAST_Pos) +#define SPI_CTRL_FILTE_Pos 16 //1 对SPI输入信号进行去抖操作 0 对SPI输入信号不进行去抖操作 +#define SPI_CTRL_FILTE_Msk (0x01 << SPI_CTRL_FILTE_Pos) +#define SPI_CTRL_SSN_H_Pos 17 //0 传输过程中SSN始终为0 1 传输过程中每字符之间会将SSN拉高半个SCLK周期 +#define SPI_CTRL_SSN_H_Msk (0x01 << SPI_CTRL_SSN_H_Pos) +#define SPI_CTRL_TFCLR_Pos 24 //TX FIFO Clear +#define SPI_CTRL_TFCLR_Msk (0x01 << SPI_CTRL_TFCLR_Pos) +#define SPI_CTRL_RFCLR_Pos 25 //RX FIFO Clear +#define SPI_CTRL_RFCLR_Msk (0x01 << SPI_CTRL_RFCLR_Pos) -#define SPI_IE_RFOVF_Pos 0 -#define SPI_IE_RFOVF_Msk (0x01 << SPI_IE_RFOVF_Pos) -#define SPI_IE_RFF_Pos 1 -#define SPI_IE_RFF_Msk (0x01 << SPI_IE_RFF_Pos) -#define SPI_IE_RFHF_Pos 2 -#define SPI_IE_RFHF_Msk (0x01 << SPI_IE_RFHF_Pos) -#define SPI_IE_TFE_Pos 3 -#define SPI_IE_TFE_Msk (0x01 << SPI_IE_TFE_Pos) -#define SPI_IE_TFHF_Pos 4 -#define SPI_IE_TFHF_Msk (0x01 << SPI_IE_TFHF_Pos) -#define SPI_IE_WTC_Pos 8 //Word Transmit Complete -#define SPI_IE_WTC_Msk (0x01 << SPI_IE_WTC_Pos) -#define SPI_IE_FTC_Pos 9 //Frame Transmit Complete -#define SPI_IE_FTC_Msk (0x01 << SPI_IE_FTC_Pos) +#define SPI_STAT_WTC_Pos 0 //Word Transmit Complete,每传输完成一个数据字由硬件置1,软件写1清零 +#define SPI_STAT_WTC_Msk (0x01 << SPI_STAT_WTC_Pos) +#define SPI_STAT_TFE_Pos 1 //发送FIFO Empty +#define SPI_STAT_TFE_Msk (0x01 << SPI_STAT_TFE_Pos) +#define SPI_STAT_TFNF_Pos 2 //发送FIFO Not Full +#define SPI_STAT_TFNF_Msk (0x01 << SPI_STAT_TFNF_Pos) +#define SPI_STAT_RFNE_Pos 3 //接收FIFO Not Empty +#define SPI_STAT_RFNE_Msk (0x01 << SPI_STAT_RFNE_Pos) +#define SPI_STAT_RFF_Pos 4 //接收FIFO Full +#define SPI_STAT_RFF_Msk (0x01 << SPI_STAT_RFF_Pos) +#define SPI_STAT_RFOVF_Pos 5 //接收FIFO Overflow +#define SPI_STAT_RFOVF_Msk (0x01 << SPI_STAT_RFOVF_Pos) +#define SPI_STAT_TFLVL_Pos 6 //发送FIFO中数据个数, 0 TFNF=0时表示FIFO内有8个数据,TFNF=1时表示FIFO内有0个数据 1--7 FIFO内有1--7个数据 +#define SPI_STAT_TFLVL_Msk (0x07 << SPI_STAT_TFLVL_Pos) +#define SPI_STAT_RFLVL_Pos 9 //接收FIFO中数据个数, 0 RFF=1时表示FIFO内有8个数据, RFF=0时表示FIFO内有0个数据 1--7 FIFO内有1--7个数据 +#define SPI_STAT_RFLVL_Msk (0x07 << SPI_STAT_RFLVL_Pos) +#define SPI_STAT_BUSY_Pos 15 +#define SPI_STAT_BUSY_Msk (0x01 << SPI_STAT_BUSY_Pos) -#define SPI_IF_RFOVF_Pos 0 //鍐1娓呴浂 -#define SPI_IF_RFOVF_Msk (0x01 << SPI_IF_RFOVF_Pos) -#define SPI_IF_RFF_Pos 1 -#define SPI_IF_RFF_Msk (0x01 << SPI_IF_RFF_Pos) -#define SPI_IF_RFHF_Pos 2 -#define SPI_IF_RFHF_Msk (0x01 << SPI_IF_RFHF_Pos) -#define SPI_IF_TFE_Pos 3 -#define SPI_IF_TFE_Msk (0x01 << SPI_IF_TFE_Pos) -#define SPI_IF_TFHF_Pos 4 -#define SPI_IF_TFHF_Msk (0x01 << SPI_IF_TFHF_Pos) -#define SPI_IF_WTC_Pos 8 //Word Transmit Complete锛屾瘡浼犺緭瀹屾垚涓涓暟鎹瓧鐢辩‖浠剁疆1 -#define SPI_IF_WTC_Msk (0x01 << SPI_IF_WTC_Pos) -#define SPI_IF_FTC_Pos 9 //Frame Transmit Complete锛學TC缃綅鏃惰嫢TX FIFO鏄┖鐨勶紝鍒橣TC缃綅 -#define SPI_IF_FTC_Msk (0x01 << SPI_IF_FTC_Pos) +#define SPI_IE_RFOVF_Pos 0 +#define SPI_IE_RFOVF_Msk (0x01 << SPI_IE_RFOVF_Pos) +#define SPI_IE_RFF_Pos 1 +#define SPI_IE_RFF_Msk (0x01 << SPI_IE_RFF_Pos) +#define SPI_IE_RFHF_Pos 2 +#define SPI_IE_RFHF_Msk (0x01 << SPI_IE_RFHF_Pos) +#define SPI_IE_TFE_Pos 3 +#define SPI_IE_TFE_Msk (0x01 << SPI_IE_TFE_Pos) +#define SPI_IE_TFHF_Pos 4 +#define SPI_IE_TFHF_Msk (0x01 << SPI_IE_TFHF_Pos) +#define SPI_IE_WTC_Pos 8 //Word Transmit Complete +#define SPI_IE_WTC_Msk (0x01 << SPI_IE_WTC_Pos) +#define SPI_IE_FTC_Pos 9 //Frame Transmit Complete +#define SPI_IE_FTC_Msk (0x01 << SPI_IE_FTC_Pos) -typedef struct -{ - __IO uint32_t CLKDIV; //[15:0] 椤诲皢鍐呴儴宸ヤ綔棰戠巼鍒嗗埌SCL棰戠巼鐨5鍊嶏紝鍗矯LKDIV = SYS_Freq/5/SCL_Freq - 1 +#define SPI_IF_RFOVF_Pos 0 //写1清零 +#define SPI_IF_RFOVF_Msk (0x01 << SPI_IF_RFOVF_Pos) +#define SPI_IF_RFF_Pos 1 +#define SPI_IF_RFF_Msk (0x01 << SPI_IF_RFF_Pos) +#define SPI_IF_RFHF_Pos 2 +#define SPI_IF_RFHF_Msk (0x01 << SPI_IF_RFHF_Pos) +#define SPI_IF_TFE_Pos 3 +#define SPI_IF_TFE_Msk (0x01 << SPI_IF_TFE_Pos) +#define SPI_IF_TFHF_Pos 4 +#define SPI_IF_TFHF_Msk (0x01 << SPI_IF_TFHF_Pos) +#define SPI_IF_WTC_Pos 8 //Word Transmit Complete,每传输完成一个数据字由硬件置1 +#define SPI_IF_WTC_Msk (0x01 << SPI_IF_WTC_Pos) +#define SPI_IF_FTC_Pos 9 //Frame Transmit Complete,WTC置位时若TX FIFO是空的,则FTC置位 +#define SPI_IF_FTC_Msk (0x01 << SPI_IF_FTC_Pos) - __IO uint32_t CTRL; - __IO uint32_t MSTDAT; - __IO uint32_t MSTCMD; - __IO uint32_t SLVCR; +typedef struct { + __IO uint32_t CLKDIV; //[15:0] 须将内部工作频率分到SCL频率的5倍,即CLKDIV = SYS_Freq/5/SCL_Freq - 1 - __IO uint32_t SLVIF; + __IO uint32_t CTRL; - __IO uint32_t SLVTX; + __IO uint32_t MSTDAT; - __IO uint32_t SLVRX; + __IO uint32_t MSTCMD; + + __IO uint32_t SLVCR; + + __IO uint32_t SLVIF; + + __IO uint32_t SLVTX; + + __IO uint32_t SLVRX; } I2C_TypeDef; -#define I2C_CTRL_MSTIE_Pos 6 -#define I2C_CTRL_MSTIE_Msk (0x01 << I2C_CTRL_MSTIE_Pos) -#define I2C_CTRL_EN_Pos 7 -#define I2C_CTRL_EN_Msk (0x01 << I2C_CTRL_EN_Pos) -#define I2C_MSTCMD_IF_Pos 0 //1 鏈夌瓑寰呭鐞嗙殑涓柇锛屽啓1娓呴浂 鏈変袱绉嶆儏鍐典笅姝や綅纭欢缃綅锛1銆佷竴涓瓧鑺備紶杈撳畬鎴 2銆佹荤嚎璁块棶鏉冧涪澶 -#define I2C_MSTCMD_IF_Msk (0x01 << I2C_MSTCMD_IF_Pos) -#define I2C_MSTCMD_TIP_Pos 1 //Transmission In Process -#define I2C_MSTCMD_TIP_Msk (0x01 << I2C_MSTCMD_TIP_Pos) -#define I2C_MSTCMD_ACK_Pos 3 //鎺ユ敹妯″紡涓嬶紝0 鍚戝彂閫佺鍙嶉ACK 1 鍚戝彂閫佺鍙嶉NACK -#define I2C_MSTCMD_ACK_Msk (0x01 << I2C_MSTCMD_ACK_Pos) -#define I2C_MSTCMD_WR_Pos 4 // 鍚慡lave鍐欐暟鎹椂锛屾妸杩欎竴浣嶅啓1锛岃嚜鍔ㄦ竻闆 -#define I2C_MSTCMD_WR_Msk (0x01 << I2C_MSTCMD_WR_Pos) -#define I2C_MSTCMD_RD_Pos 5 //鍐欙細浠嶴lave璇绘暟鎹椂锛屾妸杩欎竴浣嶅啓1锛岃嚜鍔ㄦ竻闆 璇伙細褰揑2C妯″潡澶卞幓鎬荤嚎鐨勮闂潈鏃剁‖浠剁疆1 -#define I2C_MSTCMD_RD_Msk (0x01 << I2C_MSTCMD_RD_Pos) -#define I2C_MSTCMD_BUSY_Pos 6 //璇伙細褰撴娴嬪埌START涔嬪悗锛岃繖涓浣嶅彉1锛涘綋妫娴嬪埌STOP涔嬪悗锛岃繖涓浣嶅彉0 -#define I2C_MSTCMD_BUSY_Msk (0x01 << I2C_MSTCMD_BUSY_Pos) -#define I2C_MSTCMD_STO_Pos 6 //鍐欙細浜х敓STOP锛岃嚜鍔ㄦ竻闆 -#define I2C_MSTCMD_STO_Msk (0x01 << I2C_MSTCMD_STO_Pos) -#define I2C_MSTCMD_RXACK_Pos 7 //璇伙細鎺ユ敹鍒扮殑Slave鐨凙CK浣嶏紝0 鏀跺埌ACK 1 鏀跺埌NACK -#define I2C_MSTCMD_RXACK_Msk (0x01 << I2C_MSTCMD_RXACK_Pos) -#define I2C_MSTCMD_STA_Pos 7 //鍐欙細浜х敓START锛岃嚜鍔ㄦ竻闆 -#define I2C_MSTCMD_STA_Msk (0x01 << I2C_MSTCMD_STA_Pos) +#define I2C_CTRL_MSTIE_Pos 6 +#define I2C_CTRL_MSTIE_Msk (0x01 << I2C_CTRL_MSTIE_Pos) +#define I2C_CTRL_EN_Pos 7 +#define I2C_CTRL_EN_Msk (0x01 << I2C_CTRL_EN_Pos) -#define I2C_SLVCR_IM_RXEND_Pos 0 //鎺ユ敹瀹屾垚涓柇绂佹 -#define I2C_SLVCR_IM_RXEND_Msk (0x01 << I2C_SLVCR_IM_RXEND_Pos) -#define I2C_SLVCR_IM_TXEND_Pos 1 //鍙戦佸畬鎴愪腑鏂姝 -#define I2C_SLVCR_IM_TXEND_Msk (0x01 << I2C_SLVCR_IM_TXEND_Pos) -#define I2C_SLVCR_IM_STADET_Pos 2 //妫娴嬪埌璧峰涓柇绂佹 -#define I2C_SLVCR_IM_STADET_Msk (0x01 << I2C_SLVCR_IM_STADET_Pos) -#define I2C_SLVCR_IM_STODET_Pos 3 //妫娴嬪埌鍋滄涓柇绂佹 -#define I2C_SLVCR_IM_STODET_Msk (0x01 << I2C_SLVCR_IM_STODET_Pos) -#define I2C_SLVCR_IM_RDREQ_Pos 4 //鎺ユ敹鍒拌璇锋眰涓柇绂佹 -#define I2C_SLVCR_IM_RDREQ_Msk (0x01 << I2C_SLVCR_IM_RDREQ_Pos) -#define I2C_SLVCR_IM_WRREQ_Pos 5 //鎺ユ敹鍒板啓璇锋眰涓柇绂佹 -#define I2C_SLVCR_IM_WRREQ_Msk (0x01 << I2C_SLVCR_IM_WRREQ_Pos) -#define I2C_SLVCR_ADDR7b_Pos 16 //1 7浣嶅湴鍧妯″紡 0 10浣嶅湴鍧妯″紡 -#define I2C_SLVCR_ADDR7b_Msk (0x01 << I2C_SLVCR_ADDR7b_Pos) -#define I2C_SLVCR_ACK_Pos 17 //1 搴旂瓟ACK 0 搴旂瓟NACK -#define I2C_SLVCR_ACK_Msk (0x01 << I2C_SLVCR_ACK_Pos) -#define I2C_SLVCR_SLAVE_Pos 18 //1 浠庢満妯″紡 0 涓绘満妯″紡 -#define I2C_SLVCR_SLAVE_Msk (0x01 << I2C_SLVCR_SLAVE_Pos) -#define I2C_SLVCR_DEBOUNCE_Pos 19 //鍘绘姈鍔ㄤ娇鑳 -#define I2C_SLVCR_DEBOUNCE_Msk (0x01 << I2C_SLVCR_DEBOUNCE_Pos) -#define I2C_SLVCR_ADDR_Pos 20 //浠庢満鍦板潃 -#define I2C_SLVCR_ADDR_Msk (0x3FF << I2C_SLVCR_ADDR_Pos) +#define I2C_MSTCMD_IF_Pos 0 //1 有等待处理的中断,写1清零 有两种情况下此位硬件置位:1、一个字节传输完成 2、总线访问权丢失 +#define I2C_MSTCMD_IF_Msk (0x01 << I2C_MSTCMD_IF_Pos) +#define I2C_MSTCMD_TIP_Pos 1 //Transmission In Process +#define I2C_MSTCMD_TIP_Msk (0x01 << I2C_MSTCMD_TIP_Pos) +#define I2C_MSTCMD_ACK_Pos 3 //接收模式下,0 向发送端反馈ACK 1 向发送端反馈NACK +#define I2C_MSTCMD_ACK_Msk (0x01 << I2C_MSTCMD_ACK_Pos) +#define I2C_MSTCMD_WR_Pos 4 // 向Slave写数据时,把这一位写1,自动清零 +#define I2C_MSTCMD_WR_Msk (0x01 << I2C_MSTCMD_WR_Pos) +#define I2C_MSTCMD_RD_Pos 5 //写:从Slave读数据时,把这一位写1,自动清零 读:当I2C模块失去总线的访问权时硬件置1 +#define I2C_MSTCMD_RD_Msk (0x01 << I2C_MSTCMD_RD_Pos) +#define I2C_MSTCMD_BUSY_Pos 6 //读:当检测到START之后,这一位变1;当检测到STOP之后,这一位变0 +#define I2C_MSTCMD_BUSY_Msk (0x01 << I2C_MSTCMD_BUSY_Pos) +#define I2C_MSTCMD_STO_Pos 6 //写:产生STOP,自动清零 +#define I2C_MSTCMD_STO_Msk (0x01 << I2C_MSTCMD_STO_Pos) +#define I2C_MSTCMD_RXACK_Pos 7 //读:接收到的Slave的ACK位,0 收到ACK 1 收到NACK +#define I2C_MSTCMD_RXACK_Msk (0x01 << I2C_MSTCMD_RXACK_Pos) +#define I2C_MSTCMD_STA_Pos 7 //写:产生START,自动清零 +#define I2C_MSTCMD_STA_Msk (0x01 << I2C_MSTCMD_STA_Pos) -#define I2C_SLVIF_RXEND_Pos 0 //鎺ユ敹瀹屾垚涓柇鏍囧織锛屽啓1娓呴浂 -#define I2C_SLVIF_RXEND_Msk (0x01 << I2C_SLVIF_RXEND_Pos) -#define I2C_SLVIF_TXEND_Pos 1 //鍙戦佸畬鎴愪腑鏂爣蹇楋紝鍐1娓呴浂 -#define I2C_SLVIF_TXEND_Msk (0x01 << I2C_SLVIF_TXEND_Pos) -#define I2C_SLVIF_STADET_Pos 2 //妫娴嬪埌璧峰涓柇鏍囧織锛屽啓1娓呴浂 -#define I2C_SLVIF_STADET_Msk (0x01 << I2C_SLVIF_STADET_Pos) -#define I2C_SLVIF_STODET_Pos 3 //妫娴嬪埌鍋滄涓柇鏍囧織锛屽啓1娓呴浂 -#define I2C_SLVIF_STODET_Msk (0x01 << I2C_SLVIF_STODET_Pos) -#define I2C_SLVIF_RDREQ_Pos 4 //鎺ユ敹鍒拌璇锋眰涓柇鏍囧織 -#define I2C_SLVIF_RDREQ_Msk (0x01 << I2C_SLVIF_RDREQ_Pos) -#define I2C_SLVIF_WRREQ_Pos 5 //鎺ユ敹鍒板啓璇锋眰涓柇鏍囧織 -#define I2C_SLVIF_WRREQ_Msk (0x01 << I2C_SLVIF_WRREQ_Pos) -#define I2C_SLVIF_ACTIVE_Pos 6 //slave 鏈夋晥 -#define I2C_SLVIF_ACTIVE_Msk (0x01 << I2C_SLVIF_ACTIVE_Pos) +#define I2C_SLVCR_IM_RXEND_Pos 0 //接收完成中断禁止 +#define I2C_SLVCR_IM_RXEND_Msk (0x01 << I2C_SLVCR_IM_RXEND_Pos) +#define I2C_SLVCR_IM_TXEND_Pos 1 //发送完成中断禁止 +#define I2C_SLVCR_IM_TXEND_Msk (0x01 << I2C_SLVCR_IM_TXEND_Pos) +#define I2C_SLVCR_IM_STADET_Pos 2 //检测到起始中断禁止 +#define I2C_SLVCR_IM_STADET_Msk (0x01 << I2C_SLVCR_IM_STADET_Pos) +#define I2C_SLVCR_IM_STODET_Pos 3 //检测到停止中断禁止 +#define I2C_SLVCR_IM_STODET_Msk (0x01 << I2C_SLVCR_IM_STODET_Pos) +#define I2C_SLVCR_IM_RDREQ_Pos 4 //接收到读请求中断禁止 +#define I2C_SLVCR_IM_RDREQ_Msk (0x01 << I2C_SLVCR_IM_RDREQ_Pos) +#define I2C_SLVCR_IM_WRREQ_Pos 5 //接收到写请求中断禁止 +#define I2C_SLVCR_IM_WRREQ_Msk (0x01 << I2C_SLVCR_IM_WRREQ_Pos) +#define I2C_SLVCR_ADDR7b_Pos 16 //1 7位地址模式 0 10位地址模式 +#define I2C_SLVCR_ADDR7b_Msk (0x01 << I2C_SLVCR_ADDR7b_Pos) +#define I2C_SLVCR_ACK_Pos 17 //1 应答ACK 0 应答NACK +#define I2C_SLVCR_ACK_Msk (0x01 << I2C_SLVCR_ACK_Pos) +#define I2C_SLVCR_SLAVE_Pos 18 //1 从机模式 0 主机模式 +#define I2C_SLVCR_SLAVE_Msk (0x01 << I2C_SLVCR_SLAVE_Pos) +#define I2C_SLVCR_DEBOUNCE_Pos 19 //去抖动使能 +#define I2C_SLVCR_DEBOUNCE_Msk (0x01 << I2C_SLVCR_DEBOUNCE_Pos) +#define I2C_SLVCR_ADDR_Pos 20 //从机地址 +#define I2C_SLVCR_ADDR_Msk (0x3FF << I2C_SLVCR_ADDR_Pos) -typedef struct -{ - __IO uint32_t CTRL; +#define I2C_SLVIF_RXEND_Pos 0 //接收完成中断标志,写1清零 +#define I2C_SLVIF_RXEND_Msk (0x01 << I2C_SLVIF_RXEND_Pos) +#define I2C_SLVIF_TXEND_Pos 1 //发送完成中断标志,写1清零 +#define I2C_SLVIF_TXEND_Msk (0x01 << I2C_SLVIF_TXEND_Pos) +#define I2C_SLVIF_STADET_Pos 2 //检测到起始中断标志,写1清零 +#define I2C_SLVIF_STADET_Msk (0x01 << I2C_SLVIF_STADET_Pos) +#define I2C_SLVIF_STODET_Pos 3 //检测到停止中断标志,写1清零 +#define I2C_SLVIF_STODET_Msk (0x01 << I2C_SLVIF_STODET_Pos) +#define I2C_SLVIF_RDREQ_Pos 4 //接收到读请求中断标志 +#define I2C_SLVIF_RDREQ_Msk (0x01 << I2C_SLVIF_RDREQ_Pos) +#define I2C_SLVIF_WRREQ_Pos 5 //接收到写请求中断标志 +#define I2C_SLVIF_WRREQ_Msk (0x01 << I2C_SLVIF_WRREQ_Pos) +#define I2C_SLVIF_ACTIVE_Pos 6 //slave 有效 +#define I2C_SLVIF_ACTIVE_Msk (0x01 << I2C_SLVIF_ACTIVE_Pos) - __IO uint32_t START; - __IO uint32_t IE; - __IO uint32_t IF; - struct - { - __IO uint32_t STAT; - - __IO uint32_t DATA; - - uint32_t RESERVED[2]; - } CH[8]; - - __IO uint32_t CTRL1; - - __IO uint32_t CTRL2; - - uint32_t RESERVED[2]; - - __IO uint32_t CALIBSET; - - __IO uint32_t CALIBEN; +typedef struct { + __IO uint32_t CTRL; + + __IO uint32_t START; + + __IO uint32_t IE; + + __IO uint32_t IF; + + struct { + __IO uint32_t STAT; + + __IO uint32_t DATA; + + uint32_t RESERVED[2]; + } CH[8]; + + __IO uint32_t CTRL1; + + __IO uint32_t CTRL2; + + uint32_t RESERVED[2]; + + __IO uint32_t CALIBSET; + + __IO uint32_t CALIBEN; } ADC_TypeDef; -#define ADC_CTRL_CH0_Pos 0 //閫氶亾閫変腑 -#define ADC_CTRL_CH0_Msk (0x01 << ADC_CTRL_CH0_Pos) -#define ADC_CTRL_CH1_Pos 1 -#define ADC_CTRL_CH1_Msk (0x01 << ADC_CTRL_CH1_Pos) -#define ADC_CTRL_CH2_Pos 2 -#define ADC_CTRL_CH2_Msk (0x01 << ADC_CTRL_CH2_Pos) -#define ADC_CTRL_CH3_Pos 3 -#define ADC_CTRL_CH3_Msk (0x01 << ADC_CTRL_CH3_Pos) -#define ADC_CTRL_CH4_Pos 4 -#define ADC_CTRL_CH4_Msk (0x01 << ADC_CTRL_CH4_Pos) -#define ADC_CTRL_CH5_Pos 5 -#define ADC_CTRL_CH5_Msk (0x01 << ADC_CTRL_CH5_Pos) -#define ADC_CTRL_CH6_Pos 6 -#define ADC_CTRL_CH6_Msk (0x01 << ADC_CTRL_CH6_Pos) -#define ADC_CTRL_CH7_Pos 7 -#define ADC_CTRL_CH7_Msk (0x01 << ADC_CTRL_CH7_Pos) -#define ADC_CTRL_AVG_Pos 8 //0 1娆¢噰鏍 1 2娆¢噰鏍峰彇骞冲潎鍊 3 4娆¢噰鏍峰彇骞冲潎鍊 7 8娆¢噰鏍峰彇骞冲潎鍊 15 16娆¢噰鏍峰彇骞冲潎鍊 -#define ADC_CTRL_AVG_Msk (0x0F << ADC_CTRL_AVG_Pos) -#define ADC_CTRL_EN_Pos 12 -#define ADC_CTRL_EN_Msk (0x01 << ADC_CTRL_EN_Pos) -#define ADC_CTRL_CONT_Pos 13 //Continuous conversion锛屽彧鍦ㄨ蒋浠跺惎鍔ㄦā寮忎笅鏈夋晥锛0 鍗曟杞崲锛岃浆鎹㈠畬鎴愬悗START浣嶈嚜鍔ㄦ竻闄ゅ仠姝㈣浆鎹 -#define ADC_CTRL_CONT_Msk (0x01 << ADC_CTRL_CONT_Pos) // 1 杩炵画杞崲锛屽惎鍔ㄥ悗涓鐩撮噰鏍枫佽浆鎹紝鐩村埌杞欢娓呴櫎START浣 -#define ADC_CTRL_TRIG_Pos 14 //杞崲瑙﹀彂鏂瑰紡锛0 杞欢鍚姩杞崲 1 PWM瑙﹀彂 -#define ADC_CTRL_TRIG_Msk (0x01 << ADC_CTRL_TRIG_Pos) -#define ADC_CTRL_CLKSRC_Pos 15 //0 VCO 1 HRC -#define ADC_CTRL_CLKSRC_Msk (0x01 << ADC_CTRL_CLKSRC_Pos) -#define ADC_CTRL_FIFOCLR_Pos 24 //[24] CH0_FIFO_CLR [25] CH1_FIFO_CLR ... [31] CH7_FIFO_CLR -#define ADC_CTRL_FIFOCLR_Msk (0xFFu << ADC_CTRL_FIFOCLR_Pos) -#define ADC_START_GO_Pos 0 //杞欢瑙﹀彂妯″紡涓嬶紝鍐1鍚姩ADC閲囨牱鍜岃浆鎹紝鍦ㄥ崟娆℃ā寮忎笅杞崲瀹屾垚鍚庣‖浠惰嚜鍔ㄦ竻闆讹紝鍦ㄦ壂鎻忔ā寮忎笅蹇呴』杞欢鍐0鍋滄ADC杞崲 -#define ADC_START_GO_Msk (0x01 << ADC_START_GO_Pos) -#define ADC_START_BUSY_Pos 4 -#define ADC_START_BUSY_Msk (0x01 << ADC_START_BUSY_Pos) +#define ADC_CTRL_CH0_Pos 0 //通道选中 +#define ADC_CTRL_CH0_Msk (0x01 << ADC_CTRL_CH0_Pos) +#define ADC_CTRL_CH1_Pos 1 +#define ADC_CTRL_CH1_Msk (0x01 << ADC_CTRL_CH1_Pos) +#define ADC_CTRL_CH2_Pos 2 +#define ADC_CTRL_CH2_Msk (0x01 << ADC_CTRL_CH2_Pos) +#define ADC_CTRL_CH3_Pos 3 +#define ADC_CTRL_CH3_Msk (0x01 << ADC_CTRL_CH3_Pos) +#define ADC_CTRL_CH4_Pos 4 +#define ADC_CTRL_CH4_Msk (0x01 << ADC_CTRL_CH4_Pos) +#define ADC_CTRL_CH5_Pos 5 +#define ADC_CTRL_CH5_Msk (0x01 << ADC_CTRL_CH5_Pos) +#define ADC_CTRL_CH6_Pos 6 +#define ADC_CTRL_CH6_Msk (0x01 << ADC_CTRL_CH6_Pos) +#define ADC_CTRL_CH7_Pos 7 +#define ADC_CTRL_CH7_Msk (0x01 << ADC_CTRL_CH7_Pos) +#define ADC_CTRL_AVG_Pos 8 //0 1次采样 1 2次采样取平均值 3 4次采样取平均值 7 8次采样取平均值 15 16次采样取平均值 +#define ADC_CTRL_AVG_Msk (0x0F << ADC_CTRL_AVG_Pos) +#define ADC_CTRL_EN_Pos 12 +#define ADC_CTRL_EN_Msk (0x01 << ADC_CTRL_EN_Pos) +#define ADC_CTRL_CONT_Pos 13 //Continuous conversion,只在软件启动模式下有效,0 单次转换,转换完成后START位自动清除停止转换 +#define ADC_CTRL_CONT_Msk (0x01 << ADC_CTRL_CONT_Pos) // 1 连续转换,启动后一直采样、转换,直到软件清除START位 +#define ADC_CTRL_TRIG_Pos 14 //转换触发方式:0 软件启动转换 1 PWM触发 +#define ADC_CTRL_TRIG_Msk (0x01 << ADC_CTRL_TRIG_Pos) +#define ADC_CTRL_CLKSRC_Pos 15 //0 VCO 1 HRC +#define ADC_CTRL_CLKSRC_Msk (0x01 << ADC_CTRL_CLKSRC_Pos) +#define ADC_CTRL_FIFOCLR_Pos 24 //[24] CH0_FIFO_CLR [25] CH1_FIFO_CLR ... [31] CH7_FIFO_CLR +#define ADC_CTRL_FIFOCLR_Msk (0xFFu<< ADC_CTRL_FIFOCLR_Pos) -#define ADC_IE_CH0EOC_Pos 0 //End Of Convertion -#define ADC_IE_CH0EOC_Msk (0x01 << ADC_IE_CH0EOC_Pos) -#define ADC_IE_CH0OVF_Pos 1 //Overflow -#define ADC_IE_CH0OVF_Msk (0x01 << ADC_IE_CH0OVF_Pos) -#define ADC_IE_CH0HFULL_Pos 2 //FIFO Half Full -#define ADC_IE_CH0HFULL_Msk (0x01 << ADC_IE_CH0HFULL_Pos) -#define ADC_IE_CH0FULL_Pos 3 //FIFO Full -#define ADC_IE_CH0FULL_Msk (0x01 << ADC_IE_CH0FULL_Pos) -#define ADC_IE_CH1EOC_Pos 4 -#define ADC_IE_CH1EOC_Msk (0x01 << ADC_IE_CH1EOC_Pos) -#define ADC_IE_CH1OVF_Pos 5 -#define ADC_IE_CH1OVF_Msk (0x01 << ADC_IE_CH1OVF_Pos) -#define ADC_IE_CH1HFULL_Pos 6 -#define ADC_IE_CH1HFULL_Msk (0x01 << ADC_IE_CH1HFULL_Pos) -#define ADC_IE_CH1FULL_Pos 7 -#define ADC_IE_CH1FULL_Msk (0x01 << ADC_IE_CH1FULL_Pos) -#define ADC_IE_CH2EOC_Pos 8 -#define ADC_IE_CH2EOC_Msk (0x01 << ADC_IE_CH2EOC_Pos) -#define ADC_IE_CH2OVF_Pos 9 -#define ADC_IE_CH2OVF_Msk (0x01 << ADC_IE_CH2OVF_Pos) -#define ADC_IE_CH2HFULL_Pos 10 -#define ADC_IE_CH2HFULL_Msk (0x01 << ADC_IE_CH2HFULL_Pos) -#define ADC_IE_CH2FULL_Pos 11 -#define ADC_IE_CH2FULL_Msk (0x01 << ADC_IE_CH2FULL_Pos) -#define ADC_IE_CH3EOC_Pos 12 -#define ADC_IE_CH3EOC_Msk (0x01 << ADC_IE_CH3EOC_Pos) -#define ADC_IE_CH3OVF_Pos 13 -#define ADC_IE_CH3OVF_Msk (0x01 << ADC_IE_CH3OVF_Pos) -#define ADC_IE_CH3HFULL_Pos 14 -#define ADC_IE_CH3HFULL_Msk (0x01 << ADC_IE_CH3HFULL_Pos) -#define ADC_IE_CH3FULL_Pos 15 -#define ADC_IE_CH3FULL_Msk (0x01 << ADC_IE_CH3FULL_Pos) -#define ADC_IE_CH4EOC_Pos 16 -#define ADC_IE_CH4EOC_Msk (0x01 << ADC_IE_CH4EOC_Pos) -#define ADC_IE_CH4OVF_Pos 17 -#define ADC_IE_CH4OVF_Msk (0x01 << ADC_IE_CH4OVF_Pos) -#define ADC_IE_CH4HFULL_Pos 18 -#define ADC_IE_CH4HFULL_Msk (0x01 << ADC_IE_CH4HFULL_Pos) -#define ADC_IE_CH4FULL_Pos 19 -#define ADC_IE_CH4FULL_Msk (0x01 << ADC_IE_CH4FULL_Pos) -#define ADC_IE_CH5EOC_Pos 20 -#define ADC_IE_CH5EOC_Msk (0x01 << ADC_IE_CH5EOC_Pos) -#define ADC_IE_CH5OVF_Pos 21 -#define ADC_IE_CH5OVF_Msk (0x01 << ADC_IE_CH5OVF_Pos) -#define ADC_IE_CH5HFULL_Pos 22 -#define ADC_IE_CH5HFULL_Msk (0x01 << ADC_IE_CH5HFULL_Pos) -#define ADC_IE_CH5FULL_Pos 23 -#define ADC_IE_CH5FULL_Msk (0x01 << ADC_IE_CH5FULL_Pos) -#define ADC_IE_CH6EOC_Pos 24 -#define ADC_IE_CH6EOC_Msk (0x01 << ADC_IE_CH6EOC_Pos) -#define ADC_IE_CH6OVF_Pos 25 -#define ADC_IE_CH6OVF_Msk (0x01 << ADC_IE_CH6OVF_Pos) -#define ADC_IE_CH6HFULL_Pos 26 -#define ADC_IE_CH6HFULL_Msk (0x01 << ADC_IE_CH6HFULL_Pos) -#define ADC_IE_CH6FULL_Pos 27 -#define ADC_IE_CH6FULL_Msk (0x01 << ADC_IE_CH6FULL_Pos) -#define ADC_IE_CH7EOC_Pos 28 -#define ADC_IE_CH7EOC_Msk (0x01 << ADC_IE_CH7EOC_Pos) -#define ADC_IE_CH7OVF_Pos 29 -#define ADC_IE_CH7OVF_Msk (0x01 << ADC_IE_CH7OVF_Pos) -#define ADC_IE_CH7HFULL_Pos 30 -#define ADC_IE_CH7HFULL_Msk (0x01 << ADC_IE_CH7HFULL_Pos) -#define ADC_IE_CH7FULL_Pos 31 -#define ADC_IE_CH7FULL_Msk (0x01u << ADC_IE_CH7FULL_Pos) +#define ADC_START_GO_Pos 0 //软件触发模式下,写1启动ADC采样和转换,在单次模式下转换完成后硬件自动清零,在扫描模式下必须软件写0停止ADC转换 +#define ADC_START_GO_Msk (0x01 << ADC_START_GO_Pos) +#define ADC_START_BUSY_Pos 4 +#define ADC_START_BUSY_Msk (0x01 << ADC_START_BUSY_Pos) -#define ADC_IF_CH0EOC_Pos 0 //鍐1娓呴浂 -#define ADC_IF_CH0EOC_Msk (0x01 << ADC_IF_CH0EOC_Pos) -#define ADC_IF_CH0OVF_Pos 1 //鍐1娓呴浂 -#define ADC_IF_CH0OVF_Msk (0x01 << ADC_IF_CH0OVF_Pos) -#define ADC_IF_CH0HFULL_Pos 2 //鍐1娓呴浂 -#define ADC_IF_CH0HFULL_Msk (0x01 << ADC_IF_CH0HFULL_Pos) -#define ADC_IF_CH0FULL_Pos 3 //鍐1娓呴浂 -#define ADC_IF_CH0FULL_Msk (0x01 << ADC_IF_CH0FULL_Pos) -#define ADC_IF_CH1EOC_Pos 4 -#define ADC_IF_CH1EOC_Msk (0x01 << ADC_IF_CH1EOC_Pos) -#define ADC_IF_CH1OVF_Pos 5 -#define ADC_IF_CH1OVF_Msk (0x01 << ADC_IF_CH1OVF_Pos) -#define ADC_IF_CH1HFULL_Pos 6 -#define ADC_IF_CH1HFULL_Msk (0x01 << ADC_IF_CH1HFULL_Pos) -#define ADC_IF_CH1FULL_Pos 7 -#define ADC_IF_CH1FULL_Msk (0x01 << ADC_IF_CH1FULL_Pos) -#define ADC_IF_CH2EOC_Pos 8 -#define ADC_IF_CH2EOC_Msk (0x01 << ADC_IF_CH2EOC_Pos) -#define ADC_IF_CH2OVF_Pos 9 -#define ADC_IF_CH2OVF_Msk (0x01 << ADC_IF_CH2OVF_Pos) -#define ADC_IF_CH2HFULL_Pos 10 -#define ADC_IF_CH2HFULL_Msk (0x01 << ADC_IF_CH2HFULL_Pos) -#define ADC_IF_CH2FULL_Pos 11 -#define ADC_IF_CH2FULL_Msk (0x01 << ADC_IF_CH2FULL_Pos) -#define ADC_IF_CH3EOC_Pos 12 -#define ADC_IF_CH3EOC_Msk (0x01 << ADC_IF_CH3EOC_Pos) -#define ADC_IF_CH3OVF_Pos 13 -#define ADC_IF_CH3OVF_Msk (0x01 << ADC_IF_CH3OVF_Pos) -#define ADC_IF_CH3HFULL_Pos 14 -#define ADC_IF_CH3HFULL_Msk (0x01 << ADC_IF_CH3HFULL_Pos) -#define ADC_IF_CH3FULL_Pos 15 -#define ADC_IF_CH3FULL_Msk (0x01 << ADC_IF_CH3FULL_Pos) -#define ADC_IF_CH4EOC_Pos 16 -#define ADC_IF_CH4EOC_Msk (0x01 << ADC_IF_CH4EOC_Pos) -#define ADC_IF_CH4OVF_Pos 17 -#define ADC_IF_CH4OVF_Msk (0x01 << ADC_IF_CH4OVF_Pos) -#define ADC_IF_CH4HFULL_Pos 18 -#define ADC_IF_CH4HFULL_Msk (0x01 << ADC_IF_CH4HFULL_Pos) -#define ADC_IF_CH4FULL_Pos 19 -#define ADC_IF_CH4FULL_Msk (0x01 << ADC_IF_CH4FULL_Pos) -#define ADC_IF_CH5EOC_Pos 20 -#define ADC_IF_CH5EOC_Msk (0x01 << ADC_IF_CH5EOC_Pos) -#define ADC_IF_CH5OVF_Pos 21 -#define ADC_IF_CH5OVF_Msk (0x01 << ADC_IF_CH5OVF_Pos) -#define ADC_IF_CH5HFULL_Pos 22 -#define ADC_IF_CH5HFULL_Msk (0x01 << ADC_IF_CH5HFULL_Pos) -#define ADC_IF_CH5FULL_Pos 23 -#define ADC_IF_CH5FULL_Msk (0x01 << ADC_IF_CH5FULL_Pos) -#define ADC_IF_CH6EOC_Pos 24 -#define ADC_IF_CH6EOC_Msk (0x01 << ADC_IF_CH6EOC_Pos) -#define ADC_IF_CH6OVF_Pos 25 -#define ADC_IF_CH6OVF_Msk (0x01 << ADC_IF_CH6OVF_Pos) -#define ADC_IF_CH6HFULL_Pos 26 -#define ADC_IF_CH6HFULL_Msk (0x01 << ADC_IF_CH6HFULL_Pos) -#define ADC_IF_CH6FULL_Pos 27 -#define ADC_IF_CH6FULL_Msk (0x01 << ADC_IF_CH6FULL_Pos) -#define ADC_IF_CH7EOC_Pos 28 -#define ADC_IF_CH7EOC_Msk (0x01 << ADC_IF_CH7EOC_Pos) -#define ADC_IF_CH7OVF_Pos 29 -#define ADC_IF_CH7OVF_Msk (0x01 << ADC_IF_CH7OVF_Pos) -#define ADC_IF_CH7HFULL_Pos 30 -#define ADC_IF_CH7HFULL_Msk (0x01 << ADC_IF_CH7HFULL_Pos) -#define ADC_IF_CH7FULL_Pos 31 -#define ADC_IF_CH7FULL_Msk (0x01 << ADC_IF_CH7FULL_Pos) +#define ADC_IE_CH0EOC_Pos 0 //End Of Convertion +#define ADC_IE_CH0EOC_Msk (0x01 << ADC_IE_CH0EOC_Pos) +#define ADC_IE_CH0OVF_Pos 1 //Overflow +#define ADC_IE_CH0OVF_Msk (0x01 << ADC_IE_CH0OVF_Pos) +#define ADC_IE_CH0HFULL_Pos 2 //FIFO Half Full +#define ADC_IE_CH0HFULL_Msk (0x01 << ADC_IE_CH0HFULL_Pos) +#define ADC_IE_CH0FULL_Pos 3 //FIFO Full +#define ADC_IE_CH0FULL_Msk (0x01 << ADC_IE_CH0FULL_Pos) +#define ADC_IE_CH1EOC_Pos 4 +#define ADC_IE_CH1EOC_Msk (0x01 << ADC_IE_CH1EOC_Pos) +#define ADC_IE_CH1OVF_Pos 5 +#define ADC_IE_CH1OVF_Msk (0x01 << ADC_IE_CH1OVF_Pos) +#define ADC_IE_CH1HFULL_Pos 6 +#define ADC_IE_CH1HFULL_Msk (0x01 << ADC_IE_CH1HFULL_Pos) +#define ADC_IE_CH1FULL_Pos 7 +#define ADC_IE_CH1FULL_Msk (0x01 << ADC_IE_CH1FULL_Pos) +#define ADC_IE_CH2EOC_Pos 8 +#define ADC_IE_CH2EOC_Msk (0x01 << ADC_IE_CH2EOC_Pos) +#define ADC_IE_CH2OVF_Pos 9 +#define ADC_IE_CH2OVF_Msk (0x01 << ADC_IE_CH2OVF_Pos) +#define ADC_IE_CH2HFULL_Pos 10 +#define ADC_IE_CH2HFULL_Msk (0x01 << ADC_IE_CH2HFULL_Pos) +#define ADC_IE_CH2FULL_Pos 11 +#define ADC_IE_CH2FULL_Msk (0x01 << ADC_IE_CH2FULL_Pos) +#define ADC_IE_CH3EOC_Pos 12 +#define ADC_IE_CH3EOC_Msk (0x01 << ADC_IE_CH3EOC_Pos) +#define ADC_IE_CH3OVF_Pos 13 +#define ADC_IE_CH3OVF_Msk (0x01 << ADC_IE_CH3OVF_Pos) +#define ADC_IE_CH3HFULL_Pos 14 +#define ADC_IE_CH3HFULL_Msk (0x01 << ADC_IE_CH3HFULL_Pos) +#define ADC_IE_CH3FULL_Pos 15 +#define ADC_IE_CH3FULL_Msk (0x01 << ADC_IE_CH3FULL_Pos) +#define ADC_IE_CH4EOC_Pos 16 +#define ADC_IE_CH4EOC_Msk (0x01 << ADC_IE_CH4EOC_Pos) +#define ADC_IE_CH4OVF_Pos 17 +#define ADC_IE_CH4OVF_Msk (0x01 << ADC_IE_CH4OVF_Pos) +#define ADC_IE_CH4HFULL_Pos 18 +#define ADC_IE_CH4HFULL_Msk (0x01 << ADC_IE_CH4HFULL_Pos) +#define ADC_IE_CH4FULL_Pos 19 +#define ADC_IE_CH4FULL_Msk (0x01 << ADC_IE_CH4FULL_Pos) +#define ADC_IE_CH5EOC_Pos 20 +#define ADC_IE_CH5EOC_Msk (0x01 << ADC_IE_CH5EOC_Pos) +#define ADC_IE_CH5OVF_Pos 21 +#define ADC_IE_CH5OVF_Msk (0x01 << ADC_IE_CH5OVF_Pos) +#define ADC_IE_CH5HFULL_Pos 22 +#define ADC_IE_CH5HFULL_Msk (0x01 << ADC_IE_CH5HFULL_Pos) +#define ADC_IE_CH5FULL_Pos 23 +#define ADC_IE_CH5FULL_Msk (0x01 << ADC_IE_CH5FULL_Pos) +#define ADC_IE_CH6EOC_Pos 24 +#define ADC_IE_CH6EOC_Msk (0x01 << ADC_IE_CH6EOC_Pos) +#define ADC_IE_CH6OVF_Pos 25 +#define ADC_IE_CH6OVF_Msk (0x01 << ADC_IE_CH6OVF_Pos) +#define ADC_IE_CH6HFULL_Pos 26 +#define ADC_IE_CH6HFULL_Msk (0x01 << ADC_IE_CH6HFULL_Pos) +#define ADC_IE_CH6FULL_Pos 27 +#define ADC_IE_CH6FULL_Msk (0x01 << ADC_IE_CH6FULL_Pos) +#define ADC_IE_CH7EOC_Pos 28 +#define ADC_IE_CH7EOC_Msk (0x01 << ADC_IE_CH7EOC_Pos) +#define ADC_IE_CH7OVF_Pos 29 +#define ADC_IE_CH7OVF_Msk (0x01 << ADC_IE_CH7OVF_Pos) +#define ADC_IE_CH7HFULL_Pos 30 +#define ADC_IE_CH7HFULL_Msk (0x01 << ADC_IE_CH7HFULL_Pos) +#define ADC_IE_CH7FULL_Pos 31 +#define ADC_IE_CH7FULL_Msk (0x01u<< ADC_IE_CH7FULL_Pos) -#define ADC_STAT_EOC_Pos 0 //鍐1娓呴浂 -#define ADC_STAT_EOC_Msk (0x01 << ADC_STAT_EOC_Pos) -#define ADC_STAT_OVF_Pos 1 //璇绘暟鎹瘎瀛樺櫒娓呴櫎 -#define ADC_STAT_OVF_Msk (0x01 << ADC_STAT_OVF_Pos) -#define ADC_STAT_HFULL_Pos 2 -#define ADC_STAT_HFULL_Msk (0x01 << ADC_STAT_HFULL_Pos) -#define ADC_STAT_FULL_Pos 3 -#define ADC_STAT_FULL_Msk (0x01 << ADC_STAT_FULL_Pos) -#define ADC_STAT_EMPTY_Pos 4 -#define ADC_STAT_EMPTY_Msk (0x01 << ADC_STAT_EMPTY_Pos) +#define ADC_IF_CH0EOC_Pos 0 //写1清零 +#define ADC_IF_CH0EOC_Msk (0x01 << ADC_IF_CH0EOC_Pos) +#define ADC_IF_CH0OVF_Pos 1 //写1清零 +#define ADC_IF_CH0OVF_Msk (0x01 << ADC_IF_CH0OVF_Pos) +#define ADC_IF_CH0HFULL_Pos 2 //写1清零 +#define ADC_IF_CH0HFULL_Msk (0x01 << ADC_IF_CH0HFULL_Pos) +#define ADC_IF_CH0FULL_Pos 3 //写1清零 +#define ADC_IF_CH0FULL_Msk (0x01 << ADC_IF_CH0FULL_Pos) +#define ADC_IF_CH1EOC_Pos 4 +#define ADC_IF_CH1EOC_Msk (0x01 << ADC_IF_CH1EOC_Pos) +#define ADC_IF_CH1OVF_Pos 5 +#define ADC_IF_CH1OVF_Msk (0x01 << ADC_IF_CH1OVF_Pos) +#define ADC_IF_CH1HFULL_Pos 6 +#define ADC_IF_CH1HFULL_Msk (0x01 << ADC_IF_CH1HFULL_Pos) +#define ADC_IF_CH1FULL_Pos 7 +#define ADC_IF_CH1FULL_Msk (0x01 << ADC_IF_CH1FULL_Pos) +#define ADC_IF_CH2EOC_Pos 8 +#define ADC_IF_CH2EOC_Msk (0x01 << ADC_IF_CH2EOC_Pos) +#define ADC_IF_CH2OVF_Pos 9 +#define ADC_IF_CH2OVF_Msk (0x01 << ADC_IF_CH2OVF_Pos) +#define ADC_IF_CH2HFULL_Pos 10 +#define ADC_IF_CH2HFULL_Msk (0x01 << ADC_IF_CH2HFULL_Pos) +#define ADC_IF_CH2FULL_Pos 11 +#define ADC_IF_CH2FULL_Msk (0x01 << ADC_IF_CH2FULL_Pos) +#define ADC_IF_CH3EOC_Pos 12 +#define ADC_IF_CH3EOC_Msk (0x01 << ADC_IF_CH3EOC_Pos) +#define ADC_IF_CH3OVF_Pos 13 +#define ADC_IF_CH3OVF_Msk (0x01 << ADC_IF_CH3OVF_Pos) +#define ADC_IF_CH3HFULL_Pos 14 +#define ADC_IF_CH3HFULL_Msk (0x01 << ADC_IF_CH3HFULL_Pos) +#define ADC_IF_CH3FULL_Pos 15 +#define ADC_IF_CH3FULL_Msk (0x01 << ADC_IF_CH3FULL_Pos) +#define ADC_IF_CH4EOC_Pos 16 +#define ADC_IF_CH4EOC_Msk (0x01 << ADC_IF_CH4EOC_Pos) +#define ADC_IF_CH4OVF_Pos 17 +#define ADC_IF_CH4OVF_Msk (0x01 << ADC_IF_CH4OVF_Pos) +#define ADC_IF_CH4HFULL_Pos 18 +#define ADC_IF_CH4HFULL_Msk (0x01 << ADC_IF_CH4HFULL_Pos) +#define ADC_IF_CH4FULL_Pos 19 +#define ADC_IF_CH4FULL_Msk (0x01 << ADC_IF_CH4FULL_Pos) +#define ADC_IF_CH5EOC_Pos 20 +#define ADC_IF_CH5EOC_Msk (0x01 << ADC_IF_CH5EOC_Pos) +#define ADC_IF_CH5OVF_Pos 21 +#define ADC_IF_CH5OVF_Msk (0x01 << ADC_IF_CH5OVF_Pos) +#define ADC_IF_CH5HFULL_Pos 22 +#define ADC_IF_CH5HFULL_Msk (0x01 << ADC_IF_CH5HFULL_Pos) +#define ADC_IF_CH5FULL_Pos 23 +#define ADC_IF_CH5FULL_Msk (0x01 << ADC_IF_CH5FULL_Pos) +#define ADC_IF_CH6EOC_Pos 24 +#define ADC_IF_CH6EOC_Msk (0x01 << ADC_IF_CH6EOC_Pos) +#define ADC_IF_CH6OVF_Pos 25 +#define ADC_IF_CH6OVF_Msk (0x01 << ADC_IF_CH6OVF_Pos) +#define ADC_IF_CH6HFULL_Pos 26 +#define ADC_IF_CH6HFULL_Msk (0x01 << ADC_IF_CH6HFULL_Pos) +#define ADC_IF_CH6FULL_Pos 27 +#define ADC_IF_CH6FULL_Msk (0x01 << ADC_IF_CH6FULL_Pos) +#define ADC_IF_CH7EOC_Pos 28 +#define ADC_IF_CH7EOC_Msk (0x01 << ADC_IF_CH7EOC_Pos) +#define ADC_IF_CH7OVF_Pos 29 +#define ADC_IF_CH7OVF_Msk (0x01 << ADC_IF_CH7OVF_Pos) +#define ADC_IF_CH7HFULL_Pos 30 +#define ADC_IF_CH7HFULL_Msk (0x01 << ADC_IF_CH7HFULL_Pos) +#define ADC_IF_CH7FULL_Pos 31 +#define ADC_IF_CH7FULL_Msk (0x01 << ADC_IF_CH7FULL_Pos) -#define ADC_CTRL1_RIN_Pos 4 //杈撳叆闃绘姉锛0 鏃犵┓澶 1 105K 2 90K 3 75K 4 60K 5 45K 6 30K 7 15K -#define ADC_CTRL1_RIN_Msk (0x07 << ADC_CTRL1_RIN_Pos) +#define ADC_STAT_EOC_Pos 0 //写1清零 +#define ADC_STAT_EOC_Msk (0x01 << ADC_STAT_EOC_Pos) +#define ADC_STAT_OVF_Pos 1 //读数据寄存器清除 +#define ADC_STAT_OVF_Msk (0x01 << ADC_STAT_OVF_Pos) +#define ADC_STAT_HFULL_Pos 2 +#define ADC_STAT_HFULL_Msk (0x01 << ADC_STAT_HFULL_Pos) +#define ADC_STAT_FULL_Pos 3 +#define ADC_STAT_FULL_Msk (0x01 << ADC_STAT_FULL_Pos) +#define ADC_STAT_EMPTY_Pos 4 +#define ADC_STAT_EMPTY_Msk (0x01 << ADC_STAT_EMPTY_Pos) -#define ADC_CTRL2_RESET_Pos 0 //鏁板瓧鐢佃矾澶嶄綅 -#define ADC_CTRL2_RESET_Msk (0x01 << ADC_CTRL2_RESET_Pos) -#define ADC_CTRL2_ADCEVCM_Pos 1 //ADC External VCM锛孉DC涓嶱GA杈撳嚭鍏辨ā鐢靛钩閫夋嫨 -#define ADC_CTRL2_ADCEVCM_Msk (0x01 << ADC_CTRL2_ADCEVCM_Pos) -#define ADC_CTRL2_PGAIVCM_Pos 2 //PGA Internal VCM锛孭GA杈撳叆鍏辨ā鐢靛钩閫夋嫨 -#define ADC_CTRL2_PGAIVCM_Msk (0x01 << ADC_CTRL2_PGAIVCM_Pos) -#define ADC_CTRL2_PGAGAIN_Pos 3 //0 25.1dB 1 21.6dB 2 11.1dB 3 3.5dB 4 0dB(1.8V) 5 -2.9dB 6 -5.3dB -#define ADC_CTRL2_PGAGAIN_Msk (0x07 << ADC_CTRL2_PGAGAIN_Pos) -#define ADC_CTRL2_REFPOUT_Pos 23 //1 ADC 鍐呴儴 1.2V REFP鐢靛帇杈撳嚭鍒板閮≧EFP寮曡剼锛岀敤浜庢祴閲忥紝鎴栧湪闇瑕1.2V澶栭儴REFP鏃惰妭鐪佹垚鏈 +#define ADC_CTRL1_RIN_Pos 4 //输入阻抗:0 无穷大 1 105K 2 90K 3 75K 4 60K 5 45K 6 30K 7 15K +#define ADC_CTRL1_RIN_Msk (0x07 << ADC_CTRL1_RIN_Pos) + +#define ADC_CTRL2_RESET_Pos 0 //数字电路复位 +#define ADC_CTRL2_RESET_Msk (0x01 << ADC_CTRL2_RESET_Pos) +#define ADC_CTRL2_ADCEVCM_Pos 1 //ADC External VCM,ADC与PGA输出共模电平选择 +#define ADC_CTRL2_ADCEVCM_Msk (0x01 << ADC_CTRL2_ADCEVCM_Pos) +#define ADC_CTRL2_PGAIVCM_Pos 2 //PGA Internal VCM,PGA输入共模电平选择 +#define ADC_CTRL2_PGAIVCM_Msk (0x01 << ADC_CTRL2_PGAIVCM_Pos) +#define ADC_CTRL2_PGAGAIN_Pos 3 //0 25.1dB 1 21.6dB 2 11.1dB 3 3.5dB 4 0dB(1.8V) 5 -2.9dB 6 -5.3dB +#define ADC_CTRL2_PGAGAIN_Msk (0x07 << ADC_CTRL2_PGAGAIN_Pos) +#define ADC_CTRL2_REFPOUT_Pos 23 //1 ADC 内部 1.2V REFP电压输出到外部REFP引脚,用于测量,或在需要1.2V外部REFP时节省成本 #define ADC_CTRL2_REFPOUT_Msk (0x01 << ADC_CTRL2_REFPOUT_Pos -#define ADC_CTRL2_CLKDIV_Pos 24 //鏃堕挓鍒嗛锛屽彧鍦ㄦ椂閽熸簮涓篐RC鏃舵湁鏁 -#define ADC_CTRL2_CLKDIV_Msk (0x1F << ADC_CTRL2_CLKDIV_Pos) -#define ADC_CTRL2_PGAVCM_Pos 29 -#define ADC_CTRL2_PGAVCM_Msk (0x07u << ADC_CTRL2_PGAVCM_Pos) +#define ADC_CTRL2_CLKDIV_Pos 24 //时钟分频,只在时钟源为HRC时有效 +#define ADC_CTRL2_CLKDIV_Msk (0x1F << ADC_CTRL2_CLKDIV_Pos) +#define ADC_CTRL2_PGAVCM_Pos 29 +#define ADC_CTRL2_PGAVCM_Msk (0x07u<< ADC_CTRL2_PGAVCM_Pos) -#define ADC_CALIBSET_OFFSET_Pos 0 -#define ADC_CALIBSET_OFFSET_Msk (0x1FF << ADC_CALIBSET_OFFSET_Pos) -#define ADC_CALIBSET_K_Pos 16 -#define ADC_CALIBSET_K_Msk (0x1FF << ADC_CALIBSET_K_Pos) +#define ADC_CALIBSET_OFFSET_Pos 0 +#define ADC_CALIBSET_OFFSET_Msk (0x1FF<< ADC_CALIBSET_OFFSET_Pos) +#define ADC_CALIBSET_K_Pos 16 +#define ADC_CALIBSET_K_Msk (0x1FF<< ADC_CALIBSET_K_Pos) -#define ADC_CALIBEN_OFFSET_Pos 0 -#define ADC_CALIBEN_OFFSET_Msk (0x01 << ADC_CALIBEN_OFFSET_Pos) -#define ADC_CALIBEN_K_Pos 1 -#define ADC_CALIBEN_K_Msk (0x01 << ADC_CALIBEN_K_Pos) +#define ADC_CALIBEN_OFFSET_Pos 0 +#define ADC_CALIBEN_OFFSET_Msk (0x01 << ADC_CALIBEN_OFFSET_Pos) +#define ADC_CALIBEN_K_Pos 1 +#define ADC_CALIBEN_K_Msk (0x01 << ADC_CALIBEN_K_Pos) -typedef struct -{ - __IO uint32_t MODE; //0 鏅氭ā寮忥紝A銆丅涓よ矾杈撳嚭浜掔浉鐙珛 - //1 浜掕ˉ妯″紡锛孉銆丅涓よ矾杈撳嚭閮界敱PERA銆丠IGHA鎺у埗锛孊璺緭鍑轰笌A璺緭鍑烘瀬鎬х浉鍙嶏紝涓擠ZA銆丏ZB鎺у埗A銆丅璺緭鍑轰笂鍗囨部鎺ㄨ繜鏃堕棿 - //2 鍗曟妯″紡锛屽悓鏅氭ā寮忥紝浣嗕竴涓懆鏈熷悗鑷姩鍋滄 - //3 瀵圭О妯″紡锛孉銆丅涓よ矾杈撳嚭浜掔浉鐙珛锛屼互涓や釜璁℃暟鍛ㄦ湡浜х敓涓涓尝褰㈣緭鍑哄懆鏈燂紝鍒嗚鲸鐜囨彁鍗囦竴鍊嶃侀鐜囬檷浣庝竴鍊 - //4 瀵圭О浜掕ˉ妯″紡锛屽绉版ā寮忓拰浜掕ˉ妯″紡鐨勭患鍚 - __IO uint32_t PERA; //[15:0] 鍛ㄦ湡 - __IO uint32_t HIGHA; //[15:0] 楂樼數骞虫寔缁椂闀 - __IO uint32_t DZA; //[9:0] 姝诲尯锛屽嵆涓婂崌娌挎帹杩熸椂闀匡紝蹇呴』灏忎簬HIGHA - - __IO uint32_t PERB; - - __IO uint32_t HIGHB; - - __IO uint32_t DZB; - - __IO uint32_t INIOUT; //Init Output level锛屽垵濮嬭緭鍑虹數骞 +typedef struct { + __IO uint32_t MODE; //0 普通模式,A、B两路输出互相独立 + //1 互补模式,A、B两路输出都由PERA、HIGHA控制,B路输出与A路输出极性相反,且DZA、DZB控制A、B路输出上升沿推迟时间 + //2 单次模式,同普通模式,但一个周期后自动停止 + //3 对称模式,A、B两路输出互相独立,以两个计数周期产生一个波形输出周期,分辨率提升一倍、频率降低一倍 + //4 对称互补模式,对称模式和互补模式的综合 + + __IO uint32_t PERA; //[15:0] 周期 + + __IO uint32_t HIGHA; //[15:0] 高电平持续时长 + + __IO uint32_t DZA; //[9:0] 死区,即上升沿推迟时长,必须小于HIGHA + + __IO uint32_t PERB; + + __IO uint32_t HIGHB; + + __IO uint32_t DZB; + + __IO uint32_t INIOUT; //Init Output level,初始输出电平 } PWM_TypeDef; -#define PWM_INIOUT_PWMA_Pos 0 -#define PWM_INIOUT_PWMA_Msk (0x01 << PWM_INIOUT_PWMA_Pos) -#define PWM_INIOUT_PWMB_Pos 1 -#define PWM_INIOUT_PWMB_Msk (0x01 << PWM_INIOUT_PWMB_Pos) -typedef struct -{ - __IO uint32_t FORCEH; +#define PWM_INIOUT_PWMA_Pos 0 +#define PWM_INIOUT_PWMA_Msk (0x01 << PWM_INIOUT_PWMA_Pos) +#define PWM_INIOUT_PWMB_Pos 1 +#define PWM_INIOUT_PWMB_Msk (0x01 << PWM_INIOUT_PWMB_Pos) + +typedef struct { + __IO uint32_t FORCEH; + __IO uint32_t ADTRG0A; __IO uint32_t ADTRG0B; - + __IO uint32_t ADTRG1A; __IO uint32_t ADTRG1B; - + __IO uint32_t ADTRG2A; __IO uint32_t ADTRG2B; - + __IO uint32_t ADTRG3A; __IO uint32_t ADTRG3B; - + __IO uint32_t ADTRG4A; __IO uint32_t ADTRG4B; - + __IO uint32_t ADTRG5A; - __IO uint32_t ADTRG5B; - - uint32_t RESERVED[3]; - - __IO uint32_t HALT; //鍒硅溅鎺у埗 - - __IO uint32_t CHEN; - - __IO uint32_t IE; - - __IO uint32_t IF; - - __IO uint32_t IM; //Interrupt Mask - - __IO uint32_t IRS; //Interrupt Raw Stat + __IO uint32_t ADTRG5B; + + uint32_t RESERVED[3]; + + __IO uint32_t HALT; //刹车控制 + + __IO uint32_t CHEN; + + __IO uint32_t IE; + + __IO uint32_t IF; + + __IO uint32_t IM; //Interrupt Mask + + __IO uint32_t IRS; //Interrupt Raw Stat } PWMG_TypeDef; -#define PWMG_FORCEH_PWM0_Pos 0 -#define PWMG_FORCEH_PWM0_Msk (0x01 << PWMG_FORCEH_PWM0_Pos) -#define PWMG_FORCEH_PWM1_Pos 1 -#define PWMG_FORCEH_PWM1_Msk (0x01 << PWMG_FORCEH_PWM1_Pos) -#define PWMG_FORCEH_PWM2_Pos 2 -#define PWMG_FORCEH_PWM2_Msk (0x01 << PWMG_FORCEH_PWM2_Pos) -#define PWMG_FORCEH_PWM3_Pos 3 -#define PWMG_FORCEH_PWM3_Msk (0x01 << PWMG_FORCEH_PWM3_Pos) -#define PWMG_FORCEH_PWM4_Pos 4 -#define PWMG_FORCEH_PWM4_Msk (0x01 << PWMG_FORCEH_PWM4_Pos) -#define PWMG_FORCEH_PWM5_Pos 5 -#define PWMG_FORCEH_PWM5_Msk (0x01 << PWMG_FORCEH_PWM5_Pos) -#define PWMG_ADTRG_VALUE_Pos 0 -#define PWMG_ADTRG_VALUE_Msk (0xFFFF << PWMG_ADTRG0A_VALUE_Pos) -#define PWMG_ADTRG_EVEN_Pos 16 //1 鍋舵暟鍛ㄦ湡鐢熸晥 0 濂囨暟鍛ㄦ湡鐢熸晥 -#define PWMG_ADTRG_EVEN_Msk (0x01 << PWMG_ADTRG0A_EVEN_Pos) -#define PWMG_ADTRG_EN_Pos 17 -#define PWMG_ADTRG_EN_Msk (0x01 << PWMG_ADTRG0A_EN_Pos) +#define PWMG_FORCEH_PWM0_Pos 0 +#define PWMG_FORCEH_PWM0_Msk (0x01 << PWMG_FORCEH_PWM0_Pos) +#define PWMG_FORCEH_PWM1_Pos 1 +#define PWMG_FORCEH_PWM1_Msk (0x01 << PWMG_FORCEH_PWM1_Pos) +#define PWMG_FORCEH_PWM2_Pos 2 +#define PWMG_FORCEH_PWM2_Msk (0x01 << PWMG_FORCEH_PWM2_Pos) +#define PWMG_FORCEH_PWM3_Pos 3 +#define PWMG_FORCEH_PWM3_Msk (0x01 << PWMG_FORCEH_PWM3_Pos) +#define PWMG_FORCEH_PWM4_Pos 4 +#define PWMG_FORCEH_PWM4_Msk (0x01 << PWMG_FORCEH_PWM4_Pos) +#define PWMG_FORCEH_PWM5_Pos 5 +#define PWMG_FORCEH_PWM5_Msk (0x01 << PWMG_FORCEH_PWM5_Pos) -#define PWMG_HALT_EN_Pos 0 -#define PWMG_HALT_EN_Msk (0x01 << PWMG_HALT_EN_Pos) -#define PWMG_HALT_PWM0_Pos 1 -#define PWMG_HALT_PWM0_Msk (0x01 << PWMG_HALT_PWM0_Pos) -#define PWMG_HALT_PWM1_Pos 2 -#define PWMG_HALT_PWM1_Msk (0x01 << PWMG_HALT_PWM1_Pos) -#define PWMG_HALT_PWM2_Pos 3 -#define PWMG_HALT_PWM2_Msk (0x01 << PWMG_HALT_PWM2_Pos) -#define PWMG_HALT_PWM3_Pos 4 -#define PWMG_HALT_PWM3_Msk (0x01 << PWMG_HALT_PWM3_Pos) -#define PWMG_HALT_PWM4_Pos 5 -#define PWMG_HALT_PWM4_Msk (0x01 << PWMG_HALT_PWM4_Pos) -#define PWMG_HALT_PWM5_Pos 6 -#define PWMG_HALT_PWM5_Msk (0x01 << PWMG_HALT_PWM5_Pos) -#define PWMG_HALT_STOPCNT_Pos 7 //1 鍒硅溅鏃跺皢PWM璁℃暟鍣ㄦ竻闆讹紝鍋滄璁℃暟 0 鍒硅溅鏃讹紝PWM璁℃暟鍣ㄧ户缁鏁 -#define PWMG_HALT_STOPCNT_Msk (0x01 << PWMG_HALT_STOPCNT_Pos) -#define PWMG_HALT_INLVL_Pos 8 //1 鍒硅溅杈撳叆楂樼數骞虫湁鏁 -#define PWMG_HALT_INLVL_Msk (0x01 << PWMG_HALT_INLVL_Pos) -#define PWMG_HALT_OUTLVL_Pos 9 //1 鍒硅溅杩囩▼涓緭鍑洪珮鐢靛钩 -#define PWMG_HALT_OUTLVL_Msk (0x01 << PWMG_HALT_OUTLVL_Pos) -#define PWMG_HALT_STAT_Pos 10 //1 姝e湪鍒硅溅 -#define PWMG_HALT_STAT_Msk (0x01 << PWMG_HALT_STAT_Pos) +#define PWMG_ADTRG_VALUE_Pos 0 +#define PWMG_ADTRG_VALUE_Msk (0xFFFF << PWMG_ADTRG0A_VALUE_Pos) +#define PWMG_ADTRG_EVEN_Pos 16 //1 偶数周期生效 0 奇数周期生效 +#define PWMG_ADTRG_EVEN_Msk (0x01 << PWMG_ADTRG0A_EVEN_Pos) +#define PWMG_ADTRG_EN_Pos 17 +#define PWMG_ADTRG_EN_Msk (0x01 << PWMG_ADTRG0A_EN_Pos) -#define PWMG_CHEN_PWM0A_Pos 0 -#define PWMG_CHEN_PWM0A_Msk (0x01 << PWMG_CHEN_PWM0A_Pos) -#define PWMG_CHEN_PWM0B_Pos 1 -#define PWMG_CHEN_PWM0B_Msk (0x01 << PWMG_CHEN_PWM0B_Pos) -#define PWMG_CHEN_PWM1A_Pos 2 -#define PWMG_CHEN_PWM1A_Msk (0x01 << PWMG_CHEN_PWM1A_Pos) -#define PWMG_CHEN_PWM1B_Pos 3 -#define PWMG_CHEN_PWM1B_Msk (0x01 << PWMG_CHEN_PWM1B_Pos) -#define PWMG_CHEN_PWM2A_Pos 4 -#define PWMG_CHEN_PWM2A_Msk (0x01 << PWMG_CHEN_PWM2A_Pos) -#define PWMG_CHEN_PWM2B_Pos 5 -#define PWMG_CHEN_PWM2B_Msk (0x01 << PWMG_CHEN_PWM2B_Pos) -#define PWMG_CHEN_PWM3A_Pos 6 -#define PWMG_CHEN_PWM3A_Msk (0x01 << PWMG_CHEN_PWM3A_Pos) -#define PWMG_CHEN_PWM3B_Pos 7 -#define PWMG_CHEN_PWM3B_Msk (0x01 << PWMG_CHEN_PWM3B_Pos) -#define PWMG_CHEN_PWM4A_Pos 8 -#define PWMG_CHEN_PWM4A_Msk (0x01 << PWMG_CHEN_PWM4A_Pos) -#define PWMG_CHEN_PWM4B_Pos 9 -#define PWMG_CHEN_PWM4B_Msk (0x01 << PWMG_CHEN_PWM4B_Pos) -#define PWMG_CHEN_PWM5A_Pos 10 -#define PWMG_CHEN_PWM5A_Msk (0x01 << PWMG_CHEN_PWM5A_Pos) -#define PWMG_CHEN_PWM5B_Pos 11 -#define PWMG_CHEN_PWM5B_Msk (0x01 << PWMG_CHEN_PWM5B_Pos) +#define PWMG_HALT_EN_Pos 0 +#define PWMG_HALT_EN_Msk (0x01 << PWMG_HALT_EN_Pos) +#define PWMG_HALT_PWM0_Pos 1 +#define PWMG_HALT_PWM0_Msk (0x01 << PWMG_HALT_PWM0_Pos) +#define PWMG_HALT_PWM1_Pos 2 +#define PWMG_HALT_PWM1_Msk (0x01 << PWMG_HALT_PWM1_Pos) +#define PWMG_HALT_PWM2_Pos 3 +#define PWMG_HALT_PWM2_Msk (0x01 << PWMG_HALT_PWM2_Pos) +#define PWMG_HALT_PWM3_Pos 4 +#define PWMG_HALT_PWM3_Msk (0x01 << PWMG_HALT_PWM3_Pos) +#define PWMG_HALT_PWM4_Pos 5 +#define PWMG_HALT_PWM4_Msk (0x01 << PWMG_HALT_PWM4_Pos) +#define PWMG_HALT_PWM5_Pos 6 +#define PWMG_HALT_PWM5_Msk (0x01 << PWMG_HALT_PWM5_Pos) +#define PWMG_HALT_STOPCNT_Pos 7 //1 刹车时将PWM计数器清零,停止计数 0 刹车时,PWM计数器继续计数 +#define PWMG_HALT_STOPCNT_Msk (0x01 << PWMG_HALT_STOPCNT_Pos) +#define PWMG_HALT_INLVL_Pos 8 //1 刹车输入高电平有效 +#define PWMG_HALT_INLVL_Msk (0x01 << PWMG_HALT_INLVL_Pos) +#define PWMG_HALT_OUTLVL_Pos 9 //1 刹车过程中输出高电平 +#define PWMG_HALT_OUTLVL_Msk (0x01 << PWMG_HALT_OUTLVL_Pos) +#define PWMG_HALT_STAT_Pos 10 //1 正在刹车 +#define PWMG_HALT_STAT_Msk (0x01 << PWMG_HALT_STAT_Pos) -#define PWMG_IE_NEWP0A_Pos 0 -#define PWMG_IE_NEWP0A_Msk (0x01 << PWMG_IE_NEWP0A_Pos) -#define PWMG_IE_NEWP0B_Pos 1 -#define PWMG_IE_NEWP0B_Msk (0x01 << PWMG_IE_NEWP0B_Pos) -#define PWMG_IE_NEWP1A_Pos 2 -#define PWMG_IE_NEWP1A_Msk (0x01 << PWMG_IE_NEWP1A_Pos) -#define PWMG_IE_NEWP1B_Pos 3 -#define PWMG_IE_NEWP1B_Msk (0x01 << PWMG_IE_NEWP1B_Pos) -#define PWMG_IE_NEWP2A_Pos 4 -#define PWMG_IE_NEWP2A_Msk (0x01 << PWMG_IE_NEWP2A_Pos) -#define PWMG_IE_NEWP2B_Pos 5 -#define PWMG_IE_NEWP2B_Msk (0x01 << PWMG_IE_NEWP2B_Pos) -#define PWMG_IE_NEWP3A_Pos 6 -#define PWMG_IE_NEWP3A_Msk (0x01 << PWMG_IE_NEWP3A_Pos) -#define PWMG_IE_NEWP3B_Pos 7 -#define PWMG_IE_NEWP3B_Msk (0x01 << PWMG_IE_NEWP3B_Pos) -#define PWMG_IE_NEWP4A_Pos 8 -#define PWMG_IE_NEWP4A_Msk (0x01 << PWMG_IE_NEWP4A_Pos) -#define PWMG_IE_NEWP4B_Pos 9 -#define PWMG_IE_NEWP4B_Msk (0x01 << PWMG_IE_NEWP4B_Pos) -#define PWMG_IE_NEWP5A_Pos 10 -#define PWMG_IE_NEWP5A_Msk (0x01 << PWMG_IE_NEWP5A_Pos) -#define PWMG_IE_NEWP5B_Pos 11 -#define PWMG_IE_NEWP5B_Msk (0x01 << PWMG_IE_NEWP5B_Pos) -#define PWMG_IE_HEND0A_Pos 12 -#define PWMG_IE_HEND0A_Msk (0x01 << PWMG_IE_HEND0A_Pos) -#define PWMG_IE_HEND0B_Pos 13 -#define PWMG_IE_HEND0B_Msk (0x01 << PWMG_IE_HEND0B_Pos) -#define PWMG_IE_HEND1A_Pos 14 -#define PWMG_IE_HEND1A_Msk (0x01 << PWMG_IE_HEND1A_Pos) -#define PWMG_IE_HEND1B_Pos 15 -#define PWMG_IE_HEND1B_Msk (0x01 << PWMG_IE_HEND1B_Pos) -#define PWMG_IE_HEND2A_Pos 16 -#define PWMG_IE_HEND2A_Msk (0x01 << PWMG_IE_HEND2A_Pos) -#define PWMG_IE_HEND2B_Pos 17 -#define PWMG_IE_HEND2B_Msk (0x01 << PWMG_IE_HEND2B_Pos) -#define PWMG_IE_HEND3A_Pos 18 -#define PWMG_IE_HEND3A_Msk (0x01 << PWMG_IE_HEND3A_Pos) -#define PWMG_IE_HEND3B_Pos 19 -#define PWMG_IE_HEND3B_Msk (0x01 << PWMG_IE_HEND3B_Pos) -#define PWMG_IE_HEND4A_Pos 20 -#define PWMG_IE_HEND4A_Msk (0x01 << PWMG_IE_HEND4A_Pos) -#define PWMG_IE_HEND4B_Pos 21 -#define PWMG_IE_HEND4B_Msk (0x01 << PWMG_IE_HEND4B_Pos) -#define PWMG_IE_HEND5A_Pos 22 -#define PWMG_IE_HEND5A_Msk (0x01 << PWMG_IE_HEND5A_Pos) -#define PWMG_IE_HEND5B_Pos 23 -#define PWMG_IE_HEND5B_Msk (0x01 << PWMG_IE_HEND5B_Pos) -#define PWMG_IE_HALT_Pos 24 -#define PWMG_IE_HALT_Msk (0x01 << PWMG_IE_HALT_Pos) +#define PWMG_CHEN_PWM0A_Pos 0 +#define PWMG_CHEN_PWM0A_Msk (0x01 << PWMG_CHEN_PWM0A_Pos) +#define PWMG_CHEN_PWM0B_Pos 1 +#define PWMG_CHEN_PWM0B_Msk (0x01 << PWMG_CHEN_PWM0B_Pos) +#define PWMG_CHEN_PWM1A_Pos 2 +#define PWMG_CHEN_PWM1A_Msk (0x01 << PWMG_CHEN_PWM1A_Pos) +#define PWMG_CHEN_PWM1B_Pos 3 +#define PWMG_CHEN_PWM1B_Msk (0x01 << PWMG_CHEN_PWM1B_Pos) +#define PWMG_CHEN_PWM2A_Pos 4 +#define PWMG_CHEN_PWM2A_Msk (0x01 << PWMG_CHEN_PWM2A_Pos) +#define PWMG_CHEN_PWM2B_Pos 5 +#define PWMG_CHEN_PWM2B_Msk (0x01 << PWMG_CHEN_PWM2B_Pos) +#define PWMG_CHEN_PWM3A_Pos 6 +#define PWMG_CHEN_PWM3A_Msk (0x01 << PWMG_CHEN_PWM3A_Pos) +#define PWMG_CHEN_PWM3B_Pos 7 +#define PWMG_CHEN_PWM3B_Msk (0x01 << PWMG_CHEN_PWM3B_Pos) +#define PWMG_CHEN_PWM4A_Pos 8 +#define PWMG_CHEN_PWM4A_Msk (0x01 << PWMG_CHEN_PWM4A_Pos) +#define PWMG_CHEN_PWM4B_Pos 9 +#define PWMG_CHEN_PWM4B_Msk (0x01 << PWMG_CHEN_PWM4B_Pos) +#define PWMG_CHEN_PWM5A_Pos 10 +#define PWMG_CHEN_PWM5A_Msk (0x01 << PWMG_CHEN_PWM5A_Pos) +#define PWMG_CHEN_PWM5B_Pos 11 +#define PWMG_CHEN_PWM5B_Msk (0x01 << PWMG_CHEN_PWM5B_Pos) -#define PWMG_IF_NEWP0A_Pos 0 -#define PWMG_IF_NEWP0A_Msk (0x01 << PWMG_IF_NEWP0A_Pos) -#define PWMG_IF_NEWP0B_Pos 1 -#define PWMG_IF_NEWP0B_Msk (0x01 << PWMG_IF_NEWP0B_Pos) -#define PWMG_IF_NEWP1A_Pos 2 -#define PWMG_IF_NEWP1A_Msk (0x01 << PWMG_IF_NEWP1A_Pos) -#define PWMG_IF_NEWP1B_Pos 3 -#define PWMG_IF_NEWP1B_Msk (0x01 << PWMG_IF_NEWP1B_Pos) -#define PWMG_IF_NEWP2A_Pos 4 -#define PWMG_IF_NEWP2A_Msk (0x01 << PWMG_IF_NEWP2A_Pos) -#define PWMG_IF_NEWP2B_Pos 5 -#define PWMG_IF_NEWP2B_Msk (0x01 << PWMG_IF_NEWP2B_Pos) -#define PWMG_IF_NEWP3A_Pos 6 -#define PWMG_IF_NEWP3A_Msk (0x01 << PWMG_IF_NEWP3A_Pos) -#define PWMG_IF_NEWP3B_Pos 7 -#define PWMG_IF_NEWP3B_Msk (0x01 << PWMG_IF_NEWP3B_Pos) -#define PWMG_IF_NEWP4A_Pos 8 -#define PWMG_IF_NEWP4A_Msk (0x01 << PWMG_IF_NEWP4A_Pos) -#define PWMG_IF_NEWP4B_Pos 9 -#define PWMG_IF_NEWP4B_Msk (0x01 << PWMG_IF_NEWP4B_Pos) -#define PWMG_IF_NEWP5A_Pos 10 -#define PWMG_IF_NEWP5A_Msk (0x01 << PWMG_IF_NEWP5A_Pos) -#define PWMG_IF_NEWP5B_Pos 11 -#define PWMG_IF_NEWP5B_Msk (0x01 << PWMG_IF_NEWP5B_Pos) -#define PWMG_IF_HEND0A_Pos 12 -#define PWMG_IF_HEND0A_Msk (0x01 << PWMG_IF_HEND0A_Pos) -#define PWMG_IF_HEND0B_Pos 13 -#define PWMG_IF_HEND0B_Msk (0x01 << PWMG_IF_HEND0B_Pos) -#define PWMG_IF_HEND1A_Pos 14 -#define PWMG_IF_HEND1A_Msk (0x01 << PWMG_IF_HEND1A_Pos) -#define PWMG_IF_HEND1B_Pos 15 -#define PWMG_IF_HEND1B_Msk (0x01 << PWMG_IF_HEND1B_Pos) -#define PWMG_IF_HEND2A_Pos 16 -#define PWMG_IF_HEND2A_Msk (0x01 << PWMG_IF_HEND2A_Pos) -#define PWMG_IF_HEND2B_Pos 17 -#define PWMG_IF_HEND2B_Msk (0x01 << PWMG_IF_HEND2B_Pos) -#define PWMG_IF_HEND3A_Pos 18 -#define PWMG_IF_HEND3A_Msk (0x01 << PWMG_IF_HEND3A_Pos) -#define PWMG_IF_HEND3B_Pos 19 -#define PWMG_IF_HEND3B_Msk (0x01 << PWMG_IF_HEND3B_Pos) -#define PWMG_IF_HEND4A_Pos 20 -#define PWMG_IF_HEND4A_Msk (0x01 << PWMG_IF_HEND4A_Pos) -#define PWMG_IF_HEND4B_Pos 21 -#define PWMG_IF_HEND4B_Msk (0x01 << PWMG_IF_HEND4B_Pos) -#define PWMG_IF_HEND5A_Pos 22 -#define PWMG_IF_HEND5A_Msk (0x01 << PWMG_IF_HEND5A_Pos) -#define PWMG_IF_HEND5B_Pos 23 -#define PWMG_IF_HEND5B_Msk (0x01 << PWMG_IF_HEND5B_Pos) -#define PWMG_IF_HALT_Pos 24 -#define PWMG_IF_HALT_Msk (0x01 << PWMG_IF_HALT_Pos) -#define PWMG_IM_NEWP0A_Pos 0 //Interrupt Mask -#define PWMG_IM_NEWP0A_Msk (0x01 << PWMG_IM_NEWP0A_Pos) -#define PWMG_IM_NEWP0B_Pos 1 -#define PWMG_IM_NEWP0B_Msk (0x01 << PWMG_IM_NEWP0B_Pos) -#define PWMG_IM_NEWP1A_Pos 2 -#define PWMG_IM_NEWP1A_Msk (0x01 << PWMG_IM_NEWP1A_Pos) -#define PWMG_IM_NEWP1B_Pos 3 -#define PWMG_IM_NEWP1B_Msk (0x01 << PWMG_IM_NEWP1B_Pos) -#define PWMG_IM_NEWP2A_Pos 4 -#define PWMG_IM_NEWP2A_Msk (0x01 << PWMG_IM_NEWP2A_Pos) -#define PWMG_IM_NEWP2B_Pos 5 -#define PWMG_IM_NEWP2B_Msk (0x01 << PWMG_IM_NEWP2B_Pos) -#define PWMG_IM_NEWP3A_Pos 6 -#define PWMG_IM_NEWP3A_Msk (0x01 << PWMG_IM_NEWP3A_Pos) -#define PWMG_IM_NEWP3B_Pos 7 -#define PWMG_IM_NEWP3B_Msk (0x01 << PWMG_IM_NEWP3B_Pos) -#define PWMG_IM_NEWP4A_Pos 8 -#define PWMG_IM_NEWP4A_Msk (0x01 << PWMG_IM_NEWP4A_Pos) -#define PWMG_IM_NEWP4B_Pos 9 -#define PWMG_IM_NEWP4B_Msk (0x01 << PWMG_IM_NEWP4B_Pos) -#define PWMG_IM_NEWP5A_Pos 10 -#define PWMG_IM_NEWP5A_Msk (0x01 << PWMG_IM_NEWP5A_Pos) -#define PWMG_IM_NEWP5B_Pos 11 -#define PWMG_IM_NEWP5B_Msk (0x01 << PWMG_IM_NEWP5B_Pos) -#define PWMG_IM_HEND0A_Pos 12 -#define PWMG_IM_HEND0A_Msk (0x01 << PWMG_IM_HEND0A_Pos) -#define PWMG_IM_HEND0B_Pos 13 -#define PWMG_IM_HEND0B_Msk (0x01 << PWMG_IM_HEND0B_Pos) -#define PWMG_IM_HEND1A_Pos 14 -#define PWMG_IM_HEND1A_Msk (0x01 << PWMG_IM_HEND1A_Pos) -#define PWMG_IM_HEND1B_Pos 15 -#define PWMG_IM_HEND1B_Msk (0x01 << PWMG_IM_HEND1B_Pos) -#define PWMG_IM_HEND2A_Pos 16 -#define PWMG_IM_HEND2A_Msk (0x01 << PWMG_IM_HEND2A_Pos) -#define PWMG_IM_HEND2B_Pos 17 -#define PWMG_IM_HEND2B_Msk (0x01 << PWMG_IM_HEND2B_Pos) -#define PWMG_IM_HEND3A_Pos 18 -#define PWMG_IM_HEND3A_Msk (0x01 << PWMG_IM_HEND3A_Pos) -#define PWMG_IM_HEND3B_Pos 19 -#define PWMG_IM_HEND3B_Msk (0x01 << PWMG_IM_HEND3B_Pos) -#define PWMG_IM_HEND4A_Pos 20 -#define PWMG_IM_HEND4A_Msk (0x01 << PWMG_IM_HEND4A_Pos) -#define PWMG_IM_HEND4B_Pos 21 -#define PWMG_IM_HEND4B_Msk (0x01 << PWMG_IM_HEND4B_Pos) -#define PWMG_IM_HEND5A_Pos 22 -#define PWMG_IM_HEND5A_Msk (0x01 << PWMG_IM_HEND5A_Pos) -#define PWMG_IM_HEND5B_Pos 23 -#define PWMG_IM_HEND5B_Msk (0x01 << PWMG_IM_HEND5B_Pos) -#define PWMG_IM_HALT_Pos 24 -#define PWMG_IM_HALT_Msk (0x01 << PWMG_IM_HALT_Pos) +#define PWMG_IE_NEWP0A_Pos 0 +#define PWMG_IE_NEWP0A_Msk (0x01 << PWMG_IE_NEWP0A_Pos) +#define PWMG_IE_NEWP0B_Pos 1 +#define PWMG_IE_NEWP0B_Msk (0x01 << PWMG_IE_NEWP0B_Pos) +#define PWMG_IE_NEWP1A_Pos 2 +#define PWMG_IE_NEWP1A_Msk (0x01 << PWMG_IE_NEWP1A_Pos) +#define PWMG_IE_NEWP1B_Pos 3 +#define PWMG_IE_NEWP1B_Msk (0x01 << PWMG_IE_NEWP1B_Pos) +#define PWMG_IE_NEWP2A_Pos 4 +#define PWMG_IE_NEWP2A_Msk (0x01 << PWMG_IE_NEWP2A_Pos) +#define PWMG_IE_NEWP2B_Pos 5 +#define PWMG_IE_NEWP2B_Msk (0x01 << PWMG_IE_NEWP2B_Pos) +#define PWMG_IE_NEWP3A_Pos 6 +#define PWMG_IE_NEWP3A_Msk (0x01 << PWMG_IE_NEWP3A_Pos) +#define PWMG_IE_NEWP3B_Pos 7 +#define PWMG_IE_NEWP3B_Msk (0x01 << PWMG_IE_NEWP3B_Pos) +#define PWMG_IE_NEWP4A_Pos 8 +#define PWMG_IE_NEWP4A_Msk (0x01 << PWMG_IE_NEWP4A_Pos) +#define PWMG_IE_NEWP4B_Pos 9 +#define PWMG_IE_NEWP4B_Msk (0x01 << PWMG_IE_NEWP4B_Pos) +#define PWMG_IE_NEWP5A_Pos 10 +#define PWMG_IE_NEWP5A_Msk (0x01 << PWMG_IE_NEWP5A_Pos) +#define PWMG_IE_NEWP5B_Pos 11 +#define PWMG_IE_NEWP5B_Msk (0x01 << PWMG_IE_NEWP5B_Pos) +#define PWMG_IE_HEND0A_Pos 12 +#define PWMG_IE_HEND0A_Msk (0x01 << PWMG_IE_HEND0A_Pos) +#define PWMG_IE_HEND0B_Pos 13 +#define PWMG_IE_HEND0B_Msk (0x01 << PWMG_IE_HEND0B_Pos) +#define PWMG_IE_HEND1A_Pos 14 +#define PWMG_IE_HEND1A_Msk (0x01 << PWMG_IE_HEND1A_Pos) +#define PWMG_IE_HEND1B_Pos 15 +#define PWMG_IE_HEND1B_Msk (0x01 << PWMG_IE_HEND1B_Pos) +#define PWMG_IE_HEND2A_Pos 16 +#define PWMG_IE_HEND2A_Msk (0x01 << PWMG_IE_HEND2A_Pos) +#define PWMG_IE_HEND2B_Pos 17 +#define PWMG_IE_HEND2B_Msk (0x01 << PWMG_IE_HEND2B_Pos) +#define PWMG_IE_HEND3A_Pos 18 +#define PWMG_IE_HEND3A_Msk (0x01 << PWMG_IE_HEND3A_Pos) +#define PWMG_IE_HEND3B_Pos 19 +#define PWMG_IE_HEND3B_Msk (0x01 << PWMG_IE_HEND3B_Pos) +#define PWMG_IE_HEND4A_Pos 20 +#define PWMG_IE_HEND4A_Msk (0x01 << PWMG_IE_HEND4A_Pos) +#define PWMG_IE_HEND4B_Pos 21 +#define PWMG_IE_HEND4B_Msk (0x01 << PWMG_IE_HEND4B_Pos) +#define PWMG_IE_HEND5A_Pos 22 +#define PWMG_IE_HEND5A_Msk (0x01 << PWMG_IE_HEND5A_Pos) +#define PWMG_IE_HEND5B_Pos 23 +#define PWMG_IE_HEND5B_Msk (0x01 << PWMG_IE_HEND5B_Pos) +#define PWMG_IE_HALT_Pos 24 +#define PWMG_IE_HALT_Msk (0x01 << PWMG_IE_HALT_Pos) -#define PWMG_IRS_NEWP0A_Pos 0 //Interrupt Raw State -#define PWMG_IRS_NEWP0A_Msk (0x01 << PWMG_IRS_NEWP0A_Pos) -#define PWMG_IRS_NEWP0B_Pos 1 -#define PWMG_IRS_NEWP0B_Msk (0x01 << PWMG_IRS_NEWP0B_Pos) -#define PWMG_IRS_NEWP1A_Pos 2 -#define PWMG_IRS_NEWP1A_Msk (0x01 << PWMG_IRS_NEWP1A_Pos) -#define PWMG_IRS_NEWP1B_Pos 3 -#define PWMG_IRS_NEWP1B_Msk (0x01 << PWMG_IRS_NEWP1B_Pos) -#define PWMG_IRS_NEWP2A_Pos 4 -#define PWMG_IRS_NEWP2A_Msk (0x01 << PWMG_IRS_NEWP2A_Pos) -#define PWMG_IRS_NEWP2B_Pos 5 -#define PWMG_IRS_NEWP2B_Msk (0x01 << PWMG_IRS_NEWP2B_Pos) -#define PWMG_IRS_NEWP3A_Pos 6 -#define PWMG_IRS_NEWP3A_Msk (0x01 << PWMG_IRS_NEWP3A_Pos) -#define PWMG_IRS_NEWP3B_Pos 7 -#define PWMG_IRS_NEWP3B_Msk (0x01 << PWMG_IRS_NEWP3B_Pos) -#define PWMG_IRS_NEWP4A_Pos 8 -#define PWMG_IRS_NEWP4A_Msk (0x01 << PWMG_IRS_NEWP4A_Pos) -#define PWMG_IRS_NEWP4B_Pos 9 -#define PWMG_IRS_NEWP4B_Msk (0x01 << PWMG_IRS_NEWP4B_Pos) -#define PWMG_IRS_NEWP5A_Pos 10 -#define PWMG_IRS_NEWP5A_Msk (0x01 << PWMG_IRS_NEWP5A_Pos) -#define PWMG_IRS_NEWP5B_Pos 11 -#define PWMG_IRS_NEWP5B_Msk (0x01 << PWMG_IRS_NEWP5B_Pos) -#define PWMG_IRS_HEND0A_Pos 12 -#define PWMG_IRS_HEND0A_Msk (0x01 << PWMG_IRS_HEND0A_Pos) -#define PWMG_IRS_HEND0B_Pos 13 -#define PWMG_IRS_HEND0B_Msk (0x01 << PWMG_IRS_HEND0B_Pos) -#define PWMG_IRS_HEND1A_Pos 14 -#define PWMG_IRS_HEND1A_Msk (0x01 << PWMG_IRS_HEND1A_Pos) -#define PWMG_IRS_HEND1B_Pos 15 -#define PWMG_IRS_HEND1B_Msk (0x01 << PWMG_IRS_HEND1B_Pos) -#define PWMG_IRS_HEND2A_Pos 16 -#define PWMG_IRS_HEND2A_Msk (0x01 << PWMG_IRS_HEND2A_Pos) -#define PWMG_IRS_HEND2B_Pos 17 -#define PWMG_IRS_HEND2B_Msk (0x01 << PWMG_IRS_HEND2B_Pos) -#define PWMG_IRS_HEND3A_Pos 18 -#define PWMG_IRS_HEND3A_Msk (0x01 << PWMG_IRS_HEND3A_Pos) -#define PWMG_IRS_HEND3B_Pos 19 -#define PWMG_IRS_HEND3B_Msk (0x01 << PWMG_IRS_HEND3B_Pos) -#define PWMG_IRS_HEND4A_Pos 20 -#define PWMG_IRS_HEND4A_Msk (0x01 << PWMG_IRS_HEND4A_Pos) -#define PWMG_IRS_HEND4B_Pos 21 -#define PWMG_IRS_HEND4B_Msk (0x01 << PWMG_IRS_HEND4B_Pos) -#define PWMG_IRS_HEND5A_Pos 22 -#define PWMG_IRS_HEND5A_Msk (0x01 << PWMG_IRS_HEND5A_Pos) -#define PWMG_IRS_HEND5B_Pos 23 -#define PWMG_IRS_HEND5B_Msk (0x01 << PWMG_IRS_HEND5B_Pos) -#define PWMG_IRS_HALT_Pos 24 -#define PWMG_IRS_HALT_Msk (0x01 << PWMG_IRS_HALT_Pos) +#define PWMG_IF_NEWP0A_Pos 0 +#define PWMG_IF_NEWP0A_Msk (0x01 << PWMG_IF_NEWP0A_Pos) +#define PWMG_IF_NEWP0B_Pos 1 +#define PWMG_IF_NEWP0B_Msk (0x01 << PWMG_IF_NEWP0B_Pos) +#define PWMG_IF_NEWP1A_Pos 2 +#define PWMG_IF_NEWP1A_Msk (0x01 << PWMG_IF_NEWP1A_Pos) +#define PWMG_IF_NEWP1B_Pos 3 +#define PWMG_IF_NEWP1B_Msk (0x01 << PWMG_IF_NEWP1B_Pos) +#define PWMG_IF_NEWP2A_Pos 4 +#define PWMG_IF_NEWP2A_Msk (0x01 << PWMG_IF_NEWP2A_Pos) +#define PWMG_IF_NEWP2B_Pos 5 +#define PWMG_IF_NEWP2B_Msk (0x01 << PWMG_IF_NEWP2B_Pos) +#define PWMG_IF_NEWP3A_Pos 6 +#define PWMG_IF_NEWP3A_Msk (0x01 << PWMG_IF_NEWP3A_Pos) +#define PWMG_IF_NEWP3B_Pos 7 +#define PWMG_IF_NEWP3B_Msk (0x01 << PWMG_IF_NEWP3B_Pos) +#define PWMG_IF_NEWP4A_Pos 8 +#define PWMG_IF_NEWP4A_Msk (0x01 << PWMG_IF_NEWP4A_Pos) +#define PWMG_IF_NEWP4B_Pos 9 +#define PWMG_IF_NEWP4B_Msk (0x01 << PWMG_IF_NEWP4B_Pos) +#define PWMG_IF_NEWP5A_Pos 10 +#define PWMG_IF_NEWP5A_Msk (0x01 << PWMG_IF_NEWP5A_Pos) +#define PWMG_IF_NEWP5B_Pos 11 +#define PWMG_IF_NEWP5B_Msk (0x01 << PWMG_IF_NEWP5B_Pos) +#define PWMG_IF_HEND0A_Pos 12 +#define PWMG_IF_HEND0A_Msk (0x01 << PWMG_IF_HEND0A_Pos) +#define PWMG_IF_HEND0B_Pos 13 +#define PWMG_IF_HEND0B_Msk (0x01 << PWMG_IF_HEND0B_Pos) +#define PWMG_IF_HEND1A_Pos 14 +#define PWMG_IF_HEND1A_Msk (0x01 << PWMG_IF_HEND1A_Pos) +#define PWMG_IF_HEND1B_Pos 15 +#define PWMG_IF_HEND1B_Msk (0x01 << PWMG_IF_HEND1B_Pos) +#define PWMG_IF_HEND2A_Pos 16 +#define PWMG_IF_HEND2A_Msk (0x01 << PWMG_IF_HEND2A_Pos) +#define PWMG_IF_HEND2B_Pos 17 +#define PWMG_IF_HEND2B_Msk (0x01 << PWMG_IF_HEND2B_Pos) +#define PWMG_IF_HEND3A_Pos 18 +#define PWMG_IF_HEND3A_Msk (0x01 << PWMG_IF_HEND3A_Pos) +#define PWMG_IF_HEND3B_Pos 19 +#define PWMG_IF_HEND3B_Msk (0x01 << PWMG_IF_HEND3B_Pos) +#define PWMG_IF_HEND4A_Pos 20 +#define PWMG_IF_HEND4A_Msk (0x01 << PWMG_IF_HEND4A_Pos) +#define PWMG_IF_HEND4B_Pos 21 +#define PWMG_IF_HEND4B_Msk (0x01 << PWMG_IF_HEND4B_Pos) +#define PWMG_IF_HEND5A_Pos 22 +#define PWMG_IF_HEND5A_Msk (0x01 << PWMG_IF_HEND5A_Pos) +#define PWMG_IF_HEND5B_Pos 23 +#define PWMG_IF_HEND5B_Msk (0x01 << PWMG_IF_HEND5B_Pos) +#define PWMG_IF_HALT_Pos 24 +#define PWMG_IF_HALT_Msk (0x01 << PWMG_IF_HALT_Pos) -typedef struct -{ - __IO uint32_t EN; //[0] ENABLE +#define PWMG_IM_NEWP0A_Pos 0 //Interrupt Mask +#define PWMG_IM_NEWP0A_Msk (0x01 << PWMG_IM_NEWP0A_Pos) +#define PWMG_IM_NEWP0B_Pos 1 +#define PWMG_IM_NEWP0B_Msk (0x01 << PWMG_IM_NEWP0B_Pos) +#define PWMG_IM_NEWP1A_Pos 2 +#define PWMG_IM_NEWP1A_Msk (0x01 << PWMG_IM_NEWP1A_Pos) +#define PWMG_IM_NEWP1B_Pos 3 +#define PWMG_IM_NEWP1B_Msk (0x01 << PWMG_IM_NEWP1B_Pos) +#define PWMG_IM_NEWP2A_Pos 4 +#define PWMG_IM_NEWP2A_Msk (0x01 << PWMG_IM_NEWP2A_Pos) +#define PWMG_IM_NEWP2B_Pos 5 +#define PWMG_IM_NEWP2B_Msk (0x01 << PWMG_IM_NEWP2B_Pos) +#define PWMG_IM_NEWP3A_Pos 6 +#define PWMG_IM_NEWP3A_Msk (0x01 << PWMG_IM_NEWP3A_Pos) +#define PWMG_IM_NEWP3B_Pos 7 +#define PWMG_IM_NEWP3B_Msk (0x01 << PWMG_IM_NEWP3B_Pos) +#define PWMG_IM_NEWP4A_Pos 8 +#define PWMG_IM_NEWP4A_Msk (0x01 << PWMG_IM_NEWP4A_Pos) +#define PWMG_IM_NEWP4B_Pos 9 +#define PWMG_IM_NEWP4B_Msk (0x01 << PWMG_IM_NEWP4B_Pos) +#define PWMG_IM_NEWP5A_Pos 10 +#define PWMG_IM_NEWP5A_Msk (0x01 << PWMG_IM_NEWP5A_Pos) +#define PWMG_IM_NEWP5B_Pos 11 +#define PWMG_IM_NEWP5B_Msk (0x01 << PWMG_IM_NEWP5B_Pos) +#define PWMG_IM_HEND0A_Pos 12 +#define PWMG_IM_HEND0A_Msk (0x01 << PWMG_IM_HEND0A_Pos) +#define PWMG_IM_HEND0B_Pos 13 +#define PWMG_IM_HEND0B_Msk (0x01 << PWMG_IM_HEND0B_Pos) +#define PWMG_IM_HEND1A_Pos 14 +#define PWMG_IM_HEND1A_Msk (0x01 << PWMG_IM_HEND1A_Pos) +#define PWMG_IM_HEND1B_Pos 15 +#define PWMG_IM_HEND1B_Msk (0x01 << PWMG_IM_HEND1B_Pos) +#define PWMG_IM_HEND2A_Pos 16 +#define PWMG_IM_HEND2A_Msk (0x01 << PWMG_IM_HEND2A_Pos) +#define PWMG_IM_HEND2B_Pos 17 +#define PWMG_IM_HEND2B_Msk (0x01 << PWMG_IM_HEND2B_Pos) +#define PWMG_IM_HEND3A_Pos 18 +#define PWMG_IM_HEND3A_Msk (0x01 << PWMG_IM_HEND3A_Pos) +#define PWMG_IM_HEND3B_Pos 19 +#define PWMG_IM_HEND3B_Msk (0x01 << PWMG_IM_HEND3B_Pos) +#define PWMG_IM_HEND4A_Pos 20 +#define PWMG_IM_HEND4A_Msk (0x01 << PWMG_IM_HEND4A_Pos) +#define PWMG_IM_HEND4B_Pos 21 +#define PWMG_IM_HEND4B_Msk (0x01 << PWMG_IM_HEND4B_Pos) +#define PWMG_IM_HEND5A_Pos 22 +#define PWMG_IM_HEND5A_Msk (0x01 << PWMG_IM_HEND5A_Pos) +#define PWMG_IM_HEND5B_Pos 23 +#define PWMG_IM_HEND5B_Msk (0x01 << PWMG_IM_HEND5B_Pos) +#define PWMG_IM_HALT_Pos 24 +#define PWMG_IM_HALT_Msk (0x01 << PWMG_IM_HALT_Pos) - __IO uint32_t IE; //鍙湁涓1鏃讹紝IF[CHx]鍦―MA浼犺緭缁撴潫鏃舵墠鑳藉彉涓1锛屽惁鍒欏皢涓鐩翠繚鎸佸湪0 +#define PWMG_IRS_NEWP0A_Pos 0 //Interrupt Raw State +#define PWMG_IRS_NEWP0A_Msk (0x01 << PWMG_IRS_NEWP0A_Pos) +#define PWMG_IRS_NEWP0B_Pos 1 +#define PWMG_IRS_NEWP0B_Msk (0x01 << PWMG_IRS_NEWP0B_Pos) +#define PWMG_IRS_NEWP1A_Pos 2 +#define PWMG_IRS_NEWP1A_Msk (0x01 << PWMG_IRS_NEWP1A_Pos) +#define PWMG_IRS_NEWP1B_Pos 3 +#define PWMG_IRS_NEWP1B_Msk (0x01 << PWMG_IRS_NEWP1B_Pos) +#define PWMG_IRS_NEWP2A_Pos 4 +#define PWMG_IRS_NEWP2A_Msk (0x01 << PWMG_IRS_NEWP2A_Pos) +#define PWMG_IRS_NEWP2B_Pos 5 +#define PWMG_IRS_NEWP2B_Msk (0x01 << PWMG_IRS_NEWP2B_Pos) +#define PWMG_IRS_NEWP3A_Pos 6 +#define PWMG_IRS_NEWP3A_Msk (0x01 << PWMG_IRS_NEWP3A_Pos) +#define PWMG_IRS_NEWP3B_Pos 7 +#define PWMG_IRS_NEWP3B_Msk (0x01 << PWMG_IRS_NEWP3B_Pos) +#define PWMG_IRS_NEWP4A_Pos 8 +#define PWMG_IRS_NEWP4A_Msk (0x01 << PWMG_IRS_NEWP4A_Pos) +#define PWMG_IRS_NEWP4B_Pos 9 +#define PWMG_IRS_NEWP4B_Msk (0x01 << PWMG_IRS_NEWP4B_Pos) +#define PWMG_IRS_NEWP5A_Pos 10 +#define PWMG_IRS_NEWP5A_Msk (0x01 << PWMG_IRS_NEWP5A_Pos) +#define PWMG_IRS_NEWP5B_Pos 11 +#define PWMG_IRS_NEWP5B_Msk (0x01 << PWMG_IRS_NEWP5B_Pos) +#define PWMG_IRS_HEND0A_Pos 12 +#define PWMG_IRS_HEND0A_Msk (0x01 << PWMG_IRS_HEND0A_Pos) +#define PWMG_IRS_HEND0B_Pos 13 +#define PWMG_IRS_HEND0B_Msk (0x01 << PWMG_IRS_HEND0B_Pos) +#define PWMG_IRS_HEND1A_Pos 14 +#define PWMG_IRS_HEND1A_Msk (0x01 << PWMG_IRS_HEND1A_Pos) +#define PWMG_IRS_HEND1B_Pos 15 +#define PWMG_IRS_HEND1B_Msk (0x01 << PWMG_IRS_HEND1B_Pos) +#define PWMG_IRS_HEND2A_Pos 16 +#define PWMG_IRS_HEND2A_Msk (0x01 << PWMG_IRS_HEND2A_Pos) +#define PWMG_IRS_HEND2B_Pos 17 +#define PWMG_IRS_HEND2B_Msk (0x01 << PWMG_IRS_HEND2B_Pos) +#define PWMG_IRS_HEND3A_Pos 18 +#define PWMG_IRS_HEND3A_Msk (0x01 << PWMG_IRS_HEND3A_Pos) +#define PWMG_IRS_HEND3B_Pos 19 +#define PWMG_IRS_HEND3B_Msk (0x01 << PWMG_IRS_HEND3B_Pos) +#define PWMG_IRS_HEND4A_Pos 20 +#define PWMG_IRS_HEND4A_Msk (0x01 << PWMG_IRS_HEND4A_Pos) +#define PWMG_IRS_HEND4B_Pos 21 +#define PWMG_IRS_HEND4B_Msk (0x01 << PWMG_IRS_HEND4B_Pos) +#define PWMG_IRS_HEND5A_Pos 22 +#define PWMG_IRS_HEND5A_Msk (0x01 << PWMG_IRS_HEND5A_Pos) +#define PWMG_IRS_HEND5B_Pos 23 +#define PWMG_IRS_HEND5B_Msk (0x01 << PWMG_IRS_HEND5B_Pos) +#define PWMG_IRS_HALT_Pos 24 +#define PWMG_IRS_HALT_Msk (0x01 << PWMG_IRS_HALT_Pos) - __IO uint32_t IM; //褰撲负1鏃讹紝鍗充娇IF[CHx]涓1锛宒ma_int涔熶笉浼氬洜姝ゅ彉1 - __IO uint32_t IF; //鍐1娓呴浂 - uint32_t RESERVED[12]; - struct - { - __IO uint32_t CR; - - __IO uint32_t AM; //Adress Mode - - __IO uint32_t SRC; - - __IO uint32_t SRCSGADDR1; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t SRCSGADDR2; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t SRCSGADDR3; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t SRCSGLEN; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t DST; - - __IO uint32_t DSTSGADDR1; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t DSTSGADDR2; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t DSTSGADDR3; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - __IO uint32_t DSTSGLEN; //鍙湪Scatter Gather妯″紡涓嬩娇鐢 - - uint32_t RESERVED[4]; - } CH[3]; +typedef struct { + __IO uint32_t EN; //[0] ENABLE + + __IO uint32_t IE; //只有为1时,IF[CHx]在DMA传输结束时才能变为1,否则将一直保持在0 + + __IO uint32_t IM; //当为1时,即使IF[CHx]为1,dma_int也不会因此变1 + + __IO uint32_t IF; //写1清零 + + uint32_t RESERVED[12]; + + struct { + __IO uint32_t CR; + + __IO uint32_t AM; //Adress Mode + + __IO uint32_t SRC; + + __IO uint32_t SRCSGADDR1; //只在Scatter Gather模式下使用 + + __IO uint32_t SRCSGADDR2; //只在Scatter Gather模式下使用 + + __IO uint32_t SRCSGADDR3; //只在Scatter Gather模式下使用 + + __IO uint32_t SRCSGLEN; //只在Scatter Gather模式下使用 + + __IO uint32_t DST; + + __IO uint32_t DSTSGADDR1; //只在Scatter Gather模式下使用 + + __IO uint32_t DSTSGADDR2; //只在Scatter Gather模式下使用 + + __IO uint32_t DSTSGADDR3; //只在Scatter Gather模式下使用 + + __IO uint32_t DSTSGLEN; //只在Scatter Gather模式下使用 + + uint32_t RESERVED[4]; + } CH[3]; } DMA_TypeDef; -#define DMA_IE_CH0_Pos 0 -#define DMA_IE_CH0_Msk (0x01 << DMA_IE_CH0_Pos) -#define DMA_IE_CH1_Pos 1 -#define DMA_IE_CH1_Msk (0x01 << DMA_IE_CH1_Pos) -#define DMA_IE_CH2_Pos 2 -#define DMA_IE_CH2_Msk (0x01 << DMA_IE_CH2_Pos) -#define DMA_IE_CH3_Pos 3 -#define DMA_IE_CH3_Msk (0x01 << DMA_IE_CH3_Pos) -#define DMA_IE_CH4_Pos 4 -#define DMA_IE_CH4_Msk (0x01 << DMA_IE_CH4_Pos) -#define DMA_IE_CH5_Pos 5 -#define DMA_IE_CH5_Msk (0x01 << DMA_IE_CH5_Pos) -#define DMA_IE_CH6_Pos 6 -#define DMA_IE_CH6_Msk (0x01 << DMA_IE_CH6_Pos) -#define DMA_IE_CH7_Pos 7 -#define DMA_IE_CH7_Msk (0x01 << DMA_IE_CH7_Pos) -#define DMA_IM_CH0_Pos 0 -#define DMA_IM_CH0_Msk (0x01 << DMA_IM_CH0_Pos) -#define DMA_IM_CH1_Pos 1 -#define DMA_IM_CH1_Msk (0x01 << DMA_IM_CH1_Pos) -#define DMA_IM_CH2_Pos 2 -#define DMA_IM_CH2_Msk (0x01 << DMA_IM_CH2_Pos) -#define DMA_IM_CH3_Pos 3 -#define DMA_IM_CH3_Msk (0x01 << DMA_IM_CH3_Pos) -#define DMA_IM_CH4_Pos 4 -#define DMA_IM_CH4_Msk (0x01 << DMA_IM_CH4_Pos) -#define DMA_IM_CH5_Pos 5 -#define DMA_IM_CH5_Msk (0x01 << DMA_IM_CH5_Pos) -#define DMA_IM_CH6_Pos 6 -#define DMA_IM_CH6_Msk (0x01 << DMA_IM_CH6_Pos) -#define DMA_IM_CH7_Pos 7 -#define DMA_IM_CH7_Msk (0x01 << DMA_IM_CH7_Pos) +#define DMA_IE_CH0_Pos 0 +#define DMA_IE_CH0_Msk (0x01 << DMA_IE_CH0_Pos) +#define DMA_IE_CH1_Pos 1 +#define DMA_IE_CH1_Msk (0x01 << DMA_IE_CH1_Pos) +#define DMA_IE_CH2_Pos 2 +#define DMA_IE_CH2_Msk (0x01 << DMA_IE_CH2_Pos) +#define DMA_IE_CH3_Pos 3 +#define DMA_IE_CH3_Msk (0x01 << DMA_IE_CH3_Pos) +#define DMA_IE_CH4_Pos 4 +#define DMA_IE_CH4_Msk (0x01 << DMA_IE_CH4_Pos) +#define DMA_IE_CH5_Pos 5 +#define DMA_IE_CH5_Msk (0x01 << DMA_IE_CH5_Pos) +#define DMA_IE_CH6_Pos 6 +#define DMA_IE_CH6_Msk (0x01 << DMA_IE_CH6_Pos) +#define DMA_IE_CH7_Pos 7 +#define DMA_IE_CH7_Msk (0x01 << DMA_IE_CH7_Pos) -#define DMA_IF_CH0_Pos 0 -#define DMA_IF_CH0_Msk (0x01 << DMA_IF_CH0_Pos) -#define DMA_IF_CH1_Pos 1 -#define DMA_IF_CH1_Msk (0x01 << DMA_IF_CH1_Pos) -#define DMA_IF_CH2_Pos 2 -#define DMA_IF_CH2_Msk (0x01 << DMA_IF_CH2_Pos) -#define DMA_IF_CH3_Pos 3 -#define DMA_IF_CH3_Msk (0x01 << DMA_IF_CH3_Pos) -#define DMA_IF_CH4_Pos 4 -#define DMA_IF_CH4_Msk (0x01 << DMA_IF_CH4_Pos) -#define DMA_IF_CH5_Pos 5 -#define DMA_IF_CH5_Msk (0x01 << DMA_IF_CH5_Pos) -#define DMA_IF_CH6_Pos 6 -#define DMA_IF_CH6_Msk (0x01 << DMA_IF_CH6_Pos) -#define DMA_IF_CH7_Pos 7 -#define DMA_IF_CH7_Msk (0x01 << DMA_IF_CH7_Pos) +#define DMA_IM_CH0_Pos 0 +#define DMA_IM_CH0_Msk (0x01 << DMA_IM_CH0_Pos) +#define DMA_IM_CH1_Pos 1 +#define DMA_IM_CH1_Msk (0x01 << DMA_IM_CH1_Pos) +#define DMA_IM_CH2_Pos 2 +#define DMA_IM_CH2_Msk (0x01 << DMA_IM_CH2_Pos) +#define DMA_IM_CH3_Pos 3 +#define DMA_IM_CH3_Msk (0x01 << DMA_IM_CH3_Pos) +#define DMA_IM_CH4_Pos 4 +#define DMA_IM_CH4_Msk (0x01 << DMA_IM_CH4_Pos) +#define DMA_IM_CH5_Pos 5 +#define DMA_IM_CH5_Msk (0x01 << DMA_IM_CH5_Pos) +#define DMA_IM_CH6_Pos 6 +#define DMA_IM_CH6_Msk (0x01 << DMA_IM_CH6_Pos) +#define DMA_IM_CH7_Pos 7 +#define DMA_IM_CH7_Msk (0x01 << DMA_IM_CH7_Pos) -#define DMA_CR_LEN_Pos 0 //姝ら氶亾浼犺緭鎬婚暱搴︼紝0瀵瑰簲1瀛楄妭锛屾渶澶4096瀛楄妭 -#define DMA_CR_LEN_Msk (0xFFF << DMA_CR_LEN_Pos) -#define DMA_CR_RXEN_Pos 16 -#define DMA_CR_RXEN_Msk (0x01 << DMA_CR_RXEN_Pos) -#define DMA_CR_TXEN_Pos 17 -#define DMA_CR_TXEN_Msk (0x01 << DMA_CR_TXEN_Pos) -#define DMA_CR_AUTORE_Pos 18 //Auto Restart, 閫氶亾鍦ㄤ紶杈撳畬鎴愬悗锛屾槸鍚﹁嚜鍔ㄩ噸鏂板惎鍔 -#define DMA_CR_AUTORE_Msk (0x01 << DMA_CR_AUTORE_Pos) +#define DMA_IF_CH0_Pos 0 +#define DMA_IF_CH0_Msk (0x01 << DMA_IF_CH0_Pos) +#define DMA_IF_CH1_Pos 1 +#define DMA_IF_CH1_Msk (0x01 << DMA_IF_CH1_Pos) +#define DMA_IF_CH2_Pos 2 +#define DMA_IF_CH2_Msk (0x01 << DMA_IF_CH2_Pos) +#define DMA_IF_CH3_Pos 3 +#define DMA_IF_CH3_Msk (0x01 << DMA_IF_CH3_Pos) +#define DMA_IF_CH4_Pos 4 +#define DMA_IF_CH4_Msk (0x01 << DMA_IF_CH4_Pos) +#define DMA_IF_CH5_Pos 5 +#define DMA_IF_CH5_Msk (0x01 << DMA_IF_CH5_Pos) +#define DMA_IF_CH6_Pos 6 +#define DMA_IF_CH6_Msk (0x01 << DMA_IF_CH6_Pos) +#define DMA_IF_CH7_Pos 7 +#define DMA_IF_CH7_Msk (0x01 << DMA_IF_CH7_Pos) -#define DMA_AM_SRCAM_Pos 0 //Address Mode 0 鍦板潃鍥哄畾 1 鍦板潃閫掑 2 scatter gather妯″紡 -#define DMA_AM_SRCAM_Msk (0x03 << DMA_AM_SRCAM_Pos) -#define DMA_AM_DSTAM_Pos 8 -#define DMA_AM_DSTAM_Msk (0x03 << DMA_AM_DSTAM_Pos) -#define DMA_AM_BURST_Pos 16 -#define DMA_AM_BURST_Msk (0x01 << DMA_AM_BURST_Pos) +#define DMA_CR_LEN_Pos 0 //此通道传输总长度,0对应1字节,最大4096字节 +#define DMA_CR_LEN_Msk (0xFFF << DMA_CR_LEN_Pos) +#define DMA_CR_RXEN_Pos 16 +#define DMA_CR_RXEN_Msk (0x01 << DMA_CR_RXEN_Pos) +#define DMA_CR_TXEN_Pos 17 +#define DMA_CR_TXEN_Msk (0x01 << DMA_CR_TXEN_Pos) +#define DMA_CR_AUTORE_Pos 18 //Auto Restart, 通道在传输完成后,是否自动重新启动 +#define DMA_CR_AUTORE_Msk (0x01 << DMA_CR_AUTORE_Pos) -typedef struct -{ - __IO uint32_t CR; //Control Register +#define DMA_AM_SRCAM_Pos 0 //Address Mode 0 地址固定 1 地址递增 2 scatter gather模式 +#define DMA_AM_SRCAM_Msk (0x03 << DMA_AM_SRCAM_Pos) +#define DMA_AM_DSTAM_Pos 8 +#define DMA_AM_DSTAM_Msk (0x03 << DMA_AM_DSTAM_Pos) +#define DMA_AM_BURST_Pos 16 +#define DMA_AM_BURST_Msk (0x01 << DMA_AM_BURST_Pos) - __O uint32_t CMD; //Command Register - __I uint32_t SR; //Status Register - __I uint32_t IF; //Interrupt Flag - __IO uint32_t IE; //Interrupt Enable - - uint32_t RESERVED; - - __IO uint32_t BT0; //Bit Time Register 0 - - __IO uint32_t BT1; //Bit Time Register 1 - - uint32_t RESERVED2[3]; - - __I uint32_t ALC; //Arbitration Lost Capture, 浠茶涓㈠け鎹曟崏 - - __I uint32_t ECC; //Error code capture, 閿欒浠g爜鎹曟崏 - - __IO uint32_t EWLIM; //Error Warning Limit, 閿欒鎶ヨ闄愬埗 - - __IO uint32_t RXERR; //RX閿欒璁℃暟 - - __IO uint32_t TXERR; //TX閿欒璁℃暟 - - union { - struct - { //鍦ㄥ浣嶆椂鍙鍐欙紝姝e父宸ヤ綔妯″紡涓嬩笉鍙闂 - __IO uint32_t ACR[4]; //Acceptance Check Register, 楠屾敹瀵勫瓨鍣 - - __IO uint32_t AMR[4]; //Acceptance Mask Register, 楠屾敹灞忚斀瀵勫瓨鍣紱瀵瑰簲浣嶅啓0锛孖D蹇呴』鍜岄獙鏀跺瘎瀛樺櫒鍖归厤 - - uint32_t RESERVED[5]; - } FILTER; - - union { //鍦ㄦ甯稿伐浣滄ā寮忎笅鍙鍐欙紝澶嶄綅鏃朵笉鍙闂 - struct - { - __O uint32_t INFO; - - __O uint32_t DATA[12]; - } TXFRAME; - - struct - { - __I uint32_t INFO; - - __I uint32_t DATA[12]; - } RXFRAME; - }; - }; - - __I uint32_t RMCNT; //Receive Message Count - - uint32_t RESERVED3[66]; - - struct - { //TXFRAME鐨勮鎺ュ彛 - __I uint32_t INFO; - - __I uint32_t DATA[12]; - } TXFRAME_R; +typedef struct { + __IO uint32_t CR; //Control Register + + __O uint32_t CMD; //Command Register + + __I uint32_t SR; //Status Register + + __I uint32_t IF; //Interrupt Flag,读取清零 + + __IO uint32_t IE; //Interrupt Enable + + uint32_t RESERVED; + + __IO uint32_t BT0; //Bit Time Register 0 + + __IO uint32_t BT1; //Bit Time Register 1 + + uint32_t RESERVED2[3]; + + __I uint32_t ALC; //Arbitration Lost Capture, 仲裁丢失捕捉 + + __I uint32_t ECC; //Error code capture, 错误代码捕捉 + + __IO uint32_t EWLIM; //Error Warning Limit, 错误报警限制 + + __IO uint32_t RXERR; //RX错误计数 + + __IO uint32_t TXERR; //TX错误计数 + + union { + struct { //在复位时可读写,正常工作模式下不可访问 + __IO uint32_t ACR[4]; //Acceptance Check Register, 验收寄存器 + + __IO uint32_t AMR[4]; //Acceptance Mask Register, 验收屏蔽寄存器;对应位写0,ID必须和验收寄存器匹配 + + uint32_t RESERVED[5]; + } FILTER; + + union { //在正常工作模式下可读写,复位时不可访问 + struct { + __O uint32_t INFO; + + __O uint32_t DATA[12]; + } TXFRAME; + + struct { + __I uint32_t INFO; + + __I uint32_t DATA[12]; + } RXFRAME; + }; + }; + + __I uint32_t RMCNT; //Receive Message Count + + uint32_t RESERVED3[66]; + + struct { //TXFRAME的读接口 + __I uint32_t INFO; + + __I uint32_t DATA[12]; + } TXFRAME_R; } CAN_TypeDef; -#define CAN_CR_RST_Pos 0 -#define CAN_CR_RST_Msk (0x01 << CAN_CR_RST_Pos) -#define CAN_CR_LOM_Pos 1 //Listen Only Mode -#define CAN_CR_LOM_Msk (0x01 << CAN_CR_LOM_Pos) -#define CAN_CR_STM_Pos 2 //Self Test Mode, 姝ゆā寮忎笅鍗充娇娌℃湁搴旂瓟锛孋AN鎺у埗鍣ㄤ篃鍙互鎴愬姛鍙戦 -#define CAN_CR_STM_Msk (0x01 << CAN_CR_STM_Pos) -#define CAN_CR_AFM_Pos 3 //Acceptance Filter Mode, 1 鍗曚釜楠屾敹婊ゆ尝鍣紙32浣嶏級 0 涓や釜楠屾敹婊ゆ尝鍣紙16浣嶏級 -#define CAN_CR_AFM_Msk (0x01 << CAN_CR_AFM_Pos) -#define CAN_CR_SLEEP_Pos 4 //鍐1杩涘叆鐫$湢妯″紡锛屾湁鎬荤嚎娲诲姩鎴栦腑鏂椂鍞ら啋骞惰嚜鍔ㄦ竻闆舵浣 -#define CAN_CR_SLEEP_Msk (0x01 << CAN_CR_SLEEP_Pos) -#define CAN_CMD_TXREQ_Pos 0 //Transmission Request -#define CAN_CMD_TXREQ_Msk (0x01 << CAN_CMD_TXREQ_Pos) -#define CAN_CMD_ABTTX_Pos 1 //Abort Transmission -#define CAN_CMD_ABTTX_Msk (0x01 << CAN_CMD_ABTTX_Pos) -#define CAN_CMD_RRB_Pos 2 //Release Receive Buffer -#define CAN_CMD_RRB_Msk (0x01 << CAN_CMD_RRB_Pos) -#define CAN_CMD_CLROV_Pos 3 //Clear Data Overrun -#define CAN_CMD_CLROV_Msk (0x01 << CAN_CMD_CLROV_Pos) -#define CAN_CMD_SRR_Pos 4 //Self Reception Request -#define CAN_CMD_SRR_Msk (0x01 << CAN_CMD_SRR_Pos) +#define CAN_CR_RST_Pos 0 +#define CAN_CR_RST_Msk (0x01 << CAN_CR_RST_Pos) +#define CAN_CR_LOM_Pos 1 //Listen Only Mode +#define CAN_CR_LOM_Msk (0x01 << CAN_CR_LOM_Pos) +#define CAN_CR_STM_Pos 2 //Self Test Mode, 此模式下即使没有应答,CAN控制器也可以成功发送 +#define CAN_CR_STM_Msk (0x01 << CAN_CR_STM_Pos) +#define CAN_CR_AFM_Pos 3 //Acceptance Filter Mode, 1 单个验收滤波器(32位) 0 两个验收滤波器(16位) +#define CAN_CR_AFM_Msk (0x01 << CAN_CR_AFM_Pos) +#define CAN_CR_SLEEP_Pos 4 //写1进入睡眠模式,有总线活动或中断时唤醒并自动清零此位 +#define CAN_CR_SLEEP_Msk (0x01 << CAN_CR_SLEEP_Pos) -#define CAN_SR_RXDA_Pos 0 //Receive Data Available锛屾帴鏀禙IFO涓湁瀹屾暣娑堟伅鍙互璇诲彇 -#define CAN_SR_RXDA_Msk (0x01 << CAN_SR_RXDA_Pos) -#define CAN_SR_RXOV_Pos 1 //Receive FIFO Overrun锛屾柊鎺ユ敹鐨勪俊鎭敱浜庢帴鏀禙IFO宸叉弧鑰屼涪鎺 -#define CAN_SR_RXOV_Msk (0x01 << CAN_SR_RXOV_Pos) -#define CAN_SR_TXBR_Pos 2 //Transmit Buffer Release锛0 姝e湪澶勭悊鍓嶉潰鐨勫彂閫侊紝鐜板湪涓嶈兘鍐欐柊鐨勬秷鎭 1 鍙互鍐欏叆鏂扮殑娑堟伅鍙戦 -#define CAN_SR_TXBR_Msk (0x01 << CAN_SR_TXBR_Pos) -#define CAN_SR_TXOK_Pos 3 //Transmit OK锛宻uccessfully completed -#define CAN_SR_TXOK_Msk (0x01 << CAN_SR_TXOK_Pos) -#define CAN_SR_RXBUSY_Pos 4 //Receive Busy锛屾鍦ㄦ帴鏀 -#define CAN_SR_RXBUSY_Msk (0x01 << CAN_SR_RXBUSY_Pos) -#define CAN_SR_TXBUSY_Pos 5 //Transmit Busy锛屾鍦ㄥ彂閫 -#define CAN_SR_TXBUSY_Msk (0x01 << CAN_SR_TXBUSY_Pos) -#define CAN_SR_ERRWARN_Pos 6 //1 鑷冲皯涓涓敊璇鏁板櫒杈惧埌 Warning Limit -#define CAN_SR_ERRWARN_Msk (0x01 << CAN_SR_ERRWARN_Pos) -#define CAN_SR_BUSOFF_Pos 7 //1 CAN 鎺у埗鍣ㄥ浜庢荤嚎鍏抽棴鐘舵侊紝娌℃湁鍙備笌鍒版荤嚎娲诲姩 -#define CAN_SR_BUSOFF_Msk (0x01 << CAN_SR_BUSOFF_Pos) +#define CAN_CMD_TXREQ_Pos 0 //Transmission Request +#define CAN_CMD_TXREQ_Msk (0x01 << CAN_CMD_TXREQ_Pos) +#define CAN_CMD_ABTTX_Pos 1 //Abort Transmission +#define CAN_CMD_ABTTX_Msk (0x01 << CAN_CMD_ABTTX_Pos) +#define CAN_CMD_RRB_Pos 2 //Release Receive Buffer +#define CAN_CMD_RRB_Msk (0x01 << CAN_CMD_RRB_Pos) +#define CAN_CMD_CLROV_Pos 3 //Clear Data Overrun +#define CAN_CMD_CLROV_Msk (0x01 << CAN_CMD_CLROV_Pos) +#define CAN_CMD_SRR_Pos 4 //Self Reception Request +#define CAN_CMD_SRR_Msk (0x01 << CAN_CMD_SRR_Pos) -#define CAN_IF_RXDA_Pos 0 //IF.RXDA = SR.RXDA & IE.RXDA -#define CAN_IF_RXDA_Msk (0x01 << CAN_IF_RXDA_Pos) -#define CAN_IF_TXBR_Pos 1 //褰揑E.TXBR=1鏃讹紝SR.TXBR鐢0鍙樻垚1灏嗙疆浣嶆浣 -#define CAN_IF_TXBR_Msk (0x01 << CAN_IF_TXBR_Pos) -#define CAN_IF_ERRWARN_Pos 2 //褰揑E.ERRWARN=1鏃讹紝SR.ERRWARN鎴朣R.BUSOFF 0-to-1 鎴 1-to-0灏嗙疆浣嶆浣 -#define CAN_IF_ERRWARN_Msk (0x01 << CAN_IF_ERRWARN_Pos) -#define CAN_IF_RXOV_Pos 3 //IF.RXOV = SR.RXOV & IE.RXOV -#define CAN_IF_RXOV_Msk (0x01 << CAN_IF_RXOV_Pos) -#define CAN_IF_WKUP_Pos 4 //褰揑E.WKUP=1鏃讹紝鍦ㄧ潯鐪犳ā寮忎笅鐨凜AN鎺у埗鍣ㄦ娴嬪埌鎬荤嚎娲诲姩鏃剁‖浠剁疆浣 -#define CAN_IF_WKUP_Msk (0x01 << CAN_IF_WKUP_Pos) -#define CAN_IF_ERRPASS_Pos 5 // -#define CAN_IF_ERRPASS_Msk (0x01 << CAN_IF_ERRPASS_Pos) -#define CAN_IF_ARBLOST_Pos 6 //Arbitration Lost锛屽綋IE.ARBLOST=1鏃讹紝CAN鎺у埗鍣ㄤ涪澶变徊瑁佸彉鎴愭帴鏀舵柟鏃剁‖浠剁疆浣 -#define CAN_IF_ARBLOST_Msk (0x01 << CAN_IF_ARBLOST_Pos) -#define CAN_IF_BUSERR_Pos 7 //褰揑E.BUSERR=1鏃讹紝CAN鎺у埗鍣ㄦ娴嬪埌鎬荤嚎閿欒鏃剁‖浠剁疆浣 -#define CAN_IF_BUSERR_Msk (0x01 << CAN_IF_BUSERR_Pos) +#define CAN_SR_RXDA_Pos 0 //Receive Data Available,接收FIFO中有完整消息可以读取 +#define CAN_SR_RXDA_Msk (0x01 << CAN_SR_RXDA_Pos) +#define CAN_SR_RXOV_Pos 1 //Receive FIFO Overrun,新接收的信息由于接收FIFO已满而丢掉 +#define CAN_SR_RXOV_Msk (0x01 << CAN_SR_RXOV_Pos) +#define CAN_SR_TXBR_Pos 2 //Transmit Buffer Release,0 正在处理前面的发送,现在不能写新的消息 1 可以写入新的消息发送 +#define CAN_SR_TXBR_Msk (0x01 << CAN_SR_TXBR_Pos) +#define CAN_SR_TXOK_Pos 3 //Transmit OK,successfully completed +#define CAN_SR_TXOK_Msk (0x01 << CAN_SR_TXOK_Pos) +#define CAN_SR_RXBUSY_Pos 4 //Receive Busy,正在接收 +#define CAN_SR_RXBUSY_Msk (0x01 << CAN_SR_RXBUSY_Pos) +#define CAN_SR_TXBUSY_Pos 5 //Transmit Busy,正在发送 +#define CAN_SR_TXBUSY_Msk (0x01 << CAN_SR_TXBUSY_Pos) +#define CAN_SR_ERRWARN_Pos 6 //1 至少一个错误计数器达到 Warning Limit +#define CAN_SR_ERRWARN_Msk (0x01 << CAN_SR_ERRWARN_Pos) +#define CAN_SR_BUSOFF_Pos 7 //1 CAN 控制器处于总线关闭状态,没有参与到总线活动 +#define CAN_SR_BUSOFF_Msk (0x01 << CAN_SR_BUSOFF_Pos) -#define CAN_IE_RXDA_Pos 0 -#define CAN_IE_RXDA_Msk (0x01 << CAN_IE_RXDA_Pos) -#define CAN_IE_TXBR_Pos 1 -#define CAN_IE_TXBR_Msk (0x01 << CAN_IE_TXBR_Pos) -#define CAN_IE_ERRWARN_Pos 2 -#define CAN_IE_ERRWARN_Msk (0x01 << CAN_IE_ERRWARN_Pos) -#define CAN_IE_RXOV_Pos 3 -#define CAN_IE_RXOV_Msk (0x01 << CAN_IE_RXOV_Pos) -#define CAN_IE_WKUP_Pos 4 -#define CAN_IE_WKUP_Msk (0x01 << CAN_IE_WKUP_Pos) -#define CAN_IE_ERRPASS_Pos 5 -#define CAN_IE_ERRPASS_Msk (0x01 << CAN_IE_ERRPASS_Pos) -#define CAN_IE_ARBLOST_Pos 6 -#define CAN_IE_ARBLOST_Msk (0x01 << CAN_IE_ARBLOST_Pos) -#define CAN_IE_BUSERR_Pos 7 -#define CAN_IE_BUSERR_Msk (0x01 << CAN_IE_BUSERR_Pos) +#define CAN_IF_RXDA_Pos 0 //IF.RXDA = SR.RXDA & IE.RXDA +#define CAN_IF_RXDA_Msk (0x01 << CAN_IF_RXDA_Pos) +#define CAN_IF_TXBR_Pos 1 //当IE.TXBR=1时,SR.TXBR由0变成1将置位此位 +#define CAN_IF_TXBR_Msk (0x01 << CAN_IF_TXBR_Pos) +#define CAN_IF_ERRWARN_Pos 2 //当IE.ERRWARN=1时,SR.ERRWARN或SR.BUSOFF 0-to-1 或 1-to-0将置位此位 +#define CAN_IF_ERRWARN_Msk (0x01 << CAN_IF_ERRWARN_Pos) +#define CAN_IF_RXOV_Pos 3 //IF.RXOV = SR.RXOV & IE.RXOV +#define CAN_IF_RXOV_Msk (0x01 << CAN_IF_RXOV_Pos) +#define CAN_IF_WKUP_Pos 4 //当IE.WKUP=1时,在睡眠模式下的CAN控制器检测到总线活动时硬件置位 +#define CAN_IF_WKUP_Msk (0x01 << CAN_IF_WKUP_Pos) +#define CAN_IF_ERRPASS_Pos 5 // +#define CAN_IF_ERRPASS_Msk (0x01 << CAN_IF_ERRPASS_Pos) +#define CAN_IF_ARBLOST_Pos 6 //Arbitration Lost,当IE.ARBLOST=1时,CAN控制器丢失仲裁变成接收方时硬件置位 +#define CAN_IF_ARBLOST_Msk (0x01 << CAN_IF_ARBLOST_Pos) +#define CAN_IF_BUSERR_Pos 7 //当IE.BUSERR=1时,CAN控制器检测到总线错误时硬件置位 +#define CAN_IF_BUSERR_Msk (0x01 << CAN_IF_BUSERR_Pos) -#define CAN_BT0_BRP_Pos 0 //Baud Rate Prescaler锛孋AN鏃堕棿鍗曚綅=2*Tsysclk*(BRP+1) -#define CAN_BT0_BRP_Msk (0x3F << CAN_BT0_BRP_Pos) -#define CAN_BT0_SJW_Pos 6 //Synchronization Jump Width -#define CAN_BT0_SJW_Msk (0x03 << CAN_BT0_SJW_Pos) +#define CAN_IE_RXDA_Pos 0 +#define CAN_IE_RXDA_Msk (0x01 << CAN_IE_RXDA_Pos) +#define CAN_IE_TXBR_Pos 1 +#define CAN_IE_TXBR_Msk (0x01 << CAN_IE_TXBR_Pos) +#define CAN_IE_ERRWARN_Pos 2 +#define CAN_IE_ERRWARN_Msk (0x01 << CAN_IE_ERRWARN_Pos) +#define CAN_IE_RXOV_Pos 3 +#define CAN_IE_RXOV_Msk (0x01 << CAN_IE_RXOV_Pos) +#define CAN_IE_WKUP_Pos 4 +#define CAN_IE_WKUP_Msk (0x01 << CAN_IE_WKUP_Pos) +#define CAN_IE_ERRPASS_Pos 5 +#define CAN_IE_ERRPASS_Msk (0x01 << CAN_IE_ERRPASS_Pos) +#define CAN_IE_ARBLOST_Pos 6 +#define CAN_IE_ARBLOST_Msk (0x01 << CAN_IE_ARBLOST_Pos) +#define CAN_IE_BUSERR_Pos 7 +#define CAN_IE_BUSERR_Msk (0x01 << CAN_IE_BUSERR_Pos) -#define CAN_BT1_TSEG1_Pos 0 //t_tseg1 = CAN鏃堕棿鍗曚綅 * (TSEG1+1) -#define CAN_BT1_TSEG1_Msk (0x0F << CAN_BT1_TSEG1_Pos) -#define CAN_BT1_TSEG2_Pos 4 //t_tseg2 = CAN鏃堕棿鍗曚綅 * (TSEG2+1) -#define CAN_BT1_TSEG2_Msk (0x07 << CAN_BT1_TSEG2_Pos) -#define CAN_BT1_SAM_Pos 7 //閲囨牱娆℃暟 0: sampled once 1: sampled three times -#define CAN_BT1_SAM_Msk (0x01 << CAN_BT1_SAM_Pos) +#define CAN_BT0_BRP_Pos 0 //Baud Rate Prescaler,CAN时间单位=2*Tsysclk*(BRP+1) +#define CAN_BT0_BRP_Msk (0x3F << CAN_BT0_BRP_Pos) +#define CAN_BT0_SJW_Pos 6 //Synchronization Jump Width +#define CAN_BT0_SJW_Msk (0x03 << CAN_BT0_SJW_Pos) -#define CAN_ECC_SEGCODE_Pos 0 //Segment Code -#define CAN_ECC_SEGCODE_Msk (0x1F << CAN_ECC_SEGCODE_Pos) -#define CAN_ECC_DIR_Pos 5 //0 error occurred during transmission 1 during reception -#define CAN_ECC_DIR_Msk (0x01 << CAN_ECC_DIR_Pos) -#define CAN_ECC_ERRCODE_Pos 6 //Error Code锛0 Bit error 1 Form error 2 Stuff error 3 other error -#define CAN_ECC_ERRCODE_Msk (0x03 << CAN_ECC_ERRCODE_Pos) +#define CAN_BT1_TSEG1_Pos 0 //t_tseg1 = CAN时间单位 * (TSEG1+1) +#define CAN_BT1_TSEG1_Msk (0x0F << CAN_BT1_TSEG1_Pos) +#define CAN_BT1_TSEG2_Pos 4 //t_tseg2 = CAN时间单位 * (TSEG2+1) +#define CAN_BT1_TSEG2_Msk (0x07 << CAN_BT1_TSEG2_Pos) +#define CAN_BT1_SAM_Pos 7 //采样次数 0: sampled once 1: sampled three times +#define CAN_BT1_SAM_Msk (0x01 << CAN_BT1_SAM_Pos) -#define CAN_INFO_DLC_Pos 0 //Data Length Control -#define CAN_INFO_DLC_Msk (0x0F << CAN_INFO_DLC_Pos) -#define CAN_INFO_RTR_Pos 6 //Remote Frame锛1 杩滅▼甯 0 鏁版嵁甯 -#define CAN_INFO_RTR_Msk (0x01 << CAN_INFO_RTR_Pos) -#define CAN_INFO_FF_Pos 7 //Frame Format锛0 鏍囧噯甯ф牸寮 1 鎵╁睍甯ф牸寮 -#define CAN_INFO_FF_Msk (0x01 << CAN_INFO_FF_Pos) +#define CAN_ECC_SEGCODE_Pos 0 //Segment Code +#define CAN_ECC_SEGCODE_Msk (0x1F << CAN_ECC_SEGCODE_Pos) +#define CAN_ECC_DIR_Pos 5 //0 error occurred during transmission 1 during reception +#define CAN_ECC_DIR_Msk (0x01 << CAN_ECC_DIR_Pos) +#define CAN_ECC_ERRCODE_Pos 6 //Error Code:0 Bit error 1 Form error 2 Stuff error 3 other error +#define CAN_ECC_ERRCODE_Msk (0x03 << CAN_ECC_ERRCODE_Pos) -typedef struct -{ - __IO uint32_t IE; //[0] 涓0鐨勬椂鍊欙紝IF[0]缁存寔涓0 +#define CAN_INFO_DLC_Pos 0 //Data Length Control +#define CAN_INFO_DLC_Msk (0x0F << CAN_INFO_DLC_Pos) +#define CAN_INFO_RTR_Pos 6 //Remote Frame,1 远程帧 0 数据帧 +#define CAN_INFO_RTR_Msk (0x01 << CAN_INFO_RTR_Pos) +#define CAN_INFO_FF_Pos 7 //Frame Format,0 标准帧格式 1 扩展帧格式 +#define CAN_INFO_FF_Msk (0x01 << CAN_INFO_FF_Pos) - __IO uint32_t IF; //[0] 褰撳畬鎴愭寚瀹氶暱搴︾殑鏁版嵁浼犺緭鏃剁疆1锛屽啓1娓呴浂 - __IO uint32_t IM; //[0] 褰撹瀵勫瓨鍣ㄤ负1鏃讹紝LCDC鐨勪腑鏂笉浼氳緭鍑虹粰绯荤粺鐨勪腑鏂帶鍒跺瘎瀛樺櫒 + +typedef struct { + __IO uint32_t IE; //[0] 为0的时候,IF[0]维持为0 + + __IO uint32_t IF; //[0] 当完成指定长度的数据传输时置1,写1清零 + + __IO uint32_t IM; //[0] 当该寄存器为1时,LCDC的中断不会输出给系统的中断控制寄存器 + __IO uint32_t START; - - __IO uint32_t SRCADDR; //鏁版嵁婧愬湴鍧瀵勫瓨鍣紝蹇呴』瀛楀榻愶紙鍗冲湴鍧鐨勪綆2浣嶅繀椤绘槸0锛 - + + __IO uint32_t SRCADDR; //数据源地址寄存器,必须字对齐(即地址的低2位必须是0) + __IO uint32_t CR0; - + __IO uint32_t CR1; - - __IO uint32_t PRECMDV; //鍦∕PU鎺ュ彛涓紝鍙戦佹暟鎹墠锛孯S鎷変綆鐨勯偅涓鎷嶏紝鏁版嵁鎬荤嚎涓婄殑鍊 + + __IO uint32_t PRECMDV; //在MPU接口中,发送数据前,RS拉低的那一拍,数据总线上的值 } LCD_TypeDef; -#define LCD_START_MPUEN_Pos 0 //0 RGB鎺ュ彛 1 MPU鎺ュ彛 -#define LCD_START_MPUEN_Msk (0x01 << LCD_START_MPUEN_Pos) -#define LCD_START_GO_Pos 1 //鍐1寮濮嬩紶杈撴暟鎹紝鏁版嵁浼犺緭缁撴潫鍚庤嚜鍔ㄦ竻闆 -#define LCD_START_GO_Msk (0x01 << LCD_START_GO_Pos) -#define LCD_START_BURST_Pos 2 -#define LCD_START_BURST_Msk (0x01 << LCD_START_BURST_Pos) -#define LCD_CR0_VPIX_Pos 0 //褰損ortrait涓0鏃讹紝琛ㄧず鍨傜洿鏂瑰悜鐨勫儚绱犱釜鏁帮紝0琛ㄧず1涓紝鏈澶т负767 \ - //褰損ortrait涓1鏃讹紝琛ㄧず姘村钩鏂瑰悜鐨勫儚绱犱釜鏁帮紝0琛ㄧず1涓紝鏈澶т负767 -#define LCD_CR0_VPIX_Msk (0x3FF << LCD_CR0_VPIX_Pos) -#define LCD_CR0_HPIX_Pos 10 //褰損ortrait涓0鏃讹紝琛ㄧず姘村钩鏂瑰悜鐨勫儚绱犱釜鏁帮紝0琛ㄧず1涓紝鏈澶т负1023 \ - //褰損ortrait涓1鏃讹紝琛ㄧず鍨傜洿鏂瑰悜鐨勫儚绱犱釜鏁帮紝0琛ㄧず1涓紝鏈澶т负1023 -#define LCD_CR0_HPIX_Msk (0x3FF << LCD_CR0_HPIX_Pos) -#define LCD_CR0_DCLK_Pos 20 //0 DOTCLK涓鐩寸炕杞 1 DOTCLK鍦ㄧ┖闂叉椂鍋滃湪1 -#define LCD_CR0_DCLK_Msk (0x01 << LCD_CR0_DCLK_Pos) -#define LCD_CR0_HLOW_Pos 21 //杈撳嚭HSYNC浣庣數骞虫寔缁灏戜釜DOTCLK鍛ㄦ湡锛0琛ㄧず1涓懆鏈 -#define LCD_CR0_HLOW_Msk (0x03 << LCD_CR0_HLOW_Pos) +#define LCD_START_GO_Pos 1 //写1开始传输数据,数据传输结束后自动清零 +#define LCD_START_GO_Msk (0x01 << LCD_START_GO_Pos) +#define LCD_START_BURST_Pos 2 +#define LCD_START_BURST_Msk (0x01 << LCD_START_BURST_Pos) -#define LCD_CR1_VFP_Pos 1 -#define LCD_CR1_VFP_Msk (0x07 << LCD_CR1_VFP_Pos) -#define LCD_CR1_VBP_Pos 4 -#define LCD_CR1_VBP_Msk (0x1F << LCD_CR1_VBP_Pos) -#define LCD_CR1_HFP_Pos 9 -#define LCD_CR1_HFP_Msk (0x1F << LCD_CR1_HFP_Pos) -#define LCD_CR1_HBP_Pos 14 -#define LCD_CR1_HBP_Msk (0x7F << LCD_CR1_HBP_Pos) -#define LCD_CR1_DCLKDIV_Pos 21 //DOTCLK鐩稿浜庢ā鍧楁椂閽熺殑鍒嗛姣旓紝0琛ㄧず2鍒嗛锛1琛ㄧず4鍒嗛 ... -#define LCD_CR1_DCLKDIV_Msk (0x1F << LCD_CR1_DCLKDIV_Pos) -#define LCD_CR1_DCLKINV_Pos 26 //1 杈撳嚭DOTCLK鍙嶅悜锛屽簲鐢ㄤ簬鐢―OTCLK涓嬮檷娌块噰鏍锋暟鎹殑灞 -#define LCD_CR1_DCLKINV_Msk (0x01 << LCD_CR1_DCLKINV_Pos) +#define LCD_CR0_VPIX_Pos 0 //当portrait为0时,表示垂直方向的像素个数,0表示1个,最大为767 + //当portrait为1时,表示水平方向的像素个数,0表示1个,最大为767 +#define LCD_CR0_VPIX_Msk (0x3FF << LCD_CR0_VPIX_Pos) +#define LCD_CR0_HPIX_Pos 10 //当portrait为0时,表示水平方向的像素个数,0表示1个,最大为1023 + //当portrait为1时,表示垂直方向的像素个数,0表示1个,最大为1023 +#define LCD_CR0_HPIX_Msk (0x3FF << LCD_CR0_HPIX_Pos) +#define LCD_CR0_DCLK_Pos 20 //0 DOTCLK一直翻转 1 DOTCLK在空闲时停在1 +#define LCD_CR0_DCLK_Msk (0x01 << LCD_CR0_DCLK_Pos) +#define LCD_CR0_HLOW_Pos 21 //输出HSYNC低电平持续多少个DOTCLK周期,0表示1个周期 +#define LCD_CR0_HLOW_Msk (0x03 << LCD_CR0_HLOW_Pos) -typedef struct -{ +#define LCD_CR1_VFP_Pos 1 +#define LCD_CR1_VFP_Msk (0x07 << LCD_CR1_VFP_Pos) +#define LCD_CR1_VBP_Pos 4 +#define LCD_CR1_VBP_Msk (0x1F << LCD_CR1_VBP_Pos) +#define LCD_CR1_HFP_Pos 9 +#define LCD_CR1_HFP_Msk (0x1F << LCD_CR1_HFP_Pos) +#define LCD_CR1_HBP_Pos 14 +#define LCD_CR1_HBP_Msk (0x7F << LCD_CR1_HBP_Pos) +#define LCD_CR1_DCLKDIV_Pos 21 //DOTCLK相对于模块时钟的分频比,0表示2分频,1表示4分频 ... +#define LCD_CR1_DCLKDIV_Msk (0x1F << LCD_CR1_DCLKDIV_Pos) +#define LCD_CR1_DCLKINV_Pos 26 //1 输出DOTCLK反向,应用于用DOTCLK下降沿采样数据的屏 +#define LCD_CR1_DCLKINV_Msk (0x01 << LCD_CR1_DCLKINV_Pos) + + + + +typedef struct { __IO uint32_t DMA_MEM_ADDR; - - __IO uint32_t BLK; //Block Size and Count - - __IO uint32_t ARG; //Argument - - __IO uint32_t CMD; //Command - - __IO uint32_t RESP[4]; //Response - + + __IO uint32_t BLK; //Block Size and Count + + __IO uint32_t ARG; //Argument + + __IO uint32_t CMD; //Command + + __IO uint32_t RESP[4]; //Response + __IO uint32_t DATA; - + __IO uint32_t STAT; - + __IO uint32_t CR1; - + __IO uint32_t CR2; - + __IO uint32_t IF; - - __IO uint32_t IFE; //Interrupt Flag Enable - - __IO uint32_t IE; //Interrupt Enalbe - + + __IO uint32_t IFE; //Interrupt Flag Enable + + __IO uint32_t IE; //Interrupt Enalbe + __IO uint32_t CMD12ERR; - + __IO uint32_t INFO; - + __IO uint32_t MAXCURR; } SDIO_TypeDef; -#define SDIO_BLK_SIZE_Pos 0 //0x200 512瀛楄妭 0x400 1024瀛楄妭 0x800 2048瀛楄妭 -#define SDIO_BLK_SIZE_Msk (0xFFF << SDIO_BLK_SIZE_Pos) -#define SDIO_BLK_COUNT_Pos 16 //0 Stop Transfer 1 1鍧 2 2鍧 ... ... -#define SDIO_BLK_COUNT_Msk (0xFFF << SDIO_BLK_COUNT_Pos) -#define SDIO_CMD_DMAEN_Pos 0 -#define SDIO_CMD_DMAEN_Msk (0x01 << SDIO_CMD_DMAEN_Pos) -#define SDIO_CMD_BLKCNTEN_Pos 1 -#define SDIO_CMD_BLKCNTEN_Msk (0x01 << SDIO_CMD_BLKCNTEN_Pos) -#define SDIO_CMD_AUTOCMD12_Pos 2 -#define SDIO_CMD_AUTOCMD12_Msk (0x01 << SDIO_CMD_AUTOCMD12_Pos) -#define SDIO_CMD_DIRREAD_Pos 4 //0 Write, Host to Card 1 Read, Card to Host -#define SDIO_CMD_DIRREAD_Msk (0x01 << SDIO_CMD_DIRREAD_Pos) -#define SDIO_CMD_MULTBLK_Pos 5 //0 Single Block 1 Multiple Block -#define SDIO_CMD_MULTBLK_Msk (0x01 << SDIO_CMD_MULTBLK_Pos) -#define SDIO_CMD_RESPTYPE_Pos 16 //鍝嶅簲绫诲瀷锛0 鏃犲搷搴 1 136浣嶅搷搴 2 48浣嶅搷搴 3 48浣嶅搷搴旓紝Busy after response -#define SDIO_CMD_RESPTYPE_Msk (0x03 << SDIO_CMD_RESPTYPE_Pos) -#define SDIO_CMD_CRCCHECK_Pos 19 //Command CRC Check Enable -#define SDIO_CMD_CRCCHECK_Msk (0x01 << SDIO_CMD_CRCCHECK_Pos) -#define SDIO_CMD_IDXCHECK_Pos 20 //Command Index Check Enable -#define SDIO_CMD_IDXCHECK_Msk (0x01 << SDIO_CMD_IDXCHECK_Pos) -#define SDIO_CMD_HAVEDATA_Pos 21 //0 No Data Present 1 Data Present -#define SDIO_CMD_HAVEDATA_Msk (0x01 << SDIO_CMD_HAVEDATA_Pos) -#define SDIO_CMD_CMDTYPE_Pos 22 //0 NORMAL 1 SUSPEND 2 RESUME 3 ABORT -#define SDIO_CMD_CMDTYPE_Msk (0x03 << SDIO_CMD_CMDTYPE_Pos) -#define SDIO_CMD_CMDINDX_Pos 24 //Command Index锛孋MD0-63銆丄CMD0-63 -#define SDIO_CMD_CMDINDX_Msk (0x3F << SDIO_CMD_CMDINDX_Pos) +#define SDIO_BLK_SIZE_Pos 0 //0x200 512字节 0x400 1024字节 0x800 2048字节 +#define SDIO_BLK_SIZE_Msk (0xFFF << SDIO_BLK_SIZE_Pos) +#define SDIO_BLK_COUNT_Pos 16 //0 Stop Transfer 1 1块 2 2块 ... ... +#define SDIO_BLK_COUNT_Msk (0xFFF << SDIO_BLK_COUNT_Pos) -#define SDIO_CR1_4BIT_Pos 1 //1 4 bit mode 0 1 bit mode -#define SDIO_CR1_4BIT_Msk (0x01 << SDIO_CR1_4BIT_Pos) -#define SDIO_CR1_8BIT_Pos 5 //1 8 bit mode is selected 0 8 bit mode is not selected -#define SDIO_CR1_8BIT_Msk (0x01 << SDIO_CR1_8BIT_Pos) -#define SDIO_CR1_CDBIT_Pos 6 //0 No Card 1 Card Inserted -#define SDIO_CR1_CDBIT_Msk (0x01 << SDIO_CR1_CDBIT_Pos) -#define SDIO_CR1_CDSRC_Pos 7 //Card Detect Source, 1 CR1.CDBIT浣 0 SD_Detect寮曡剼 -#define SDIO_CR1_CDSRC_Msk (0x01 << SDIO_CR1_CDSRC_Pos) -#define SDIO_CR1_PWRON_Pos 8 //1 Power on 0 Power off -#define SDIO_CR1_PWRON_Msk (0x01 << SDIO_CR1_PWRON_Pos) -#define SDIO_CR1_VOLT_Pos 9 //7 3.3V 6 3.0V 5 1.8V -#define SDIO_CR1_VOLT_Msk (0x07 << SDIO_CR1_VOLT_Pos) +#define SDIO_CMD_DMAEN_Pos 0 +#define SDIO_CMD_DMAEN_Msk (0x01 << SDIO_CMD_DMAEN_Pos) +#define SDIO_CMD_BLKCNTEN_Pos 1 +#define SDIO_CMD_BLKCNTEN_Msk (0x01 << SDIO_CMD_BLKCNTEN_Pos) +#define SDIO_CMD_AUTOCMD12_Pos 2 +#define SDIO_CMD_AUTOCMD12_Msk (0x01 << SDIO_CMD_AUTOCMD12_Pos) +#define SDIO_CMD_DIRREAD_Pos 4 //0 Write, Host to Card 1 Read, Card to Host +#define SDIO_CMD_DIRREAD_Msk (0x01 << SDIO_CMD_DIRREAD_Pos) +#define SDIO_CMD_MULTBLK_Pos 5 //0 Single Block 1 Multiple Block +#define SDIO_CMD_MULTBLK_Msk (0x01 << SDIO_CMD_MULTBLK_Pos) +#define SDIO_CMD_RESPTYPE_Pos 16 //响应类型,0 无响应 1 136位响应 2 48位响应 3 48位响应,Busy after response +#define SDIO_CMD_RESPTYPE_Msk (0x03 << SDIO_CMD_RESPTYPE_Pos) +#define SDIO_CMD_CRCCHECK_Pos 19 //Command CRC Check Enable +#define SDIO_CMD_CRCCHECK_Msk (0x01 << SDIO_CMD_CRCCHECK_Pos) +#define SDIO_CMD_IDXCHECK_Pos 20 //Command Index Check Enable +#define SDIO_CMD_IDXCHECK_Msk (0x01 << SDIO_CMD_IDXCHECK_Pos) +#define SDIO_CMD_HAVEDATA_Pos 21 //0 No Data Present 1 Data Present +#define SDIO_CMD_HAVEDATA_Msk (0x01 << SDIO_CMD_HAVEDATA_Pos) +#define SDIO_CMD_CMDTYPE_Pos 22 //0 NORMAL 1 SUSPEND 2 RESUME 3 ABORT +#define SDIO_CMD_CMDTYPE_Msk (0x03 << SDIO_CMD_CMDTYPE_Pos) +#define SDIO_CMD_CMDINDX_Pos 24 //Command Index,CMD0-63、ACMD0-63 +#define SDIO_CMD_CMDINDX_Msk (0x3F << SDIO_CMD_CMDINDX_Pos) -#define SDIO_CR2_CLKEN_Pos 0 //Internal Clock Enable -#define SDIO_CR2_CLKEN_Msk (0x01 << SDIO_CR2_CLKEN_Pos) -#define SDIO_CR2_CLKRDY_Pos 1 //Internal Clock Stable/Ready -#define SDIO_CR2_CLKRDY_Msk (0x01 << SDIO_CR2_CLKRDY_Pos) -#define SDIO_CR2_SDCLKEN_Pos 2 //SDCLK Enable -#define SDIO_CR2_SDCLKEN_Msk (0x01 << SDIO_CR2_SDCLKEN_Pos) -#define SDIO_CR2_SDCLKDIV_Pos 8 //SDCLK Frequency Div, 0x00 涓嶅垎棰 0x01 2鍒嗛 0x02 4鍒嗛 0x04 8鍒嗛 0x08 16鍒嗛 ... 0x80 256鍒嗛 -#define SDIO_CR2_SDCLKDIV_Msk (0xFF << SDIO_CR2_SDCLKDIV_Pos) -#define SDIO_CR2_TIMEOUT_Pos 16 //0 TMCLK*2^13 1 TMCLK*2^14 ... 14 TMCLK*2^27 -#define SDIO_CR2_TIMEOUT_Msk (0x0F << SDIO_CR2_TIMEOUT_Pos) -#define SDIO_CR2_RSTALL_Pos 24 //Software Reset for All -#define SDIO_CR2_RSTALL_Msk (0x01 << SDIO_CR2_RSTALL_Pos) -#define SDIO_CR2_RSTCMD_Pos 25 //Software Reset for CMD Line -#define SDIO_CR2_RSTCMD_Msk (0x01 << SDIO_CR2_RSTCMD_Pos) -#define SDIO_CR2_RSTDAT_Pos 26 //Software Reset for DAT Line -#define SDIO_CR2_RSTDAT_Msk (0x01 << SDIO_CR2_RSTDAT_Pos) +#define SDIO_CR1_4BIT_Pos 1 //1 4 bit mode 0 1 bit mode +#define SDIO_CR1_4BIT_Msk (0x01 << SDIO_CR1_4BIT_Pos) +#define SDIO_CR1_8BIT_Pos 5 //1 8 bit mode is selected 0 8 bit mode is not selected +#define SDIO_CR1_8BIT_Msk (0x01 << SDIO_CR1_8BIT_Pos) +#define SDIO_CR1_CDBIT_Pos 6 //0 No Card 1 Card Inserted +#define SDIO_CR1_CDBIT_Msk (0x01 << SDIO_CR1_CDBIT_Pos) +#define SDIO_CR1_CDSRC_Pos 7 //Card Detect Source, 1 CR1.CDBIT位 0 SD_Detect引脚 +#define SDIO_CR1_CDSRC_Msk (0x01 << SDIO_CR1_CDSRC_Pos) +#define SDIO_CR1_PWRON_Pos 8 //1 Power on 0 Power off +#define SDIO_CR1_PWRON_Msk (0x01 << SDIO_CR1_PWRON_Pos) +#define SDIO_CR1_VOLT_Pos 9 //7 3.3V 6 3.0V 5 1.8V +#define SDIO_CR1_VOLT_Msk (0x07 << SDIO_CR1_VOLT_Pos) -#define SDIO_IF_CMDDONE_Pos 0 -#define SDIO_IF_CMDDONE_Msk (0x01 << SDIO_IF_CMDDONE_Pos) -#define SDIO_IF_TRXDONE_Pos 1 -#define SDIO_IF_TRXDONE_Msk (0x01 << SDIO_IF_TRXDONE_Pos) -#define SDIO_IF_BLKGAP_Pos 2 -#define SDIO_IF_BLKGAP_Msk (0x01 << SDIO_IF_BLKGAP_Pos) -#define SDIO_IF_DMADONE_Pos 3 -#define SDIO_IF_DMADONE_Msk (0x01 << SDIO_IF_DMADONE_Pos) -#define SDIO_IF_BUFWRRDY_Pos 4 -#define SDIO_IF_BUFWRRDY_Msk (0x01 << SDIO_IF_BUFWRRDY_Pos) -#define SDIO_IF_BUFRDRDY_Pos 5 -#define SDIO_IF_BUFRDRDY_Msk (0x01 << SDIO_IF_BUFRDRDY_Pos) -#define SDIO_IF_CARDINSR_Pos 6 -#define SDIO_IF_CARDINSR_Msk (0x01 << SDIO_IF_CARDINSR_Pos) -#define SDIO_IF_CARDRMOV_Pos 7 -#define SDIO_IF_CARDRMOV_Msk (0x01 << SDIO_IF_CARDRMOV_Pos) -#define SDIO_IF_CARD_Pos 8 -#define SDIO_IF_CARD_Msk (0x01 << SDIO_IF_CARD_Pos) -#define SDIO_IF_ERROR_Pos 15 -#define SDIO_IF_ERROR_Msk (0x01 << SDIO_IF_ERROR_Pos) -#define SDIO_IF_CMDTIMEOUT_Pos 16 -#define SDIO_IF_CMDTIMEOUT_Msk (0x01 << SDIO_IF_CMDTIMEOUT_Pos) -#define SDIO_IF_CMDCRCERR_Pos 17 -#define SDIO_IF_CMDCRCERR_Msk (0x01 << SDIO_IF_CMDCRCERR_Pos) -#define SDIO_IF_CMDENDERR_Pos 18 -#define SDIO_IF_CMDENDERR_Msk (0x01 << SDIO_IF_CMDENDCERR_Pos) -#define SDIO_IF_CMDIDXERR_Pos 19 -#define SDIO_IF_CMDIDXERR_Msk (0x01 << SDIO_IF_CMDIDXCERR_Pos) -#define SDIO_IF_DATTIMEOUT_Pos 20 -#define SDIO_IF_DATTIMEOUT_Msk (0x01 << SDIO_IF_DATTIMEOUT_Pos) -#define SDIO_IF_DATCRCERR_Pos 21 -#define SDIO_IF_DATCRCERR_Msk (0x01 << SDIO_IF_DATCRCERR_Pos) -#define SDIO_IF_DATENDERR_Pos 22 -#define SDIO_IF_DATENDERR_Msk (0x01 << SDIO_IF_DATENDCERR_Pos) -#define SDIO_IF_CURLIMERR_Pos 23 -#define SDIO_IF_CURLIMERR_Msk (0x01 << SDIO_IF_CURLIMERR_Pos) -#define SDIO_IF_CMD12ERR_Pos 24 -#define SDIO_IF_CMD12ERR_Msk (0x01 << SDIO_IF_CMD12ERR_Pos) -#define SDIO_IF_DMAERR_Pos 25 -#define SDIO_IF_DMAERR_Msk (0x01 << SDIO_IF_DMAERR_Pos) -#define SDIO_IF_RESPERR_Pos 28 -#define SDIO_IF_RESPERR_Msk (0x01 << SDIO_IF_RESPERR_Pos) +#define SDIO_CR2_CLKEN_Pos 0 //Internal Clock Enable +#define SDIO_CR2_CLKEN_Msk (0x01 << SDIO_CR2_CLKEN_Pos) +#define SDIO_CR2_CLKRDY_Pos 1 //Internal Clock Stable/Ready +#define SDIO_CR2_CLKRDY_Msk (0x01 << SDIO_CR2_CLKRDY_Pos) +#define SDIO_CR2_SDCLKEN_Pos 2 //SDCLK Enable +#define SDIO_CR2_SDCLKEN_Msk (0x01 << SDIO_CR2_SDCLKEN_Pos) +#define SDIO_CR2_SDCLKDIV_Pos 8 //SDCLK Frequency Div, 0x00 不分频 0x01 2分频 0x02 4分频 0x04 8分频 0x08 16分频 ... 0x80 256分频 +#define SDIO_CR2_SDCLKDIV_Msk (0xFF << SDIO_CR2_SDCLKDIV_Pos) +#define SDIO_CR2_TIMEOUT_Pos 16 //0 TMCLK*2^13 1 TMCLK*2^14 ... 14 TMCLK*2^27 +#define SDIO_CR2_TIMEOUT_Msk (0x0F << SDIO_CR2_TIMEOUT_Pos) +#define SDIO_CR2_RSTALL_Pos 24 //Software Reset for All +#define SDIO_CR2_RSTALL_Msk (0x01 << SDIO_CR2_RSTALL_Pos) +#define SDIO_CR2_RSTCMD_Pos 25 //Software Reset for CMD Line +#define SDIO_CR2_RSTCMD_Msk (0x01 << SDIO_CR2_RSTCMD_Pos) +#define SDIO_CR2_RSTDAT_Pos 26 //Software Reset for DAT Line +#define SDIO_CR2_RSTDAT_Msk (0x01 << SDIO_CR2_RSTDAT_Pos) -#define SDIO_IE_CMDDONE_Pos 0 //Command Complete Status Enable -#define SDIO_IE_CMDDONE_Msk (0x01 << SDIO_IE_CMDDONE_Pos) -#define SDIO_IE_TRXDONE_Pos 1 //Transfer Complete Status Enable -#define SDIO_IE_TRXDONE_Msk (0x01 << SDIO_IE_TRXDONE_Pos) -#define SDIO_IE_BLKGAP_Pos 2 //Block Gap Event Status Enable -#define SDIO_IE_BLKGAP_Msk (0x01 << SDIO_IE_BLKGAP_Pos) -#define SDIO_IE_DMADONE_Pos 3 //DMA Interrupt Status Enable -#define SDIO_IE_DMADONE_Msk (0x01 << SDIO_IE_DMADONE_Pos) -#define SDIO_IE_BUFWRRDY_Pos 4 //Buffer Write Ready Status Enable -#define SDIO_IE_BUFWRRDY_Msk (0x01 << SDIO_IE_BUFWRRDY_Pos) -#define SDIO_IE_BUFRDRDY_Pos 5 //Buffer Read Ready Status Enable -#define SDIO_IE_BUFRDRDY_Msk (0x01 << SDIO_IE_BUFRDRDY_Pos) -#define SDIO_IE_CARDINSR_Pos 6 //Card Insertion Status Enable -#define SDIO_IE_CARDINSR_Msk (0x01 << SDIO_IE_CARDINSR_Pos) -#define SDIO_IE_CARDRMOV_Pos 7 //Card Removal Status Enable -#define SDIO_IE_CARDRMOV_Msk (0x01 << SDIO_IE_CARDRMOV_Pos) -#define SDIO_IE_CARD_Pos 8 -#define SDIO_IE_CARD_Msk (0x01 << SDIO_IE_CARD_Pos) -#define SDIO_IE_CMDTIMEOUT_Pos 16 //Command Timeout Error Status Enable -#define SDIO_IE_CMDTIMEOUT_Msk (0x01 << SDIO_IE_CMDTIMEOUT_Pos) -#define SDIO_IE_CMDCRCERR_Pos 17 //Command CRC Error Status Enable -#define SDIO_IE_CMDCRCERR_Msk (0x01 << SDIO_IE_CMDCRCERR_Pos) -#define SDIO_IE_CMDENDERR_Pos 18 //Command End Bit Error Status Enable -#define SDIO_IE_CMDENDERR_Msk (0x01 << SDIO_IE_CMDENDCERR_Pos) -#define SDIO_IE_CMDIDXERR_Pos 19 //Command Index Error Status Enable -#define SDIO_IE_CMDIDXERR_Msk (0x01 << SDIO_IE_CMDIDXCERR_Pos) -#define SDIO_IE_DATTIMEOUT_Pos 20 //Data Timeout Error Status Enable -#define SDIO_IE_DATTIMEOUT_Msk (0x01 << SDIO_IE_DATTIMEOUT_Pos) -#define SDIO_IE_DATCRCERR_Pos 21 //Data CRC Error Status Enable -#define SDIO_IE_DATCRCERR_Msk (0x01 << SDIO_IE_DATCRCERR_Pos) -#define SDIO_IE_DATENDERR_Pos 22 //Data End Bit Error Status Enable -#define SDIO_IE_DATENDERR_Msk (0x01 << SDIO_IE_DATENDCERR_Pos) -#define SDIO_IE_CURLIMERR_Pos 23 //Current Limit Error Status Enable -#define SDIO_IE_CURLIMERR_Msk (0x01 << SDIO_IE_CURLIMERR_Pos) -#define SDIO_IE_CMD12ERR_Pos 24 //Auto CMD12 Error Status Enable -#define SDIO_IE_CMD12ERR_Msk (0x01 << SDIO_IE_CMD12ERR_Pos) -#define SDIO_IE_DMAERR_Pos 25 //ADMA Error Status Enable -#define SDIO_IE_DMAERR_Msk (0x01 << SDIO_IE_DMAERR_Pos) -#define SDIO_IE_RESPERR_Pos 28 //Target Response Error Status Enable -#define SDIO_IE_RESPERR_Msk (0x01 << SDIO_IE_RESPERR_Pos) +#define SDIO_IF_CMDDONE_Pos 0 +#define SDIO_IF_CMDDONE_Msk (0x01 << SDIO_IF_CMDDONE_Pos) +#define SDIO_IF_TRXDONE_Pos 1 +#define SDIO_IF_TRXDONE_Msk (0x01 << SDIO_IF_TRXDONE_Pos) +#define SDIO_IF_BLKGAP_Pos 2 +#define SDIO_IF_BLKGAP_Msk (0x01 << SDIO_IF_BLKGAP_Pos) +#define SDIO_IF_DMADONE_Pos 3 +#define SDIO_IF_DMADONE_Msk (0x01 << SDIO_IF_DMADONE_Pos) +#define SDIO_IF_BUFWRRDY_Pos 4 +#define SDIO_IF_BUFWRRDY_Msk (0x01 << SDIO_IF_BUFWRRDY_Pos) +#define SDIO_IF_BUFRDRDY_Pos 5 +#define SDIO_IF_BUFRDRDY_Msk (0x01 << SDIO_IF_BUFRDRDY_Pos) +#define SDIO_IF_CARDINSR_Pos 6 +#define SDIO_IF_CARDINSR_Msk (0x01 << SDIO_IF_CARDINSR_Pos) +#define SDIO_IF_CARDRMOV_Pos 7 +#define SDIO_IF_CARDRMOV_Msk (0x01 << SDIO_IF_CARDRMOV_Pos) +#define SDIO_IF_CARD_Pos 8 +#define SDIO_IF_CARD_Msk (0x01 << SDIO_IF_CARD_Pos) +#define SDIO_IF_ERROR_Pos 15 +#define SDIO_IF_ERROR_Msk (0x01 << SDIO_IF_ERROR_Pos) +#define SDIO_IF_CMDTIMEOUT_Pos 16 +#define SDIO_IF_CMDTIMEOUT_Msk (0x01 << SDIO_IF_CMDTIMEOUT_Pos) +#define SDIO_IF_CMDCRCERR_Pos 17 +#define SDIO_IF_CMDCRCERR_Msk (0x01 << SDIO_IF_CMDCRCERR_Pos) +#define SDIO_IF_CMDENDERR_Pos 18 +#define SDIO_IF_CMDENDERR_Msk (0x01 << SDIO_IF_CMDENDCERR_Pos) +#define SDIO_IF_CMDIDXERR_Pos 19 +#define SDIO_IF_CMDIDXERR_Msk (0x01 << SDIO_IF_CMDIDXCERR_Pos) +#define SDIO_IF_DATTIMEOUT_Pos 20 +#define SDIO_IF_DATTIMEOUT_Msk (0x01 << SDIO_IF_DATTIMEOUT_Pos) +#define SDIO_IF_DATCRCERR_Pos 21 +#define SDIO_IF_DATCRCERR_Msk (0x01 << SDIO_IF_DATCRCERR_Pos) +#define SDIO_IF_DATENDERR_Pos 22 +#define SDIO_IF_DATENDERR_Msk (0x01 << SDIO_IF_DATENDCERR_Pos) +#define SDIO_IF_CURLIMERR_Pos 23 +#define SDIO_IF_CURLIMERR_Msk (0x01 << SDIO_IF_CURLIMERR_Pos) +#define SDIO_IF_CMD12ERR_Pos 24 +#define SDIO_IF_CMD12ERR_Msk (0x01 << SDIO_IF_CMD12ERR_Pos) +#define SDIO_IF_DMAERR_Pos 25 +#define SDIO_IF_DMAERR_Msk (0x01 << SDIO_IF_DMAERR_Pos) +#define SDIO_IF_RESPERR_Pos 28 +#define SDIO_IF_RESPERR_Msk (0x01 << SDIO_IF_RESPERR_Pos) -#define SDIO_IM_CMDDONE_Pos 0 -#define SDIO_IM_CMDDONE_Msk (0x01 << SDIO_IM_CMDDONE_Pos) -#define SDIO_IM_TRXDONE_Pos 1 -#define SDIO_IM_TRXDONE_Msk (0x01 << SDIO_IM_TRXDONE_Pos) -#define SDIO_IM_BLKGAP_Pos 2 -#define SDIO_IM_BLKGAP_Msk (0x01 << SDIO_IM_BLKGAP_Pos) -#define SDIO_IM_DMADONE_Pos 3 -#define SDIO_IM_DMADONE_Msk (0x01 << SDIO_IM_DMADONE_Pos) -#define SDIO_IM_BUFWRRDY_Pos 4 -#define SDIO_IM_BUFWRRDY_Msk (0x01 << SDIO_IM_BUFWRRDY_Pos) -#define SDIO_IM_BUFRDRDY_Pos 5 -#define SDIO_IM_BUFRDRDY_Msk (0x01 << SDIO_IM_BUFRDRDY_Pos) -#define SDIO_IM_CARDINSR_Pos 6 -#define SDIO_IM_CARDINSR_Msk (0x01 << SDIO_IM_CARDINSR_Pos) -#define SDIO_IM_CARDRMOV_Pos 7 -#define SDIO_IM_CARDRMOV_Msk (0x01 << SDIO_IM_CARDRMOV_Pos) -#define SDIO_IM_CARD_Pos 8 -#define SDIO_IM_CARD_Msk (0x01 << SDIO_IM_CARD_Pos) -#define SDIO_IM_CMDTIMEOUT_Pos 16 -#define SDIO_IM_CMDTIMEOUT_Msk (0x01 << SDIO_IM_CMDTIMEOUT_Pos) -#define SDIO_IM_CMDCRCERR_Pos 17 -#define SDIO_IM_CMDCRCERR_Msk (0x01 << SDIO_IM_CMDCRCERR_Pos) -#define SDIO_IM_CMDENDERR_Pos 18 -#define SDIO_IM_CMDENDERR_Msk (0x01 << SDIO_IM_CMDENDCERR_Pos) -#define SDIO_IM_CMDIDXERR_Pos 19 -#define SDIO_IM_CMDIDXERR_Msk (0x01 << SDIO_IM_CMDIDXCERR_Pos) -#define SDIO_IM_DATTIMEOUT_Pos 20 -#define SDIO_IM_DATTIMEOUT_Msk (0x01 << SDIO_IM_DATTIMEOUT_Pos) -#define SDIO_IM_DATCRCERR_Pos 21 -#define SDIO_IM_DATCRCERR_Msk (0x01 << SDIO_IM_DATCRCERR_Pos) -#define SDIO_IM_DATENDERR_Pos 22 -#define SDIO_IM_DATENDERR_Msk (0x01 << SDIO_IM_DATENDCERR_Pos) -#define SDIO_IM_CURLIMERR_Pos 23 -#define SDIO_IM_CURLIMERR_Msk (0x01 << SDIO_IM_CURLIMERR_Pos) -#define SDIO_IM_CMD12ERR_Pos 24 -#define SDIO_IM_CMD12ERR_Msk (0x01 << SDIO_IM_CMD12ERR_Pos) -#define SDIO_IM_DMAERR_Pos 25 -#define SDIO_IM_DMAERR_Msk (0x01 << SDIO_IM_DMAERR_Pos) -#define SDIO_IM_RESPERR_Pos 28 -#define SDIO_IM_RESPERR_Msk (0x01 << SDIO_IM_RESPERR_Pos) +#define SDIO_IE_CMDDONE_Pos 0 //Command Complete Status Enable +#define SDIO_IE_CMDDONE_Msk (0x01 << SDIO_IE_CMDDONE_Pos) +#define SDIO_IE_TRXDONE_Pos 1 //Transfer Complete Status Enable +#define SDIO_IE_TRXDONE_Msk (0x01 << SDIO_IE_TRXDONE_Pos) +#define SDIO_IE_BLKGAP_Pos 2 //Block Gap Event Status Enable +#define SDIO_IE_BLKGAP_Msk (0x01 << SDIO_IE_BLKGAP_Pos) +#define SDIO_IE_DMADONE_Pos 3 //DMA Interrupt Status Enable +#define SDIO_IE_DMADONE_Msk (0x01 << SDIO_IE_DMADONE_Pos) +#define SDIO_IE_BUFWRRDY_Pos 4 //Buffer Write Ready Status Enable +#define SDIO_IE_BUFWRRDY_Msk (0x01 << SDIO_IE_BUFWRRDY_Pos) +#define SDIO_IE_BUFRDRDY_Pos 5 //Buffer Read Ready Status Enable +#define SDIO_IE_BUFRDRDY_Msk (0x01 << SDIO_IE_BUFRDRDY_Pos) +#define SDIO_IE_CARDINSR_Pos 6 //Card Insertion Status Enable +#define SDIO_IE_CARDINSR_Msk (0x01 << SDIO_IE_CARDINSR_Pos) +#define SDIO_IE_CARDRMOV_Pos 7 //Card Removal Status Enable +#define SDIO_IE_CARDRMOV_Msk (0x01 << SDIO_IE_CARDRMOV_Pos) +#define SDIO_IE_CARD_Pos 8 +#define SDIO_IE_CARD_Msk (0x01 << SDIO_IE_CARD_Pos) +#define SDIO_IE_CMDTIMEOUT_Pos 16 //Command Timeout Error Status Enable +#define SDIO_IE_CMDTIMEOUT_Msk (0x01 << SDIO_IE_CMDTIMEOUT_Pos) +#define SDIO_IE_CMDCRCERR_Pos 17 //Command CRC Error Status Enable +#define SDIO_IE_CMDCRCERR_Msk (0x01 << SDIO_IE_CMDCRCERR_Pos) +#define SDIO_IE_CMDENDERR_Pos 18 //Command End Bit Error Status Enable +#define SDIO_IE_CMDENDERR_Msk (0x01 << SDIO_IE_CMDENDCERR_Pos) +#define SDIO_IE_CMDIDXERR_Pos 19 //Command Index Error Status Enable +#define SDIO_IE_CMDIDXERR_Msk (0x01 << SDIO_IE_CMDIDXCERR_Pos) +#define SDIO_IE_DATTIMEOUT_Pos 20 //Data Timeout Error Status Enable +#define SDIO_IE_DATTIMEOUT_Msk (0x01 << SDIO_IE_DATTIMEOUT_Pos) +#define SDIO_IE_DATCRCERR_Pos 21 //Data CRC Error Status Enable +#define SDIO_IE_DATCRCERR_Msk (0x01 << SDIO_IE_DATCRCERR_Pos) +#define SDIO_IE_DATENDERR_Pos 22 //Data End Bit Error Status Enable +#define SDIO_IE_DATENDERR_Msk (0x01 << SDIO_IE_DATENDCERR_Pos) +#define SDIO_IE_CURLIMERR_Pos 23 //Current Limit Error Status Enable +#define SDIO_IE_CURLIMERR_Msk (0x01 << SDIO_IE_CURLIMERR_Pos) +#define SDIO_IE_CMD12ERR_Pos 24 //Auto CMD12 Error Status Enable +#define SDIO_IE_CMD12ERR_Msk (0x01 << SDIO_IE_CMD12ERR_Pos) +#define SDIO_IE_DMAERR_Pos 25 //ADMA Error Status Enable +#define SDIO_IE_DMAERR_Msk (0x01 << SDIO_IE_DMAERR_Pos) +#define SDIO_IE_RESPERR_Pos 28 //Target Response Error Status Enable +#define SDIO_IE_RESPERR_Msk (0x01 << SDIO_IE_RESPERR_Pos) -typedef struct -{ - __IO uint32_t DATA; - __IO uint32_t ADDR; - __IO uint32_t _ERASE; //鍜宮mcsd_cmd.h(59)鍚嶅瓧鍐茬獊锛岃繖閲屼慨鏀逛负_ERASE - __IO uint32_t CACHE; - __IO uint32_t CFG0; - __IO uint32_t CFG1; - __IO uint32_t CFG2; - __IO uint32_t CFG3; - __IO uint32_t STAT; +#define SDIO_IM_CMDDONE_Pos 0 +#define SDIO_IM_CMDDONE_Msk (0x01 << SDIO_IM_CMDDONE_Pos) +#define SDIO_IM_TRXDONE_Pos 1 +#define SDIO_IM_TRXDONE_Msk (0x01 << SDIO_IM_TRXDONE_Pos) +#define SDIO_IM_BLKGAP_Pos 2 +#define SDIO_IM_BLKGAP_Msk (0x01 << SDIO_IM_BLKGAP_Pos) +#define SDIO_IM_DMADONE_Pos 3 +#define SDIO_IM_DMADONE_Msk (0x01 << SDIO_IM_DMADONE_Pos) +#define SDIO_IM_BUFWRRDY_Pos 4 +#define SDIO_IM_BUFWRRDY_Msk (0x01 << SDIO_IM_BUFWRRDY_Pos) +#define SDIO_IM_BUFRDRDY_Pos 5 +#define SDIO_IM_BUFRDRDY_Msk (0x01 << SDIO_IM_BUFRDRDY_Pos) +#define SDIO_IM_CARDINSR_Pos 6 +#define SDIO_IM_CARDINSR_Msk (0x01 << SDIO_IM_CARDINSR_Pos) +#define SDIO_IM_CARDRMOV_Pos 7 +#define SDIO_IM_CARDRMOV_Msk (0x01 << SDIO_IM_CARDRMOV_Pos) +#define SDIO_IM_CARD_Pos 8 +#define SDIO_IM_CARD_Msk (0x01 << SDIO_IM_CARD_Pos) +#define SDIO_IM_CMDTIMEOUT_Pos 16 +#define SDIO_IM_CMDTIMEOUT_Msk (0x01 << SDIO_IM_CMDTIMEOUT_Pos) +#define SDIO_IM_CMDCRCERR_Pos 17 +#define SDIO_IM_CMDCRCERR_Msk (0x01 << SDIO_IM_CMDCRCERR_Pos) +#define SDIO_IM_CMDENDERR_Pos 18 +#define SDIO_IM_CMDENDERR_Msk (0x01 << SDIO_IM_CMDENDCERR_Pos) +#define SDIO_IM_CMDIDXERR_Pos 19 +#define SDIO_IM_CMDIDXERR_Msk (0x01 << SDIO_IM_CMDIDXCERR_Pos) +#define SDIO_IM_DATTIMEOUT_Pos 20 +#define SDIO_IM_DATTIMEOUT_Msk (0x01 << SDIO_IM_DATTIMEOUT_Pos) +#define SDIO_IM_DATCRCERR_Pos 21 +#define SDIO_IM_DATCRCERR_Msk (0x01 << SDIO_IM_DATCRCERR_Pos) +#define SDIO_IM_DATENDERR_Pos 22 +#define SDIO_IM_DATENDERR_Msk (0x01 << SDIO_IM_DATENDCERR_Pos) +#define SDIO_IM_CURLIMERR_Pos 23 +#define SDIO_IM_CURLIMERR_Msk (0x01 << SDIO_IM_CURLIMERR_Pos) +#define SDIO_IM_CMD12ERR_Pos 24 +#define SDIO_IM_CMD12ERR_Msk (0x01 << SDIO_IM_CMD12ERR_Pos) +#define SDIO_IM_DMAERR_Pos 25 +#define SDIO_IM_DMAERR_Msk (0x01 << SDIO_IM_DMAERR_Pos) +#define SDIO_IM_RESPERR_Pos 28 +#define SDIO_IM_RESPERR_Msk (0x01 << SDIO_IM_RESPERR_Pos) + + + + +typedef struct { + __IO uint32_t DATA; + __IO uint32_t ADDR; + __IO uint32_t ERASE; + __IO uint32_t CACHE; + __IO uint32_t CFG0; + __IO uint32_t CFG1; + __IO uint32_t CFG2; + __IO uint32_t CFG3; + __IO uint32_t STAT; } FLASH_Typedef; -#define FLASH_ERASE_REQ_Pos 31 -#define FLASH_ERASE_REQ_Msk (0x01u << FLASH_ERASE_REQ_Pos) -#define FLASH_CACHE_PROG_Pos 2 -#define FLASH_CACHE_PROG_Msk (0x01 << FLASH_CACHE_PROG_Pos) -#define FLASH_CACHE_CLEAR_Pos 3 -#define FLASH_CACHE_CLEAR_Msk (0x01 << FLASH_CACHE_CLEAR_Pos) +#define FLASH_ERASE_REQ_Pos 31 +#define FLASH_ERASE_REQ_Msk (0x01u<< FLASH_ERASE_REQ_Pos) -#define FLASH_STAT_ERASE_GOING_Pos 0 -#define FLASH_STAT_ERASE_GOING_Msk (0X01 << FLASH_STAT_ERASE_GOING_Pos) -#define FLASH_STAT_PROG_GOING_Pos 1 -#define FLASH_STAT_PROG_GOING_Msk (0x01 << FLASH_STAT_PROG_GOING_Pos) -#define FALSH_STAT_FIFO_EMPTY_Pos 3 -#define FLASH_STAT_FIFO_EMPTY_Msk (0x01 << FALSH_STAT_FIFO_EMPTY_Pos) -#define FALSH_STAT_FIFO_FULL_Pos 4 -#define FLASH_STAT_FIFO_FULL_Msk (0x01 << FALSH_STAT_FIFO_FULL_Pos) +#define FLASH_CACHE_PROG_Pos 2 +#define FLASH_CACHE_PROG_Msk (0x01 << FLASH_CACHE_PROG_Pos) +#define FLASH_CACHE_CLEAR_Pos 3 +#define FLASH_CACHE_CLEAR_Msk (0x01 << FLASH_CACHE_CLEAR_Pos) -typedef struct -{ +#define FLASH_STAT_ERASE_GOING_Pos 0 +#define FLASH_STAT_ERASE_GOING_Msk (0X01 << FLASH_STAT_ERASE_GOING_Pos) +#define FLASH_STAT_PROG_GOING_Pos 1 +#define FLASH_STAT_PROG_GOING_Msk (0x01 << FLASH_STAT_PROG_GOING_Pos) +#define FALSH_STAT_FIFO_EMPTY_Pos 3 +#define FLASH_STAT_FIFO_EMPTY_Msk (0x01 << FALSH_STAT_FIFO_EMPTY_Pos) +#define FALSH_STAT_FIFO_FULL_Pos 4 +#define FLASH_STAT_FIFO_FULL_Msk (0x01 << FALSH_STAT_FIFO_FULL_Pos) + + + + +typedef struct { __IO uint32_t CR; } SRAMC_TypeDef; -#define SRAMC_CR_RWTIME_Pos 0 //璇诲啓鎿嶄綔鎸佺画澶氬皯涓椂閽熷懆鏈熴0琛ㄧず1涓椂閽熷懆鏈熴傛渶灏忚缃负4 -#define SRAMC_CR_RWTIME_Msk (0x0F << SRAMC_CR_RWTIME_Pos) -#define SRAMC_CR_BYTEIF_Pos 4 //澶栭儴SRAM鏁版嵁瀹藉害锛0 16浣 1 8浣 -#define SRAMC_CR_BYTEIF_Msk (0x01 << SRAMC_CR_BYTEIF_Pos) -#define SRAMC_CR_HBLBDIS_Pos 5 //1 ADDR[23:22]涓哄湴鍧绾 0 ADDR[23]涓洪珮瀛楄妭浣胯兘锛孉DDR[22]涓轰綆瀛楄妭浣胯兘 -#define SRAMC_CR_HBLBDIS_Msk (0x01 << SRAMC_CR_HBLBDIS_Pos) -typedef struct -{ +#define SRAMC_CR_RWTIME_Pos 0 //读写操作持续多少个时钟周期。0表示1个时钟周期。最小设置为4 +#define SRAMC_CR_RWTIME_Msk (0x0F << SRAMC_CR_RWTIME_Pos) +#define SRAMC_CR_BYTEIF_Pos 4 //外部SRAM数据宽度,0 16位 1 8位 +#define SRAMC_CR_BYTEIF_Msk (0x01 << SRAMC_CR_BYTEIF_Pos) +#define SRAMC_CR_HBLBDIS_Pos 5 //1 ADDR[23:22]为地址线 0 ADDR[23]为高字节使能,ADDR[22]为低字节使能 +#define SRAMC_CR_HBLBDIS_Msk (0x01 << SRAMC_CR_HBLBDIS_Pos) + + + +typedef struct { __IO uint32_t CR0; - + __IO uint32_t CR1; - + __IO uint32_t REFRESH; - - __IO uint32_t NOPNUM; //[15:0] 鍒濆鍖栧畬鎴愬悗锛屽湪姝e父鎿嶄綔涔嬪墠锛屽彂閫佸灏戜釜NOP鍛戒护 - + + __IO uint32_t NOPNUM; //[15:0] 初始化完成后,在正常操作之前,发送多少个NOP命令 + __IO uint32_t LATCH; - - __IO uint32_t REFDONE; //[0] Frefresh Done锛屼笂鐢靛垵濮嬪寲瀹屾垚 + + __IO uint32_t REFDONE; //[0] Frefresh Done,上电初始化完成 } SDRAMC_TypeDef; -#define SDRAMC_CR0_BURSTLEN_Pos 0 //蹇呴』鍙2锛岃〃绀築urst Length涓4 -#define SDRAMC_CR0_BURSTLEN_Msk (0x07 << SDRAMC_CR0_BURSTLEN_Pos) -#define SDRAMC_CR0_CASDELAY_Pos 4 //CAS Latency锛 2 2 3 3 -#define SDRAMC_CR0_CASDELAY_Msk (0x07 << SDRAMC_CR0_CASDELAY_Pos) -#define SDRAMC_CR1_TRP_Pos 0 -#define SDRAMC_CR1_TRP_Msk (0x07 << SDRAMC_CR1_TRP_Pos) -#define SDRAMC_CR1_TRCD_Pos 3 -#define SDRAMC_CR1_TRCD_Msk (0x07 << SDRAMC_CR1_TRCD_Pos) -#define SDRAMC_CR1_TRC_Pos 6 -#define SDRAMC_CR1_TRC_Msk (0x0F << SDRAMC_CR1_TRC_Pos) -#define SDRAMC_CR1_TRAS_Pos 10 -#define SDRAMC_CR1_TRAS_Msk (0x07 << SDRAMC_CR1_TRAS_Pos) -#define SDRAMC_CR1_TRRD_Pos 13 -#define SDRAMC_CR1_TRRD_Msk (0x03 << SDRAMC_CR1_TRRD_Pos) -#define SDRAMC_CR1_TMRD_Pos 15 -#define SDRAMC_CR1_TMRD_Msk (0x07 << SDRAMC_CR1_TMRD_Pos) -#define SDRAMC_CR1_32BIT_Pos 18 //SDRAMC鐨勬帴鍙f暟鎹綅瀹斤紝1 32bit 0 16bit -#define SDRAMC_CR1_32BIT_Msk (0x01 << SDRAMC_CR1_32BIT_Pos) -#define SDRAMC_CR1_BANK_Pos 19 //SDRAM姣忎釜棰楃矑鏈夊嚑涓猙ank锛0 2 banks 1 4 banks -#define SDRAMC_CR1_BANK_Msk (0x01 << SDRAMC_CR1_BANK_Pos) -#define SDRAMC_CR1_CELL32BIT_Pos 20 //SDRAM棰楃矑鐨勪綅瀹斤紝1 32bit 0 16bit -#define SDRAMC_CR1_CELL32BIT_Msk (0x01 << SDRAMC_CR1_CELL32BIT_Pos) -#define SDRAMC_CR1_CELLSIZE_Pos 21 //SDRAM棰楃矑鐨勫閲忥紝0 64Mb 1 128Mb 2 256Mb 3 16Mb -#define SDRAMC_CR1_CELLSIZE_Msk (0x03 << SDRAMC_CR1_CELLSIZE_Pos) -#define SDRAMC_CR1_HIGHSPEED_Pos 23 //褰揾clk澶т簬100MHz鏃讹紝杩欎竴浣嶅繀椤婚厤缃负1锛屽惁鍒欎负0 -#define SDRAMC_CR1_HIGHSPEED_Msk (0x01 << SDRAMC_CR1_HIGHSPEED_Pos) +#define SDRAMC_CR0_BURSTLEN_Pos 0 //必须取2,表示Burst Length为4 +#define SDRAMC_CR0_BURSTLEN_Msk (0x07 << SDRAMC_CR0_BURSTLEN_Pos) +#define SDRAMC_CR0_CASDELAY_Pos 4 //CAS Latency, 2 2 3 3 +#define SDRAMC_CR0_CASDELAY_Msk (0x07 << SDRAMC_CR0_CASDELAY_Pos) -#define SDRAMC_REFRESH_RATE_Pos 0 -#define SDRAMC_REFRESH_RATE_Msk (0xFFF << SDRAMC_REFRESH_RATE_Pos) -#define SDRAMC_REFRESH_EN_Pos 12 -#define SDRAMC_REFRESH_EN_Msk (0x01 << SDRAMC_REFRESH_EN_Pos) +#define SDRAMC_CR1_TRP_Pos 0 +#define SDRAMC_CR1_TRP_Msk (0x07 << SDRAMC_CR1_TRP_Pos) +#define SDRAMC_CR1_TRCD_Pos 3 +#define SDRAMC_CR1_TRCD_Msk (0x07 << SDRAMC_CR1_TRCD_Pos) +#define SDRAMC_CR1_TRC_Pos 6 +#define SDRAMC_CR1_TRC_Msk (0x0F << SDRAMC_CR1_TRC_Pos) +#define SDRAMC_CR1_TRAS_Pos 10 +#define SDRAMC_CR1_TRAS_Msk (0x07 << SDRAMC_CR1_TRAS_Pos) +#define SDRAMC_CR1_TRRD_Pos 13 +#define SDRAMC_CR1_TRRD_Msk (0x03 << SDRAMC_CR1_TRRD_Pos) +#define SDRAMC_CR1_TMRD_Pos 15 +#define SDRAMC_CR1_TMRD_Msk (0x07 << SDRAMC_CR1_TMRD_Pos) +#define SDRAMC_CR1_32BIT_Pos 18 //SDRAMC的接口数据位宽,1 32bit 0 16bit +#define SDRAMC_CR1_32BIT_Msk (0x01 << SDRAMC_CR1_32BIT_Pos) +#define SDRAMC_CR1_BANK_Pos 19 //SDRAM每个颗粒有几个bank,0 2 banks 1 4 banks +#define SDRAMC_CR1_BANK_Msk (0x01 << SDRAMC_CR1_BANK_Pos) +#define SDRAMC_CR1_CELL32BIT_Pos 20 //SDRAM颗粒的位宽,1 32bit 0 16bit +#define SDRAMC_CR1_CELL32BIT_Msk (0x01 << SDRAMC_CR1_CELL32BIT_Pos) +#define SDRAMC_CR1_CELLSIZE_Pos 21 //SDRAM颗粒的容量,0 64Mb 1 128Mb 2 256Mb 3 16Mb +#define SDRAMC_CR1_CELLSIZE_Msk (0x03 << SDRAMC_CR1_CELLSIZE_Pos) +#define SDRAMC_CR1_HIGHSPEED_Pos 23 //当hclk大于100MHz时,这一位必须配置为1,否则为0 +#define SDRAMC_CR1_HIGHSPEED_Msk (0x01 << SDRAMC_CR1_HIGHSPEED_Pos) -#define SDRAMC_LATCH_INEDGE_Pos 0 //鍝釜娌挎潵閿佸瓨浠嶴DRAM涓鍥炵殑鏁版嵁锛0 涓婂崌娌 1 涓嬮檷娌 -#define SDRAMC_LATCH_INEDGE_Msk (0x01 << SDRAMC_LATCH_INEDGE_Pos) -#define SDRAMC_LATCH_OUTEDGE_Pos 1 //鍝釜娌垮幓閿佸瓨閫佺粰SDRAM鐨勬暟鎹紝1 涓婂崌娌 0 涓嬮檷娌 -#define SDRAMC_LATCH_OUTEDGE_Msk (0x01 << SDRAMC_LATCH_OUTEDGE_Pos) -#define SDRAMC_LATCH_WAITST_Pos 2 -#define SDRAMC_LATCH_WAITST_Msk (0x01 << SDRAMC_LATCH_WAITST_Pos) +#define SDRAMC_REFRESH_RATE_Pos 0 +#define SDRAMC_REFRESH_RATE_Msk (0xFFF << SDRAMC_REFRESH_RATE_Pos) +#define SDRAMC_REFRESH_EN_Pos 12 +#define SDRAMC_REFRESH_EN_Msk (0x01 << SDRAMC_REFRESH_EN_Pos) -typedef struct -{ +#define SDRAMC_LATCH_INEDGE_Pos 0 //哪个沿来锁存从SDRAM中读回的数据,0 上升沿 1 下降沿 +#define SDRAMC_LATCH_INEDGE_Msk (0x01 << SDRAMC_LATCH_INEDGE_Pos) +#define SDRAMC_LATCH_OUTEDGE_Pos 1 //哪个沿去锁存送给SDRAM的数据,1 上升沿 0 下降沿 +#define SDRAMC_LATCH_OUTEDGE_Msk (0x01 << SDRAMC_LATCH_OUTEDGE_Pos) +#define SDRAMC_LATCH_WAITST_Pos 2 +#define SDRAMC_LATCH_WAITST_Msk (0x01 << SDRAMC_LATCH_WAITST_Pos) + + + + +typedef struct { __IO uint32_t IE; - - __IO uint32_t IF; //鍐1娓呴浂 - + + __IO uint32_t IF; //写1清零 + __IO uint32_t IM; - + __IO uint32_t CR; - + __IO uint32_t ADDR; - + __IO uint32_t CMD; } NORFLC_TypeDef; -#define NORFLC_IE_FINISH_Pos 0 -#define NORFLC_IE_FINISH_Msk (0x01 << NORFLC_IE_FINISH_Pos) -#define NORFLC_IE_TIMEOUT_Pos 1 -#define NORFLC_IE_TIMEOUT_Msk (0x01 << NORFLC_IE_TIMEOUT_Pos) -#define NORFLC_IF_FINISH_Pos 0 -#define NORFLC_IF_FINISH_Msk (0x01 << NORFLC_IF_FINISH_Pos) -#define NORFLC_IF_TIMEOUT_Pos 1 -#define NORFLC_IF_TIMEOUT_Msk (0x01 << NORFLC_IF_TIMEOUT_Pos) +#define NORFLC_IE_FINISH_Pos 0 +#define NORFLC_IE_FINISH_Msk (0x01 << NORFLC_IE_FINISH_Pos) +#define NORFLC_IE_TIMEOUT_Pos 1 +#define NORFLC_IE_TIMEOUT_Msk (0x01 << NORFLC_IE_TIMEOUT_Pos) -#define NORFLC_IM_FINISH_Pos 0 -#define NORFLC_IM_FINISH_Msk (0x01 << NORFLC_IM_FINISH_Pos) -#define NORFLC_IM_TIMEOUT_Pos 1 -#define NORFLC_IM_TIMEOUT_Msk (0x01 << NORFLC_IM_TIMEOUT_Pos) +#define NORFLC_IF_FINISH_Pos 0 +#define NORFLC_IF_FINISH_Msk (0x01 << NORFLC_IF_FINISH_Pos) +#define NORFLC_IF_TIMEOUT_Pos 1 +#define NORFLC_IF_TIMEOUT_Msk (0x01 << NORFLC_IF_TIMEOUT_Pos) -#define NORFLC_CR_RDTIME_Pos 0 //Oen涓嬮檷娌垮悗澶氬皯涓椂閽熷懆鏈熷悗閲囨牱璇诲洖鐨勬暟鎹0琛ㄧず1涓椂閽熷懆鏈 -#define NORFLC_CR_RDTIME_Msk (0x1F << NORFLC_CR_RDTIME_Pos) -#define NORFLC_CR_WRTIME_Pos 5 //杈撳嚭Wen鐨勪綆鐢靛钩瀹藉害銆0琛ㄧず1涓椂閽熷懆鏈 -#define NORFLC_CR_WRTIME_Msk (0x07 << NORFLC_CR_WRTIME_Pos) -#define NORFLC_CR_BYTEIF_Pos 8 //澶栭儴NOR FLASH鏁版嵁瀹藉害锛1 8浣 0 16浣 -#define NORFLC_CR_BYTEIF_Msk (0x01 << NORFLC_CR_BYTEIF_Pos) +#define NORFLC_IM_FINISH_Pos 0 +#define NORFLC_IM_FINISH_Msk (0x01 << NORFLC_IM_FINISH_Pos) +#define NORFLC_IM_TIMEOUT_Pos 1 +#define NORFLC_IM_TIMEOUT_Msk (0x01 << NORFLC_IM_TIMEOUT_Pos) -#define NORFLC_CMD_DATA_Pos 0 //鍦≒ROGRAM鍛戒护涓紝DATA鏄鍐欏叆NOR FLASH鐨勬暟鎹紱鍦≧EAD鍛戒护涓紝DATA鏄粠NOR FLASH璇诲洖鐨勬暟鎹 -#define NORFLC_CMD_DATA_Msk (0xFFFF << NORFLC_CMD_DATA_Pos) -#define NORFLC_CMD_CMD_Pos 16 //闇瑕佹墽琛岀殑鍛戒护锛0 READ 1 RESET 2 AUTOMATIC SELECT 3 PROGRAM 4 CHIP ERASE 5 SECTOR ERASE -#define NORFLC_CMD_CMD_Msk (0x07 << NORFLC_CMD_CMD_Pos) +#define NORFLC_CR_RDTIME_Pos 0 //Oen下降沿后多少个时钟周期后采样读回的数据。0表示1个时钟周期 +#define NORFLC_CR_RDTIME_Msk (0x1F << NORFLC_CR_RDTIME_Pos) +#define NORFLC_CR_WRTIME_Pos 5 //输出Wen的低电平宽度。0表示1个时钟周期 +#define NORFLC_CR_WRTIME_Msk (0x07 << NORFLC_CR_WRTIME_Pos) +#define NORFLC_CR_BYTEIF_Pos 8 //外部NOR FLASH数据宽度,1 8位 0 16位 +#define NORFLC_CR_BYTEIF_Msk (0x01 << NORFLC_CR_BYTEIF_Pos) -typedef struct -{ +#define NORFLC_CMD_DATA_Pos 0 //在PROGRAM命令中,DATA是要写入NOR FLASH的数据;在READ命令中,DATA是从NOR FLASH读回的数据 +#define NORFLC_CMD_DATA_Msk (0xFFFF << NORFLC_CMD_DATA_Pos) +#define NORFLC_CMD_CMD_Pos 16 //需要执行的命令,0 READ 1 RESET 2 AUTOMATIC SELECT 3 PROGRAM 4 CHIP ERASE 5 SECTOR ERASE +#define NORFLC_CMD_CMD_Msk (0x07 << NORFLC_CMD_CMD_Pos) + + + + +typedef struct { __IO uint32_t CR; - - __O uint32_t DATAIN; - + + __O uint32_t DATAIN; + __IO uint32_t INIVAL; - - __I uint32_t RESULT; + + __I uint32_t RESULT; } CRC_TypeDef; -#define CRC_CR_EN_Pos 0 -#define CRC_CR_EN_Msk (0x01 << CRC_CR_EN_Pos) -#define CRC_CR_OREV_Pos 1 //杈撳嚭缁撴灉鏄惁缈昏浆 -#define CRC_CR_OREV_Msk (0x01 << CRC_CR_OREV_Pos) -#define CRC_CR_ONOT_Pos 2 //杈撳嚭缁撴灉鏄惁鍙栧弽 -#define CRC_CR_ONOT_Msk (0x01 << CRC_CR_ONOT_Pos) -#define CRC_CR_CRC16_Pos 3 //1 CRC16 0 CRC32 -#define CRC_CR_CRC16_Msk (0x01 << CRC_CR_CRC16_Pos) -#define CRC_CR_IBITS_Pos 4 //杈撳叆鏁版嵁鏈夋晥浣嶆暟 0 32浣 1 16浣 2 8浣 -#define CRC_CR_IBITS_Msk (0x03 << CRC_CR_IBITS_Pos) -typedef struct -{ - __IO uint32_t MINSEC; //鍒嗙璁℃暟 +#define CRC_CR_EN_Pos 0 +#define CRC_CR_EN_Msk (0x01 << CRC_CR_EN_Pos) +#define CRC_CR_OREV_Pos 1 //输出结果是否翻转 +#define CRC_CR_OREV_Msk (0x01 << CRC_CR_OREV_Pos) +#define CRC_CR_ONOT_Pos 2 //输出结果是否取反 +#define CRC_CR_ONOT_Msk (0x01 << CRC_CR_ONOT_Pos) +#define CRC_CR_CRC16_Pos 3 //1 CRC16 0 CRC32 +#define CRC_CR_CRC16_Msk (0x01 << CRC_CR_CRC16_Pos) +#define CRC_CR_IBITS_Pos 4 //输入数据有效位数 0 32位 1 16位 2 8位 +#define CRC_CR_IBITS_Msk (0x03 << CRC_CR_IBITS_Pos) - __IO uint32_t DATHUR; //鏃ユ椂璁℃暟 - __IO uint32_t MONDAY; //鏈堝懆璁℃暟 - __IO uint32_t YEAR; //[11:0] 骞磋鏁帮紝鏀寔1901-2199 - - __IO uint32_t MINSECAL; //鍒嗙闂归搩璁剧疆 - - __IO uint32_t DAYHURAL; //鍛ㄦ椂闂归搩璁剧疆 - - __IO uint32_t LOAD; //灏嗚缃瘎瀛樺櫒涓殑鍊煎悓姝ュ埌RTC涓紝鍚屾瀹屾垚鑷姩娓呴浂 +typedef struct { + __IO uint32_t MINSEC; //分秒计数 + + __IO uint32_t DATHUR; //日时计数 + + __IO uint32_t MONDAY; //月周计数 + + __IO uint32_t YEAR; //[11:0] 年计数,支持1901-2199 + + __IO uint32_t MINSECAL; //分秒闹铃设置 + + __IO uint32_t DAYHURAL; //周时闹铃设置 + + __IO uint32_t LOAD; //将设置寄存器中的值同步到RTC中,同步完成自动清零 + __IO uint32_t IE; - - __IO uint32_t IF; //鍐1娓呴浂 - - __IO uint32_t EN; //[0] 1 RTC浣胯兘 - - __IO uint32_t CFGABLE; //[0] 1 RTC鍙厤缃 - - __IO uint32_t TRIM; //鏃堕挓璋冩暣 - - __IO uint32_t TRIMM; //鏃堕挓寰皟鏁 + + __IO uint32_t IF; //写1清零 + + __IO uint32_t EN; //[0] 1 RTC使能 + + __IO uint32_t CFGABLE; //[0] 1 RTC可配置 + + __IO uint32_t TRIM; //时钟调整 + + __IO uint32_t TRIMM; //时钟微调整 } RTC_TypeDef; -#define RTC_LOAD_TIME_Pos 0 -#define RTC_LOAD_TIME_Msk (0x01 << RTC_LOAD_TIME_Pos) -#define RTC_LOAD_ALARM_Pos 1 -#define RTC_LOAD_ALARM_Msk (0x01 << RTC_LOAD_ALARM_Pos) -#define RTC_MINSEC_SEC_Pos 0 //绉掕鏁帮紝鍙栧0--59 -#define RTC_MINSEC_SEC_Msk (0x3F << RTC_MINSEC_SEC_Pos) -#define RTC_MINSEC_MIN_Pos 6 //鍒嗛挓璁℃暟锛屽彇鍊0--59 -#define RTC_MINSEC_MIN_Msk (0x3F << RTC_MINSEC_MIN_Pos) +#define RTC_LOAD_TIME_Pos 0 +#define RTC_LOAD_TIME_Msk (0x01 << RTC_LOAD_TIME_Pos) +#define RTC_LOAD_ALARM_Pos 1 +#define RTC_LOAD_ALARM_Msk (0x01 << RTC_LOAD_ALARM_Pos) -#define RTC_DATHUR_HOUR_Pos 0 //灏忔椂璁℃暟锛屽彇鍊0--23 -#define RTC_DATHUR_HOUR_Msk (0x1F << RTC_DATHUR_HOUR_Pos) -#define RTC_DATHUR_DATE_Pos 5 //date of month锛屽彇鍊1--31 -#define RTC_DATHUR_DATE_Msk (0x1F << RTC_DATHUR_DATE_Pos) +#define RTC_MINSEC_SEC_Pos 0 //秒计数,取值0--59 +#define RTC_MINSEC_SEC_Msk (0x3F << RTC_MINSEC_SEC_Pos) +#define RTC_MINSEC_MIN_Pos 6 //分钟计数,取值0--59 +#define RTC_MINSEC_MIN_Msk (0x3F << RTC_MINSEC_MIN_Pos) -#define RTC_MONDAY_DAY_Pos 0 //day of week锛屽彇鍊0--6 -#define RTC_MONDAY_DAY_Msk (0x07 << RTC_MONDAY_DAY_Pos) -#define RTC_MONDAY_MON_Pos 3 //鏈堜唤璁℃暟锛屽彇鍊1--12 -#define RTC_MONDAY_MON_Msk (0x0F << RTC_MONDAY_MON_Pos) +#define RTC_DATHUR_HOUR_Pos 0 //小时计数,取值0--23 +#define RTC_DATHUR_HOUR_Msk (0x1F << RTC_DATHUR_HOUR_Pos) +#define RTC_DATHUR_DATE_Pos 5 //date of month,取值1--31 +#define RTC_DATHUR_DATE_Msk (0x1F << RTC_DATHUR_DATE_Pos) -#define RTC_MINSECAL_SEC_Pos 0 //闂归挓绉掕缃 -#define RTC_MINSECAL_SEC_Msk (0x3F << RTC_MINSECAL_SEC_Pos) -#define RTC_MINSECAL_MIN_Pos 6 //闂归挓鍒嗛挓璁剧疆 -#define RTC_MINSECAL_MIN_Msk (0x3F << RTC_MINSECAL_MIN_Pos) +#define RTC_MONDAY_DAY_Pos 0 //day of week,取值0--6 +#define RTC_MONDAY_DAY_Msk (0x07 << RTC_MONDAY_DAY_Pos) +#define RTC_MONDAY_MON_Pos 3 //月份计数,取值1--12 +#define RTC_MONDAY_MON_Msk (0x0F << RTC_MONDAY_MON_Pos) -#define RTC_DAYHURAL_HOUR_Pos 0 //闂归挓灏忔椂璁剧疆 -#define RTC_DAYHURAL_HOUR_Msk (0x1F << RTC_DAYHURAL_HOUR_Pos) -#define RTC_DAYHURAL_SUN_Pos 5 //鍛ㄦ棩闂归挓鏈夋晥 -#define RTC_DAYHURAL_SUN_Msk (0x01 << RTC_DAYHURAL_SUN_Pos) -#define RTC_DAYHURAL_MON_Pos 6 //鍛ㄤ竴闂归挓鏈夋晥 -#define RTC_DAYHURAL_MON_Msk (0x01 << RTC_DAYHURAL_MON_Pos) -#define RTC_DAYHURAL_TUE_Pos 7 //鍛ㄤ簩闂归挓鏈夋晥 -#define RTC_DAYHURAL_TUE_Msk (0x01 << RTC_DAYHURAL_TUE_Pos) -#define RTC_DAYHURAL_WED_Pos 8 //鍛ㄤ笁闂归挓鏈夋晥 -#define RTC_DAYHURAL_WED_Msk (0x01 << RTC_DAYHURAL_WED_Pos) -#define RTC_DAYHURAL_THU_Pos 9 //鍛ㄥ洓闂归挓鏈夋晥 -#define RTC_DAYHURAL_THU_Msk (0x01 << RTC_DAYHURAL_THU_Pos) -#define RTC_DAYHURAL_FRI_Pos 10 //鍛ㄤ簲闂归挓鏈夋晥 -#define RTC_DAYHURAL_FRI_Msk (0x01 << RTC_DAYHURAL_FRI_Pos) -#define RTC_DAYHURAL_SAT_Pos 11 //鍛ㄥ叚闂归挓鏈夋晥 -#define RTC_DAYHURAL_SAT_Msk (0x01 << RTC_DAYHURAL_SAT_Pos) +#define RTC_MINSECAL_SEC_Pos 0 //闹钟秒设置 +#define RTC_MINSECAL_SEC_Msk (0x3F << RTC_MINSECAL_SEC_Pos) +#define RTC_MINSECAL_MIN_Pos 6 //闹钟分钟设置 +#define RTC_MINSECAL_MIN_Msk (0x3F << RTC_MINSECAL_MIN_Pos) -#define RTC_IE_SEC_Pos 0 //绉掍腑鏂娇鑳 -#define RTC_IE_SEC_Msk (0x01 << RTC_IE_SEC_Pos) -#define RTC_IE_MIN_Pos 1 -#define RTC_IE_MIN_Msk (0x01 << RTC_IE_MIN_Pos) -#define RTC_IE_HOUR_Pos 2 -#define RTC_IE_HOUR_Msk (0x01 << RTC_IE_HOUR_Pos) -#define RTC_IE_DATE_Pos 3 -#define RTC_IE_DATE_Msk (0x01 << RTC_IE_DATE_Pos) -#define RTC_IE_ALARM_Pos 4 -#define RTC_IE_ALARM_Msk (0x01 << RTC_IE_ALARM_Pos) +#define RTC_DAYHURAL_HOUR_Pos 0 //闹钟小时设置 +#define RTC_DAYHURAL_HOUR_Msk (0x1F << RTC_DAYHURAL_HOUR_Pos) +#define RTC_DAYHURAL_SUN_Pos 5 //周日闹钟有效 +#define RTC_DAYHURAL_SUN_Msk (0x01 << RTC_DAYHURAL_SUN_Pos) +#define RTC_DAYHURAL_MON_Pos 6 //周一闹钟有效 +#define RTC_DAYHURAL_MON_Msk (0x01 << RTC_DAYHURAL_MON_Pos) +#define RTC_DAYHURAL_TUE_Pos 7 //周二闹钟有效 +#define RTC_DAYHURAL_TUE_Msk (0x01 << RTC_DAYHURAL_TUE_Pos) +#define RTC_DAYHURAL_WED_Pos 8 //周三闹钟有效 +#define RTC_DAYHURAL_WED_Msk (0x01 << RTC_DAYHURAL_WED_Pos) +#define RTC_DAYHURAL_THU_Pos 9 //周四闹钟有效 +#define RTC_DAYHURAL_THU_Msk (0x01 << RTC_DAYHURAL_THU_Pos) +#define RTC_DAYHURAL_FRI_Pos 10 //周五闹钟有效 +#define RTC_DAYHURAL_FRI_Msk (0x01 << RTC_DAYHURAL_FRI_Pos) +#define RTC_DAYHURAL_SAT_Pos 11 //周六闹钟有效 +#define RTC_DAYHURAL_SAT_Msk (0x01 << RTC_DAYHURAL_SAT_Pos) -#define RTC_IF_SEC_Pos 0 //鍐1娓呴浂 -#define RTC_IF_SEC_Msk (0x01 << RTC_IF_SEC_Pos) -#define RTC_IF_MIN_Pos 1 -#define RTC_IF_MIN_Msk (0x01 << RTC_IF_MIN_Pos) -#define RTC_IF_HOUR_Pos 2 -#define RTC_IF_HOUR_Msk (0x01 << RTC_IF_HOUR_Pos) -#define RTC_IF_DATE_Pos 3 -#define RTC_IF_DATE_Msk (0x01 << RTC_IF_DATE_Pos) -#define RTC_IF_ALARM_Pos 4 -#define RTC_IF_ALARM_Msk (0x01 << RTC_IF_ALARM_Pos) +#define RTC_IE_SEC_Pos 0 //秒中断使能 +#define RTC_IE_SEC_Msk (0x01 << RTC_IE_SEC_Pos) +#define RTC_IE_MIN_Pos 1 +#define RTC_IE_MIN_Msk (0x01 << RTC_IE_MIN_Pos) +#define RTC_IE_HOUR_Pos 2 +#define RTC_IE_HOUR_Msk (0x01 << RTC_IE_HOUR_Pos) +#define RTC_IE_DATE_Pos 3 +#define RTC_IE_DATE_Msk (0x01 << RTC_IE_DATE_Pos) +#define RTC_IE_ALARM_Pos 4 +#define RTC_IE_ALARM_Msk (0x01 << RTC_IE_ALARM_Pos) -#define RTC_TRIM_ADJ_Pos 0 //鐢ㄤ簬璋冩暣BASECNT鐨勮鏁板懆鏈燂紝榛樿涓32768锛屽鏋淒EC涓1锛屽垯璁℃暟鍛ㄦ湡璋冩暣涓32768-ADJ锛屽惁鍒欒皟鏁翠负32768+ADJ -#define RTC_TRIM_ADJ_Msk (0xFF << RTC_TRIM_ADJ_Pos) -#define RTC_TRIM_DEC_Pos 8 -#define RTC_TRIM_DEC_Msk (0x01 << RTC_TRIM_DEC_Pos) +#define RTC_IF_SEC_Pos 0 //写1清零 +#define RTC_IF_SEC_Msk (0x01 << RTC_IF_SEC_Pos) +#define RTC_IF_MIN_Pos 1 +#define RTC_IF_MIN_Msk (0x01 << RTC_IF_MIN_Pos) +#define RTC_IF_HOUR_Pos 2 +#define RTC_IF_HOUR_Msk (0x01 << RTC_IF_HOUR_Pos) +#define RTC_IF_DATE_Pos 3 +#define RTC_IF_DATE_Msk (0x01 << RTC_IF_DATE_Pos) +#define RTC_IF_ALARM_Pos 4 +#define RTC_IF_ALARM_Msk (0x01 << RTC_IF_ALARM_Pos) -#define RTC_TRIMM_CYCLE_Pos 0 //鐢ㄤ簬璁℃暟鍛ㄦ湡寰皟锛屽鏋淚NC涓1锛屽垯绗琻涓鏁板懆鏈熻皟鏁翠负(32768卤ADJ)+1,鍚﹀垯璋冩暣涓(32768卤ADJ)-1 \ - //cycles=0鏃讹紝涓嶈繘琛屽井璋冩暣锛沜ycles=1锛屽垯n涓2锛沜ycles=7锛屽垯n涓8锛涗互姝ょ被鎺 -#define RTC_TRIMM_CYCLE_Msk (0x07 << RTC_TRIMM_CYCLE_Pos) -#define RTC_TRIMM_INC_Pos 3 -#define RTC_TRIMM_INC_Msk (0x01 << RTC_TRIMM_INC_Pos) +#define RTC_TRIM_ADJ_Pos 0 //用于调整BASECNT的计数周期,默认为32768,如果DEC为1,则计数周期调整为32768-ADJ,否则调整为32768+ADJ +#define RTC_TRIM_ADJ_Msk (0xFF << RTC_TRIM_ADJ_Pos) +#define RTC_TRIM_DEC_Pos 8 +#define RTC_TRIM_DEC_Msk (0x01 << RTC_TRIM_DEC_Pos) -typedef struct -{ - __IO uint32_t LOAD; //鍠傜嫍浣胯鏁板櫒瑁呰浇LOAD鍊 +#define RTC_TRIMM_CYCLE_Pos 0 //用于计数周期微调,如果INC为1,则第n个计数周期调整为(32768±ADJ)+1,否则调整为(32768±ADJ)-1 + //cycles=0时,不进行微调整;cycles=1,则n为2;cycles=7,则n为8;以此类推 +#define RTC_TRIMM_CYCLE_Msk (0x07 << RTC_TRIMM_CYCLE_Pos) +#define RTC_TRIMM_INC_Pos 3 +#define RTC_TRIMM_INC_Msk (0x01 << RTC_TRIMM_INC_Pos) - __I uint32_t VALUE; - __IO uint32_t CR; - __IO uint32_t IF; //璁℃暟鍒0鏃剁‖浠剁疆浣嶏紝杞欢鍐1娓呴櫎鏍囧織 - __IO uint32_t FEED; //鍐0x55鍠傜嫍 +typedef struct { + __IO uint32_t LOAD; //喂狗使计数器装载LOAD值 + + __I uint32_t VALUE; + + __IO uint32_t CR; + + __IO uint32_t IF; //计数到0时硬件置位,软件写1清除标志 + + __IO uint32_t FEED; //写0x55喂狗 } WDT_TypeDef; -#define WDT_CR_EN_Pos 0 -#define WDT_CR_EN_Msk (0x01 << WDT_CR_EN_Pos) -#define WDT_CR_RSTEN_Pos 1 -#define WDT_CR_RSTEN_Msk (0x01 << WDT_CR_RSTEN_Pos) + +#define WDT_CR_EN_Pos 0 +#define WDT_CR_EN_Msk (0x01 << WDT_CR_EN_Pos) +#define WDT_CR_RSTEN_Pos 1 +#define WDT_CR_RSTEN_Msk (0x01 << WDT_CR_RSTEN_Pos) + /******************************************************************************/ /* Peripheral memory map */ /******************************************************************************/ -#define RAM_BASE 0x20000000 -#define AHB_BASE 0x40000000 -#define APB_BASE 0x40010000 +#define RAM_BASE 0x20000000 +#define AHB_BASE 0x40000000 +#define APB_BASE 0x40010000 -#define NORFLC_BASE 0x60000000 -#define NORFLM_BASE 0x61000000 +#define NORFLC_BASE 0x60000000 +#define NORFLM_BASE 0x61000000 -#define SRAMC_BASE 0x68000000 -#define SRAMM_BASE 0x69000000 +#define SRAMC_BASE 0x68000000 +#define SRAMM_BASE 0x69000000 -#define SDRAMC_BASE 0x78000000 -#define SDRAMM_BASE 0x70000000 +#define SDRAMC_BASE 0x78000000 +#define SDRAMM_BASE 0x70000000 /* AHB Peripheral memory map */ -#define SYS_BASE (AHB_BASE + 0x00000) +#define SYS_BASE (AHB_BASE + 0x00000) -#define DMA_BASE (AHB_BASE + 0x01000) +#define DMA_BASE (AHB_BASE + 0x01000) -#define LCD_BASE (AHB_BASE + 0x02000) +#define LCD_BASE (AHB_BASE + 0x02000) -#define CRC_BASE (AHB_BASE + 0x03000) +#define CRC_BASE (AHB_BASE + 0x03000) -#define SDIO_BASE (AHB_BASE + 0x04000) +#define SDIO_BASE (AHB_BASE + 0x04000) /* APB Peripheral memory map */ -#define PORT_BASE (APB_BASE + 0x00000) +#define PORT_BASE (APB_BASE + 0x00000) -#define GPIOA_BASE (APB_BASE + 0x01000) -#define GPIOB_BASE (APB_BASE + 0x02000) -#define GPIOC_BASE (APB_BASE + 0x03000) -#define GPIOD_BASE (APB_BASE + 0x04000) -#define GPIOM_BASE (APB_BASE + 0x05000) -#define GPION_BASE (APB_BASE + 0x06000) -#define GPIOP_BASE (APB_BASE + 0x08000) +#define GPIOA_BASE (APB_BASE + 0x01000) +#define GPIOB_BASE (APB_BASE + 0x02000) +#define GPIOC_BASE (APB_BASE + 0x03000) +#define GPIOD_BASE (APB_BASE + 0x04000) +#define GPIOM_BASE (APB_BASE + 0x05000) +#define GPION_BASE (APB_BASE + 0x06000) +#define GPIOP_BASE (APB_BASE + 0x08000) -#define TIMR0_BASE (APB_BASE + 0x07000) -#define TIMR1_BASE (APB_BASE + 0x0700C) -#define TIMR2_BASE (APB_BASE + 0x07018) -#define TIMR3_BASE (APB_BASE + 0x07024) -#define TIMR4_BASE (APB_BASE + 0x07030) -#define TIMR5_BASE (APB_BASE + 0x0703C) -#define TIMRG_BASE (APB_BASE + 0x07060) +#define TIMR0_BASE (APB_BASE + 0x07000) +#define TIMR1_BASE (APB_BASE + 0x0700C) +#define TIMR2_BASE (APB_BASE + 0x07018) +#define TIMR3_BASE (APB_BASE + 0x07024) +#define TIMR4_BASE (APB_BASE + 0x07030) +#define TIMR5_BASE (APB_BASE + 0x0703C) +#define TIMRG_BASE (APB_BASE + 0x07060) -#define WDT_BASE (APB_BASE + 0x09000) +#define WDT_BASE (APB_BASE + 0x09000) -#define PWM0_BASE (APB_BASE + 0x0A000) -#define PWM1_BASE (APB_BASE + 0x0A020) -#define PWM2_BASE (APB_BASE + 0x0A040) -#define PWM3_BASE (APB_BASE + 0x0A060) -#define PWM4_BASE (APB_BASE + 0x0A080) -#define PWM5_BASE (APB_BASE + 0x0A0A0) -#define PWMG_BASE (APB_BASE + 0x0A180) +#define PWM0_BASE (APB_BASE + 0x0A000) +#define PWM1_BASE (APB_BASE + 0x0A020) +#define PWM2_BASE (APB_BASE + 0x0A040) +#define PWM3_BASE (APB_BASE + 0x0A060) +#define PWM4_BASE (APB_BASE + 0x0A080) +#define PWM5_BASE (APB_BASE + 0x0A0A0) +#define PWMG_BASE (APB_BASE + 0x0A180) -#define RTC_BASE (APB_BASE + 0x0B000) +#define RTC_BASE (APB_BASE + 0x0B000) -#define ADC0_BASE (APB_BASE + 0x0C000) -#define ADC1_BASE (APB_BASE + 0x0D000) +#define ADC0_BASE (APB_BASE + 0x0C000) +#define ADC1_BASE (APB_BASE + 0x0D000) -#define FLASH_BASE (APB_BASE + 0x0F000) +#define FLASH_BASE (APB_BASE + 0x0F000) -#define UART0_BASE (APB_BASE + 0x10000) -#define UART1_BASE (APB_BASE + 0x11000) -#define UART2_BASE (APB_BASE + 0x12000) -#define UART3_BASE (APB_BASE + 0x13000) +#define UART0_BASE (APB_BASE + 0x10000) +#define UART1_BASE (APB_BASE + 0x11000) +#define UART2_BASE (APB_BASE + 0x12000) +#define UART3_BASE (APB_BASE + 0x13000) -#define I2C0_BASE (APB_BASE + 0x18000) -#define I2C1_BASE (APB_BASE + 0x19000) +#define I2C0_BASE (APB_BASE + 0x18000) +#define I2C1_BASE (APB_BASE + 0x19000) -#define SPI0_BASE (APB_BASE + 0x1C000) -#define SPI1_BASE (APB_BASE + 0x1D000) +#define SPI0_BASE (APB_BASE + 0x1C000) +#define SPI1_BASE (APB_BASE + 0x1D000) + +#define CAN_BASE (APB_BASE + 0x20000) -#define CAN_BASE (APB_BASE + 0x20000) /******************************************************************************/ /* Peripheral declaration */ /******************************************************************************/ -#define SYS ((SYS_TypeDef *)SYS_BASE) +#define SYS ((SYS_TypeDef *) SYS_BASE) -#define PORT ((PORT_TypeDef *)PORT_BASE) +#define PORT ((PORT_TypeDef *) PORT_BASE) -#define GPIOA ((GPIO_TypeDef *)GPIOA_BASE) -#define GPIOB ((GPIO_TypeDef *)GPIOB_BASE) -#define GPIOC ((GPIO_TypeDef *)GPIOC_BASE) -#define GPIOM ((GPIO_TypeDef *)GPIOM_BASE) -#define GPION ((GPIO_TypeDef *)GPION_BASE) -#define GPIOP ((GPIO_TypeDef *)GPIOP_BASE) +#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE) +#define GPIOB ((GPIO_TypeDef *) GPIOB_BASE) +#define GPIOC ((GPIO_TypeDef *) GPIOC_BASE) +#define GPIOM ((GPIO_TypeDef *) GPIOM_BASE) +#define GPION ((GPIO_TypeDef *) GPION_BASE) +#define GPIOP ((GPIO_TypeDef *) GPIOP_BASE) -#define TIMR0 ((TIMR_TypeDef *)TIMR0_BASE) -#define TIMR1 ((TIMR_TypeDef *)TIMR1_BASE) -#define TIMR2 ((TIMR_TypeDef *)TIMR2_BASE) -#define TIMR3 ((TIMR_TypeDef *)TIMR3_BASE) -#define TIMR4 ((TIMR_TypeDef *)TIMR4_BASE) -#define TIMR5 ((TIMR_TypeDef *)TIMR5_BASE) -#define TIMRG ((TIMRG_TypeDef *)TIMRG_BASE) +#define TIMR0 ((TIMR_TypeDef *) TIMR0_BASE) +#define TIMR1 ((TIMR_TypeDef *) TIMR1_BASE) +#define TIMR2 ((TIMR_TypeDef *) TIMR2_BASE) +#define TIMR3 ((TIMR_TypeDef *) TIMR3_BASE) +#define TIMR4 ((TIMR_TypeDef *) TIMR4_BASE) +#define TIMR5 ((TIMR_TypeDef *) TIMR5_BASE) +#define TIMRG ((TIMRG_TypeDef*) TIMRG_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 UART0 ((UART_TypeDef *) UART0_BASE) +#define UART1 ((UART_TypeDef *) UART1_BASE) +#define UART2 ((UART_TypeDef *) UART2_BASE) +#define UART3 ((UART_TypeDef *) UART3_BASE) -#define SPI0 ((SPI_TypeDef *)SPI0_BASE) -#define SPI1 ((SPI_TypeDef *)SPI1_BASE) +#define SPI0 ((SPI_TypeDef *) SPI0_BASE) +#define SPI1 ((SPI_TypeDef *) SPI1_BASE) -#define I2C0 ((I2C_TypeDef *)I2C0_BASE) -#define I2C1 ((I2C_TypeDef *)I2C1_BASE) +#define I2C0 ((I2C_TypeDef *) I2C0_BASE) +#define I2C1 ((I2C_TypeDef *) I2C1_BASE) -#define ADC0 ((ADC_TypeDef *)ADC0_BASE) -#define ADC1 ((ADC_TypeDef *)ADC1_BASE) +#define ADC0 ((ADC_TypeDef *) ADC0_BASE) +#define ADC1 ((ADC_TypeDef *) ADC1_BASE) -#define PWM0 ((PWM_TypeDef *)PWM0_BASE) -#define PWM1 ((PWM_TypeDef *)PWM1_BASE) -#define PWM2 ((PWM_TypeDef *)PWM2_BASE) -#define PWM3 ((PWM_TypeDef *)PWM3_BASE) -#define PWM4 ((PWM_TypeDef *)PWM4_BASE) -#define PWM5 ((PWM_TypeDef *)PWM5_BASE) -#define PWMG ((PWMG_TypeDef *)PWMG_BASE) +#define PWM0 ((PWM_TypeDef *) PWM0_BASE) +#define PWM1 ((PWM_TypeDef *) PWM1_BASE) +#define PWM2 ((PWM_TypeDef *) PWM2_BASE) +#define PWM3 ((PWM_TypeDef *) PWM3_BASE) +#define PWM4 ((PWM_TypeDef *) PWM4_BASE) +#define PWM5 ((PWM_TypeDef *) PWM5_BASE) +#define PWMG ((PWMG_TypeDef *) PWMG_BASE) -#define SDIO ((SDIO_TypeDef *)SDIO_BASE) +#define SDIO ((SDIO_TypeDef *) SDIO_BASE) -#define DMA ((DMA_TypeDef *)DMA_BASE) +#define DMA ((DMA_TypeDef *) DMA_BASE) -#define CAN ((CAN_TypeDef *)CAN_BASE) +#define CAN ((CAN_TypeDef *) CAN_BASE) -#define LCD ((LCD_TypeDef *)LCD_BASE) +#define LCD ((LCD_TypeDef *) LCD_BASE) -#define CRC ((CRC_TypeDef *)CRC_BASE) +#define CRC ((CRC_TypeDef *) CRC_BASE) -#define RTC ((RTC_TypeDef *)RTC_BASE) +#define RTC ((RTC_TypeDef *) RTC_BASE) -#define WDT ((WDT_TypeDef *)WDT_BASE) +#define WDT ((WDT_TypeDef *) WDT_BASE) -#define FLASH ((FLASH_Typedef *)FLASH_BASE) +#define FLASH ((FLASH_Typedef*) FLASH_BASE) -#define SRAMC ((SRAMC_TypeDef *)SRAMC_BASE) +#define SRAMC ((SRAMC_TypeDef*) SRAMC_BASE) -#define NORFLC ((NORFLC_TypeDef *)NORFLC_BASE) +#define NORFLC ((NORFLC_TypeDef*) NORFLC_BASE) -#define SDRAMC ((SDRAMC_TypeDef *)SDRAMC_BASE) +#define SDRAMC ((SDRAMC_TypeDef*) SDRAMC_BASE) + + + +typedef void (* Func_void_void) (void); -typedef void (*Func_void_void)(void); #include "SWM320_port.h" #include "SWM320_gpio.h" @@ -3564,4 +3622,5 @@ typedef void (*Func_void_void)(void); #include "SWM320_rtc.h" #include "SWM320_wdt.h" + #endif //__SWM320_H__ diff --git a/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.c b/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.c index c367b17d11..a99fa78fc9 100644 --- a/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.c +++ b/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.c @@ -1,262 +1,280 @@ -/****************************************************************************************************************************************** -* 鏂囦欢鍚嶇О: system_SWM320.c -* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑鏃堕挓璁剧疆 -* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 娉ㄦ剰浜嬮」: -* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 -* 鍗囩骇璁板綍: +/****************************************************************************************************************************************** +* 文件名称: system_SWM320.c +* 功能说明: SWM320单片机的时钟设置 +* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 注意事项: +* 版本日期: V1.1.0 2017年10月25日 +* 升级记录: * * ******************************************************************************************************************************************* * @attention * -* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION -* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE -* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION +* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE +* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT * OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN- * -ECTION WITH THEIR PRODUCTS. * * COPYRIGHT 2012 Synwit Technology -*******************************************************************************************************************************************/ +*******************************************************************************************************************************************/ #include #include "SWM320.h" + /****************************************************************************************************************************************** - * 绯荤粺鏃堕挓璁惧畾 + * 系统时钟设定 *****************************************************************************************************************************************/ -#define SYS_CLK_20MHz 0 //0 鍐呴儴楂橀20MHz RC鎸崱鍣 -#define SYS_CLK_40MHz 1 //1 鍐呴儴楂橀40MHz RC鎸崱鍣 -#define SYS_CLK_32KHz 2 //2 鍐呴儴浣庨32KHz RC鎸崱鍣 -#define SYS_CLK_XTAL 3 //3 澶栭儴鏅朵綋鎸崱鍣紙2-30MHz锛 -#define SYS_CLK_PLL 4 //4 鐗囧唴閿佺浉鐜緭鍑 +#define SYS_CLK_20MHz 0 //0 内部高频20MHz RC振荡器 +#define SYS_CLK_40MHz 1 //1 内部高频40MHz RC振荡器 +#define SYS_CLK_32KHz 2 //2 内部低频32KHz RC振荡器 +#define SYS_CLK_XTAL 3 //3 外部晶体振荡器(2-30MHz) +#define SYS_CLK_PLL 4 //4 片内锁相环输出 -#define SYS_CLK SYS_CLK_PLL +#define SYS_CLK SYS_CLK_PLL -#define SYS_CLK_DIV_1 0 -#define SYS_CLK_DIV_2 1 -#define SYS_CLK_DIV SYS_CLK_DIV_1 +#define SYS_CLK_DIV_1 0 +#define SYS_CLK_DIV_2 1 -#define __HSI (20000000UL) //楂橀熷唴閮ㄦ椂閽 -#define __LSI (32000UL) //浣庨熷唴閮ㄦ椂閽 -#define __HSE (20000000UL) //楂橀熷閮ㄦ椂閽 +#define SYS_CLK_DIV SYS_CLK_DIV_1 -/********************************** PLL 璁惧畾 ********************************************** - * VCO杈撳嚭棰戠巼 = PLL杈撳叆鏃堕挓 / INDIV * 4 * FBDIV - * PLL杈撳嚭棰戠巼 = PLL杈撳叆鏃堕挓 / INDIV * 4 * FBDIV / OUTDIV = VCO杈撳嚭棰戠巼 / OUTDIV - *****************************************************************************************/ -#define SYS_PLL_SRC SYS_CLK_20MHz //鍙彇鍊糞YS_CLK_20MHz銆丼YS_CLK_XTAL -#define PLL_IN_DIV 5 +#define __HSI (20000000UL) //高速内部时钟 +#define __LSI ( 32000UL) //低速内部时钟 +#define __HSE (20000000UL) //高速外部时钟 -#define PLL_FB_DIV 60 -#define PLL_OUT_DIV8 0 -#define PLL_OUT_DIV4 1 -#define PLL_OUT_DIV2 2 +/********************************** PLL 设定 ********************************************** + * VCO输出频率 = PLL输入时钟 / INDIV * 4 * FBDIV + * PLL输出频率 = PLL输入时钟 / INDIV * 4 * FBDIV / OUTDIV = VCO输出频率 / OUTDIV + *****************************************************************************************/ +#define SYS_PLL_SRC SYS_CLK_20MHz //可取值SYS_CLK_20MHz、SYS_CLK_XTAL -#define PLL_OUT_DIV PLL_OUT_DIV8 +#define PLL_IN_DIV 5 -uint32_t SystemCoreClock = __HSI; //System Clock Frequency (Core Clock) -uint32_t CyclesPerUs = (__HSI / 1000000); //Cycles per micro second +#define PLL_FB_DIV 60 -/****************************************************************************************************************************************** -* 鍑芥暟鍚嶇О: -* 鍔熻兘璇存槑: This function is used to update the variable SystemCoreClock and must be called whenever the core clock is changed -* 杈 鍏: -* 杈 鍑: -* 娉ㄦ剰浜嬮」: + +#define PLL_OUT_DIV8 0 +#define PLL_OUT_DIV4 1 +#define PLL_OUT_DIV2 2 + +#define PLL_OUT_DIV PLL_OUT_DIV8 + + + +uint32_t SystemCoreClock = __HSI; //System Clock Frequency (Core Clock) +uint32_t CyclesPerUs = (__HSI / 1000000); //Cycles per micro second + + +/****************************************************************************************************************************************** +* 函数名称: +* 功能说明: This function is used to update the variable SystemCoreClock and must be called whenever the core clock is changed +* 输 入: +* 输 出: +* 注意事项: ******************************************************************************************************************************************/ -void SystemCoreClockUpdate(void) +void SystemCoreClockUpdate(void) { - if (SYS->CLKSEL & SYS_CLKSEL_SYS_Msk) //SYS_CLK <= HFCK - { - if (SYS->CLKSEL & SYS_CLKSEL_HFCK_Msk) //HFCK <= XTAL - { - SystemCoreClock = __HSE; - } - else //HFCK <= HRC - { - if (SYS->HRCCR & SYS_HRCCR_DBL_Msk) //HRC = 40MHz - { - SystemCoreClock = __HSI * 2; - } - else //HRC = 20MHz - { - SystemCoreClock = __HSI; - } - } - } - else //SYS_CLK <= LFCK - { - if (SYS->CLKSEL & SYS_CLKSEL_LFCK_Msk) //LFCK <= PLL - { - if (SYS->PLLCR & SYS_PLLCR_INSEL_Msk) //PLL_SRC <= HRC - { - SystemCoreClock = __HSI; - } - else //PLL_SRC <= XTAL - { - SystemCoreClock = __HSE; - } - - SystemCoreClock = SystemCoreClock / PLL_IN_DIV * PLL_FB_DIV * 4 / (2 << (2 - PLL_OUT_DIV)); - } - else //LFCK <= LRC - { - SystemCoreClock = __LSI; - } - } - - if (SYS->CLKDIV & SYS_CLKDIV_SYS_Msk) - SystemCoreClock /= 2; - - CyclesPerUs = SystemCoreClock / 1000000; + if(SYS->CLKSEL & SYS_CLKSEL_SYS_Msk) //SYS_CLK <= HFCK + { + if(SYS->CLKSEL & SYS_CLKSEL_HFCK_Msk) //HFCK <= XTAL + { + SystemCoreClock = __HSE; + } + else //HFCK <= HRC + { + if(SYS->HRCCR & SYS_HRCCR_DBL_Msk) //HRC = 40MHz + { + SystemCoreClock = __HSI*2; + } + else //HRC = 20MHz + { + SystemCoreClock = __HSI; + } + } + } + else //SYS_CLK <= LFCK + { + if(SYS->CLKSEL & SYS_CLKSEL_LFCK_Msk) //LFCK <= PLL + { + if(SYS->PLLCR & SYS_PLLCR_INSEL_Msk) //PLL_SRC <= HRC + { + SystemCoreClock = __HSI; + } + else //PLL_SRC <= XTAL + { + SystemCoreClock = __HSE; + } + + SystemCoreClock = SystemCoreClock / PLL_IN_DIV * PLL_FB_DIV * 4 / (2 << (2 - PLL_OUT_DIV)); + } + else //LFCK <= LRC + { + SystemCoreClock = __LSI; + } + } + + if(SYS->CLKDIV & SYS_CLKDIV_SYS_Msk) SystemCoreClock /= 2; + + CyclesPerUs = SystemCoreClock / 1000000; } -/****************************************************************************************************************************************** -* 鍑芥暟鍚嶇О: -* 鍔熻兘璇存槑: The necessary initializaiton of systerm -* 杈 鍏: -* 杈 鍑: -* 娉ㄦ剰浜嬮」: +/****************************************************************************************************************************************** +* 函数名称: +* 功能说明: The necessary initializaiton of systerm +* 输 入: +* 输 出: +* 注意事项: ******************************************************************************************************************************************/ void SystemInit(void) -{ - SYS->CLKEN |= (1 << SYS_CLKEN_ANAC_Pos); - - switch (SYS_CLK) - { - case SYS_CLK_20MHz: //0 鍐呴儴楂橀20MHz RC鎸崱鍣 - switchCLK_20MHz(); - break; - - case SYS_CLK_40MHz: //1 鍐呴儴楂橀40MHz RC鎸崱鍣 - switchCLK_40MHz(); - break; - - case SYS_CLK_32KHz: //2 鍐呴儴浣庨32KHz RC鎸崱鍣 - switchCLK_32KHz(); - break; - - case SYS_CLK_XTAL: //3 澶栭儴鏅朵綋鎸崱鍣紙2-30MHz锛 - switchCLK_XTAL(); - break; - - case SYS_CLK_PLL: //4 鐗囧唴閿佺浉鐜緭鍑 - switchCLK_PLL(); - break; - } - - SYS->CLKDIV &= ~SYS_CLKDIV_SYS_Msk; - SYS->CLKDIV |= (SYS_CLK_DIV << SYS_CLKDIV_SYS_Pos); - - SystemCoreClockUpdate(); +{ + SYS->CLKEN |= (1 << SYS_CLKEN_ANAC_Pos); + + Flash_Param_at_xMHz(120); + + switch(SYS_CLK) + { + case SYS_CLK_20MHz: //0 内部高频20MHz RC振荡器 + switchCLK_20MHz(); + break; + + case SYS_CLK_40MHz: //1 内部高频40MHz RC振荡器 + switchCLK_40MHz(); + break; + + case SYS_CLK_32KHz: //2 内部低频32KHz RC振荡器 + switchCLK_32KHz(); + break; + + case SYS_CLK_XTAL: //3 外部晶体振荡器(2-30MHz) + switchCLK_XTAL(); + break; + + case SYS_CLK_PLL: //4 片内锁相环输出 + switchCLK_PLL(); + break; + } + + SYS->CLKDIV &= ~SYS_CLKDIV_SYS_Msk; + SYS->CLKDIV |= (SYS_CLK_DIV << SYS_CLKDIV_SYS_Pos); + + SystemCoreClockUpdate(); + + if(SystemCoreClock > 80000000) + { + Flash_Param_at_xMHz(120); + } + else if(SystemCoreClock > 40000000) + { + Flash_Param_at_xMHz(80); + } + else if(SystemCoreClock > 30000000) + { + Flash_Param_at_xMHz(40); + } + else + { + Flash_Param_at_xMHz(30); + } } void switchCLK_20MHz(void) { - uint32_t i; - - SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | - (0 << SYS_HRCCR_DBL_Pos); //HRC = 20MHz - - for (i = 0; i < 1000; i++) - __NOP(); - - SYS->CLKSEL &= ~SYS_CLKSEL_HFCK_Msk; //HFCK <= HRC - SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK + uint32_t i; + + SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | + (0 << SYS_HRCCR_DBL_Pos); //HRC = 20MHz + + for(i = 0; i < 1000; i++) __NOP(); + + SYS->CLKSEL &= ~SYS_CLKSEL_HFCK_Msk; //HFCK <= HRC + SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK } void switchCLK_40MHz(void) { - uint32_t i; - - SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | - (1 << SYS_HRCCR_DBL_Pos); //HRC = 40MHz - - for (i = 0; i < 1000; i++) - __NOP(); - - SYS->CLKSEL &= ~SYS_CLKSEL_HFCK_Msk; //HFCK <= HRC - SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK + uint32_t i; + + SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | + (1 << SYS_HRCCR_DBL_Pos); //HRC = 40MHz + + for(i = 0; i < 1000; i++) __NOP(); + + SYS->CLKSEL &= ~SYS_CLKSEL_HFCK_Msk; //HFCK <= HRC + SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK } void switchCLK_32KHz(void) { - uint32_t i; - - SYS->CLKEN |= (1 << SYS_CLKEN_RTCBKP_Pos); - - SYS->LRCCR &= ~(1 << SYS_LRCCR_OFF_Pos); - - for (i = 0; i < 100; i++) - __NOP(); - - SYS->CLKSEL &= ~SYS_CLKSEL_LFCK_Msk; //LFCK <= LRC - SYS->CLKSEL &= ~SYS_CLKSEL_SYS_Msk; //SYS_CLK <= LFCK + uint32_t i; + + SYS->CLKEN |= (1 << SYS_CLKEN_RTCBKP_Pos); + + SYS->LRCCR &= ~(1 << SYS_LRCCR_OFF_Pos); + + for(i = 0; i < 100; i++) __NOP(); + + SYS->CLKSEL &= ~SYS_CLKSEL_LFCK_Msk; //LFCK <= LRC + SYS->CLKSEL &= ~SYS_CLKSEL_SYS_Msk; //SYS_CLK <= LFCK } void switchCLK_XTAL(void) { - uint32_t i; - - SYS->XTALCR = (1 << SYS_XTALCR_EN_Pos); - - for (i = 0; i < 1000; i++) - __NOP(); - - SYS->CLKSEL |= (1 << SYS_CLKSEL_HFCK_Pos); //HFCK <= XTAL - SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK + uint32_t i; + + SYS->XTALCR = (1 << SYS_XTALCR_EN_Pos); + + for(i = 0; i < 1000; i++) __NOP(); + + SYS->CLKSEL |= (1 << SYS_CLKSEL_HFCK_Pos); //HFCK <= XTAL + SYS->CLKSEL |= (1 << SYS_CLKSEL_SYS_Pos); //SYS_CLK <= HFCK } void switchCLK_PLL(void) { - uint32_t i; - - PLLInit(); - SYS->PLLCR |= (1 << SYS_PLLCR_OUTEN_Pos); - - for (i = 0; i < 10000; i++) - __NOP(); - - SYS->CLKSEL |= (1 << SYS_CLKSEL_LFCK_Pos); //LFCK <= PLL - SYS->CLKSEL &= ~SYS_CLKSEL_SYS_Msk; //SYS_CLK <= LFCK + uint32_t i; + + PLLInit(); + SYS->PLLCR |= (1 << SYS_PLLCR_OUTEN_Pos); + + for(i = 0; i < 10000; i++) __NOP(); + + SYS->CLKSEL |= (1 << SYS_CLKSEL_LFCK_Pos); //LFCK <= PLL + SYS->CLKSEL &= ~SYS_CLKSEL_SYS_Msk; //SYS_CLK <= LFCK } void PLLInit(void) { - uint32_t i; - - if (SYS_PLL_SRC == SYS_CLK_20MHz) - { - SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | - (0 << SYS_HRCCR_DBL_Pos); //HRC = 20MHz - - for (i = 0; i < 1000; i++) - __NOP(); - - SYS->PLLCR |= (1 << SYS_PLLCR_INSEL_Pos); //PLL_SRC <= HRC - } - else if (SYS_PLL_SRC == SYS_CLK_XTAL) - { - SYS->XTALCR = (1 << SYS_XTALCR_EN_Pos); - - for (i = 0; i < 20000; i++) - ; - - SYS->PLLCR &= ~(1 << SYS_PLLCR_INSEL_Pos); //PLL_SRC <= XTAL - } - - SYS->PLLDIV &= ~(SYS_PLLDIV_INDIV_Msk | - SYS_PLLDIV_FBDIV_Msk | - SYS_PLLDIV_OUTDIV_Msk); - SYS->PLLDIV |= (PLL_IN_DIV << SYS_PLLDIV_INDIV_Pos) | - (PLL_FB_DIV << SYS_PLLDIV_FBDIV_Pos) | - (PLL_OUT_DIV << SYS_PLLDIV_OUTDIV_Pos); - - SYS->PLLCR &= ~(1 << SYS_PLLCR_OFF_Pos); - - while (SYS->PLLLOCK == 0) - ; //绛夊緟PLL閿佸畾 + uint32_t i; + + if(SYS_PLL_SRC == SYS_CLK_20MHz) + { + SYS->HRCCR = (0 << SYS_HRCCR_OFF_Pos) | + (0 << SYS_HRCCR_DBL_Pos); //HRC = 20MHz + + for(i = 0; i < 1000; i++) __NOP(); + + SYS->PLLCR |= (1 << SYS_PLLCR_INSEL_Pos); //PLL_SRC <= HRC + } + else if(SYS_PLL_SRC == SYS_CLK_XTAL) + { + SYS->XTALCR = (1 << SYS_XTALCR_EN_Pos); + + for(i = 0; i < 20000; i++); + + SYS->PLLCR &= ~(1 << SYS_PLLCR_INSEL_Pos); //PLL_SRC <= XTAL + } + + SYS->PLLDIV &= ~(SYS_PLLDIV_INDIV_Msk | + SYS_PLLDIV_FBDIV_Msk | + SYS_PLLDIV_OUTDIV_Msk); + SYS->PLLDIV |= (PLL_IN_DIV << SYS_PLLDIV_INDIV_Pos) | + (PLL_FB_DIV << SYS_PLLDIV_FBDIV_Pos) | + (PLL_OUT_DIV<< SYS_PLLDIV_OUTDIV_Pos); + + SYS->PLLCR &= ~(1 << SYS_PLLCR_OFF_Pos); + + while(SYS->PLLLOCK == 0); //等待PLL锁定 } diff --git a/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.h b/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.h index 4db7f29433..3967e4059c 100644 --- a/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.h +++ b/bsp/swm320/libraries/CMSIS/DeviceSupport/system_SWM320.h @@ -2,24 +2,28 @@ #define __SYSTEM_SWM320_H__ #ifdef __cplusplus -extern "C" -{ + extern "C" { #endif - extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock) - extern uint32_t CyclesPerUs; // Cycles per micro second - extern void SystemInit(void); +extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock) +extern uint32_t CyclesPerUs; // Cycles per micro second - extern void SystemCoreClockUpdate(void); - extern void switchCLK_20MHz(void); - extern void switchCLK_40MHz(void); - extern void switchCLK_32KHz(void); - extern void switchCLK_XTAL(void); - extern void switchCLK_PLL(void); +extern void SystemInit(void); + +extern void SystemCoreClockUpdate (void); + + + +extern void switchCLK_20MHz(void); +extern void switchCLK_40MHz(void); +extern void switchCLK_32KHz(void); +extern void switchCLK_XTAL(void); +extern void switchCLK_PLL(void); + +extern void PLLInit(void); - extern void PLLInit(void); #ifdef __cplusplus } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.c index 7f5f64e84e..8f73ec62c9 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_adc.c -* 功能说明: SWM320单片机的ADC数模转换器功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_adc.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑ADC鏁版ā杞崲鍣ㄥ姛鑳介┍鍔ㄥ簱 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: ******************************************************************************************************************************************* * @attention * @@ -21,12 +21,12 @@ /****************************************************************************************************************************************** -* 函数名称: ADC_Init() -* 功能说明: ADC模数转换器初始化 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,有效值包括ADC0、ADC1 -* ADC_InitStructure * initStruct 包含ADC各相关定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Init() +* 鍔熻兘璇存槑: ADC妯℃暟杞崲鍣ㄥ垵濮嬪寲 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屾湁鏁堝煎寘鎷珹DC0銆丄DC1 +* ADC_InitStructure * initStruct 鍖呭惈ADC鍚勭浉鍏冲畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct) { @@ -41,7 +41,7 @@ void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct) break; } - ADC_Close(ADCx); //一些关键寄存器只能在ADC关闭时设置 + ADC_Close(ADCx); //涓浜涘叧閿瘎瀛樺櫒鍙兘鍦ˋDC鍏抽棴鏃惰缃 if(initStruct->clk_src == ADC_CLKSRC_HRC) { @@ -80,7 +80,7 @@ void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct) (initStruct->trig_src << ADC_CTRL_TRIG_Pos) | (initStruct->Continue << ADC_CTRL_CONT_Pos); - ADCx->IF = 0xFFFFFFFF; //清除中断标志 + ADCx->IF = 0xFFFFFFFF; //娓呴櫎涓柇鏍囧織 ADCx->IE &= ~(ADC_IE_CH0EOC_Msk | ADC_IE_CH1EOC_Msk | ADC_IE_CH2EOC_Msk | ADC_IE_CH3EOC_Msk | ADC_IE_CH4EOC_Msk | ADC_IE_CH5EOC_Msk | ADC_IE_CH6EOC_Msk | ADC_IE_CH7EOC_Msk); @@ -153,11 +153,11 @@ void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: ADC_Open() -* 功能说明: ADC开启,可以软件启动、或硬件触发ADC转换 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Open() +* 鍔熻兘璇存槑: ADC寮鍚紝鍙互杞欢鍚姩銆佹垨纭欢瑙﹀彂ADC杞崲 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_Open(ADC_TypeDef * ADCx) { @@ -165,11 +165,11 @@ void ADC_Open(ADC_TypeDef * ADCx) } /****************************************************************************************************************************************** -* 函数名称: ADC_Close() -* 功能说明: ADC关闭,无法软件启动、或硬件触发ADC转换 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Close() +* 鍔熻兘璇存槑: ADC鍏抽棴锛屾棤娉曡蒋浠跺惎鍔ㄣ佹垨纭欢瑙﹀彂ADC杞崲 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_Close(ADC_TypeDef * ADCx) { @@ -177,11 +177,11 @@ void ADC_Close(ADC_TypeDef * ADCx) } /****************************************************************************************************************************************** -* 函数名称: ADC_Start() -* 功能说明: 软件触发模式下启动ADC转换 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Start() +* 鍔熻兘璇存槑: 杞欢瑙﹀彂妯″紡涓嬪惎鍔ˋDC杞崲 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_Start(ADC_TypeDef * ADCx) { @@ -189,11 +189,11 @@ void ADC_Start(ADC_TypeDef * ADCx) } /****************************************************************************************************************************************** -* 函数名称: ADC_Stop() -* 功能说明: 软件触发模式下停止ADC转换 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Stop() +* 鍔熻兘璇存槑: 杞欢瑙﹀彂妯″紡涓嬪仠姝DC杞崲 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_Stop(ADC_TypeDef * ADCx) { @@ -220,12 +220,12 @@ static uint32_t chn2idx(uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_Read() -* 功能说明: 从指定通道读取转换结果 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要读取转换结果的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 读取到的转换结果 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_Read() +* 鍔熻兘璇存槑: 浠庢寚瀹氶氶亾璇诲彇杞崲缁撴灉 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽鍙栬浆鎹㈢粨鏋滅殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 璇诲彇鍒扮殑杞崲缁撴灉 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_Read(ADC_TypeDef * ADCx, uint32_t chn) { @@ -234,18 +234,18 @@ uint32_t ADC_Read(ADC_TypeDef * ADCx, uint32_t chn) dat = ADCx->CH[idx].DATA; - ADCx->CH[idx].STAT = 0x01; //清除EOC标志 + ADCx->CH[idx].STAT = 0x01; //娓呴櫎EOC鏍囧織 return dat; } /****************************************************************************************************************************************** -* 函数名称: ADC_IsEOC() -* 功能说明: 指定通道是否End Of Conversion -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要查询状态的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 1 该通道完成了转换 0 该通道未完成转换 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IsEOC() +* 鍔熻兘璇存槑: 鎸囧畾閫氶亾鏄惁End Of Conversion +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佹煡璇㈢姸鎬佺殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 1 璇ラ氶亾瀹屾垚浜嗚浆鎹 0 璇ラ氶亾鏈畬鎴愯浆鎹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_IsEOC(ADC_TypeDef * ADCx, uint32_t chn) { @@ -255,12 +255,12 @@ uint32_t ADC_IsEOC(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_ChnSelect() -* 功能说明: ADC通道选通,模数转换会在选通的通道上依次采样转换 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chns 要选通的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_ChnSelect() +* 鍔熻兘璇存槑: ADC閫氶亾閫夐氾紝妯℃暟杞崲浼氬湪閫夐氱殑閫氶亾涓婁緷娆¢噰鏍疯浆鎹 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chns 瑕侀夐氱殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_ChnSelect(ADC_TypeDef * ADCx, uint32_t chns) { @@ -270,12 +270,12 @@ void ADC_ChnSelect(ADC_TypeDef * ADCx, uint32_t chns) /****************************************************************************************************************************************** -* 函数名称: ADC_IntEOCEn() -* 功能说明: 转换完成中断使能 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntEOCEn() +* 鍔熻兘璇存槑: 杞崲瀹屾垚涓柇浣胯兘 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntEOCEn(ADC_TypeDef * ADCx, uint32_t chn) { @@ -285,12 +285,12 @@ void ADC_IntEOCEn(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntEOCDis() -* 功能说明: 转换完成中断禁止 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntEOCDis() +* 鍔熻兘璇存槑: 杞崲瀹屾垚涓柇绂佹 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntEOCDis(ADC_TypeDef * ADCx, uint32_t chn) { @@ -300,12 +300,12 @@ void ADC_IntEOCDis(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntEOCClr() -* 功能说明: 转换完成中断标志清除 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntEOCClr() +* 鍔熻兘璇存槑: 杞崲瀹屾垚涓柇鏍囧織娓呴櫎 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntEOCClr(ADC_TypeDef * ADCx, uint32_t chn) { @@ -315,12 +315,12 @@ void ADC_IntEOCClr(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntEOCStat() -* 功能说明: 转换完成中断状态 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要查询的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 1 该通道完成了转换 0 该通道未完成转换 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntEOCStat() +* 鍔熻兘璇存槑: 杞崲瀹屾垚涓柇鐘舵 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佹煡璇㈢殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 1 璇ラ氶亾瀹屾垚浜嗚浆鎹 0 璇ラ氶亾鏈畬鎴愯浆鎹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_IntEOCStat(ADC_TypeDef * ADCx, uint32_t chn) { @@ -330,12 +330,12 @@ uint32_t ADC_IntEOCStat(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntOVFEn() -* 功能说明: 数据溢出中断使能 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntOVFEn() +* 鍔熻兘璇存槑: 鏁版嵁婧㈠嚭涓柇浣胯兘 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntOVFEn(ADC_TypeDef * ADCx, uint32_t chn) { @@ -345,12 +345,12 @@ void ADC_IntOVFEn(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntOVFDis() -* 功能说明: 数据溢出中断禁止 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntOVFDis() +* 鍔熻兘璇存槑: 鏁版嵁婧㈠嚭涓柇绂佹 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntOVFDis(ADC_TypeDef * ADCx, uint32_t chn) { @@ -360,12 +360,12 @@ void ADC_IntOVFDis(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntOVFClr() -* 功能说明: 数据溢出中断标志清除 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntOVFClr() +* 鍔熻兘璇存槑: 鏁版嵁婧㈠嚭涓柇鏍囧織娓呴櫎 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntOVFClr(ADC_TypeDef * ADCx, uint32_t chn) { @@ -375,12 +375,12 @@ void ADC_IntOVFClr(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntOVFStat() -* 功能说明: 数据溢出中断状态 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要查询的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 1 该通道完成了转换 0 该通道未完成转换 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntOVFStat() +* 鍔熻兘璇存槑: 鏁版嵁婧㈠嚭涓柇鐘舵 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佹煡璇㈢殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 1 璇ラ氶亾瀹屾垚浜嗚浆鎹 0 璇ラ氶亾鏈畬鎴愯浆鎹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_IntOVFStat(ADC_TypeDef * ADCx, uint32_t chn) { @@ -390,12 +390,12 @@ uint32_t ADC_IntOVFStat(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntHFULLEn() -* 功能说明: FIFO半满中断使能 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntHFULLEn() +* 鍔熻兘璇存槑: FIFO鍗婃弧涓柇浣胯兘 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntHFULLEn(ADC_TypeDef * ADCx, uint32_t chn) { @@ -405,12 +405,12 @@ void ADC_IntHFULLEn(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntHFULLDis() -* 功能说明: FIFO半满中断禁止 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntHFULLDis() +* 鍔熻兘璇存槑: FIFO鍗婃弧涓柇绂佹 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntHFULLDis(ADC_TypeDef * ADCx, uint32_t chn) { @@ -420,12 +420,12 @@ void ADC_IntHFULLDis(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntHFULLClr() -* 功能说明: FIFO半满中断标志清除 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntHFULLClr() +* 鍔熻兘璇存槑: FIFO鍗婃弧涓柇鏍囧織娓呴櫎 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntHFULLClr(ADC_TypeDef * ADCx, uint32_t chn) { @@ -435,12 +435,12 @@ void ADC_IntHFULLClr(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntHFULLStat() -* 功能说明: FIFO半满中断状态 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要查询的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 1 该通道完成了转换 0 该通道未完成转换 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntHFULLStat() +* 鍔熻兘璇存槑: FIFO鍗婃弧涓柇鐘舵 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佹煡璇㈢殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 1 璇ラ氶亾瀹屾垚浜嗚浆鎹 0 璇ラ氶亾鏈畬鎴愯浆鎹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_IntHFULLStat(ADC_TypeDef * ADCx, uint32_t chn) { @@ -450,12 +450,12 @@ uint32_t ADC_IntHFULLStat(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntFULLEn() -* 功能说明: FIFO满中断使能 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntFULLEn() +* 鍔熻兘璇存槑: FIFO婊′腑鏂娇鑳 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntFULLEn(ADC_TypeDef * ADCx, uint32_t chn) { @@ -465,12 +465,12 @@ void ADC_IntFULLEn(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntFULLDis() -* 功能说明: FIFO满中断禁止 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntFULLDis() +* 鍔熻兘璇存槑: FIFO婊′腑鏂姝 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntFULLDis(ADC_TypeDef * ADCx, uint32_t chn) { @@ -480,12 +480,12 @@ void ADC_IntFULLDis(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntFULLClr() -* 功能说明: FIFO满中断标志清除 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要设置的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntFULLClr() +* 鍔熻兘璇存槑: FIFO婊′腑鏂爣蹇楁竻闄 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佽缃殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void ADC_IntFULLClr(ADC_TypeDef * ADCx, uint32_t chn) { @@ -495,12 +495,12 @@ void ADC_IntFULLClr(ADC_TypeDef * ADCx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: ADC_IntFULLStat() -* 功能说明: FIFO满中断状态 -* 输 入: ADC_TypeDef * ADCx 指定要被设置的ADC,可取值包括ADC -* uint32_t chn 要查询的通道,有效值ADC_CH0、ADC_CH1、... ... 、ADC_CH7 -* 输 出: uint32_t 1 该通道完成了转换 0 该通道未完成转换 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: ADC_IntFULLStat() +* 鍔熻兘璇存槑: FIFO婊′腑鏂姸鎬 +* 杈 鍏: ADC_TypeDef * ADCx 鎸囧畾瑕佽璁剧疆鐨凙DC锛屽彲鍙栧煎寘鎷珹DC +* uint32_t chn 瑕佹煡璇㈢殑閫氶亾锛屾湁鏁堝糀DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7 +* 杈 鍑: uint32_t 1 璇ラ氶亾瀹屾垚浜嗚浆鎹 0 璇ラ氶亾鏈畬鎴愯浆鎹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t ADC_IntFULLStat(ADC_TypeDef * ADCx, uint32_t chn) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.h index 56f93c66d8..96e10972e3 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_adc.h @@ -2,18 +2,18 @@ #define __SWM320_ADC_H__ typedef struct { - uint8_t clk_src; //ADC转换时钟源:ADC_CLKSRC_HRC、ADC_CLKSRC_VCO_DIV16、ADC_CLKSRC_VCO_DIV32、ADC_CLKSRC_VCO_DIV32 - uint8_t clk_div; //ADC转换时钟分频,取值1--31 - uint8_t pga_ref; //PGA基准:PGA_REF_INTERNAL、PGA_REF_EXTERNAL - uint8_t channels; //ADC转换通道选中,ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) - uint8_t samplAvg; //采样取平均,触发启动ADC转换后,ADC在一个通道上连续采样、转换多次,并将它们的平均值作为该通道转换结果 - uint8_t trig_src; //ADC触发方式:ADC_TRIGSRC_SW、ADC_TRIGSRC_PWM、ADC_TRIGSRC_TIMR2、ADC_TRIGSRC_TIMR3 - uint8_t Continue; //在软件触发模式下:1 连续转换模式,启动后一直采样、转换,直到软件清除START位 - // 0 单次转换模式,转换完成后START位自动清除停止转换 - uint8_t EOC_IEn; //EOC中断使能,可针对每个通道设置,其有效值为ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) - uint8_t OVF_IEn; //OVF中断使能,可针对每个通道设置,其有效值为ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) - uint8_t HFULL_IEn; //FIFO半满中断使能,可针对每个通道设置,其有效值为ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) - uint8_t FULL_IEn; //FIFO 满中断使能,可针对每个通道设置,其有效值为ADC_CH0、ADC_CH1、... ... 、ADC_CH7及其组合(即“按位或”运算) + uint8_t clk_src; //ADC杞崲鏃堕挓婧愶細ADC_CLKSRC_HRC銆丄DC_CLKSRC_VCO_DIV16銆丄DC_CLKSRC_VCO_DIV32銆丄DC_CLKSRC_VCO_DIV32 + uint8_t clk_div; //ADC杞崲鏃堕挓鍒嗛锛屽彇鍊1--31 + uint8_t pga_ref; //PGA鍩哄噯锛歅GA_REF_INTERNAL銆丳GA_REF_EXTERNAL + uint8_t channels; //ADC杞崲閫氶亾閫変腑锛孉DC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 + uint8_t samplAvg; //閲囨牱鍙栧钩鍧囷紝瑙﹀彂鍚姩ADC杞崲鍚庯紝ADC鍦ㄤ竴涓氶亾涓婅繛缁噰鏍枫佽浆鎹㈠娆★紝骞跺皢瀹冧滑鐨勫钩鍧囧间綔涓鸿閫氶亾杞崲缁撴灉 + uint8_t trig_src; //ADC瑙﹀彂鏂瑰紡锛欰DC_TRIGSRC_SW銆丄DC_TRIGSRC_PWM銆丄DC_TRIGSRC_TIMR2銆丄DC_TRIGSRC_TIMR3 + uint8_t Continue; //鍦ㄨ蒋浠惰Е鍙戞ā寮忎笅锛1 杩炵画杞崲妯″紡锛屽惎鍔ㄥ悗涓鐩撮噰鏍枫佽浆鎹紝鐩村埌杞欢娓呴櫎START浣 + // 0 鍗曟杞崲妯″紡锛岃浆鎹㈠畬鎴愬悗START浣嶈嚜鍔ㄦ竻闄ゅ仠姝㈣浆鎹 + uint8_t EOC_IEn; //EOC涓柇浣胯兘锛屽彲閽堝姣忎釜閫氶亾璁剧疆锛屽叾鏈夋晥鍊间负ADC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 + uint8_t OVF_IEn; //OVF涓柇浣胯兘锛屽彲閽堝姣忎釜閫氶亾璁剧疆锛屽叾鏈夋晥鍊间负ADC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 + uint8_t HFULL_IEn; //FIFO鍗婃弧涓柇浣胯兘锛屽彲閽堝姣忎釜閫氶亾璁剧疆锛屽叾鏈夋晥鍊间负ADC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 + uint8_t FULL_IEn; //FIFO 婊′腑鏂娇鑳斤紝鍙拡瀵规瘡涓氶亾璁剧疆锛屽叾鏈夋晥鍊间负ADC_CH0銆丄DC_CH1銆... ... 銆丄DC_CH7鍙婂叾缁勫悎锛堝嵆鈥滄寜浣嶆垨鈥濊繍绠楋級 } ADC_InitStructure; #define ADC_CH0 0x01 @@ -31,49 +31,49 @@ typedef struct { #define ADC_CLKSRC_VCO_DIV64 4 #define ADC_AVG_SAMPLE1 0 -#define ADC_AVG_SAMPLE2 1 //一次启动连续采样、转换2次,并计算两次结果的平均值作为转换结果 +#define ADC_AVG_SAMPLE2 1 //涓娆″惎鍔ㄨ繛缁噰鏍枫佽浆鎹2娆★紝骞惰绠椾袱娆$粨鏋滅殑骞冲潎鍊间綔涓鸿浆鎹㈢粨鏋 #define ADC_AVG_SAMPLE4 3 #define ADC_AVG_SAMPLE8 7 #define ADC_AVG_SAMPLE16 15 -#define ADC_TRIGSRC_SW 0 //软件触发,即ADC->START.GO写1启动转换 +#define ADC_TRIGSRC_SW 0 //杞欢瑙﹀彂锛屽嵆ADC->START.GO鍐1鍚姩杞崲 #define ADC_TRIGSRC_PWM 1 -#define PGA_REF_INTERNAL 1 //PGA输入共模电平由内部电路产生,ADC_REFP和ADC_REFN可悬空 -#define PGA_REF_EXTERNAL 0 //PGA输入共模电平由外部引脚提供,(ADC_REFP + ADC_REFN) 电平值须与量程相同 +#define PGA_REF_INTERNAL 1 //PGA杈撳叆鍏辨ā鐢靛钩鐢卞唴閮ㄧ數璺骇鐢燂紝ADC_REFP鍜孉DC_REFN鍙偓绌 +#define PGA_REF_EXTERNAL 0 //PGA杈撳叆鍏辨ā鐢靛钩鐢卞閮ㄥ紩鑴氭彁渚涳紝(ADC_REFP + ADC_REFN) 鐢靛钩鍊奸』涓庨噺绋嬬浉鍚 -void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct); //ADC模数转换器初始化 -void ADC_Open(ADC_TypeDef * ADCx); //ADC开启,可以软件启动、或硬件触发ADC转换 -void ADC_Close(ADC_TypeDef * ADCx); //ADC关闭,无法软件启动、或硬件触发ADC转换 -void ADC_Start(ADC_TypeDef * ADCx); //启动指定ADC,开始模数转换 -void ADC_Stop(ADC_TypeDef * ADCx); //关闭指定ADC,停止模数转换 +void ADC_Init(ADC_TypeDef * ADCx, ADC_InitStructure * initStruct); //ADC妯℃暟杞崲鍣ㄥ垵濮嬪寲 +void ADC_Open(ADC_TypeDef * ADCx); //ADC寮鍚紝鍙互杞欢鍚姩銆佹垨纭欢瑙﹀彂ADC杞崲 +void ADC_Close(ADC_TypeDef * ADCx); //ADC鍏抽棴锛屾棤娉曡蒋浠跺惎鍔ㄣ佹垨纭欢瑙﹀彂ADC杞崲 +void ADC_Start(ADC_TypeDef * ADCx); //鍚姩鎸囧畾ADC锛屽紑濮嬫ā鏁拌浆鎹 +void ADC_Stop(ADC_TypeDef * ADCx); //鍏抽棴鎸囧畾ADC锛屽仠姝㈡ā鏁拌浆鎹 -uint32_t ADC_Read(ADC_TypeDef * ADCx, uint32_t chn); //从指定通道读取转换结果 -uint32_t ADC_IsEOC(ADC_TypeDef * ADCx, uint32_t chn); //指定通道是否End Of Conversion +uint32_t ADC_Read(ADC_TypeDef * ADCx, uint32_t chn); //浠庢寚瀹氶氶亾璇诲彇杞崲缁撴灉 +uint32_t ADC_IsEOC(ADC_TypeDef * ADCx, uint32_t chn); //鎸囧畾閫氶亾鏄惁End Of Conversion void ADC_ChnSelect(ADC_TypeDef * ADCx, uint32_t chns); -void ADC_IntEOCEn(ADC_TypeDef * ADCx, uint32_t chn); //转换完成中断使能 -void ADC_IntEOCDis(ADC_TypeDef * ADCx, uint32_t chn); //转换完成中断禁止 -void ADC_IntEOCClr(ADC_TypeDef * ADCx, uint32_t chn); //转换完成中断标志清除 -uint32_t ADC_IntEOCStat(ADC_TypeDef * ADCx, uint32_t chn); //转换完成中断状态 +void ADC_IntEOCEn(ADC_TypeDef * ADCx, uint32_t chn); //杞崲瀹屾垚涓柇浣胯兘 +void ADC_IntEOCDis(ADC_TypeDef * ADCx, uint32_t chn); //杞崲瀹屾垚涓柇绂佹 +void ADC_IntEOCClr(ADC_TypeDef * ADCx, uint32_t chn); //杞崲瀹屾垚涓柇鏍囧織娓呴櫎 +uint32_t ADC_IntEOCStat(ADC_TypeDef * ADCx, uint32_t chn); //杞崲瀹屾垚涓柇鐘舵 -void ADC_IntOVFEn(ADC_TypeDef * ADCx, uint32_t chn); //数据溢出中断使能 -void ADC_IntOVFDis(ADC_TypeDef * ADCx, uint32_t chn); //数据溢出中断禁止 -void ADC_IntOVFClr(ADC_TypeDef * ADCx, uint32_t chn); //数据溢出中断标志清除 -uint32_t ADC_IntOVFStat(ADC_TypeDef * ADCx, uint32_t chn); //数据溢出中断状态 +void ADC_IntOVFEn(ADC_TypeDef * ADCx, uint32_t chn); //鏁版嵁婧㈠嚭涓柇浣胯兘 +void ADC_IntOVFDis(ADC_TypeDef * ADCx, uint32_t chn); //鏁版嵁婧㈠嚭涓柇绂佹 +void ADC_IntOVFClr(ADC_TypeDef * ADCx, uint32_t chn); //鏁版嵁婧㈠嚭涓柇鏍囧織娓呴櫎 +uint32_t ADC_IntOVFStat(ADC_TypeDef * ADCx, uint32_t chn); //鏁版嵁婧㈠嚭涓柇鐘舵 -void ADC_IntHFULLEn(ADC_TypeDef * ADCx, uint32_t chn); //FIFO半满中断使能 -void ADC_IntHFULLDis(ADC_TypeDef * ADCx, uint32_t chn); //FIFO半满中断禁止 -void ADC_IntHFULLClr(ADC_TypeDef * ADCx, uint32_t chn); //FIFO半满中断标志清除 -uint32_t ADC_IntHFULLStat(ADC_TypeDef * ADCx, uint32_t chn);//FIFO半满中断状态 +void ADC_IntHFULLEn(ADC_TypeDef * ADCx, uint32_t chn); //FIFO鍗婃弧涓柇浣胯兘 +void ADC_IntHFULLDis(ADC_TypeDef * ADCx, uint32_t chn); //FIFO鍗婃弧涓柇绂佹 +void ADC_IntHFULLClr(ADC_TypeDef * ADCx, uint32_t chn); //FIFO鍗婃弧涓柇鏍囧織娓呴櫎 +uint32_t ADC_IntHFULLStat(ADC_TypeDef * ADCx, uint32_t chn);//FIFO鍗婃弧涓柇鐘舵 -void ADC_IntFULLEn(ADC_TypeDef * ADCx, uint32_t chn); //FIFO满中断使能 -void ADC_IntFULLDis(ADC_TypeDef * ADCx, uint32_t chn); //FIFO满中断禁止 -void ADC_IntFULLClr(ADC_TypeDef * ADCx, uint32_t chn); //FIFO满中断标志清除 -uint32_t ADC_IntFULLStat(ADC_TypeDef * ADCx, uint32_t chn); //FIFO满中断状态 +void ADC_IntFULLEn(ADC_TypeDef * ADCx, uint32_t chn); //FIFO婊′腑鏂娇鑳 +void ADC_IntFULLDis(ADC_TypeDef * ADCx, uint32_t chn); //FIFO婊′腑鏂姝 +void ADC_IntFULLClr(ADC_TypeDef * ADCx, uint32_t chn); //FIFO婊′腑鏂爣蹇楁竻闄 +uint32_t ADC_IntFULLStat(ADC_TypeDef * ADCx, uint32_t chn); //FIFO婊′腑鏂姸鎬 #endif //__SWM320_ADC_H__ diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.c index c5c5f34a45..e7b30e3cb2 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.c @@ -411,18 +411,6 @@ void CAN_INTRXNotEmptyDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_RXDA_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTRXNotEmptyStat() -* 功能说明: RX FIFO非空中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTRXNotEmptyStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_RXDA_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTTXBufEmptyEn() * 功能说明: 当TX Buffer空时触发中断使能 @@ -447,18 +435,6 @@ void CAN_INTTXBufEmptyDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_TXBR_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTTXBufEmptyStat() -* 功能说明: TX Buffer空中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTTXBufEmptyStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_TXBR_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTErrWarningEn() * 功能说明: TXERR/RXERR计数值达到Error Warning Limit时触发中断使能 @@ -483,18 +459,6 @@ void CAN_INTErrWarningDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_ERRWARN_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTErrWarningStat() -* 功能说明: TXERR/RXERR计数值达到Error Warning Limit中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTErrWarningStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_ERRWARN_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTRXOverflowEn() * 功能说明: RX FIFO 溢出时触发中断使能 @@ -519,18 +483,6 @@ void CAN_INTRXOverflowDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_RXOV_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTRXOverflowStat() -* 功能说明: RX FIFO 溢出中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTRXOverflowStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_RXOV_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTRXOverflowClear() * 功能说明: RX FIFO 溢出中断清除 @@ -567,18 +519,6 @@ void CAN_INTWakeupDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_WKUP_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTWakeupStat() -* 功能说明: 唤醒事件中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTWakeupStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_WKUP_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTErrPassiveEn() * 功能说明: TXERR/RXERR计数值达到127时中断使能 @@ -603,18 +543,6 @@ void CAN_INTErrPassiveDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_ERRPASS_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTErrPassiveStat() -* 功能说明: TXERR/RXERR计数值达到127中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTErrPassiveStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_ERRPASS_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTArbitrLostEn() * 功能说明: 仲裁失败中断使能 @@ -639,18 +567,6 @@ void CAN_INTArbitrLostDis(CAN_TypeDef * CANx) CANx->IE &= ~(1 << CAN_IE_ARBLOST_Pos); } -/****************************************************************************************************************************************** -* 函数名称: CAN_INTArbitrLostStat() -* 功能说明: 仲裁失败中断是否触发 -* 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 -******************************************************************************************************************************************/ -uint32_t CAN_INTArbitrLostStat(CAN_TypeDef * CANx) -{ - return (CANx->IF & CAN_IF_ARBLOST_Msk) ? 1 : 0; -} - /****************************************************************************************************************************************** * 函数名称: CAN_INTBusErrorEn() * 功能说明: 总线错误中断使能 @@ -676,13 +592,13 @@ void CAN_INTBusErrorDis(CAN_TypeDef * CANx) } /****************************************************************************************************************************************** -* 函数名称: CAN_INTBusErrorStat() -* 功能说明: 总线错误中断是否触发 +* 函数名称: CAN_INTStat() +* 功能说明: 查询中断状态 * 输 入: CAN_TypeDef * CANx 指定要被设置的CAN接口,有效值包括CAN -* 输 出: uint32_t 1 已触发 0 未触发 -* 注意事项: 无 +* 输 出: uint32_t 当前中断状态 +* 注意事项: CANx->IF读取清零,因此在中断ISR中只能读取一次,不能多次读取 ******************************************************************************************************************************************/ -uint32_t CAN_INTBusErrorStat(CAN_TypeDef * CANx) +uint32_t CAN_INTStat(CAN_TypeDef * CANx) { - return (CANx->IF & CAN_IF_BUSERR_Msk) ? 1 : 0; + return CANx->IF; } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.h index 7b66ee4d5c..7cdd751ca5 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_can.h @@ -5,14 +5,14 @@ #define CAN_FRAME_EXT 1 typedef struct { - uint8_t Mode; //CAN_MODE_NORMAL、CAN_MODE_LISTEN、CAN_MODE_SELFTEST - uint8_t CAN_BS1; //CAN_BS1_1tq、CAN_BS1_2tq、... ... 、CAN_BS1_16tq - uint8_t CAN_BS2; //CAN_BS2_1tq、CAN_BS2_2tq、... ... 、CAN_BS2_8tq - uint8_t CAN_SJW; //CAN_SJW_1tq、CAN_SJW_2tq、CAN_SJW_3tq、CAN_SJW_4tq - uint32_t Baudrate; //波特率,即位传输速率,取值1--1000000 - uint8_t FilterMode; //CAN_FILTER_16b、CAN_FILTER_32b + uint8_t Mode; //CAN_MODE_NORMAL銆丆AN_MODE_LISTEN銆丆AN_MODE_SELFTEST + uint8_t CAN_BS1; //CAN_BS1_1tq銆丆AN_BS1_2tq銆... ... 銆丆AN_BS1_16tq + uint8_t CAN_BS2; //CAN_BS2_1tq銆丆AN_BS2_2tq銆... ... 銆丆AN_BS2_8tq + uint8_t CAN_SJW; //CAN_SJW_1tq銆丆AN_SJW_2tq銆丆AN_SJW_3tq銆丆AN_SJW_4tq + uint32_t Baudrate; //娉㈢壒鐜囷紝鍗充綅浼犺緭閫熺巼锛屽彇鍊1--1000000 + uint8_t FilterMode; //CAN_FILTER_16b銆丆AN_FILTER_32b union { - uint32_t FilterMask32b; //FilterCheck & (~FilterMask) == ID & (~FilterMask)的Message通过过滤 + uint32_t FilterMask32b; //FilterCheck & (~FilterMask) == ID & (~FilterMask)鐨凪essage閫氳繃杩囨护 struct { // 0 must match 1 don't care uint16_t FilterMask16b1; uint16_t FilterMask16b2; @@ -25,15 +25,15 @@ typedef struct { uint16_t FilterCheck16b2; }; }; - uint8_t RXNotEmptyIEn; //接收FIFO非空,有数据可读 - uint8_t RXOverflowIEn; //接收FIFO溢出,有数据丢失 - uint8_t ArbitrLostIEn; //控制器丢失仲裁变成接收方 - uint8_t ErrPassiveIEn; //接收/发送错误计数值达到127 + uint8_t RXNotEmptyIEn; //鎺ユ敹FIFO闈炵┖锛屾湁鏁版嵁鍙 + uint8_t RXOverflowIEn; //鎺ユ敹FIFO婧㈠嚭锛屾湁鏁版嵁涓㈠け + uint8_t ArbitrLostIEn; //鎺у埗鍣ㄤ涪澶变徊瑁佸彉鎴愭帴鏀舵柟 + uint8_t ErrPassiveIEn; //鎺ユ敹/鍙戦侀敊璇鏁板艰揪鍒127 } CAN_InitStructure; -#define CAN_MODE_NORMAL 0 //常规模式 -#define CAN_MODE_LISTEN 1 //监听模式 -#define CAN_MODE_SELFTEST 2 //自测模式 +#define CAN_MODE_NORMAL 0 //甯歌妯″紡 +#define CAN_MODE_LISTEN 1 //鐩戝惉妯″紡 +#define CAN_MODE_SELFTEST 2 //鑷祴妯″紡 #define CAN_BS1_1tq 0 #define CAN_BS1_2tq 1 @@ -66,15 +66,15 @@ typedef struct { #define CAN_SJW_3tq 2 #define CAN_SJW_4tq 3 -#define CAN_FILTER_16b 0 //两个16位过滤器 -#define CAN_FILTER_32b 1 //一个32位过滤器 +#define CAN_FILTER_16b 0 //涓や釜16浣嶈繃婊ゅ櫒 +#define CAN_FILTER_32b 1 //涓涓32浣嶈繃婊ゅ櫒 typedef struct { - uint32_t id; //消息ID - uint8_t format; //帧格式:CAN_FRAME_STD、CAN_FRAME_EXT - uint8_t remote; //消息是否为远程帧 - uint8_t size; //接收到的数据个数 - uint8_t data[8]; //接收到的数据 + uint32_t id; //娑堟伅ID + uint8_t format; //甯ф牸寮忥細CAN_FRAME_STD銆丆AN_FRAME_EXT + uint8_t remote; //娑堟伅鏄惁涓鸿繙绋嬪抚 + uint8_t size; //鎺ユ敹鍒扮殑鏁版嵁涓暟 + uint8_t data[8]; //鎺ユ敹鍒扮殑鏁版嵁 } CAN_RXMessage; @@ -102,35 +102,29 @@ void CAN_SetFilter16b(CAN_TypeDef * CANx, uint16_t check1, uint16_t mask1, uint1 void CAN_INTRXNotEmptyEn(CAN_TypeDef * CANx); void CAN_INTRXNotEmptyDis(CAN_TypeDef * CANx); -uint32_t CAN_INTRXNotEmptyStat(CAN_TypeDef * CANx); void CAN_INTTXBufEmptyEn(CAN_TypeDef * CANx); void CAN_INTTXBufEmptyDis(CAN_TypeDef * CANx); -uint32_t CAN_INTTXBufEmptyStat(CAN_TypeDef * CANx); void CAN_INTErrWarningEn(CAN_TypeDef * CANx); void CAN_INTErrWarningDis(CAN_TypeDef * CANx); -uint32_t CAN_INTErrWarningStat(CAN_TypeDef * CANx); void CAN_INTRXOverflowEn(CAN_TypeDef * CANx); void CAN_INTRXOverflowDis(CAN_TypeDef * CANx); -uint32_t CAN_INTRXOverflowStat(CAN_TypeDef * CANx); void CAN_INTRXOverflowClear(CAN_TypeDef * CANx); void CAN_INTWakeupEn(CAN_TypeDef * CANx); void CAN_INTWakeupDis(CAN_TypeDef * CANx); -uint32_t CAN_INTWakeupStat(CAN_TypeDef * CANx); void CAN_INTErrPassiveEn(CAN_TypeDef * CANx); void CAN_INTErrPassiveDis(CAN_TypeDef * CANx); -uint32_t CAN_INTErrPassiveStat(CAN_TypeDef * CANx); void CAN_INTArbitrLostEn(CAN_TypeDef * CANx); void CAN_INTArbitrLostDis(CAN_TypeDef * CANx); -uint32_t CAN_INTArbitrLostStat(CAN_TypeDef * CANx); void CAN_INTBusErrorEn(CAN_TypeDef * CANx); void CAN_INTBusErrorDis(CAN_TypeDef * CANx); -uint32_t CAN_INTBusErrorStat(CAN_TypeDef * CANx); + +uint32_t CAN_INTStat(CAN_TypeDef * CANx); #endif //__SWM320_CAN_H__ diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_crc.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_crc.h index ce9f1f3731..6a5dd2f781 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_crc.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_crc.h @@ -2,22 +2,22 @@ #define __SWM320_CRC_H__ -#define CRC32_IN32 0 //CRC32算法,输入数据32位 -#define CRC32_IN16 2 //CRC32算法,输入数据16位 -#define CRC32_IN8 4 //CRC32算法,输入数据 8位 -#define CRC16_IN16 3 //CRC16算法,输入数据16位 -#define CRC16_IN8 5 //CRC16算法,输入数据 8位 +#define CRC32_IN32 0 //CRC32绠楁硶锛岃緭鍏ユ暟鎹32浣 +#define CRC32_IN16 2 //CRC32绠楁硶锛岃緭鍏ユ暟鎹16浣 +#define CRC32_IN8 4 //CRC32绠楁硶锛岃緭鍏ユ暟鎹 8浣 +#define CRC16_IN16 3 //CRC16绠楁硶锛岃緭鍏ユ暟鎹16浣 +#define CRC16_IN8 5 //CRC16绠楁硶锛岃緭鍏ユ暟鎹 8浣 void CRC_Init(CRC_TypeDef * CRCx, uint32_t mode, uint32_t out_not, uint32_t out_rev, uint32_t ini_val); /****************************************************************************************************************************************** -* 函数名称: CRC_Write() -* 功能说明: CRC写入数据 -* 输 入: uint32_t data 要写入的数据 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: CRC_Write() +* 鍔熻兘璇存槑: CRC鍐欏叆鏁版嵁 +* 杈 鍏: uint32_t data 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ static __INLINE void CRC_Write(uint32_t data) { @@ -25,11 +25,11 @@ static __INLINE void CRC_Write(uint32_t data) } /****************************************************************************************************************************************** -* 函数名称: CRC_Result() -* 功能说明: 获取CRC计算结果 -* 输 入: 无 -* 输 出: uint32_t CRC 计算结果 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: CRC_Result() +* 鍔熻兘璇存槑: 鑾峰彇CRC璁$畻缁撴灉 +* 杈 鍏: 鏃 +* 杈 鍑: uint32_t CRC 璁$畻缁撴灉 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ static __INLINE uint32_t CRC_Result(void) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_dma.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_dma.h index 817162cd65..0857f7d023 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_dma.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_dma.h @@ -7,14 +7,14 @@ #define DMA_CH2 2 -void DMA_CHM_Config(uint32_t chn, uint32_t src_addr, uint32_t src_addr_incr, uint32_t dst_addr, uint32_t dst_addr_incr, uint32_t num_word, uint32_t int_en); //DMA通道配置,用于存储器间(如Flash和RAM间)搬运数据 -void DMA_CH_Open(uint32_t chn); //DMA通道打开 -void DMA_CH_Close(uint32_t chn); //DMA通道关闭 +void DMA_CHM_Config(uint32_t chn, uint32_t src_addr, uint32_t src_addr_incr, uint32_t dst_addr, uint32_t dst_addr_incr, uint32_t num_word, uint32_t int_en); //DMA閫氶亾閰嶇疆锛岀敤浜庡瓨鍌ㄥ櫒闂达紙濡侳lash鍜孯AM闂达級鎼繍鏁版嵁 +void DMA_CH_Open(uint32_t chn); //DMA閫氶亾鎵撳紑 +void DMA_CH_Close(uint32_t chn); //DMA閫氶亾鍏抽棴 -void DMA_CH_INTEn(uint32_t chn); //DMA中断使能,数据搬运完成后触发中断 -void DMA_CH_INTDis(uint32_t chn); //DMA中断禁止,数据搬运完成后不触发中断 -void DMA_CH_INTClr(uint32_t chn); //DMA中断标志清除 -uint32_t DMA_CH_INTStat(uint32_t chn); //DMA中断状态查询,1 数据搬运完成 0 数据搬运未完成 +void DMA_CH_INTEn(uint32_t chn); //DMA涓柇浣胯兘锛屾暟鎹惉杩愬畬鎴愬悗瑙﹀彂涓柇 +void DMA_CH_INTDis(uint32_t chn); //DMA涓柇绂佹锛屾暟鎹惉杩愬畬鎴愬悗涓嶈Е鍙戜腑鏂 +void DMA_CH_INTClr(uint32_t chn); //DMA涓柇鏍囧織娓呴櫎 +uint32_t DMA_CH_INTStat(uint32_t chn); //DMA涓柇鐘舵佹煡璇紝1 鏁版嵁鎼繍瀹屾垚 0 鏁版嵁鎼繍鏈畬鎴 #endif //__SWM320_DMA_H__ diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_exti.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_exti.h index 088cd9a619..529770e6a6 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_exti.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_exti.h @@ -1,20 +1,20 @@ #ifndef __SWM320_EXTI_H__ #define __SWM320_EXTI_H__ -void EXTI_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t mode); //指定引脚外部中断初始化 -void EXTI_Open(GPIO_TypeDef * GPIOx, uint32_t n); //指定引脚外部中断打开(即使能) -void EXTI_Close(GPIO_TypeDef * GPIOx, uint32_t n); //指定引脚外部中断关闭(即禁能) +void EXTI_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t mode); //鎸囧畾寮曡剼澶栭儴涓柇鍒濆鍖 +void EXTI_Open(GPIO_TypeDef * GPIOx, uint32_t n); //鎸囧畾寮曡剼澶栭儴涓柇鎵撳紑锛堝嵆浣胯兘锛 +void EXTI_Close(GPIO_TypeDef * GPIOx, uint32_t n); //鎸囧畾寮曡剼澶栭儴涓柇鍏抽棴锛堝嵆绂佽兘锛 -uint32_t EXTI_State(GPIO_TypeDef * GPIOx, uint32_t n); //指定引脚是否触发了中断 -uint32_t EXTI_RawState(GPIO_TypeDef * GPIOx, uint32_t n); //指定引脚是否满足过/了中断触发条件,当此中断关闭时可通过调用此函数以查询的方式检测引脚上是否满足过/了中断触发条件 -void EXTI_Clear(GPIO_TypeDef * GPIOx, uint32_t n); //指定引脚外部中断清除(即清除中断标志,以免再次进入此中断) +uint32_t EXTI_State(GPIO_TypeDef * GPIOx, uint32_t n); //鎸囧畾寮曡剼鏄惁瑙﹀彂浜嗕腑鏂 +uint32_t EXTI_RawState(GPIO_TypeDef * GPIOx, uint32_t n); //鎸囧畾寮曡剼鏄惁婊¤冻杩/浜嗕腑鏂Е鍙戞潯浠讹紝褰撴涓柇鍏抽棴鏃跺彲閫氳繃璋冪敤姝ゅ嚱鏁颁互鏌ヨ鐨勬柟寮忔娴嬪紩鑴氫笂鏄惁婊¤冻杩/浜嗕腑鏂Е鍙戞潯浠 +void EXTI_Clear(GPIO_TypeDef * GPIOx, uint32_t n); //鎸囧畾寮曡剼澶栭儴涓柇娓呴櫎锛堝嵆娓呴櫎涓柇鏍囧織锛屼互鍏嶅啀娆¤繘鍏ユ涓柇锛 -#define EXTI_FALL_EDGE 0x00 //下降沿触发中断 -#define EXTI_RISE_EDGE 0x01 //上升沿触发中断 -#define EXTI_BOTH_EDGE 0x02 //双边沿触发中断 -#define EXTI_LOW_LEVEL 0x10 //低电平触发中断 -#define EXTI_HIGH_LEVEL 0x11 //高电平触发中断 +#define EXTI_FALL_EDGE 0x00 //涓嬮檷娌胯Е鍙戜腑鏂 +#define EXTI_RISE_EDGE 0x01 //涓婂崌娌胯Е鍙戜腑鏂 +#define EXTI_BOTH_EDGE 0x02 //鍙岃竟娌胯Е鍙戜腑鏂 +#define EXTI_LOW_LEVEL 0x10 //浣庣數骞宠Е鍙戜腑鏂 +#define EXTI_HIGH_LEVEL 0x11 //楂樼數骞宠Е鍙戜腑鏂 #endif //__SWM320_EXTI_H__ diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.c index dbd0eca4bf..d384125db3 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_flash.c -* 功能说明: 使用芯片的IAP功能将片上Flash模拟成EEPROM来保存数据,掉电后不丢失 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_flash.c +* 鍔熻兘璇存槑: 浣跨敤鑺墖鐨処AP鍔熻兘灏嗙墖涓奆lash妯℃嫙鎴怑EPROM鏉ヤ繚瀛樻暟鎹紝鎺夌數鍚庝笉涓㈠け +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: ******************************************************************************************************************************************* * @attention * @@ -27,11 +27,11 @@ IAP_Flash_Write_t IAP_Flash_Write = (IAP_Flash_Write_t)0x11000801; /****************************************************************************************************************************************** -* 函数名称: FLASH_Erase() -* 功能说明: 片内Flash擦除 -* 输 入: uint32_t addr 擦除地址,扇区大小为4K Byte -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: FLASH_Erase() +* 鍔熻兘璇存槑: 鐗囧唴Flash鎿﹂櫎 +* 杈 鍏: uint32_t addr 鎿﹂櫎鍦板潃锛屾墖鍖哄ぇ灏忎负4K Byte +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void FLASH_Erase(uint32_t addr) { @@ -45,13 +45,13 @@ void FLASH_Erase(uint32_t addr) } /****************************************************************************************************************************************** -* 函数名称: FLASH_Write() -* 功能说明: 片内Flash写入 -* 输 入: uint32_t addr 写入地址 -* uint32_t buff[] 要写入的数据 -* uint32_t count 要写入数据的个数,以字为单位,且必须是4的整数倍,即最少写入4个字 -* 输 出: 无 -* 注意事项: 写入数据个数必须是4的整数倍,即最少写入4个字 +* 鍑芥暟鍚嶇О: FLASH_Write() +* 鍔熻兘璇存槑: 鐗囧唴Flash鍐欏叆 +* 杈 鍏: uint32_t addr 鍐欏叆鍦板潃 +* uint32_t buff[] 瑕佸啓鍏ョ殑鏁版嵁 +* uint32_t count 瑕佸啓鍏ユ暟鎹殑涓暟锛屼互瀛椾负鍗曚綅锛屼笖蹇呴』鏄4鐨勬暣鏁板嶏紝鍗虫渶灏戝啓鍏4涓瓧 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鍐欏叆鏁版嵁涓暟蹇呴』鏄4鐨勬暣鏁板嶏紝鍗虫渶灏戝啓鍏4涓瓧 ******************************************************************************************************************************************/ void FLASH_Write(uint32_t addr, uint32_t buff[], uint32_t count) { @@ -65,17 +65,33 @@ void FLASH_Write(uint32_t addr, uint32_t buff[], uint32_t count) } /****************************************************************************************************************************************** -* 函数名称: Flash_Param_at_120MHz() -* 功能说明: 将Flash参数设置成120MHz主频下运行时所需的参数 -* 输 入: 无 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: Flash_Param_at_xMHz() +* 鍔熻兘璇存槑: 灏咶lash鍙傛暟璁剧疆鎴恱MHz涓婚涓嬭繍琛屾椂鎵闇鐨勫弬鏁 +* 杈 鍏: uint32_t x 鍙彇鍊 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ -void Flash_Param_at_120MHz(void) +void Flash_Param_at_xMHz(uint32_t x) { __disable_irq(); + switch(x) + { + case 30: + IAP_Flash_Param(0x489, 0xabf41f25); + break; - IAP_Flash_Param(0x48a, 0xabfc7a6e); + case 40: + IAP_Flash_Param(0x489, 0xabf42929); + break; + case 80: + IAP_Flash_Param(0x489, 0xabf8524d); + break; + + case 120: + default: + IAP_Flash_Param(0x48a, 0xabfc7a6e); + break; + } __enable_irq(); } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.h index 113e2a2e07..40f64fac42 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_flash.h @@ -5,7 +5,7 @@ void FLASH_Erase(uint32_t addr); void FLASH_Write(uint32_t addr, uint32_t buff[], uint32_t count); -void Flash_Param_at_120MHz(void); +void Flash_Param_at_xMHz(uint32_t x); diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.c index 1d2aa3a2ab..932608a9e9 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.c @@ -31,7 +31,7 @@ * uint32_t pull_up 上拉电阻,0 关闭上拉 1 开启上拉 * uint32_t pull_down 下拉电阻,0 关闭下拉 1 开启下拉 * 输 出: 无 -* 注意事项: GPIOA、GPIOC、GPIOM、GPIOP只有上拉,GPIOB、GPION只有下拉 +* 注意事项: GPIOA、GPIOC、GPIOM、GPIOP只有上拉,GPIOB、GPION只有下拉(PN0、PN1、PN2三个引脚有上拉没下拉) ******************************************************************************************************************************************/ void GPIO_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t dir, uint32_t pull_up, uint32_t pull_down) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.h index bcb59b0bee..3ced2d736e 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_gpio.h @@ -2,16 +2,16 @@ #define __SWM320_GPIO_H__ -void GPIO_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t dir, uint32_t pull_up, uint32_t pull_down); //引脚初始化,包含引脚方向、上拉电阻、下拉电阻 +void GPIO_Init(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t dir, uint32_t pull_up, uint32_t pull_down); //寮曡剼鍒濆鍖栵紝鍖呭惈寮曡剼鏂瑰悜銆佷笂鎷夌數闃汇佷笅鎷夌數闃 -void GPIO_SetBit(GPIO_TypeDef * GPIOx, uint32_t n); //将参数指定的引脚电平置高 -void GPIO_ClrBit(GPIO_TypeDef * GPIOx, uint32_t n); //将参数指定的引脚电平置低 -void GPIO_InvBit(GPIO_TypeDef * GPIOx, uint32_t n); //将参数指定的引脚电平反转 -uint32_t GPIO_GetBit(GPIO_TypeDef * GPIOx, uint32_t n); //读取参数指定的引脚的电平状态 -void GPIO_SetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //将参数指定的从n开始的w位连续引脚的电平置高 -void GPIO_ClrBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //将参数指定的从n开始的w位连续引脚的电平置低 -void GPIO_InvBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //将参数指定的从n开始的w位连续引脚的电平反转 -uint32_t GPIO_GetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //读取参数指定的从n开始的w位连续引脚的电平状态 +void GPIO_SetBit(GPIO_TypeDef * GPIOx, uint32_t n); //灏嗗弬鏁版寚瀹氱殑寮曡剼鐢靛钩缃珮 +void GPIO_ClrBit(GPIO_TypeDef * GPIOx, uint32_t n); //灏嗗弬鏁版寚瀹氱殑寮曡剼鐢靛钩缃綆 +void GPIO_InvBit(GPIO_TypeDef * GPIOx, uint32_t n); //灏嗗弬鏁版寚瀹氱殑寮曡剼鐢靛钩鍙嶈浆 +uint32_t GPIO_GetBit(GPIO_TypeDef * GPIOx, uint32_t n); //璇诲彇鍙傛暟鎸囧畾鐨勫紩鑴氱殑鐢靛钩鐘舵 +void GPIO_SetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //灏嗗弬鏁版寚瀹氱殑浠巒寮濮嬬殑w浣嶈繛缁紩鑴氱殑鐢靛钩缃珮 +void GPIO_ClrBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //灏嗗弬鏁版寚瀹氱殑浠巒寮濮嬬殑w浣嶈繛缁紩鑴氱殑鐢靛钩缃綆 +void GPIO_InvBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //灏嗗弬鏁版寚瀹氱殑浠巒寮濮嬬殑w浣嶈繛缁紩鑴氱殑鐢靛钩鍙嶈浆 +uint32_t GPIO_GetBits(GPIO_TypeDef * GPIOx, uint32_t n, uint32_t w); //璇诲彇鍙傛暟鎸囧畾鐨勪粠n寮濮嬬殑w浣嶈繛缁紩鑴氱殑鐢靛钩鐘舵 void GPIO_AtomicSetBit(GPIO_TypeDef * GPIOx, uint32_t n); void GPIO_AtomicClrBit(GPIO_TypeDef * GPIOx, uint32_t n); diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_i2c.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_i2c.h index fc52e9265e..02f1292a28 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_i2c.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_i2c.h @@ -2,19 +2,19 @@ #define __SWM320_I2C_H__ typedef struct { - uint8_t Master; //1 主机模式 - uint8_t Addr7b; //1 7位地址 0 10位地址 + uint8_t Master; //1 涓绘満妯″紡 + uint8_t Addr7b; //1 7浣嶅湴鍧 0 10浣嶅湴鍧 - uint32_t MstClk; //主机传输时钟频率 - uint8_t MstIEn; //主机模式中断使能 + uint32_t MstClk; //涓绘満浼犺緭鏃堕挓棰戠巼 + uint8_t MstIEn; //涓绘満妯″紡涓柇浣胯兘 - uint16_t SlvAddr; //从机地址 - uint8_t SlvRxEndIEn; //从机接收完成中断使能 - uint8_t SlvTxEndIEn; //从机发送完成中断使能 - uint8_t SlvSTADetIEn; //从机检测到起始中断使能 - uint8_t SlvSTODetIEn; //从机检测到终止中断使能 - uint8_t SlvRdReqIEn; //从机接收到读请求中断使能 - uint8_t SlvWrReqIEn; //从机接收到写请求中断使能 + uint16_t SlvAddr; //浠庢満鍦板潃 + uint8_t SlvRxEndIEn; //浠庢満鎺ユ敹瀹屾垚涓柇浣胯兘 + uint8_t SlvTxEndIEn; //浠庢満鍙戦佸畬鎴愪腑鏂娇鑳 + uint8_t SlvSTADetIEn; //浠庢満妫娴嬪埌璧峰涓柇浣胯兘 + uint8_t SlvSTODetIEn; //浠庢満妫娴嬪埌缁堟涓柇浣胯兘 + uint8_t SlvRdReqIEn; //浠庢満鎺ユ敹鍒拌璇锋眰涓柇浣胯兘 + uint8_t SlvWrReqIEn; //浠庢満鎺ユ敹鍒板啓璇锋眰涓柇浣胯兘 } I2C_InitStructure; diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.c index 5220cb8046..c26ea71f9d 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_lcd.c -* 功能说明: SWM320单片机的LCD功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_lcd.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑LCD鍔熻兘椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -24,12 +24,12 @@ #include /****************************************************************************************************************************************** -* 函数名称: LCD_Init() -* 功能说明: LCD初始化 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* LCD_InitStructure * initStruct 包含LCD相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_Init() +* 鍔熻兘璇存槑: LCD鍒濆鍖 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* LCD_InitStructure * initStruct 鍖呭惈LCD鐩稿叧璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void LCD_Init(LCD_TypeDef * LCDx, LCD_InitStructure * initStruct) { @@ -39,30 +39,21 @@ void LCD_Init(LCD_TypeDef * LCDx, LCD_InitStructure * initStruct) SYS->CLKEN |= (0x01 << SYS_CLKEN_LCD_Pos); break; } - - if(initStruct->Interface == LCD_INTERFACE_RGB) - { - LCDx->START = (0 << LCD_START_MPUEN_Pos); - - LCDx->CR0 = ((initStruct->HnPixel - 1) << LCD_CR0_HPIX_Pos) | - ((initStruct->VnPixel - 1) << LCD_CR0_VPIX_Pos) | - (initStruct->ClkAlways << LCD_CR0_DCLK_Pos) | - (initStruct->HsyncWidth << LCD_CR0_HLOW_Pos); - - LCDx->CR1 = ((initStruct->Hfp - 1) << LCD_CR1_HFP_Pos) | - ((initStruct->Hbp - 1) << LCD_CR1_HBP_Pos) | - ((initStruct->Vfp - 1) << LCD_CR1_VFP_Pos) | - ((initStruct->Vbp - 1) << LCD_CR1_VBP_Pos) | - (initStruct->ClkDiv << LCD_CR1_DCLKDIV_Pos) | - (initStruct->SamplEdge << LCD_CR1_DCLKINV_Pos); - } - else if(initStruct->Interface == LCD_INTERFACE_I80) - { - // - } + + LCDx->CR0 = ((initStruct->HnPixel - 1) << LCD_CR0_HPIX_Pos) | + ((initStruct->VnPixel - 1) << LCD_CR0_VPIX_Pos) | + (initStruct->ClkAlways << LCD_CR0_DCLK_Pos) | + (initStruct->HsyncWidth << LCD_CR0_HLOW_Pos); + + LCDx->CR1 = ((initStruct->Hfp - 1) << LCD_CR1_HFP_Pos) | + ((initStruct->Hbp - 1) << LCD_CR1_HBP_Pos) | + ((initStruct->Vfp - 1) << LCD_CR1_VFP_Pos) | + ((initStruct->Vbp - 1) << LCD_CR1_VBP_Pos) | + (initStruct->ClkDiv << LCD_CR1_DCLKDIV_Pos) | + (initStruct->SamplEdge << LCD_CR1_DCLKINV_Pos); LCDx->IE = 1; - LCDx->IF = 1; //清除标志 + LCDx->IF = 1; //娓呴櫎鏍囧織 if(initStruct->IntEOTEn) LCD_INTEn(LCDx); else LCD_INTDis(LCDx); @@ -82,11 +73,11 @@ void LCD_Init(LCD_TypeDef * LCDx, LCD_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: LCD_Start() -* 功能说明: 启动一次数据传输 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_Start() +* 鍔熻兘璇存槑: 鍚姩涓娆℃暟鎹紶杈 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void LCD_Start(LCD_TypeDef * LCDx) { @@ -94,11 +85,11 @@ void LCD_Start(LCD_TypeDef * LCDx) } /****************************************************************************************************************************************** -* 函数名称: LCD_IsBusy() -* 功能说明: 是否正在进行数据传输 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: uint32_t 1 正在传输数据 0 数据传输已完成 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_IsBusy() +* 鍔熻兘璇存槑: 鏄惁姝e湪杩涜鏁版嵁浼犺緭 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: uint32_t 1 姝e湪浼犺緭鏁版嵁 0 鏁版嵁浼犺緭宸插畬鎴 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t LCD_IsBusy(LCD_TypeDef * LCDx) { @@ -106,11 +97,11 @@ uint32_t LCD_IsBusy(LCD_TypeDef * LCDx) } /****************************************************************************************************************************************** -* 函数名称: LCD_INTEn() -* 功能说明: LCD中断使能,完成指定长度的数据传输时触发中断 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_INTEn() +* 鍔熻兘璇存槑: LCD涓柇浣胯兘锛屽畬鎴愭寚瀹氶暱搴︾殑鏁版嵁浼犺緭鏃惰Е鍙戜腑鏂 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void LCD_INTEn(LCD_TypeDef * LCDx) { @@ -118,11 +109,11 @@ void LCD_INTEn(LCD_TypeDef * LCDx) } /****************************************************************************************************************************************** -* 函数名称: LCD_INTDis() -* 功能说明: LCD中断禁止,完成指定长度的数据传输时不触发中断 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_INTDis() +* 鍔熻兘璇存槑: LCD涓柇绂佹锛屽畬鎴愭寚瀹氶暱搴︾殑鏁版嵁浼犺緭鏃朵笉瑙﹀彂涓柇 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void LCD_INTDis(LCD_TypeDef * LCDx) { @@ -130,11 +121,11 @@ void LCD_INTDis(LCD_TypeDef * LCDx) } /****************************************************************************************************************************************** -* 函数名称: LCD_INTClr() -* 功能说明: LCD中断标志清除 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_INTClr() +* 鍔熻兘璇存槑: LCD涓柇鏍囧織娓呴櫎 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void LCD_INTClr(LCD_TypeDef * LCDx) { @@ -142,11 +133,11 @@ void LCD_INTClr(LCD_TypeDef * LCDx) } /****************************************************************************************************************************************** -* 函数名称: LCD_INTStat() -* 功能说明: LCD中断状态查询 -* 输 入: LCD_TypeDef * LCDx 指定要被设置的LCD,有效值包括LCD -* 输 出: uint32_t 1 完成指定长度的数据传输 0 未完成指定长度的数据传输 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: LCD_INTStat() +* 鍔熻兘璇存槑: LCD涓柇鐘舵佹煡璇 +* 杈 鍏: LCD_TypeDef * LCDx 鎸囧畾瑕佽璁剧疆鐨凩CD锛屾湁鏁堝煎寘鎷琇CD +* 杈 鍑: uint32_t 1 瀹屾垚鎸囧畾闀垮害鐨勬暟鎹紶杈 0 鏈畬鎴愭寚瀹氶暱搴︾殑鏁版嵁浼犺緭 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t LCD_INTStat(LCD_TypeDef * LCDx) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.h index 490af3162f..8091a88f03 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_lcd.h @@ -2,10 +2,7 @@ #define __SWM320_LCD_H__ -typedef struct { - uint8_t Interface; //LCD屏接口:LCD_INTERFACE_RGB、LCD_INTERFACE_I80、LCD_INTERFACE_M68 - - /* RGB同步接口参数 */ +typedef struct { uint16_t HnPixel; //水平方向像素个数,最大取值1024 uint16_t VnPixel; //垂直方向像素个数,最大取值 768 uint8_t Hfp; //horizonal front porch,最大取值32 @@ -21,10 +18,6 @@ typedef struct { } LCD_InitStructure; -#define LCD_INTERFACE_RGB 0 -#define LCD_INTERFACE_I80 1 -#define LCD_INTERFACE_M68 2 - #define LCD_SAMPLEDGE_RISE 0 //屏幕在DOTCLK的上升沿采样数据 #define LCD_SAMPLEDGE_FALL 1 //屏幕在DOTCLK的下降沿采样数据 diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_norflash.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_norflash.h index 23f7e5f902..1714454dd7 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_norflash.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_norflash.h @@ -2,12 +2,12 @@ #define __SWM320_NORFLASH_H__ typedef struct { - uint8_t DataWidth; // 8、16 + uint8_t DataWidth; // 8銆16 - uint8_t WELowPulseTime; // WE# pulse width,单位为系统时钟周期,最大值为7 - uint8_t OEPreValidTime; // Valid data output after OE# low,单位为系统时钟周期,最大值为15 + uint8_t WELowPulseTime; // WE# pulse width锛屽崟浣嶄负绯荤粺鏃堕挓鍛ㄦ湡锛屾渶澶у间负7 + uint8_t OEPreValidTime; // Valid data output after OE# low锛屽崟浣嶄负绯荤粺鏃堕挓鍛ㄦ湡锛屾渶澶у间负15 - uint8_t OperFinishIEn; // 操作(写入、擦除)完成中断使能 + uint8_t OperFinishIEn; // 鎿嶄綔(鍐欏叆銆佹摝闄)瀹屾垚涓柇浣胯兘 uint8_t OperTimeoutIEn; } NORFL_InitStructure; @@ -21,7 +21,7 @@ uint32_t NORFL_Read(uint32_t addr); uint16_t NORFL_ReadID(uint32_t id_addr); -/* 当前版本总线读只支持字读 +/* 褰撳墠鐗堟湰鎬荤嚎璇诲彧鏀寔瀛楄 #define NORFL_Read8(addr) *((volatile uint8_t *)(NORFLM_BASE + addr)) #define NORFL_Read16(addr) *((volatile uint16_t *)(NORFLM_BASE + addr)) */ #define NORFL_Read32(addr) *((volatile uint32_t *)(NORFLM_BASE + addr)) diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.c index af21c1ffeb..55967f7cac 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_port.c -* 功能说明: SWM320单片机的端口引脚功能选择库函数 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_port.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑绔彛寮曡剼鍔熻兘閫夋嫨搴撳嚱鏁 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,15 +23,15 @@ /****************************************************************************************************************************************** -* 函数名称: PORT_Init() -* 功能说明: 端口引脚功能选择,可用的功能见"SWM320_port.h"文件 -* 输 入: uint32_t PORTx 指定PORT端口,有效值包括PORTA、PORTB、PORTC、PORTM、PORTN、PORTP -* uint32_t n 指定PORT引脚,有效值包括PIN0、PIN1、PIN2、... ... PIN22、PIN23 -* uint32_t func 指定端口引脚要设定的功能,其可取值见"SWM320_port.h"文件 -* uint32_t digit_in_en 数字输入使能 -* 输 出: 无 -* 注意事项: 当引脚标号n为偶数时,func取值只能是FUNMUX0开头的,如FUNMUX0_UART0_RXD -* 当引脚标号n为奇数时,func取值只能是FUNMUX1开头的,如FUNMUX1_UART0_TXD +* 鍑芥暟鍚嶇О: PORT_Init() +* 鍔熻兘璇存槑: 绔彛寮曡剼鍔熻兘閫夋嫨锛屽彲鐢ㄧ殑鍔熻兘瑙"SWM320_port.h"鏂囦欢 +* 杈 鍏: uint32_t PORTx 鎸囧畾PORT绔彛锛屾湁鏁堝煎寘鎷琍ORTA銆丳ORTB銆丳ORTC銆丳ORTM銆丳ORTN銆丳ORTP +* uint32_t n 鎸囧畾PORT寮曡剼锛屾湁鏁堝煎寘鎷琍IN0銆丳IN1銆丳IN2銆... ... PIN22銆丳IN23 +* uint32_t func 鎸囧畾绔彛寮曡剼瑕佽瀹氱殑鍔熻兘锛屽叾鍙彇鍊艰"SWM320_port.h"鏂囦欢 +* uint32_t digit_in_en 鏁板瓧杈撳叆浣胯兘 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 褰撳紩鑴氭爣鍙穘涓哄伓鏁版椂锛宖unc鍙栧煎彧鑳芥槸FUNMUX0寮澶寸殑锛屽FUNMUX0_UART0_RXD +* 褰撳紩鑴氭爣鍙穘涓哄鏁版椂锛宖unc鍙栧煎彧鑳芥槸FUNMUX1寮澶寸殑锛屽FUNMUX1_UART0_TXD ******************************************************************************************************************************************/ void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.h index 1e2f4f2244..9fa2a24b12 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_port.h @@ -1,7 +1,7 @@ #ifndef __SWM320_PORT_H__ #define __SWM320_PORT_H__ -void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en); //端口引脚功能选择,其可取值如下: +void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en); //绔彛寮曡剼鍔熻兘閫夋嫨锛屽叾鍙彇鍊煎涓嬶細 #define PORTA 0 #define PORTB 1 @@ -425,8 +425,8 @@ void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en); -/* 下面宏定义的取值全部在正确值的基础上“加100”,以区分上面宏定义的值,从而方便库函数的编写*/ -/* 下面这些值是偶数编号引脚的功能取值,如PIN0、PIN2、... */ +/* 涓嬮潰瀹忓畾涔夌殑鍙栧煎叏閮ㄥ湪姝g‘鍊肩殑鍩虹涓娾滃姞100鈥濓紝浠ュ尯鍒嗕笂闈㈠畯瀹氫箟鐨勫硷紝浠庤屾柟渚垮簱鍑芥暟鐨勭紪鍐*/ +/* 涓嬮潰杩欎簺鍊兼槸鍋舵暟缂栧彿寮曡剼鐨勫姛鑳藉彇鍊硷紝濡侾IN0銆丳IN2銆... */ #define FUNMUX0_UART0_RXD 100 #define FUNMUX0_UART1_RXD 101 #define FUNMUX0_UART2_RXD 102 @@ -452,7 +452,7 @@ void PORT_Init(uint32_t PORTx, uint32_t n, uint32_t func, uint32_t digit_in_en); #define FUNMUX0_UART2_CTS 123 #define FUNMUX0_UART3_CTS 124 -/* 下面这些值是奇数编号引脚的功能取值,如PIN1、PIN3、... */ +/* 涓嬮潰杩欎簺鍊兼槸濂囨暟缂栧彿寮曡剼鐨勫姛鑳藉彇鍊硷紝濡侾IN1銆丳IN3銆... */ #define FUNMUX1_UART0_TXD 100 #define FUNMUX1_UART1_TXD 101 #define FUNMUX1_UART2_TXD 102 diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.c index e74334fc93..2c8e87cd9b 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_pwm.c -* 功能说明: SWM320单片机的PWM功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_pwm.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑PWM鍔熻兘椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,12 +23,12 @@ /****************************************************************************************************************************************** -* 函数名称: PWM_Init() -* 功能说明: PWM初始化 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* PWM_InitStructure * initStruct 包含PWM相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_Init() +* 鍔熻兘璇存槑: PWM鍒濆鍖 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* PWM_InitStructure * initStruct 鍖呭惈PWM鐩稿叧璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct) { @@ -39,7 +39,7 @@ void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct) SYS->CLKDIV &= ~SYS_CLKDIV_PWM_Msk; SYS->CLKDIV |= (initStruct->clk_div << SYS_CLKDIV_PWM_Pos); - PWM_Stop(PWMx, 1, 1); //一些关键寄存器只能在PWM停止时设置 + PWM_Stop(PWMx, 1, 1); //涓浜涘叧閿瘎瀛樺櫒鍙兘鍦≒WM鍋滄鏃惰缃 PWMx->MODE = initStruct->mode; @@ -84,7 +84,7 @@ void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct) break; } - PWMG->IRS = ((0x01 << bit_offset) | (0x01 << (bit_offset+1)) | (0x01 << (bit_offset+12)) | (0x01 << (bit_offset+13))); //清除中断标志 + PWMG->IRS = ((0x01 << bit_offset) | (0x01 << (bit_offset+1)) | (0x01 << (bit_offset+12)) | (0x01 << (bit_offset+13))); //娓呴櫎涓柇鏍囧織 PWMG->IE &= ~((0x01 << bit_offset) | (0x01 << (bit_offset+1)) | (0x01 << (bit_offset+12)) | (0x01 << (bit_offset+13))); PWMG->IE |= (initStruct->NCycleAIEn << bit_offset) | (initStruct->NCycleBIEn << (bit_offset+1)) | (initStruct->HEndAIEn << (bit_offset+12)) | (initStruct->HEndBIEn << (bit_offset+13)); @@ -100,13 +100,13 @@ void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: PWM_Start() -* 功能说明: 启动PWM,开始PWM输出 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chA 0 通道A不启动 1 通道A启动 -* uint32_t chB 0 通道B不启动 1 通道B启动 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_Start() +* 鍔熻兘璇存槑: 鍚姩PWM锛屽紑濮婸WM杈撳嚭 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chA 0 閫氶亾A涓嶅惎鍔 1 閫氶亾A鍚姩 +* uint32_t chB 0 閫氶亾B涓嶅惎鍔 1 閫氶亾B鍚姩 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_Start(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB) { @@ -139,13 +139,13 @@ void PWM_Start(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB) } /****************************************************************************************************************************************** -* 函数名称: PWM_Stop() -* 功能说明: 关闭PWM,停止PWM输出 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chA 0 通道A不关闭 1 通道A关闭 -* uint32_t chB 0 通道B不关闭 1 通道B关闭 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_Stop() +* 鍔熻兘璇存槑: 鍏抽棴PWM锛屽仠姝WM杈撳嚭 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chA 0 閫氶亾A涓嶅叧闂 1 閫氶亾A鍏抽棴 +* uint32_t chB 0 閫氶亾B涓嶅叧闂 1 閫氶亾B鍏抽棴 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_Stop(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB) { @@ -178,13 +178,13 @@ void PWM_Stop(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB) } /****************************************************************************************************************************************** -* 函数名称: PWM_SetCycle() -* 功能说明: 设置周期 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* uint16_t cycle 要设定的周期值 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_SetCycle() +* 鍔熻兘璇存槑: 璁剧疆鍛ㄦ湡 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* uint16_t cycle 瑕佽瀹氱殑鍛ㄦ湡鍊 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_SetCycle(PWM_TypeDef * PWMx, uint32_t chn, uint16_t cycle) { @@ -195,12 +195,12 @@ void PWM_SetCycle(PWM_TypeDef * PWMx, uint32_t chn, uint16_t cycle) } /****************************************************************************************************************************************** -* 函数名称: PWM_GetCycle() -* 功能说明: 获取周期 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要查询哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: uint16_t 获取到的周期值 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_GetCycle() +* 鍔熻兘璇存槑: 鑾峰彇鍛ㄦ湡 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佹煡璇㈠摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: uint16_t 鑾峰彇鍒扮殑鍛ㄦ湡鍊 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint16_t PWM_GetCycle(PWM_TypeDef * PWMx, uint32_t chn) { @@ -215,13 +215,13 @@ uint16_t PWM_GetCycle(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_SetHDuty() -* 功能说明: 设置高电平时长 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* uint16_t hduty 要设定的高电平时长 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_SetHDuty() +* 鍔熻兘璇存槑: 璁剧疆楂樼數骞虫椂闀 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* uint16_t hduty 瑕佽瀹氱殑楂樼數骞虫椂闀 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_SetHDuty(PWM_TypeDef * PWMx, uint32_t chn, uint16_t hduty) { @@ -232,12 +232,12 @@ void PWM_SetHDuty(PWM_TypeDef * PWMx, uint32_t chn, uint16_t hduty) } /****************************************************************************************************************************************** -* 函数名称: PWM_GetHDuty() -* 功能说明: 获取高电平时长 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要查询哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: uint16_t 获取到的高电平时长 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_GetHDuty() +* 鍔熻兘璇存槑: 鑾峰彇楂樼數骞虫椂闀 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佹煡璇㈠摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: uint16_t 鑾峰彇鍒扮殑楂樼數骞虫椂闀 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint16_t PWM_GetHDuty(PWM_TypeDef * PWMx, uint32_t chn) { @@ -252,13 +252,13 @@ uint16_t PWM_GetHDuty(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_SetDeadzone() -* 功能说明: 设置死区时长 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* uint8_t deadzone 要设定的死区时长 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_SetDeadzone() +* 鍔熻兘璇存槑: 璁剧疆姝诲尯鏃堕暱 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* uint8_t deadzone 瑕佽瀹氱殑姝诲尯鏃堕暱 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_SetDeadzone(PWM_TypeDef * PWMx, uint32_t chn, uint8_t deadzone) { @@ -269,12 +269,12 @@ void PWM_SetDeadzone(PWM_TypeDef * PWMx, uint32_t chn, uint8_t deadzone) } /****************************************************************************************************************************************** -* 函数名称: PWM_GetDeadzone() -* 功能说明: 获取死区时长 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要查询哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: uint8_t 获取到的死区时长 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_GetDeadzone() +* 鍔熻兘璇存槑: 鑾峰彇姝诲尯鏃堕暱 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佹煡璇㈠摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: uint8_t 鑾峰彇鍒扮殑姝诲尯鏃堕暱 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint8_t PWM_GetDeadzone(PWM_TypeDef * PWMx, uint32_t chn) { @@ -290,12 +290,12 @@ uint8_t PWM_GetDeadzone(PWM_TypeDef * PWMx, uint32_t chn) /****************************************************************************************************************************************** -* 函数名称: PWM_IntNCycleEn() -* 功能说明: 新周期开始中断使能 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntNCycleEn() +* 鍔熻兘璇存槑: 鏂板懆鏈熷紑濮嬩腑鏂娇鑳 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntNCycleEn(PWM_TypeDef * PWMx, uint32_t chn) { @@ -334,12 +334,12 @@ void PWM_IntNCycleEn(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntNCycleDis() -* 功能说明: 新周期开始中断禁能 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntNCycleDis() +* 鍔熻兘璇存槑: 鏂板懆鏈熷紑濮嬩腑鏂鑳 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntNCycleDis(PWM_TypeDef * PWMx, uint32_t chn) { @@ -378,12 +378,12 @@ void PWM_IntNCycleDis(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntNCycleClr() -* 功能说明: 新周期开始中断标志清除 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntNCycleClr() +* 鍔熻兘璇存槑: 鏂板懆鏈熷紑濮嬩腑鏂爣蹇楁竻闄 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntNCycleClr(PWM_TypeDef * PWMx, uint32_t chn) { @@ -422,12 +422,12 @@ void PWM_IntNCycleClr(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntNCycleStat() -* 功能说明: 新周期开始中断是否发生 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: uint32_t 1 新周期开始中断已发生 0 新周期开始中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntNCycleStat() +* 鍔熻兘璇存槑: 鏂板懆鏈熷紑濮嬩腑鏂槸鍚﹀彂鐢 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: uint32_t 1 鏂板懆鏈熷紑濮嬩腑鏂凡鍙戠敓 0 鏂板懆鏈熷紑濮嬩腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t PWM_IntNCycleStat(PWM_TypeDef * PWMx, uint32_t chn) { @@ -471,12 +471,12 @@ uint32_t PWM_IntNCycleStat(PWM_TypeDef * PWMx, uint32_t chn) /****************************************************************************************************************************************** -* 函数名称: PWM_IntHEndEn() -* 功能说明: 高电平结束中断使能 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntHEndEn() +* 鍔熻兘璇存槑: 楂樼數骞崇粨鏉熶腑鏂娇鑳 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntHEndEn(PWM_TypeDef * PWMx, uint32_t chn) { @@ -515,12 +515,12 @@ void PWM_IntHEndEn(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntHEndDis() -* 功能说明: 高电平结束中断禁能 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntHEndDis() +* 鍔熻兘璇存槑: 楂樼數骞崇粨鏉熶腑鏂鑳 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntHEndDis(PWM_TypeDef * PWMx, uint32_t chn) { @@ -559,12 +559,12 @@ void PWM_IntHEndDis(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntHEndClr() -* 功能说明: 高电平结束中断标志清除 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntHEndClr() +* 鍔熻兘璇存槑: 楂樼數骞崇粨鏉熶腑鏂爣蹇楁竻闄 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void PWM_IntHEndClr(PWM_TypeDef * PWMx, uint32_t chn) { @@ -603,12 +603,12 @@ void PWM_IntHEndClr(PWM_TypeDef * PWMx, uint32_t chn) } /****************************************************************************************************************************************** -* 函数名称: PWM_IntHEndStat() -* 功能说明: 高电平结束中断是否发生 -* 输 入: PWM_TypeDef * PWMx 指定要被设置的PWM,有效值包括PWM0、PWM1、PWM2、PWM3、PWM4、PWM5 -* uint32_t chn 选择要设置哪个通道,有效值:PWM_CH_A、PWM_CH_B -* 输 出: uint32_t 1 高电平结束中断已发生 0 高电平结束中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: PWM_IntHEndStat() +* 鍔熻兘璇存槑: 楂樼數骞崇粨鏉熶腑鏂槸鍚﹀彂鐢 +* 杈 鍏: PWM_TypeDef * PWMx 鎸囧畾瑕佽璁剧疆鐨凱WM锛屾湁鏁堝煎寘鎷琍WM0銆丳WM1銆丳WM2銆丳WM3銆丳WM4銆丳WM5 +* uint32_t chn 閫夋嫨瑕佽缃摢涓氶亾锛屾湁鏁堝硷細PWM_CH_A銆丳WM_CH_B +* 杈 鍑: uint32_t 1 楂樼數骞崇粨鏉熶腑鏂凡鍙戠敓 0 楂樼數骞崇粨鏉熶腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t PWM_IntHEndStat(PWM_TypeDef * PWMx, uint32_t chn) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.h index 4565a05a94..6f857fae37 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_pwm.h @@ -2,57 +2,57 @@ #define __SWM320_PWM_H__ typedef struct { - uint8_t clk_div; //PWM_CLKDIV_1、PWM_CLKDIV_8 + uint8_t clk_div; //PWM_CLKDIV_1銆丳WM_CLKDIV_8 - uint8_t mode; //PWM_MODE_INDEP、PWM_MODE_COMPL、PWM_MODE_INDEP_CALIGN、PWM_MODE_COMPL_CALIGN + uint8_t mode; //PWM_MODE_INDEP銆丳WM_MODE_COMPL銆丳WM_MODE_INDEP_CALIGN銆丳WM_MODE_COMPL_CALIGN - uint16_t cycleA; //A路周期 - uint16_t hdutyA; //A路占空比 - uint16_t deadzoneA; //A路死区时长,取值0--1023 - uint8_t initLevelA; //A路初始输出电平,0 低电平 1 高电平 + uint16_t cycleA; //A璺懆鏈 + uint16_t hdutyA; //A璺崰绌烘瘮 + uint16_t deadzoneA; //A璺鍖烘椂闀匡紝鍙栧0--1023 + uint8_t initLevelA; //A璺垵濮嬭緭鍑虹數骞筹紝0 浣庣數骞 1 楂樼數骞 - uint16_t cycleB; //B路周期 - uint16_t hdutyB; //B路占空比 - uint16_t deadzoneB; //B路死区时长,取值0--1023 - uint8_t initLevelB; //B路初始输出电平,0 低电平 1 高电平 + uint16_t cycleB; //B璺懆鏈 + uint16_t hdutyB; //B璺崰绌烘瘮 + uint16_t deadzoneB; //B璺鍖烘椂闀匡紝鍙栧0--1023 + uint8_t initLevelB; //B璺垵濮嬭緭鍑虹數骞筹紝0 浣庣數骞 1 楂樼數骞 - uint8_t HEndAIEn; //A路高电平结束中断使能 - uint8_t NCycleAIEn; //A路新周期开始中断使能 - uint8_t HEndBIEn; //B路高电平结束中断使能 - uint8_t NCycleBIEn; //B路新周期开始中断使能 + uint8_t HEndAIEn; //A璺珮鐢靛钩缁撴潫涓柇浣胯兘 + uint8_t NCycleAIEn; //A璺柊鍛ㄦ湡寮濮嬩腑鏂娇鑳 + uint8_t HEndBIEn; //B璺珮鐢靛钩缁撴潫涓柇浣胯兘 + uint8_t NCycleBIEn; //B璺柊鍛ㄦ湡寮濮嬩腑鏂娇鑳 } PWM_InitStructure; #define PWM_CLKDIV_1 0 #define PWM_CLKDIV_8 1 -#define PWM_MODE_INDEP 0 //A路和B路为两路独立输出 -#define PWM_MODE_COMPL 1 //A路和B路为一路互补输出 -#define PWM_MODE_INDEP_CALIGN 3 //A路和B路为两路独立输出,中心对齐 -#define PWM_MODE_COMPL_CALIGN 4 //A路和B路为一路互补输出,中心对齐 +#define PWM_MODE_INDEP 0 //A璺拰B璺负涓よ矾鐙珛杈撳嚭 +#define PWM_MODE_COMPL 1 //A璺拰B璺负涓璺簰琛ヨ緭鍑 +#define PWM_MODE_INDEP_CALIGN 3 //A璺拰B璺负涓よ矾鐙珛杈撳嚭锛屼腑蹇冨榻 +#define PWM_MODE_COMPL_CALIGN 4 //A璺拰B璺负涓璺簰琛ヨ緭鍑猴紝涓績瀵归綈 #define PWM_CH_A 0 #define PWM_CH_B 1 -void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct); //PWM初始化 -void PWM_Start(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //启动PWM,开始PWM输出 -void PWM_Stop(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //关闭PWM,停止PWM输出 +void PWM_Init(PWM_TypeDef * PWMx, PWM_InitStructure * initStruct); //PWM鍒濆鍖 +void PWM_Start(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //鍚姩PWM锛屽紑濮婸WM杈撳嚭 +void PWM_Stop(PWM_TypeDef * PWMx, uint32_t chA, uint32_t chB); //鍏抽棴PWM锛屽仠姝WM杈撳嚭 -void PWM_SetCycle(PWM_TypeDef * PWMx, uint32_t chn, uint16_t cycle); //设置周期 -uint16_t PWM_GetCycle(PWM_TypeDef * PWMx, uint32_t chn); //获取周期 -void PWM_SetHDuty(PWM_TypeDef * PWMx, uint32_t chn, uint16_t hduty); //设置高电平时长 -uint16_t PWM_GetHDuty(PWM_TypeDef * PWMx, uint32_t chn); //获取高电平时长 -void PWM_SetDeadzone(PWM_TypeDef * PWMx, uint32_t chn, uint8_t deadzone); //设置死区时长 -uint8_t PWM_GetDeadzone(PWM_TypeDef * PWMx, uint32_t chn); //获取死区时长 +void PWM_SetCycle(PWM_TypeDef * PWMx, uint32_t chn, uint16_t cycle); //璁剧疆鍛ㄦ湡 +uint16_t PWM_GetCycle(PWM_TypeDef * PWMx, uint32_t chn); //鑾峰彇鍛ㄦ湡 +void PWM_SetHDuty(PWM_TypeDef * PWMx, uint32_t chn, uint16_t hduty); //璁剧疆楂樼數骞虫椂闀 +uint16_t PWM_GetHDuty(PWM_TypeDef * PWMx, uint32_t chn); //鑾峰彇楂樼數骞虫椂闀 +void PWM_SetDeadzone(PWM_TypeDef * PWMx, uint32_t chn, uint8_t deadzone); //璁剧疆姝诲尯鏃堕暱 +uint8_t PWM_GetDeadzone(PWM_TypeDef * PWMx, uint32_t chn); //鑾峰彇姝诲尯鏃堕暱 -void PWM_IntNCycleEn(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断使能 -void PWM_IntNCycleDis(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断禁能 -void PWM_IntNCycleClr(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断标志清除 -uint32_t PWM_IntNCycleStat(PWM_TypeDef * PWMx, uint32_t chn); //新周期开始中断是否发生 -void PWM_IntHEndEn(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断使能 -void PWM_IntHEndDis(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断禁能 -void PWM_IntHEndClr(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断标志清除 -uint32_t PWM_IntHEndStat(PWM_TypeDef * PWMx, uint32_t chn); //高电平结束中断是否发生 +void PWM_IntNCycleEn(PWM_TypeDef * PWMx, uint32_t chn); //鏂板懆鏈熷紑濮嬩腑鏂娇鑳 +void PWM_IntNCycleDis(PWM_TypeDef * PWMx, uint32_t chn); //鏂板懆鏈熷紑濮嬩腑鏂鑳 +void PWM_IntNCycleClr(PWM_TypeDef * PWMx, uint32_t chn); //鏂板懆鏈熷紑濮嬩腑鏂爣蹇楁竻闄 +uint32_t PWM_IntNCycleStat(PWM_TypeDef * PWMx, uint32_t chn); //鏂板懆鏈熷紑濮嬩腑鏂槸鍚﹀彂鐢 +void PWM_IntHEndEn(PWM_TypeDef * PWMx, uint32_t chn); //楂樼數骞崇粨鏉熶腑鏂娇鑳 +void PWM_IntHEndDis(PWM_TypeDef * PWMx, uint32_t chn); //楂樼數骞崇粨鏉熶腑鏂鑳 +void PWM_IntHEndClr(PWM_TypeDef * PWMx, uint32_t chn); //楂樼數骞崇粨鏉熶腑鏂爣蹇楁竻闄 +uint32_t PWM_IntHEndStat(PWM_TypeDef * PWMx, uint32_t chn); //楂樼數骞崇粨鏉熶腑鏂槸鍚﹀彂鐢 #endif //__SWM320_PWM_H__ diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.c index 2ce0f390b7..d43ee91f15 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_rtc.c -* 功能说明: SWM320单片机的RTC驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_rtc.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑RTC椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -24,18 +24,18 @@ static uint32_t calcWeekDay(uint32_t year, uint32_t month, uint32_t date); /****************************************************************************************************************************************** -* 函数名称: RTC_Init() -* 功能说明: RTC初始化 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,有效值包括RTC -* RTC_InitStructure * initStruct 包含RTC相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_Init() +* 鍔熻兘璇存槑: RTC鍒濆鍖 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屾湁鏁堝煎寘鎷琑TC +* RTC_InitStructure * initStruct 鍖呭惈RTC鐩稿叧璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_Init(RTC_TypeDef * RTCx, RTC_InitStructure * initStruct) { SYS->CLKEN |= (1 << SYS_CLKEN_RTCBKP_Pos); - SYS->LRCCR &= ~(1 << SYS_LRCCR_OFF_Pos); //RTC使用32KHz RC时钟 + SYS->LRCCR &= ~(1 << SYS_LRCCR_OFF_Pos); //RTC浣跨敤32KHz RC鏃堕挓 SYS->CLKEN |= (1 << SYS_CLKEN_RTC_Pos) | ((uint32_t)1 << SYS_CLKEN_ALIVE_Pos); @@ -72,11 +72,11 @@ void RTC_Init(RTC_TypeDef * RTCx, RTC_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: RTC_Start() -* 功能说明: 启动RTC -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_Start() +* 鍔熻兘璇存槑: 鍚姩RTC +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_Start(RTC_TypeDef * RTCx) { @@ -84,11 +84,11 @@ void RTC_Start(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_Stop() -* 功能说明: 停止RTC -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_Stop() +* 鍔熻兘璇存槑: 鍋滄RTC +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_Stop(RTC_TypeDef * RTCx) { @@ -96,12 +96,12 @@ void RTC_Stop(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_GetDateTime() -* 功能说明: 获取当前的时间和日期 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,有效值包括RTC -* RTC_DateTime * dateTime 获取到的时间、日期值存入此指针指向的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_GetDateTime() +* 鍔熻兘璇存槑: 鑾峰彇褰撳墠鐨勬椂闂村拰鏃ユ湡 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屾湁鏁堝煎寘鎷琑TC +* RTC_DateTime * dateTime 鑾峰彇鍒扮殑鏃堕棿銆佹棩鏈熷煎瓨鍏ユ鎸囬拡鎸囧悜鐨勭粨鏋勪綋 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_GetDateTime(RTC_TypeDef * RTCx, RTC_DateTime * dateTime) { @@ -115,12 +115,12 @@ void RTC_GetDateTime(RTC_TypeDef * RTCx, RTC_DateTime * dateTime) } /****************************************************************************************************************************************** -* 函数名称: RTC_AlarmSetup() -* 功能说明: RTC闹钟设定 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,有效值包括RTC -* RTC_AlarmStructure * alarmStruct 包含RTC闹钟设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_AlarmSetup() +* 鍔熻兘璇存槑: RTC闂归挓璁惧畾 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屾湁鏁堝煎寘鎷琑TC +* RTC_AlarmStructure * alarmStruct 鍖呭惈RTC闂归挓璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_AlarmSetup(RTC_TypeDef * RTCx, RTC_AlarmStructure * alarmStruct) { @@ -143,13 +143,13 @@ void RTC_AlarmSetup(RTC_TypeDef * RTCx, RTC_AlarmStructure * alarmStruct) } /****************************************************************************************************************************************** -* 函数名称: calcWeekDay() -* 功能说明: 计算指定年、月、日是星期几 -* 输 入: uint32_t year 年 -* uint32_t month 月 -* uint32_t date 日 -* 输 出: uint32_t 0 星期日 1 星期一 ... ... 6 星期六 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: calcWeekDay() +* 鍔熻兘璇存槑: 璁$畻鎸囧畾骞淬佹湀銆佹棩鏄槦鏈熷嚑 +* 杈 鍏: uint32_t year 骞 +* uint32_t month 鏈 +* uint32_t date 鏃 +* 杈 鍑: uint32_t 0 鏄熸湡鏃 1 鏄熸湡涓 ... ... 6 鏄熸湡鍏 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ static uint32_t calcWeekDay(uint32_t year, uint32_t month, uint32_t date) { @@ -173,11 +173,11 @@ static uint32_t calcWeekDay(uint32_t year, uint32_t month, uint32_t date) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntSecondEn() -* 功能说明: 秒中断使能 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntSecondEn() +* 鍔熻兘璇存槑: 绉掍腑鏂娇鑳 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntSecondEn(RTC_TypeDef * RTCx) { @@ -185,11 +185,11 @@ void RTC_IntSecondEn(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntSecondDis() -* 功能说明: 秒中断禁止 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntSecondDis() +* 鍔熻兘璇存槑: 绉掍腑鏂姝 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntSecondDis(RTC_TypeDef * RTCx) { @@ -197,11 +197,11 @@ void RTC_IntSecondDis(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntSecondClr() -* 功能说明: 秒中断标志清除 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntSecondClr() +* 鍔熻兘璇存槑: 绉掍腑鏂爣蹇楁竻闄 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntSecondClr(RTC_TypeDef * RTCx) { @@ -209,11 +209,11 @@ void RTC_IntSecondClr(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntSecondStat() -* 功能说明: 秒中断状态 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: uint32_t 1 秒中断发生 0 秒中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntSecondStat() +* 鍔熻兘璇存槑: 绉掍腑鏂姸鎬 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: uint32_t 1 绉掍腑鏂彂鐢 0 绉掍腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t RTC_IntSecondStat(RTC_TypeDef * RTCx) { @@ -221,11 +221,11 @@ uint32_t RTC_IntSecondStat(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntMinuteEn() -* 功能说明: 分中断使能 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntMinuteEn() +* 鍔熻兘璇存槑: 鍒嗕腑鏂娇鑳 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntMinuteEn(RTC_TypeDef * RTCx) { @@ -233,11 +233,11 @@ void RTC_IntMinuteEn(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntMinuteDis() -* 功能说明: 分中断禁止 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntMinuteDis() +* 鍔熻兘璇存槑: 鍒嗕腑鏂姝 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntMinuteDis(RTC_TypeDef * RTCx) { @@ -245,11 +245,11 @@ void RTC_IntMinuteDis(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntMinuteClr() -* 功能说明: 分中断标志清除 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntMinuteClr() +* 鍔熻兘璇存槑: 鍒嗕腑鏂爣蹇楁竻闄 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntMinuteClr(RTC_TypeDef * RTCx) { @@ -257,11 +257,11 @@ void RTC_IntMinuteClr(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntMinuteStat() -* 功能说明: 分中断状态 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: uint32_t 1 分中断发生 0 分中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntMinuteStat() +* 鍔熻兘璇存槑: 鍒嗕腑鏂姸鎬 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: uint32_t 1 鍒嗕腑鏂彂鐢 0 鍒嗕腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t RTC_IntMinuteStat(RTC_TypeDef * RTCx) { @@ -269,11 +269,11 @@ uint32_t RTC_IntMinuteStat(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntHourEn() -* 功能说明: 时中断使能 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntHourEn() +* 鍔熻兘璇存槑: 鏃朵腑鏂娇鑳 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntHourEn(RTC_TypeDef * RTCx) { @@ -281,11 +281,11 @@ void RTC_IntHourEn(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntHourDis() -* 功能说明: 时中断禁止 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntHourDis() +* 鍔熻兘璇存槑: 鏃朵腑鏂姝 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntHourDis(RTC_TypeDef * RTCx) { @@ -293,11 +293,11 @@ void RTC_IntHourDis(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntHourClr() -* 功能说明: 时中断标志清除 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntHourClr() +* 鍔熻兘璇存槑: 鏃朵腑鏂爣蹇楁竻闄 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntHourClr(RTC_TypeDef * RTCx) { @@ -305,11 +305,11 @@ void RTC_IntHourClr(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntHourStat() -* 功能说明: 时中断状态 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: uint32_t 1 时中断发生 0 时中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntHourStat() +* 鍔熻兘璇存槑: 鏃朵腑鏂姸鎬 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: uint32_t 1 鏃朵腑鏂彂鐢 0 鏃朵腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t RTC_IntHourStat(RTC_TypeDef * RTCx) { @@ -317,11 +317,11 @@ uint32_t RTC_IntHourStat(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntDateEn() -* 功能说明: 日中断使能 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntDateEn() +* 鍔熻兘璇存槑: 鏃ヤ腑鏂娇鑳 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntDateEn(RTC_TypeDef * RTCx) { @@ -329,11 +329,11 @@ void RTC_IntDateEn(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntDateDis() -* 功能说明: 日中断禁止 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntDateDis() +* 鍔熻兘璇存槑: 鏃ヤ腑鏂姝 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntDateDis(RTC_TypeDef * RTCx) { @@ -341,11 +341,11 @@ void RTC_IntDateDis(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntDateClr() -* 功能说明: 日中断标志清除 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntDateClr() +* 鍔熻兘璇存槑: 鏃ヤ腑鏂爣蹇楁竻闄 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntDateClr(RTC_TypeDef * RTCx) { @@ -353,11 +353,11 @@ void RTC_IntDateClr(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntDateStat() -* 功能说明: 日中断状态 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: uint32_t 1 日中断发生 0 日中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntDateStat() +* 鍔熻兘璇存槑: 鏃ヤ腑鏂姸鎬 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: uint32_t 1 鏃ヤ腑鏂彂鐢 0 鏃ヤ腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t RTC_IntDateStat(RTC_TypeDef * RTCx) { @@ -365,11 +365,11 @@ uint32_t RTC_IntDateStat(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntAlarmEn() -* 功能说明: 闹钟中断使能 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntAlarmEn() +* 鍔熻兘璇存槑: 闂归挓涓柇浣胯兘 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntAlarmEn(RTC_TypeDef * RTCx) { @@ -377,11 +377,11 @@ void RTC_IntAlarmEn(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntAlarmDis() -* 功能说明: 闹钟中断禁止 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntAlarmDis() +* 鍔熻兘璇存槑: 闂归挓涓柇绂佹 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntAlarmDis(RTC_TypeDef * RTCx) { @@ -389,11 +389,11 @@ void RTC_IntAlarmDis(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntAlarmClr() -* 功能说明: 闹钟中断标志清除 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntAlarmClr() +* 鍔熻兘璇存槑: 闂归挓涓柇鏍囧織娓呴櫎 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void RTC_IntAlarmClr(RTC_TypeDef * RTCx) { @@ -401,11 +401,11 @@ void RTC_IntAlarmClr(RTC_TypeDef * RTCx) } /****************************************************************************************************************************************** -* 函数名称: RTC_IntAlarmStat() -* 功能说明: 闹钟中断状态 -* 输 入: RTC_TypeDef * RTCx 指定要被设置的RTC,可取值包括RTC -* 输 出: uint32_t 1 闹钟中断发生 0 闹钟中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: RTC_IntAlarmStat() +* 鍔熻兘璇存槑: 闂归挓涓柇鐘舵 +* 杈 鍏: RTC_TypeDef * RTCx 鎸囧畾瑕佽璁剧疆鐨凴TC锛屽彲鍙栧煎寘鎷琑TC +* 杈 鍑: uint32_t 1 闂归挓涓柇鍙戠敓 0 闂归挓涓柇鏈彂鐢 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t RTC_IntAlarmStat(RTC_TypeDef * RTCx) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.h index 513f885cf6..13cd0e6785 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_rtc.h @@ -13,17 +13,17 @@ typedef struct { uint16_t Year; - uint8_t Month; //取值1--12 - uint8_t Date; //取值1--31 - uint8_t Hour; //取值0--23 - uint8_t Minute; //取值0--59 - uint8_t Second; //取值0--59 + uint8_t Month; //鍙栧1--12 + uint8_t Date; //鍙栧1--31 + uint8_t Hour; //鍙栧0--23 + uint8_t Minute; //鍙栧0--59 + uint8_t Second; //鍙栧0--59 uint8_t SecondIEn; uint8_t MinuteIEn; } RTC_InitStructure; typedef struct { - uint8_t Days; //RTC_SUN、RTC_MON、RTC_TUE、RTC_WED、RTC_THU、RTC_FRI、RTC_SAT及其或运算组合 + uint8_t Days; //RTC_SUN銆丷TC_MON銆丷TC_TUE銆丷TC_WED銆丷TC_THU銆丷TC_FRI銆丷TC_SAT鍙婂叾鎴栬繍绠楃粍鍚 uint8_t Hour; uint8_t Minute; uint8_t Second; @@ -34,7 +34,7 @@ typedef struct { uint16_t Year; uint8_t Month; uint8_t Date; - uint8_t Day; //RTC_SUN、RTC_MON、RTC_TUE、RTC_WED、RTC_THU、RTC_FRI、RTC_SAT + uint8_t Day; //RTC_SUN銆丷TC_MON銆丷TC_TUE銆丷TC_WED銆丷TC_THU銆丷TC_FRI銆丷TC_SAT uint8_t Hour; uint8_t Minute; uint8_t Second; diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.c index 2cb8b9e3e8..9175cce387 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_sdio.c -* 功能说明: SWM320单片机的SDIO接口驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: 为了通用性、兼容性、易用性,只支持以512字节为单位的读写 -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_sdio.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑SDIO鎺ュ彛椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: 涓轰簡閫氱敤鎬с佸吋瀹规с佹槗鐢ㄦэ紝鍙敮鎸佷互512瀛楄妭涓哄崟浣嶇殑璇诲啓 +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -25,11 +25,11 @@ SD_CardInfo SD_cardInfo; /****************************************************************************************************************************************** -* 函数名称: SDIO_Init() -* 功能说明: SDIO读写SD卡初始化,初始化成高速4线模式、读写以512字节大小进行 -* 输 入: uint32_t freq SDIO_CLK时钟频率 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_Init() +* 鍔熻兘璇存槑: SDIO璇诲啓SD鍗″垵濮嬪寲锛屽垵濮嬪寲鎴愰珮閫4绾挎ā寮忋佽鍐欎互512瀛楄妭澶у皬杩涜 +* 杈 鍏: uint32_t freq SDIO_CLK鏃堕挓棰戠巼 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_Init(uint32_t freq) { @@ -37,7 +37,7 @@ uint32_t SDIO_Init(uint32_t freq) uint32_t resp, resps[4]; SYS->CLKDIV &= ~SYS_CLKDIV_SDIO_Msk; - if(SystemCoreClock > 80000000) //SDIO时钟需要小于52MHz + if(SystemCoreClock > 80000000) //SDIO鏃堕挓闇瑕佸皬浜52MHz SYS->CLKDIV |= (2 << SYS_CLKDIV_SDIO_Pos); //SDCLK = SYSCLK / 4 else SYS->CLKDIV |= (1 << SYS_CLKDIV_SDIO_Pos); //SDCLK = SYSCLK / 2 @@ -64,7 +64,7 @@ uint32_t SDIO_Init(uint32_t freq) SDIO_SendCmd(SD_CMD_GO_IDLE_STATE, 0x00, SD_RESP_NO, 0); //CMD0: GO_IDLE_STATE - res = SDIO_SendCmd(SD_CMD_SEND_IF_COND, 0x1AA, SD_RESP_32b, &resp); //CMD8: SEND_IF_COND, 检测工作电压、检测是否支持SD 2.0 + res = SDIO_SendCmd(SD_CMD_SEND_IF_COND, 0x1AA, SD_RESP_32b, &resp); //CMD8: SEND_IF_COND, 妫娴嬪伐浣滅數鍘嬨佹娴嬫槸鍚︽敮鎸丼D 2.0 if(res != SD_RES_OK) return res; @@ -77,50 +77,50 @@ uint32_t SDIO_Init(uint32_t freq) if(res != SD_RES_OK) return res; - if(resp != 0x120) return SD_RES_ERR; //不是SD卡,可能是MMC卡 + if(resp != 0x120) return SD_RES_ERR; //涓嶆槸SD鍗★紝鍙兘鏄疢MC鍗 if(SD_cardInfo.CardType == SDIO_STD_CAPACITY_SD_CARD_V2_0) SDIO_SendCmd(SD_CMD_SD_APP_OP_COND, 0x80100000|0x40000000, SD_RESP_32b, &resp); else SDIO_SendCmd(SD_CMD_SD_APP_OP_COND, 0x80100000|0x00000000, SD_RESP_32b, &resp); - } while(((resp >> 31) & 0x01) == 0); //上电没完成时resp[31] == 0 + } while(((resp >> 31) & 0x01) == 0); //涓婄數娌″畬鎴愭椂resp[31] == 0 if(((resp >> 30) & 0x01) == 1) SD_cardInfo.CardType = SDIO_HIGH_CAPACITY_SD_CARD; - SDIO_SendCmd(SD_CMD_ALL_SEND_CID, 0x00, SD_RESP_128b, resps); //CMD2: SD_CMD_ALL_SEND_CID,获取CID + SDIO_SendCmd(SD_CMD_ALL_SEND_CID, 0x00, SD_RESP_128b, resps); //CMD2: SD_CMD_ALL_SEND_CID锛岃幏鍙朇ID parseCID(resps); - SDIO_SendCmd(SD_CMD_SET_REL_ADDR, 0x00, SD_RESP_32b, &resp); //CMD3: SD_CMD_SET_REL_ADDR,设置RCA + SDIO_SendCmd(SD_CMD_SET_REL_ADDR, 0x00, SD_RESP_32b, &resp); //CMD3: SD_CMD_SET_REL_ADDR锛岃缃甊CA SD_cardInfo.RCA = resp >> 16; - SDIO_SendCmd(SD_CMD_SEND_CSD, SD_cardInfo.RCA << 16, SD_RESP_128b, resps); //CMD9: SD_CMD_SEND_CSD,获取CSD + SDIO_SendCmd(SD_CMD_SEND_CSD, SD_cardInfo.RCA << 16, SD_RESP_128b, resps); //CMD9: SD_CMD_SEND_CSD锛岃幏鍙朇SD parseCSD(resps); - if(SD_cardInfo.CardBlockSize < 0x200) return SD_RES_ERR; //本驱动只支持以512字节为单位的读写,所以最大读写单位必须不小于512 + if(SD_cardInfo.CardBlockSize < 0x200) return SD_RES_ERR; //鏈┍鍔ㄥ彧鏀寔浠512瀛楄妭涓哄崟浣嶇殑璇诲啓锛屾墍浠ユ渶澶ц鍐欏崟浣嶅繀椤讳笉灏忎簬512 SDIO->CR2 &= ~(SDIO_CR2_SDCLKEN_Msk | SDIO_CR2_SDCLKDIV_Msk); SDIO->CR2 |= (1 << SDIO_CR2_SDCLKEN_Pos) | - (calcSDCLKDiv(freq) << SDIO_CR2_SDCLKDIV_Pos); //初始化完成,SDCLK切换到高速 + (calcSDCLKDiv(freq) << SDIO_CR2_SDCLKDIV_Pos); //鍒濆鍖栧畬鎴愶紝SDCLK鍒囨崲鍒伴珮閫 - SDIO_SendCmd(SD_CMD_SEL_DESEL_CARD, SD_cardInfo.RCA << 16, SD_RESP_32b_busy, &resp); //CMD7: 选中卡,从Standy模式进入Transfer模式 + SDIO_SendCmd(SD_CMD_SEL_DESEL_CARD, SD_cardInfo.RCA << 16, SD_RESP_32b_busy, &resp); //CMD7: 閫変腑鍗★紝浠嶴tandy妯″紡杩涘叆Transfer妯″紡 SDIO->IF = SDIO_IF_TRXDONE_Msk; SDIO_SendCmd(SD_CMD_APP_CMD, SD_cardInfo.RCA << 16, SD_RESP_32b, &resp); - SDIO_SendCmd(SD_CMD_APP_SD_SET_BUSWIDTH, SD_BUSWIDTH_4b, SD_RESP_32b, &resp); //切换成4位总线模式 + SDIO_SendCmd(SD_CMD_APP_SD_SET_BUSWIDTH, SD_BUSWIDTH_4b, SD_RESP_32b, &resp); //鍒囨崲鎴4浣嶆荤嚎妯″紡 SDIO->CR1 |= (1 << SDIO_CR1_4BIT_Pos); - SDIO_SendCmd(SD_CMD_SET_BLOCKLEN, 512, SD_RESP_32b, &resp); //固定块大小位512字节 + SDIO_SendCmd(SD_CMD_SET_BLOCKLEN, 512, SD_RESP_32b, &resp); //鍥哄畾鍧楀ぇ灏忎綅512瀛楄妭 SDIO->BLK = 512; @@ -128,12 +128,12 @@ uint32_t SDIO_Init(uint32_t freq) } /****************************************************************************************************************************************** -* 函数名称: SDIO_BlockWrite() -* 功能说明: 向SD卡写入数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint32_t buff[] 要写入的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_BlockWrite() +* 鍔熻兘璇存槑: 鍚慡D鍗″啓鍏ユ暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint32_t buff[] 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_BlockWrite(uint32_t block_addr, uint32_t buff[]) { @@ -159,13 +159,13 @@ uint32_t SDIO_BlockWrite(uint32_t block_addr, uint32_t buff[]) } /****************************************************************************************************************************************** -* 函数名称: SDIO_MultiBlockWrite() -* 功能说明: 向SD卡写入多块数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint16_t block_cnt 要写入的块数 -* uint32_t buff[] 要写入的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_MultiBlockWrite() +* 鍔熻兘璇存槑: 鍚慡D鍗″啓鍏ュ鍧楁暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint16_t block_cnt 瑕佸啓鍏ョ殑鍧楁暟 +* uint32_t buff[] 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_MultiBlockWrite(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]) { @@ -194,13 +194,13 @@ uint32_t SDIO_MultiBlockWrite(uint32_t block_addr, uint16_t block_cnt, uint32_t } /****************************************************************************************************************************************** -* 函数名称: SDIO_DMABlockWrite() -* 功能说明: 通过DMA向SD卡写入多块数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint16_t block_cnt 要写入的块数 -* uint32_t buff[] 要写入的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_DMABlockWrite() +* 鍔熻兘璇存槑: 閫氳繃DMA鍚慡D鍗″啓鍏ュ鍧楁暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint16_t block_cnt 瑕佸啓鍏ョ殑鍧楁暟 +* uint32_t buff[] 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_DMABlockWrite(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]) { @@ -223,12 +223,12 @@ uint32_t SDIO_DMABlockWrite(uint32_t block_addr, uint16_t block_cnt, uint32_t bu } /****************************************************************************************************************************************** -* 函数名称: SDIO_BlockRead() -* 功能说明: 从SD卡读出数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint32_t buff[] 读出的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_BlockRead() +* 鍔熻兘璇存槑: 浠嶴D鍗¤鍑烘暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint32_t buff[] 璇诲嚭鐨勬暟鎹 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_BlockRead(uint32_t block_addr, uint32_t buff[]) { @@ -254,13 +254,13 @@ uint32_t SDIO_BlockRead(uint32_t block_addr, uint32_t buff[]) } /****************************************************************************************************************************************** -* 函数名称: SDIO_MultiBlockRead() -* 功能说明: 从SD卡读出多块数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint16_t block_cnt 要读出的块数 -* uint32_t buff[] 读出的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_MultiBlockRead() +* 鍔熻兘璇存槑: 浠嶴D鍗¤鍑哄鍧楁暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint16_t block_cnt 瑕佽鍑虹殑鍧楁暟 +* uint32_t buff[] 璇诲嚭鐨勬暟鎹 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_MultiBlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]) { @@ -289,13 +289,13 @@ uint32_t SDIO_MultiBlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t b } /****************************************************************************************************************************************** -* 函数名称: SDIO_DMABlockRead() -* 功能说明: 通过DMA从SD卡读出多块数据 -* 输 入: uint32_t block_addr SD卡块地址,每块512字节 -* uint16_t block_cnt 要读出的块数 -* uint32_t buff[] 读出的数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDIO_DMABlockRead() +* 鍔熻兘璇存槑: 閫氳繃DMA浠嶴D鍗¤鍑哄鍧楁暟鎹 +* 杈 鍏: uint32_t block_addr SD鍗″潡鍦板潃锛屾瘡鍧512瀛楄妭 +* uint16_t block_cnt 瑕佽鍑虹殑鍧楁暟 +* uint32_t buff[] 璇诲嚭鐨勬暟鎹 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SDIO_DMABlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]) { @@ -318,20 +318,20 @@ uint32_t SDIO_DMABlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t buf } /****************************************************************************************************************************************** -* 函数名称: _SDIO_SendCmd() -* 功能说明: SDIO向SD卡发送命令 -* 输 入: uint32_t cmd 命令索引 -* uint32_t arg 命令参数 -* uint32_t _resp_type 响应类型,取值SD_RESP_NO、SD_RESP_32b、SD_RESP_128b、SD_RESP_32b_busy -* uint32_t *resp_data 响应内容 -* uint32_t have_data 是否有数据传输 -* uint32_t data_read 1 读SD卡 0 写SD卡 -* uint16_t block_cnt 读写块个数 -* uint32_t use_dma 1 使用DMA搬运数据 -* 输 出: uint32_t SD_RES_OK 操作成功 SD_RES_ERR 操作失败 SD_RES_TIMEOUT 操作超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: _SDIO_SendCmd() +* 鍔熻兘璇存槑: SDIO鍚慡D鍗″彂閫佸懡浠 +* 杈 鍏: uint32_t cmd 鍛戒护绱㈠紩 +* uint32_t arg 鍛戒护鍙傛暟 +* uint32_t resp_type 鍝嶅簲绫诲瀷锛屽彇鍊糞D_RESP_NO銆丼D_RESP_32b銆丼D_RESP_128b銆丼D_RESP_32b_busy +* uint32_t *resp_data 鍝嶅簲鍐呭 +* uint32_t have_data 鏄惁鏈夋暟鎹紶杈 +* uint32_t data_read 1 璇籗D鍗 0 鍐橲D鍗 +* uint16_t block_cnt 璇诲啓鍧椾釜鏁 +* uint32_t use_dma 1 浣跨敤DMA鎼繍鏁版嵁 +* 杈 鍑: uint32_t SD_RES_OK 鎿嶄綔鎴愬姛 SD_RES_ERR 鎿嶄綔澶辫触 SD_RES_TIMEOUT 鎿嶄綔瓒呮椂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ -uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t _resp_type, uint32_t *resp_data, uint32_t have_data, uint32_t data_read, uint16_t block_cnt, uint32_t use_dma) +uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t resp_type, uint32_t *resp_data, uint32_t have_data, uint32_t data_read, uint16_t block_cnt, uint32_t use_dma) { SDIO->BLK &= ~SDIO_BLK_COUNT_Msk; SDIO->BLK |= (block_cnt << SDIO_BLK_COUNT_Pos); @@ -341,7 +341,7 @@ uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t _resp_type, uint32_t (0 << SDIO_CMD_CMDTYPE_Pos) | (0 << SDIO_CMD_IDXCHECK_Pos) | (0 << SDIO_CMD_CRCCHECK_Pos) | - (_resp_type << SDIO_CMD_RESPTYPE_Pos) | + (resp_type << SDIO_CMD_RESPTYPE_Pos) | (have_data << SDIO_CMD_HAVEDATA_Pos) | (data_read << SDIO_CMD_DIRREAD_Pos) | ((block_cnt > 1) << SDIO_CMD_MULTBLK_Pos) | @@ -366,14 +366,14 @@ uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t _resp_type, uint32_t } SDIO->IF = SDIO_IF_CMDDONE_Msk; - if(_resp_type == SD_RESP_32b) + if(resp_type == SD_RESP_32b) { resp_data[0] = SDIO->RESP[0]; } - else if(_resp_type == SD_RESP_128b) + else if(resp_type == SD_RESP_128b) { - //寄存器中将CID/CSD[127-8]依次存放在了RESP3-0[119-0],最低位的CRC被丢掉 - //读出数据时调整了顺序,将CID/CSD[127-8]存放在resp_data0-3[127-8],最低8位填充0x00 + //瀵勫瓨鍣ㄤ腑灏咰ID/CSD[127-8]渚濇瀛樻斁鍦ㄤ簡RESP3-0[119-0]锛屾渶浣庝綅鐨凜RC琚涪鎺 + //璇诲嚭鏁版嵁鏃惰皟鏁翠簡椤哄簭锛屽皢CID/CSD[127-8]瀛樻斁鍦╮esp_data0-3[127-8]锛屾渶浣8浣嶅~鍏0x00 resp_data[0] = (SDIO->RESP[3] << 8) + ((SDIO->RESP[2] >> 24) & 0xFF); resp_data[1] = (SDIO->RESP[2] << 8) + ((SDIO->RESP[1] >> 24) & 0xFF); resp_data[2] = (SDIO->RESP[1] << 8) + ((SDIO->RESP[0] >> 24) & 0xFF); @@ -538,7 +538,7 @@ void parseCSD(uint32_t CSD_Tab[4]) /*!< Byte 10 */ tmp = (uint8_t)((CSD_Tab[2] & 0x0000FF00) >> 8); - SD_cardInfo.CardCapacity = (SD_cardInfo.SD_csd.DeviceSize + 1) * 512 * 1024; + SD_cardInfo.CardCapacity = (uint64_t)(SD_cardInfo.SD_csd.DeviceSize + 1) * 512 * 1024; SD_cardInfo.CardBlockSize = 512; } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.h index ece2711ce4..52552eed99 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdio.h @@ -35,10 +35,10 @@ #define SD_CMD_SDIO_RW_EXTENDED ((uint8_t)53) -#define SD_RESP_NO 0 //0 无响应 -#define SD_RESP_32b 2 //2 32位响应 -#define SD_RESP_128b 1 //1 128位响应 -#define SD_RESP_32b_busy 3 //3 32位响应,check Busy after response +#define SD_RESP_NO 0 //0 鏃犲搷搴 +#define SD_RESP_32b 2 //2 32浣嶅搷搴 +#define SD_RESP_128b 1 //1 128浣嶅搷搴 +#define SD_RESP_32b_busy 3 //3 32浣嶅搷搴旓紝check Busy after response #define SD_BUSWIDTH_1b 0 #define SD_BUSWIDTH_4b 2 @@ -133,11 +133,11 @@ uint32_t SDIO_MultiBlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t b uint32_t SDIO_DMABlockWrite(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]); uint32_t SDIO_DMABlockRead(uint32_t block_addr, uint16_t block_cnt, uint32_t buff[]); -uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t _resp_type, uint32_t *resp_data, uint32_t have_data, uint32_t data_read, uint16_t block_cnt, uint32_t use_dma); +uint32_t _SDIO_SendCmd(uint32_t cmd, uint32_t arg, uint32_t resp_type, uint32_t *resp_data, uint32_t have_data, uint32_t data_read, uint16_t block_cnt, uint32_t use_dma); -#define SDIO_SendCmd(cmd, arg, _resp_type, resp_data) _SDIO_SendCmd(cmd, arg, _resp_type, resp_data, 0, 0, 0, 0) -#define SDIO_SendCmdWithData(cmd, arg, _resp_type, resp_data, data_read, block_cnt) _SDIO_SendCmd(cmd, arg, _resp_type, resp_data, 1, data_read, block_cnt, 0) -#define SDIO_SendCmdWithDataByDMA(cmd, arg, _resp_type, resp_data, data_read, block_cnt) _SDIO_SendCmd(cmd, arg, _resp_type, resp_data, 1, data_read, block_cnt, 1) +#define SDIO_SendCmd(cmd, arg, resp_type, resp_data) _SDIO_SendCmd(cmd, arg, resp_type, resp_data, 0, 0, 0, 0) +#define SDIO_SendCmdWithData(cmd, arg, resp_type, resp_data, data_read, block_cnt) _SDIO_SendCmd(cmd, arg, resp_type, resp_data, 1, data_read, block_cnt, 0) +#define SDIO_SendCmdWithDataByDMA(cmd, arg, resp_type, resp_data, data_read, block_cnt) _SDIO_SendCmd(cmd, arg, resp_type, resp_data, 1, data_read, block_cnt, 1) void parseCID(uint32_t CID_Tab[4]); void parseCSD(uint32_t CID_Tab[4]); diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.c index 246f572eeb..e1075564cb 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_sdram.c -* 功能说明: SWM320单片机的SDRAM驱动程序 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_sdram.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑SDRAM椹卞姩绋嬪簭 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -22,11 +22,11 @@ #include "SWM320_sdram.h" /****************************************************************************************************************************************** -* 函数名称: SDRAM_Init() -* 功能说明: SDRAM控制器初始化 -* 输 入: SDRAM_InitStructure * initStruct 包含 SDRAM 控制器相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDRAM_Init() +* 鍔熻兘璇存槑: SDRAM鎺у埗鍣ㄥ垵濮嬪寲 +* 杈 鍏: SDRAM_InitStructure * initStruct 鍖呭惈 SDRAM 鎺у埗鍣ㄧ浉鍏宠瀹氬肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SDRAM_Init(SDRAM_InitStructure * initStruct) { @@ -35,9 +35,9 @@ void SDRAM_Init(SDRAM_InitStructure * initStruct) SYS->CLKEN |= (1 << SYS_CLKEN_SDRAM_Pos); SYS->CLKDIV &= ~SYS_CLKDIV_SDRAM_Msk; - SYS->CLKDIV |= (1 << SYS_CLKDIV_SDRAM_Pos); //2分频 + SYS->CLKDIV |= (1 << SYS_CLKDIV_SDRAM_Pos); //2鍒嗛 - SDRAMC->CR0 = (2 << SDRAMC_CR0_BURSTLEN_Pos) | //2 Burst Length为4 + SDRAMC->CR0 = (2 << SDRAMC_CR0_BURSTLEN_Pos) | //2 Burst Length涓4 (initStruct->CASLatency << SDRAMC_CR0_CASDELAY_Pos); SDRAMC->CR1 = (initStruct->CellSize << SDRAMC_CR1_CELLSIZE_Pos) | @@ -69,11 +69,11 @@ void SDRAM_Init(SDRAM_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: SDRAM_Enable() -* 功能说明: SDRAM使能,使能后可读写SDRAM -* 输 入: 无 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDRAM_Enable() +* 鍔熻兘璇存槑: SDRAM浣胯兘锛屼娇鑳藉悗鍙鍐橲DRAM +* 杈 鍏: 鏃 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SDRAM_Enable(void) { @@ -86,11 +86,11 @@ void SDRAM_Enable(void) } /****************************************************************************************************************************************** -* 函数名称: SDRAM_Disable() -* 功能说明: SDRAM禁能,禁能后SDRAM颗粒进入低功耗模式、并自刷新,不可读写 -* 输 入: 无 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SDRAM_Disable() +* 鍔熻兘璇存槑: SDRAM绂佽兘锛岀鑳藉悗SDRAM棰楃矑杩涘叆浣庡姛鑰楁ā寮忋佸苟鑷埛鏂帮紝涓嶅彲璇诲啓 +* 杈 鍏: 鏃 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SDRAM_Disable(void) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.h index 5659b3e330..d6f6761226 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.h @@ -2,17 +2,17 @@ #define __SWM320_SDRAM_H__ typedef struct { - uint8_t CellSize; // SDRAM颗粒的容量,SDRAM_CELLSIZE_16Mb、SDRAM_CELLSIZE_64Mb、SDRAM_CELLSIZE_128Mb、SDRAM_CELLSIZE_256Mb - uint8_t CellBank; // SDRAM颗粒有几个bank,SDRAM_CELLBANK_2、SDRAM_CELLBANK_4 - uint8_t CellWidth; // SDRAM颗粒的位宽,SDRAM_CELLWIDTH_16、SDRAM_CELLWIDTH_32 - uint8_t CASLatency; // 列地址到有效数据输出间隔,SDRAM_CASLATENCY_2、SDRAM_CASLATENCY_3 + uint8_t CellSize; // SDRAM棰楃矑鐨勫閲忥紝SDRAM_CELLSIZE_16Mb銆丼DRAM_CELLSIZE_64Mb銆丼DRAM_CELLSIZE_128Mb銆丼DRAM_CELLSIZE_256Mb + uint8_t CellBank; // SDRAM棰楃矑鏈夊嚑涓猙ank锛孲DRAM_CELLBANK_2銆丼DRAM_CELLBANK_4 + uint8_t CellWidth; // SDRAM棰楃矑鐨勪綅瀹斤紝SDRAM_CELLWIDTH_16銆丼DRAM_CELLWIDTH_32 + uint8_t CASLatency; // 鍒楀湴鍧鍒版湁鏁堟暟鎹緭鍑洪棿闅旓紝SDRAM_CASLATENCY_2銆丼DRAM_CASLATENCY_3 uint8_t TimeTMRD; // MRS to New Command uint8_t TimeTRRD; // Activate to activate on different banks - uint8_t TimeTRAS; // Self refresh time,最小Self-refresh周期 - uint8_t TimeTRC; // Row cycle delay,Refresh命令到Activate命令间延时,也是两个连续Refresh命令间延时 - uint8_t TimeTRCD; // Row to column delay,行地址到列地址间延时,也即Activate命令到读写命令间延时 - uint8_t TimeTRP; // Row precharge delay,Precharge命令到另一个命令间延时 + uint8_t TimeTRAS; // Self refresh time锛屾渶灏廠elf-refresh鍛ㄦ湡 + uint8_t TimeTRC; // Row cycle delay锛孯efresh鍛戒护鍒癆ctivate鍛戒护闂村欢鏃讹紝涔熸槸涓や釜杩炵画Refresh鍛戒护闂村欢鏃 + uint8_t TimeTRCD; // Row to column delay锛岃鍦板潃鍒板垪鍦板潃闂村欢鏃讹紝涔熷嵆Activate鍛戒护鍒拌鍐欏懡浠ら棿寤舵椂 + uint8_t TimeTRP; // Row precharge delay锛孭recharge鍛戒护鍒板彟涓涓懡浠ら棿寤舵椂 } SDRAM_InitStructure; #define SDRAM_CELLSIZE_16Mb 3 diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.c index fb38187a3f..dcd618ec92 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_spi.c -* 功能说明: SWM320单片机的SPI功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_spi.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑SPI鍔熻兘椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,12 +23,12 @@ /****************************************************************************************************************************************** -* 函数名称: SPI_Init() -* 功能说明: SPI同步串行接口初始化,包括帧长度设定、时序设定、速度设定、中断设定、FIFO触发设定 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* SPI_InitStructure * initStruct 包含SPI相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_Init() +* 鍔熻兘璇存槑: SPI鍚屾涓茶鎺ュ彛鍒濆鍖栵紝鍖呮嫭甯ч暱搴﹁瀹氥佹椂搴忚瀹氥侀熷害璁惧畾銆佷腑鏂瀹氥丗IFO瑙﹀彂璁惧畾 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* SPI_InitStructure * initStruct 鍖呭惈SPI鐩稿叧璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct) { @@ -39,11 +39,11 @@ void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct) break; case ((uint32_t)SPI1): - SYS->CLKEN |= (0x01 << SYS_CLKEN_SPI0_Pos); //与SPI0使用同一位时钟使能 + SYS->CLKEN |= (0x01 << SYS_CLKEN_SPI0_Pos); //涓嶴PI0浣跨敤鍚屼竴浣嶆椂閽熶娇鑳 break; } - SPI_Close(SPIx); //一些关键寄存器只能在SPI关闭时设置 + SPI_Close(SPIx); //涓浜涘叧閿瘎瀛樺櫒鍙兘鍦⊿PI鍏抽棴鏃惰缃 SPIx->CTRL &= ~(SPI_CTRL_FFS_Msk | SPI_CTRL_CPHA_Msk | SPI_CTRL_CPOL_Msk | SPI_CTRL_SIZE_Msk | SPI_CTRL_MSTR_Msk | SPI_CTRL_CLKDIV_Msk | SPI_CTRL_SSN_H_Msk); @@ -55,7 +55,7 @@ void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct) (initStruct->clkDiv << SPI_CTRL_CLKDIV_Pos) | (0 << SPI_CTRL_SSN_H_Pos); - SPIx->IF = (0x01 << SPI_IF_RFOVF_Pos); //清除中断标志 + SPIx->IF = (0x01 << SPI_IF_RFOVF_Pos); //娓呴櫎涓柇鏍囧織 SPIx->IE &= ~(SPI_IE_RFHF_Msk | SPI_IE_TFHF_Msk | SPI_IE_FTC_Msk); SPIx->IE |= (initStruct->RXHFullIEn << SPI_IE_RFHF_Pos) | (initStruct->TXEmptyIEn << SPI_IE_TFHF_Pos) | @@ -88,11 +88,11 @@ void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: SPI_Open() -* 功能说明: SPI打开,允许收发 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_Open() +* 鍔熻兘璇存槑: SPI鎵撳紑锛屽厑璁告敹鍙 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_Open(SPI_TypeDef * SPIx) { @@ -100,11 +100,11 @@ void SPI_Open(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_Close() -* 功能说明: SPI关闭,禁止收发 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_Close() +* 鍔熻兘璇存槑: SPI鍏抽棴锛岀姝㈡敹鍙 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_Close(SPI_TypeDef * SPIx) { @@ -112,11 +112,11 @@ void SPI_Close(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_Read() -* 功能说明: 读取一个数据 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 读取到的数据 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_Read() +* 鍔熻兘璇存槑: 璇诲彇涓涓暟鎹 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 璇诲彇鍒扮殑鏁版嵁 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_Read(SPI_TypeDef * SPIx) { @@ -124,12 +124,12 @@ uint32_t SPI_Read(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_Write() -* 功能说明: 写入一个数据 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* uint32_t 要写入的数据 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_Write() +* 鍔熻兘璇存槑: 鍐欏叆涓涓暟鎹 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* uint32_t 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_Write(SPI_TypeDef * SPIx, uint32_t data) { @@ -137,12 +137,12 @@ void SPI_Write(SPI_TypeDef * SPIx, uint32_t data) } /****************************************************************************************************************************************** -* 函数名称: SPI_WriteWithWait() -* 功能说明: 写入一个数据并等待数据完全发送出去 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1、SPI1 -* uint32_t 要写入的数据 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_WriteWithWait() +* 鍔熻兘璇存槑: 鍐欏叆涓涓暟鎹苟绛夊緟鏁版嵁瀹屽叏鍙戦佸嚭鍘 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1銆丼PI1 +* uint32_t 瑕佸啓鍏ョ殑鏁版嵁 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_WriteWithWait(SPI_TypeDef * SPIx, uint32_t data) { @@ -154,12 +154,12 @@ void SPI_WriteWithWait(SPI_TypeDef * SPIx, uint32_t data) } /****************************************************************************************************************************************** -* 函数名称: SPI_ReadWrite() -* 功能说明: 发送一个数据,并返回发送过程中接收到的 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* uint32_t data 要发送的数据 -* 输 出: uint32_t 接收到的数据 -* 注意事项: 对于同一个SPI模块,此函数不应与SPI_Write()混着用,因为SPI_Write()不清除SPI_STAT_RFNE状态 +* 鍑芥暟鍚嶇О: SPI_ReadWrite() +* 鍔熻兘璇存槑: 鍙戦佷竴涓暟鎹紝骞惰繑鍥炲彂閫佽繃绋嬩腑鎺ユ敹鍒扮殑 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* uint32_t data 瑕佸彂閫佺殑鏁版嵁 +* 杈 鍑: uint32_t 鎺ユ敹鍒扮殑鏁版嵁 +* 娉ㄦ剰浜嬮」: 瀵逛簬鍚屼竴涓猄PI妯″潡锛屾鍑芥暟涓嶅簲涓嶴PI_Write()娣风潃鐢紝鍥犱负SPI_Write()涓嶆竻闄PI_STAT_RFNE鐘舵 ******************************************************************************************************************************************/ uint32_t SPI_ReadWrite(SPI_TypeDef * SPIx, uint32_t data) { @@ -170,11 +170,11 @@ uint32_t SPI_ReadWrite(SPI_TypeDef * SPIx, uint32_t data) } /****************************************************************************************************************************************** -* 函数名称: SPI_IsRXEmpty() -* 功能说明: 接收FIFO是否空,如果不空则可以继续SPI_Read() -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 接收FIFO空 0 接收FIFO非空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_IsRXEmpty() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鏄惁绌猴紝濡傛灉涓嶇┖鍒欏彲浠ョ户缁璖PI_Read() +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鎺ユ敹FIFO绌 0 鎺ユ敹FIFO闈炵┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_IsRXEmpty(SPI_TypeDef * SPIx) { @@ -182,11 +182,11 @@ uint32_t SPI_IsRXEmpty(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_IsTXFull() -* 功能说明: 发送FIFO是否满,如果不满则可以继续SPI_Write() -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送FIFO满 0 发送FIFO不满 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_IsTXFull() +* 鍔熻兘璇存槑: 鍙戦丗IFO鏄惁婊★紝濡傛灉涓嶆弧鍒欏彲浠ョ户缁璖PI_Write() +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦丗IFO婊 0 鍙戦丗IFO涓嶆弧 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_IsTXFull(SPI_TypeDef * SPIx) { @@ -194,11 +194,11 @@ uint32_t SPI_IsTXFull(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_IsTXEmpty() -* 功能说明: 发送FIFO是否空 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送FIFO空 0 发送FIFO非空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_IsTXEmpty() +* 鍔熻兘璇存槑: 鍙戦丗IFO鏄惁绌 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦丗IFO绌 0 鍙戦丗IFO闈炵┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_IsTXEmpty(SPI_TypeDef * SPIx) { @@ -207,11 +207,11 @@ uint32_t SPI_IsTXEmpty(SPI_TypeDef * SPIx) /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXHalfFullEn() -* 功能说明: 接收FIFO半满中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXHalfFullEn() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鍗婃弧涓柇浣胯兘 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXHalfFullEn(SPI_TypeDef * SPIx) { @@ -219,11 +219,11 @@ void SPI_INTRXHalfFullEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXHalfFullDis() -* 功能说明: 接收FIFO半满中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXHalfFullDis() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鍗婃弧涓柇绂佹 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXHalfFullDis(SPI_TypeDef * SPIx) { @@ -231,11 +231,11 @@ void SPI_INTRXHalfFullDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXHalfFullClr() -* 功能说明: 接收FIFO半满中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXHalfFullClr() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鍗婃弧涓柇鏍囧織娓呴櫎 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXHalfFullClr(SPI_TypeDef * SPIx) { @@ -243,11 +243,11 @@ void SPI_INTRXHalfFullClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXHalfFullStat() -* 功能说明: 接收FIFO半满中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 接收FIFO达到半满 0 接收FIFO未达到半满 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXHalfFullStat() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鍗婃弧涓柇鐘舵 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鎺ユ敹FIFO杈惧埌鍗婃弧 0 鎺ユ敹FIFO鏈揪鍒板崐婊 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTRXHalfFullStat(SPI_TypeDef * SPIx) { @@ -255,11 +255,11 @@ uint32_t SPI_INTRXHalfFullStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXFullEn() -* 功能说明: 接收FIFO满中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXFullEn() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婊′腑鏂娇鑳 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXFullEn(SPI_TypeDef * SPIx) { @@ -267,11 +267,11 @@ void SPI_INTRXFullEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXFullDis() -* 功能说明: 接收FIFO满中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXFullDis() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婊′腑鏂姝 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXFullDis(SPI_TypeDef * SPIx) { @@ -279,11 +279,11 @@ void SPI_INTRXFullDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXFullClr() -* 功能说明: 接收FIFO满中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXFullClr() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婊′腑鏂爣蹇楁竻闄 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXFullClr(SPI_TypeDef * SPIx) { @@ -291,11 +291,11 @@ void SPI_INTRXFullClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXFullStat() -* 功能说明: 接收FIFO满中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 接收FIFO满 0 接收FIFO未满 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXFullStat() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婊′腑鏂姸鎬 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鎺ユ敹FIFO婊 0 鎺ユ敹FIFO鏈弧 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTRXFullStat(SPI_TypeDef * SPIx) { @@ -303,11 +303,11 @@ uint32_t SPI_INTRXFullStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXOverflowEn() -* 功能说明: 接收FIFO溢出中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXOverflowEn() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婧㈠嚭涓柇浣胯兘 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXOverflowEn(SPI_TypeDef * SPIx) { @@ -315,11 +315,11 @@ void SPI_INTRXOverflowEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXOverflowDis() -* 功能说明: 接收FIFO溢出中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXOverflowDis() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婧㈠嚭涓柇绂佹 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXOverflowDis(SPI_TypeDef * SPIx) { @@ -327,11 +327,11 @@ void SPI_INTRXOverflowDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXOverflowClr() -* 功能说明: 接收FIFO溢出中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXOverflowClr() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婧㈠嚭涓柇鏍囧織娓呴櫎 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTRXOverflowClr(SPI_TypeDef * SPIx) { @@ -339,11 +339,11 @@ void SPI_INTRXOverflowClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTRXOverflowStat() -* 功能说明: 接收FIFO溢出中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 接收FIFO溢出 0 接收FIFO未溢出 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTRXOverflowStat() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO婧㈠嚭涓柇鐘舵 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鎺ユ敹FIFO婧㈠嚭 0 鎺ユ敹FIFO鏈孩鍑 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTRXOverflowStat(SPI_TypeDef * SPIx) { @@ -351,11 +351,11 @@ uint32_t SPI_INTRXOverflowStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXHalfFullEn() -* 功能说明: 发送FIFO半满中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXHalfFullEn() +* 鍔熻兘璇存槑: 鍙戦丗IFO鍗婃弧涓柇浣胯兘 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXHalfFullEn(SPI_TypeDef * SPIx) { @@ -363,11 +363,11 @@ void SPI_INTTXHalfFullEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXHalfFullDis() -* 功能说明: 发送FIFO半满中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXHalfFullDis() +* 鍔熻兘璇存槑: 鍙戦丗IFO鍗婃弧涓柇绂佹 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXHalfFullDis(SPI_TypeDef * SPIx) { @@ -375,11 +375,11 @@ void SPI_INTTXHalfFullDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXHalfFullClr() -* 功能说明: 发送FIFO半满中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXHalfFullClr() +* 鍔熻兘璇存槑: 鍙戦丗IFO鍗婃弧涓柇鏍囧織娓呴櫎 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXHalfFullClr(SPI_TypeDef * SPIx) { @@ -387,11 +387,11 @@ void SPI_INTTXHalfFullClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXHalfFullStat() -* 功能说明: 发送FIFO半满中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送FIFO达到半满 0 发送FIFO未达到半满 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXHalfFullStat() +* 鍔熻兘璇存槑: 鍙戦丗IFO鍗婃弧涓柇鐘舵 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦丗IFO杈惧埌鍗婃弧 0 鍙戦丗IFO鏈揪鍒板崐婊 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTTXHalfFullStat(SPI_TypeDef * SPIx) { @@ -399,11 +399,11 @@ uint32_t SPI_INTTXHalfFullStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXEmptyEn() -* 功能说明: 发送FIFO空中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXEmptyEn() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰腑鏂娇鑳 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXEmptyEn(SPI_TypeDef * SPIx) { @@ -411,11 +411,11 @@ void SPI_INTTXEmptyEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXEmptyDis() -* 功能说明: 发送FIFO空中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXEmptyDis() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰腑鏂姝 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXEmptyDis(SPI_TypeDef * SPIx) { @@ -423,11 +423,11 @@ void SPI_INTTXEmptyDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXEmptyClr() -* 功能说明: 发送FIFO空中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXEmptyClr() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰腑鏂爣蹇楁竻闄 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXEmptyClr(SPI_TypeDef * SPIx) { @@ -435,11 +435,11 @@ void SPI_INTTXEmptyClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXEmptyStat() -* 功能说明: 发送FIFO空中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送FIFO空 0 发送FIFO非空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXEmptyStat() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰腑鏂姸鎬 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦丗IFO绌 0 鍙戦丗IFO闈炵┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTTXEmptyStat(SPI_TypeDef * SPIx) { @@ -447,11 +447,11 @@ uint32_t SPI_INTTXEmptyStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXCompleteEn() -* 功能说明: 发送FIFO空且发送移位寄存器空中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXCompleteEn() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂娇鑳 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXCompleteEn(SPI_TypeDef * SPIx) { @@ -459,11 +459,11 @@ void SPI_INTTXCompleteEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXCompleteDis() -* 功能说明: 发送FIFO空且发送移位寄存器空中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXCompleteDis() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂姝 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXCompleteDis(SPI_TypeDef * SPIx) { @@ -471,11 +471,11 @@ void SPI_INTTXCompleteDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXCompleteClr() -* 功能说明: 发送FIFO空且发送移位寄存器空中断状态清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXCompleteClr() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂姸鎬佹竻闄 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXCompleteClr(SPI_TypeDef * SPIx) { @@ -483,11 +483,11 @@ void SPI_INTTXCompleteClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXCompleteStat() -* 功能说明: 发送FIFO空且发送移位寄存器空中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送FIFO空且发送移位寄存器空 0 发送FIFO或发送移位寄存器非空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXCompleteStat() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂姸鎬 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌 0 鍙戦丗IFO鎴栧彂閫佺Щ浣嶅瘎瀛樺櫒闈炵┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTTXCompleteStat(SPI_TypeDef * SPIx) { @@ -495,11 +495,11 @@ uint32_t SPI_INTTXCompleteStat(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXWordCompleteEn() -* 功能说明: 发送FIFO字发送完成中断使能 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXWordCompleteEn() +* 鍔熻兘璇存槑: 鍙戦丗IFO瀛楀彂閫佸畬鎴愪腑鏂娇鑳 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXWordCompleteEn(SPI_TypeDef * SPIx) { @@ -507,11 +507,11 @@ void SPI_INTTXWordCompleteEn(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXWordCompleteDis() -* 功能说明: 发送FIFO字发送完成中断禁止 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXWordCompleteDis() +* 鍔熻兘璇存槑: 鍙戦丗IFO瀛楀彂閫佸畬鎴愪腑鏂姝 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXWordCompleteDis(SPI_TypeDef * SPIx) { @@ -519,11 +519,11 @@ void SPI_INTTXWordCompleteDis(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXWordCompleteClr() -* 功能说明: 发送FIFO字发送完成中断标志清除 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXWordCompleteClr() +* 鍔熻兘璇存槑: 鍙戦丗IFO瀛楀彂閫佸畬鎴愪腑鏂爣蹇楁竻闄 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SPI_INTTXWordCompleteClr(SPI_TypeDef * SPIx) { @@ -531,11 +531,11 @@ void SPI_INTTXWordCompleteClr(SPI_TypeDef * SPIx) } /****************************************************************************************************************************************** -* 函数名称: SPI_INTTXWordCompleteStat() -* 功能说明: 发送FIFO字发送完成中断状态 -* 输 入: SPI_TypeDef * SPIx 指定要被设置的SPI,有效值包括SPI0、SPI1 -* 输 出: uint32_t 1 发送完成中断已发生 0 发送完成中断未发生 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SPI_INTTXWordCompleteStat() +* 鍔熻兘璇存槑: 鍙戦丗IFO瀛楀彂閫佸畬鎴愪腑鏂姸鎬 +* 杈 鍏: SPI_TypeDef * SPIx 鎸囧畾瑕佽璁剧疆鐨凷PI锛屾湁鏁堝煎寘鎷琒PI0銆丼PI1 +* 杈 鍑: uint32_t 1 鍙戦佸畬鎴愪腑鏂凡鍙戠敓 0 鍙戦佸畬鎴愪腑鏂湭鍙戠敓 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t SPI_INTTXWordCompleteStat(SPI_TypeDef * SPIx) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.h index 42c4d0cb70..a7725ee24e 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_spi.h @@ -2,26 +2,26 @@ #define __SWM320_SPI_H__ typedef struct { - uint8_t FrameFormat; //帧格式:SPI_FORMAT_SPI、SPI_FORMAT_TI_SSI - uint8_t SampleEdge; //在SPI帧格式下,选择数据采样边沿:SPI_FIRST_EDGE、SPI_SECOND_EDGE - uint8_t IdleLevel; //在SPI帧格式下,选择空闲时(无数据传输时)时钟线的电平:SPI_LOW_LEVEL、SPI_HIGH_LEVEL - uint8_t WordSize; //字长度, 有效值4-16 - uint8_t Master; //1 主机模式 0 从机模式 - uint8_t clkDiv; //SPI_CLK = SYS_CLK / clkDiv,有效值:SPI_CLKDIV_4、SPI_CLKDIV_8、... ... 、SPI_CLKDIV_512 + uint8_t FrameFormat; //甯ф牸寮忥細SPI_FORMAT_SPI銆丼PI_FORMAT_TI_SSI + uint8_t SampleEdge; //鍦⊿PI甯ф牸寮忎笅锛岄夋嫨鏁版嵁閲囨牱杈规部锛歋PI_FIRST_EDGE銆丼PI_SECOND_EDGE + uint8_t IdleLevel; //鍦⊿PI甯ф牸寮忎笅锛岄夋嫨绌洪棽鏃讹紙鏃犳暟鎹紶杈撴椂锛夋椂閽熺嚎鐨勭數骞筹細SPI_LOW_LEVEL銆丼PI_HIGH_LEVEL + uint8_t WordSize; //瀛楅暱搴, 鏈夋晥鍊4-16 + uint8_t Master; //1 涓绘満妯″紡 0 浠庢満妯″紡 + uint8_t clkDiv; //SPI_CLK = SYS_CLK / clkDiv锛屾湁鏁堝硷細SPI_CLKDIV_4銆丼PI_CLKDIV_8銆... ... 銆丼PI_CLKDIV_512 - uint8_t RXHFullIEn; //接收FIFO半满中断使能 - uint8_t TXEmptyIEn; //发送FIFO 空中断使能 - uint8_t TXCompleteIEn; //发送FIFO 空且发送移位寄存器空中断使能 + uint8_t RXHFullIEn; //鎺ユ敹FIFO鍗婃弧涓柇浣胯兘 + uint8_t TXEmptyIEn; //鍙戦丗IFO 绌轰腑鏂娇鑳 + uint8_t TXCompleteIEn; //鍙戦丗IFO 绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂娇鑳 } SPI_InitStructure; -#define SPI_FORMAT_SPI 0 //Motorola SPI 格式 -#define SPI_FORMAT_TI_SSI 1 //TI SSI 格式 +#define SPI_FORMAT_SPI 0 //Motorola SPI 鏍煎紡 +#define SPI_FORMAT_TI_SSI 1 //TI SSI 鏍煎紡 -#define SPI_FIRST_EDGE 0 //第一个时钟沿开始采样 -#define SPI_SECOND_EDGE 1 //第二个时钟沿开始采样 +#define SPI_FIRST_EDGE 0 //绗竴涓椂閽熸部寮濮嬮噰鏍 +#define SPI_SECOND_EDGE 1 //绗簩涓椂閽熸部寮濮嬮噰鏍 -#define SPI_LOW_LEVEL 0 //空闲时时钟线保持低电平 -#define SPI_HIGH_LEVEL 1 //空闲时时钟线保持高电平 +#define SPI_LOW_LEVEL 0 //绌洪棽鏃舵椂閽熺嚎淇濇寔浣庣數骞 +#define SPI_HIGH_LEVEL 1 //绌洪棽鏃舵椂閽熺嚎淇濇寔楂樼數骞 #define SPI_CLKDIV_4 0 #define SPI_CLKDIV_8 1 @@ -34,18 +34,18 @@ typedef struct { -void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct); //SPI初始化 -void SPI_Open(SPI_TypeDef * SPIx); //SPI打开,允许收发 -void SPI_Close(SPI_TypeDef * SPIx); //SPI关闭,禁止收发 +void SPI_Init(SPI_TypeDef * SPIx, SPI_InitStructure * initStruct); //SPI鍒濆鍖 +void SPI_Open(SPI_TypeDef * SPIx); //SPI鎵撳紑锛屽厑璁告敹鍙 +void SPI_Close(SPI_TypeDef * SPIx); //SPI鍏抽棴锛岀姝㈡敹鍙 uint32_t SPI_Read(SPI_TypeDef * SPIx); void SPI_Write(SPI_TypeDef * SPIx, uint32_t data); void SPI_WriteWithWait(SPI_TypeDef * SPIx, uint32_t data); uint32_t SPI_ReadWrite(SPI_TypeDef * SPIx, uint32_t data); -uint32_t SPI_IsRXEmpty(SPI_TypeDef * SPIx); //接收FIFO是否空,如果不空则可以继续SPI_Read() -uint32_t SPI_IsTXFull(SPI_TypeDef * SPIx); //发送FIFO是否满,如果不满则可以继续SPI_Write() -uint32_t SPI_IsTXEmpty(SPI_TypeDef * SPIx); //发送FIFO是否空 +uint32_t SPI_IsRXEmpty(SPI_TypeDef * SPIx); //鎺ユ敹FIFO鏄惁绌猴紝濡傛灉涓嶇┖鍒欏彲浠ョ户缁璖PI_Read() +uint32_t SPI_IsTXFull(SPI_TypeDef * SPIx); //鍙戦丗IFO鏄惁婊★紝濡傛灉涓嶆弧鍒欏彲浠ョ户缁璖PI_Write() +uint32_t SPI_IsTXEmpty(SPI_TypeDef * SPIx); //鍙戦丗IFO鏄惁绌 void SPI_INTRXHalfFullEn(SPI_TypeDef * SPIx); diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.c index d1f421aaba..62e4c84eed 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_sram.c -* 功能说明: SWM320单片机的SRAM驱动程序 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_sram.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑SRAM椹卞姩绋嬪簭 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,17 +23,17 @@ /****************************************************************************************************************************************** -* 函数名称: SRAM_Init() -* 功能说明: SRAM控制器初始化 -* 输 入: SRAM_InitStructure * initStruct 包含 SRAM 控制器相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: SRAM_Init() +* 鍔熻兘璇存槑: SRAM鎺у埗鍣ㄥ垵濮嬪寲 +* 杈 鍏: SRAM_InitStructure * initStruct 鍖呭惈 SRAM 鎺у埗鍣ㄧ浉鍏宠瀹氬肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void SRAM_Init(SRAM_InitStructure * initStruct) { uint32_t i; - // 配置SRAM前需要刷新下SDRAM控制器 + // 閰嶇疆SRAM鍓嶉渶瑕佸埛鏂颁笅SDRAM鎺у埗鍣 do { SYS->CLKEN |= (1 << SYS_CLKEN_SDRAM_Pos); @@ -49,5 +49,5 @@ void SRAM_Init(SRAM_InitStructure * initStruct) SRAMC->CR = (initStruct->ClkDiv << SRAMC_CR_RWTIME_Pos) | (initStruct->DataWidth << SRAMC_CR_BYTEIF_Pos) | - (0 << SRAMC_CR_HBLBDIS_Pos); // 使能字节、半字访问 + (0 << SRAMC_CR_HBLBDIS_Pos); // 浣胯兘瀛楄妭銆佸崐瀛楄闂 } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.h index 2ef71b24ba..799b271a99 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sram.h @@ -2,8 +2,8 @@ #define __SWM320_SRAM_H__ typedef struct { - uint8_t ClkDiv; //SRAM_CLKDIV_5...SRAM_CLKDIV_16,根据SRAM芯片所能跑的最高频率选择合适分频 - uint8_t DataWidth; //SRAM_DATAWIDTH_8、SRAM_DATAWIDTH_16 + uint8_t ClkDiv; //SRAM_CLKDIV_5...SRAM_CLKDIV_16锛屾牴鎹甋RAM鑺墖鎵鑳借窇鐨勬渶楂橀鐜囬夋嫨鍚堥傚垎棰 + uint8_t DataWidth; //SRAM_DATAWIDTH_8銆丼RAM_DATAWIDTH_16 } SRAM_InitStructure; diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.c index d4cbe03238..b67711a49a 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_timr.c -* 功能说明: SWM320单片机的计数器/定时器功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_timr.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑璁℃暟鍣/瀹氭椂鍣ㄥ姛鑳介┍鍔ㄥ簱 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,20 +23,20 @@ /****************************************************************************************************************************************** -* 函数名称: TIMR_Init() -* 功能说明: TIMR定时器/计数器初始化 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,有效值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* uint32_t mode TIMR_MODE_TIMER 定时器模式 TIMR_MODE_COUNTER 计数器模式 -* uint32_t period 定时/计数周期 -* uint32_t int_en 中断使能 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_Init() +* 鍔熻兘璇存槑: TIMR瀹氭椂鍣/璁℃暟鍣ㄥ垵濮嬪寲 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屾湁鏁堝煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* uint32_t mode TIMR_MODE_TIMER 瀹氭椂鍣ㄦā寮 TIMR_MODE_COUNTER 璁℃暟鍣ㄦā寮 +* uint32_t period 瀹氭椂/璁℃暟鍛ㄦ湡 +* uint32_t int_en 涓柇浣胯兘 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t int_en) { SYS->CLKEN |= (0x01 << SYS_CLKEN_TIMR_Pos); - TIMR_Stop(TIMRx); //一些关键寄存器只能在定时器停止时设置 + TIMR_Stop(TIMRx); //涓浜涘叧閿瘎瀛樺櫒鍙兘鍦ㄥ畾鏃跺櫒鍋滄鏃惰缃 TIMRx->CTRL &= ~TIMR_CTRL_CLKSRC_Msk; TIMRx->CTRL |= mode << TIMR_CTRL_CLKSRC_Pos; @@ -46,7 +46,7 @@ void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t in switch((uint32_t)TIMRx) { case ((uint32_t)TIMR0): - TIMRG->IF = (1 << TIMRG_IF_TIMR0_Pos); //使能中断前清除中断标志 + TIMRG->IF = (1 << TIMRG_IF_TIMR0_Pos); //浣胯兘涓柇鍓嶆竻闄や腑鏂爣蹇 TIMRG->IE &= ~TIMRG_IE_TIMR0_Msk; TIMRG->IE |= (int_en << TIMRG_IE_TIMR0_Pos); @@ -96,11 +96,11 @@ void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t in } /****************************************************************************************************************************************** -* 函数名称: TIMR_Start() -* 功能说明: 启动定时器,从初始值开始计时/计数 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_Start() +* 鍔熻兘璇存槑: 鍚姩瀹氭椂鍣紝浠庡垵濮嬪煎紑濮嬭鏃/璁℃暟 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_Start(TIMR_TypeDef * TIMRx) { @@ -108,11 +108,11 @@ void TIMR_Start(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_Stop() -* 功能说明: 停止定时器 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_Stop() +* 鍔熻兘璇存槑: 鍋滄瀹氭椂鍣 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_Stop(TIMR_TypeDef * TIMRx) { @@ -120,11 +120,11 @@ void TIMR_Stop(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_Halt() -* 功能说明: 暂停定时器,计数值保持不变 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_Halt() +* 鍔熻兘璇存槑: 鏆傚仠瀹氭椂鍣紝璁℃暟鍊间繚鎸佷笉鍙 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_Halt(TIMR_TypeDef * TIMRx) { @@ -157,11 +157,11 @@ void TIMR_Halt(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_Resume() -* 功能说明: 恢复定时器,从暂停处继续计数 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_Resume() +* 鍔熻兘璇存槑: 鎭㈠瀹氭椂鍣紝浠庢殏鍋滃缁х画璁℃暟 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_Resume(TIMR_TypeDef * TIMRx) { @@ -194,12 +194,12 @@ void TIMR_Resume(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_SetPeriod() -* 功能说明: 设置定时/计数周期 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* uint32_t period 定时/计数周期 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_SetPeriod() +* 鍔熻兘璇存槑: 璁剧疆瀹氭椂/璁℃暟鍛ㄦ湡 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* uint32_t period 瀹氭椂/璁℃暟鍛ㄦ湡 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_SetPeriod(TIMR_TypeDef * TIMRx, uint32_t period) { @@ -207,11 +207,11 @@ void TIMR_SetPeriod(TIMR_TypeDef * TIMRx, uint32_t period) } /****************************************************************************************************************************************** -* 函数名称: TIMR_GetPeriod() -* 功能说明: 获取定时/计数周期 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: uint32_t 当前定时/计数周期 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_GetPeriod() +* 鍔熻兘璇存槑: 鑾峰彇瀹氭椂/璁℃暟鍛ㄦ湡 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: uint32_t 褰撳墠瀹氭椂/璁℃暟鍛ㄦ湡 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t TIMR_GetPeriod(TIMR_TypeDef * TIMRx) { @@ -219,11 +219,11 @@ uint32_t TIMR_GetPeriod(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_GetCurValue() -* 功能说明: 获取当前计数值 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: uint32_t 当前计数值 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_GetCurValue() +* 鍔熻兘璇存槑: 鑾峰彇褰撳墠璁℃暟鍊 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: uint32_t 褰撳墠璁℃暟鍊 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t TIMR_GetCurValue(TIMR_TypeDef * TIMRx) { @@ -231,11 +231,11 @@ uint32_t TIMR_GetCurValue(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_INTEn() -* 功能说明: 使能中断 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_INTEn() +* 鍔熻兘璇存槑: 浣胯兘涓柇 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_INTEn(TIMR_TypeDef * TIMRx) { @@ -274,11 +274,11 @@ void TIMR_INTEn(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_INTDis() -* 功能说明: 禁能中断 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_INTDis() +* 鍔熻兘璇存槑: 绂佽兘涓柇 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_INTDis(TIMR_TypeDef * TIMRx) { @@ -311,11 +311,11 @@ void TIMR_INTDis(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_INTClr() -* 功能说明: 清除中断标志 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_INTClr() +* 鍔熻兘璇存槑: 娓呴櫎涓柇鏍囧織 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void TIMR_INTClr(TIMR_TypeDef * TIMRx) { @@ -348,11 +348,11 @@ void TIMR_INTClr(TIMR_TypeDef * TIMRx) } /****************************************************************************************************************************************** -* 函数名称: TIMR_INTStat() -* 功能说明: 获取中断状态 -* 输 入: TIMR_TypeDef * TIMRx 指定要被设置的定时器,可取值包括TIMR0、TIMR1、TIMR2、TIMR3、TIMR4、TIMR5 -* 输 出: uint32_t 0 TIMRx未产生中断 1 TIMRx产生了中断 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: TIMR_INTStat() +* 鍔熻兘璇存槑: 鑾峰彇涓柇鐘舵 +* 杈 鍏: TIMR_TypeDef * TIMRx 鎸囧畾瑕佽璁剧疆鐨勫畾鏃跺櫒锛屽彲鍙栧煎寘鎷琓IMR0銆乀IMR1銆乀IMR2銆乀IMR3銆乀IMR4銆乀IMR5 +* 杈 鍑: uint32_t 0 TIMRx鏈骇鐢熶腑鏂 1 TIMRx浜х敓浜嗕腑鏂 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t TIMR_INTStat(TIMR_TypeDef * TIMRx) { @@ -382,32 +382,32 @@ uint32_t TIMR_INTStat(TIMR_TypeDef * TIMRx) /****************************************************************************************************************************************** -* 函数名称: Pulse_Init() -* 功能说明: 脉宽测量功能初始化 -* 输 入: uint32_t pulse PULSE_LOW 测量低脉冲宽度 PULSE_HIGH 测量高脉冲宽度 -* uint32_t int_en 是否使能脉冲测量完成中断 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: Pulse_Init() +* 鍔熻兘璇存槑: 鑴夊娴嬮噺鍔熻兘鍒濆鍖 +* 杈 鍏: uint32_t pulse PULSE_LOW 娴嬮噺浣庤剦鍐插搴 PULSE_HIGH 娴嬮噺楂樿剦鍐插搴 +* uint32_t int_en 鏄惁浣胯兘鑴夊啿娴嬮噺瀹屾垚涓柇 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void Pulse_Init(uint32_t pulse, uint32_t int_en) { SYS->CLKEN |= (0x01 << SYS_CLKEN_TIMR_Pos); - TIMRG->PCTRL = (0 << TIMRG_PCTRL_CLKSRC_Pos) | // 系统时钟作为时钟源 + TIMRG->PCTRL = (0 << TIMRG_PCTRL_CLKSRC_Pos) | // 绯荤粺鏃堕挓浣滀负鏃堕挓婧 (pulse << TIMRG_PCTRL_HIGH_Pos) | (0 << TIMRG_PCTRL_EN_Pos); - TIMRG->IE |= (1 << TIMRG_IE_PULSE_Pos); //使能才能查询中断标志 + TIMRG->IE |= (1 << TIMRG_IE_PULSE_Pos); //浣胯兘鎵嶈兘鏌ヨ涓柇鏍囧織 if(int_en) NVIC_EnableIRQ(PULSE_IRQn); } /****************************************************************************************************************************************** -* 函数名称: Pulse_Start() -* 功能说明: 脉宽测量功能启动,测量到脉宽后会自动关闭测量功能 -* 输 入: 无 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: Pulse_Start() +* 鍔熻兘璇存槑: 鑴夊娴嬮噺鍔熻兘鍚姩锛屾祴閲忓埌鑴夊鍚庝細鑷姩鍏抽棴娴嬮噺鍔熻兘 +* 杈 鍏: 鏃 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void Pulse_Start(void) { @@ -415,17 +415,17 @@ void Pulse_Start(void) } /****************************************************************************************************************************************** -* 函数名称: Pulse_Done() -* 功能说明: 脉宽测量是否完成 -* 输 入: 无 -* 输 出: uint32_t 1 测量已完成 0 测量未完成 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: Pulse_Done() +* 鍔熻兘璇存槑: 鑴夊娴嬮噺鏄惁瀹屾垚 +* 杈 鍏: 鏃 +* 杈 鍑: uint32_t 1 娴嬮噺宸插畬鎴 0 娴嬮噺鏈畬鎴 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t Pulse_Done(void) { if(TIMRG->IF & TIMRG_IF_PULSE_Msk) { - TIMRG->IF = TIMRG_IF_PULSE_Msk; // 清除中断标志 + TIMRG->IF = TIMRG_IF_PULSE_Msk; // 娓呴櫎涓柇鏍囧織 return 1; } diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.h index bd1aa2618d..5cfdce204d 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_timr.h @@ -4,20 +4,20 @@ #define TIMR_MODE_TIMER 0 #define TIMR_MODE_COUNTER 1 -void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t int_en); //定时器/计数器初始化 -void TIMR_Start(TIMR_TypeDef * TIMRx); //启动定时器,从初始值开始计时/计数 -void TIMR_Stop(TIMR_TypeDef * TIMRx); //停止定时器 -void TIMR_Halt(TIMR_TypeDef * TIMRx); //暂停定时器,计数值保持不变 -void TIMR_Resume(TIMR_TypeDef * TIMRx); //恢复定时器,从暂停处继续计数 +void TIMR_Init(TIMR_TypeDef * TIMRx, uint32_t mode, uint32_t period, uint32_t int_en); //瀹氭椂鍣/璁℃暟鍣ㄥ垵濮嬪寲 +void TIMR_Start(TIMR_TypeDef * TIMRx); //鍚姩瀹氭椂鍣紝浠庡垵濮嬪煎紑濮嬭鏃/璁℃暟 +void TIMR_Stop(TIMR_TypeDef * TIMRx); //鍋滄瀹氭椂鍣 +void TIMR_Halt(TIMR_TypeDef * TIMRx); //鏆傚仠瀹氭椂鍣紝璁℃暟鍊间繚鎸佷笉鍙 +void TIMR_Resume(TIMR_TypeDef * TIMRx); //鎭㈠瀹氭椂鍣紝浠庢殏鍋滃缁х画璁℃暟 -void TIMR_SetPeriod(TIMR_TypeDef * TIMRx, uint32_t period); //设置定时/计数周期 -uint32_t TIMR_GetPeriod(TIMR_TypeDef * TIMRx); //获取定时/计数周期 -uint32_t TIMR_GetCurValue(TIMR_TypeDef * TIMRx); //获取当前计数值 +void TIMR_SetPeriod(TIMR_TypeDef * TIMRx, uint32_t period); //璁剧疆瀹氭椂/璁℃暟鍛ㄦ湡 +uint32_t TIMR_GetPeriod(TIMR_TypeDef * TIMRx); //鑾峰彇瀹氭椂/璁℃暟鍛ㄦ湡 +uint32_t TIMR_GetCurValue(TIMR_TypeDef * TIMRx); //鑾峰彇褰撳墠璁℃暟鍊 -void TIMR_INTEn(TIMR_TypeDef * TIMRx); //使能中断 -void TIMR_INTDis(TIMR_TypeDef * TIMRx); //禁能中断 -void TIMR_INTClr(TIMR_TypeDef * TIMRx); //清除中断标志 -uint32_t TIMR_INTStat(TIMR_TypeDef * TIMRx); //获取中断状态 +void TIMR_INTEn(TIMR_TypeDef * TIMRx); //浣胯兘涓柇 +void TIMR_INTDis(TIMR_TypeDef * TIMRx); //绂佽兘涓柇 +void TIMR_INTClr(TIMR_TypeDef * TIMRx); //娓呴櫎涓柇鏍囧織 +uint32_t TIMR_INTStat(TIMR_TypeDef * TIMRx); //鑾峰彇涓柇鐘舵 diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.c index 6b3f046c75..73f219f7aa 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_uart.c -* 功能说明: SWM320单片机的UART串口功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: 没有编写LIN功能相关的函数 -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_uart.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑UART涓插彛鍔熻兘椹卞姩搴 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: 娌℃湁缂栧啓LIN鍔熻兘鐩稿叧鐨勫嚱鏁 +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,12 +23,12 @@ /****************************************************************************************************************************************** -* 函数名称: UART_Init() -* 功能说明: UART串口初始化 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* UART_InitStructure * initStruct 包含UART串口相关设定值的结构体 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_Init() +* 鍔熻兘璇存槑: UART涓插彛鍒濆鍖 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* UART_InitStructure * initStruct 鍖呭惈UART涓插彛鐩稿叧璁惧畾鍊肩殑缁撴瀯浣 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct) { @@ -51,7 +51,7 @@ void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct) break; } - UART_Close(UARTx); //一些关键寄存器只能在串口关闭时设置 + UART_Close(UARTx); //涓浜涘叧閿瘎瀛樺櫒鍙兘鍦ㄤ覆鍙e叧闂椂璁剧疆 UARTx->CTRL |= (0x01 << UART_CTRL_BAUDEN_Pos); UARTx->BAUD &= ~UART_BAUD_BAUD_Msk; @@ -62,10 +62,10 @@ void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct) (initStruct->Parity << UART_CTRL_PARITY_Pos) | (initStruct->StopBits << UART_CTRL_STOP2b_Pos); - /* 在SWM320中,当 RXLVL >= RXTHR 时触发中断,如果RXTHR设置为0的话,在未接收到数据时就会一直触发中断; - 其他芯片中,当 RXLVL > RXTHR 时触发中断,为解决SWM320中RXTHR不能为0的问题,并统一库函数API,这里将RXTHR设置值加一 + /* 鍦⊿WM320涓紝褰 RXLVL >= RXTHR 鏃惰Е鍙戜腑鏂紝濡傛灉RXTHR璁剧疆涓0鐨勮瘽锛屽湪鏈帴鏀跺埌鏁版嵁鏃跺氨浼氫竴鐩磋Е鍙戜腑鏂紱 + 鍏朵粬鑺墖涓紝褰 RXLVL > RXTHR 鏃惰Е鍙戜腑鏂紝涓鸿В鍐砈WM320涓璕XTHR涓嶈兘涓0鐨勯棶棰橈紝骞剁粺涓搴撳嚱鏁癆PI锛岃繖閲屽皢RXTHR璁剧疆鍊煎姞涓 */ - switch((uint32_t)UARTx) // 软件复位不能清零 NVIC 寄存器,若不手动清除,下面的代码清零 RXTHR 时会导致一直进入 ISR + switch((uint32_t)UARTx) // 杞欢澶嶄綅涓嶈兘娓呴浂 NVIC 瀵勫瓨鍣紝鑻ヤ笉鎵嬪姩娓呴櫎锛屼笅闈㈢殑浠g爜娓呴浂 RXTHR 鏃朵細瀵艰嚧涓鐩磋繘鍏 ISR { case ((uint32_t)UART0): NVIC_DisableIRQ(UART0_IRQn); break; case ((uint32_t)UART1): NVIC_DisableIRQ(UART1_IRQn); break; @@ -133,11 +133,11 @@ void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct) } /****************************************************************************************************************************************** -* 函数名称: UART_Open() -* 功能说明: UART串口打开 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_Open() +* 鍔熻兘璇存槑: UART涓插彛鎵撳紑 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_Open(UART_TypeDef * UARTx) { @@ -145,11 +145,11 @@ void UART_Open(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_Close() -* 功能说明: UART串口关闭 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_Close() +* 鍔熻兘璇存槑: UART涓插彛鍏抽棴 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_Close(UART_TypeDef * UARTx) { @@ -157,12 +157,12 @@ void UART_Close(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_WriteByte() -* 功能说明: 发送一个字节数据 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,可取值包括UART0、UART1、UART2、UART3、UART4 -* uint32_t data 要发送的字节 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_WriteByte() +* 鍔熻兘璇存槑: 鍙戦佷竴涓瓧鑺傛暟鎹 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屽彲鍙栧煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3銆乁ART4 +* uint32_t data 瑕佸彂閫佺殑瀛楄妭 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_WriteByte(UART_TypeDef * UARTx, uint32_t data) { @@ -170,12 +170,12 @@ void UART_WriteByte(UART_TypeDef * UARTx, uint32_t data) } /****************************************************************************************************************************************** -* 函数名称: UART_ReadByte() -* 功能说明: 读取一个字节数据,并指出数据是否Valid -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,可取值包括UART0、UART1、UART2、UART3、UART4 -* uint32_t * data 接收到的数据 -* 输 出: uint32_t 0 无错误 UART_ERR_PARITY 奇偶校验错误 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_ReadByte() +* 鍔熻兘璇存槑: 璇诲彇涓涓瓧鑺傛暟鎹紝骞舵寚鍑烘暟鎹槸鍚alid +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屽彲鍙栧煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3銆乁ART4 +* uint32_t * data 鎺ユ敹鍒扮殑鏁版嵁 +* 杈 鍑: uint32_t 0 鏃犻敊璇 UART_ERR_PARITY 濂囧伓鏍¢獙閿欒 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_ReadByte(UART_TypeDef * UARTx, uint32_t * data) { @@ -189,11 +189,11 @@ uint32_t UART_ReadByte(UART_TypeDef * UARTx, uint32_t * data) } /****************************************************************************************************************************************** -* 函数名称: UART_IsTXBusy() -* 功能说明: UART是否正在发送数据 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 UART正在发送数据 0 数据已发完 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_IsTXBusy() +* 鍔熻兘璇存槑: UART鏄惁姝e湪鍙戦佹暟鎹 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 UART姝e湪鍙戦佹暟鎹 0 鏁版嵁宸插彂瀹 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_IsTXBusy(UART_TypeDef * UARTx) { @@ -201,11 +201,11 @@ uint32_t UART_IsTXBusy(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_IsRXFIFOEmpty() -* 功能说明: 接收FIFO是否为空,如果不空则说明其中有数据可以读取 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 接收FIFO空 0 接收FIFO非空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_IsRXFIFOEmpty() +* 鍔熻兘璇存槑: 鎺ユ敹FIFO鏄惁涓虹┖锛屽鏋滀笉绌哄垯璇存槑鍏朵腑鏈夋暟鎹彲浠ヨ鍙 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 鎺ユ敹FIFO绌 0 鎺ユ敹FIFO闈炵┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_IsRXFIFOEmpty(UART_TypeDef * UARTx) { @@ -213,11 +213,11 @@ uint32_t UART_IsRXFIFOEmpty(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_IsTXFIFOFull() -* 功能说明: 发送FIFO是否为满,如果不满则可以继续向其中写入数据 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 发送FIFO满 0 发送FIFO不满 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_IsTXFIFOFull() +* 鍔熻兘璇存槑: 鍙戦丗IFO鏄惁涓烘弧锛屽鏋滀笉婊″垯鍙互缁х画鍚戝叾涓啓鍏ユ暟鎹 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 鍙戦丗IFO婊 0 鍙戦丗IFO涓嶆弧 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_IsTXFIFOFull(UART_TypeDef * UARTx) { @@ -225,12 +225,12 @@ uint32_t UART_IsTXFIFOFull(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_SetBaudrate() -* 功能说明: 设置波特率 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* uint32_t baudrate 要设置的波特率 -* 输 出: 无 -* 注意事项: 不要在串口工作时更改波特率,使用此函数前请先调用UART_Close()关闭串口 +* 鍑芥暟鍚嶇О: UART_SetBaudrate() +* 鍔熻兘璇存槑: 璁剧疆娉㈢壒鐜 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* uint32_t baudrate 瑕佽缃殑娉㈢壒鐜 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 涓嶈鍦ㄤ覆鍙e伐浣滄椂鏇存敼娉㈢壒鐜囷紝浣跨敤姝ゅ嚱鏁板墠璇峰厛璋冪敤UART_Close()鍏抽棴涓插彛 ******************************************************************************************************************************************/ void UART_SetBaudrate(UART_TypeDef * UARTx, uint32_t baudrate) { @@ -239,11 +239,11 @@ void UART_SetBaudrate(UART_TypeDef * UARTx, uint32_t baudrate) } /****************************************************************************************************************************************** -* 函数名称: UART_GetBaudrate() -* 功能说明: 查询波特率 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 当前波特率 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_GetBaudrate() +* 鍔熻兘璇存槑: 鏌ヨ娉㈢壒鐜 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 褰撳墠娉㈢壒鐜 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_GetBaudrate(UART_TypeDef * UARTx) { @@ -251,13 +251,13 @@ uint32_t UART_GetBaudrate(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_CTSConfig() -* 功能说明: UART CTS流控配置 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* uint32_t enable 1 使能CTS流控 0 禁止CTS流控 -* uint32_t polarity 0 CTS输入为低表示可以发送数据 1 CTS输入为高表示可以发送数据 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_CTSConfig() +* 鍔熻兘璇存槑: UART CTS娴佹帶閰嶇疆 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* uint32_t enable 1 浣胯兘CTS娴佹帶 0 绂佹CTS娴佹帶 +* uint32_t polarity 0 CTS杈撳叆涓轰綆琛ㄧず鍙互鍙戦佹暟鎹 1 CTS杈撳叆涓洪珮琛ㄧず鍙互鍙戦佹暟鎹 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_CTSConfig(UART_TypeDef * UARTx, uint32_t enable, uint32_t polarity) { @@ -267,11 +267,11 @@ void UART_CTSConfig(UART_TypeDef * UARTx, uint32_t enable, uint32_t polarity) } /****************************************************************************************************************************************** -* 函数名称: UART_CTSLineState() -* 功能说明: UART CTS线当前状态 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 0 CTS线当前为低电平 1 CTS线当前为高电平 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_CTSLineState() +* 鍔熻兘璇存槑: UART CTS绾垮綋鍓嶇姸鎬 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 0 CTS绾垮綋鍓嶄负浣庣數骞 1 CTS绾垮綋鍓嶄负楂樼數骞 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_CTSLineState(UART_TypeDef * UARTx) { @@ -279,14 +279,14 @@ uint32_t UART_CTSLineState(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_RTSConfig() -* 功能说明: UART RTS流控配置 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* uint32_t enable 1 使能RTS流控 0 禁止RTS流控 -* uint32_t polarity 0 RTS输出低表示可以接收数据 1 RTS输出高表示可以接收数据 -* uint32_t threshold RTS流控的触发阈值,可取值UART_RTS_1BYTE、UART_RTS_2BYTE、UART_RTS_4BYTE、UART_RTS_6BYTE -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_RTSConfig() +* 鍔熻兘璇存槑: UART RTS娴佹帶閰嶇疆 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* uint32_t enable 1 浣胯兘RTS娴佹帶 0 绂佹RTS娴佹帶 +* uint32_t polarity 0 RTS杈撳嚭浣庤〃绀哄彲浠ユ帴鏀舵暟鎹 1 RTS杈撳嚭楂樿〃绀哄彲浠ユ帴鏀舵暟鎹 +* uint32_t threshold RTS娴佹帶鐨勮Е鍙戦槇鍊硷紝鍙彇鍊糢ART_RTS_1BYTE銆乁ART_RTS_2BYTE銆乁ART_RTS_4BYTE銆乁ART_RTS_6BYTE +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_RTSConfig(UART_TypeDef * UARTx, uint32_t enable, uint32_t polarity, uint32_t threshold) { @@ -297,11 +297,11 @@ void UART_RTSConfig(UART_TypeDef * UARTx, uint32_t enable, uint32_t polarity, ui } /****************************************************************************************************************************************** -* 函数名称: UART_RTSLineState() -* 功能说明: UART RTS线当前状态 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 0 RTS线当前为低电平 1 RTS线当前为高电平 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_RTSLineState() +* 鍔熻兘璇存槑: UART RTS绾垮綋鍓嶇姸鎬 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 0 RTS绾垮綋鍓嶄负浣庣數骞 1 RTS绾垮綋鍓嶄负楂樼數骞 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_RTSLineState(UART_TypeDef * UARTx) { @@ -309,13 +309,13 @@ uint32_t UART_RTSLineState(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_LINConfig() -* 功能说明: UART LIN功能配置 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* uint32_t detectedIEn 检测到Break中断使能 -* uint32_t generatedIEn Break发送完成中断使能 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_LINConfig() +* 鍔熻兘璇存槑: UART LIN鍔熻兘閰嶇疆 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* uint32_t detectedIEn 妫娴嬪埌Break涓柇浣胯兘 +* uint32_t generatedIEn Break鍙戦佸畬鎴愪腑鏂娇鑳 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_LINConfig(UART_TypeDef * UARTx, uint32_t detectedIEn, uint32_t generatedIEn) { @@ -325,11 +325,11 @@ void UART_LINConfig(UART_TypeDef * UARTx, uint32_t detectedIEn, uint32_t generat } /****************************************************************************************************************************************** -* 函数名称: UART_LINGenerate() -* 功能说明: UART LIN产生/发送Break -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_LINGenerate() +* 鍔熻兘璇存槑: UART LIN浜х敓/鍙戦丅reak +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_LINGenerate(UART_TypeDef * UARTx) { @@ -337,11 +337,11 @@ void UART_LINGenerate(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_LINIsDetected() -* 功能说明: UART LIN是否检测到Break -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 检测到LIN Break 0 未检测到LIN Break -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_LINIsDetected() +* 鍔熻兘璇存槑: UART LIN鏄惁妫娴嬪埌Break +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 妫娴嬪埌LIN Break 0 鏈娴嬪埌LIN Break +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_LINIsDetected(UART_TypeDef * UARTx) { @@ -349,11 +349,11 @@ uint32_t UART_LINIsDetected(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_LINIsGenerated() -* 功能说明: UART LIN Break是否发送完成 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 LIN Break 发送完成 0 LIN Break发送未完成 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_LINIsGenerated() +* 鍔熻兘璇存槑: UART LIN Break鏄惁鍙戦佸畬鎴 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 LIN Break 鍙戦佸畬鎴 0 LIN Break鍙戦佹湭瀹屾垚 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_LINIsGenerated(UART_TypeDef * UARTx) { @@ -361,14 +361,14 @@ uint32_t UART_LINIsGenerated(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_ABRStart() -* 功能说明: UART 自动波特率检测开始 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* uint32_t detectChar 用于自动检测、计算波特率的检测字符 -* 8位数据时可取值:0xFF、0xFE、0xF8、0x80,分别表示发送方必须发送0xFF、0xFE、0xF8、0x80 -* 9位数据时可取值:0x1FF、0x1FE、0x1F8、0x180,分别表示发送方必须发送0x1FF、0x1FE、0x1F8、0x180 -* 输 出: 无 -* 注意事项: 自动波特率检测时不能开启奇偶校验 +* 鍑芥暟鍚嶇О: UART_ABRStart() +* 鍔熻兘璇存槑: UART 鑷姩娉㈢壒鐜囨娴嬪紑濮 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* uint32_t detectChar 鐢ㄤ簬鑷姩妫娴嬨佽绠楁尝鐗圭巼鐨勬娴嬪瓧绗 +* 8浣嶆暟鎹椂鍙彇鍊硷細0xFF銆0xFE銆0xF8銆0x80锛屽垎鍒〃绀哄彂閫佹柟蹇呴』鍙戦0xFF銆0xFE銆0xF8銆0x80 +* 9浣嶆暟鎹椂鍙彇鍊硷細0x1FF銆0x1FE銆0x1F8銆0x180锛屽垎鍒〃绀哄彂閫佹柟蹇呴』鍙戦0x1FF銆0x1FE銆0x1F8銆0x180 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鑷姩娉㈢壒鐜囨娴嬫椂涓嶈兘寮鍚鍋舵牎楠 ******************************************************************************************************************************************/ void UART_ABRStart(UART_TypeDef * UARTx, uint32_t detectChar) { @@ -386,11 +386,11 @@ void UART_ABRStart(UART_TypeDef * UARTx, uint32_t detectChar) } /****************************************************************************************************************************************** -* 函数名称: UART_ABRIsDone() -* 功能说明: UART 自动波特率是否完成 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 0 未完成 UART_ABR_RES_OK 已完成,且成功 UART_ABR_RES_ERR 已完成,但失败、出错 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_ABRIsDone() +* 鍔熻兘璇存槑: UART 鑷姩娉㈢壒鐜囨槸鍚﹀畬鎴 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 0 鏈畬鎴 UART_ABR_RES_OK 宸插畬鎴愶紝涓旀垚鍔 UART_ABR_RES_ERR 宸插畬鎴愶紝浣嗗け璐ャ佸嚭閿 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_ABRIsDone(UART_TypeDef * UARTx) { @@ -409,11 +409,11 @@ uint32_t UART_ABRIsDone(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTRXThresholdEn() -* 功能说明: 当RX FIFO中数据个数 >= RXThreshold时 触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTRXThresholdEn() +* 鍔熻兘璇存槑: 褰揜X FIFO涓暟鎹釜鏁 >= RXThreshold鏃 瑙﹀彂涓柇 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTRXThresholdEn(UART_TypeDef * UARTx) { @@ -421,11 +421,11 @@ void UART_INTRXThresholdEn(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTRXThresholdDis() -* 功能说明: 当RX FIFO中数据个数 >= RXThreshold时 不触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTRXThresholdDis() +* 鍔熻兘璇存槑: 褰揜X FIFO涓暟鎹釜鏁 >= RXThreshold鏃 涓嶈Е鍙戜腑鏂 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTRXThresholdDis(UART_TypeDef * UARTx) { @@ -433,11 +433,11 @@ void UART_INTRXThresholdDis(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTRXThresholdStat() -* 功能说明: 是否RX FIFO中数据个数 >= RXThreshold -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 RX FIFO中数据个数 >= RXThreshold 0 RX FIFO中数据个数 < RXThreshold -* 注意事项: RXIF = RXTHRF & RXIE +* 鍑芥暟鍚嶇О: UART_INTRXThresholdStat() +* 鍔熻兘璇存槑: 鏄惁RX FIFO涓暟鎹釜鏁 >= RXThreshold +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 RX FIFO涓暟鎹釜鏁 >= RXThreshold 0 RX FIFO涓暟鎹釜鏁 < RXThreshold +* 娉ㄦ剰浜嬮」: RXIF = RXTHRF & RXIE ******************************************************************************************************************************************/ uint32_t UART_INTRXThresholdStat(UART_TypeDef * UARTx) { @@ -445,11 +445,11 @@ uint32_t UART_INTRXThresholdStat(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXThresholdEn() -* 功能说明: 当TX FIFO中数据个数 <= TXThreshold时 触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTXThresholdEn() +* 鍔熻兘璇存槑: 褰揟X FIFO涓暟鎹釜鏁 <= TXThreshold鏃 瑙﹀彂涓柇 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTXThresholdEn(UART_TypeDef * UARTx) { @@ -457,11 +457,11 @@ void UART_INTTXThresholdEn(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXThresholdDis() -* 功能说明: 当TX FIFO中数据个数 <= TXThreshold时 不触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTXThresholdDis() +* 鍔熻兘璇存槑: 褰揟X FIFO涓暟鎹釜鏁 <= TXThreshold鏃 涓嶈Е鍙戜腑鏂 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTXThresholdDis(UART_TypeDef * UARTx) { @@ -469,11 +469,11 @@ void UART_INTTXThresholdDis(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXThresholdStat() -* 功能说明: 是否TX FIFO中数据个数 <= TXThreshold -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 TX FIFO中数据个数 <= TXThreshold 0 TX FIFO中数据个数 > TXThreshold -* 注意事项: TXIF = TXTHRF & TXIE +* 鍑芥暟鍚嶇О: UART_INTTXThresholdStat() +* 鍔熻兘璇存槑: 鏄惁TX FIFO涓暟鎹釜鏁 <= TXThreshold +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 TX FIFO涓暟鎹釜鏁 <= TXThreshold 0 TX FIFO涓暟鎹釜鏁 > TXThreshold +* 娉ㄦ剰浜嬮」: TXIF = TXTHRF & TXIE ******************************************************************************************************************************************/ uint32_t UART_INTTXThresholdStat(UART_TypeDef * UARTx) { @@ -481,11 +481,11 @@ uint32_t UART_INTTXThresholdStat(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTimeoutEn() -* 功能说明: 接收发生超时时 触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTimeoutEn() +* 鍔熻兘璇存槑: 鎺ユ敹鍙戠敓瓒呮椂鏃 瑙﹀彂涓柇 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTimeoutEn(UART_TypeDef * UARTx) { @@ -493,11 +493,11 @@ void UART_INTTimeoutEn(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTimeoutDis() -* 功能说明: 接收发生超时时 不触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTimeoutDis() +* 鍔熻兘璇存槑: 鎺ユ敹鍙戠敓瓒呮椂鏃 涓嶈Е鍙戜腑鏂 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTimeoutDis(UART_TypeDef * UARTx) { @@ -505,11 +505,11 @@ void UART_INTTimeoutDis(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTimeoutStat() -* 功能说明: 是否发生了接收超时,即超过 TimeoutTime/(Baudrate/10) 秒没有在RX线上接收到数据时触发中断 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 发生了接收超时 0 未发生接收超时 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTimeoutStat() +* 鍔熻兘璇存槑: 鏄惁鍙戠敓浜嗘帴鏀惰秴鏃讹紝鍗宠秴杩 TimeoutTime/(Baudrate/10) 绉掓病鏈夊湪RX绾夸笂鎺ユ敹鍒版暟鎹椂瑙﹀彂涓柇 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 鍙戠敓浜嗘帴鏀惰秴鏃 0 鏈彂鐢熸帴鏀惰秴鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_INTTimeoutStat(UART_TypeDef * UARTx) { @@ -517,11 +517,11 @@ uint32_t UART_INTTimeoutStat(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXDoneEn() -* 功能说明: 发送FIFO空且发送移位寄存器空中断使能 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTXDoneEn() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂娇鑳 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTXDoneEn(UART_TypeDef * UARTx) { @@ -529,11 +529,11 @@ void UART_INTTXDoneEn(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXDoneDis() -* 功能说明: 发送FIFO空且发送移位寄存器空中断禁止 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTXDoneDis() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂姝 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void UART_INTTXDoneDis(UART_TypeDef * UARTx) { @@ -541,11 +541,11 @@ void UART_INTTXDoneDis(UART_TypeDef * UARTx) } /****************************************************************************************************************************************** -* 函数名称: UART_INTTXDoneStat() -* 功能说明: 发送FIFO空且发送移位寄存器空中断状态 -* 输 入: UART_TypeDef * UARTx 指定要被设置的UART串口,有效值包括UART0、UART1、UART2、UART3 -* 输 出: uint32_t 1 发送FIFO空且发送移位寄存器空 0 发送FIFO或发送移位寄存器未空 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: UART_INTTXDoneStat() +* 鍔熻兘璇存槑: 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌轰腑鏂姸鎬 +* 杈 鍏: UART_TypeDef * UARTx 鎸囧畾瑕佽璁剧疆鐨刄ART涓插彛锛屾湁鏁堝煎寘鎷琔ART0銆乁ART1銆乁ART2銆乁ART3 +* 杈 鍑: uint32_t 1 鍙戦丗IFO绌轰笖鍙戦佺Щ浣嶅瘎瀛樺櫒绌 0 鍙戦丗IFO鎴栧彂閫佺Щ浣嶅瘎瀛樺櫒鏈┖ +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t UART_INTTXDoneStat(UART_TypeDef * UARTx) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.h index 1611744cb7..bad63f420c 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_uart.h @@ -4,20 +4,20 @@ typedef struct { uint32_t Baudrate; - uint8_t DataBits; //数据位位数,可取值UART_DATA_8BIT、UART_DATA_9BIT + uint8_t DataBits; //鏁版嵁浣嶄綅鏁帮紝鍙彇鍊糢ART_DATA_8BIT銆乁ART_DATA_9BIT - uint8_t Parity; //奇偶校验位,可取值UART_PARITY_NONE、UART_PARITY_ODD、UART_PARITY_EVEN、UART_PARITY_ONE、UART_PARITY_ZERO + uint8_t Parity; //濂囧伓鏍¢獙浣嶏紝鍙彇鍊糢ART_PARITY_NONE銆乁ART_PARITY_ODD銆乁ART_PARITY_EVEN銆乁ART_PARITY_ONE銆乁ART_PARITY_ZERO - uint8_t StopBits; //停止位位数,可取值UART_STOP_1BIT、UART_STOP_2BIT + uint8_t StopBits; //鍋滄浣嶄綅鏁帮紝鍙彇鍊糢ART_STOP_1BIT銆乁ART_STOP_2BIT - uint8_t RXThreshold; //取值0--7 - uint8_t RXThresholdIEn; //当RX FIFO中数据个数 > RXThreshold时触发中断 + uint8_t RXThreshold; //鍙栧0--7 + uint8_t RXThresholdIEn; //褰揜X FIFO涓暟鎹釜鏁 > RXThreshold鏃惰Е鍙戜腑鏂 - uint8_t TXThreshold; //取值0--7 - uint8_t TXThresholdIEn; //当TX FIFO中数据个数 <= TXThreshold时触发中断 + uint8_t TXThreshold; //鍙栧0--7 + uint8_t TXThresholdIEn; //褰揟X FIFO涓暟鎹釜鏁 <= TXThreshold鏃惰Е鍙戜腑鏂 - uint8_t TimeoutTime; //超时时长 = TimeoutTime/(Baudrate/10) 秒 - uint8_t TimeoutIEn; //超时中断,RX FIFO非空,且超过 TimeoutTime/(Baudrate/10) 秒没有在RX线上接收到数据时触发中断 + uint8_t TimeoutTime; //瓒呮椂鏃堕暱 = TimeoutTime/(Baudrate/10) 绉 + uint8_t TimeoutIEn; //瓒呮椂涓柇锛孯X FIFO闈炵┖锛屼笖瓒呰繃 TimeoutTime/(Baudrate/10) 绉掓病鏈夊湪RX绾夸笂鎺ユ敹鍒版暟鎹椂瑙﹀彂涓柇 } UART_InitStructure; @@ -46,20 +46,20 @@ typedef struct { #define UART_ERR_NOISE 3 -void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct); //UART串口初始化 +void UART_Init(UART_TypeDef * UARTx, UART_InitStructure * initStruct); //UART涓插彛鍒濆鍖 void UART_Open(UART_TypeDef * UARTx); void UART_Close(UART_TypeDef * UARTx); -void UART_WriteByte(UART_TypeDef * UARTx, uint32_t data); //发送一个字节数据 -uint32_t UART_ReadByte(UART_TypeDef * UARTx, uint32_t * data); //读取一个字节数据,并指出数据是否Valid +void UART_WriteByte(UART_TypeDef * UARTx, uint32_t data); //鍙戦佷竴涓瓧鑺傛暟鎹 +uint32_t UART_ReadByte(UART_TypeDef * UARTx, uint32_t * data); //璇诲彇涓涓瓧鑺傛暟鎹紝骞舵寚鍑烘暟鎹槸鍚alid uint32_t UART_IsTXBusy(UART_TypeDef * UARTx); -uint32_t UART_IsRXFIFOEmpty(UART_TypeDef * UARTx); //接收FIFO是否空,如果不空则可以继续UART_ReadByte() -uint32_t UART_IsTXFIFOFull(UART_TypeDef * UARTx); //发送FIFO是否满,如果不满则可以继续UART_WriteByte() +uint32_t UART_IsRXFIFOEmpty(UART_TypeDef * UARTx); //鎺ユ敹FIFO鏄惁绌猴紝濡傛灉涓嶇┖鍒欏彲浠ョ户缁璘ART_ReadByte() +uint32_t UART_IsTXFIFOFull(UART_TypeDef * UARTx); //鍙戦丗IFO鏄惁婊★紝濡傛灉涓嶆弧鍒欏彲浠ョ户缁璘ART_WriteByte() -void UART_SetBaudrate(UART_TypeDef * UARTx, uint32_t baudrate); //设置波特率 -uint32_t UART_GetBaudrate(UART_TypeDef * UARTx); //获取当前使用的波特率 +void UART_SetBaudrate(UART_TypeDef * UARTx, uint32_t baudrate); //璁剧疆娉㈢壒鐜 +uint32_t UART_GetBaudrate(UART_TypeDef * UARTx); //鑾峰彇褰撳墠浣跨敤鐨勬尝鐗圭巼 void UART_CTSConfig(UART_TypeDef * UARTx, uint32_t enable, uint32_t polarity); uint32_t UART_CTSLineState(UART_TypeDef * UARTx); diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.c b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.c index 762e79b3ae..59a358b69e 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.c +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.c @@ -1,10 +1,10 @@ /****************************************************************************************************************************************** -* 文件名称: SWM320_wdt.c -* 功能说明: SWM320单片机的WDT看门狗功能驱动库 -* 技术支持: http://www.synwit.com.cn/e/tool/gbook/?bid=1 -* 注意事项: -* 版本日期: V1.1.0 2017年10月25日 -* 升级记录: +* 鏂囦欢鍚嶇О: SWM320_wdt.c +* 鍔熻兘璇存槑: SWM320鍗曠墖鏈虹殑WDT鐪嬮棬鐙楀姛鑳介┍鍔ㄥ簱 +* 鎶鏈敮鎸: http://www.synwit.com.cn/e/tool/gbook/?bid=1 +* 娉ㄦ剰浜嬮」: +* 鐗堟湰鏃ユ湡: V1.1.0 2017骞10鏈25鏃 +* 鍗囩骇璁板綍: * * ******************************************************************************************************************************************* @@ -23,19 +23,19 @@ /****************************************************************************************************************************************** -* 函数名称: WDT_Init() -* 功能说明: WDT看门狗初始化 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* uint32_t peroid 取值0--4294967295,单位为单片机系统时钟周期 -* uint32_t mode WDT_MODE_RESET 超时产生复位 WDT_MODE_INTERRUPT 超时产生中断 -* 输 出: 无 -* 注意事项: 复位使能时中断不起作用,因为计数周期结束时芯片直接复位了,无法响应中断 +* 鍑芥暟鍚嶇О: WDT_Init() +* 鍔熻兘璇存槑: WDT鐪嬮棬鐙楀垵濮嬪寲 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* uint32_t peroid 鍙栧0--4294967295锛屽崟浣嶄负鍗曠墖鏈虹郴缁熸椂閽熷懆鏈 +* uint32_t mode WDT_MODE_RESET 瓒呮椂浜х敓澶嶄綅 WDT_MODE_INTERRUPT 瓒呮椂浜х敓涓柇 +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 澶嶄綅浣胯兘鏃朵腑鏂笉璧蜂綔鐢紝鍥犱负璁℃暟鍛ㄦ湡缁撴潫鏃惰姱鐗囩洿鎺ュ浣嶄簡锛屾棤娉曞搷搴斾腑鏂 ******************************************************************************************************************************************/ void WDT_Init(WDT_TypeDef * WDTx, uint32_t peroid, uint32_t mode) { SYS->CLKEN |= (0x01 << SYS_CLKEN_WDT_Pos); - WDT_Stop(WDTx); //设置前先关闭 + WDT_Stop(WDTx); //璁剧疆鍓嶅厛鍏抽棴 WDTx->LOAD = peroid; @@ -54,11 +54,11 @@ void WDT_Init(WDT_TypeDef * WDTx, uint32_t peroid, uint32_t mode) } /****************************************************************************************************************************************** -* 函数名称: WDT_Start() -* 功能说明: 启动指定WDT,开始倒计时 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_Start() +* 鍔熻兘璇存槑: 鍚姩鎸囧畾WDT锛屽紑濮嬪掕鏃 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void WDT_Start(WDT_TypeDef * WDTx) { @@ -66,11 +66,11 @@ void WDT_Start(WDT_TypeDef * WDTx) } /****************************************************************************************************************************************** -* 函数名称: WDT_Stop() -* 功能说明: 关闭指定WDT,停止倒计时 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_Stop() +* 鍔熻兘璇存槑: 鍏抽棴鎸囧畾WDT锛屽仠姝㈠掕鏃 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void WDT_Stop(WDT_TypeDef * WDTx) { @@ -78,11 +78,11 @@ void WDT_Stop(WDT_TypeDef * WDTx) } /****************************************************************************************************************************************** -* 函数名称: WDT_Feed() -* 功能说明: 喂狗,重新从装载值开始倒计时 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_Feed() +* 鍔熻兘璇存槑: 鍠傜嫍锛岄噸鏂颁粠瑁呰浇鍊煎紑濮嬪掕鏃 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void WDT_Feed(WDT_TypeDef * WDTx) { @@ -90,11 +90,11 @@ void WDT_Feed(WDT_TypeDef * WDTx) } /****************************************************************************************************************************************** -* 函数名称: WDT_GetValue() -* 功能说明: 获取指定看门狗定时器的当前倒计时值 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: int32_t 看门狗当前计数值 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_GetValue() +* 鍔熻兘璇存槑: 鑾峰彇鎸囧畾鐪嬮棬鐙楀畾鏃跺櫒鐨勫綋鍓嶅掕鏃跺 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: int32_t 鐪嬮棬鐙楀綋鍓嶈鏁板 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ int32_t WDT_GetValue(WDT_TypeDef * WDTx) { @@ -102,11 +102,11 @@ int32_t WDT_GetValue(WDT_TypeDef * WDTx) } /****************************************************************************************************************************************** -* 函数名称: WDT_INTClr() -* 功能说明: 中断标志清除 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: 无 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_INTClr() +* 鍔熻兘璇存槑: 涓柇鏍囧織娓呴櫎 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: 鏃 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ void WDT_INTClr(WDT_TypeDef * WDTx) { @@ -114,11 +114,11 @@ void WDT_INTClr(WDT_TypeDef * WDTx) } /****************************************************************************************************************************************** -* 函数名称: WDT_INTStat() -* 功能说明: 中断状态查询 -* 输 入: WDT_TypeDef * WDTx 指定要被设置的看门狗,有效值包括WDT -* 输 出: int32_t 1 发生中断溢出 0 未发生中断溢出 -* 注意事项: 无 +* 鍑芥暟鍚嶇О: WDT_INTStat() +* 鍔熻兘璇存槑: 涓柇鐘舵佹煡璇 +* 杈 鍏: WDT_TypeDef * WDTx 鎸囧畾瑕佽璁剧疆鐨勭湅闂ㄧ嫍锛屾湁鏁堝煎寘鎷琖DT +* 杈 鍑: int32_t 1 鍙戠敓涓柇婧㈠嚭 0 鏈彂鐢熶腑鏂孩鍑 +* 娉ㄦ剰浜嬮」: 鏃 ******************************************************************************************************************************************/ uint32_t WDT_INTStat(WDT_TypeDef * WDTx) { diff --git a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.h b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.h index 1d056ba296..a02a60ba87 100644 --- a/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.h +++ b/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_wdt.h @@ -4,16 +4,16 @@ #define WDT_MODE_RESET 0 #define WDT_MODE_INTERRUPT 1 -void WDT_Init(WDT_TypeDef * WDTx, uint32_t peroid, uint32_t mode); //WDT看门狗初始化 -void WDT_Start(WDT_TypeDef * WDTx); //启动指定WDT,开始倒计时 -void WDT_Stop(WDT_TypeDef * WDTx); //关闭指定WDT,停止倒计时 +void WDT_Init(WDT_TypeDef * WDTx, uint32_t peroid, uint32_t mode); //WDT鐪嬮棬鐙楀垵濮嬪寲 +void WDT_Start(WDT_TypeDef * WDTx); //鍚姩鎸囧畾WDT锛屽紑濮嬪掕鏃 +void WDT_Stop(WDT_TypeDef * WDTx); //鍏抽棴鎸囧畾WDT锛屽仠姝㈠掕鏃 -void WDT_Feed(WDT_TypeDef * WDTx); //喂狗,重新从装载值开始倒计时 +void WDT_Feed(WDT_TypeDef * WDTx); //鍠傜嫍锛岄噸鏂颁粠瑁呰浇鍊煎紑濮嬪掕鏃 -int32_t WDT_GetValue(WDT_TypeDef * WDTx); //获取指定看门狗定时器的当前倒计时值 +int32_t WDT_GetValue(WDT_TypeDef * WDTx); //鑾峰彇鎸囧畾鐪嬮棬鐙楀畾鏃跺櫒鐨勫綋鍓嶅掕鏃跺 -void WDT_INTClr(WDT_TypeDef * WDTx); //中断标志清除 -uint32_t WDT_INTStat(WDT_TypeDef * WDTx); //中断状态查询 +void WDT_INTClr(WDT_TypeDef * WDTx); //涓柇鏍囧織娓呴櫎 +uint32_t WDT_INTStat(WDT_TypeDef * WDTx); //涓柇鐘舵佹煡璇 #endif //__SWM320_WDT_H__