Software APIs
sw
device
lib
runtime
ibex.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/lib/runtime/ibex.h
"
6
7
#include "
sw/device/lib/base/csr.h
"
8
9
uint32_t
ibex_mcause_read
(
void
) {
10
uint32_t mtval;
11
CSR_READ
(CSR_REG_MCAUSE, &mtval);
12
return
mtval;
13
}
14
15
uint32_t
ibex_mtval_read
(
void
) {
16
uint32_t mtval;
17
CSR_READ
(CSR_REG_MTVAL, &mtval);
18
return
mtval;
19
}
20
21
uint32_t
ibex_mepc_read
(
void
) {
22
uint32_t mepc;
23
CSR_READ
(CSR_REG_MEPC, &mepc);
24
return
mepc;
25
}
26
27
void
ibex_mepc_write
(uint32_t mepc) {
CSR_WRITE
(CSR_REG_MEPC, mepc); }
28
29
// `extern` declarations to give the inline functions in the
30
// corresponding header a link location.
31
32
extern
uint64_t
ibex_mcycle_read
(
void
);
33
extern
ibex_timeout_t
ibex_timeout_init
(uint32_t timeout_usec);
34
extern
bool
ibex_timeout_check
(
const
ibex_timeout_t
*timeout);
35
extern
uint64_t
ibex_timeout_elapsed
(
const
ibex_timeout_t
*timeout);
Return to
OpenTitan Documentation