mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-20 11:57:12 -04:00
Add icache_enable function to simple_system_common.h
This commit is contained in:
parent
4f96e5446b
commit
2de873c9bb
1 changed files with 17 additions and 0 deletions
|
@ -95,4 +95,21 @@ void timer_disable(void);
|
|||
*/
|
||||
uint64_t get_elapsed_time(void);
|
||||
|
||||
/**
|
||||
* Enables/disables the instruction cache. This has no effect on Ibex
|
||||
* configurations that do not have an instruction cache and in particular is
|
||||
* safe to execute on those configurations.
|
||||
*
|
||||
* @param enable if non-zero enables, otherwise disables
|
||||
*/
|
||||
static inline void icache_enable(int enable) {
|
||||
if (enable) {
|
||||
// Set icache enable bit in CPUCTRLSTS
|
||||
asm volatile("csrs 0x7c0, 1");
|
||||
} else {
|
||||
// Clear icache enable bit in CPUCTRLSTS
|
||||
asm volatile("csrc 0x7c0, 1");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue