@@ -39,7 +39,9 @@ use super::{
3939 DmaTransfer , Error , Instance , Word ,
4040} ;
4141
42- // This trait is defined to be bound by ChannelWaker when futures are enabled via the
42+ /// DmaChannel trait provides the API contract that all GPDMA channels exposed to the user
43+ /// implement.
44+ // Note: This trait is defined to be bound by ChannelWaker when futures are enabled via the
4345// `gpdma-futures` feature. This is to ensure that the waker associated with a channel can
4446// be accessed from the interrupt handler and the DmaTransfer `poll` function.
4547// Specifically, this alternate definition is needed to ensure that the DmaChannel implementations
@@ -150,6 +152,7 @@ where
150152{
151153 #[ inline( always) ]
152154 fn handle_interrupt ( ) {
155+ // Safety:
153156 // This creates a DmaChannelRef instance for channel N, which is be a duplicate to the
154157 // DmaChannelRef instance that is held as a mutable reference in the DmaTransfer struct
155158 // while a transfer is in progress. However, it is only used to disable the transfer
@@ -159,7 +162,7 @@ where
159162 // When the DmaTransfer struct is dropped, interrupts are disabled for the channel,
160163 // preventing this interrupt from being triggered. Interrupts are only enabled when the
161164 // transfer is awaited (calling IntoFuture::into_future).
162- let mut ch = Self :: new ( ) ;
165+ let mut ch = unsafe { Self :: new_unsafe ( ) } ;
163166
164167 // This is a single volatile write to the channel's interrupt status register to disable
165168 // interrupts for the channel so this interrupt doesn't trigger again while the transfer
0 commit comments