Skip to content

Commit b2a8ffe

Browse files
Update to latest arm-gic
1 parent 3add523 commit b2a8ffe

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

examples/mps3-an536/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ version = "0.0.0"
1919
cortex-ar = { path = "../../cortex-ar", features = ["critical-section-multi-core"] }
2020
cortex-r-rt = { path = "../../cortex-r-rt" }
2121
semihosting = { version = "0.1.18", features = ["stdio"] }
22-
arm-gic = { git = "https://github.com/google/arm-gic.git", rev = "46a8fc1720f5c28fccf4dfb5953b88dab7012e9c", optional = true }
22+
arm-gic = { version = "0.6.1", optional = true }
2323
critical-section = "1.2.0"
2424

2525
[build-dependencies]

examples/mps3-an536/src/bin/gic.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ use cortex_r_rt::{entry, irq};
1010
use mps3_an536 as _;
1111

1212
use arm_gic::{
13-
gicv3::{Group, SgiTarget},
13+
gicv3::{GicV3, Group, InterruptGroup, SgiTarget, SgiTargetGroup},
1414
IntId,
1515
};
1616
use semihosting::println;
1717

18-
type SingleCoreGic = arm_gic::gicv3::GicV3<1>;
19-
2018
/// Offset from PERIPHBASE for GIC Distributor
2119
const GICD_BASE_OFFSET: usize = 0x0000_0000usize;
2220

@@ -42,11 +40,10 @@ fn main() -> ! {
4240
"Creating GIC driver @ {:010p} / {:010p}",
4341
gicd_base, gicr_base
4442
);
45-
let mut gic: SingleCoreGic =
46-
unsafe { SingleCoreGic::new(gicd_base.cast(), [gicr_base.cast()]) };
43+
let mut gic: GicV3 = unsafe { GicV3::new(gicd_base.cast(), gicr_base.cast(), 1, false) };
4744
println!("Calling git.setup(0)");
4845
gic.setup(0);
49-
SingleCoreGic::set_priority_mask(0x80);
46+
GicV3::set_priority_mask(0x80);
5047

5148
// Configure a Software Generated Interrupt for Core 0
5249
println!("Configure low-prio SGI...");
@@ -70,14 +67,15 @@ fn main() -> ! {
7067

7168
// Send it
7269
println!("Send lo-prio SGI");
73-
SingleCoreGic::send_sgi(
70+
GicV3::send_sgi(
7471
SGI_INTID_LO,
7572
SgiTarget::List {
7673
affinity3: 0,
7774
affinity2: 0,
7875
affinity1: 0,
7976
target_list: 0b1,
8077
},
78+
SgiTargetGroup::CurrentGroup1,
8179
);
8280

8381
for _ in 0..1_000_000 {
@@ -97,7 +95,7 @@ fn dump_cpsr() {
9795
#[irq]
9896
fn irq_handler() {
9997
println!("> IRQ");
100-
while let Some(int_id) = SingleCoreGic::get_and_acknowledge_interrupt() {
98+
while let Some(int_id) = GicV3::get_and_acknowledge_interrupt(InterruptGroup::Group1) {
10199
// let's go re-entrant
102100
unsafe {
103101
cortex_ar::interrupt::enable();
@@ -108,20 +106,21 @@ fn irq_handler() {
108106
"- IRQ got {:?}, sending hi-prio {:?}",
109107
SGI_INTID_LO, SGI_INTID_HI
110108
);
111-
SingleCoreGic::send_sgi(
109+
GicV3::send_sgi(
112110
SGI_INTID_HI,
113111
SgiTarget::List {
114112
affinity3: 0,
115113
affinity2: 0,
116114
affinity1: 0,
117115
target_list: 0b1,
118116
},
117+
SgiTargetGroup::CurrentGroup1,
119118
);
120119
println!("- IRQ finished sending hi-prio!");
121120
}
122121
// turn interrupts off again
123122
cortex_ar::interrupt::disable();
124-
SingleCoreGic::end_interrupt(int_id);
123+
GicV3::end_interrupt(int_id, InterruptGroup::Group1);
125124
}
126125
println!("< IRQ");
127126
}

0 commit comments

Comments
 (0)