diff options
Diffstat (limited to 'embassy-net-driver-channel/src')
| -rw-r--r-- | embassy-net-driver-channel/src/lib.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/embassy-net-driver-channel/src/lib.rs b/embassy-net-driver-channel/src/lib.rs index a20760749..bf7ae5217 100644 --- a/embassy-net-driver-channel/src/lib.rs +++ b/embassy-net-driver-channel/src/lib.rs | |||
| @@ -14,7 +14,7 @@ use embassy_net_driver::{Capabilities, LinkState, Medium}; | |||
| 14 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; | 14 | use embassy_sync::blocking_mutex::raw::NoopRawMutex; |
| 15 | use embassy_sync::blocking_mutex::Mutex; | 15 | use embassy_sync::blocking_mutex::Mutex; |
| 16 | use embassy_sync::waitqueue::WakerRegistration; | 16 | use embassy_sync::waitqueue::WakerRegistration; |
| 17 | use embassy_sync::zero_copy_channel; | 17 | use embassy_sync::zerocopy_channel; |
| 18 | 18 | ||
| 19 | pub struct State<const MTU: usize, const N_RX: usize, const N_TX: usize> { | 19 | pub struct State<const MTU: usize, const N_RX: usize, const N_TX: usize> { |
| 20 | rx: [PacketBuf<MTU>; N_RX], | 20 | rx: [PacketBuf<MTU>; N_RX], |
| @@ -35,8 +35,8 @@ impl<const MTU: usize, const N_RX: usize, const N_TX: usize> State<MTU, N_RX, N_ | |||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | struct StateInner<'d, const MTU: usize> { | 37 | struct StateInner<'d, const MTU: usize> { |
| 38 | rx: zero_copy_channel::Channel<'d, NoopRawMutex, PacketBuf<MTU>>, | 38 | rx: zerocopy_channel::Channel<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 39 | tx: zero_copy_channel::Channel<'d, NoopRawMutex, PacketBuf<MTU>>, | 39 | tx: zerocopy_channel::Channel<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 40 | shared: Mutex<NoopRawMutex, RefCell<Shared>>, | 40 | shared: Mutex<NoopRawMutex, RefCell<Shared>>, |
| 41 | } | 41 | } |
| 42 | 42 | ||
| @@ -48,8 +48,8 @@ struct Shared { | |||
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | pub struct Runner<'d, const MTU: usize> { | 50 | pub struct Runner<'d, const MTU: usize> { |
| 51 | tx_chan: zero_copy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, | 51 | tx_chan: zerocopy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 52 | rx_chan: zero_copy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, | 52 | rx_chan: zerocopy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 53 | shared: &'d Mutex<NoopRawMutex, RefCell<Shared>>, | 53 | shared: &'d Mutex<NoopRawMutex, RefCell<Shared>>, |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -59,11 +59,11 @@ pub struct StateRunner<'d> { | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | pub struct RxRunner<'d, const MTU: usize> { | 61 | pub struct RxRunner<'d, const MTU: usize> { |
| 62 | rx_chan: zero_copy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, | 62 | rx_chan: zerocopy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | pub struct TxRunner<'d, const MTU: usize> { | 65 | pub struct TxRunner<'d, const MTU: usize> { |
| 66 | tx_chan: zero_copy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, | 66 | tx_chan: zerocopy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | impl<'d, const MTU: usize> Runner<'d, MTU> { | 69 | impl<'d, const MTU: usize> Runner<'d, MTU> { |
| @@ -244,8 +244,8 @@ pub fn new<'d, const MTU: usize, const N_RX: usize, const N_TX: usize>( | |||
| 244 | let state_uninit: *mut MaybeUninit<StateInner<'d, MTU>> = | 244 | let state_uninit: *mut MaybeUninit<StateInner<'d, MTU>> = |
| 245 | (&mut state.inner as *mut MaybeUninit<StateInner<'static, MTU>>).cast(); | 245 | (&mut state.inner as *mut MaybeUninit<StateInner<'static, MTU>>).cast(); |
| 246 | let state = unsafe { &mut *state_uninit }.write(StateInner { | 246 | let state = unsafe { &mut *state_uninit }.write(StateInner { |
| 247 | rx: zero_copy_channel::Channel::new(&mut state.rx[..]), | 247 | rx: zerocopy_channel::Channel::new(&mut state.rx[..]), |
| 248 | tx: zero_copy_channel::Channel::new(&mut state.tx[..]), | 248 | tx: zerocopy_channel::Channel::new(&mut state.tx[..]), |
| 249 | shared: Mutex::new(RefCell::new(Shared { | 249 | shared: Mutex::new(RefCell::new(Shared { |
| 250 | link_state: LinkState::Down, | 250 | link_state: LinkState::Down, |
| 251 | hardware_address, | 251 | hardware_address, |
| @@ -283,8 +283,8 @@ impl<const MTU: usize> PacketBuf<MTU> { | |||
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | pub struct Device<'d, const MTU: usize> { | 285 | pub struct Device<'d, const MTU: usize> { |
| 286 | rx: zero_copy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, | 286 | rx: zerocopy_channel::Receiver<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 287 | tx: zero_copy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, | 287 | tx: zerocopy_channel::Sender<'d, NoopRawMutex, PacketBuf<MTU>>, |
| 288 | shared: &'d Mutex<NoopRawMutex, RefCell<Shared>>, | 288 | shared: &'d Mutex<NoopRawMutex, RefCell<Shared>>, |
| 289 | caps: Capabilities, | 289 | caps: Capabilities, |
| 290 | } | 290 | } |
| @@ -329,7 +329,7 @@ impl<'d, const MTU: usize> embassy_net_driver::Driver for Device<'d, MTU> { | |||
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | pub struct RxToken<'a, const MTU: usize> { | 331 | pub struct RxToken<'a, const MTU: usize> { |
| 332 | rx: zero_copy_channel::Receiver<'a, NoopRawMutex, PacketBuf<MTU>>, | 332 | rx: zerocopy_channel::Receiver<'a, NoopRawMutex, PacketBuf<MTU>>, |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | impl<'a, const MTU: usize> embassy_net_driver::RxToken for RxToken<'a, MTU> { | 335 | impl<'a, const MTU: usize> embassy_net_driver::RxToken for RxToken<'a, MTU> { |
| @@ -346,7 +346,7 @@ impl<'a, const MTU: usize> embassy_net_driver::RxToken for RxToken<'a, MTU> { | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | pub struct TxToken<'a, const MTU: usize> { | 348 | pub struct TxToken<'a, const MTU: usize> { |
| 349 | tx: zero_copy_channel::Sender<'a, NoopRawMutex, PacketBuf<MTU>>, | 349 | tx: zerocopy_channel::Sender<'a, NoopRawMutex, PacketBuf<MTU>>, |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | impl<'a, const MTU: usize> embassy_net_driver::TxToken for TxToken<'a, MTU> { | 352 | impl<'a, const MTU: usize> embassy_net_driver::TxToken for TxToken<'a, MTU> { |
