From ac195356d6f3c652615299e78523cb0f40478e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Wed, 13 Nov 2024 12:35:01 +0100 Subject: [PATCH] Restore configurable priority via DmaChannel --- esp-hal/src/dma/gdma.rs | 9 +++++++++ esp-hal/src/dma/mod.rs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/esp-hal/src/dma/gdma.rs b/esp-hal/src/dma/gdma.rs index 7400f791e5..ebe89ed75f 100644 --- a/esp-hal/src/dma/gdma.rs +++ b/esp-hal/src/dma/gdma.rs @@ -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)) } @@ -602,6 +607,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)) } diff --git a/esp-hal/src/dma/mod.rs b/esp-hal/src/dma/mod.rs index b4aad105e5..8635428640 100644 --- a/esp-hal/src/dma/mod.rs +++ b/esp-hal/src/dma/mod.rs @@ -1589,6 +1589,10 @@ pub trait DmaChannel: Peripheral

{ /// 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) {