mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
stm32/wpan: reorg subsystems
This commit is contained in:
parent
4dd48099be
commit
29f32ce00e
@ -145,14 +145,14 @@ impl Drop for EvtBox {
|
||||
fn drop(&mut self) {
|
||||
#[cfg(feature = "ble")]
|
||||
unsafe {
|
||||
use crate::mm;
|
||||
use crate::sub::mm;
|
||||
|
||||
mm::MemoryManager::drop_event_packet(self.ptr)
|
||||
};
|
||||
|
||||
#[cfg(feature = "mac")]
|
||||
unsafe {
|
||||
use crate::mac;
|
||||
use crate::sub::mac;
|
||||
|
||||
mac::Mac::drop_event_packet(self.ptr)
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
use core::ptr;
|
||||
|
||||
use crate::cmd::CmdPacket;
|
||||
use crate::consts::{TlPacketType, TL_EVT_HEADER_SIZE};
|
||||
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;
|
||||
|
||||
const TL_BLEEVT_CC_OPCODE: u8 = 0x0e;
|
||||
@ -38,7 +40,7 @@ impl Default for LhciC1DeviceInformationCcrp {
|
||||
safe_boot_info_table,
|
||||
rss_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 uid96_0 = (device_id[3] as u32) << 24
|
||||
@ -105,7 +107,7 @@ impl LhciC1DeviceInformationCcrp {
|
||||
let self_ptr: *const LhciC1DeviceInformationCcrp = self;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,26 +11,24 @@ use embassy_hal_common::{into_ref, Peripheral, PeripheralRef};
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::ipcc::{Config, Ipcc, ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||
use embassy_stm32::peripherals::IPCC;
|
||||
use mm::MemoryManager;
|
||||
use sys::Sys;
|
||||
use sub::mm::MemoryManager;
|
||||
use sub::sys::Sys;
|
||||
use tables::*;
|
||||
use unsafe_linked_list::LinkedListNode;
|
||||
|
||||
#[cfg(feature = "ble")]
|
||||
pub mod ble;
|
||||
pub mod channels;
|
||||
pub mod cmd;
|
||||
pub mod consts;
|
||||
pub mod evt;
|
||||
pub mod lhci;
|
||||
#[cfg(feature = "mac")]
|
||||
pub mod mac;
|
||||
pub mod mm;
|
||||
pub mod shci;
|
||||
pub mod sys;
|
||||
pub mod sub;
|
||||
pub mod tables;
|
||||
pub mod unsafe_linked_list;
|
||||
|
||||
#[cfg(feature = "ble")]
|
||||
pub use crate::sub::ble::hci;
|
||||
|
||||
type PacketHeader = LinkedListNode;
|
||||
|
||||
pub struct TlMbox<'d> {
|
||||
@ -39,9 +37,9 @@ pub struct TlMbox<'d> {
|
||||
pub sys_subsystem: Sys,
|
||||
pub mm_subsystem: MemoryManager,
|
||||
#[cfg(feature = "ble")]
|
||||
pub ble_subsystem: ble::Ble,
|
||||
pub ble_subsystem: sub::ble::Ble,
|
||||
#[cfg(feature = "mac")]
|
||||
pub mac_subsystem: mac::Mac,
|
||||
pub mac_subsystem: sub::mac::Mac,
|
||||
}
|
||||
|
||||
impl<'d> TlMbox<'d> {
|
||||
@ -128,12 +126,12 @@ impl<'d> TlMbox<'d> {
|
||||
|
||||
Self {
|
||||
_ipcc: ipcc,
|
||||
sys_subsystem: sys::Sys::new(),
|
||||
sys_subsystem: sub::sys::Sys::new(),
|
||||
#[cfg(feature = "ble")]
|
||||
ble_subsystem: ble::Ble::new(),
|
||||
ble_subsystem: sub::ble::Ble::new(),
|
||||
#[cfg(feature = "mac")]
|
||||
mac_subsystem: mac::Mac::new(),
|
||||
mm_subsystem: mm::MemoryManager::new(),
|
||||
mac_subsystem: sub::mac::Mac::new(),
|
||||
mm_subsystem: sub::mm::MemoryManager::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
embassy-stm32-wpan/src/sub/mod.rs
Normal file
6
embassy-stm32-wpan/src/sub/mod.rs
Normal file
@ -0,0 +1,6 @@
|
||||
#[cfg(feature = "ble")]
|
||||
pub mod ble;
|
||||
#[cfg(feature = "mac")]
|
||||
pub mod mac;
|
||||
pub mod mm;
|
||||
pub mod sys;
|
@ -8,15 +8,15 @@ use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::bind_interrupts;
|
||||
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||
use embassy_stm32_wpan::ble::hci::host::uart::UartHci;
|
||||
use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
|
||||
use embassy_stm32_wpan::ble::hci::types::AdvertisingType;
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{
|
||||
use embassy_stm32_wpan::hci::host::uart::UartHci;
|
||||
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
|
||||
use embassy_stm32_wpan::hci::types::AdvertisingType;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
|
||||
AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
|
||||
};
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands;
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
|
||||
use embassy_stm32_wpan::ble::hci::BdAddr;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
|
||||
use embassy_stm32_wpan::hci::BdAddr;
|
||||
use embassy_stm32_wpan::lhci::LhciC1DeviceInformationCcrp;
|
||||
use embassy_stm32_wpan::TlMbox;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
@ -12,17 +12,18 @@ use common::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::bind_interrupts;
|
||||
use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler};
|
||||
use embassy_stm32_wpan::ble::hci::host::uart::UartHci;
|
||||
use embassy_stm32_wpan::ble::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
|
||||
use embassy_stm32_wpan::ble::hci::types::AdvertisingType;
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gap::{
|
||||
use embassy_stm32_wpan::hci::host::uart::UartHci;
|
||||
use embassy_stm32_wpan::hci::host::{AdvertisingFilterPolicy, EncryptionKey, HostHci, OwnAddressType};
|
||||
use embassy_stm32_wpan::hci::types::AdvertisingType;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gap::{
|
||||
AdvertisingDataType, DiscoverableParameters, GapCommands, Role,
|
||||
};
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::gatt::GattCommands;
|
||||
use embassy_stm32_wpan::ble::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
|
||||
use embassy_stm32_wpan::ble::hci::BdAddr;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::gatt::GattCommands;
|
||||
use embassy_stm32_wpan::hci::vendor::stm32wb::command::hal::{ConfigData, HalCommands, PowerLevel};
|
||||
use embassy_stm32_wpan::hci::BdAddr;
|
||||
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 _};
|
||||
|
||||
bind_interrupts!(struct Irqs{
|
||||
|
Loading…
Reference in New Issue
Block a user