Software APIs
sw
device
silicon_creator
lib
drivers
uart_functest.c
1
// Copyright lowRISC contributors (OpenTitan project).
2
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3
// SPDX-License-Identifier: Apache-2.0
4
5
#include <
stdbool.h
>
6
#include <
stdint.h
>
7
8
#include "
sw/device/lib/arch/device.h
"
9
#include "
sw/device/lib/runtime/print.h
"
10
#include "
sw/device/lib/testing/test_framework/ottf_main.h
"
11
#include "sw/device/silicon_creator/lib/drivers/uart.h"
12
#include "sw/device/silicon_creator/lib/error.h"
13
14
#include "
hw/top_earlgrey/sw/autogen/top_earlgrey.h
"
15
16
OTTF_DEFINE_TEST_CONFIG(.console.test_may_clobber =
true
);
17
18
rom_error_t uart_test(
void
) {
19
// Configure UART0 as stdout.
20
uart_init(
kUartNCOValue
);
21
base_set_stdout
((
buffer_sink_t
){
22
.data = NULL,
23
.sink = uart_sink,
24
});
25
26
base_printf
(
"uart functional test!\r\n"
);
27
return
kErrorOk;
28
}
29
30
bool
test_main
(
void
) {
31
status_t
result = OK_STATUS();
32
EXECUTE_TEST
(result, uart_test);
33
return
status_ok(result);
34
}
Return to
OpenTitan Documentation