使用rust重构softirq机制;解决Rtc驱动的编译警告问题 (#138)

* 使用rust重构softirq机制
* 解决Rtc驱动的编译警告问题

Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
Gou Ngai
2023-01-07 23:15:37 +08:00
committed by GitHub
parent e9fdc57bf8
commit 62e4613978
10 changed files with 386 additions and 257 deletions

View File

@ -1,6 +1,6 @@
#![allow(dead_code)]
use crate::driver::timers::rtc::rtc::{rtc_get_cmos_time, rtc_time_t};
use crate::driver::timers::rtc::rtc::RtcTime;
#[allow(non_camel_case_types)]
pub type ktime_t = i64;
@ -15,17 +15,15 @@ fn ktime_to_ns(kt: ktime_t) -> i64 {
/// 时间戳为从UTC+0 1970-01-01 00:00到当前UTC+0时间所经过的纳秒数。
/// 注意由于当前未引入时区因此本函数默认时区为UTC+8来计算
fn ktime_get_real() -> ktime_t {
let mut rtc_time: rtc_time_t = rtc_time_t {
second: (0),
minute: (0),
hour: (0),
day: (0),
month: (0),
year: (0),
};
let mut rtc_time: RtcTime = RtcTime::default();
//调用rtc.h里面的函数
rtc_get_cmos_time(&mut rtc_time);
{
let r = rtc_time.get();
// 返回错误码
if r.is_err() {
return r.unwrap_err() as ktime_t;
}
}
let mut day_count: i32 = 0;
for year in 1970..rtc_time.year {