Skip to content

Commit

Permalink
Bump smoltcp
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan committed Nov 21, 2024
1 parent e751a71 commit 95afd4a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 17 deletions.
3 changes: 1 addition & 2 deletions firmware-binaries/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 firmware-binaries/examples/smoltcp_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ bittide-sys = { path = "../../../firmware-support/bittide-sys" }
riscv-rt = "0.11.0"
riscv = "^0.10"
heapless = { version = "0.8", default-features = false}
smoltcp = { version = "0.11", default-features = false, features = ["medium-ethernet", "proto-ipv4", "socket-tcp", "socket-dhcpv4"] }
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "dc08e0b42e668c331bb2b6f8d80016301d0efe03", default-features = false, features = ["medium-ethernet", "proto-ipv4", "socket-tcp", "socket-dhcpv4"] }
ufmt = "0.2.0"
log = {version = "0.4.21", features = ["max_level_off", "release_max_level_info"]}
3 changes: 1 addition & 2 deletions firmware-support/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 firmware-support/bittide-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fdt = "0.1.0"
heapless = { version = "0.8", features = ["ufmt"]}
log = "0.4.21"
rand = {version = "0.8.3", features = ["small_rng"], default-features = false }
smoltcp = { version = "0.11", default-features = false, features = ["log", "medium-ethernet", "proto-ipv4", "socket-tcp"] }
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp.git", rev = "dc08e0b42e668c331bb2b6f8d80016301d0efe03", default-features = false, features = ["log", "medium-ethernet", "proto-ipv4", "socket-tcp"] }
ufmt = "0.2.0"

[dev-dependencies]
Expand Down
11 changes: 2 additions & 9 deletions firmware-support/bittide-sys/src/smoltcp/axi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,13 @@ pub struct RxToken<'a, const BUFFER_SIZE: usize> {
impl<const BUFFER_SIZE: usize> phy::RxToken for RxToken<'_, BUFFER_SIZE> {
fn consume<R, F>(self, f: F) -> R
where
F: FnOnce(&mut [u8]) -> R,
F: FnOnce(&[u8]) -> R,
{
// Get a slice containing the received data
let buf = self.axi_rx.get_slice();

// TODO: This is a hack to get around the fact that the buffer is not mutable,
// but the smoltcp API requires it to be. This Should be fixed by
// https://github.com/smoltcp-rs/smoltcp/pull/924
#[allow(clippy::cast_ref_to_mut)]
let mutable_buf =
unsafe { core::slice::from_raw_parts_mut(buf.as_ptr().cast_mut(), buf.len()) };

// Process the received data
let r = f(mutable_buf);
let r = f(buf);

// Clear the packet and status registers
self.axi_rx.clear_packet();
Expand Down
3 changes: 1 addition & 2 deletions host-tools/Cargo.lock

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

0 comments on commit 95afd4a

Please sign in to comment.