Skip to content

Commit

Permalink
Restore configurable priority via DmaChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Nov 21, 2024
1 parent f86431d commit 6ab5ef6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions esp-hal/src/dma/gdma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ impl DmaChannel for AnyGdmaChannel {
type Rx = AnyGdmaRxChannel;
type Tx = AnyGdmaTxChannel;

fn set_priority(&self, priority: DmaPriority) {
AnyGdmaRxChannel(self.0).set_priority(priority);
AnyGdmaTxChannel(self.0).set_priority(priority);
}

unsafe fn split_internal(self, _: crate::private::Internal) -> (Self::Rx, Self::Tx) {
(AnyGdmaRxChannel(self.0), AnyGdmaTxChannel(self.0))
}
Expand Down Expand Up @@ -608,6 +613,10 @@ macro_rules! impl_channel {
type Rx = AnyGdmaRxChannel;
type Tx = AnyGdmaTxChannel;

fn set_priority(&self, priority: DmaPriority) {
AnyGdmaChannel($num).set_priority(priority);
}

unsafe fn split_internal(self, _: $crate::private::Internal) -> (Self::Rx, Self::Tx) {
(AnyGdmaRxChannel($num), AnyGdmaTxChannel($num))
}
Expand Down
4 changes: 4 additions & 0 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,10 @@ pub trait DmaChannel: Peripheral<P = Self> {
/// A description of the TX half of a DMA Channel.
type Tx: DmaTxChannel;

/// Sets the priority of the DMA channel.
#[cfg(gdma)]
fn set_priority(&self, priority: DmaPriority);

/// Splits the DMA channel into its RX and TX halves.
#[cfg(any(not(esp32c2), not(esp32s3)))]
fn split(self) -> (Self::Rx, Self::Tx) {
Expand Down

0 comments on commit 6ab5ef6

Please sign in to comment.