aboutsummaryrefslogtreecommitdiff
path: root/embassy-net-driver-channel/src/lib.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-09-04 22:16:28 +0200
committerDario Nieuwenhuis <[email protected]>2023-09-04 22:16:28 +0200
commit615882ebd67f4e7e60fb8aa1505b1272655c4fa4 (patch)
treeb8b79f097f86d85d5a88ff83f27841a8a21b70ef /embassy-net-driver-channel/src/lib.rs
parent6e38b0764253ba07d3106ce3d57c2fd3509d7beb (diff)
Rename zero_copy -> zerocopy.
Diffstat (limited to 'embassy-net-driver-channel/src/lib.rs')
-rw-r--r--embassy-net-driver-channel/src/lib.rs26
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};
14use embassy_sync::blocking_mutex::raw::NoopRawMutex; 14use embassy_sync::blocking_mutex::raw::NoopRawMutex;
15use embassy_sync::blocking_mutex::Mutex; 15use embassy_sync::blocking_mutex::Mutex;
16use embassy_sync::waitqueue::WakerRegistration; 16use embassy_sync::waitqueue::WakerRegistration;
17use embassy_sync::zero_copy_channel; 17use embassy_sync::zerocopy_channel;
18 18
19pub struct State<const MTU: usize, const N_RX: usize, const N_TX: usize> { 19pub 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
37struct StateInner<'d, const MTU: usize> { 37struct 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
50pub struct Runner<'d, const MTU: usize> { 50pub 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
61pub struct RxRunner<'d, const MTU: usize> { 61pub 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
65pub struct TxRunner<'d, const MTU: usize> { 65pub 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
69impl<'d, const MTU: usize> Runner<'d, MTU> { 69impl<'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
285pub struct Device<'d, const MTU: usize> { 285pub 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
331pub struct RxToken<'a, const MTU: usize> { 331pub 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
335impl<'a, const MTU: usize> embassy_net_driver::RxToken for RxToken<'a, MTU> { 335impl<'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
348pub struct TxToken<'a, const MTU: usize> { 348pub 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
352impl<'a, const MTU: usize> embassy_net_driver::TxToken for TxToken<'a, MTU> { 352impl<'a, const MTU: usize> embassy_net_driver::TxToken for TxToken<'a, MTU> {