diff --git a/embassy-stm32-wpan/src/evt.rs b/embassy-stm32-wpan/src/evt.rs index ee108ec88..47bdc49bf 100644 --- a/embassy-stm32-wpan/src/evt.rs +++ b/embassy-stm32-wpan/src/evt.rs @@ -45,15 +45,15 @@ pub struct AsynchEvt { payload: [u8; 1], } -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone)] #[repr(C, packed)] pub struct Evt { pub evt_code: u8, pub payload_len: u8, - pub payload: [u8; 1], + pub payload: [u8; 255], } -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone)] #[repr(C, packed)] pub struct EvtSerial { pub kind: u8, @@ -75,7 +75,7 @@ pub struct EvtStub { /// Be careful that the asynchronous events reported by the CPU2 on the system channel do /// include the header and shall use `EvtPacket` format. Only the command response format on the /// system channel is different. -#[derive(Copy, Clone, Default)] +#[derive(Copy, Clone)] #[repr(C, packed)] pub struct EvtPacket { pub header: PacketHeader, diff --git a/embassy-stm32-wpan/src/mac.rs b/embassy-stm32-wpan/src/mac.rs index 9fbf37473..d2be1b85c 100644 --- a/embassy-stm32-wpan/src/mac.rs +++ b/embassy-stm32-wpan/src/mac.rs @@ -8,14 +8,13 @@ use embassy_futures::poll_once; use embassy_stm32::ipcc::Ipcc; use embassy_sync::waitqueue::AtomicWaker; +use crate::channels; use crate::cmd::CmdPacket; use crate::consts::TlPacketType; use crate::evt::{EvtBox, EvtPacket}; use crate::tables::{ Mac802_15_4Table, MAC_802_15_4_CMD_BUFFER, MAC_802_15_4_NOTIF_RSP_EVT_BUFFER, TL_MAC_802_15_4_TABLE, }; -use crate::unsafe_linked_list::LinkedListNode; -use crate::{channels, EVT_QUEUE}; static MAC_WAKER: AtomicWaker = AtomicWaker::new(); static MAC_EVT_OUT: AtomicBool = AtomicBool::new(false); @@ -27,8 +26,6 @@ pub struct Mac { impl Mac { pub(crate) fn new() -> Self { unsafe { - LinkedListNode::init_head(EVT_QUEUE.as_mut_ptr()); - TL_MAC_802_15_4_TABLE.as_mut_ptr().write_volatile(Mac802_15_4Table { p_cmdrsp_buffer: MAC_802_15_4_CMD_BUFFER.as_mut_ptr().cast(), p_notack_buffer: MAC_802_15_4_NOTIF_RSP_EVT_BUFFER.as_mut_ptr().cast(), @@ -42,7 +39,12 @@ impl Mac { /// SAFETY: passing a pointer to something other than a managed event packet is UB pub(crate) unsafe fn drop_event_packet(_: *mut EvtPacket) { // Write the ack - CmdPacket::write_into(MAC_802_15_4_CMD_BUFFER.as_mut_ptr(), TlPacketType::OtAck, 0, &[]); + CmdPacket::write_into( + MAC_802_15_4_NOTIF_RSP_EVT_BUFFER.as_mut_ptr() as *mut _, + TlPacketType::OtAck, + 0, + &[], + ); // Clear the rx flag let _ = poll_once(Ipcc::receive::( diff --git a/embassy-stm32-wpan/src/sys.rs b/embassy-stm32-wpan/src/sys.rs index 65a64e090..2b699b725 100644 --- a/embassy-stm32-wpan/src/sys.rs +++ b/embassy-stm32-wpan/src/sys.rs @@ -4,6 +4,7 @@ use core::ptr; use crate::cmd::CmdPacket; use crate::consts::TlPacketType; use crate::evt::{CcEvt, EvtBox, EvtPacket}; +#[allow(unused_imports)] use crate::shci::{SchiCommandStatus, ShciBleInitCmdParam, ShciOpcode}; use crate::tables::{SysTable, WirelessFwInfoTable}; use crate::unsafe_linked_list::LinkedListNode;