1 /*
2  * Copyright 2021 QuickLogic
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
18 
19 #ifndef __UDMA_UART_DRIVER_H_
20 #define __UDMA_UART_DRIVER_H_
21 
22 #include "stdint.h"
23 
24 #include "hal_udma_ctrl_reg_defs.h"
25 
26 typedef enum {
27 		kUartDataValid
28 } udma_uart_control_type_t;
29 
30 uint16_t udma_uart_open (uint8_t uart_id, uint32_t xbaudrate);
31 uint16_t udma_uart_close (uint8_t uart_id);
32 uint16_t udma_uart_write(uint8_t uart_id, uint16_t write_len, uint8_t* write_buffer);
33 uint16_t udma_uart_writeraw(uint8_t uart_id, uint16_t write_len, uint8_t* write_buffer);
34 uint16_t udma_uart_read(uint8_t uart_id, uint16_t read_len, uint8_t* read_buffer);
35 uint16_t udma_uart_readraw(uint8_t uart_id, uint16_t read_len, uint8_t* read_buffer);
36 uint8_t udma_uart_getchar(uint8_t uart_id);
37 uint16_t udma_uart_control(uint8_t uart_id, udma_uart_control_type_t control_type, void* pparam);
38 
39 uint8_t uart_getchar (uint8_t id);
40 #endif //__UDMA_UART_DRIVER_H_
41