From 31697c14f238c631cc3292bd4ba772d5386910b1 Mon Sep 17 00:00:00 2001 From: Liu_Weichao Date: Tue, 15 Mar 2022 11:08:52 +0800 Subject: [PATCH] fix Ubiquitous/XiZi/board/ok1052-c compile error --- Ubiquitous/XiZi/board/ok1052-c/board.c | 10 + .../board/ok1052-c/third_party_driver/Kconfig | 6 +- .../ok1052-c/third_party_driver/Makefile | 1 - .../common/fsl_debug_console.c | 1123 ----------------- .../third_party_driver/include/connect_adc.h | 2 +- .../third_party_driver/include/connect_gpio.h | 2 +- .../third_party_driver/include/connect_i2c.h | 2 +- .../third_party_driver/include/connect_rtc.h | 2 +- .../third_party_driver/include/connect_sdio.h | 2 +- .../third_party_driver/include/connect_spi.h | 2 +- .../third_party_driver/include/connect_usb.h | 2 +- .../include/fsl_debug_console.h | 213 ---- .../include/fsl_debug_console_conf.h | 158 --- .../include/serial_manager.h | 548 -------- .../include/serial_port_uart.h | 55 - .../include/serial_port_usb.h | 76 -- .../ok1052-c/third_party_driver/spi/Makefile | 6 +- .../third_party_driver/include/connect_gpio.h | 2 +- 18 files changed, 26 insertions(+), 2186 deletions(-) delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/common/fsl_debug_console.c delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console.h delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console_conf.h delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_manager.h delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_uart.h delete mode 100755 Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_usb.h diff --git a/Ubiquitous/XiZi/board/ok1052-c/board.c b/Ubiquitous/XiZi/board/ok1052-c/board.c index 55786560d..155d6a376 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/board.c +++ b/Ubiquitous/XiZi/board/ok1052-c/board.c @@ -66,11 +66,21 @@ int MountSDCard(void) #include "fsl_gpio.h" #include "fsl_lpuart.h" +#ifdef BSP_USING_LWIP #include +#endif +#ifdef BSP_USING_LPUART #include +#endif +#ifdef BSP_USING_ADC #include +#endif +#ifdef BSP_USING_SPI #include +#endif +#ifdef BSP_USING_RTC #include +#endif #define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority 4 bits for subpriority */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Kconfig b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Kconfig index ed032333a..0ec9c3aa4 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Kconfig +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Kconfig @@ -22,7 +22,7 @@ menuconfig BSP_USING_GPIO menuconfig BSP_USING_I2C bool "Using I2C device" - default y + default n select RESOURCES_I2C if BSP_USING_I2C @@ -31,7 +31,7 @@ menuconfig BSP_USING_I2C menuconfig BSP_USING_ADC bool "Using ADC device" - default y + default n select RESOURCES_ADC if BSP_USING_ADC @@ -40,7 +40,7 @@ menuconfig BSP_USING_ADC menuconfig BSP_USING_SPI bool "Using SPI device" - default y + default n select RESOURCES_SPI if BSP_USING_SPI diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Makefile b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Makefile index 3f9e5692f..81e730f3b 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Makefile +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/Makefile @@ -28,7 +28,6 @@ ifeq ($(CONFIG_BSP_USING_RTC),y) SRC_DIR += rtc endif - ifeq ($(CONFIG_BSP_USING_SDIO),y) SRC_DIR += sdio endif diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/common/fsl_debug_console.c b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/common/fsl_debug_console.c deleted file mode 100755 index 4a0ccd30f..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/common/fsl_debug_console.c +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * This is a modified version of the file printf.c, which was distributed - * by Motorola as part of the M5407C3BOOT.zip package used to initialize - * the M5407C3 evaluation board. - * - * Copyright: - * 1999-2000 MOTOROLA, INC. All Rights Reserved. - * You are hereby granted a copyright license to use, modify, and - * distribute the SOFTWARE so long as this entire notice is - * retained without alteration in any modified and/or redistributed - * versions, and that such modified versions are clearly identified - * as such. No licenses are granted by implication, estoppel or - * otherwise under any patents or trademarks of Motorola, Inc. This - * software is provided on an "AS IS" basis and without warranty. - * - * To the maximum extent permitted by applicable law, MOTOROLA - * DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR - * PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE - * SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY - * ACCOMPANYING WRITTEN MATERIALS. - * - * To the maximum extent permitted by applicable law, IN NO EVENT - * SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING - * WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS - * INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY - * LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. - * - * Motorola assumes no responsibility for the maintenance and support - * of this software - - * Copyright (c) 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2019 NXP - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#if defined(__CC_ARM) || defined(__ARMCC_VERSION) -#include -#endif - -#ifdef FSL_RTOS_FREE_RTOS -#include "FreeRTOS.h" -#include "semphr.h" -#include "task.h" -#endif - -#include "fsl_debug_console_conf.h" -#include "fsl_str.h" - -#include "fsl_common.h" -//#include "serial_manager.h" - -#include "fsl_debug_console.h" - -/******************************************************************************* - * Definitions - ******************************************************************************/ -#ifndef NDEBUG -#if (defined(DEBUG_CONSOLE_ASSERT_DISABLE) && (DEBUG_CONSOLE_ASSERT_DISABLE > 0U)) -#undef assert -#define assert(n) -#endif -#endif - -#if SDK_DEBUGCONSOLE -#define DEBUG_CONSOLE_FUNCTION_PREFIX -#else -#define DEBUG_CONSOLE_FUNCTION_PREFIX static -#endif - -/*! @brief character backspace ASCII value */ -#define DEBUG_CONSOLE_BACKSPACE 127U - -/* lock definition */ -#if (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS) - -static SemaphoreHandle_t s_debugConsoleReadSemaphore; -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) -static SemaphoreHandle_t s_debugConsoleReadWaitSemaphore; -#endif - -#elif (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_BM) - -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) -static volatile uint8_t s_debugConsoleReadWaitSemaphore; -#endif - -#else - -#endif /* DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS */ - -/*! @brief get current runing environment is ISR or not */ -#ifdef __CA7_REV -#define IS_RUNNING_IN_ISR() SystemGetIRQNestingLevel() -#else -#define IS_RUNNING_IN_ISR() __get_IPSR() -#endif /* __CA7_REV */ - -/* semaphore definition */ -#if (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS) - -/* mutex semaphore */ -#define DEBUG_CONSOLE_CREATE_MUTEX_SEMAPHORE(mutex) ((mutex) = xSemaphoreCreateMutex()) - -/* clang-format off */ -#define DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(mutex) \ -{ \ - if (IS_RUNNING_IN_ISR() == 0U) \ - { \ - (void)xSemaphoreGive(mutex); \ - } \ -} - -#define DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_BLOCKING(mutex) \ -{ \ - if (IS_RUNNING_IN_ISR() == 0U) \ - { \ - (void)xSemaphoreTake(mutex, portMAX_DELAY); \ - } \ -} - -#define DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_NONBLOCKING(mutex, result) \ -{ \ - if (IS_RUNNING_IN_ISR() == 0U) \ - { \ - result = xSemaphoreTake(mutex, 0U); \ - } \ - else \ - { \ - result = 1U; \ - } \ -} -/* clang-format on */ - -/* Binary semaphore */ -#define DEBUG_CONSOLE_CREATE_BINARY_SEMAPHORE(binary) ((binary) = xSemaphoreCreateBinary()) -#define DEBUG_CONSOLE_TAKE_BINARY_SEMAPHORE_BLOCKING(binary) ((void)xSemaphoreTake(binary, portMAX_DELAY)) -#define DEBUG_CONSOLE_GIVE_BINARY_SEMAPHORE_FROM_ISR(binary) ((void)xSemaphoreGiveFromISR(binary, NULL)) - -#elif (DEBUG_CONSOLE_SYNCHRONIZATION_BM == DEBUG_CONSOLE_SYNCHRONIZATION_MODE) - -#define DEBUG_CONSOLE_CREATE_MUTEX_SEMAPHORE(mutex) -#define DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_BLOCKING(mutex) -#define DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(mutex) -#define DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_NONBLOCKING(mutex, result) (result = 1U) - -#define DEBUG_CONSOLE_CREATE_BINARY_SEMAPHORE(binary) -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -#define DEBUG_CONSOLE_TAKE_BINARY_SEMAPHORE_BLOCKING(binary) \ - { \ - while (!binary) \ - { \ - } \ - binary = false; \ - } -#define DEBUG_CONSOLE_GIVE_BINARY_SEMAPHORE_FROM_ISR(binary) (binary = true) -#else -#define DEBUG_CONSOLE_TAKE_BINARY_SEMAPHORE_BLOCKING(binary) -#define DEBUG_CONSOLE_GIVE_BINARY_SEMAPHORE_FROM_ISR(binary) -#endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */ - -/* add other implementation here - *such as : - * #elif(DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DDEBUG_CONSOLE_SYNCHRONIZATION_xxx) - */ - -#else - -#error RTOS type is not defined by DEBUG_CONSOLE_SYNCHRONIZATION_MODE. - -#endif /* DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS */ - -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -/* receive state structure */ -typedef struct _debug_console_write_ring_buffer -{ - uint32_t ringBufferSize; - volatile uint32_t ringHead; - volatile uint32_t ringTail; - uint8_t ringBuffer[DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN]; -} debug_console_write_ring_buffer_t; -#endif - -typedef struct _debug_console_state_struct -{ - uint8_t serialHandleBuffer[SERIAL_MANAGER_HANDLE_SIZE]; - serial_handle_t serialHandle; /*!< serial manager handle */ -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING - debug_console_write_ring_buffer_t writeRingBuffer; - uint8_t readRingBuffer[DEBUG_CONSOLE_RECEIVE_BUFFER_LEN]; -#endif - uint8_t serialWriteHandleBuffer[SERIAL_MANAGER_WRITE_HANDLE_SIZE]; - uint8_t serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; -} debug_console_state_struct_t; - -/******************************************************************************* - * Variables - ******************************************************************************/ - -/*! @brief Debug console state information. */ -static debug_console_state_struct_t s_debugConsoleState; -serial_handle_t g_serialHandle; /*!< serial manager handle */ - -/******************************************************************************* - * Prototypes - ******************************************************************************/ -/*! - * @brief This is a printf call back function which is used to relocate the log to buffer - * or print the log immediately when the local buffer is full. - * - * @param[in] buf Buffer to store log. - * @param[in] indicator Buffer index. - * @param[in] val Target character to store. - * @param[in] len length of the character - * - */ -#if SDK_DEBUGCONSOLE -static void DbgConsole_PrintCallback(char *buf, int32_t *indicator, char dbgVal, int len); -#endif - -status_t DbgConsole_ReadOneCharacter(uint8_t *ch); -int DbgConsole_SendData(uint8_t *ch, size_t size); -int DbgConsole_SendDataReliable(uint8_t *ch, size_t size); -int DbgConsole_ReadLine(uint8_t *buf, size_t size); -int DbgConsole_ReadCharacter(uint8_t *ch); - -#if ((SDK_DEBUGCONSOLE > 0U) || \ - ((SDK_DEBUGCONSOLE == 0U) && defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) && \ - (defined(DEBUG_CONSOLE_TX_RELIABLE_ENABLE) && (DEBUG_CONSOLE_TX_RELIABLE_ENABLE > 0U)))) -DEBUG_CONSOLE_FUNCTION_PREFIX status_t DbgConsole_Flush(void); -#endif -/******************************************************************************* - * Code - ******************************************************************************/ - -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - -static void DbgConsole_SerialManagerTxCallback(void *callbackParam, - serial_manager_callback_message_t *message, - serial_manager_status_t status) -{ - debug_console_state_struct_t *ioState; - uint32_t sendDataLength; - - if ((NULL == callbackParam) || (NULL == message)) - { - return; - } - - ioState = (debug_console_state_struct_t *)callbackParam; - - ioState->writeRingBuffer.ringTail += message->length; - if (ioState->writeRingBuffer.ringTail >= ioState->writeRingBuffer.ringBufferSize) - { - ioState->writeRingBuffer.ringTail = 0U; - } - - if (kStatus_SerialManager_Success == status) - { - if (ioState->writeRingBuffer.ringTail != ioState->writeRingBuffer.ringHead) - { - if (ioState->writeRingBuffer.ringHead > ioState->writeRingBuffer.ringTail) - { - sendDataLength = ioState->writeRingBuffer.ringHead - ioState->writeRingBuffer.ringTail; - } - else - { - sendDataLength = ioState->writeRingBuffer.ringBufferSize - ioState->writeRingBuffer.ringTail; - } - - (void)SerialManager_WriteNonBlocking( - ((serial_write_handle_t)&ioState->serialWriteHandleBuffer[0]), - &ioState->writeRingBuffer.ringBuffer[ioState->writeRingBuffer.ringTail], sendDataLength); - } - } - else if (kStatus_SerialManager_Canceled == status) - { - ioState->writeRingBuffer.ringTail = 0U; - ioState->writeRingBuffer.ringHead = 0U; - } - else - { - /*MISRA rule 16.4*/ - } -} - -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - -static void DbgConsole_SerialManagerRxCallback(void *callbackParam, - serial_manager_callback_message_t *message, - serial_manager_status_t status) -{ - if ((NULL == callbackParam) || (NULL == message)) - { - return; - } - - if (kStatus_SerialManager_Notify == status) - { - } - else if (kStatus_SerialManager_Success == status) - { - /* release s_debugConsoleReadWaitSemaphore from RX callback */ - DEBUG_CONSOLE_GIVE_BINARY_SEMAPHORE_FROM_ISR(s_debugConsoleReadWaitSemaphore); - } - else - { - /*MISRA rule 16.4*/ - } -} -#endif - -#endif - -status_t DbgConsole_ReadOneCharacter(uint8_t *ch) -{ -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) && \ - (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_BM) && defined(OSA_USED) - return kStatus_Fail; -#else - status_t status = (status_t)kStatus_SerialManager_Error; - -/* recieve one char every time */ -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - status = (status_t)SerialManager_ReadNonBlocking( - ((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0]), ch, 1); -#else - status = (status_t)SerialManager_ReadBlocking( - ((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0]), ch, 1); -#endif - if ((status_t)kStatus_SerialManager_Success != status) - { - return (status_t)kStatus_Fail; - } - /* wait s_debugConsoleReadWaitSemaphore from RX callback */ - DEBUG_CONSOLE_TAKE_BINARY_SEMAPHORE_BLOCKING(s_debugConsoleReadWaitSemaphore); - - return (status_t)kStatus_Success; -#endif - -#else - - return (status_t)kStatus_Fail; - -#endif -} - -#if DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION -static status_t DbgConsole_EchoCharacter(uint8_t *ch, bool isGetChar, int *index) -{ - /* Due to scanf take \n and \r as end of string,should not echo */ - if (((*ch != (uint8_t)'\r') && (*ch != (uint8_t)'\n')) || (isGetChar)) - { - /* recieve one char every time */ - if (1 != DbgConsole_SendDataReliable(ch, 1U)) - { - return (status_t)kStatus_Fail; - } - } - - if ((!isGetChar) && (index != NULL)) - { - if (DEBUG_CONSOLE_BACKSPACE == *ch) - { - if ((*index >= 2)) - { - *index -= 2; - } - else - { - *index = 0; - } - } - } - - return (status_t)kStatus_Success; -} -#endif - -int DbgConsole_SendData(uint8_t *ch, size_t size) -{ - status_t status = (status_t)kStatus_SerialManager_Error; -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - uint32_t sendDataLength; - int txBusy = 0; -#endif - assert(NULL != ch); - assert(0 != size); - -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - uint32_t regPrimask = DisableGlobalIRQ(); - if (s_debugConsoleState.writeRingBuffer.ringHead != s_debugConsoleState.writeRingBuffer.ringTail) - { - txBusy = 1; - sendDataLength = - (s_debugConsoleState.writeRingBuffer.ringHead + s_debugConsoleState.writeRingBuffer.ringBufferSize - - s_debugConsoleState.writeRingBuffer.ringTail) % - s_debugConsoleState.writeRingBuffer.ringBufferSize; - } - else - { - sendDataLength = 0U; - } - sendDataLength = s_debugConsoleState.writeRingBuffer.ringBufferSize - sendDataLength - 1; - if (sendDataLength <= size) - { - EnableGlobalIRQ(regPrimask); - return -1; - } - for (int i = 0; i < (int)size; i++) - { - s_debugConsoleState.writeRingBuffer.ringBuffer[s_debugConsoleState.writeRingBuffer.ringHead++] = ch[i]; - if (s_debugConsoleState.writeRingBuffer.ringHead >= s_debugConsoleState.writeRingBuffer.ringBufferSize) - { - s_debugConsoleState.writeRingBuffer.ringHead = 0U; - } - } - - status = (status_t)kStatus_SerialManager_Success; - - if (txBusy == 0) - { - if (s_debugConsoleState.writeRingBuffer.ringHead > s_debugConsoleState.writeRingBuffer.ringTail) - { - sendDataLength = - s_debugConsoleState.writeRingBuffer.ringHead - s_debugConsoleState.writeRingBuffer.ringTail; - } - else - { - sendDataLength = - s_debugConsoleState.writeRingBuffer.ringBufferSize - s_debugConsoleState.writeRingBuffer.ringTail; - } - - status = (status_t)SerialManager_WriteNonBlocking( - ((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0]), - &s_debugConsoleState.writeRingBuffer.ringBuffer[s_debugConsoleState.writeRingBuffer.ringTail], - sendDataLength); - } - EnableGlobalIRQ(regPrimask); -#else - status = (status_t)SerialManager_WriteBlocking( - ((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0]), ch, size); -#endif - return (((status_t)kStatus_Success == status) ? (int)size : -1); -} - -int DbgConsole_SendDataReliable(uint8_t *ch, size_t size) -{ -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) -#if (defined(DEBUG_CONSOLE_TX_RELIABLE_ENABLE) && (DEBUG_CONSOLE_TX_RELIABLE_ENABLE > 0U)) - status_t status = kStatus_SerialManager_Error; - uint32_t sendDataLength; - uint32_t totalLength = size; - int sentLength; -#endif /* DEBUG_CONSOLE_TX_RELIABLE_ENABLE */ -#else - status_t status = kStatus_SerialManager_Error; -#endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */ - - assert(NULL != ch); - assert(0 != size); - -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - -#if (defined(DEBUG_CONSOLE_TX_RELIABLE_ENABLE) && (DEBUG_CONSOLE_TX_RELIABLE_ENABLE > 0U)) - do - { - uint32_t regPrimask = DisableGlobalIRQ(); - if (s_debugConsoleState.writeRingBuffer.ringHead != s_debugConsoleState.writeRingBuffer.ringTail) - { - sendDataLength = - (s_debugConsoleState.writeRingBuffer.ringHead + s_debugConsoleState.writeRingBuffer.ringBufferSize - - s_debugConsoleState.writeRingBuffer.ringTail) % - s_debugConsoleState.writeRingBuffer.ringBufferSize; - } - else - { - sendDataLength = 0U; - } - sendDataLength = s_debugConsoleState.writeRingBuffer.ringBufferSize - sendDataLength - 1U; - - if (sendDataLength > 0U) - { - if (sendDataLength > totalLength) - { - sendDataLength = totalLength; - } - - sentLength = DbgConsole_SendData(&ch[size - totalLength], sendDataLength); - if (sentLength > 0) - { - totalLength = totalLength - (uint32_t)sentLength; - } - } - EnableGlobalIRQ(regPrimask); - - if (totalLength != 0U) - { - status = DbgConsole_Flush(); - if ((status_t)kStatus_Success != status) - { - break; - } - } - } while (totalLength != 0U); - return (status_t)(uint32_t)((uint32_t)size - totalLength); -#else - return DbgConsole_SendData(ch, size); -#endif /* DEBUG_CONSOLE_TX_RELIABLE_ENABLE */ - -#else - status = (status_t)SerialManager_WriteBlocking( - ((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0]), ch, size); - return (((status_t)kStatus_Success == status) ? (int)size : -1); -#endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */ -} - -int DbgConsole_ReadLine(uint8_t *buf, size_t size) -{ - int i = 0; - - assert(buf != NULL); - - /* take mutex lock function */ - DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_BLOCKING(s_debugConsoleReadSemaphore); - - do - { - /* recieve one char every time */ - if ((status_t)kStatus_Success != DbgConsole_ReadOneCharacter(&buf[i])) - { - /* release mutex lock function */ - DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(s_debugConsoleReadSemaphore); - i = -1; - break; - } -#if DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION - (void)DbgConsole_EchoCharacter(&buf[i], false, &i); -#endif - /* analysis data */ - if (((uint8_t)'\r' == buf[i]) || ((uint8_t)'\n' == buf[i])) - { - /* End of Line. */ - if (0 == i) - { - buf[i] = (uint8_t)'\0'; - continue; - } - else - { - break; - } - } - i++; - } while (i < (int)size); - - /* get char should not add '\0'*/ - if (i == (int)size) - { - buf[i] = (uint8_t)'\0'; - } - else - { - buf[i + 1] = (uint8_t)'\0'; - } - - /* release mutex lock function */ - DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(s_debugConsoleReadSemaphore); - - return i; -} - -int DbgConsole_ReadCharacter(uint8_t *ch) -{ - int ret; - - assert(ch); - - /* take mutex lock function */ - DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_BLOCKING(s_debugConsoleReadSemaphore); - /* read one character */ - if ((status_t)kStatus_Success == DbgConsole_ReadOneCharacter(ch)) - { - ret = 1; -#if DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION - (void)DbgConsole_EchoCharacter(ch, true, NULL); -#endif - } - else - { - ret = -1; - } - - /* release mutex lock function */ - DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(s_debugConsoleReadSemaphore); - - return ret; -} - -#if SDK_DEBUGCONSOLE -static void DbgConsole_PrintCallback(char *buf, int32_t *indicator, char dbgVal, int len) -{ - int i = 0; - - for (i = 0; i < len; i++) - { - if (((uint32_t)*indicator + 1UL) >= DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN) - { - (void)DbgConsole_SendDataReliable((uint8_t *)buf, (uint32_t)(*indicator)); - *indicator = 0; - } - - buf[*indicator] = dbgVal; - (*indicator)++; - } -} -#endif - -/*************Code for DbgConsole Init, Deinit, Printf, Scanf *******************************/ - -/* See fsl_debug_console.h for documentation of this function. */ -status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq) -{ - serial_manager_config_t serialConfig; - status_t status = (status_t)kStatus_SerialManager_Error; - -#if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U)) - serial_port_uart_config_t uartConfig = { - .instance = instance, - .clockRate = clkSrcFreq, - .baudRate = baudRate, - .parityMode = kSerialManager_UartParityDisabled, - .stopBitCount = kSerialManager_UartOneStopBit, - .enableRx = 1, - .enableTx = 1, - }; -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U)) - serial_port_usb_cdc_config_t usbCdcConfig = { - .controllerIndex = (serial_port_usb_cdc_controller_index_t)instance, - }; -#endif - -#if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U)) - serial_port_swo_config_t swoConfig = { - .clockRate = clkSrcFreq, - .baudRate = baudRate, - .port = instance, - .protocol = kSerialManager_SwoProtocolNrz, - }; -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U)) - serial_port_usb_cdc_virtual_config_t usbCdcVirtualConfig = { - .controllerIndex = (serial_port_usb_cdc_virtual_controller_index_t)instance, - }; -#endif - serialConfig.type = device; -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - serialConfig.ringBuffer = &s_debugConsoleState.readRingBuffer[0]; - serialConfig.ringBufferSize = DEBUG_CONSOLE_RECEIVE_BUFFER_LEN; -#endif - - if (kSerialPort_Uart == device) - { -#if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U)) - serialConfig.portConfig = &uartConfig; -#else - return status; -#endif - } - else if (kSerialPort_UsbCdc == device) - { -#if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U)) - serialConfig.portConfig = &usbCdcConfig; -#else - return status; -#endif - } - else if (kSerialPort_Swo == device) - { -#if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U)) - serialConfig.portConfig = &swoConfig; -#else - return status; -#endif - } - else if (kSerialPort_UsbCdcVirtual == device) - { -#if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U)) - serialConfig.portConfig = &usbCdcVirtualConfig; -#else - return status; -#endif - } - else - { - return status; - } - - (void)memset(&s_debugConsoleState, 0, sizeof(s_debugConsoleState)); - -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - s_debugConsoleState.writeRingBuffer.ringBufferSize = DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN; -#endif - - s_debugConsoleState.serialHandle = (serial_handle_t)&s_debugConsoleState.serialHandleBuffer[0]; - status = (status_t)SerialManager_Init(s_debugConsoleState.serialHandle, &serialConfig); - - assert(kStatus_SerialManager_Success == status); - - DEBUG_CONSOLE_CREATE_MUTEX_SEMAPHORE(s_debugConsoleReadSemaphore); -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - DEBUG_CONSOLE_CREATE_BINARY_SEMAPHORE(s_debugConsoleReadWaitSemaphore); -#endif - - { - status = (status_t)SerialManager_OpenWriteHandle( - s_debugConsoleState.serialHandle, ((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0])); - assert(kStatus_SerialManager_Success == status); -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - (void)SerialManager_InstallTxCallback(((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0]), - DbgConsole_SerialManagerTxCallback, &s_debugConsoleState); -#endif - } - -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - { - status = (status_t)SerialManager_OpenReadHandle( - s_debugConsoleState.serialHandle, ((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0])); - assert(kStatus_SerialManager_Success == status); -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - (void)SerialManager_InstallRxCallback(((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0]), - DbgConsole_SerialManagerRxCallback, &s_debugConsoleState); -#endif - } -#endif - - g_serialHandle = s_debugConsoleState.serialHandle; - - return kStatus_Success; -} - -/* See fsl_debug_console.h for documentation of this function. */ -status_t DbgConsole_Deinit(void) -{ - { - if (s_debugConsoleState.serialHandle != NULL) - { - (void)SerialManager_CloseWriteHandle( - ((serial_write_handle_t)&s_debugConsoleState.serialWriteHandleBuffer[0])); - } - } -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - { - if (s_debugConsoleState.serialHandle != NULL) - { - (void)SerialManager_CloseReadHandle(((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0])); - } - } -#endif - return (status_t)kStatus_Success; -} - -#if ((SDK_DEBUGCONSOLE > 0U) || \ - ((SDK_DEBUGCONSOLE == 0U) && defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) && \ - (defined(DEBUG_CONSOLE_TX_RELIABLE_ENABLE) && (DEBUG_CONSOLE_TX_RELIABLE_ENABLE > 0U)))) -DEBUG_CONSOLE_FUNCTION_PREFIX status_t DbgConsole_Flush(void) -{ -#if defined(DEBUG_CONSOLE_TRANSFER_NON_BLOCKING) - -#if (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_BM) && defined(OSA_USED) - - if (s_debugConsoleState.writeRingBuffer.ringHead != s_debugConsoleState.writeRingBuffer.ringTail) - { - return (status_t)kStatus_Fail; - } - -#else - - while (s_debugConsoleState.writeRingBuffer.ringHead != s_debugConsoleState.writeRingBuffer.ringTail) - { -#if (DEBUG_CONSOLE_SYNCHRONIZATION_MODE == DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS) - if (0U == IS_RUNNING_IN_ISR()) - { - if (taskSCHEDULER_RUNNING == xTaskGetSchedulerState()) - { - vTaskDelay(1); - } - } - else - { - return (status_t)kStatus_Fail; - } -#endif - } - -#endif - -#endif - return (status_t)kStatus_Success; -} -#endif - -#if SDK_DEBUGCONSOLE -/* See fsl_debug_console.h for documentation of this function. */ -int DbgConsole_Printf(const char *formatString, ...) -{ - va_list ap; - int logLength = 0, dbgResult = 0; - char printBuf[DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN] = {'\0'}; - - if (NULL == g_serialHandle) - { - return 0; - } - - va_start(ap, formatString); - /* format print log first */ - logLength = StrFormatPrintf(formatString, ap, printBuf, DbgConsole_PrintCallback); - /* print log */ - dbgResult = DbgConsole_SendDataReliable((uint8_t *)printBuf, (size_t)logLength); - - va_end(ap); - - return dbgResult; -} - -/* See fsl_debug_console.h for documentation of this function. */ -int DbgConsole_Putchar(int ch) -{ - /* print char */ - return DbgConsole_SendDataReliable((uint8_t *)&ch, 1U); -} - -/* See fsl_debug_console.h for documentation of this function. */ -int DbgConsole_Scanf(char *formatString, ...) -{ - va_list ap; - int formatResult; - char scanfBuf[DEBUG_CONSOLE_SCANF_MAX_LOG_LEN + 1U] = {'\0'}; - - /* scanf log */ - (void)DbgConsole_ReadLine((uint8_t *)scanfBuf, DEBUG_CONSOLE_SCANF_MAX_LOG_LEN); - /* get va_list */ - va_start(ap, formatString); - /* format scanf log */ - formatResult = StrFormatScanf(scanfBuf, formatString, ap); - - va_end(ap); - - return formatResult; -} - -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -status_t DbgConsole_TryGetchar(char *ch) -{ -#if (defined(DEBUG_CONSOLE_RX_ENABLE) && (DEBUG_CONSOLE_RX_ENABLE > 0U)) - uint32_t length = 0; - status_t status = (status_t)kStatus_Fail; - - assert(ch); - - /* take mutex lock function */ - DEBUG_CONSOLE_TAKE_MUTEX_SEMAPHORE_BLOCKING(s_debugConsoleReadSemaphore); - - if (kStatus_SerialManager_Success == - SerialManager_TryRead(((serial_read_handle_t)&s_debugConsoleState.serialReadHandleBuffer[0]), (uint8_t *)ch, 1, - &length)) - { - if (length != 0U) - { -#if DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION - (void)DbgConsole_EchoCharacter((uint8_t *)ch, true, NULL); -#endif - status = (status_t)kStatus_Success; - } - } - /* release mutex lock function */ - DEBUG_CONSOLE_GIVE_MUTEX_SEMAPHORE(s_debugConsoleReadSemaphore); - return status; -#else - return (status_t)kStatus_Fail; -#endif -} -#endif - -/* See fsl_debug_console.h for documentation of this function. */ -int DbgConsole_Getchar(void) -{ - uint8_t ch = 0U; - - /* Get char */ - (void)DbgConsole_ReadCharacter(&ch); - - return (int)ch; -} - -#endif /* SDK_DEBUGCONSOLE */ - -/*************Code to support toolchain's printf, scanf *******************************/ -/* These function __write and __read is used to support IAR toolchain to printf and scanf*/ -#if (defined(__ICCARM__)) -#if defined(SDK_DEBUGCONSOLE_UART) -#pragma weak __write -size_t __write(int handle, const unsigned char *buffer, size_t size) -{ - if (buffer == 0) - { - /* - * This means that we should flush internal buffers. Since we don't we just return. - * (Remember, "handle" == -1 means that all handles should be flushed.) - */ - return 0; - } - - /* This function only writes to "standard out" and "standard err" for all other file handles it returns failure. */ - if ((handle != 1) && (handle != 2)) - { - return ((size_t)-1); - } - - /* Send data. */ - DbgConsole_SendDataReliable((uint8_t *)buffer, size); - - return size; -} - -#pragma weak __read -size_t __read(int handle, unsigned char *buffer, size_t size) -{ - uint8_t ch = 0U; - int actualSize = 0U; - - /* This function only reads from "standard in", for all other file handles it returns failure. */ - if (handle != 0) - { - return ((size_t)-1); - } - - /* Receive data.*/ - for (; size > 0; size--) - { - DbgConsole_ReadCharacter(&ch); - if (ch == 0) - { - break; - } - - *buffer++ = ch; - actualSize++; - } - - return actualSize; -} -#endif /* SDK_DEBUGCONSOLE_UART */ - -/* support LPC Xpresso with RedLib */ -#elif (defined(__REDLIB__)) - -#if (!SDK_DEBUGCONSOLE) && (defined(SDK_DEBUGCONSOLE_UART)) -int __attribute__((weak)) __sys_write(int handle, char *buffer, int size) -{ - if (buffer == 0) - { - /* return -1 if error. */ - return -1; - } - - /* This function only writes to "standard out" and "standard err" for all other file handles it returns failure. */ - if ((handle != 1) && (handle != 2)) - { - return -1; - } - - /* Send data. */ - DbgConsole_SendDataReliable((uint8_t *)buffer, size); - - return 0; -} - -int __attribute__((weak)) __sys_readc(void) -{ - char tmp; - - /* Receive data. */ - DbgConsole_ReadCharacter((uint8_t *)&tmp); - - return tmp; -} -#endif - -/* These function fputc and fgetc is used to support KEIL toolchain to printf and scanf*/ -#elif defined(__CC_ARM) || defined(__ARMCC_VERSION) -#if defined(SDK_DEBUGCONSOLE_UART) -#if defined(__CC_ARM) -struct __FILE -{ - int handle; - /* - * Whatever you require here. If the only file you are using is standard output using printf() for debugging, - * no file handling is required. - */ -}; -#endif - -/* FILE is typedef in stdio.h. */ -#pragma weak __stdout -#pragma weak __stdin -FILE __stdout; -FILE __stdin; - -#pragma weak fputc -int fputc(int ch, FILE *f) -{ - /* Send data. */ - return DbgConsole_SendDataReliable((uint8_t *)(&ch), 1); -} - -#pragma weak fgetc -int fgetc(FILE *f) -{ - char ch; - - /* Receive data. */ - DbgConsole_ReadCharacter((uint8_t *)&ch); - - return ch; -} - -/* - * Terminate the program, passing a return code back to the user. - * This function may not return. - */ -void _sys_exit(int returncode) -{ - while (1) - { - } -} - -/* - * Writes a character to the output channel. This function is used - * for last-resort error message output. - */ -void _ttywrch(int ch) -{ - char ench = ch; - DbgConsole_SendDataReliable((uint8_t *)(&ench), 1); -} - -char *_sys_command_string(char *cmd, int len) -{ - return (cmd); -} -#endif /* SDK_DEBUGCONSOLE_UART */ - -/* These function __write and __read is used to support ARM_GCC, KDS, Atollic toolchains to printf and scanf*/ -#elif (defined(__GNUC__)) - -#if ((defined(__GNUC__) && (!defined(__MCUXPRESSO)) && (defined(SDK_DEBUGCONSOLE_UART))) || \ - (defined(__MCUXPRESSO) && (!SDK_DEBUGCONSOLE) && (defined(SDK_DEBUGCONSOLE_UART)))) -int __attribute__((weak)) _write(int handle, char *buffer, int size); -int __attribute__((weak)) _write(int handle, char *buffer, int size) -{ - if (buffer == NULL) - { - /* return -1 if error. */ - return -1; - } - - /* This function only writes to "standard out" and "standard err" for all other file handles it returns failure. */ - if ((handle != 1) && (handle != 2)) - { - return -1; - } - - /* Send data. */ - (void)DbgConsole_SendDataReliable((uint8_t *)buffer, (size_t)size); - - return size; -} - -int __attribute__((weak)) _read(int handle, char *buffer, int size); -int __attribute__((weak)) _read(int handle, char *buffer, int size) -{ - uint8_t ch = 0U; - int actualSize = 0; - - /* This function only reads from "standard in", for all other file handles it returns failure. */ - if (handle != 0) - { - return -1; - } - - /* Receive data. */ - for (; size > 0; size--) - { - if (DbgConsole_ReadCharacter(&ch) < 0) - { - break; - } - - *buffer++ = (char)ch; - actualSize++; - - if ((ch == 0U) || (ch == (uint8_t)'\n') || (ch == (uint8_t)'\r')) - { - break; - } - } - - return (actualSize > 0) ? actualSize : -1; -} -#endif - -#endif /* __ICCARM__ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_adc.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_adc.h index 0b35471f4..63755da29 100755 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_adc.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_adc.h @@ -12,7 +12,7 @@ /** * @file connect_adc.h -* @brief define stm32f407-st-discovery adc function and struct +* @brief define imxrt1052-baord adc function and struct * @version 1.1 * @author AIIT XUOS Lab * @date 2021-12-28 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_gpio.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_gpio.h index 6c114e5fd..b9239bcf4 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_gpio.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_gpio.h @@ -12,7 +12,7 @@ /** * @file connect_gpio.h -* @brief define ok1052-c gpio function and struct +* @brief define imxrt1052-baord gpio function and struct * @version 1.0 * @author AIIT XUOS Lab * @date 2022-03-01 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_i2c.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_i2c.h index 119c5eea7..376727197 100755 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_i2c.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_i2c.h @@ -12,7 +12,7 @@ /** * @file connect_i2c.h -* @brief define stm32f407-st-discovery-board i2c function and struct +* @brief define imxrt1052-baord i2c function and struct * @version 1.0 * @author AIIT XUOS Lab * @date 2021-04-25 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_rtc.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_rtc.h index 7f3a8c66e..d50a58575 100755 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_rtc.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_rtc.h @@ -12,7 +12,7 @@ /** * @file connect_rtc.h -* @brief define ok1052-c rtc function and structure +* @brief define imxrt1052-baord rtc function and structure * @version 1.0 * @author AIIT XUOS Lab * @date 2022-03-01 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_sdio.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_sdio.h index dcf2c72af..17012e1da 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_sdio.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_sdio.h @@ -12,7 +12,7 @@ /** * @file connect_sdio.h -* @brief define OK1052-board sdio function and struct +* @brief define imxrt1052-baord sdio function and struct * @version 2.0 * @author AIIT XUOS Lab * @date 2022-01-24 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_spi.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_spi.h index 54c8a4edf..77fc20e7a 100755 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_spi.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_spi.h @@ -12,7 +12,7 @@ /** * @file connect_spi.h -* @brief define stm32f407-st-discovery-board spi function and struct +* @brief define imxrt1052-baord spi function and struct * @version 1.0 * @author AIIT XUOS Lab * @date 2021-04-25 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_usb.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_usb.h index 2510702d7..f9e1a9abb 100644 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_usb.h +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/connect_usb.h @@ -12,7 +12,7 @@ /** * @file connect_usb.h -* @brief define ok1052-board usb function and struct +* @brief define imxrt1052-baord usb function and struct * @version 2.0 * @author AIIT XUOS Lab * @date 2022-02-09 diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console.h deleted file mode 100755 index 500bb7bf4..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc. - * Copyright 2016-2018 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * Debug console shall provide input and output functions to scan and print formatted data. - * o Support a format specifier for PRINTF follows this prototype "%[flags][width][.precision][length]specifier" - * - [flags] :'-', '+', '#', ' ', '0' - * - [width]: number (0,1...) - * - [.precision]: number (0,1...) - * - [length]: do not support - * - [specifier]: 'd', 'i', 'f', 'F', 'x', 'X', 'o', 'p', 'u', 'c', 's', 'n' - * o Support a format specifier for SCANF follows this prototype " %[*][width][length]specifier" - * - [*]: is supported. - * - [width]: number (0,1...) - * - [length]: 'h', 'hh', 'l','ll','L'. ignore ('j','z','t') - * - [specifier]: 'd', 'i', 'u', 'f', 'F', 'e', 'E', 'g', 'G', 'a', 'A', 'o', 'c', 's' - */ - -#ifndef _FSL_DEBUGCONSOLE_H_ -#define _FSL_DEBUGCONSOLE_H_ - -#include "fsl_common.h" -#include "serial_manager.h" - -/*! - * @addtogroup debugconsole - * @{ - */ - -/******************************************************************************* - * Definitions - ******************************************************************************/ - -extern serial_handle_t g_serialHandle; /*!< serial manager handle */ - -/*! @brief Definition select redirect toolchain printf, scanf to uart or not. */ -#define DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN 0U /*!< Select toolchain printf and scanf. */ -#define DEBUGCONSOLE_REDIRECT_TO_SDK 1U /*!< Select SDK version printf, scanf. */ -#define DEBUGCONSOLE_DISABLE 2U /*!< Disable debugconsole function. */ - -/*! @brief Definition to select sdk or toolchain printf, scanf. The macro only support - * to be redefined in project setting. - */ -#ifndef SDK_DEBUGCONSOLE -#define SDK_DEBUGCONSOLE 1U -#endif - -/*! @brief Definition to select redirect toolchain printf, scanf to uart or not. */ -#ifndef SDK_DEBUGCONSOLE_UART -/* mcux will handle this macro, not define it here */ -#if (!defined(__MCUXPRESSO)) -#define SDK_DEBUGCONSOLE_UART -#endif -#endif - -#if defined(SDK_DEBUGCONSOLE) && !(SDK_DEBUGCONSOLE) -#include -#endif - -/*! @brief Definition to select redirect toolchain printf, scanf to uart or not. - * - * if SDK_DEBUGCONSOLE defined to 0,it represents select toolchain printf, scanf. - * if SDK_DEBUGCONSOLE defined to 1,it represents select SDK version printf, scanf. - * if SDK_DEBUGCONSOLE defined to 2,it represents disable debugconsole function. - */ -#if SDK_DEBUGCONSOLE == DEBUGCONSOLE_DISABLE /* Disable debug console */ -#define PRINTF -#define SCANF -#define PUTCHAR -#define GETCHAR -#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK /* Select printf, scanf, putchar, getchar of SDK version. */ -#define PRINTF DbgConsole_Printf -#define SCANF DbgConsole_Scanf -#define PUTCHAR DbgConsole_Putchar -#define GETCHAR DbgConsole_Getchar -#elif SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_TOOLCHAIN /* Select printf, scanf, putchar, getchar of toolchain. \ \ - */ -#define PRINTF printf -#define SCANF scanf -#define PUTCHAR putchar -#define GETCHAR getchar -#endif /* SDK_DEBUGCONSOLE */ - -/******************************************************************************* - * Prototypes - ******************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* __cplusplus */ - -/*! @name Initialization*/ -/* @{ */ - -/*! - * @brief Initializes the peripheral used for debug messages. - * - * Call this function to enable debug log messages to be output via the specified peripheral - * initialized by the serial manager module. - * After this function has returned, stdout and stdin are connected to the selected peripheral. - * - * @param instance The instance of the module. - * @param baudRate The desired baud rate in bits per second. - * @param device Low level device type for the debug console, can be one of the following. - * @arg kSerialPort_Uart, - * @arg kSerialPort_UsbCdc - * @arg kSerialPort_UsbCdcVirtual. - * @param clkSrcFreq Frequency of peripheral source clock. - * - * @return Indicates whether initialization was successful or not. - * @retval kStatus_Success Execution successfully - */ -status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq); - -/*! - * @brief De-initializes the peripheral used for debug messages. - * - * Call this function to disable debug log messages to be output via the specified peripheral - * initialized by the serial manager module. - * - * @return Indicates whether de-initialization was successful or not. - */ -status_t DbgConsole_Deinit(void); - -#if SDK_DEBUGCONSOLE -/*! - * @brief Writes formatted output to the standard output stream. - * - * Call this function to write a formatted output to the standard output stream. - * - * @param formatString Format control string. - * @return Returns the number of characters printed or a negative value if an error occurs. - */ -int DbgConsole_Printf(const char *formatString, ...); - -/*! - * @brief Writes a character to stdout. - * - * Call this function to write a character to stdout. - * - * @param ch Character to be written. - * @return Returns the character written. - */ -int DbgConsole_Putchar(int ch); - -/*! - * @brief Reads formatted data from the standard input stream. - * - * Call this function to read formatted data from the standard input stream. - * - * @note Due the limitation in the BM OSA environment (CPU is blocked in the function, - * other tasks will not be scheduled), the function cannot be used when the - * DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is set in the BM OSA environment. - * And an error is returned when the function called in this case. The suggestion - * is that polling the non-blocking function DbgConsole_TryGetchar to get the input char. - * - * @param formatString Format control string. - * @return Returns the number of fields successfully converted and assigned. - */ -int DbgConsole_Scanf(char *formatString, ...); - -/*! - * @brief Reads a character from standard input. - * - * Call this function to read a character from standard input. - * - * @note Due the limitation in the BM OSA environment (CPU is blocked in the function, - * other tasks will not be scheduled), the function cannot be used when the - * DEBUG_CONSOLE_TRANSFER_NON_BLOCKING is set in the BM OSA environment. - * And an error is returned when the function called in this case. The suggestion - * is that polling the non-blocking function DbgConsole_TryGetchar to get the input char. - * - * @return Returns the character read. - */ -int DbgConsole_Getchar(void); - -/*! - * @brief Debug console flush. - * - * Call this function to wait the tx buffer empty. - * If interrupt transfer is using, make sure the global IRQ is enable before call this function - * This function should be called when - * 1, before enter power down mode - * 2, log is required to print to terminal immediately - * @return Indicates whether wait idle was successful or not. - */ -status_t DbgConsole_Flush(void); - -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -/*! - * @brief Debug console try to get char - * This function provides a API which will not block current task, if character is - * available return it, otherwise return fail. - * @param ch the address of char to receive - * @return Indicates get char was successful or not. - */ -status_t DbgConsole_TryGetchar(char *ch); -#endif - -#endif /* SDK_DEBUGCONSOLE */ - -/*! @} */ - -#if defined(__cplusplus) -} -#endif /* __cplusplus */ - -/*! @} */ - -#endif /* _FSL_DEBUGCONSOLE_H_ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console_conf.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console_conf.h deleted file mode 100755 index 4c36a7dd8..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/fsl_debug_console_conf.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2017 - 2019 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ -#ifndef _FSL_DEBUG_CONSOLE_CONF_H_ -#define _FSL_DEBUG_CONSOLE_CONF_H_ - -/****************Debug console configuration********************/ - -/*! @brief If Non-blocking mode is needed, please define it at project setting, - * otherwise blocking mode is the default transfer mode. - * Warning: If you want to use non-blocking transfer,please make sure the corresponding - * IO interrupt is enable, otherwise there is no output. - * And non-blocking is combine with buffer, no matter bare-metal or rtos. - * Below shows how to configure in your project if you want to use non-blocking mode. - * For IAR, right click project and select "Options", define it in "C/C++ Compiler->Preprocessor->Defined symbols". - * For KEIL, click "Options for Target…", define it in "C/C++->Preprocessor Symbols->Define". - * For ARMGCC, open CmakeLists.txt and add the following lines, - * "SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING")" for debug target. - * "SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDEBUG_CONSOLE_TRANSFER_NON_BLOCKING")" for release target. - * For MCUxpresso, right click project and select "Properties", define it in "C/C++ Build->Settings->MCU C - * Complier->Preprocessor". - * - */ -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -/*! @brief define the transmit buffer length which is used to store the multi task log, buffer is enabled automatically - * when - * non-blocking transfer is using, - * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement. - * If it is configured too small, log maybe missed , because the log will not be - * buffered if the buffer is full, and the print will return immediately with -1. - * And this value should be multiple of 4 to meet memory alignment. - * - */ -#ifndef DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN -#define DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN (512U) -#endif /* DEBUG_CONSOLE_TRANSMIT_BUFFER_LEN */ - -/*! @brief define the receive buffer length which is used to store the user input, buffer is enabled automatically when - * non-blocking transfer is using, - * This value will affect the RAM's ultilization, should be set per paltform's capability and software requirement. - * If it is configured too small, log maybe missed, because buffer will be overwrited if buffer is too small. - * And this value should be multiple of 4 to meet memory alignment. - * - */ -#ifndef DEBUG_CONSOLE_RECEIVE_BUFFER_LEN -#define DEBUG_CONSOLE_RECEIVE_BUFFER_LEN (1024U) -#endif /* DEBUG_CONSOLE_RECEIVE_BUFFER_LEN */ - -/*!@ brief Whether enable the reliable TX function - * If the macro is zero, the reliable TX function of the debug console is disabled. - * When the macro is zero, the string of PRINTF will be thrown away after the transmit buffer is full. - */ -#ifndef DEBUG_CONSOLE_TX_RELIABLE_ENABLE -#define DEBUG_CONSOLE_TX_RELIABLE_ENABLE (1U) -#endif /* DEBUG_CONSOLE_RX_ENABLE */ - -#else -#define DEBUG_CONSOLE_TRANSFER_BLOCKING -#endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */ - -/*!@ brief Whether enable the RX function - * If the macro is zero, the receive function of the debug console is disabled. - */ -#ifndef DEBUG_CONSOLE_RX_ENABLE -#define DEBUG_CONSOLE_RX_ENABLE (1U) -#endif /* DEBUG_CONSOLE_RX_ENABLE */ - -/*!@ brief define the MAX log length debug console support , that is when you call printf("log", x);, the log - * length can not bigger than this value. - * This macro decide the local log buffer length, the buffer locate at stack, the stack maybe overflow if - * the buffer is too big and current task stack size not big enough. - */ -#ifndef DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN -#define DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN (128U) -#endif /* DEBUG_CONSOLE_PRINTF_MAX_LOG_LEN */ - -/*!@ brief define the buffer support buffer scanf log length, that is when you call scanf("log", &x);, the log - * length can not bigger than this value. - * As same as the DEBUG_CONSOLE_BUFFER_PRINTF_MAX_LOG_LEN. - */ -#ifndef DEBUG_CONSOLE_SCANF_MAX_LOG_LEN -#define DEBUG_CONSOLE_SCANF_MAX_LOG_LEN (20U) -#endif /* DEBUG_CONSOLE_SCANF_MAX_LOG_LEN */ - -/*! @brief Debug console synchronization - * User should not change these macro for synchronization mode, but add the - * corresponding synchronization mechanism per different software environment. - * Such as, if another RTOS is used, - * add: - * #define DEBUG_CONSOLE_SYNCHRONIZATION_XXXX 3 - * in this configuration file and implement the synchronization in fsl.log.c. - */ -/*! @brief synchronization for baremetal software */ -#define DEBUG_CONSOLE_SYNCHRONIZATION_BM 0 -/*! @brief synchronization for freertos software */ -#define DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS 1 - -/*! @brief RTOS synchronization mechanism disable - * If not defined, default is enable, to avoid multitask log print mess. - * If other RTOS is used, you can implement the RTOS's specific synchronization mechanism in fsl.log.c - * If synchronization is disabled, log maybe messed on terminal. - */ -#ifndef DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -#ifdef FSL_RTOS_FREE_RTOS -#define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_FREERTOS -#else -#define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM -#endif /* FSL_RTOS_FREE_RTOS */ -#else -#define DEBUG_CONSOLE_SYNCHRONIZATION_MODE DEBUG_CONSOLE_SYNCHRONIZATION_BM -#endif /* DEBUG_CONSOLE_TRANSFER_NON_BLOCKING */ -#endif /* DEBUG_CONSOLE_DISABLE_RTOS_SYNCHRONIZATION */ - -/*! @brief echo function support - * If you want to use the echo function,please define DEBUG_CONSOLE_ENABLE_ECHO - * at your project setting. - */ -#ifndef DEBUG_CONSOLE_ENABLE_ECHO -#define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 0 -#else -#define DEBUG_CONSOLE_ENABLE_ECHO_FUNCTION 1 -#endif /* DEBUG_CONSOLE_ENABLE_ECHO */ - -/*********************************************************************/ - -/***************Debug console other configuration*********************/ -/*! @brief Definition to printf the float number. */ -#ifndef PRINTF_FLOAT_ENABLE -#define PRINTF_FLOAT_ENABLE 0U -#endif /* PRINTF_FLOAT_ENABLE */ - -/*! @brief Definition to scanf the float number. */ -#ifndef SCANF_FLOAT_ENABLE -#define SCANF_FLOAT_ENABLE 0U -#endif /* SCANF_FLOAT_ENABLE */ - -/*! @brief Definition to support advanced format specifier for printf. */ -#ifndef PRINTF_ADVANCED_ENABLE -#define PRINTF_ADVANCED_ENABLE 0U -#endif /* PRINTF_ADVANCED_ENABLE */ - -/*! @brief Definition to support advanced format specifier for scanf. */ -#ifndef SCANF_ADVANCED_ENABLE -#define SCANF_ADVANCED_ENABLE 0U -#endif /* SCANF_ADVANCED_ENABLE */ - -/*! @brief Definition to select virtual com(USB CDC) as the debug console. */ -#ifndef BOARD_USE_VIRTUALCOM -#define BOARD_USE_VIRTUALCOM 0U -#endif -/*******************************************************************/ - -#endif /* _FSL_DEBUG_CONSOLE_CONF_H_ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_manager.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_manager.h deleted file mode 100755 index 14af2c07c..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_manager.h +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright 2018 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __SERIAL_MANAGER_H__ -#define __SERIAL_MANAGER_H__ - -/*! - * @addtogroup serialmanager - * @{ - */ - -/******************************************************************************* - * Definitions - ******************************************************************************/ -#ifdef DEBUG_CONSOLE_TRANSFER_NON_BLOCKING -/*! @brief Enable or disable serial manager non-blocking mode (1 - enable, 0 - disable) */ -#define SERIAL_MANAGER_NON_BLOCKING_MODE (1U) -#else -#ifndef SERIAL_MANAGER_NON_BLOCKING_MODE -#define SERIAL_MANAGER_NON_BLOCKING_MODE (0U) -#endif -#endif - -/*! @brief Enable or disable uart port (1 - enable, 0 - disable) */ -#ifndef SERIAL_PORT_TYPE_UART -#define SERIAL_PORT_TYPE_UART (1U) -#endif - -/*! @brief Enable or disable USB CDC port (1 - enable, 0 - disable) */ -#ifndef SERIAL_PORT_TYPE_USBCDC -#define SERIAL_PORT_TYPE_USBCDC (0U) -#endif - -/*! @brief Enable or disable SWO port (1 - enable, 0 - disable) */ -#ifndef SERIAL_PORT_TYPE_SWO -#define SERIAL_PORT_TYPE_SWO (0U) -#endif - -/*! @brief Enable or disable USB CDC virtual port (1 - enable, 0 - disable) */ -#ifndef SERIAL_PORT_TYPE_USBCDC_VIRTUAL -#define SERIAL_PORT_TYPE_USBCDC_VIRTUAL (0U) -#endif - -/*! @brief Set serial manager write handle size */ -#if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -#define SERIAL_MANAGER_WRITE_HANDLE_SIZE (44U) -#define SERIAL_MANAGER_READ_HANDLE_SIZE (44U) -#else -#define SERIAL_MANAGER_WRITE_HANDLE_SIZE (4U) -#define SERIAL_MANAGER_READ_HANDLE_SIZE (4U) -#endif - -#if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U)) -#include "serial_port_uart.h" -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U)) - -#if !(defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -#error The serial manager blocking mode cannot be supported for USB CDC. -#endif - -#include "serial_port_usb.h" -#endif - -#if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U)) -#include "serial_port_swo.h" -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U)) - -#if !(defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -#error The serial manager blocking mode cannot be supported for USB CDC. -#endif - -#include "serial_port_usb_virtual.h" -#endif - -#define SERIAL_MANAGER_HANDLE_SIZE_TEMP 0U -#if (defined(SERIAL_PORT_TYPE_UART) && (SERIAL_PORT_TYPE_UART > 0U)) - -#if (SERIAL_PORT_UART_HANDLE_SIZE > SERIAL_MANAGER_HANDLE_SIZE_TEMP) -#undef SERIAL_MANAGER_HANDLE_SIZE_TEMP -#define SERIAL_MANAGER_HANDLE_SIZE_TEMP SERIAL_PORT_UART_HANDLE_SIZE -#endif - -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC) && (SERIAL_PORT_TYPE_USBCDC > 0U)) - -#if (SERIAL_PORT_USB_CDC_HANDLE_SIZE > SERIAL_MANAGER_HANDLE_SIZE_TEMP) -#undef SERIAL_MANAGER_HANDLE_SIZE_TEMP -#define SERIAL_MANAGER_HANDLE_SIZE_TEMP SERIAL_PORT_USB_CDC_HANDLE_SIZE -#endif - -#endif - -#if (defined(SERIAL_PORT_TYPE_SWO) && (SERIAL_PORT_TYPE_SWO > 0U)) - -#if (SERIAL_PORT_SWO_HANDLE_SIZE > SERIAL_MANAGER_HANDLE_SIZE_TEMP) -#undef SERIAL_MANAGER_HANDLE_SIZE_TEMP -#define SERIAL_MANAGER_HANDLE_SIZE_TEMP SERIAL_PORT_SWO_HANDLE_SIZE -#endif - -#endif - -#if (defined(SERIAL_PORT_TYPE_USBCDC_VIRTUAL) && (SERIAL_PORT_TYPE_USBCDC_VIRTUAL > 0U)) - -#if (SERIAL_PORT_USB_VIRTUAL_HANDLE_SIZE > SERIAL_MANAGER_HANDLE_SIZE_TEMP) -#undef SERIAL_MANAGER_HANDLE_SIZE_TEMP -#define SERIAL_MANAGER_HANDLE_SIZE_TEMP SERIAL_PORT_USB_VIRTUAL_HANDLE_SIZE -#endif - -#endif - -/*! @brief SERIAL_PORT_UART_HANDLE_SIZE/SERIAL_PORT_USB_CDC_HANDLE_SIZE + serial manager dedicated size */ -#if ((defined(SERIAL_MANAGER_HANDLE_SIZE_TEMP) && (SERIAL_MANAGER_HANDLE_SIZE_TEMP > 0U))) -#else -#error SERIAL_PORT_TYPE_UART, SERIAL_PORT_TYPE_USBCDC, SERIAL_PORT_TYPE_SWO and SERIAL_PORT_TYPE_USBCDC_VIRTUAL should not be cleared at same time. -#endif - -#if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -#define SERIAL_MANAGER_HANDLE_SIZE (SERIAL_MANAGER_HANDLE_SIZE_TEMP + 120U) -#else -#define SERIAL_MANAGER_HANDLE_SIZE (SERIAL_MANAGER_HANDLE_SIZE_TEMP + 12U) -#endif - -#define SERIAL_MANAGER_USE_COMMON_TASK (1U) -#define SERIAL_MANAGER_TASK_PRIORITY (2U) -#define SERIAL_MANAGER_TASK_STACK_SIZE (1000U) - -typedef void *serial_handle_t; -typedef void *serial_write_handle_t; -typedef void *serial_read_handle_t; - -/*! @brief serial port type*/ -typedef enum _serial_port_type -{ - kSerialPort_Uart = 1U, /*!< Serial port UART */ - kSerialPort_UsbCdc, /*!< Serial port USB CDC */ - kSerialPort_Swo, /*!< Serial port SWO */ - kSerialPort_UsbCdcVirtual, /*!< Serial port USB CDC Virtual */ -} serial_port_type_t; - -/*! @brief serial manager config structure*/ -typedef struct _serial_manager_config -{ - uint8_t *ringBuffer; /*!< Ring buffer address, it is used to buffer data received by the hardware. - Besides, the memory space cannot be free during the lifetime of the serial - manager module. */ - uint32_t ringBufferSize; /*!< The size of the ring buffer */ - serial_port_type_t type; /*!< Serial port type */ - void *portConfig; /*!< Serial port configuration */ -} serial_manager_config_t; - -/*! @brief serial manager error code*/ -typedef enum _serial_manager_status -{ - kStatus_SerialManager_Success = kStatus_Success, /*!< Success */ - kStatus_SerialManager_Error = MAKE_STATUS(kStatusGroup_SERIALMANAGER, 1), /*!< Failed */ - kStatus_SerialManager_Busy = MAKE_STATUS(kStatusGroup_SERIALMANAGER, 2), /*!< Busy */ - kStatus_SerialManager_Notify = MAKE_STATUS(kStatusGroup_SERIALMANAGER, 3), /*!< Ring buffer is not empty */ - kStatus_SerialManager_Canceled = - MAKE_STATUS(kStatusGroup_SERIALMANAGER, 4), /*!< the non-blocking request is canceled */ - kStatus_SerialManager_HandleConflict = MAKE_STATUS(kStatusGroup_SERIALMANAGER, 5), /*!< The handle is opened */ - kStatus_SerialManager_RingBufferOverflow = - MAKE_STATUS(kStatusGroup_SERIALMANAGER, 6), /*!< The ring buffer is overflowed */ -} serial_manager_status_t; - -/*! @brief Callback message structure */ -typedef struct _serial_manager_callback_message -{ - uint8_t *buffer; /*!< Transferred buffer */ - uint32_t length; /*!< Transferred data length */ -} serial_manager_callback_message_t; - -/*! @brief callback function */ -typedef void (*serial_manager_callback_t)(void *callbackParam, - serial_manager_callback_message_t *message, - serial_manager_status_t status); - -/******************************************************************************* - * API - ******************************************************************************/ - -#if defined(__cplusplus) -extern "C" { -#endif /* _cplusplus */ - -/*! - * @brief Initializes a serial manager module with the serial manager handle and the user configuration structure. - * - * This function configures the Serial Manager module with user-defined settings. The user can configure the - * configuration - * structure. The parameter serialHandle is a pointer to point to a memory space of size #SERIAL_MANAGER_HANDLE_SIZE - * allocated by the caller. - * The Serial Manager module supports two types of serial port, UART (includes UART, USART, LPSCI, LPUART, etc) and USB - * CDC. - * Please refer to #serial_port_type_t for serial port setting. These two types can be set by using - * #serial_manager_config_t. - * - * Example below shows how to use this API to configure the Serial Manager. - * For UART, - * @code - * #define SERIAL_MANAGER_RING_BUFFER_SIZE (256U) - * static uint8_t s_serialHandleBuffer[SERIAL_MANAGER_HANDLE_SIZE]; - * static serial_handle_t s_serialHandle = &s_serialHandleBuffer[0]; - * static uint8_t s_ringBuffer[SERIAL_MANAGER_RING_BUFFER_SIZE]; - * - * serial_manager_config_t config; - * serial_port_uart_config_t uartConfig; - * config.type = kSerialPort_Uart; - * config.ringBuffer = &s_ringBuffer[0]; - * config.ringBufferSize = SERIAL_MANAGER_RING_BUFFER_SIZE; - * uartConfig.instance = 0; - * uartConfig.clockRate = 24000000; - * uartConfig.baudRate = 115200; - * uartConfig.parityMode = kSerialManager_UartParityDisabled; - * uartConfig.stopBitCount = kSerialManager_UartOneStopBit; - * uartConfig.enableRx = 1; - * uartConfig.enableTx = 1; - * config.portConfig = &uartConfig; - * SerialManager_Init(s_serialHandle, &config); - * @endcode - * For USB CDC, - * @code - * #define SERIAL_MANAGER_RING_BUFFER_SIZE (256U) - * static uint8_t s_serialHandleBuffer[SERIAL_MANAGER_HANDLE_SIZE]; - * static serial_handle_t s_serialHandle = &s_serialHandleBuffer[0]; - * static uint8_t s_ringBuffer[SERIAL_MANAGER_RING_BUFFER_SIZE]; - * - * serial_manager_config_t config; - * serial_port_usb_cdc_config_t usbCdcConfig; - * config.type = kSerialPort_UsbCdc; - * config.ringBuffer = &s_ringBuffer[0]; - * config.ringBufferSize = SERIAL_MANAGER_RING_BUFFER_SIZE; - * usbCdcConfig.controllerIndex = kSerialManager_UsbControllerKhci0; - * config.portConfig = &usbCdcConfig; - * SerialManager_Init(s_serialHandle, &config); - * @endcode - * - * @param serialHandle Pointer to point to a memory space of size #SERIAL_MANAGER_HANDLE_SIZE allocated by the caller. - * @param config Pointer to user-defined configuration structure. - * @retval kStatus_SerialManager_Error An error occurred. - * @retval kStatus_SerialManager_Success The Serial Manager module initialization succeed. - */ -serial_manager_status_t SerialManager_Init(serial_handle_t serialHandle, serial_manager_config_t *config); - -/*! - * @brief De-initializes the serial manager module instance. - * - * This function de-initializes the serial manager module instance. If the opened writing or - * reading handle is not closed, the function will return kStatus_SerialManager_Busy. - * - * @param serialHandle The serial manager module handle pointer. - * @retval kStatus_SerialManager_Success The serial manager de-initialization succeed. - * @retval kStatus_SerialManager_Busy Opened reading or writing handle is not closed. - */ -serial_manager_status_t SerialManager_Deinit(serial_handle_t serialHandle); - -/*! - * @brief Opens a writing handle for the serial manager module. - * - * This function Opens a writing handle for the serial manager module. If the serial manager needs to - * be used in different tasks, the task should open a dedicated write handle for itself by calling - * #SerialManager_OpenWriteHandle. Since there can only one buffer for transmission for the writing - * handle at the same time, multiple writing handles need to be opened when the multiple transmission - * is needed for a task. - * - * @param serialHandle The serial manager module handle pointer. - * @param writeHandle The serial manager module writing handle pointer. - * @retval kStatus_SerialManager_Error An error occurred. - * @retval kStatus_SerialManager_HandleConflict The writing handle was opened. - * @retval kStatus_SerialManager_Success The writing handle is opened. - * - * Example below shows how to use this API to write data. - * For task 1, - * @code - * static uint8_t s_serialWriteHandleBuffer1[SERIAL_MANAGER_WRITE_HANDLE_SIZE]; - * static serial_write_handle_t s_serialWriteHandle1 = &s_serialWriteHandleBuffer1[0]; - * static uint8_t s_nonBlockingWelcome1[] = "This is non-blocking writing log for task1!\r\n"; - * SerialManager_OpenWriteHandle(serialHandle, s_serialWriteHandle1); - * SerialManager_InstallTxCallback(s_serialWriteHandle1, Task1_SerialManagerTxCallback, s_serialWriteHandle1); - * SerialManager_WriteNonBlocking(s_serialWriteHandle1, s_nonBlockingWelcome1, sizeof(s_nonBlockingWelcome1) - 1); - * @endcode - * For task 2, - * @code - * static uint8_t s_serialWriteHandleBuffer2[SERIAL_MANAGER_WRITE_HANDLE_SIZE]; - * static serial_write_handle_t s_serialWriteHandle2 = &s_serialWriteHandleBuffer2[0]; - * static uint8_t s_nonBlockingWelcome2[] = "This is non-blocking writing log for task2!\r\n"; - * SerialManager_OpenWriteHandle(serialHandle, s_serialWriteHandle2); - * SerialManager_InstallTxCallback(s_serialWriteHandle2, Task2_SerialManagerTxCallback, s_serialWriteHandle2); - * SerialManager_WriteNonBlocking(s_serialWriteHandle2, s_nonBlockingWelcome2, sizeof(s_nonBlockingWelcome2) - 1); - * @endcode - */ -serial_manager_status_t SerialManager_OpenWriteHandle(serial_handle_t serialHandle, serial_write_handle_t writeHandle); - -/*! - * @brief Closes a writing handle for the serial manager module. - * - * This function Closes a writing handle for the serial manager module. - * - * @param writeHandle The serial manager module writing handle pointer. - * @retval kStatus_SerialManager_Success The writing handle is closed. - */ -serial_manager_status_t SerialManager_CloseWriteHandle(serial_write_handle_t writeHandle); - -/*! - * @brief Opens a reading handle for the serial manager module. - * - * This function Opens a reading handle for the serial manager module. The reading handle can not be - * opened multiple at the same time. The error code kStatus_SerialManager_Busy would be returned when - * the previous reading handle is not closed. And There can only be one buffer for receiving for the - * reading handle at the same time. - * - * @param serialHandle The serial manager module handle pointer. - * @param readHandle The serial manager module reading handle pointer. - * @retval kStatus_SerialManager_Error An error occurred. - * @retval kStatus_SerialManager_Success The reading handle is opened. - * @retval kStatus_SerialManager_Busy Previous reading handle is not closed. - * - * Example below shows how to use this API to read data. - * @code - * static uint8_t s_serialReadHandleBuffer[SERIAL_MANAGER_READ_HANDLE_SIZE]; - * static serial_read_handle_t s_serialReadHandle = &s_serialReadHandleBuffer[0]; - * SerialManager_OpenReadHandle(serialHandle, s_serialReadHandle); - * static uint8_t s_nonBlockingBuffer[64]; - * SerialManager_InstallRxCallback(s_serialReadHandle, APP_SerialManagerRxCallback, s_serialReadHandle); - * SerialManager_ReadNonBlocking(s_serialReadHandle, s_nonBlockingBuffer, sizeof(s_nonBlockingBuffer)); - * @endcode - */ -serial_manager_status_t SerialManager_OpenReadHandle(serial_handle_t serialHandle, serial_read_handle_t readHandle); - -/*! - * @brief Closes a reading for the serial manager module. - * - * This function Closes a reading for the serial manager module. - * - * @param readHandle The serial manager module reading handle pointer. - * @retval kStatus_SerialManager_Success The reading handle is closed. - */ -serial_manager_status_t SerialManager_CloseReadHandle(serial_read_handle_t readHandle); - -/*! - * @brief Transmits data with the blocking mode. - * - * This is a blocking function, which polls the sending queue, waits for the sending queue to be empty. - * This function sends data using an interrupt method. The interrupt of the hardware could not be disabled. - * And There can only one buffer for transmission for the writing handle at the same time. - * - * @note The function #SerialManager_WriteBlocking and the function #SerialManager_WriteNonBlocking - * cannot be used at the same time. - * And, the function #SerialManager_CancelWriting cannot be used to abort the transmission of this function. - * - * @param writeHandle The serial manager module handle pointer. - * @param buffer Start address of the data to write. - * @param length Length of the data to write. - * @retval kStatus_SerialManager_Success Successfully sent all data. - * @retval kStatus_SerialManager_Busy Previous transmission still not finished; data not all sent yet. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_WriteBlocking(serial_write_handle_t writeHandle, - uint8_t *buffer, - uint32_t length); - -/*! - * @brief Reads data with the blocking mode. - * - * This is a blocking function, which polls the receiving buffer, waits for the receiving buffer to be full. - * This function receives data using an interrupt method. The interrupt of the hardware could not be disabled. - * And There can only one buffer for receiving for the reading handle at the same time. - * - * @note The function #SerialManager_ReadBlocking and the function #SerialManager_ReadNonBlocking - * cannot be used at the same time. - * And, the function #SerialManager_CancelReading cannot be used to abort the transmission of this function. - * - * @param readHandle The serial manager module handle pointer. - * @param buffer Start address of the data to store the received data. - * @param length The length of the data to be received. - * @retval kStatus_SerialManager_Success Successfully received all data. - * @retval kStatus_SerialManager_Busy Previous transmission still not finished; data not all received yet. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_ReadBlocking(serial_read_handle_t readHandle, uint8_t *buffer, uint32_t length); - -#if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -/*! - * @brief Transmits data with the non-blocking mode. - * - * This is a non-blocking function, which returns directly without waiting for all data to be sent. - * When all data is sent, the module notifies the upper layer through a TX callback function and passes - * the status parameter @ref kStatus_SerialManager_Success. - * This function sends data using an interrupt method. The interrupt of the hardware could not be disabled. - * And There can only one buffer for transmission for the writing handle at the same time. - * - * @note The function #SerialManager_WriteBlocking and the function #SerialManager_WriteNonBlocking - * cannot be used at the same time. And, the TX callback is mandatory before the function could be used. - * - * @param writeHandle The serial manager module handle pointer. - * @param buffer Start address of the data to write. - * @param length Length of the data to write. - * @retval kStatus_SerialManager_Success Successfully sent all data. - * @retval kStatus_SerialManager_Busy Previous transmission still not finished; data not all sent yet. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_WriteNonBlocking(serial_write_handle_t writeHandle, - uint8_t *buffer, - uint32_t length); - -/*! - * @brief Reads data with the non-blocking mode. - * - * This is a non-blocking function, which returns directly without waiting for all data to be received. - * When all data is received, the module driver notifies the upper layer - * through a RX callback function and passes the status parameter @ref kStatus_SerialManager_Success. - * This function receives data using an interrupt method. The interrupt of the hardware could not be disabled. - * And There can only one buffer for receiving for the reading handle at the same time. - * - * @note The function #SerialManager_ReadBlocking and the function #SerialManager_ReadNonBlocking - * cannot be used at the same time. And, the RX callback is mandatory before the function could be used. - * - * @param readHandle The serial manager module handle pointer. - * @param buffer Start address of the data to store the received data. - * @param length The length of the data to be received. - * @retval kStatus_SerialManager_Success Successfully received all data. - * @retval kStatus_SerialManager_Busy Previous transmission still not finished; data not all received yet. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_ReadNonBlocking(serial_read_handle_t readHandle, - uint8_t *buffer, - uint32_t length); - -/*! - * @brief Tries to read data. - * - * The function tries to read data from internal ring buffer. If the ring buffer is not empty, the data will be - * copied from ring buffer to up layer buffer. The copied length is the minimum of the ring buffer and up layer length. - * After the data is copied, the actual data length is passed by the parameter length. - * And There can only one buffer for receiving for the reading handle at the same time. - * - * @param readHandle The serial manager module handle pointer. - * @param buffer Start address of the data to store the received data. - * @param length The length of the data to be received. - * @param receivedLength Length received from the ring buffer directly. - * @retval kStatus_SerialManager_Success Successfully received all data. - * @retval kStatus_SerialManager_Busy Previous transmission still not finished; data not all received yet. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_TryRead(serial_read_handle_t readHandle, - uint8_t *buffer, - uint32_t length, - uint32_t *receivedLength); - -/*! - * @brief Cancels unfinished send transmission. - * - * The function cancels unfinished send transmission. When the transfer is canceled, the module notifies the upper layer - * through a TX callback function and passes the status parameter @ref kStatus_SerialManager_Canceled. - * - * @note The function #SerialManager_CancelWriting cannot be used to abort the transmission of - * the function #SerialManager_WriteBlocking. - * - * @param writeHandle The serial manager module handle pointer. - * @retval kStatus_SerialManager_Success Get successfully abort the sending. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_CancelWriting(serial_write_handle_t writeHandle); - -/*! - * @brief Cancels unfinished receive transmission. - * - * The function cancels unfinished receive transmission. When the transfer is canceled, the module notifies the upper - * layer - * through a RX callback function and passes the status parameter @ref kStatus_SerialManager_Canceled. - * - * @note The function #SerialManager_CancelReading cannot be used to abort the transmission of - * the function #SerialManager_ReadBlocking. - * - * @param readHandle The serial manager module handle pointer. - * @retval kStatus_SerialManager_Success Get successfully abort the receiving. - * @retval kStatus_SerialManager_Error An error occurred. - */ -serial_manager_status_t SerialManager_CancelReading(serial_read_handle_t readHandle); - -/*! - * @brief Installs a TX callback and callback parameter. - * - * This function is used to install the TX callback and callback parameter for the serial manager module. - * When any status of TX transmission changed, the driver will notify the upper layer by the installed callback - * function. And the status is also passed as status parameter when the callback is called. - * - * @param writeHandle The serial manager module handle pointer. - * @param callback The callback function. - * @param callbackParam The parameter of the callback function. - * @retval kStatus_SerialManager_Success Successfully install the callback. - */ -serial_manager_status_t SerialManager_InstallTxCallback(serial_write_handle_t writeHandle, - serial_manager_callback_t callback, - void *callbackParam); - -/*! - * @brief Installs a RX callback and callback parameter. - * - * This function is used to install the RX callback and callback parameter for the serial manager module. - * When any status of RX transmission changed, the driver will notify the upper layer by the installed callback - * function. And the status is also passed as status parameter when the callback is called. - * - * @param readHandle The serial manager module handle pointer. - * @param callback The callback function. - * @param callbackParam The parameter of the callback function. - * @retval kStatus_SerialManager_Success Successfully install the callback. - */ -serial_manager_status_t SerialManager_InstallRxCallback(serial_read_handle_t readHandle, - serial_manager_callback_t callback, - void *callbackParam); - -#endif - -/*! - * @brief Prepares to enter low power consumption. - * - * This function is used to prepare to enter low power consumption. - * - * @param serialHandle The serial manager module handle pointer. - * @retval kStatus_SerialManager_Success Successful operation. - */ -serial_manager_status_t SerialManager_EnterLowpower(serial_handle_t serialHandle); - -/*! - * @brief Restores from low power consumption. - * - * This function is used to restore from low power consumption. - * - * @param serialHandle The serial manager module handle pointer. - * @retval kStatus_SerialManager_Success Successful operation. - */ -serial_manager_status_t SerialManager_ExitLowpower(serial_handle_t serialHandle); - -#if defined(__cplusplus) -} -#endif -/*! @} */ -#endif /* __SERIAL_MANAGER_H__ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_uart.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_uart.h deleted file mode 100755 index 24a717009..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_uart.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 NXP - * All rights reserved. - * - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __SERIAL_PORT_UART_H__ -#define __SERIAL_PORT_UART_H__ - -/*! - * @addtogroup serial_port_uart - * @{ - */ - -/******************************************************************************* - * Definitions - ******************************************************************************/ -/*! @brief serial port uart handle size*/ -#if (defined(SERIAL_MANAGER_NON_BLOCKING_MODE) && (SERIAL_MANAGER_NON_BLOCKING_MODE > 0U)) -#define SERIAL_PORT_UART_HANDLE_SIZE (166U) -#else -#define SERIAL_PORT_UART_HANDLE_SIZE (4U) -#endif - -/*! @brief serial port uart parity mode*/ -typedef enum _serial_port_uart_parity_mode -{ - kSerialManager_UartParityDisabled = 0x0U, /*!< Parity disabled */ - kSerialManager_UartParityEven = 0x1U, /*!< Parity even enabled */ - kSerialManager_UartParityOdd = 0x2U, /*!< Parity odd enabled */ -} serial_port_uart_parity_mode_t; - -/*! @brief serial port uart stop bit count*/ -typedef enum _serial_port_uart_stop_bit_count -{ - kSerialManager_UartOneStopBit = 0U, /*!< One stop bit */ - kSerialManager_UartTwoStopBit = 1U, /*!< Two stop bits */ -} serial_port_uart_stop_bit_count_t; - -/*! @brief serial port uart config struct*/ -typedef struct _serial_port_uart_config -{ - uint32_t clockRate; /*!< clock rate */ - uint32_t baudRate; /*!< baud rate */ - serial_port_uart_parity_mode_t parityMode; /*!< Parity mode, disabled (default), even, odd */ - serial_port_uart_stop_bit_count_t stopBitCount; /*!< Number of stop bits, 1 stop bit (default) or 2 stop bits */ - uint8_t instance; /*!< Instance (0 - UART0, 1 - UART1, ...), detail information - please refer to the SOC corresponding RM. */ - uint8_t enableRx; /*!< Enable RX */ - uint8_t enableTx; /*!< Enable TX */ -} serial_port_uart_config_t; -/*! @} */ -#endif /* __SERIAL_PORT_UART_H__ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_usb.h b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_usb.h deleted file mode 100755 index fc1dd000e..000000000 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/include/serial_port_usb.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. - * Copyright 2016 - 2018 NXP - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __SERIAL_PORT_USB_H__ -#define __SERIAL_PORT_USB_H__ - -#if defined(FSL_RTOS_FREE_RTOS) -#include "FreeRTOS.h" -#endif - -/*! - * @addtogroup serial_port_usb - * @{ - */ - -/******************************************************************************* - * Definitions - ******************************************************************************/ -/*! @brief serial port usb handle size*/ -#define SERIAL_PORT_USB_CDC_HANDLE_SIZE (72) - -/*! @brief USB interrupt priority*/ -#if defined(__GIC_PRIO_BITS) -#define USB_DEVICE_INTERRUPT_PRIORITY (25U) -#else -#if defined(configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY) -#define USB_DEVICE_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY) -#else -/* The default value 3 is used to support different ARM Core, such as CM0P, CM4, CM7, and CM33, etc. - * The minimum number of priority bits implemented in the NVIC is 2 on these SOCs. The value of mininum - * priority is 3 (2^2 - 1). So, the default value is 3. - */ -#define USB_DEVICE_INTERRUPT_PRIORITY (3U) -#endif -#endif - -/*! @brief USB controller ID */ -typedef enum _serial_port_usb_cdc_controller_index -{ - kSerialManager_UsbControllerKhci0 = 0U, /*!< KHCI 0U */ - kSerialManager_UsbControllerKhci1 = 1U, /*!< KHCI 1U, Currently, there are no platforms which have two KHCI IPs, - this is reserved to be used in the future. */ - kSerialManager_UsbControllerEhci0 = 2U, /*!< EHCI 0U */ - kSerialManager_UsbControllerEhci1 = 3U, /*!< EHCI 1U, Currently, there are no platforms which have two EHCI IPs, - this is reserved to be used in the future. */ - - kSerialManager_UsbControllerLpcIp3511Fs0 = 4U, /*!< LPC USB IP3511 FS controller 0 */ - kSerialManager_UsbControllerLpcIp3511Fs1 = 5U, /*!< LPC USB IP3511 FS controller 1, there are no platforms which - have two IP3511 IPs, this is reserved to be used in the future. */ - - kSerialManager_UsbControllerLpcIp3511Hs0 = 6U, /*!< LPC USB IP3511 HS controller 0 */ - kSerialManager_UsbControllerLpcIp3511Hs1 = 7U, /*!< LPC USB IP3511 HS controller 1, there are no platforms which - have two IP3511 IPs, this is reserved to be used in the future. */ - - kSerialManager_UsbControllerOhci0 = 8U, /*!< OHCI 0U */ - kSerialManager_UsbControllerOhci1 = 9U, /*!< OHCI 1U, Currently, there are no platforms which have two OHCI IPs, - this is reserved to be used in the future. */ - - kSerialManager_UsbControllerIp3516Hs0 = 10U, /*!< IP3516HS 0U */ - kSerialManager_UsbControllerIp3516Hs1 = 11U, /*!< IP3516HS 1U, Currently, there are no platforms which have two - IP3516HS IPs, this is reserved to be used in the future. */ -} serial_port_usb_cdc_controller_index_t; - -/*! @brief serial port usb config struct*/ -typedef struct _serial_port_usb_cdc_config -{ - serial_port_usb_cdc_controller_index_t controllerIndex; /*!< controller index */ -} serial_port_usb_cdc_config_t; - -/*! @} */ -#endif /* __SERIAL_PORT_USB_H__ */ diff --git a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/spi/Makefile b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/spi/Makefile index 7eaf163ae..8765fdab1 100755 --- a/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/spi/Makefile +++ b/Ubiquitous/XiZi/board/ok1052-c/third_party_driver/spi/Makefile @@ -1,3 +1,7 @@ -SRC_FILES := fsl_lpspi.c connect_spi.c connect_flash_spi.c +SRC_FILES := fsl_lpspi.c connect_spi.c + +ifeq ($(CONFIG_RESOURCES_SPI_SFUD),y) + SRC_FILES += connect_flash_spi.c +endif include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi/board/stm32f407-st-discovery/third_party_driver/include/connect_gpio.h b/Ubiquitous/XiZi/board/stm32f407-st-discovery/third_party_driver/include/connect_gpio.h index 6c114e5fd..3f3c3b0e2 100644 --- a/Ubiquitous/XiZi/board/stm32f407-st-discovery/third_party_driver/include/connect_gpio.h +++ b/Ubiquitous/XiZi/board/stm32f407-st-discovery/third_party_driver/include/connect_gpio.h @@ -12,7 +12,7 @@ /** * @file connect_gpio.h -* @brief define ok1052-c gpio function and struct +* @brief define stm32f407-st-discovery-board gpio function and struct * @version 1.0 * @author AIIT XUOS Lab * @date 2022-03-01