From e4b728c7ec3d962dd87db2f57e59669c35a94687 Mon Sep 17 00:00:00 2001 From: jianzhen guo Date: Thu, 2 Nov 2023 19:59:13 +0800 Subject: [PATCH] [Update] Update code to fix compilation issues. --- .../board/halley6/include/x16xx_hal_conf.h | 5 +++ hardware/chip/x1600/hal/drv_uart.c | 31 ++++++++++++------- hardware/chip/x1600/hal/lcd/drv_dpu.c | 2 -- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/hardware/board/halley6/include/x16xx_hal_conf.h b/hardware/board/halley6/include/x16xx_hal_conf.h index 6645eaa8..975b828e 100644 --- a/hardware/board/halley6/include/x16xx_hal_conf.h +++ b/hardware/board/halley6/include/x16xx_hal_conf.h @@ -23,6 +23,7 @@ #define HAL_USB_ENABLED #define HAL_AIC_ENABLED #define HAL_LCD_ENABLED +#define HAL_SDIO_ENABLED /* 系统时钟配配置,通过工具生成,随开发板或者平台变化.*/ #include @@ -95,6 +96,10 @@ #include "x16xx_hal_lcd.h" #endif +#ifdef HAL_SDIO_ENABLED +#include "sdio.h" +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/hardware/chip/x1600/hal/drv_uart.c b/hardware/chip/x1600/hal/drv_uart.c index 53cf26c6..35ae867b 100644 --- a/hardware/chip/x1600/hal/drv_uart.c +++ b/hardware/chip/x1600/hal/drv_uart.c @@ -78,7 +78,7 @@ int32_t hal_uart_init(uart_dev_t *uart) uart_device->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; }else { if(uart->port > 1) { - prom_printk("UART2 UART3 does not support hardware flow control!\n"); + printf("UART2 UART3 does not support hardware flow control!\n"); return -1; } else uart_device->handle.Init.HwFlowCtl = UART_HWCONTROL_RTS_CTS; @@ -86,8 +86,6 @@ int32_t hal_uart_init(uart_dev_t *uart) UART_HandleTypeDef *handle = &uart_device->handle; - ll_request_irq(uart_device->IRQ, HAL_UART_IRQHandler, handle); - switch(uart->port){ case 0: CPM_GATE_Enable(CPM_Instance, CPM_CLKID_UART0); @@ -141,7 +139,19 @@ int32_t hal_uart_init(uart_dev_t *uart) break; } + /* Tick init */ + if(HAL_OK != HAL_InitTick()) { + printf("Init Tick Error\n"); + return -1; + } + + if (HAL_UART_DeInit(handle) != HAL_OK) { + printf("UART DeInit Error\n"); + return -1; + } + if (HAL_UART_Init(handle) != HAL_OK) { + printf("UART Init Error\n"); return -1; } @@ -157,7 +167,7 @@ int32_t hal_uart_finalize(uart_dev_t *uart) ret = HAL_UART_DeInit(handle); if (ret){ - prom_printk("uart%d device close deinit failed!\n",uart_device->port); + printf("uart%d device close deinit failed!\n",uart_device->port); return ret; } @@ -170,7 +180,8 @@ int32_t hal_uart_send(uart_dev_t *uart, const void *data, struct ingenic_uart_dev *uart_device = get_uart_dev(uart->port); UART_HandleTypeDef *handle = &uart_device->handle; - if(HAL_OK != HAL_UART_Transmit(handle, (uint8_t *)data, count, HAL_MAX_DELAY)) { + if(HAL_OK != HAL_UART_Transmit(handle, (uint8_t *)data, count, timeout)) { + printf("UART Transmiet Errot\n"); return -1; } @@ -185,12 +196,10 @@ int32_t hal_uart_recv_II(uart_dev_t *uart, void *data, uint32_t count, UART_HandleTypeDef *handle = &uart_device->handle; /*启动一次 uart 传输*/ - HAL_UART_Receive_IT(handle, data, count); - - /*等 uart 传输完成或者超时*/ - while((handle->RxState != HAL_UART_STATE_READY) && --timeout) - HAL_Delay(1); - ; + if(HAL_OK != HAL_UART_Receive(handle, (uint8_t *)data, count, timeout)) { + printf("UART Receive Error\n"); + return -1; + } *received = count - handle->RxXferCount; diff --git a/hardware/chip/x1600/hal/lcd/drv_dpu.c b/hardware/chip/x1600/hal/lcd/drv_dpu.c index 5cd27014..890c0560 100644 --- a/hardware/chip/x1600/hal/lcd/drv_dpu.c +++ b/hardware/chip/x1600/hal/lcd/drv_dpu.c @@ -11,7 +11,6 @@ #include #include -HAL_LockTypeDef lcd_lock; LCD_HandleTypeDef LCD_Handle; extern LL_CPM_CGU_ConfigTypeDef LcdCguConfig; @@ -40,7 +39,6 @@ int8_t ingenic_dpu_init(void) LCD_Handle.desc[0] = &desc; LCD_Handle.desc[1] = &desc1; LCD_Handle.desc[2] = &desc2; - LCD_Handle.lock = &lcd_lock; for(i = 0; i < lcdc_data.frame_mem * MAX_SRDMA_DESC_NUM; i++){ framebuffer[i] = 0xffffff; -- Gitee