Skip to content

Commit 8c31ddb

Browse files
committed
Changes to support OOB events
1 parent 19e6eeb commit 8c31ddb

File tree

3 files changed

+35
-18
lines changed

3 files changed

+35
-18
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ defmt = "0.3"
3333
document-features = "0.2.7"
3434
embassy-executor = { git = "https://github.com/embassy-rs/embassy" }
3535
embassy-futures = { git = "https://github.com/embassy-rs/embassy" }
36-
#embassy-imxrt = { git = "https://github.com/OpenDevicePartnership/embassy-imxrt" }
37-
embassy-imxrt = { git = "https://github.com/philgweber/embassy-imxrt" }
36+
embassy-imxrt = { git = "https://github.com/OpenDevicePartnership/embassy-imxrt" }
3837
embassy-sync = { git = "https://github.com/embassy-rs/embassy" }
3938
embassy-time = { git = "https://github.com/embassy-rs/embassy" }
4039
embassy-time-driver = { git = "https://github.com/embassy-rs/embassy" }

espi-service/src/espi_service.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,23 +176,16 @@ pub async fn espi_service(mut espi: espi::Espi<'static>, memory_map_buffer: &'st
176176
.await
177177
.unwrap();
178178

179-
unsafe {
180-
let test_mem = 0x2000_0010 as *mut u32;
181-
*test_mem = 0xff;
182-
};
183-
184179
loop {
185180
let event = espi.wait_for_event().await;
186181
match event {
187182
Ok(espi::Event::PeripheralEvent(port_event)) => {
188183
info!(
189184
"eSPI PeripheralEvent Port: {}, direction: {}, address: {}, offset: {}, length: {}",
190-
port_event.port, port_event.direction, port_event.offset,
191-
port_event.base_addr, port_event.length,
185+
port_event.port, port_event.direction, port_event.offset, port_event.base_addr, port_event.length,
192186
);
193187

194188
// If it is a peripheral channel write, then we need to notify the service
195-
/*
196189
if port_event.direction {
197190
let res = espi_service
198191
.route_to_service(port_event.offset, port_event.length)
@@ -205,19 +198,16 @@ pub async fn espi_service(mut espi: espi::Espi<'static>, memory_map_buffer: &'st
205198
);
206199
}
207200
}
208-
*/
209201

210202
espi.complete_port(port_event.port).await;
211203
}
212204

213205
Ok(espi::Event::OOBEvent(port_event)) => {
214206
info!(
215207
"eSPI OOBEvent Port: {}, direction: {}, address: {}, offset: {}, length: {}",
216-
port_event.port, port_event.direction, port_event.offset,
217-
port_event.base_addr, port_event.length,
208+
port_event.port, port_event.direction, port_event.offset, port_event.base_addr, port_event.length,
218209
);
219210

220-
221211
if port_event.direction {
222212
unsafe {
223213
let src_slice = slice::from_raw_parts(port_event.base_addr as *const u8, port_event.length);
@@ -230,14 +220,14 @@ pub async fn espi_service(mut espi: espi::Espi<'static>, memory_map_buffer: &'st
230220
dest_slice[..src_slice.len()].copy_from_slice(src_slice);
231221
}
232222
Err(e) => {
233-
error!("Failed to retrieve OOB write buffer: {}",e)
223+
error!("Failed to retrieve OOB write buffer: {}", e)
234224
}
235225
}
236226
};
237227

238228
// Don't complete event until we read out OOB data
239229
espi.complete_port(port_event.port).await;
240-
230+
241231
// Test code send same data on loopback
242232
let _ = espi.oob_write_data(port_event.port, port_event.length as u8);
243233
} else {

0 commit comments

Comments
 (0)