stm32/wpan: use align to align data
This commit is contained in:
parent
f23b34951a
commit
91fdd76053
@ -21,6 +21,7 @@ embassy-embedded-hal = { version = "0.1.0", path = "../embassy-embedded-hal" }
|
|||||||
defmt = { version = "0.3", optional = true }
|
defmt = { version = "0.3", optional = true }
|
||||||
cortex-m = "0.7.6"
|
cortex-m = "0.7.6"
|
||||||
heapless = "0.7.16"
|
heapless = "0.7.16"
|
||||||
|
aligned = "0.4.1"
|
||||||
|
|
||||||
bit_field = "0.10.2"
|
bit_field = "0.10.2"
|
||||||
stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] }
|
stm32-device-signature = { version = "0.3.3", features = ["stm32wb5x"] }
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use core::mem::MaybeUninit;
|
use core::mem::MaybeUninit;
|
||||||
|
|
||||||
|
use aligned::{Aligned, A4};
|
||||||
use bit_field::BitField;
|
use bit_field::BitField;
|
||||||
|
|
||||||
use crate::cmd::{AclDataPacket, CmdPacket};
|
use crate::cmd::{AclDataPacket, CmdPacket};
|
||||||
@ -164,9 +165,6 @@ pub struct Mac802_15_4Table {
|
|||||||
pub evt_queue: *const u8,
|
pub evt_queue: *const u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C, align(4))]
|
|
||||||
pub struct AlignedData<const L: usize>([u8; L]);
|
|
||||||
|
|
||||||
/// Reference table. Contains pointers to all other tables.
|
/// Reference table. Contains pointers to all other tables.
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -222,10 +220,9 @@ pub static mut FREE_BUF_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::uninit
|
|||||||
#[link_section = "MB_MEM1"]
|
#[link_section = "MB_MEM1"]
|
||||||
pub static mut TRACES_EVT_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::uninit();
|
pub static mut TRACES_EVT_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::uninit();
|
||||||
|
|
||||||
const CS_BUFFER_SIZE: usize = TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + TL_CS_EVT_SIZE;
|
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut CS_BUFFER: MaybeUninit<AlignedData<CS_BUFFER_SIZE>> = MaybeUninit::uninit();
|
pub static mut CS_BUFFER: MaybeUninit<Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + TL_CS_EVT_SIZE]>> =
|
||||||
|
MaybeUninit::uninit();
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut EVT_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::uninit();
|
pub static mut EVT_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::uninit();
|
||||||
@ -238,35 +235,30 @@ pub static mut SYSTEM_EVT_QUEUE: MaybeUninit<LinkedListNode> = MaybeUninit::unin
|
|||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut MAC_802_15_4_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
pub static mut MAC_802_15_4_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
||||||
|
|
||||||
#[cfg(feature = "mac")]
|
|
||||||
const MAC_802_15_4_NOTIF_RSP_EVT_BUFFER_SIZE: usize = TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255;
|
|
||||||
|
|
||||||
#[cfg(feature = "mac")]
|
#[cfg(feature = "mac")]
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut MAC_802_15_4_NOTIF_RSP_EVT_BUFFER: MaybeUninit<AlignedData<MAC_802_15_4_NOTIF_RSP_EVT_BUFFER_SIZE>> =
|
pub static mut MAC_802_15_4_NOTIF_RSP_EVT_BUFFER: MaybeUninit<
|
||||||
MaybeUninit::uninit();
|
Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>,
|
||||||
|
> = MaybeUninit::uninit();
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut EVT_POOL: MaybeUninit<[u8; POOL_SIZE]> = MaybeUninit::uninit();
|
pub static mut EVT_POOL: MaybeUninit<Aligned<A4, [u8; POOL_SIZE]>> = MaybeUninit::uninit();
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut SYS_CMD_BUF: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
pub static mut SYS_CMD_BUF: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
||||||
|
|
||||||
const SYS_SPARE_EVT_BUF_SIZE: usize = TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255;
|
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut SYS_SPARE_EVT_BUF: MaybeUninit<AlignedData<SYS_SPARE_EVT_BUF_SIZE>> = MaybeUninit::uninit();
|
pub static mut SYS_SPARE_EVT_BUF: MaybeUninit<Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> =
|
||||||
|
MaybeUninit::uninit();
|
||||||
|
|
||||||
#[link_section = "MB_MEM1"]
|
#[link_section = "MB_MEM1"]
|
||||||
pub static mut BLE_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
pub static mut BLE_CMD_BUFFER: MaybeUninit<CmdPacket> = MaybeUninit::uninit();
|
||||||
|
|
||||||
const BLE_SPARE_EVT_BUF_SIZE: usize = TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255;
|
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
pub static mut BLE_SPARE_EVT_BUF: MaybeUninit<AlignedData<BLE_SPARE_EVT_BUF_SIZE>> = MaybeUninit::uninit();
|
pub static mut BLE_SPARE_EVT_BUF: MaybeUninit<Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + TL_EVT_HEADER_SIZE + 255]>> =
|
||||||
|
MaybeUninit::uninit();
|
||||||
const HCI_ACL_DATA_BUFFER_SIZE: usize = TL_PACKET_HEADER_SIZE + 5 + 251;
|
|
||||||
|
|
||||||
#[link_section = "MB_MEM2"]
|
#[link_section = "MB_MEM2"]
|
||||||
// fuck these "magic" numbers from ST ---v---v
|
// fuck these "magic" numbers from ST ---v---v
|
||||||
pub static mut HCI_ACL_DATA_BUFFER: MaybeUninit<[u8; HCI_ACL_DATA_BUFFER_SIZE]> = MaybeUninit::uninit();
|
pub static mut HCI_ACL_DATA_BUFFER: MaybeUninit<Aligned<A4, [u8; TL_PACKET_HEADER_SIZE + 5 + 251]>> =
|
||||||
|
MaybeUninit::uninit();
|
||||||
|
Loading…
Reference in New Issue
Block a user