mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-11 13:16:47 +00:00
uart增加发送字符串的功能
This commit is contained in:
parent
de3324ed7d
commit
8325799657
@ -83,6 +83,25 @@ uchar uart_read(uint32_t port)
|
||||
{
|
||||
while (serial_received(port) == 0)
|
||||
pause();
|
||||
|
||||
|
||||
return io_in8(port);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 通过串口发送整个字符串
|
||||
*
|
||||
* @param port 串口端口
|
||||
* @param str 字符串
|
||||
*/
|
||||
void uart_send_str(uint32_t port, const char *str)
|
||||
{
|
||||
if ((unlikely(str == NULL)))
|
||||
return;
|
||||
while (1)
|
||||
{
|
||||
if (unlikely(*str == '\0'))
|
||||
return;
|
||||
uart_send(port, *str);
|
||||
++str;
|
||||
}
|
||||
}
|
@ -61,4 +61,12 @@ void uart_send(uint32_t port, char c);
|
||||
* @param port 端口号
|
||||
* @return uchar 接收到的数据
|
||||
*/
|
||||
uchar uart_read(uint32_t port);
|
||||
uchar uart_read(uint32_t port);
|
||||
|
||||
/**
|
||||
* @brief 通过串口发送整个字符串
|
||||
*
|
||||
* @param port 串口端口
|
||||
* @param str 字符串
|
||||
*/
|
||||
void uart_send_str(uint32_t port, const char *str);
|
Loading…
x
Reference in New Issue
Block a user