1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::StandardError;
const EID: u32 = 0x54494d45;
pub fn set_timer(stime_value: u64) -> Result<(), StandardError> {
use {
crate::ecall,
{bit_field::BitField, core::convert::TryInto},
};
const FID: u32 = 0x0;
let ret = if let Ok(stime_value) = stime_value.try_into() {
ecall(EID, FID, [stime_value, 0, 0, 0, 0, 0])
} else {
ecall(
EID,
FID,
[
stime_value.get_bits(0..32) as usize,
stime_value.get_bits(32..64) as usize,
0,
0,
0,
0,
],
)
};
let res: Result<_, _> = ret.into();
res.map(|_| ())
}