Skip to content

Commit caf0cd8

Browse files
authored
Use NotificationBits in Idol (#2233)
This is mostly mechanical, with one logical change: I removed the timer from `medusa-seq-server`, because it wasn't doing anything.
1 parent ef8e9ac commit caf0cd8

53 files changed

Lines changed: 89 additions & 117 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/medusa/base.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ task-slots = [
125125
"auxflash",
126126
"packrat",
127127
{front_io = "ecp5_front_io"}]
128-
notifications = ["timer"]
129128

130129
[tasks.transceivers]
131130
name = "drv-transceivers-server"

drv/auxflash-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ impl NotificationHandler for ServerImpl {
484484
0
485485
}
486486

487-
fn handle_notification(&mut self, _bits: u32) {
487+
fn handle_notification(&mut self, _bits: userlib::NotificationBits) {
488488
unreachable!()
489489
}
490490
}

drv/cosmo-hf/src/hf.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,10 +785,8 @@ impl NotificationHandler for ServerImpl {
785785
notifications::TIMER_MASK
786786
}
787787

788-
fn handle_notification(&mut self, bits: u32) {
789-
if (bits & notifications::TIMER_MASK) != 0
790-
&& userlib::sys_get_timer().deadline.is_none()
791-
{
788+
fn handle_notification(&mut self, bits: userlib::NotificationBits) {
789+
if bits.has_timer_fired(notifications::TIMER_MASK) {
792790
self.step_hash();
793791
}
794792
}

drv/cosmo-seq-server/src/main.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -888,14 +888,12 @@ impl NotificationHandler for ServerImpl {
888888
notifications::TIMER_MASK | notifications::SEQ_IRQ_MASK
889889
}
890890

891-
fn handle_notification(&mut self, bits: u32) {
892-
if (bits & notifications::SEQ_IRQ_MASK) != 0 {
891+
fn handle_notification(&mut self, bits: userlib::NotificationBits) {
892+
if bits.check_notification_mask(notifications::SEQ_IRQ_MASK) {
893893
self.handle_sequencer_interrupt();
894894
}
895895

896-
if (bits & notifications::TIMER_MASK) == 0
897-
|| sys_get_timer().deadline.is_some()
898-
{
896+
if !bits.has_timer_fired(notifications::TIMER_MASK) {
899897
return;
900898
}
901899
let state = self.log_state_registers();

drv/eeprom/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl NotificationHandler for EepromServer {
9797
0
9898
}
9999

100-
fn handle_notification(&mut self, _bits: u32) {
100+
fn handle_notification(&mut self, _bits: userlib::NotificationBits) {
101101
unreachable!()
102102
}
103103
}

drv/fpga-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ impl<'a, Device: Fpga<'a> + FpgaUserDesign> idol_runtime::NotificationHandler
608608
0
609609
}
610610

611-
fn handle_notification(&mut self, _bits: u32) {
611+
fn handle_notification(&mut self, _bits: userlib::NotificationBits) {
612612
unreachable!()
613613
}
614614
}

drv/gimlet-hf-server/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,10 +947,8 @@ impl NotificationHandler for ServerImpl {
947947
notifications::TIMER_MASK
948948
}
949949

950-
fn handle_notification(&mut self, bits: u32) {
951-
if (bits & notifications::TIMER_MASK) != 0
952-
&& userlib::sys_get_timer().deadline.is_none()
953-
{
950+
fn handle_notification(&mut self, bits: userlib::NotificationBits) {
951+
if bits.has_timer_fired(notifications::TIMER_MASK) {
954952
self.step_hash();
955953
}
956954
}

drv/gimlet-seq-server/src/main.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,12 @@ impl<S: SpiServer> NotificationHandler for ServerImpl<S> {
540540
notifications::TIMER_MASK | self.vcore.mask()
541541
}
542542

543-
fn handle_notification(&mut self, bits: u32) {
544-
if (bits & self.vcore.mask()) != 0 {
543+
fn handle_notification(&mut self, bits: userlib::NotificationBits) {
544+
if bits.check_notification_mask(self.vcore.mask()) {
545545
self.vcore.handle_notification(self.ereport_buf);
546546
}
547547

548-
if (bits & notifications::TIMER_MASK) == 0
549-
|| sys_get_timer().deadline.is_some()
550-
{
548+
if !bits.has_timer_fired(notifications::TIMER_MASK) {
551549
return;
552550
}
553551

drv/grapefruit-seq-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl NotificationHandler for ServerImpl {
189189
0
190190
}
191191

192-
fn handle_notification(&mut self, _bits: u32) {
192+
fn handle_notification(&mut self, _bits: userlib::NotificationBits) {
193193
unreachable!()
194194
}
195195
}

0 commit comments

Comments
 (0)