1 /* 2 * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef WM_UART_TASK_H 17 #define WM_UART_TASK_H 18 19 #include "wm_cmdp.h" 20 #include "wm_uart.h" 21 #include "wm_osal.h" 22 #define INS_SYNC_CHAR 0x01 23 #define INS_RICMD 0x02 24 #define INS_DATA 0x04 25 26 #define RICMD_SYNC_FLAG 0xAA 27 28 struct uart_ricmd_info { 29 u8 sync_head[20]; 30 u32 cbytes; 31 u16 length; 32 u8 dest; 33 }; 34 35 typedef struct tls_uart { 36 struct tls_uart_port *uart_port; 37 u32 cmd_mode; 38 u8 inputstate; 39 /* 40 * tx callbak, notify user application tx complete, 41 * user can use it, write new data to uart for transmit 42 */ 43 void (*tx_cb)(struct tls_uart *uart); 44 struct uart_ricmd_info ricmd_info; 45 u16 sksnd_cnt; 46 } tls_uart_t; 47 48 struct tls_uart *tls_uart_open(u32 uart_no, TLS_UART_MODE_T uart_mode); 49 50 #endif /* WM_UART_TASK_H */ 51