Skip to content

Commit c9fe888

Browse files
feat(dummy-uart): Add dummy uart
This uart can be used to prevent compiling errors when there is no uart (currently) supported.
1 parent deab9e3 commit c9fe888

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#include <drivers/dummy_uart.h>
7+
#include <fences.h>
8+
9+
void uart_init(volatile struct dummy_uart* uart)
10+
{
11+
UNUSED_ARG(uart);
12+
return;
13+
}
14+
15+
void uart_enable(volatile struct dummy_uart* uart)
16+
{
17+
UNUSED_ARG(uart);
18+
return;
19+
}
20+
21+
void uart_putc(volatile struct dummy_uart* uart, int8_t c)
22+
{
23+
UNUSED_ARG(uart);
24+
UNUSED_ARG(c);
25+
return;
26+
}
27+
28+
void uart_puts(volatile struct dummy_uart* uart, int8_t const* str)
29+
{
30+
UNUSED_ARG(uart);
31+
UNUSED_ARG(str);
32+
return;
33+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright (c) Bao Project and Contributors. All rights reserved.
4+
*/
5+
6+
#ifndef DUMMY_UART_H
7+
#define DUMMY_UART_H
8+
9+
#include <bao.h>
10+
// #include <plat/platform.h>
11+
12+
struct dummy_uart {
13+
uint32_t dummy_reg; /* 0x0 */
14+
};
15+
16+
typedef volatile struct dummy_uart bao_uart_t;
17+
18+
void uart_enable(volatile struct dummy_uart* uart);
19+
void uart_init(volatile struct dummy_uart* uart);
20+
void uart_puts(volatile struct dummy_uart* uart, const int8_t* str);
21+
void uart_putc(volatile struct dummy_uart* uart, int8_t str);
22+
23+
#endif /* DUMMY_UART_H */
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## SPDX-License-Identifier: Apache-2.0
2+
## Copyright (c) Bao Project and Contributors. All rights reserved.
3+
4+
drivers-objs-y+=dummy_uart/dummy_uart.o

0 commit comments

Comments
 (0)