aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxoviat <[email protected]>2023-06-23 17:54:06 -0500
committerxoviat <[email protected]>2023-06-23 17:54:06 -0500
commit29f32ce00ec0f50ef5e3b29c7e50f7f5479b4967 (patch)
treeab2d04d6cce0de6471a24aae4a68bf36011170e4
parent4dd48099bee305fc31e47a586f34d09c3ec02673 (diff)
stm32/wpan: reorg subsystems
-rw-r--r--embassy-stm32-wpan/src/evt.rs4
-rw-r--r--embassy-stm32-wpan/src/lhci.rs8
-rw-r--r--embassy-stm32-wpan/src/lib.rs26
-rw-r--r--embassy-stm32-wpan/src/sub/ble.rs (renamed from embassy-stm32-wpan/src/ble.rs)0
-rw-r--r--embassy-stm32-wpan/src/sub/mac.rs (renamed from embassy-stm32-wpan/src/mac.rs)0
-rw-r--r--embassy-stm32-wpan/src/sub/mm.rs (renamed from embassy-stm32-wpan/src/mm.rs)0
-rw-r--r--embassy-stm32-wpan/src/sub/mod.rs6
-rw-r--r--embassy-stm32-wpan/src/sub/sys.rs (renamed from embassy-stm32-wpan/src/sys.rs)0
-rw-r--r--examples/stm32wb/src/bin/eddystone_beacon.rs14
-rw-r--r--tests/stm32/src/bin/tl_mbox.rs17
10 files changed, 41 insertions, 34 deletions
diff --git a/embassy-stm32-wpan/src/evt.rs b/embassy-stm32-wpan/src/evt.rs
index 25249a13a..22f089037 100644
--- a/embassy-stm32-wpan/src/evt.rs
+++ b/embassy-stm32-wpan/src/evt.rs
@@ -145,14 +145,14 @@ impl Drop for EvtBox {
145 fn drop(&mut self) { 145 fn drop(&mut self) {
146 #[cfg(feature = "ble")] 146 #[cfg(feature = "ble")]
147 unsafe { 147 unsafe {
148 use crate::mm; 148 use crate::sub::mm;
149 149
150 mm::MemoryManager::drop_event_packet(self.ptr) 150 mm::MemoryManager::drop_event_packet(self.ptr)
151 }; 151 };
152 152
153 #[cfg(feature = "mac")] 153 #[cfg(feature = "mac")]
154 unsafe { 154 unsafe {
155 use crate::mac; 155 use crate::sub::mac;
156 156
157 mac::Mac::drop_event_packet(self.ptr) 157 mac::Mac::drop_event_packet(self.ptr)
158 } 158 }
diff --git a/embassy-stm32-wpan/src/lhci.rs b/embassy-stm32-wpan/src/lhci.rs
index 62116a695..284103705 100644
--- a/embassy-stm32-wpan/src/lhci.rs
+++ b/embassy-stm32-wpan/src/lhci.rs
@@ -1,7 +1,9 @@
1use core::ptr;
2
1use crate::cmd::CmdPacket; 3use crate::cmd::CmdPacket;
2use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE}; 4use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE};
3use crate::evt::{CcEvt, EvtPacket, EvtSerial}; 5use crate::evt::{CcEvt, EvtPacket, EvtSerial};
4use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable}; 6use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable, TL_DEVICE_INFO_TABLE};
5use crate::TL_REF_TABLE; 7use crate::TL_REF_TABLE;
6 8
7const TL_BLEEVT_CC_OPCODE: u8 = 0x0e; 9const TL_BLEEVT_CC_OPCODE: u8 = 0x0e;
@@ -38,7 +40,7 @@ impl Default for LhciC1DeviceInformationCcrp {
38 safe_boot_info_table, 40 safe_boot_info_table,
39 rss_info_table, 41 rss_info_table,
40 wireless_fw_info_table, 42 wireless_fw_info_table,
41 } = unsafe { &*(*TL_REF_TABLE.as_ptr()).device_info_table }.clone(); 43 } = unsafe { ptr::read_volatile(TL_DEVICE_INFO_TABLE.as_ptr()) };
42 44
43 let device_id = stm32_device_signature::device_id(); 45 let device_id = stm32_device_signature::device_id();
44 let uid96_0 = (device_id[3] as u32) << 24 46 let uid96_0 = (device_id[3] as u32) << 24
@@ -105,7 +107,7 @@ impl LhciC1DeviceInformationCcrp {
105 let self_ptr: *const LhciC1DeviceInformationCcrp = self; 107 let self_ptr: *const LhciC1DeviceInformationCcrp = self;
106 let self_buf = self_ptr.cast(); 108 let self_buf = self_ptr.cast();
107 109
108 core::ptr::copy(self_buf, evt_cc_payload_buf, self_size); 110 ptr::copy(self_buf, evt_cc_payload_buf, self_size);
109 } 111 }
110 } 112 }
111} 113}
diff --git a/embassy-stm32-wpan/src/lib.rs b/embassy-stm32-wpan/src/lib.rs
index bf0f0466e..99c610583 100644
--- a/embassy-stm32-wpan/src/lib.rs
+++ b/embassy-stm32-wpan/src/lib.rs
@@ -11,26 +11,24 @@ use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
11use embassy_stm32::interrupt; 11use embassy_stm32::interrupt;
12use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler}; 12use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
13use embassy_stm32::peripherals::IPCC; 13use embassy_stm32::peripherals::IPCC;
14use mm::MemoryManager; 14use sub::mm::MemoryManager;
15use sys::Sys; 15use sub::sys::Sys;
16use tables::*; 16use tables::*;
17use unsafe_linked_list::LinkedListNode; 17use unsafe_linked_list::LinkedListNode;
18 18
19#[cfg(feature = "ble")]
20pub mod ble;
21pub mod channels; 19pub mod channels;
22pub mod cmd; 20pub mod cmd;
23pub mod consts; 21pub mod consts;
24pub mod evt; 22pub mod evt;
25pub mod lhci; 23pub mod lhci;
26#[cfg(feature = "mac")]
27pub mod mac;
28pub mod mm;
29pub mod shci; 24pub mod shci;
30pub mod sys; 25pub mod sub;
31pub mod tables; 26pub mod tables;
32pub mod unsafe_linked_list; 27pub mod unsafe_linked_list;
33 28
29#[cfg(feature = "ble")]
30pub use crate::sub::ble::hci;
31
34type PacketHeader = LinkedListNode; 32type PacketHeader = LinkedListNode;
35 33
36pub struct TlMbox<'d> { 34pub struct TlMbox<'d> {
@@ -39,9 +37,9 @@ pub struct TlMbox<'d> {
39 pub sys_subsystem: Sys, 37 pub sys_subsystem: Sys,
40 pub mm_subsystem: MemoryManager, 38 pub mm_subsystem: MemoryManager,
41 #[cfg(feature = "ble")] 39 #[cfg(feature = "ble")]
42 pub ble_subsystem: ble::Ble, 40 pub ble_subsystem: sub::ble::Ble,
43 #[cfg(feature = "mac")] 41 #[cfg(feature = "mac")]
44 pub mac_subsystem: mac::Mac, 42 pub mac_subsystem: sub::mac::Mac,
45} 43}
46 44
47impl<'d> TlMbox<'d> { 45impl<'d> TlMbox<'d> {
@@ -128,12 +126,12 @@ impl<'d> TlMbox<'d> {
128 126
129 Self { 127 Self {
130 _ipcc: ipcc, 128 _ipcc: ipcc,
131 sys_subsystem: sys::Sys::new(), 129 sys_subsystem: sub::sys::Sys::new(),
132 #[cfg(feature = "ble")] 130 #[cfg(feature = "ble")]
133 ble_subsystem: ble::Ble::new(), 131 ble_subsystem: sub::ble::Ble::new(),
134 #[cfg(feature = "mac")] 132 #[cfg(feature = "mac")]
135 mac_subsystem: mac::Mac::new(), 133 mac_subsystem: sub::mac::Mac::new(),
136 mm_subsystem: mm::MemoryManager::new(), 134 mm_subsystem: sub::mm::MemoryManager::new(),
137 } 135 }
138 } 136 }
139} 137}
diff --git a/embassy-stm32-wpan/src/ble.rs b/embassy-stm32-wpan/src/sub/ble.rs
index 619cd66a0..619cd66a0 100644
--- a/embassy-stm32-wpan/src/ble.rs
+++ b/embassy-stm32-wpan/src/sub/ble.rs
diff --git a/embassy-stm32-wpan/src/mac.rs b/embassy-stm32-wpan/src/sub/mac.rs
index d2be1b85c..d2be1b85c 100644
--- a/embassy-stm32-wpan/src/mac.rs
+++ b/embassy-stm32-wpan/src/sub/mac.rs
diff --git a/embassy-stm32-wpan/src/mm.rs b/embassy-stm32-wpan/src/sub/mm.rs
index 047fddcd4..047fddcd4 100644
--- a/embassy-stm32-wpan/src/mm.rs
+++ b/embassy-stm32-wpan/src/sub/mm.rs
diff --git a/embassy-stm32-wpan/src/sub/mod.rs b/embassy-stm32-wpan/src/sub/mod.rs
new file mode 100644
index 000000000..bee3dbdf1
--- /dev/null
+++ b/embassy-stm32-wpan/src/sub/mod.rs
@@ -0,0 +1,6 @@
1#[cfg(feature = "ble")]
2pub mod ble;
3#[cfg(feature = "mac")]
4pub mod mac;
5pub mod mm;
6pub mod sys;
diff --git a/embassy-stm32-wpan/src/sys.rs b/embassy-stm32-wpan/src/sub/sys.rs
index 2b699b725..2b699b725 100644
--- a/embassy-stm32-wpan/src/sys.rs
+++ b/embassy-stm32-wpan/src/sub/sys.rs
diff --git a/examples/stm32wb/src/bin/eddystone_beacon.rs b/examples/stm32wb/src/bin/eddystone_beacon.rs
index fdd5be4a2..b99f8cb2e 100644
--- a/examples/stm32wb/src/bin/eddystone_beacon.rs
+++ b/examples/stm32wb/src/bin/eddystone_beacon.rs
@@ -8,15 +8,15 @@ use defmt::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_stm32::bind_interrupts; 9use embassy_stm32::bind_interrupts;
10use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 10use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
11use embassy_stm32_wpan::ble::hci::host::uart::UartHci; 11use embassy_stm32_wpan::hci::host::uart::UartHci;
12use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 12use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
13use embassy_stm32_wpan::ble::hci::types::AdvertisingType; 13use embassy_stm32_wpan::hci::types::AdvertisingType;
14use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{ 14use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
15 AdvertisingDataType, DiscoverableParameters, GapCommands, Role, 15 AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
16}; 16};
17use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands; 17use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
18use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; 18use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
19use embassy_stm32_wpan::ble::hci::BdAddr; 19use embassy_stm32_wpan::hci::BdAddr;
20use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 20use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
21use embassy_stm32_wpan::TlMbox; 21use embassy_stm32_wpan::TlMbox;
22use {defmt_rtt as _, panic_probe as _}; 22use {defmt_rtt as _, panic_probe as _};
diff --git a/tests/stm32/src/bin/tl_mbox.rs b/tests/stm32/src/bin/tl_mbox.rs
index 76c736a5b..8880554de 100644
--- a/tests/stm32/src/bin/tl_mbox.rs
+++ b/tests/stm32/src/bin/tl_mbox.rs
@@ -12,17 +12,18 @@ use common::*;
12use embassy_executor::Spawner; 12use embassy_executor::Spawner;
13use embassy_stm32::bind_interrupts; 13use embassy_stm32::bind_interrupts;
14use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; 14use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
15use embassy_stm32_wpan::ble::hci::host::uart::UartHci; 15use embassy_stm32_wpan::hci::host::uart::UartHci;
16use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; 16use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
17use embassy_stm32_wpan::ble::hci::types::AdvertisingType; 17use embassy_stm32_wpan::hci::types::AdvertisingType;
18use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{ 18use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
19 AdvertisingDataType, DiscoverableParameters, GapCommands, Role, 19 AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
20}; 20};
21use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands; 21use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
22use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; 22use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
23use embassy_stm32_wpan::ble::hci::BdAddr; 23use embassy_stm32_wpan::hci::BdAddr;
24use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; 24use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
25use embassy_stm32_wpan::{mm, TlMbox}; 25use embassy_stm32_wpan::sub::mm;
26use embassy_stm32_wpan::TlMbox;
26use {defmt_rtt as _, panic_probe as _}; 27use {defmt_rtt as _, panic_probe as _};
27 28
28bind_interrupts!(struct Irqs{ 29bind_interrupts!(struct Irqs{