You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-11-26 16:12:31 +02:00
cargo: bump arm-gic from 0.6.1 to 0.7.1 in /src/exercises/bare-metal/rtc in the minor group (#2933)
Bumps the minor group in /src/exercises/bare-metal/rtc with 1 update: arm-gic. Updates `arm-gic` from 0.6.1 to 0.7.1 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Walbran <qwandor@google.com>
This commit is contained in:
4
src/exercises/bare-metal/rtc/Cargo.lock
generated
4
src/exercises/bare-metal/rtc/Cargo.lock
generated
@@ -23,9 +23,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "arm-gic"
|
||||
version = "0.6.1"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6bfdb03424c95b58315a4cb0ff4ca919568a5a28ae5ba960a1ad92c9ccaf49b9"
|
||||
checksum = "fc8a5b06c02f993e98b0b3eb95c3acefb6889cc33a630621fb3e6c564502c2b0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"safe-mmio",
|
||||
|
||||
@@ -9,7 +9,7 @@ publish = false
|
||||
[dependencies]
|
||||
aarch64-paging = { version = "0.10.0", default-features = false }
|
||||
aarch64-rt = "0.2.2"
|
||||
arm-gic = "0.6.1"
|
||||
arm-gic = "0.7.1"
|
||||
arm-pl011-uart = "0.3.2"
|
||||
bitflags = "2.9.3"
|
||||
chrono = { version = "0.4.41", default-features = false }
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use arm_gic::gicv3::{GicV3, InterruptGroup};
|
||||
use arm_gic::gicv3::{GicCpuInterface, InterruptGroup};
|
||||
use log::{error, info, trace};
|
||||
use smccc::Hvc;
|
||||
use smccc::psci::system_off;
|
||||
@@ -28,8 +28,9 @@ extern "C" fn sync_exception_current(_elr: u64, _spsr: u64) {
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn irq_current(_elr: u64, _spsr: u64) {
|
||||
trace!("irq_current");
|
||||
let intid = GicV3::get_and_acknowledge_interrupt(InterruptGroup::Group1)
|
||||
.expect("No pending interrupt");
|
||||
let intid =
|
||||
GicCpuInterface::get_and_acknowledge_interrupt(InterruptGroup::Group1)
|
||||
.expect("No pending interrupt");
|
||||
info!("IRQ {intid:?}");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ use core::hint::spin_loop;
|
||||
// ANCHOR: imports
|
||||
use aarch64_paging::paging::Attributes;
|
||||
use aarch64_rt::{InitialPagetable, entry, initial_pagetable};
|
||||
use arm_gic::gicv3::GicV3;
|
||||
use arm_gic::gicv3::registers::{Gicd, GicrSgi};
|
||||
use arm_gic::gicv3::{GicCpuInterface, GicV3};
|
||||
use arm_pl011_uart::{PL011Registers, Uart, UniqueMmioPointer};
|
||||
use core::panic::PanicInfo;
|
||||
use core::ptr::NonNull;
|
||||
@@ -39,8 +39,8 @@ use smccc::Hvc;
|
||||
use smccc::psci::system_off;
|
||||
|
||||
/// Base addresses of the GICv3.
|
||||
const GICD_BASE_ADDRESS: *mut Gicd = 0x800_0000 as _;
|
||||
const GICR_BASE_ADDRESS: *mut GicrSgi = 0x80A_0000 as _;
|
||||
const GICD_BASE_ADDRESS: NonNull<Gicd> = NonNull::new(0x800_0000 as _).unwrap();
|
||||
const GICR_BASE_ADDRESS: NonNull<GicrSgi> = NonNull::new(0x80A_0000 as _).unwrap();
|
||||
|
||||
/// Base address of the primary PL011 UART.
|
||||
const PL011_BASE_ADDRESS: NonNull<PL011Registers> =
|
||||
@@ -90,8 +90,14 @@ fn main(x0: u64, x1: u64, x2: u64, x3: u64) -> ! {
|
||||
// SAFETY: `GICD_BASE_ADDRESS` and `GICR_BASE_ADDRESS` are the base
|
||||
// addresses of a GICv3 distributor and redistributor respectively, and
|
||||
// nothing else accesses those address ranges.
|
||||
let mut gic =
|
||||
unsafe { GicV3::new(GICD_BASE_ADDRESS, GICR_BASE_ADDRESS, 1, false) };
|
||||
let mut gic = unsafe {
|
||||
GicV3::new(
|
||||
UniqueMmioPointer::new(GICD_BASE_ADDRESS),
|
||||
GICR_BASE_ADDRESS,
|
||||
1,
|
||||
false,
|
||||
)
|
||||
};
|
||||
gic.setup(0);
|
||||
// ANCHOR_END: main
|
||||
|
||||
@@ -102,11 +108,11 @@ fn main(x0: u64, x1: u64, x2: u64, x3: u64) -> ! {
|
||||
let time = Utc.timestamp_opt(timestamp.into(), 0).unwrap();
|
||||
info!("RTC: {time}");
|
||||
|
||||
GicV3::set_priority_mask(0xff);
|
||||
gic.set_interrupt_priority(PL031_IRQ, None, 0x80);
|
||||
gic.set_trigger(PL031_IRQ, None, Trigger::Level);
|
||||
GicCpuInterface::set_priority_mask(0xff);
|
||||
gic.set_interrupt_priority(PL031_IRQ, None, 0x80).unwrap();
|
||||
gic.set_trigger(PL031_IRQ, None, Trigger::Level).unwrap();
|
||||
irq_enable();
|
||||
gic.enable_interrupt(PL031_IRQ, None, true);
|
||||
gic.enable_interrupt(PL031_IRQ, None, true).unwrap();
|
||||
|
||||
// Wait for 3 seconds, without interrupts.
|
||||
let target = timestamp + 3;
|
||||
|
||||
Reference in New Issue
Block a user