diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 531ddd1..ec5f9ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: rust-toolchain: [nightly] - targets: [x86_64-unknown-linux-gnu, x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat] + targets: [x86_64-unknown-linux-gnu, x86_64-unknown-none] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly @@ -22,7 +22,7 @@ jobs: - name: Check code format run: cargo fmt --all -- --check - name: Clippy - run: cargo clippy --target ${{ matrix.targets }} --all-features -- -A clippy::new_without_default + run: cargo clippy --target ${{ matrix.targets }} --all-features -- -D warnings - name: Build run: cargo build --target ${{ matrix.targets }} --all-features - name: Unit test diff --git a/.gitignore b/.gitignore index ff78c42..23bb4fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /target /.vscode .DS_Store -Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..f6493cb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,53 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "bit_field" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + +[[package]] +name = "volatile" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" + +[[package]] +name = "x86_64" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae" +dependencies = [ + "bit_field", + "bitflags", + "rustversion", + "volatile", +] + +[[package]] +name = "x86_rtc" +version = "0.1.1" +dependencies = [ + "cfg-if", + "x86_64", +] diff --git a/Cargo.toml b/Cargo.toml index 2471d01..f7f7d53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,6 @@ cfg-if = "1.0" [target.'cfg(target_arch = "x86_64")'.dependencies] x86_64 = "0.15" + +[lints.clippy] +new_without_default = "allow" diff --git a/src/lib.rs b/src/lib.rs index 45fff40..975fc01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -205,15 +205,15 @@ cfg_if::cfg_if! { fn read_cmos_register(register: u8) -> u8 { unsafe { - COMMAND_PORT.write(CMOS_DISABLE_NMI | register); - DATA_PORT.read() + (*{ &raw mut COMMAND_PORT }).write(CMOS_DISABLE_NMI | register); + (*{ &raw mut DATA_PORT }).read() } } fn write_cmos_register(register: u8, value: u8) { unsafe { - COMMAND_PORT.write(CMOS_DISABLE_NMI | register); - DATA_PORT.write(value) + (*{ &raw mut COMMAND_PORT }).write(CMOS_DISABLE_NMI | register); + (*{ &raw mut DATA_PORT }).write(value) } }