Software APIs
sw
device
lib
runtime
hart.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/hart.h
"
6
7
#include <
stdbool.h
>
8
9
#include "
sw/device/lib/arch/device.h
"
10
#include "
sw/device/lib/base/math.h
"
11
#include "
sw/device/lib/runtime/ibex.h
"
12
13
void
busy_spin_micros
(uint32_t usec) {
14
uint64_t start =
ibex_mcycle_read
();
15
uint64_t cycles =
to_cpu_cycles
(usec);
16
while
((
ibex_mcycle_read
() - start) < cycles) {
17
}
18
}
19
20
noreturn
void
abort
(
void
) {
21
while
(
true
) {
22
wait_for_interrupt
();
23
}
24
}
25
26
// `extern` declarations to give the inline functions in the
27
// corresponding header a link location.
28
29
extern
void
wait_for_interrupt
(
void
);
30
extern
void
icache_invalidate
(
void
);
Return to
OpenTitan Documentation