aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32-wpan
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-10-06 22:56:31 +0200
committerDario Nieuwenhuis <[email protected]>2025-10-06 23:19:53 +0200
commit8730a013c395cf0bf4c2fa8eeb7f138288103039 (patch)
tree39eca5fbc4570bd0129c9a291f134de5dab98820 /embassy-stm32-wpan
parentabc8e450f936567ad42cb34b5d2a7941b206aa5d (diff)
Rustfmt for edition 2024.
Diffstat (limited to 'embassy-stm32-wpan')
-rw-r--r--embassy-stm32-wpan/src/cmd.rs2
-rw-r--r--embassy-stm32-wpan/src/consts.rs2
-rw-r--r--embassy-stm32-wpan/src/lhci.rs4
-rw-r--r--embassy-stm32-wpan/src/lib.rs4
-rw-r--r--embassy-stm32-wpan/src/mac/driver.rs2
-rw-r--r--embassy-stm32-wpan/src/mac/runner.rs2
-rw-r--r--embassy-stm32-wpan/src/sub/ble.rs4
-rw-r--r--embassy-stm32-wpan/src/sub/mm.rs4
-rw-r--r--embassy-stm32-wpan/src/sub/sys.rs12
-rw-r--r--embassy-stm32-wpan/src/tables.rs2
10 files changed, 17 insertions, 21 deletions
diff --git a/embassy-stm32-wpan/src/cmd.rs b/embassy-stm32-wpan/src/cmd.rs
index 928357384..5c81a4aa7 100644
--- a/embassy-stm32-wpan/src/cmd.rs
+++ b/embassy-stm32-wpan/src/cmd.rs
@@ -1,7 +1,7 @@
1use core::ptr; 1use core::ptr;
2 2
3use crate::consts::TlPacketType;
4use crate::PacketHeader; 3use crate::PacketHeader;
4use crate::consts::TlPacketType;
5 5
6#[derive(Copy, Clone)] 6#[derive(Copy, Clone)]
7#[repr(C, packed)] 7#[repr(C, packed)]
diff --git a/embassy-stm32-wpan/src/consts.rs b/embassy-stm32-wpan/src/consts.rs
index e2ae6ca86..7ecb22974 100644
--- a/embassy-stm32-wpan/src/consts.rs
+++ b/embassy-stm32-wpan/src/consts.rs
@@ -1,5 +1,5 @@
1use crate::evt::CsEvt;
2use crate::PacketHeader; 1use crate::PacketHeader;
2use crate::evt::CsEvt;
3 3
4#[derive(Debug)] 4#[derive(Debug)]
5#[repr(C)] 5#[repr(C)]
diff --git a/embassy-stm32-wpan/src/lhci.rs b/embassy-stm32-wpan/src/lhci.rs
index 89f204f99..59c8bfb5d 100644
--- a/embassy-stm32-wpan/src/lhci.rs
+++ b/embassy-stm32-wpan/src/lhci.rs
@@ -1,9 +1,9 @@
1use core::ptr; 1use core::ptr;
2 2
3use crate::cmd::CmdPacket; 3use crate::cmd::CmdPacket;
4use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE}; 4use crate::consts::{TL_EVT_HEADER_SIZE, TlPacketType};
5use crate::evt::{CcEvt, EvtPacket, EvtSerial}; 5use crate::evt::{CcEvt, EvtPacket, EvtSerial};
6use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable, TL_DEVICE_INFO_TABLE}; 6use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, TL_DEVICE_INFO_TABLE, WirelessFwInfoTable};
7 7
8const TL_BLEEVT_CC_OPCODE: u8 = 0x0e; 8const TL_BLEEVT_CC_OPCODE: u8 = 0x0e;
9const LHCI_OPCODE_C1_DEVICE_INF: u16 = 0xfd62; 9const LHCI_OPCODE_C1_DEVICE_INF: u16 = 0xfd62;
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs
index f4eb0069f..f6b1f6021 100644
--- a/embassy-stm32-wpan/src/lib.rs
+++ b/embassy-stm32-wpan/src/lib.rs
@@ -22,7 +22,7 @@
22mod fmt; 22mod fmt;
23 23
24use core::mem::MaybeUninit; 24use core::mem::MaybeUninit;
25use core::sync::atomic::{compiler_fence, Ordering}; 25use core::sync::atomic::{Ordering, compiler_fence};
26 26
27use embassy_hal_internal::Peri; 27use embassy_hal_internal::Peri;
28use embassy_stm32::interrupt; 28use embassy_stm32::interrupt;
@@ -95,7 +95,7 @@ impl<'d> TlMbox<'d> {
95 pub fn init( 95 pub fn init(
96 ipcc: Peri<'d, IPCC>, 96 ipcc: Peri<'d, IPCC>,
97 _irqs: impl interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_RX, ReceiveInterruptHandler> 97 _irqs: impl interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_RX, ReceiveInterruptHandler>
98 + interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_TX, TransmitInterruptHandler>, 98 + interrupt::typelevel::Binding<interrupt::typelevel::IPCC_C1_TX, TransmitInterruptHandler>,
99 config: Config, 99 config: Config,
100 ) -> Self { 100 ) -> Self {
101 // this is an inlined version of TL_Init from the STM32WB firmware as requested by AN5289. 101 // this is an inlined version of TL_Init from the STM32WB firmware as requested by AN5289.
diff --git a/embassy-stm32-wpan/src/mac/driver.rs b/embassy-stm32-wpan/src/mac/driver.rs
index 41cca09e3..480ac3790 100644
--- a/embassy-stm32-wpan/src/mac/driver.rs
+++ b/embassy-stm32-wpan/src/mac/driver.rs
@@ -6,9 +6,9 @@ use embassy_net_driver::{Capabilities, HardwareAddress, LinkState};
6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 6use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
7use embassy_sync::channel::Channel; 7use embassy_sync::channel::Channel;
8 8
9use crate::mac::MTU;
9use crate::mac::event::MacEvent; 10use crate::mac::event::MacEvent;
10use crate::mac::runner::Runner; 11use crate::mac::runner::Runner;
11use crate::mac::MTU;
12 12
13pub struct Driver<'d> { 13pub struct Driver<'d> {
14 runner: &'d Runner<'d>, 14 runner: &'d Runner<'d>,
diff --git a/embassy-stm32-wpan/src/mac/runner.rs b/embassy-stm32-wpan/src/mac/runner.rs
index d3099b6b7..2409f994d 100644
--- a/embassy-stm32-wpan/src/mac/runner.rs
+++ b/embassy-stm32-wpan/src/mac/runner.rs
@@ -7,10 +7,10 @@ use embassy_sync::channel::Channel;
7use embassy_sync::mutex::Mutex; 7use embassy_sync::mutex::Mutex;
8use embassy_sync::signal::Signal; 8use embassy_sync::signal::Signal;
9 9
10use crate::mac::MTU;
10use crate::mac::commands::DataRequest; 11use crate::mac::commands::DataRequest;
11use crate::mac::event::MacEvent; 12use crate::mac::event::MacEvent;
12use crate::mac::typedefs::{AddressMode, MacAddress, PanId, SecurityLevel}; 13use crate::mac::typedefs::{AddressMode, MacAddress, PanId, SecurityLevel};
13use crate::mac::MTU;
14use crate::sub::mac::Mac; 14use crate::sub::mac::Mac;
15 15
16type ZeroCopyPubSub<M, T> = blocking_mutex::Mutex<M, RefCell<Option<Signal<NoopRawMutex, T>>>>; 16type ZeroCopyPubSub<M, T> = blocking_mutex::Mutex<M, RefCell<Option<Signal<NoopRawMutex, T>>>>;
diff --git a/embassy-stm32-wpan/src/sub/ble.rs b/embassy-stm32-wpan/src/sub/ble.rs
index 0f770d92c..cd69a0479 100644
--- a/embassy-stm32-wpan/src/sub/ble.rs
+++ b/embassy-stm32-wpan/src/sub/ble.rs
@@ -4,10 +4,10 @@ use embassy_stm32::ipcc::Ipcc;
4use hci::Opcode; 4use hci::Opcode;
5 5
6use crate::cmd::CmdPacket; 6use crate::cmd::CmdPacket;
7use crate::consts::{TlPacketType, TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE}; 7use crate::consts::{TL_BLEEVT_CC_OPCODE, TL_BLEEVT_CS_OPCODE, TlPacketType};
8use crate::evt::{EvtBox, EvtPacket, EvtStub}; 8use crate::evt::{EvtBox, EvtPacket, EvtStub};
9use crate::sub::mm; 9use crate::sub::mm;
10use crate::tables::{BleTable, BLE_CMD_BUFFER, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE}; 10use crate::tables::{BLE_CMD_BUFFER, BleTable, CS_BUFFER, EVT_QUEUE, HCI_ACL_DATA_BUFFER, TL_BLE_TABLE};
11use crate::unsafe_linked_list::LinkedListNode; 11use crate::unsafe_linked_list::LinkedListNode;
12use crate::{channels, evt}; 12use crate::{channels, evt};
13 13
diff --git a/embassy-stm32-wpan/src/sub/mm.rs b/embassy-stm32-wpan/src/sub/mm.rs
index 4e4d2f854..62d0de8bd 100644
--- a/embassy-stm32-wpan/src/sub/mm.rs
+++ b/embassy-stm32-wpan/src/sub/mm.rs
@@ -3,7 +3,7 @@ use core::future::poll_fn;
3use core::mem::MaybeUninit; 3use core::mem::MaybeUninit;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use aligned::{Aligned, A4}; 6use aligned::{A4, Aligned};
7use cortex_m::interrupt; 7use cortex_m::interrupt;
8use embassy_stm32::ipcc::Ipcc; 8use embassy_stm32::ipcc::Ipcc;
9use embassy_sync::waitqueue::AtomicWaker; 9use embassy_sync::waitqueue::AtomicWaker;
@@ -12,7 +12,7 @@ use crate::consts::POOL_SIZE;
12use crate::evt::EvtPacket; 12use crate::evt::EvtPacket;
13#[cfg(feature = "ble")] 13#[cfg(feature = "ble")]
14use crate::tables::BLE_SPARE_EVT_BUF; 14use crate::tables::BLE_SPARE_EVT_BUF;
15use crate::tables::{MemManagerTable, EVT_POOL, FREE_BUF_QUEUE, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE}; 15use crate::tables::{EVT_POOL, FREE_BUF_QUEUE, MemManagerTable, SYS_SPARE_EVT_BUF, TL_MEM_MANAGER_TABLE};
16use crate::unsafe_linked_list::LinkedListNode; 16use crate::unsafe_linked_list::LinkedListNode;
17use crate::{channels, evt}; 17use crate::{channels, evt};
18 18
diff --git a/embassy-stm32-wpan/src/sub/sys.rs b/embassy-stm32-wpan/src/sub/sys.rs
index cf6df58bf..8a3382f86 100644
--- a/embassy-stm32-wpan/src/sub/sys.rs
+++ b/embassy-stm32-wpan/src/sub/sys.rs
@@ -8,7 +8,7 @@ use crate::shci::{SchiCommandStatus, ShciBleInitCmdParam, ShciOpcode};
8use crate::sub::mm; 8use crate::sub::mm;
9use crate::tables::{SysTable, WirelessFwInfoTable}; 9use crate::tables::{SysTable, WirelessFwInfoTable};
10use crate::unsafe_linked_list::LinkedListNode; 10use crate::unsafe_linked_list::LinkedListNode;
11use crate::{channels, Ipcc, SYSTEM_EVT_QUEUE, SYS_CMD_BUF, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE}; 11use crate::{Ipcc, SYS_CMD_BUF, SYSTEM_EVT_QUEUE, TL_DEVICE_INFO_TABLE, TL_SYS_TABLE, channels};
12 12
13/// A guard that, once constructed, allows for sys commands to be sent to CPU2. 13/// A guard that, once constructed, allows for sys commands to be sent to CPU2.
14pub struct Sys { 14pub struct Sys {
@@ -35,11 +35,7 @@ impl Sys {
35 let info = unsafe { TL_DEVICE_INFO_TABLE.as_mut_ptr().read_volatile().wireless_fw_info_table }; 35 let info = unsafe { TL_DEVICE_INFO_TABLE.as_mut_ptr().read_volatile().wireless_fw_info_table };
36 36
37 // Zero version indicates that CPU2 wasn't active and didn't fill the information table 37 // Zero version indicates that CPU2 wasn't active and didn't fill the information table
38 if info.version != 0 { 38 if info.version != 0 { Some(info) } else { None }
39 Some(info)
40 } else {
41 None
42 }
43 } 39 }
44 40
45 pub async fn write(&self, opcode: ShciOpcode, payload: &[u8]) { 41 pub async fn write(&self, opcode: ShciOpcode, payload: &[u8]) {
@@ -66,8 +62,8 @@ impl Sys {
66 #[cfg(feature = "mac")] 62 #[cfg(feature = "mac")]
67 pub async fn shci_c2_mac_802_15_4_init(&self) -> Result<SchiCommandStatus, ()> { 63 pub async fn shci_c2_mac_802_15_4_init(&self) -> Result<SchiCommandStatus, ()> {
68 use crate::tables::{ 64 use crate::tables::{
69 Mac802_15_4Table, TracesTable, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, 65 MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, Mac802_15_4Table, TL_MAC_802_15_4_TABLE,
70 TL_MAC_802_15_4_TABLE, TL_TRACES_TABLE, TRACES_EVT_QUEUE, 66 TL_TRACES_TABLE, TRACES_EVT_QUEUE, TracesTable,
71 }; 67 };
72 68
73 unsafe { 69 unsafe {
diff --git a/embassy-stm32-wpan/src/tables.rs b/embassy-stm32-wpan/src/tables.rs
index 204790e6d..1dafed159 100644
--- a/embassy-stm32-wpan/src/tables.rs
+++ b/embassy-stm32-wpan/src/tables.rs
@@ -1,6 +1,6 @@
1use core::mem::MaybeUninit; 1use core::mem::MaybeUninit;
2 2
3use aligned::{Aligned, A4}; 3use aligned::{A4, Aligned};
4use bit_field::BitField; 4use bit_field::BitField;
5 5
6use crate::cmd::{AclDataPacket, CmdPacket}; 6use crate::cmd::{AclDataPacket, CmdPacket};