summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c')
-rw-r--r--FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c
index 25fda5de7..8e28c8979 100644
--- a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c
+++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/cpu.c
@@ -4,56 +4,66 @@
#include <metal/cpu.h>
#include <metal/machine.h>
-struct metal_cpu* metal_cpu_get(unsigned int hartid)
-{
+struct metal_cpu *metal_cpu_get(unsigned int hartid) {
if (hartid < __METAL_DT_MAX_HARTS) {
return (struct metal_cpu *)__metal_cpu_table[hartid];
- }
+ }
return NULL;
}
-int metal_cpu_get_current_hartid()
-{
+int metal_cpu_get_current_hartid() {
#ifdef __riscv
int mhartid;
- __asm__ volatile("csrr %0, mhartid" : "=r" (mhartid));
+ __asm__ volatile("csrr %0, mhartid" : "=r"(mhartid));
return mhartid;
#endif
}
-int metal_cpu_get_num_harts()
-{
- return __METAL_DT_MAX_HARTS;
-}
+int metal_cpu_get_num_harts() { return __METAL_DT_MAX_HARTS; }
extern __inline__ unsigned long long metal_cpu_get_timer(struct metal_cpu *cpu);
-extern __inline__ unsigned long long metal_cpu_get_timebase(struct metal_cpu *cpu);
+extern __inline__ unsigned long long
+metal_cpu_get_timebase(struct metal_cpu *cpu);
extern __inline__ unsigned long long metal_cpu_get_mtime(struct metal_cpu *cpu);
-extern __inline__ int metal_cpu_set_mtimecmp(struct metal_cpu *cpu, unsigned long long time);
+extern __inline__ int metal_cpu_set_mtimecmp(struct metal_cpu *cpu,
+ unsigned long long time);
-extern __inline__ struct metal_interrupt* metal_cpu_timer_interrupt_controller(struct metal_cpu *cpu);
+extern __inline__ struct metal_interrupt *
+metal_cpu_timer_interrupt_controller(struct metal_cpu *cpu);
extern __inline__ int metal_cpu_timer_get_interrupt_id(struct metal_cpu *cpu);
-extern __inline__ struct metal_interrupt* metal_cpu_software_interrupt_controller(struct metal_cpu *cpu);
+extern __inline__ struct metal_interrupt *
+metal_cpu_software_interrupt_controller(struct metal_cpu *cpu);
-extern __inline__ int metal_cpu_software_get_interrupt_id(struct metal_cpu *cpu);
+extern __inline__ int
+metal_cpu_software_get_interrupt_id(struct metal_cpu *cpu);
-extern __inline__ int metal_cpu_software_set_ipi(struct metal_cpu *cpu, int hartid);
+extern __inline__ int metal_cpu_software_set_ipi(struct metal_cpu *cpu,
+ int hartid);
-extern __inline__ int metal_cpu_software_clear_ipi(struct metal_cpu *cpu, int hartid);
+extern __inline__ int metal_cpu_software_clear_ipi(struct metal_cpu *cpu,
+ int hartid);
extern __inline__ int metal_cpu_get_msip(struct metal_cpu *cpu, int hartid);
-extern __inline__ struct metal_interrupt* metal_cpu_interrupt_controller(struct metal_cpu *cpu);
+extern __inline__ struct metal_interrupt *
+metal_cpu_interrupt_controller(struct metal_cpu *cpu);
-extern __inline__ int metal_cpu_exception_register(struct metal_cpu *cpu, int ecode, metal_exception_handler_t handler);
+extern __inline__ int
+metal_cpu_exception_register(struct metal_cpu *cpu, int ecode,
+ metal_exception_handler_t handler);
-extern __inline__ int metal_cpu_get_instruction_length(struct metal_cpu *cpu, uintptr_t epc);
+extern __inline__ int metal_cpu_get_instruction_length(struct metal_cpu *cpu,
+ uintptr_t epc);
extern __inline__ uintptr_t metal_cpu_get_exception_pc(struct metal_cpu *cpu);
-extern __inline__ int metal_cpu_set_exception_pc(struct metal_cpu *cpu, uintptr_t epc);
+extern __inline__ int metal_cpu_set_exception_pc(struct metal_cpu *cpu,
+ uintptr_t epc);
+
+extern __inline__ struct metal_buserror *
+metal_cpu_get_buserror(struct metal_cpu *cpu);