From e328ebef585cea2351b37117b2d5ac4978ecd3c0 Mon Sep 17 00:00:00 2001 From: WXK <287788329@qq.com> Date: 星期二, 11 二月 2025 14:57:23 +0800 Subject: [PATCH] 1111111 --- keil/include/drivers/mk_uart.h | 49 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 37 insertions(+), 12 deletions(-) diff --git a/keil/include/drivers/mk_uart.h b/keil/include/drivers/mk_uart.h index bcf654e..1e56e15 100644 --- a/keil/include/drivers/mk_uart.h +++ b/keil/include/drivers/mk_uart.h @@ -65,13 +65,11 @@ #define UART_ERR_LINE 0x40000000 #define UART_ERR_TIMEOUT 0x20000000 #define UART_ERR_BUSY 0x10000000 -//脪脝脰虏 + + + #define SerialPutString(x) Serial_PutString((uint8_t*)(x)) #define Serial0PutString(x) Serial0_PutString((uint8_t*)(x)) -uint32_t SerialKeyPressed(uint8_t *key); -void SerialPutChar(uint8_t c); -void SerialPutChar(uint8_t c); -void Serial_PutString(uint8_t *s); void Serial0PutChar(uint8_t c); void Serial0_PutString(uint8_t *s); /** @@ -372,6 +370,39 @@ int uart_receive(enum UART_DEV_T id, uint8_t *rx_buf, uint32_t len, drv_callback_t callback); /** + * @brief Sends an amount of data over internal FIFO + * @param[in] id UART device ID. \n + * This parameter should be one of the UART_DEV_T enum values as below + * @arg UART_ID0 uart0 + * @arg UART_ID1 uart1 + * @param[in] tx_buf Pointer to data buffer + * @param[in] len Bytes of data to be sent + * @return void + * @note This is an unsafe interface thus the USER MUST ensure that following things \n + * 1. @P len MUST NOT exceeds 16 bytes \n + * 2. DO NOT call this interface while HW is sending data \n + * 3. The uart @p id MUST be opened before this interface gets called \n + * 4. DO NOT enable \ref UART_HANDLE_T::int_tx while uart @p id gets opened + */ +void uart_send_over_fifo(enum UART_DEV_T id, uint8_t *tx_buf, uint32_t len); + +/** + * @brief Receive an amount of data from internal FIFO + * @param[in] id UART device ID. \n + * This parameter should be one of the UART_DEV_T enum values as below + * @arg UART_ID0 uart0 + * @arg UART_ID1 uart1 + * @param[in] tx_buf Pointer to data buffer + * @param[in] len Bytes of data to be sent + * @return The bytes of data receive from interval FIFO + * @note This is an unsafe interface thus the USER MUST ensure that following things \n + * 1. @P len MUST NOT exceeds 16 bytes \n + * 2. The uart @p id MUST be opened before this interface gets called \n + * 3. DO NOT enable \ref UART_HANDLE_T::int_rx while uart @p id gets opened + */ +uint32_t uart_receive_from_fifo(enum UART_DEV_T id, uint8_t *rx_buf, uint32_t len); + +/** * @brief Abort ongoing Transmit transfer. * @note This function is used to abort the ongoing uart TX transfer, if the * TX transfer is completed before uart dma abort, the abort_tx_callback @@ -443,13 +474,7 @@ * @return None */ void uart_printf(enum UART_DEV_T id, const char *fmt, ...); -/** - * @brief This function get USART1 rxcount to DMA handler - * @param[in] id void default usart1 - * @param[in] fmt - * @return rx count from usart1 - */ -uint32_t get_rx_count_from_uart1(void); + #ifdef __cplusplus } #endif -- Gitblit v1.9.3