sbi--sbi_set_timer // 设置定时器的函数 fn set_timer(time: usize) -> SbiRet { const EXTENSION_TIMER: usize = 0x54494D45; // TIMER 扩展ID(ASCII码"TIMER") const FUNCTION_SET_TIMER: usize = 0; // 设置定时器的功能ID sbi_call(EXTENSION_TIMER, FUNCTION_SET_TIMER, time, 0) } #[no...
SBI 实现应该通过 mhpmeventX CSRs 高 16 位来决定如何写入数据。 注意:RISC-V 平台硬件实现可能选择定义一个特定的数值,写入到 mhpmeventX CSR 寄存器来表示硬件事件。为了简便,在硬件普通、cache 事件中,RISC-V 平台硬件实现可能使用event_idx 的非 0 扩展作为指定的值。 11.4 事件:固件事件(类型 #15) even...
Linux中是使用如下函数调用这个SBI函数的 static void __sbi_set_timer_v02(uint64_t stime_value) { #if __riscv_xlen == 32 sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, stime_value, stime_value >> 32, 0, 0, 0, 0); #else sbi_ecall(SBI_EXT_TIME, SBI_EXT_TIME_SET_TIMER, ...
6.1.函数: 时钟设定 (FID #0) struct sbiret sbi_set_timer(uint64_t stime_value) 在stime_value 时间之后,为下一个事件设置时钟。stime_value 以绝对时间表示。此函数还必须清除挂起的计时器中断位。 如果监管者希望在不安排下一个计时器事件的情况下清除计时器中断,可以请求一个无限远的计时器中断(即(uint...
* 将 ``os/src/sbi.rs`` 中的常量 ``SBI_SHUTDOWN`` 的值替换为 ``const SBI_SHUTDOWN: usize = 0x53525354;``,``SBI_SET_TIMER`` 的值替换为 ``const SBI_SET_TIMER: usize = 0x54494D45;`` .. attention:: 0 comments on commit 4887a37 Please sign in to comment. Footer...
long sbi_set_timer(uint64_t stime_value) 设置stime_value 时间后的闹钟事件,这个函数回清除定时器的中断标志 pending bit。 如果S 模式想清除中断并且不想继续处理定时器事件,可以通过设置参数为 -1 或者 清除 sie.SITE CSR 寄存器来实现。 SBI 调用成功时返回 0,失败时返回实现定义的负数错误码。
依赖 [dependencies] riscv = "0.7.0" riscv-sbi = "0.2.0" 代码: #![no_std] #![no_main] extern crate panic_halt; use riscv::register::time; use riscv_sbi::set_timer; // 入口点 #[no_mangle] pub extern "C" fn _start() -> ! { ...
5.1. Function: Set Timer (FID #0) struct sbiret sbi_set_timer(uint64_t stime_value) Programs the clock for next event after stime_value time. stime_value is in absolute time. This function must clear the pending timer interrupt bit as well. If the supervisor wishes to clear...
void sbi_set_timer(uint64_t stime_value) Programs the clock for next event after stime_value time. This function also clears the pending timer interrupt bit. If the supervisor wishes to clear the timer interrupt without scheduling the next timer event, it can either request a timer interrupt...
### 摘要 本文探讨了RISC-V Supervisor Binary Interface (SBI) 的重要性及其作为推荐标准接口的角色,它促进了在机器模式(M模式)下运行的固件与在超级用户模式(S模式)或高安全模式(HS模式)下执行的操作系统之间的通信。尤其强调了HS模式下的管理程序如何利用SBI实现与平台固件的有效交互。 ### 关键词 RISC-V SB...