From 50a7ada0bbc4ee8b93d1ec364a5fbf5e4e5eccf7 Mon Sep 17 00:00:00 2001 From: Caleb Garrett <47389035+caleb-garrett@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:28:53 -0400 Subject: [PATCH] Fixed DMA CI build issues. --- embassy-stm32/src/dma/dma_bdma.rs | 91 +++++++++++++------------------ 1 file changed, 39 insertions(+), 52 deletions(-) diff --git a/embassy-stm32/src/dma/dma_bdma.rs b/embassy-stm32/src/dma/dma_bdma.rs index 5b3243de7..7b5b3cf58 100644 --- a/embassy-stm32/src/dma/dma_bdma.rs +++ b/embassy-stm32/src/dma/dma_bdma.rs @@ -10,8 +10,7 @@ use super::ringbuffer::{DmaCtrl, OverrunError, ReadableDmaRingBuffer, WritableDm use super::word::{Word, WordSize}; use super::{AnyChannel, Channel, Dir, Request, STATE}; use crate::interrupt::typelevel::Interrupt; -use crate::interrupt; -use crate::pac; +use crate::{interrupt, pac}; pub(crate) struct ChannelInfo { pub(crate) dma: DmaInfo, @@ -78,6 +77,44 @@ impl Default for TransferOptions { } } +/// DMA request priority +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] +pub enum Priority { + /// Low Priority + Low, + /// Medium Priority + Medium, + /// High Priority + High, + /// Very High Priority + VeryHigh, +} + +#[cfg(dma)] +impl From for pac::dma::vals::Pl { + fn from(value: Priority) -> Self { + match value { + Priority::Low => pac::dma::vals::Pl::LOW, + Priority::Medium => pac::dma::vals::Pl::MEDIUM, + Priority::High => pac::dma::vals::Pl::HIGH, + Priority::VeryHigh => pac::dma::vals::Pl::VERYHIGH, + } + } +} + +#[cfg(bdma)] +impl From for pac::bdma::vals::Pl { + fn from(value: Priority) -> Self { + match value { + Priority::Low => pac::bdma::vals::Pl::LOW, + Priority::Medium => pac::bdma::vals::Pl::MEDIUM, + Priority::High => pac::bdma::vals::Pl::HIGH, + Priority::VeryHigh => pac::bdma::vals::Pl::VERYHIGH, + } + } +} + #[cfg(dma)] pub use dma_only::*; #[cfg(dma)] @@ -173,31 +210,6 @@ mod dma_only { } } } - - /// DMA request priority - #[derive(Debug, Copy, Clone, PartialEq, Eq)] - #[cfg_attr(feature = "defmt", derive(defmt::Format))] - pub enum Priority { - /// Low Priority - Low, - /// Medium Priority - Medium, - /// High Priority - High, - /// Very High Priority - VeryHigh, - } - - impl From for vals::Pl { - fn from(value: Priority) -> Self { - match value { - Priority::Low => vals::Pl::LOW, - Priority::Medium => vals::Pl::MEDIUM, - Priority::High => vals::Pl::HIGH, - Priority::VeryHigh => vals::Pl::VERYHIGH, - } - } - } } #[cfg(bdma)] @@ -224,31 +236,6 @@ mod bdma_only { } } } - - /// DMA request priority - #[derive(Debug, Copy, Clone, PartialEq, Eq)] - #[cfg_attr(feature = "defmt", derive(defmt::Format))] - pub enum Priority { - /// Low Priority - Low, - /// Medium Priority - Medium, - /// High Priority - High, - /// Very High Priority - VeryHigh, - } - - impl From for vals::Pl { - fn from(value: Priority) -> Self { - match value { - Priority::Low => vals::Pl::LOW, - Priority::Medium => vals::Pl::MEDIUM, - Priority::High => vals::Pl::HIGH, - Priority::VeryHigh => vals::Pl::VERYHIGH, - } - } - } } pub(crate) struct ChannelState {