diff options
| author | xoviat <[email protected]> | 2023-07-15 14:47:34 -0500 |
|---|---|---|
| committer | xoviat <[email protected]> | 2023-07-15 14:47:34 -0500 |
| commit | 4db4200c37c191f4ec018dd318e805aa805d9cc3 (patch) | |
| tree | b7c5ea2fdae0f23819af90515b7e3d5e6fa0d028 | |
| parent | 3705b4f40d206490a5165a287791206ac70573d9 (diff) | |
wpan: factor mac logic into other mod
| -rw-r--r-- | embassy-stm32-wpan/src/lib.rs | 3 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/commands.rs (renamed from embassy-stm32-wpan/src/sub/mac/commands.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/consts.rs (renamed from embassy-stm32-wpan/src/sub/mac/consts.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/event.rs (renamed from embassy-stm32-wpan/src/sub/mac/event.rs) | 2 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/helpers.rs (renamed from embassy-stm32-wpan/src/sub/mac/helpers.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/indications.rs (renamed from embassy-stm32-wpan/src/sub/mac/indications.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/macros.rs (renamed from embassy-stm32-wpan/src/sub/mac/macros.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/mod.rs | 9 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/opcodes.rs (renamed from embassy-stm32-wpan/src/sub/mac/opcodes.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/responses.rs (renamed from embassy-stm32-wpan/src/sub/mac/responses.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/mac/typedefs.rs (renamed from embassy-stm32-wpan/src/sub/mac/typedefs.rs) | 0 | ||||
| -rw-r--r-- | embassy-stm32-wpan/src/sub/mac.rs (renamed from embassy-stm32-wpan/src/sub/mac/mod.rs) | 16 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/mac_ffd.rs | 6 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/mac_rfd.rs | 6 | ||||
| -rw-r--r-- | tests/stm32/src/bin/wpan_mac.rs | 6 |
15 files changed, 25 insertions, 23 deletions
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs index 3a45c5978..57f0dc4fa 100644 --- a/embassy-stm32-wpan/src/lib.rs +++ b/embassy-stm32-wpan/src/lib.rs | |||
| @@ -26,6 +26,9 @@ pub mod sub; | |||
| 26 | pub mod tables; | 26 | pub mod tables; |
| 27 | pub mod unsafe_linked_list; | 27 | pub mod unsafe_linked_list; |
| 28 | 28 | ||
| 29 | #[cfg(feature = "mac")] | ||
| 30 | pub mod mac; | ||
| 31 | |||
| 29 | #[cfg(feature = "ble")] | 32 | #[cfg(feature = "ble")] |
| 30 | pub use crate::sub::ble::hci; | 33 | pub use crate::sub::ble::hci; |
| 31 | 34 | ||
diff --git a/embassy-stm32-wpan/src/sub/mac/commands.rs b/embassy-stm32-wpan/src/mac/commands.rs index 8cfa0a054..8cfa0a054 100644 --- a/embassy-stm32-wpan/src/sub/mac/commands.rs +++ b/embassy-stm32-wpan/src/mac/commands.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/consts.rs b/embassy-stm32-wpan/src/mac/consts.rs index 56903d980..56903d980 100644 --- a/embassy-stm32-wpan/src/sub/mac/consts.rs +++ b/embassy-stm32-wpan/src/mac/consts.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/event.rs b/embassy-stm32-wpan/src/mac/event.rs index aaf965565..dfce21fea 100644 --- a/embassy-stm32-wpan/src/sub/mac/event.rs +++ b/embassy-stm32-wpan/src/mac/event.rs | |||
| @@ -7,7 +7,7 @@ use super::responses::{ | |||
| 7 | AssociateConfirm, CalibrateConfirm, DataConfirm, DisassociateConfirm, DpsConfirm, GetConfirm, GtsConfirm, | 7 | AssociateConfirm, CalibrateConfirm, DataConfirm, DisassociateConfirm, DpsConfirm, GetConfirm, GtsConfirm, |
| 8 | PollConfirm, PurgeConfirm, ResetConfirm, RxEnableConfirm, ScanConfirm, SetConfirm, SoundingConfirm, StartConfirm, | 8 | PollConfirm, PurgeConfirm, ResetConfirm, RxEnableConfirm, ScanConfirm, SetConfirm, SoundingConfirm, StartConfirm, |
| 9 | }; | 9 | }; |
| 10 | use crate::sub::mac::opcodes::OpcodeM0ToM4; | 10 | use crate::mac::opcodes::OpcodeM0ToM4; |
| 11 | 11 | ||
| 12 | pub trait ParseableMacEvent { | 12 | pub trait ParseableMacEvent { |
| 13 | const SIZE: usize; | 13 | const SIZE: usize; |
diff --git a/embassy-stm32-wpan/src/sub/mac/helpers.rs b/embassy-stm32-wpan/src/mac/helpers.rs index 5a5bf8a85..5a5bf8a85 100644 --- a/embassy-stm32-wpan/src/sub/mac/helpers.rs +++ b/embassy-stm32-wpan/src/mac/helpers.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/indications.rs b/embassy-stm32-wpan/src/mac/indications.rs index 6df4aa23a..6df4aa23a 100644 --- a/embassy-stm32-wpan/src/sub/mac/indications.rs +++ b/embassy-stm32-wpan/src/mac/indications.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/macros.rs b/embassy-stm32-wpan/src/mac/macros.rs index 1a988a779..1a988a779 100644 --- a/embassy-stm32-wpan/src/sub/mac/macros.rs +++ b/embassy-stm32-wpan/src/mac/macros.rs | |||
diff --git a/embassy-stm32-wpan/src/mac/mod.rs b/embassy-stm32-wpan/src/mac/mod.rs new file mode 100644 index 000000000..1af8fe6ba --- /dev/null +++ b/embassy-stm32-wpan/src/mac/mod.rs | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | pub mod commands; | ||
| 2 | mod consts; | ||
| 3 | pub mod event; | ||
| 4 | mod helpers; | ||
| 5 | pub mod indications; | ||
| 6 | mod macros; | ||
| 7 | mod opcodes; | ||
| 8 | pub mod responses; | ||
| 9 | pub mod typedefs; | ||
diff --git a/embassy-stm32-wpan/src/sub/mac/opcodes.rs b/embassy-stm32-wpan/src/mac/opcodes.rs index fd7011873..fd7011873 100644 --- a/embassy-stm32-wpan/src/sub/mac/opcodes.rs +++ b/embassy-stm32-wpan/src/mac/opcodes.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/responses.rs b/embassy-stm32-wpan/src/mac/responses.rs index 2f6f5bf58..2f6f5bf58 100644 --- a/embassy-stm32-wpan/src/sub/mac/responses.rs +++ b/embassy-stm32-wpan/src/mac/responses.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/typedefs.rs b/embassy-stm32-wpan/src/mac/typedefs.rs index 30c7731b2..30c7731b2 100644 --- a/embassy-stm32-wpan/src/sub/mac/typedefs.rs +++ b/embassy-stm32-wpan/src/mac/typedefs.rs | |||
diff --git a/embassy-stm32-wpan/src/sub/mac/mod.rs b/embassy-stm32-wpan/src/sub/mac.rs index ab39f89c2..4893cb47b 100644 --- a/embassy-stm32-wpan/src/sub/mac/mod.rs +++ b/embassy-stm32-wpan/src/sub/mac.rs | |||
| @@ -8,25 +8,15 @@ use embassy_futures::poll_once; | |||
| 8 | use embassy_stm32::ipcc::Ipcc; | 8 | use embassy_stm32::ipcc::Ipcc; |
| 9 | use embassy_sync::waitqueue::AtomicWaker; | 9 | use embassy_sync::waitqueue::AtomicWaker; |
| 10 | 10 | ||
| 11 | use self::commands::MacCommand; | ||
| 12 | use self::event::MacEvent; | ||
| 13 | use self::typedefs::MacError; | ||
| 14 | use crate::cmd::CmdPacket; | 11 | use crate::cmd::CmdPacket; |
| 15 | use crate::consts::TlPacketType; | 12 | use crate::consts::TlPacketType; |
| 16 | use crate::evt::{EvtBox, EvtPacket}; | 13 | use crate::evt::{EvtBox, EvtPacket}; |
| 14 | use crate::mac::commands::MacCommand; | ||
| 15 | use crate::mac::event::MacEvent; | ||
| 16 | use crate::mac::typedefs::MacError; | ||
| 17 | use crate::tables::{MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER}; | 17 | use crate::tables::{MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER}; |
| 18 | use crate::{channels, evt}; | 18 | use crate::{channels, evt}; |
| 19 | 19 | ||
| 20 | pub mod commands; | ||
| 21 | mod consts; | ||
| 22 | pub mod event; | ||
| 23 | mod helpers; | ||
| 24 | pub mod indications; | ||
| 25 | mod macros; | ||
| 26 | mod opcodes; | ||
| 27 | pub mod responses; | ||
| 28 | pub mod typedefs; | ||
| 29 | |||
| 30 | static MAC_WAKER: AtomicWaker = AtomicWaker::new(); | 20 | static MAC_WAKER: AtomicWaker = AtomicWaker::new(); |
| 31 | static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); | 21 | static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); |
| 32 | 22 | ||
diff --git a/examples/stm32wb/src/bin/mac_ffd.rs b/examples/stm32wb/src/bin/mac_ffd.rs index 689a28353..e4d81997e 100644 --- a/examples/stm32wb/src/bin/mac_ffd.rs +++ b/examples/stm32wb/src/bin/mac_ffd.rs | |||
| @@ -6,9 +6,9 @@ use defmt::*; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::bind_interrupts; | 7 | use embassy_stm32::bind_interrupts; |
| 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 9 | use embassy_stm32_wpan::sub::mac::commands::{AssociateResponse, ResetRequest, SetRequest, StartRequest}; | 9 | use embassy_stm32_wpan::mac::commands::{AssociateResponse, ResetRequest, SetRequest, StartRequest}; |
| 10 | use embassy_stm32_wpan::sub::mac::event::MacEvent; | 10 | use embassy_stm32_wpan::mac::event::MacEvent; |
| 11 | use embassy_stm32_wpan::sub::mac::typedefs::{MacChannel, MacStatus, PanId, PibId, SecurityLevel}; | 11 | use embassy_stm32_wpan::mac::typedefs::{MacChannel, MacStatus, PanId, PibId, SecurityLevel}; |
| 12 | use embassy_stm32_wpan::sub::mm; | 12 | use embassy_stm32_wpan::sub::mm; |
| 13 | use embassy_stm32_wpan::TlMbox; | 13 | use embassy_stm32_wpan::TlMbox; |
| 14 | use {defmt_rtt as _, panic_probe as _}; | 14 | use {defmt_rtt as _, panic_probe as _}; |
diff --git a/examples/stm32wb/src/bin/mac_rfd.rs b/examples/stm32wb/src/bin/mac_rfd.rs index ea349f9a8..b2dac72cc 100644 --- a/examples/stm32wb/src/bin/mac_rfd.rs +++ b/examples/stm32wb/src/bin/mac_rfd.rs | |||
| @@ -6,9 +6,9 @@ use defmt::*; | |||
| 6 | use embassy_executor::Spawner; | 6 | use embassy_executor::Spawner; |
| 7 | use embassy_stm32::bind_interrupts; | 7 | use embassy_stm32::bind_interrupts; |
| 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 9 | use embassy_stm32_wpan::sub::mac::commands::{AssociateRequest, DataRequest, GetRequest, ResetRequest, SetRequest}; | 9 | use embassy_stm32_wpan::mac::commands::{AssociateRequest, DataRequest, GetRequest, ResetRequest, SetRequest}; |
| 10 | use embassy_stm32_wpan::sub::mac::event::MacEvent; | 10 | use embassy_stm32_wpan::mac::event::MacEvent; |
| 11 | use embassy_stm32_wpan::sub::mac::typedefs::{ | 11 | use embassy_stm32_wpan::mac::typedefs::{ |
| 12 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, | 12 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, |
| 13 | }; | 13 | }; |
| 14 | use embassy_stm32_wpan::sub::mm; | 14 | use embassy_stm32_wpan::sub::mm; |
diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs index d97a4d404..cfa0aca3b 100644 --- a/tests/stm32/src/bin/wpan_mac.rs +++ b/tests/stm32/src/bin/wpan_mac.rs | |||
| @@ -10,9 +10,9 @@ use common::*; | |||
| 10 | use embassy_executor::Spawner; | 10 | use embassy_executor::Spawner; |
| 11 | use embassy_stm32::bind_interrupts; | 11 | use embassy_stm32::bind_interrupts; |
| 12 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | 12 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; |
| 13 | use embassy_stm32_wpan::sub::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; | 13 | use embassy_stm32_wpan::mac::commands::{AssociateRequest, GetRequest, ResetRequest, SetRequest}; |
| 14 | use embassy_stm32_wpan::sub::mac::event::MacEvent; | 14 | use embassy_stm32_wpan::mac::event::MacEvent; |
| 15 | use embassy_stm32_wpan::sub::mac::typedefs::{ | 15 | use embassy_stm32_wpan::mac::typedefs::{ |
| 16 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, | 16 | AddressMode, Capabilities, KeyIdMode, MacAddress, MacChannel, PanId, PibId, SecurityLevel, |
| 17 | }; | 17 | }; |
| 18 | use embassy_stm32_wpan::sub::mm; | 18 | use embassy_stm32_wpan::sub::mm; |
