Skip to content

Commit

Permalink
Load dummy packrat config for grapefruit
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Jan 21, 2025
1 parent 6b8a7f8 commit 227b876
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/grapefruit/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ priority = 4
max-sizes = {flash = 131072, ram = 16384 }
stacksize = 2600
start = true
task-slots = ["sys", {spi = "spi2_driver"}, "auxflash", "jefe"]
task-slots = ["sys", {spi = "spi2_driver"}, "auxflash", "jefe", "packrat"]

[tasks.thermal]
name = "task-thermal"
Expand Down
9 changes: 5 additions & 4 deletions drv/grapefruit-seq-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ version = "0.1.0"
edition = "2021"

[dependencies]
drv-spi-api = { path = "../spi-api" }
drv-cpu-seq-api = { path = "../cpu-seq-api" }
counters = { path = "../../lib/counters" }
drv-auxflash-api = { path = "../auxflash-api" }
drv-cpu-power-state = { path = "../cpu-power-state" }
drv-cpu-seq-api = { path = "../cpu-seq-api" }
drv-spi-api = { path = "../spi-api" }
drv-stm32xx-sys-api = { path = "../stm32xx-sys-api" }
drv-auxflash-api = { path = "../auxflash-api" }
counters = { path = "../../lib/counters" }
gnarle = { path = "../../lib/gnarle" }
task-packrat-api = { path = "../../task/packrat-api" }
ringbuf = { path = "../../lib/ringbuf" }
userlib = { path = "../../sys/userlib", features = ["panic-messages"] }
task-jefe-api = { path = "../../task/jefe-api" }
Expand Down
29 changes: 29 additions & 0 deletions drv/grapefruit-seq-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use drv_stm32xx_sys_api as sys_api;
use idol_runtime::{NotificationHandler, RequestError};
use sha3::{Digest, Sha3_256};
use task_jefe_api::Jefe;
use task_packrat_api::{CacheSetError, MacAddressBlock, Packrat, VpdIdentity};
use userlib::{
hl, sys_recv_notification, task_slot, FromPrimitive, RecvMessage,
UnwrapLite,
Expand All @@ -29,6 +30,8 @@ enum Trace {
ContinueBitstreamLoad(usize),
WaitForDone,
Programmed,
MacsAlreadySet(MacAddressBlock),
IdentityAlreadySet(VpdIdentity),

#[count(skip)]
None,
Expand All @@ -48,13 +51,39 @@ counted_ringbuf!(Trace, 128, Trace::None);
task_slot!(SYS, sys);
task_slot!(SPI, spi);
task_slot!(AUXFLASH, auxflash);
task_slot!(PACKRAT, packrat);

#[export_name = "main"]
fn main() -> ! {
let sys = sys_api::Sys::from(SYS.get_task_id());
let spi = drv_spi_api::Spi::from(SPI.get_task_id());
let aux = drv_auxflash_api::AuxFlash::from(AUXFLASH.get_task_id());

// Populate packrat with dummy values, because talking to the EEPROM is hard
let packrat = Packrat::from(PACKRAT.get_task_id());
let macs = MacAddressBlock {
base_mac: [0; 6],
count: 0.into(),
stride: 0,
};
match packrat.set_mac_address_block(macs) {
Ok(()) => (),
Err(CacheSetError::ValueAlreadySet) => {
ringbuf_entry!(Trace::MacsAlreadySet(macs));
}
}
let identity = VpdIdentity {
serial: *b"GRAPEFRUIT ",
part_number: *b"913-0000083",
revision: 0,
};
match packrat.set_identity(identity) {
Ok(()) => (),
Err(CacheSetError::ValueAlreadySet) => {
ringbuf_entry!(Trace::IdentityAlreadySet(identity));
}
}

match ServerImpl::init(&sys, spi, aux) {
// Set up everything nicely, time to start serving incoming messages.
Ok(mut server) => {
Expand Down

0 comments on commit 227b876

Please sign in to comment.