Skip to content

Commit d4951d9

Browse files
committed
Remove AnyPdmaChannel
1 parent f16366a commit d4951d9

File tree

1 file changed

+0
-213
lines changed

1 file changed

+0
-213
lines changed

esp-hal/src/dma/pdma.rs

-213
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,11 @@ pub struct SpiDmaRxChannelImpl<C>(C);
3737

3838
impl<C> crate::private::Sealed for SpiDmaRxChannelImpl<C> {}
3939

40-
impl<C: PdmaChannel> SpiDmaRxChannelImpl<C>
41-
where
42-
AnyPdmaRxChannel: From<Self>,
43-
{
44-
fn degrade(self) -> AnyPdmaRxChannelImpl {
45-
AnyPdmaRxChannelImpl(AnyPdmaRxChannel::from(self))
46-
}
47-
}
48-
4940
#[doc(hidden)]
5041
pub struct SpiDmaTxChannelImpl<C>(C);
5142

5243
impl<C> crate::private::Sealed for SpiDmaTxChannelImpl<C> {}
5344

54-
impl<C: PdmaChannel> SpiDmaTxChannelImpl<C>
55-
where
56-
AnyPdmaTxChannel: From<Self>,
57-
{
58-
fn degrade(self) -> AnyPdmaTxChannelImpl {
59-
AnyPdmaTxChannelImpl(AnyPdmaTxChannel::from(self))
60-
}
61-
}
62-
6345
impl<C: PdmaChannel<RegisterBlock = SpiRegisterBlock>> RegisterAccess for SpiDmaTxChannelImpl<C> {
6446
fn reset(&self) {
6547
let spi = self.0.register_block();
@@ -347,14 +329,6 @@ macro_rules! ImplSpiChannel {
347329
type Tx = SpiDmaTxChannelImpl<Self>;
348330
}
349331

350-
impl DmaChannelConvert<AnyPdmaChannel> for [<Spi $num DmaChannel>] {
351-
fn degrade_rx(rx: Self::Rx) -> AnyPdmaRxChannelImpl {
352-
rx.degrade()
353-
}
354-
fn degrade_tx(tx: Self::Tx) -> AnyPdmaTxChannelImpl {
355-
tx.degrade()
356-
}
357-
}
358332
impl PeripheralDmaChannel for [<Spi $num DmaChannel>] {
359333
type P = crate::peripherals::[<SPI $num>];
360334
}
@@ -469,29 +443,11 @@ pub struct I2sDmaRxChannelImpl<C>(C);
469443

470444
impl<C> crate::private::Sealed for I2sDmaRxChannelImpl<C> {}
471445

472-
impl<C: PdmaChannel> I2sDmaRxChannelImpl<C>
473-
where
474-
AnyPdmaRxChannel: From<Self>,
475-
{
476-
fn degrade(self) -> AnyPdmaRxChannelImpl {
477-
AnyPdmaRxChannelImpl(AnyPdmaRxChannel::from(self))
478-
}
479-
}
480-
481446
#[doc(hidden)]
482447
pub struct I2sDmaTxChannelImpl<C>(C);
483448

484449
impl<C> crate::private::Sealed for I2sDmaTxChannelImpl<C> {}
485450

486-
impl<C: PdmaChannel> I2sDmaTxChannelImpl<C>
487-
where
488-
AnyPdmaTxChannel: From<Self>,
489-
{
490-
fn degrade(self) -> AnyPdmaTxChannelImpl {
491-
AnyPdmaTxChannelImpl(AnyPdmaTxChannel::from(self))
492-
}
493-
}
494-
495451
impl<C: PdmaChannel<RegisterBlock = I2sRegisterBlock>> RegisterAccess for I2sDmaTxChannelImpl<C> {
496452
fn set_burst_mode(&self, burst_mode: bool) {
497453
let reg_block = self.0.register_block();
@@ -790,14 +746,6 @@ macro_rules! ImplI2sChannel {
790746
type Tx = I2sDmaTxChannelImpl<Self>;
791747
}
792748

793-
impl DmaChannelConvert<AnyPdmaChannel> for [<I2s $num DmaChannel>] {
794-
fn degrade_rx(rx: Self::Rx) -> AnyPdmaRxChannelImpl {
795-
rx.degrade()
796-
}
797-
fn degrade_tx(tx: Self::Tx) -> AnyPdmaTxChannelImpl {
798-
tx.degrade()
799-
}
800-
}
801749
impl PeripheralDmaChannel for [<I2s $num DmaChannel>] {
802750
type P = crate::peripherals::[<I2S $num>];
803751
}
@@ -944,167 +892,6 @@ impl<'d> Dma<'d> {
944892
}
945893
}
946894

947-
macro_rules! define_enum {
948-
(
949-
$(#[$meta:meta])*
950-
$vis:vis enum $ty:ident {
951-
$($(#[$cfg:meta])?
952-
$variant:ident($inner:ty),)*
953-
}
954-
) => {
955-
$(#[$meta])*
956-
$vis enum $ty {
957-
$(
958-
$(#[$cfg])?
959-
$variant($inner),
960-
)*
961-
}
962-
963-
$(
964-
$(#[$cfg])?
965-
impl From<$inner> for $ty {
966-
fn from(inner: $inner) -> Self {
967-
Self::$variant(inner)
968-
}
969-
}
970-
)*
971-
}
972-
}
973-
974-
/// An arbitrary PDMA channel.
975-
// NOTE: this is unused currently (peripherals prescribe a specific channel) but type-erased
976-
// peripherals will require type-erased channels.
977-
#[non_exhaustive]
978-
pub struct AnyPdmaChannel;
979-
impl crate::private::Sealed for AnyPdmaChannel {}
980-
981-
impl DmaChannel for AnyPdmaChannel {
982-
type Rx = AnyPdmaRxChannelImpl;
983-
type Tx = AnyPdmaTxChannelImpl;
984-
}
985-
986-
define_enum! {
987-
#[doc(hidden)]
988-
pub enum AnyPdmaRxChannel {
989-
Spi2(SpiDmaRxChannelImpl<Spi2DmaChannel>),
990-
Spi3(SpiDmaRxChannelImpl<Spi3DmaChannel>),
991-
I2s0(I2sDmaRxChannelImpl<I2s0DmaChannel>),
992-
#[cfg(i2s1)]
993-
I2s1(I2sDmaRxChannelImpl<I2s1DmaChannel>),
994-
}
995-
}
996-
997-
#[doc(hidden)]
998-
pub struct AnyPdmaRxChannelImpl(AnyPdmaRxChannel);
999-
1000-
impl crate::private::Sealed for AnyPdmaRxChannelImpl {}
1001-
impl InterruptAccess<DmaRxInterrupt> for AnyPdmaRxChannelImpl {
1002-
delegate::delegate! {
1003-
to match &self.0 {
1004-
AnyPdmaRxChannel::Spi2(channel) => channel,
1005-
AnyPdmaRxChannel::Spi3(channel) => channel,
1006-
AnyPdmaRxChannel::I2s0(channel) => channel,
1007-
#[cfg(i2s1)]
1008-
AnyPdmaRxChannel::I2s1(channel) => channel,
1009-
} {
1010-
fn enable_listen(&self, interrupts: EnumSet<DmaRxInterrupt>, enable: bool);
1011-
fn is_listening(&self) -> EnumSet<DmaRxInterrupt>;
1012-
fn clear(&self, interrupts: impl Into<EnumSet<DmaRxInterrupt>>);
1013-
fn pending_interrupts(&self) -> EnumSet<DmaRxInterrupt>;
1014-
fn waker(&self) -> &'static AtomicWaker;
1015-
}
1016-
}
1017-
}
1018-
impl RegisterAccess for AnyPdmaRxChannelImpl {
1019-
delegate::delegate! {
1020-
to match &self.0 {
1021-
AnyPdmaRxChannel::Spi2(channel) => channel,
1022-
AnyPdmaRxChannel::Spi3(channel) => channel,
1023-
AnyPdmaRxChannel::I2s0(channel) => channel,
1024-
#[cfg(i2s1)]
1025-
AnyPdmaRxChannel::I2s1(channel) => channel,
1026-
} {
1027-
fn set_burst_mode(&self, burst_mode: bool);
1028-
fn set_priority(&self, priority: DmaPriority);
1029-
fn reset(&self);
1030-
fn set_link_addr(&self, address: u32);
1031-
fn set_peripheral(&self, peripheral: u8);
1032-
fn start(&self);
1033-
fn stop(&self);
1034-
fn restart(&self);
1035-
fn is_compatible_with(&self, peripheral: &impl PeripheralMarker) -> bool;
1036-
}
1037-
}
1038-
}
1039-
impl RxRegisterAccess for AnyPdmaRxChannelImpl {}
1040-
1041-
define_enum! {
1042-
#[doc(hidden)]
1043-
pub enum AnyPdmaTxChannel {
1044-
Spi2(SpiDmaTxChannelImpl<Spi2DmaChannel>),
1045-
Spi3(SpiDmaTxChannelImpl<Spi3DmaChannel>),
1046-
I2s0(I2sDmaTxChannelImpl<I2s0DmaChannel>),
1047-
#[cfg(i2s1)]
1048-
I2s1(I2sDmaTxChannelImpl<I2s1DmaChannel>),
1049-
}
1050-
}
1051-
1052-
#[doc(hidden)]
1053-
pub struct AnyPdmaTxChannelImpl(AnyPdmaTxChannel);
1054-
1055-
impl crate::private::Sealed for AnyPdmaTxChannelImpl {}
1056-
impl InterruptAccess<DmaTxInterrupt> for AnyPdmaTxChannelImpl {
1057-
delegate::delegate! {
1058-
to match &self.0 {
1059-
AnyPdmaTxChannel::Spi2(channel) => channel,
1060-
AnyPdmaTxChannel::Spi3(channel) => channel,
1061-
AnyPdmaTxChannel::I2s0(channel) => channel,
1062-
#[cfg(i2s1)]
1063-
AnyPdmaTxChannel::I2s1(channel) => channel,
1064-
} {
1065-
fn enable_listen(&self, interrupts: EnumSet<DmaTxInterrupt>, enable: bool);
1066-
fn is_listening(&self) -> EnumSet<DmaTxInterrupt>;
1067-
fn clear(&self, interrupts: impl Into<EnumSet<DmaTxInterrupt>>);
1068-
fn pending_interrupts(&self) -> EnumSet<DmaTxInterrupt>;
1069-
fn waker(&self) -> &'static AtomicWaker;
1070-
}
1071-
}
1072-
}
1073-
impl RegisterAccess for AnyPdmaTxChannelImpl {
1074-
delegate::delegate! {
1075-
to match &self.0 {
1076-
AnyPdmaTxChannel::Spi2(channel) => channel,
1077-
AnyPdmaTxChannel::Spi3(channel) => channel,
1078-
AnyPdmaTxChannel::I2s0(channel) => channel,
1079-
#[cfg(i2s1)]
1080-
AnyPdmaTxChannel::I2s1(channel) => channel,
1081-
} {
1082-
fn set_burst_mode(&self, burst_mode: bool);
1083-
fn set_priority(&self, priority: DmaPriority);
1084-
fn reset(&self);
1085-
fn set_link_addr(&self, address: u32);
1086-
fn set_peripheral(&self, peripheral: u8);
1087-
fn start(&self);
1088-
fn stop(&self);
1089-
fn restart(&self);
1090-
fn is_compatible_with(&self, peripheral: &impl PeripheralMarker) -> bool;
1091-
}
1092-
}
1093-
}
1094-
impl TxRegisterAccess for AnyPdmaTxChannelImpl {
1095-
delegate::delegate! {
1096-
to match &self.0 {
1097-
AnyPdmaTxChannel::Spi2(channel) => channel,
1098-
AnyPdmaTxChannel::Spi3(channel) => channel,
1099-
AnyPdmaTxChannel::I2s0(channel) => channel,
1100-
#[cfg(i2s1)]
1101-
AnyPdmaTxChannel::I2s1(channel) => channel,
1102-
} {
1103-
fn last_dscr_address(&self) -> usize;
1104-
}
1105-
}
1106-
}
1107-
1108895
impl<'d, C, M: Mode> Channel<'d, C, M>
1109896
where
1110897
C: DmaChannel,

0 commit comments

Comments
 (0)