Skip to content

Commit

Permalink
Rename M, DmaMode, MODE type parameters to Dm
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajSadel committed Dec 17, 2024
1 parent 20e5ea1 commit 1d9f945
Show file tree
Hide file tree
Showing 14 changed files with 395 additions and 395 deletions.
2 changes: 1 addition & 1 deletion esp-hal/src/dma/gdma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ impl InterruptAccess<DmaRxInterrupt> for AnyGdmaRxChannel {
}
}

impl<CH: DmaChannel, M: Mode> Channel<'_, M, CH> {
impl<CH: DmaChannel, Dm: Mode> Channel<'_, Dm, CH> {
/// Asserts that the channel is compatible with the given peripheral.
pub fn runtime_ensure_compatible<P: DmaEligible>(&self, _peripheral: &PeripheralRef<'_, P>) {
// No runtime checks; GDMA channels are compatible with any peripheral
Expand Down
20 changes: 10 additions & 10 deletions esp-hal/src/dma/m2m.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ use crate::{
/// This is a pseudo-peripheral that allows for memory to memory transfers.
/// It is not a real peripheral, but a way to use the DMA engine for memory
/// to memory transfers.
pub struct Mem2Mem<'d, M>
pub struct Mem2Mem<'d, Dm>
where
M: Mode,
Dm: Mode,
{
channel: Channel<'d, M, AnyGdmaChannel>,
channel: Channel<'d, Dm, AnyGdmaChannel>,
rx_chain: DescriptorChain,
tx_chain: DescriptorChain,
peripheral: DmaPeripheral,
Expand Down Expand Up @@ -123,9 +123,9 @@ impl<'d> Mem2Mem<'d, Blocking> {
}
}

impl<M> Mem2Mem<'_, M>
impl<Dm> Mem2Mem<'_, Dm>
where
M: Mode,
Dm: Mode,
{
/// Start a memory to memory transfer.
pub fn start_transfer<'t, TXBUF, RXBUF>(
Expand Down Expand Up @@ -156,9 +156,9 @@ where
}
}

impl<MODE> DmaSupport for Mem2Mem<'_, MODE>
impl<Dm> DmaSupport for Mem2Mem<'_, Dm>
where
MODE: Mode,
Dm: Mode,
{
fn peripheral_wait_dma(&mut self, _is_rx: bool, _is_tx: bool) {
while !self.channel.rx.is_done() {}
Expand All @@ -169,11 +169,11 @@ where
}
}

impl<'d, M> DmaSupportRx for Mem2Mem<'d, M>
impl<'d, Dm> DmaSupportRx for Mem2Mem<'d, Dm>
where
M: Mode,
Dm: Mode,
{
type RX = ChannelRx<'d, M, AnyGdmaRxChannel>;
type RX = ChannelRx<'d, Dm, AnyGdmaRxChannel>;

fn rx(&mut self) -> &mut Self::RX {
&mut self.channel.rx
Expand Down
44 changes: 22 additions & 22 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1808,13 +1808,13 @@ fn create_guard(_ch: &impl RegisterAccess) -> PeripheralGuard {
// DMA receive channel
#[non_exhaustive]
#[doc(hidden)]
pub struct ChannelRx<'a, M, CH>
pub struct ChannelRx<'a, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaRxChannel,
{
pub(crate) rx_impl: PeripheralRef<'a, CH>,
pub(crate) _phantom: PhantomData<M>,
pub(crate) _phantom: PhantomData<Dm>,
pub(crate) _guard: PeripheralGuard,
}

Expand Down Expand Up @@ -1892,9 +1892,9 @@ where
}
}

impl<M, CH> ChannelRx<'_, M, CH>
impl<Dm, CH> ChannelRx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaRxChannel,
{
/// Configure the channel.
Expand Down Expand Up @@ -1936,16 +1936,16 @@ where
}
}

impl<M, CH> crate::private::Sealed for ChannelRx<'_, M, CH>
impl<Dm, CH> crate::private::Sealed for ChannelRx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaRxChannel,
{
}

impl<M, CH> Rx for ChannelRx<'_, M, CH>
impl<Dm, CH> Rx for ChannelRx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaRxChannel,
{
// TODO: used by I2S, which should be rewritten to use the Preparation-based
Expand Down Expand Up @@ -2108,13 +2108,13 @@ pub trait Tx: crate::private::Sealed {

/// DMA transmit channel
#[doc(hidden)]
pub struct ChannelTx<'a, M, CH>
pub struct ChannelTx<'a, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaTxChannel,
{
pub(crate) tx_impl: PeripheralRef<'a, CH>,
pub(crate) _phantom: PhantomData<M>,
pub(crate) _phantom: PhantomData<Dm>,
pub(crate) _guard: PeripheralGuard,
}

Expand Down Expand Up @@ -2186,9 +2186,9 @@ where
}
}

impl<M, CH> ChannelTx<'_, M, CH>
impl<Dm, CH> ChannelTx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaTxChannel,
{
/// Configure the channel priority.
Expand Down Expand Up @@ -2230,16 +2230,16 @@ where
}
}

impl<M, CH> crate::private::Sealed for ChannelTx<'_, M, CH>
impl<Dm, CH> crate::private::Sealed for ChannelTx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaTxChannel,
{
}

impl<M, CH> Tx for ChannelTx<'_, M, CH>
impl<Dm, CH> Tx for ChannelTx<'_, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaTxChannel,
{
// TODO: used by I2S, which should be rewritten to use the Preparation-based
Expand Down Expand Up @@ -2448,15 +2448,15 @@ pub trait InterruptAccess<T: EnumSetType>: crate::private::Sealed {

/// DMA Channel
#[non_exhaustive]
pub struct Channel<'d, M, CH>
pub struct Channel<'d, Dm, CH>
where
M: Mode,
Dm: Mode,
CH: DmaChannel,
{
/// RX half of the channel
pub rx: ChannelRx<'d, M, CH::Rx>,
pub rx: ChannelRx<'d, Dm, CH::Rx>,
/// TX half of the channel
pub tx: ChannelTx<'d, M, CH::Tx>,
pub tx: ChannelTx<'d, Dm, CH::Tx>,
}

impl<'d, CH> Channel<'d, Blocking, CH>
Expand Down
4 changes: 2 additions & 2 deletions esp-hal/src/dma/pdma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ pub(super) fn init_dma(_cs: CriticalSection<'_>) {
}
}

impl<CH, M> Channel<'_, M, CH>
impl<CH, Dm> Channel<'_, Dm, CH>
where
CH: DmaChannel,
M: Mode,
Dm: Mode,
{
/// Asserts that the channel is compatible with the given peripheral.
pub fn runtime_ensure_compatible(&self, peripheral: &PeripheralRef<'_, impl DmaEligible>) {
Expand Down
Loading

0 comments on commit 1d9f945

Please sign in to comment.