Skip to content

Commit 433155c

Browse files
committed
Check for DIMM failures in cosmo
check the various DIMM PCAMP signals
1 parent 0256d22 commit 433155c

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

task/cosmo-spd/src/main.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use drv_cpu_seq_api::PowerState;
1111
use drv_spartan7_loader_api::Spartan7Loader;
1212
use idol_runtime::RequestError;
13-
use ringbuf::{ringbuf, ringbuf_entry};
13+
use ringbuf::{counted_ringbuf, ringbuf_entry, Count};
1414
use task_jefe_api::Jefe;
1515
use task_packrat_api::Packrat;
1616
use task_sensor_api::{config::other_sensors, NoData, Sensor, SensorId};
@@ -25,15 +25,16 @@ task_slot!(PACKRAT, packrat);
2525
task_slot!(LOADER, spartan7_loader);
2626
task_slot!(SENSOR, sensor);
2727

28-
#[derive(Copy, Clone, PartialEq)]
28+
#[derive(Copy, Clone, PartialEq, Count)]
2929
enum Trace {
3030
None,
3131
Ready,
3232
Present { index: usize, present: bool },
3333
TemperatureReadTimeout { index: usize, pos: usize },
34+
DimmFailure { index: usize },
3435
}
3536

36-
ringbuf!(Trace, 32, Trace::None);
37+
counted_ringbuf!(Trace, 32, Trace::None);
3738

3839
#[export_name = "main"]
3940
fn main() -> ! {
@@ -318,6 +319,25 @@ impl idol_runtime::NotificationHandler for ServerImpl {
318319

319320
// Send the value to the sensors task
320321
self.sensor.post_now(DIMM_SENSORS[index][pos], temp_c);
322+
323+
let dev = match index {
324+
0 => self.dimms.dimm_pcamp.pcamp_a(),
325+
1 => self.dimms.dimm_pcamp.pcamp_b(),
326+
2 => self.dimms.dimm_pcamp.pcamp_c(),
327+
3 => self.dimms.dimm_pcamp.pcamp_d(),
328+
4 => self.dimms.dimm_pcamp.pcamp_e(),
329+
5 => self.dimms.dimm_pcamp.pcamp_f(),
330+
6 => self.dimms.dimm_pcamp.pcamp_g(),
331+
7 => self.dimms.dimm_pcamp.pcamp_h(),
332+
8 => self.dimms.dimm_pcamp.pcamp_i(),
333+
9 => self.dimms.dimm_pcamp.pcamp_j(),
334+
10 => self.dimms.dimm_pcamp.pcamp_k(),
335+
11 => self.dimms.dimm_pcamp.pcamp_l(),
336+
_ => unreachable!(),
337+
};
338+
if !dev {
339+
ringbuf_entry!(Trace::DimmFailure { index });
340+
}
321341
}
322342
}
323343
set_timer_relative(TIMER_INTERVAL, notifications::TIMER_MASK);

0 commit comments

Comments
 (0)