Software APIs
uart.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 "sw/device/silicon_creator/lib/drivers/uart.h"
6
7
#include "
sw/device/lib/arch/device.h
"
8
#include "sw/device/silicon_creator/lib/drivers/ibex.h"
9
10
void
device_fpga_version_print(
void
) {
11
// This value is guaranteed to be zero on all non-FPGA implementations.
12
uint32_t fpga = ibex_fpga_version();
13
// : M O R
14
const
uint32_t kRom = 0x3a4d4f52;
15
uart_write_imm(kRom);
16
// The cast to unsigned int stops GCC from complaining about uint32_t
17
// being a `long unsigned int` while the %x specifier takes `unsigned int`.
18
const
uint32_t kNewline = 0x0a0d;
19
uart_write_hex(fpga,
sizeof
(fpga), kNewline);
20
}
sw
device
lib
arch
uart.c
Return to
OpenTitan Documentation