@@ -16,6 +16,7 @@ use crate::dma::{
1616 dma1, CircBuffer , DMAFrame , FrameReader , FrameSender , Receive , RxDma , TransferPayload ,
1717 Transmit , TxDma ,
1818} ;
19+ use crate :: dmamux:: { DmaInput , DmaMux } ;
1920use crate :: gpio:: { self , Alternate , OpenDrain , PushPull } ;
2021use crate :: pac;
2122use crate :: rcc:: { Clocks , Enable , RccBus , Reset } ;
@@ -225,8 +226,8 @@ macro_rules! hal {
225226 $USARTX: ident: (
226227 $usartX: ident,
227228 $pclkX: ident,
228- tx: ( $txdma: ident, $dmacst : ident , $dmatxch : path) ,
229- rx: ( $rxdma: ident, $dmacsr : ident , $dmarxch : path)
229+ tx: ( $txdma: ident, $dmatxch : path , $dmatxsel : path) ,
230+ rx: ( $rxdma: ident, $dmarxch : path , $dmarxsel : path)
230231 ) ,
231232 ) +) => {
232233 $(
@@ -721,9 +722,7 @@ macro_rules! hal {
721722 self . channel. set_transfer_length( len as u16 ) ;
722723
723724 // Tell DMA to request from serial
724- self . channel. cselr( ) . modify( |_, w| {
725- w. $dmacsr( ) . map2( )
726- } ) ;
725+ self . channel. set_request_line( $dmarxsel) . unwrap( ) ;
727726
728727 self . channel. ccr( ) . modify( |_, w| {
729728 w
@@ -776,9 +775,7 @@ macro_rules! hal {
776775 self . channel. set_transfer_length( buf. max_len( ) as u16 ) ;
777776
778777 // Tell DMA to request from serial
779- self . channel. cselr( ) . modify( |_, w| {
780- w. $dmacsr( ) . map2( )
781- } ) ;
778+ self . channel. set_request_line( $dmarxsel) . unwrap( ) ;
782779
783780 self . channel. ccr( ) . modify( |_, w| {
784781 w
@@ -823,9 +820,7 @@ macro_rules! hal {
823820 self . channel. set_peripheral_address( & usart. tdr as * const _ as u32 , false ) ;
824821
825822 // Tell DMA to request from serial
826- self . channel. cselr( ) . modify( |_, w| {
827- w. $dmacst( ) . map2( )
828- } ) ;
823+ self . channel. set_request_line( $dmatxsel) . unwrap( ) ;
829824
830825 self . channel. ccr( ) . modify( |_, w| unsafe {
831826 w. mem2mem( )
@@ -852,13 +847,13 @@ macro_rules! hal {
852847}
853848
854849hal ! {
855- USART1 : ( usart1, pclk2, tx: ( TxDma1 , c4s , dma1:: C4 ) , rx: ( RxDma1 , c5s , dma1:: C5 ) ) ,
856- USART2 : ( usart2, pclk1, tx: ( TxDma2 , c7s , dma1:: C7 ) , rx: ( RxDma2 , c6s , dma1:: C6 ) ) ,
850+ USART1 : ( usart1, pclk2, tx: ( TxDma1 , dma1:: C4 , DmaInput :: Usart1Tx ) , rx: ( RxDma1 , dma1:: C5 , DmaInput :: Usart1Rx ) ) ,
851+ USART2 : ( usart2, pclk1, tx: ( TxDma2 , dma1:: C7 , DmaInput :: Usart2Tx ) , rx: ( RxDma2 , dma1:: C6 , DmaInput :: Usart2Rx ) ) ,
857852}
858853
859854#[ cfg( not( any( feature = "stm32l432" , feature = "stm32l442" ) ) ) ]
860855hal ! {
861- USART3 : ( usart3, pclk1, tx: ( TxDma3 , c2s , dma1:: C2 ) , rx: ( RxDma3 , c3s , dma1:: C3 ) ) ,
856+ USART3 : ( usart3, pclk1, tx: ( TxDma3 , dma1:: C2 , DmaInput :: Usart3Tx ) , rx: ( RxDma3 , dma1:: C3 , DmaInput :: Usart3Rx ) ) ,
862857}
863858
864859#[ cfg( any(
@@ -882,7 +877,7 @@ hal! {
882877 feature = "stm32l4s9" ,
883878) ) ]
884879hal ! {
885- UART4 : ( uart4, pclk1, tx: ( TxDma4 , c3s , dma2:: C3 ) , rx: ( RxDma4 , c5s , dma2:: C5 ) ) ,
880+ UART4 : ( uart4, pclk1, tx: ( TxDma4 , dma2:: C3 , DmaInput :: Uart4Tx ) , rx: ( RxDma4 , dma2:: C5 , DmaInput :: Uart4Rx ) ) ,
886881}
887882
888883#[ cfg( any(
@@ -903,7 +898,7 @@ hal! {
903898 feature = "stm32l4s9" ,
904899) ) ]
905900hal ! {
906- UART5 : ( uart5, pclk1, tx: ( TxDma5 , c1s , dma2:: C1 ) , rx: ( RxDma5 , c2s , dma2:: C2 ) ) ,
901+ UART5 : ( uart5, pclk1, tx: ( TxDma5 , dma2:: C1 , DmaInput :: Uart5Tx ) , rx: ( RxDma5 , dma2:: C2 , DmaInput :: Uart5Rx ) ) ,
907902}
908903
909904impl < USART , PINS > fmt:: Write for Serial < USART , PINS >
0 commit comments