mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 22:43:23 +00:00
修复内核的clippy检查报错 (#637)
修复内核的clippy检查报错 --------- Co-authored-by: Samuel Dai <947309196@qq.com> Co-authored-by: Donkey Kane <109840258+xiaolin2004@users.noreply.github.com> Co-authored-by: themildwind <107623059+themildwind@users.noreply.github.com> Co-authored-by: GnoCiYeH <heyicong@dragonos.org> Co-authored-by: MemoryShore <105195940+MemoryShore@users.noreply.github.com> Co-authored-by: 曾俊 <110876916+ZZJJWarth@users.noreply.github.com> Co-authored-by: sun5etop <146408999+sun5etop@users.noreply.github.com> Co-authored-by: hmt <114841534+1037827920@users.noreply.github.com> Co-authored-by: laokengwt <143977175+laokengwt@users.noreply.github.com> Co-authored-by: TTaq <103996388+TTaq@users.noreply.github.com> Co-authored-by: Jomo <2512364506@qq.com> Co-authored-by: Samuel Dai <samuka007@qq.com> Co-authored-by: sspphh <112558065+sspphh@users.noreply.github.com>
This commit is contained in:
@ -33,7 +33,7 @@ impl HpetRegisters {
|
||||
|
||||
/// 获取 HPET 计数器的频率
|
||||
pub fn frequency(&self) -> u64 {
|
||||
10000_0000_0000_000 / self.counter_clock_period()
|
||||
1_000_000_000_000_000 / self.counter_clock_period()
|
||||
}
|
||||
|
||||
pub fn main_counter_value(&self) -> u64 {
|
||||
|
@ -1 +1,2 @@
|
||||
#[allow(clippy::module_inception)]
|
||||
pub mod rtc;
|
||||
|
@ -5,6 +5,7 @@ use crate::{
|
||||
exception::InterruptArch,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct RtcTime {
|
||||
pub second: i32,
|
||||
pub minute: i32,
|
||||
@ -14,19 +15,6 @@ pub struct RtcTime {
|
||||
pub year: i32,
|
||||
}
|
||||
|
||||
impl Default for RtcTime {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
second: (0),
|
||||
minute: (0),
|
||||
hour: (0),
|
||||
day: (0),
|
||||
month: (0),
|
||||
year: (0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RtcTime {
|
||||
///@brief 从主板cmos中获取时间
|
||||
///
|
||||
@ -37,17 +25,10 @@ impl RtcTime {
|
||||
let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() };
|
||||
//0x0B
|
||||
let status_register_b: u8 = read_cmos(0x0B); // 读取状态寄存器B
|
||||
let is_24h: bool = if (status_register_b & 0x02) != 0 {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}; // 判断是否启用24小时模式
|
||||
let is_24h: bool = (status_register_b & 0x02) != 0;
|
||||
// 判断是否启用24小时模式
|
||||
|
||||
let is_binary: bool = if (status_register_b & 0x04) != 0 {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}; // 判断是否为二进制码
|
||||
let is_binary: bool = (status_register_b & 0x04) != 0; // 判断是否为二进制码
|
||||
|
||||
loop {
|
||||
self.year = read_cmos(CMOSTimeSelector::Year as u8) as i32;
|
||||
|
Reference in New Issue
Block a user