RISC-V: bind NuttX native SBI to SBI glue logic
This commit is contained in:
parent
ae64f28344
commit
2525c10729
@ -41,10 +41,15 @@
|
|||||||
|
|
||||||
#include "riscv_internal.h"
|
#include "riscv_internal.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_NUTTSBI
|
||||||
|
#include "sbi_mcall.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_NUTTSBI
|
||||||
static inline uintptr_t sbi_ecall(unsigned int extid, unsigned int fid,
|
static inline uintptr_t sbi_ecall(unsigned int extid, unsigned int fid,
|
||||||
uintptr_t parm0, uintptr_t parm1,
|
uintptr_t parm0, uintptr_t parm1,
|
||||||
uintptr_t parm2, uintptr_t parm3,
|
uintptr_t parm2, uintptr_t parm3,
|
||||||
@ -69,6 +74,7 @@ static inline uintptr_t sbi_ecall(unsigned int extid, unsigned int fid,
|
|||||||
|
|
||||||
return r1;
|
return r1;
|
||||||
}
|
}
|
||||||
|
#endif /* CONFIG_NUTTSBI */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -87,6 +93,9 @@ static inline uintptr_t sbi_ecall(unsigned int extid, unsigned int fid,
|
|||||||
|
|
||||||
void riscv_sbi_set_timer(uint64_t stime_value)
|
void riscv_sbi_set_timer(uint64_t stime_value)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NUTTSBI
|
||||||
|
sbi_mcall_set_timer(stime_value);
|
||||||
|
#else
|
||||||
#ifdef CONFIG_ARCH_RV64
|
#ifdef CONFIG_ARCH_RV64
|
||||||
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0, 0, 0, 0,
|
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, 0, 0, 0, 0,
|
||||||
0);
|
0);
|
||||||
@ -94,6 +103,7 @@ void riscv_sbi_set_timer(uint64_t stime_value)
|
|||||||
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
|
sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value,
|
||||||
stime_value >> 32, 0, 0, 0, 0);
|
stime_value >> 32, 0, 0, 0, 0);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -109,6 +119,9 @@ void riscv_sbi_set_timer(uint64_t stime_value)
|
|||||||
|
|
||||||
uint64_t riscv_sbi_get_time(void)
|
uint64_t riscv_sbi_get_time(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_NUTTSBI
|
||||||
|
return sbi_mcall_get_time();
|
||||||
|
#else
|
||||||
#ifdef CONFIG_ARCH_RV64
|
#ifdef CONFIG_ARCH_RV64
|
||||||
return READ_CSR(time);
|
return READ_CSR(time);
|
||||||
#else
|
#else
|
||||||
@ -124,4 +137,5 @@ uint64_t riscv_sbi_get_time(void)
|
|||||||
|
|
||||||
return (((uint64_t) hi) << 32) | lo;
|
return (((uint64_t) hi) << 32) | lo;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user