stm32/wpan: reorg subsystems

This commit is contained in:
xoviat 2023-06-23 17:54:06 -05:00
parent 4dd48099be
commit 29f32ce00e
10 changed files with 41 additions and 34 deletions

View File

@ -145,14 +145,14 @@ impl Drop for EvtBox {
fn drop(&mut self) { fn drop(&mut self) {
#[cfg(feature = "ble")] #[cfg(feature = "ble")]
unsafe { unsafe {
use crate::mm; use crate::sub::mm;
mm::MemoryManager::drop_event_packet(self.ptr) mm::MemoryManager::drop_event_packet(self.ptr)
}; };
#[cfg(feature = "mac")] #[cfg(feature = "mac")]
unsafe { unsafe {
use crate::mac; use crate::sub::mac;
mac::Mac::drop_event_packet(self.ptr) mac::Mac::drop_event_packet(self.ptr)
} }

View File

@ -1,7 +1,9 @@
use core::ptr;
use crate::cmd::CmdPacket; use crate::cmd::CmdPacket;
use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE}; use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE};
use crate::evt::{CcEvt, EvtPacket, EvtSerial}; use crate::evt::{CcEvt, EvtPacket, EvtSerial};
use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable}; use crate::tables::{DeviceInfoTable, RssInfoTable, SafeBootInfoTable, WirelessFwInfoTable, TL_DEVICE_INFO_TABLE};
use crate::TL_REF_TABLE; use crate::TL_REF_TABLE;
const TL_BLEEVT_CC_OPCODE: u8 = 0x0e; const TL_BLEEVT_CC_OPCODE: u8 = 0x0e;
@ -38,7 +40,7 @@ impl Default for LhciC1DeviceInformationCcrp {
safe_boot_info_table, safe_boot_info_table,
rss_info_table, rss_info_table,
wireless_fw_info_table, wireless_fw_info_table,
} = unsafe { &*(*TL_REF_TABLE.as_ptr()).device_info_table }.clone(); } = unsafe { ptr::read_volatile(TL_DEVICE_INFO_TABLE.as_ptr()) };
let device_id = stm32_device_signature::device_id(); let device_id = stm32_device_signature::device_id();
let uid96_0 = (device_id[3] as u32) << 24 let uid96_0 = (device_id[3] as u32) << 24
@ -105,7 +107,7 @@ impl LhciC1DeviceInformationCcrp {
let self_ptr: *const LhciC1DeviceInformationCcrp = self; let self_ptr: *const LhciC1DeviceInformationCcrp = self;
let self_buf = self_ptr.cast(); let self_buf = self_ptr.cast();
core::ptr::copy(self_buf, evt_cc_payload_buf, self_size); ptr::copy(self_buf, evt_cc_payload_buf, self_size);
} }
} }
} }

View File

@ -11,26 +11,24 @@ use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
use embassy_stm32::interrupt; use embassy_stm32::interrupt;
use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
use embassy_stm32::peripherals::IPCC; use embassy_stm32::peripherals::IPCC;
use mm::MemoryManager; use sub::mm::MemoryManager;
use sys::Sys; use sub::sys::Sys;
use tables::*; use tables::*;
use unsafe_linked_list::LinkedListNode; use unsafe_linked_list::LinkedListNode;
#[cfg(feature = "ble")]
pub mod ble;
pub mod channels; pub mod channels;
pub mod cmd; pub mod cmd;
pub mod consts; pub mod consts;
pub mod evt; pub mod evt;
pub mod lhci; pub mod lhci;
#[cfg(feature = "mac")]
pub mod mac;
pub mod mm;
pub mod shci; pub mod shci;
pub mod sys; pub mod sub;
pub mod tables; pub mod tables;
pub mod unsafe_linked_list; pub mod unsafe_linked_list;
#[cfg(feature = "ble")]
pub use crate::sub::ble::hci;
type PacketHeader = LinkedListNode; type PacketHeader = LinkedListNode;
pub struct TlMbox<'d> { pub struct TlMbox<'d> {
@ -39,9 +37,9 @@ pub struct TlMbox<'d> {
pub sys_subsystem: Sys, pub sys_subsystem: Sys,
pub mm_subsystem: MemoryManager, pub mm_subsystem: MemoryManager,
#[cfg(feature = "ble")] #[cfg(feature = "ble")]
pub ble_subsystem: ble::Ble, pub ble_subsystem: sub::ble::Ble,
#[cfg(feature = "mac")] #[cfg(feature = "mac")]
pub mac_subsystem: mac::Mac, pub mac_subsystem: sub::mac::Mac,
} }
impl<'d> TlMbox<'d> { impl<'d> TlMbox<'d> {
@ -128,12 +126,12 @@ impl<'d> TlMbox<'d> {
Self { Self {
_ipcc: ipcc, _ipcc: ipcc,
sys_subsystem: sys::Sys::new(), sys_subsystem: sub::sys::Sys::new(),
#[cfg(feature = "ble")] #[cfg(feature = "ble")]
ble_subsystem: ble::Ble::new(), ble_subsystem: sub::ble::Ble::new(),
#[cfg(feature = "mac")] #[cfg(feature = "mac")]
mac_subsystem: mac::Mac::new(), mac_subsystem: sub::mac::Mac::new(),
mm_subsystem: mm::MemoryManager::new(), mm_subsystem: sub::mm::MemoryManager::new(),
} }
} }
} }

View File

@ -0,0 +1,6 @@
#[cfg(feature = "ble")]
pub mod ble;
#[cfg(feature = "mac")]
pub mod mac;
pub mod mm;
pub mod sys;

View File

@ -8,15 +8,15 @@ use defmt::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::bind_interrupts; use embassy_stm32::bind_interrupts;
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
use embassy_stm32_wpan::ble::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::ble::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
AdvertisingDataType, DiscoverableParameters, GapCommands, Role, AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
}; };
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands; use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::ble::hci::BdAddr; use embassy_stm32_wpan::hci::BdAddr;
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::TlMbox; use embassy_stm32_wpan::TlMbox;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};

View File

@ -12,17 +12,18 @@ use common::*;
use embassy_executor::Spawner; use embassy_executor::Spawner;
use embassy_stm32::bind_interrupts; use embassy_stm32::bind_interrupts;
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
use embassy_stm32_wpan::ble::hci::host::uart::UartHci; use embassy_stm32_wpan::hci::host::uart::UartHci;
use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType}; use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
use embassy_stm32_wpan::ble::hci::types::AdvertisingType; use embassy_stm32_wpan::hci::types::AdvertisingType;
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{ use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
AdvertisingDataType, DiscoverableParameters, GapCommands, Role, AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
}; };
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands; use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel}; use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
use embassy_stm32_wpan::ble::hci::BdAddr; use embassy_stm32_wpan::hci::BdAddr;
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp; use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
use embassy_stm32_wpan::{mm, TlMbox}; use embassy_stm32_wpan::sub::mm;
use embassy_stm32_wpan::TlMbox;
use {defmt_rtt as _, panic_probe as _}; use {defmt_rtt as _, panic_probe as _};
bind_interrupts!(struct Irqs{ bind_interrupts!(struct Irqs{