aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-07-16 12:41:57 -0500
committerxoviat <[email protected]>2023-07-16 12:41:57 -0500
commite95a7dc555f367534d3b8bc7a9b6f2d361b0d951 (patch)
treeb7f692fb1957fac70397cdc4a3686473cd8278df
parentc7ec45a004750f590c1d9ea4a721972efe133b8e (diff)
wpan/mac: use slice view to avoid copy
-rw-r--r--embassy-stm32-wpan/src/mac/commands.rs83
-rw-r--r--embassy-stm32-wpan/src/mac/typedefs.rs2
-rw-r--r--embassy-stm32-wpan/src/sub/mac.rs9
-rw-r--r--examples/stm32wb/src/bin/mac_ffd.rs5
-rw-r--r--examples/stm32wb/src/bin/mac_rfd.rs35
-rw-r--r--tests/stm32/src/bin/wpan_mac.rs6
6 files changed, 77 insertions, 63 deletions
diff --git a/embassy-stm32-wpan/src/mac/commands.rs b/embassy-stm32-wpan/src/mac/commands.rs
index 8cfa0a054..8acae24bb 100644
--- a/embassy-stm32-wpan/src/mac/commands.rs
+++ b/embassy-stm32-wpan/src/mac/commands.rs
@@ -1,15 +1,16 @@
1use core::{mem, slice};
2
1use super::opcodes::OpcodeM4ToM0; 3use super::opcodes::OpcodeM4ToM0;
2use super::typedefs::{ 4use super::typedefs::{
3 AddressMode, Capabilities, DisassociationReason, GtsCharacteristics, KeyIdMode, MacAddress, MacChannel, MacStatus, 5 AddressMode, Capabilities, DisassociationReason, GtsCharacteristics, KeyIdMode, MacAddress, MacChannel, MacStatus,
4 PanId, PibId, ScanType, SecurityLevel, 6 PanId, PibId, ScanType, SecurityLevel,
5}; 7};
6 8
7pub trait MacCommand { 9pub trait MacCommand: Sized {
8 const OPCODE: OpcodeM4ToM0; 10 const OPCODE: OpcodeM4ToM0;
9 const SIZE: usize;
10 11
11 fn copy_into_slice(&self, buf: &mut [u8]) { 12 fn payload<'a>(&'a self) -> &'a [u8] {
12 unsafe { core::ptr::copy(self as *const _ as *const u8, buf as *mut _ as *mut u8, Self::SIZE) }; 13 unsafe { slice::from_raw_parts(self as *const _ as *const u8, mem::size_of::<Self>()) }
13 } 14 }
14} 15}
15 16
@@ -41,7 +42,6 @@ pub struct AssociateRequest {
41 42
42impl MacCommand for AssociateRequest { 43impl MacCommand for AssociateRequest {
43 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeAssociateReq; 44 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeAssociateReq;
44 const SIZE: usize = 25;
45} 45}
46 46
47/// MLME DISASSOCIATE Request sed to request a disassociation 47/// MLME DISASSOCIATE Request sed to request a disassociation
@@ -70,20 +70,22 @@ pub struct DisassociateRequest {
70 70
71impl MacCommand for DisassociateRequest { 71impl MacCommand for DisassociateRequest {
72 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeDisassociateReq; 72 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeDisassociateReq;
73 const SIZE: usize = 24;
74} 73}
75 74
76/// MLME GET Request used to request a PIB value 75/// MLME GET Request used to request a PIB value
77#[repr(C)] 76#[repr(C)]
77#[derive(Default)]
78#[cfg_attr(feature = "defmt", derive(defmt::Format))] 78#[cfg_attr(feature = "defmt", derive(defmt::Format))]
79pub struct GetRequest { 79pub struct GetRequest {
80 /// the name of the PIB attribute to read 80 /// the name of the PIB attribute to read
81 pub pib_attribute: PibId, 81 pub pib_attribute: PibId,
82
83 /// byte stuffing to keep 32 bit alignment
84 pub a_stuffing: [u8; 3],
82} 85}
83 86
84impl MacCommand for GetRequest { 87impl MacCommand for GetRequest {
85 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeGetReq; 88 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeGetReq;
86 const SIZE: usize = 4;
87} 89}
88 90
89/// MLME GTS Request used to request and maintain GTSs 91/// MLME GTS Request used to request and maintain GTSs
@@ -104,19 +106,20 @@ pub struct GtsRequest {
104 106
105impl MacCommand for GtsRequest { 107impl MacCommand for GtsRequest {
106 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeGetReq; 108 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeGetReq;
107 const SIZE: usize = 12;
108} 109}
109 110
110#[repr(C)] 111#[repr(C)]
112#[derive(Default)]
111#[cfg_attr(feature = "defmt", derive(defmt::Format))] 113#[cfg_attr(feature = "defmt", derive(defmt::Format))]
112pub struct ResetRequest { 114pub struct ResetRequest {
113 /// MAC PIB attributes are set to their default values or not during reset 115 /// MAC PIB attributes are set to their default values or not during reset
114 pub set_default_pib: bool, 116 pub set_default_pib: bool,
117 /// byte stuffing to keep 32 bit alignment
118 pub a_stuffing: [u8; 3],
115} 119}
116 120
117impl MacCommand for ResetRequest { 121impl MacCommand for ResetRequest {
118 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeResetReq; 122 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeResetReq;
119 const SIZE: usize = 4;
120} 123}
121 124
122/// MLME RX ENABLE Request used to request that the receiver is either enabled 125/// MLME RX ENABLE Request used to request that the receiver is either enabled
@@ -129,6 +132,8 @@ pub struct RxEnableRequest {
129 /// configure the transceiver to RX with ranging for a value of 132 /// configure the transceiver to RX with ranging for a value of
130 /// RANGING_ON or to not enable ranging for RANGING_OFF 133 /// RANGING_ON or to not enable ranging for RANGING_OFF
131 pub ranging_rx_control: u8, 134 pub ranging_rx_control: u8,
135 /// byte stuffing to keep 32 bit alignment
136 pub a_stuffing: [u8; 2],
132 /// number of symbols measured before the receiver is to be enabled or disabled 137 /// number of symbols measured before the receiver is to be enabled or disabled
133 pub rx_on_time: [u8; 4], 138 pub rx_on_time: [u8; 4],
134 /// number of symbols for which the receiver is to be enabled 139 /// number of symbols for which the receiver is to be enabled
@@ -137,19 +142,6 @@ pub struct RxEnableRequest {
137 142
138impl MacCommand for RxEnableRequest { 143impl MacCommand for RxEnableRequest {
139 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeRxEnableReq; 144 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeRxEnableReq;
140 const SIZE: usize = 12;
141
142 fn copy_into_slice(&self, buf: &mut [u8]) {
143 buf[0] = self.defer_permit as u8;
144 buf[1] = self.ranging_rx_control as u8;
145
146 // stuffing to keep 32bit alignment
147 buf[2] = 0;
148 buf[3] = 0;
149
150 buf[4..8].copy_from_slice(&self.rx_on_time);
151 buf[8..12].copy_from_slice(&self.rx_on_duration);
152 }
153} 145}
154 146
155/// MLME SCAN Request used to initiate a channel scan over a given list of channels 147/// MLME SCAN Request used to initiate a channel scan over a given list of channels
@@ -172,11 +164,12 @@ pub struct ScanRequest {
172 pub key_id_mode: KeyIdMode, 164 pub key_id_mode: KeyIdMode,
173 /// index of the key to be used 165 /// index of the key to be used
174 pub key_index: u8, 166 pub key_index: u8,
167 /// byte stuffing to keep 32 bit alignment
168 pub a_stuffing: [u8; 2],
175} 169}
176 170
177impl MacCommand for ScanRequest { 171impl MacCommand for ScanRequest {
178 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeScanReq; 172 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeScanReq;
179 const SIZE: usize = 20;
180} 173}
181 174
182/// MLME SET Request used to attempt to write the given value to the indicated PIB attribute 175/// MLME SET Request used to attempt to write the given value to the indicated PIB attribute
@@ -191,13 +184,12 @@ pub struct SetRequest {
191 184
192impl MacCommand for SetRequest { 185impl MacCommand for SetRequest {
193 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSetReq; 186 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSetReq;
194 const SIZE: usize = 8;
195} 187}
196 188
197/// MLME START Request used by the FFDs to intiate a new PAN or to begin using a new superframe 189/// MLME START Request used by the FFDs to intiate a new PAN or to begin using a new superframe
198/// configuration 190/// configuration
199#[derive(Default)]
200#[repr(C)] 191#[repr(C)]
192#[derive(Default)]
201#[cfg_attr(feature = "defmt", derive(defmt::Format))] 193#[cfg_attr(feature = "defmt", derive(defmt::Format))]
202pub struct StartRequest { 194pub struct StartRequest {
203 /// PAN indentifier to used by the device 195 /// PAN indentifier to used by the device
@@ -236,7 +228,6 @@ pub struct StartRequest {
236 228
237impl MacCommand for StartRequest { 229impl MacCommand for StartRequest {
238 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeStartReq; 230 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeStartReq;
239 const SIZE: usize = 35;
240} 231}
241 232
242/// MLME SYNC Request used to synchronize with the coordinator by acquiring and, if 233/// MLME SYNC Request used to synchronize with the coordinator by acquiring and, if
@@ -253,11 +244,12 @@ pub struct SyncRequest {
253 /// 244 ///
254 /// `false` if the MLME is to synchronize with only the next beacon 245 /// `false` if the MLME is to synchronize with only the next beacon
255 pub track_beacon: bool, 246 pub track_beacon: bool,
247 /// byte stuffing to keep 32 bit alignment
248 pub a_stuffing: [u8; 1],
256} 249}
257 250
258impl MacCommand for SyncRequest { 251impl MacCommand for SyncRequest {
259 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSyncReq; 252 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSyncReq;
260 const SIZE: usize = 4;
261} 253}
262 254
263/// MLME POLL Request propmts the device to request data from the coordinator 255/// MLME POLL Request propmts the device to request data from the coordinator
@@ -278,11 +270,12 @@ pub struct PollRequest {
278 pub key_source: [u8; 8], 270 pub key_source: [u8; 8],
279 /// PAN identifier of the coordinator 271 /// PAN identifier of the coordinator
280 pub coord_pan_id: PanId, 272 pub coord_pan_id: PanId,
273 /// byte stuffing to keep 32 bit alignment
274 pub a_stuffing: [u8; 2],
281} 275}
282 276
283impl MacCommand for PollRequest { 277impl MacCommand for PollRequest {
284 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmePollReq; 278 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmePollReq;
285 const SIZE: usize = 24;
286} 279}
287 280
288/// MLME DPS Request allows the next higher layer to request that the PHY utilize a 281/// MLME DPS Request allows the next higher layer to request that the PHY utilize a
@@ -297,33 +290,38 @@ pub struct DpsRequest {
297 /// the number of symbols for which the transmitter and receiver will utilize the 290 /// the number of symbols for which the transmitter and receiver will utilize the
298 /// respective DPS indices 291 /// respective DPS indices
299 dps_index_duration: u8, 292 dps_index_duration: u8,
293 /// byte stuffing to keep 32 bit alignment
294 pub a_stuffing: [u8; 1],
300} 295}
301 296
302impl MacCommand for DpsRequest { 297impl MacCommand for DpsRequest {
303 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeDpsReq; 298 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeDpsReq;
304 const SIZE: usize = 4;
305} 299}
306 300
307/// MLME SOUNDING request primitive which is used by the next higher layer to request that 301/// MLME SOUNDING request primitive which is used by the next higher layer to request that
308/// the PHY respond with channel sounding information 302/// the PHY respond with channel sounding information
309#[repr(C)] 303#[repr(C)]
310#[cfg_attr(feature = "defmt", derive(defmt::Format))] 304#[cfg_attr(feature = "defmt", derive(defmt::Format))]
311pub struct SoundingRequest; 305pub struct SoundingRequest {
306 /// byte stuffing to keep 32 bit alignment
307 pub a_stuffing: [u8; 4],
308}
312 309
313impl MacCommand for SoundingRequest { 310impl MacCommand for SoundingRequest {
314 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSoundingReq; 311 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeSoundingReq;
315 const SIZE: usize = 4;
316} 312}
317 313
318/// MLME CALIBRATE request primitive which used to obtain the results of a ranging 314/// MLME CALIBRATE request primitive which used to obtain the results of a ranging
319/// calibration request from an RDEV 315/// calibration request from an RDEV
320#[repr(C)] 316#[repr(C)]
321#[cfg_attr(feature = "defmt", derive(defmt::Format))] 317#[cfg_attr(feature = "defmt", derive(defmt::Format))]
322pub struct CalibrateRequest; 318pub struct CalibrateRequest {
319 /// byte stuffing to keep 32 bit alignment
320 pub a_stuffing: [u8; 4],
321}
323 322
324impl MacCommand for CalibrateRequest { 323impl MacCommand for CalibrateRequest {
325 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeCalibrateReq; 324 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeCalibrateReq;
326 const SIZE: usize = 4;
327} 325}
328 326
329/// MCPS DATA Request used for MAC data related requests from the application 327/// MCPS DATA Request used for MAC data related requests from the application
@@ -370,6 +368,15 @@ pub struct DataRequest {
370 pub datrate: u8, 368 pub datrate: u8,
371} 369}
372 370
371impl DataRequest {
372 pub fn set_buffer<'a>(&'a mut self, buf: &'a [u8]) -> &mut Self {
373 self.msdu_ptr = &buf as *const _ as *const u8;
374 self.msdu_length = buf.len() as u8;
375
376 self
377 }
378}
379
373impl Default for DataRequest { 380impl Default for DataRequest {
374 fn default() -> Self { 381 fn default() -> Self {
375 Self { 382 Self {
@@ -397,7 +404,6 @@ impl Default for DataRequest {
397 404
398impl MacCommand for DataRequest { 405impl MacCommand for DataRequest {
399 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::McpsDataReq; 406 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::McpsDataReq;
400 const SIZE: usize = 40;
401} 407}
402 408
403/// for MCPS PURGE Request used to purge an MSDU from the transaction queue 409/// for MCPS PURGE Request used to purge an MSDU from the transaction queue
@@ -407,11 +413,12 @@ pub struct PurgeRequest {
407 /// the handle associated with the MSDU to be purged from the transaction 413 /// the handle associated with the MSDU to be purged from the transaction
408 /// queue 414 /// queue
409 pub msdu_handle: u8, 415 pub msdu_handle: u8,
416 /// byte stuffing to keep 32 bit alignment
417 pub a_stuffing: [u8; 3],
410} 418}
411 419
412impl MacCommand for PurgeRequest { 420impl MacCommand for PurgeRequest {
413 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::McpsPurgeReq; 421 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::McpsPurgeReq;
414 const SIZE: usize = 4;
415} 422}
416 423
417/// MLME ASSOCIATE Response used to initiate a response to an MLME-ASSOCIATE.indication 424/// MLME ASSOCIATE Response used to initiate a response to an MLME-ASSOCIATE.indication
@@ -434,11 +441,12 @@ pub struct AssociateResponse {
434 pub key_id_mode: KeyIdMode, 441 pub key_id_mode: KeyIdMode,
435 /// the index of the key to be used 442 /// the index of the key to be used
436 pub key_index: u8, 443 pub key_index: u8,
444 /// byte stuffing to keep 32 bit alignment
445 pub a_stuffing: [u8; 2],
437} 446}
438 447
439impl MacCommand for AssociateResponse { 448impl MacCommand for AssociateResponse {
440 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeAssociateRes; 449 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeAssociateRes;
441 const SIZE: usize = 24;
442} 450}
443 451
444/// MLME ORPHAN Response used to respond to the MLME ORPHAN Indication 452/// MLME ORPHAN Response used to respond to the MLME ORPHAN Indication
@@ -459,9 +467,10 @@ pub struct OrphanResponse {
459 pub key_id_mode: KeyIdMode, 467 pub key_id_mode: KeyIdMode,
460 /// the index of the key to be used 468 /// the index of the key to be used
461 pub key_index: u8, 469 pub key_index: u8,
470 /// byte stuffing to keep 32 bit alignment
471 pub a_stuffing: [u8; 2],
462} 472}
463 473
464impl MacCommand for OrphanResponse { 474impl MacCommand for OrphanResponse {
465 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeOrphanRes; 475 const OPCODE: OpcodeM4ToM0 = OpcodeM4ToM0::MlmeOrphanRes;
466 const SIZE: usize = 24;
467} 476}
diff --git a/embassy-stm32-wpan/src/mac/typedefs.rs b/embassy-stm32-wpan/src/mac/typedefs.rs
index 30c7731b2..98c67c86b 100644
--- a/embassy-stm32-wpan/src/mac/typedefs.rs
+++ b/embassy-stm32-wpan/src/mac/typedefs.rs
@@ -37,9 +37,11 @@ numeric_enum! {
37numeric_enum! { 37numeric_enum! {
38 #[repr(u8)] 38 #[repr(u8)]
39 /// this enum contains all the MAC PIB Ids 39 /// this enum contains all the MAC PIB Ids
40 #[derive(Default)]
40 #[cfg_attr(feature = "defmt", derive(defmt::Format))] 41 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
41 pub enum PibId { 42 pub enum PibId {
42 // PHY 43 // PHY
44 #[default]
43 CurrentChannel = 0x00, 45 CurrentChannel = 0x00,
44 ChannelsSupported = 0x01, 46 ChannelsSupported = 0x01,
45 TransmitPower = 0x02, 47 TransmitPower = 0x02,
diff --git a/embassy-stm32-wpan/src/sub/mac.rs b/embassy-stm32-wpan/src/sub/mac.rs
index 4893cb47b..d30ed2f11 100644
--- a/embassy-stm32-wpan/src/sub/mac.rs
+++ b/embassy-stm32-wpan/src/sub/mac.rs
@@ -85,12 +85,7 @@ impl Mac {
85 where 85 where
86 T: MacCommand, 86 T: MacCommand,
87 { 87 {
88 let mut payload = [0u8; MAX_PACKET_SIZE]; 88 let response = self.tl_write_and_get_response(T::OPCODE as u16, cmd.payload()).await;
89 cmd.copy_into_slice(&mut payload);
90
91 let response = self
92 .tl_write_and_get_response(T::OPCODE as u16, &payload[..T::SIZE])
93 .await;
94 89
95 if response == 0x00 { 90 if response == 0x00 {
96 Ok(()) 91 Ok(())
@@ -107,8 +102,6 @@ impl Mac {
107 } 102 }
108} 103}
109 104
110const MAX_PACKET_SIZE: usize = 255;
111
112impl evt::MemoryManager for Mac { 105impl evt::MemoryManager for Mac {
113 /// SAFETY: passing a pointer to something other than a managed event packet is UB 106 /// SAFETY: passing a pointer to something other than a managed event packet is UB
114 unsafe fn drop_event_packet(_: *mut EvtPacket) { 107 unsafe fn drop_event_packet(_: *mut EvtPacket) {
diff --git a/examples/stm32wb/src/bin/mac_ffd.rs b/examples/stm32wb/src/bin/mac_ffd.rs
index e4d81997e..f8c8ba288 100644
--- a/examples/stm32wb/src/bin/mac_ffd.rs
+++ b/examples/stm32wb/src/bin/mac_ffd.rs
@@ -67,7 +67,10 @@ async fn main(spawner: Spawner) {
67 67
68 info!("resetting"); 68 info!("resetting");
69 mbox.mac_subsystem 69 mbox.mac_subsystem
70 .send_command(&ResetRequest { set_default_pib: true }) 70 .send_command(&ResetRequest {
71 set_default_pib: true,
72 ..Default::default()
73 })
71 .await 74 .await
72 .unwrap(); 75 .unwrap();
73 let evt = mbox.mac_subsystem.read().await; 76 let evt = mbox.mac_subsystem.read().await;
diff --git a/examples/stm32wb/src/bin/mac_rfd.rs b/examples/stm32wb/src/bin/mac_rfd.rs
index b2dac72cc..b0eb91061 100644
--- a/examples/stm32wb/src/bin/mac_rfd.rs
+++ b/examples/stm32wb/src/bin/mac_rfd.rs
@@ -69,7 +69,10 @@ async fn main(spawner: Spawner) {
69 69
70 info!("resetting"); 70 info!("resetting");
71 mbox.mac_subsystem 71 mbox.mac_subsystem
72 .send_command(&ResetRequest { set_default_pib: true }) 72 .send_command(&ResetRequest {
73 set_default_pib: true,
74 ..Default::default()
75 })
73 .await 76 .await
74 .unwrap(); 77 .unwrap();
75 let evt = mbox.mac_subsystem.read().await; 78 let evt = mbox.mac_subsystem.read().await;
@@ -91,6 +94,7 @@ async fn main(spawner: Spawner) {
91 mbox.mac_subsystem 94 mbox.mac_subsystem
92 .send_command(&GetRequest { 95 .send_command(&GetRequest {
93 pib_attribute: PibId::ExtendedAddress, 96 pib_attribute: PibId::ExtendedAddress,
97 ..Default::default()
94 }) 98 })
95 .await 99 .await
96 .unwrap(); 100 .unwrap();
@@ -141,23 +145,22 @@ async fn main(spawner: Spawner) {
141 info!("{:#x}", evt); 145 info!("{:#x}", evt);
142 146
143 info!("sending data"); 147 info!("sending data");
144 let mut data_buffer = [0u8; 256];
145 let data = b"Hello from embassy!"; 148 let data = b"Hello from embassy!";
146 data_buffer[..data.len()].copy_from_slice(data);
147 mbox.mac_subsystem 149 mbox.mac_subsystem
148 .send_command(&DataRequest { 150 .send_command(
149 src_addr_mode: AddressMode::Short, 151 DataRequest {
150 dst_addr_mode: AddressMode::Short, 152 src_addr_mode: AddressMode::Short,
151 dst_pan_id: PanId([0x1A, 0xAA]), 153 dst_addr_mode: AddressMode::Short,
152 dst_address: MacAddress::BROADCAST, 154 dst_pan_id: PanId([0x1A, 0xAA]),
153 msdu_handle: 0x02, 155 dst_address: MacAddress::BROADCAST,
154 ack_tx: 0x00, 156 msdu_handle: 0x02,
155 gts_tx: false, 157 ack_tx: 0x00,
156 msdu_ptr: &data_buffer as *const _ as *const u8, 158 gts_tx: false,
157 msdu_length: data.len() as u8, 159 security_level: SecurityLevel::Unsecure,
158 security_level: SecurityLevel::Unsecure, 160 ..Default::default()
159 ..Default::default() 161 }
160 }) 162 .set_buffer(data),
163 )
161 .await 164 .await
162 .unwrap(); 165 .unwrap();
163 let evt = mbox.mac_subsystem.read().await; 166 let evt = mbox.mac_subsystem.read().await;
diff --git a/tests/stm32/src/bin/wpan_mac.rs b/tests/stm32/src/bin/wpan_mac.rs
index cfa0aca3b..2fc15dc9d 100644
--- a/tests/stm32/src/bin/wpan_mac.rs
+++ b/tests/stm32/src/bin/wpan_mac.rs
@@ -49,7 +49,10 @@ async fn main(spawner: Spawner) {
49 49
50 info!("resetting"); 50 info!("resetting");
51 mbox.mac_subsystem 51 mbox.mac_subsystem
52 .send_command(&ResetRequest { set_default_pib: true }) 52 .send_command(&ResetRequest {
53 set_default_pib: true,
54 ..Default::default()
55 })
53 .await 56 .await
54 .unwrap(); 57 .unwrap();
55 let evt = mbox.mac_subsystem.read().await; 58 let evt = mbox.mac_subsystem.read().await;
@@ -71,6 +74,7 @@ async fn main(spawner: Spawner) {
71 mbox.mac_subsystem 74 mbox.mac_subsystem
72 .send_command(&GetRequest { 75 .send_command(&GetRequest {
73 pib_attribute: PibId::ExtendedAddress, 76 pib_attribute: PibId::ExtendedAddress,
77 ..Default::default()
74 }) 78 })
75 .await 79 .await
76 .unwrap(); 80 .unwrap();