1 /* 2 * @ : Copyright (c) 2021 Phytium Information Technology, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0. 5 * 6 * @Date: 2021-04-07 09:53:07 7 * @LastEditTime: 2021-05-25 16:49:30 8 * @Description: This files is for uart register function 9 * 10 * @Modify History: 11 * Ver Who Date Changes 12 * ----- ------ -------- -------------------------------------- 13 */ 14 15 #include "ft_uart_hw.h" 16 FUart_SendByte(u32 BaseAddress,u8 Byte)17void FUart_SendByte(u32 BaseAddress, u8 Byte) 18 { 19 while (FT_UART_IsTransmitFull(BaseAddress)) 20 { 21 ; 22 } 23 FT_UART_WriteReg(BaseAddress, UARTDR_OFFSET, (u32)Byte); 24 } 25 FUart_RecvByte(u32 BaseAddress)26u8 FUart_RecvByte(u32 BaseAddress) 27 { 28 u32 RecievedByte; 29 while (FT_UART_IsReceiveData(BaseAddress)) 30 { 31 ; 32 } 33 RecievedByte = FT_UART_ReadReg(BaseAddress, UARTDR_OFFSET); 34 return RecievedByte; 35 } 36 FUart_GetChar(u32 BaseAddress)37u8 FUart_GetChar(u32 BaseAddress) 38 { 39 u32 RecievedByte; 40 if (FT_UART_IsReceiveData(BaseAddress)) 41 { 42 return 0xff; 43 } 44 RecievedByte = FT_UART_ReadReg(BaseAddress, UARTDR_OFFSET); 45 return RecievedByte; 46 } 47