diff --git a/bsp/board/bl702/board.c b/bsp/board/bl702/board.c index 9714a8a6..7728d722 100644 --- a/bsp/board/bl702/board.c +++ b/bsp/board/bl702/board.c @@ -199,6 +199,17 @@ static void board_pin_mux_init(void) hbn_gpio_mask &= ~(1 << (af_pin_table[i].pin - 9)); } continue; + } else if ((af_pin_table[i].func == GPIO_FUN_USB) || (af_pin_table[i].func == GPIO_FUN_DAC) || (af_pin_table[i].func == GPIO_FUN_ADC)) { + /*if analog func , for usb、adc、dac*/ + gpio_cfg.gpioFun = GPIO_FUN_ANALOG; + gpio_cfg.gpioMode = GPIO_MODE_ANALOG; + gpio_cfg.pullType = GPIO_PULL_NONE; + } else if ((af_pin_table[i].func & 0xF0) == 0xF0) { + /*if uart func*/ + gpio_cfg.gpioFun = GPIO_FUN_UART; + uint8_t sig = af_pin_table[i].func & 0x07; + /*link to one uart sig*/ + GLB_UART_Fun_Sel((gpio_cfg.gpioPin % 8), sig); } else if (af_pin_table[i].func == GPIO_FUN_PWM) { /*if pwm func*/ gpio_cfg.pullType = GPIO_PULL_DOWN; @@ -212,17 +223,6 @@ static void board_pin_mux_init(void) gpio_cfg.pullType = GPIO_PULL_NONE; gpio_cfg.gpioMode = GPIO_MODE_OUTPUT; gpio_cfg.gpioFun = GPIO_FUN_QDEC; - } else if ((af_pin_table[i].func == GPIO_FUN_USB) || (af_pin_table[i].func == GPIO_FUN_DAC) || (af_pin_table[i].func == GPIO_FUN_ADC)) { - /*if analog func , for usb、adc、dac*/ - gpio_cfg.gpioFun = GPIO_FUN_ANALOG; - gpio_cfg.gpioMode = GPIO_MODE_ANALOG; - gpio_cfg.pullType = GPIO_PULL_NONE; - } else if ((af_pin_table[i].func & 0x70) == 0x70) { - /*if uart func*/ - gpio_cfg.gpioFun = GPIO_FUN_UART; - uint8_t sig = af_pin_table[i].func & 0x07; - /*link to one uart sig*/ - GLB_UART_Fun_Sel((gpio_cfg.gpioPin % 8), sig); } else if (af_pin_table[i].func == GPIO_FUN_CLK_OUT) { if (af_pin_table[i].pin % 2) { /*odd gpio output clock*/ @@ -302,12 +302,20 @@ void bl_show_info(void) #if 0 MSG("root clock:%dM\r\n", system_clock_get(SYSTEM_CLOCK_ROOT_CLOCK) / 1000000); /*root clock before f_div*/ + MSG("fclk clock:%dM\r\n", system_clock_get(SYSTEM_CLOCK_FCLK) / 1000000); /*after f_div,this is system core clock*/ MSG("bclk clock:%dM\r\n", system_clock_get(SYSTEM_CLOCK_BCLK) / 1000000); MSG("uart clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_UART) / 1000000); MSG("spi clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_SPI) / 1000000); MSG("i2c clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_I2C) / 1000000); + MSG("adc clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_ADC) / 1000000); + MSG("dac clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_DAC) / 1000000); + MSG("i2s clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_I2S) / 1000000); + MSG("pwm clock:%dhz\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_PWM)); + MSG("cam clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_CAM) / 1000000); + MSG("timer0 clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_TIMER0) / 1000000); + MSG("timer1 clock:%dM\r\n", peripheral_clock_get(PERIPHERAL_CLOCK_TIMER1) / 1000000); #endif } diff --git a/drivers/bl702_driver/std_drv/inc/bl702_gpio.h b/drivers/bl702_driver/std_drv/inc/bl702_gpio.h index 8f1bd38e..519adfab 100644 --- a/drivers/bl702_driver/std_drv/inc/bl702_gpio.h +++ b/drivers/bl702_driver/std_drv/inc/bl702_gpio.h @@ -127,9 +127,6 @@ typedef enum { GPIO_FUN_PWM = 8, GPIO_FUN_CAM = 9, GPIO_FUN_ANALOG = 10, - GPIO_FUN_USB = 10, - GPIO_FUN_DAC = 10, - GPIO_FUN_ADC = 10, GPIO_FUN_GPIO = 11, GPIO_FUN_RF_TEST = 12, GPIO_FUN_SCAN = 13, @@ -141,32 +138,35 @@ typedef enum { GPIO_FUN_ETHER_MAC = 19, GPIO_FUN_EMAC = 19, GPIO_FUN_QDEC = 20, - GPIO_FUN_QDEC_LED = 24, GPIO_FUN_KEY_SCAN_IN = 21, GPIO_FUN_KEY_SCAN_ROW = 21, GPIO_FUN_KEY_SCAN_DRIVE = 22, GPIO_FUN_KEY_SCAN_COL = 22, GPIO_FUN_CAM_MISC = 23, - GPIO_FUN_UART0_RTS = 0x70, - GPIO_FUN_UART0_CTS = 0x71, - GPIO_FUN_UART0_TX = 0x72, - GPIO_FUN_UART0_RX = 0x73, - GPIO_FUN_UART1_RTS = 0x74, - GPIO_FUN_UART1_CTS = 0x75, - GPIO_FUN_UART1_TX = 0x76, - GPIO_FUN_UART1_RX = 0x77, - GPIO_FUN_GPIO_OUTPUT_UP = 240, - GPIO_FUN_GPIO_OUTPUT_DOWN = 241, - GPIO_FUN_GPIO_OUTPUT_NONE = 242, - GPIO_FUN_GPIO_INPUT_UP = 243, - GPIO_FUN_GPIO_INPUT_DOWN = 244, - GPIO_FUN_GPIO_INPUT_NONE = 245, - GPIO_FUN_GPIO_EXTI_RISING_EDGE = 246, - GPIO_FUN_GPIO_EXTI_FALLING_EDGE = 247, - GPIO_FUN_GPIO_EXTI_HIGH_LEVEL = 248, - GPIO_FUN_GPIO_EXTI_LOW_LEVEL = 249, - GPIO_FUN_WAKEUP = 250, - GPIO_FUN_UNUSED = 255 + GPIO_FUN_USB = 0xD0, + GPIO_FUN_DAC = 0xD1, + GPIO_FUN_ADC = 0xD2, + GPIO_FUN_QDEC_LED = 0xD3, + GPIO_FUN_GPIO_OUTPUT_UP = 0xE0, + GPIO_FUN_GPIO_OUTPUT_DOWN = 0xE1, + GPIO_FUN_GPIO_OUTPUT_NONE = 0xE2, + GPIO_FUN_GPIO_INPUT_UP = 0xE3, + GPIO_FUN_GPIO_INPUT_DOWN = 0xE4, + GPIO_FUN_GPIO_INPUT_NONE = 0xE5, + GPIO_FUN_GPIO_EXTI_RISING_EDGE = 0xE6, + GPIO_FUN_GPIO_EXTI_FALLING_EDGE = 0xE7, + GPIO_FUN_GPIO_EXTI_HIGH_LEVEL = 0xE8, + GPIO_FUN_GPIO_EXTI_LOW_LEVEL = 0xE9, + GPIO_FUN_UART0_RTS = 0xF0, + GPIO_FUN_UART0_CTS = 0xF1, + GPIO_FUN_UART0_TX = 0xF2, + GPIO_FUN_UART0_RX = 0xF3, + GPIO_FUN_UART1_RTS = 0xF4, + GPIO_FUN_UART1_CTS = 0xF5, + GPIO_FUN_UART1_TX = 0xF6, + GPIO_FUN_UART1_RX = 0xF7, + GPIO_FUN_WAKEUP = 0xFE, + GPIO_FUN_UNUSED = 0xFF } GLB_GPIO_FUNC_Type; typedef struct