@@ -383,12 +383,12 @@ impl<DMA: Instance, const S: u8> StreamX<DMA, S> {
383383 #[ cfg( not( any( feature = "gpio-f411" , feature = "gpio-f413" , feature = "gpio-f410" ) ) ) ]
384384 #[ inline( always) ]
385385 unsafe fn st ( ) -> & ' static pac:: dma2:: ST {
386- & ( * DMA :: ptr ( ) ) . st [ S as usize ]
386+ ( * DMA :: ptr ( ) ) . st ( S as usize )
387387 }
388388 #[ cfg( any( feature = "gpio-f411" , feature = "gpio-f413" , feature = "gpio-f410" ) ) ]
389389 #[ inline( always) ]
390390 unsafe fn st ( ) -> & ' static pac:: dma1:: ST {
391- & ( * DMA :: ptr ( ) ) . st [ S as usize ]
391+ ( * DMA :: ptr ( ) ) . st ( S as usize )
392392 }
393393}
394394
@@ -481,183 +481,187 @@ where
481481 #[ inline( always) ]
482482 fn set_peripheral_address ( & mut self , value : u32 ) {
483483 unsafe { Self :: st ( ) }
484- . par
484+ . par ( )
485485 . write ( |w| unsafe { w. pa ( ) . bits ( value) } ) ;
486486 }
487487
488488 #[ inline( always) ]
489489 fn set_memory_address ( & mut self , value : u32 ) {
490490 unsafe { Self :: st ( ) }
491- . m0ar
491+ . m0ar ( )
492492 . write ( |w| unsafe { w. m0a ( ) . bits ( value) } ) ;
493493 }
494494
495495 #[ inline( always) ]
496496 fn memory_address ( & self ) -> u32 {
497- unsafe { Self :: st ( ) } . m0ar . read ( ) . m0a ( ) . bits ( )
497+ unsafe { Self :: st ( ) } . m0ar ( ) . read ( ) . m0a ( ) . bits ( )
498498 }
499499
500500 #[ inline( always) ]
501501 fn set_alternate_memory_address ( & mut self , value : u32 ) {
502502 unsafe { Self :: st ( ) }
503- . m1ar
503+ . m1ar ( )
504504 . write ( |w| unsafe { w. m1a ( ) . bits ( value) } ) ;
505505 }
506506
507507 #[ inline( always) ]
508508 fn alternate_memory_address ( & self ) -> u32 {
509- unsafe { Self :: st ( ) } . m1ar . read ( ) . m1a ( ) . bits ( )
509+ unsafe { Self :: st ( ) } . m1ar ( ) . read ( ) . m1a ( ) . bits ( )
510510 }
511511
512512 #[ inline( always) ]
513513 fn set_number_of_transfers ( & mut self , value : u16 ) {
514- unsafe { Self :: st ( ) } . ndtr . write ( |w| w. ndt ( ) . bits ( value) ) ;
514+ unsafe { Self :: st ( ) } . ndtr ( ) . write ( |w| w. ndt ( ) . set ( value) ) ;
515515 }
516516
517517 #[ inline( always) ]
518518 fn number_of_transfers ( & self ) -> u16 {
519- unsafe { Self :: st ( ) } . ndtr . read ( ) . ndt ( ) . bits ( )
519+ unsafe { Self :: st ( ) } . ndtr ( ) . read ( ) . ndt ( ) . bits ( )
520520 }
521521
522522 #[ inline( always) ]
523523 unsafe fn enable ( & mut self ) {
524- Self :: st ( ) . cr . modify ( |_, w| w. en ( ) . set_bit ( ) ) ;
524+ Self :: st ( ) . cr ( ) . modify ( |_, w| w. en ( ) . set_bit ( ) ) ;
525525 }
526526
527527 #[ inline( always) ]
528528 fn is_enabled ( & self ) -> bool {
529- unsafe { Self :: st ( ) } . cr . read ( ) . en ( ) . bit_is_set ( )
529+ unsafe { Self :: st ( ) } . cr ( ) . read ( ) . en ( ) . bit_is_set ( )
530530 }
531531
532532 #[ inline( always) ]
533533 unsafe fn disable ( & mut self ) {
534- unsafe { Self :: st ( ) } . cr . modify ( |_, w| w. en ( ) . clear_bit ( ) ) ;
534+ unsafe { Self :: st ( ) } . cr ( ) . modify ( |_, w| w. en ( ) . clear_bit ( ) ) ;
535535 }
536536
537537 #[ inline( always) ]
538538 fn set_channel ( & mut self , channel : DmaChannel ) {
539539 unsafe { Self :: st ( ) }
540- . cr
541- . modify ( |_, w| w. chsel ( ) . bits ( channel. bits ( ) ) ) ;
540+ . cr ( )
541+ . modify ( |_, w| w. chsel ( ) . set ( channel. bits ( ) ) ) ;
542542 }
543543
544544 #[ inline( always) ]
545545 fn set_priority ( & mut self , priority : config:: Priority ) {
546546 unsafe { Self :: st ( ) }
547- . cr
548- . modify ( |_, w| w. pl ( ) . bits ( priority. bits ( ) ) ) ;
547+ . cr ( )
548+ . modify ( |_, w| w. pl ( ) . set ( priority. bits ( ) ) ) ;
549549 }
550550
551551 #[ inline( always) ]
552552 fn set_peripheral_increment_offset ( & mut self , value : PeripheralIncrementOffset ) {
553553 unsafe { Self :: st ( ) }
554- . cr
554+ . cr ( )
555555 . modify ( |_, w| w. pincos ( ) . bit ( value. bits ( ) ) ) ;
556556 }
557557
558558 #[ inline( always) ]
559559 unsafe fn set_memory_size ( & mut self , size : DmaDataSize ) {
560- Self :: st ( ) . cr . modify ( |_, w| w. msize ( ) . bits ( size. bits ( ) ) ) ;
560+ Self :: st ( ) . cr ( ) . modify ( |_, w| w. msize ( ) . bits ( size. bits ( ) ) ) ;
561561 }
562562
563563 #[ inline( always) ]
564564 unsafe fn set_peripheral_size ( & mut self , size : DmaDataSize ) {
565- Self :: st ( ) . cr . modify ( |_, w| w. psize ( ) . bits ( size. bits ( ) ) ) ;
565+ Self :: st ( ) . cr ( ) . modify ( |_, w| w. psize ( ) . bits ( size. bits ( ) ) ) ;
566566 }
567567
568568 #[ inline( always) ]
569569 fn set_memory_increment ( & mut self , increment : bool ) {
570570 unsafe { Self :: st ( ) }
571- . cr
571+ . cr ( )
572572 . modify ( |_, w| w. minc ( ) . bit ( increment) ) ;
573573 }
574574
575575 #[ inline( always) ]
576576 fn set_peripheral_increment ( & mut self , increment : bool ) {
577577 unsafe { Self :: st ( ) }
578- . cr
578+ . cr ( )
579579 . modify ( |_, w| w. pinc ( ) . bit ( increment) ) ;
580580 }
581581
582582 #[ inline( always) ]
583583 fn set_circular_mode ( & mut self , value : bool ) {
584- unsafe { Self :: st ( ) } . cr . modify ( |_, w| w. circ ( ) . bit ( value) ) ;
584+ unsafe { Self :: st ( ) }
585+ . cr ( )
586+ . modify ( |_, w| w. circ ( ) . bit ( value) ) ;
585587 }
586588
587589 #[ inline( always) ]
588590 fn set_direction ( & mut self , direction : DmaDirection ) {
589591 unsafe { Self :: st ( ) }
590- . cr
592+ . cr ( )
591593 . modify ( |_, w| unsafe { w. dir ( ) . bits ( direction. bits ( ) ) } ) ;
592594 }
593595
594596 #[ inline( always) ]
595597 fn set_flow_controller ( & mut self , value : DmaFlowController ) {
596598 unsafe { Self :: st ( ) }
597- . cr
599+ . cr ( )
598600 . modify ( |_, w| w. pfctrl ( ) . bit ( value. bits ( ) ) ) ;
599601 }
600602
601603 #[ inline( always) ]
602604 fn events ( & self ) -> BitFlags < DmaEvent > {
603- BitFlags :: from_bits_truncate ( unsafe { Self :: st ( ) } . cr . read ( ) . bits ( ) )
605+ BitFlags :: from_bits_truncate ( unsafe { Self :: st ( ) } . cr ( ) . read ( ) . bits ( ) )
604606 }
605607
606608 #[ inline( always) ]
607609 fn listen_fifo_error ( & mut self ) {
608- unsafe { Self :: st ( ) } . fcr . modify ( |_, w| w. feie ( ) . set_bit ( ) ) ;
610+ unsafe { Self :: st ( ) }
611+ . fcr ( )
612+ . modify ( |_, w| w. feie ( ) . set_bit ( ) ) ;
609613 }
610614
611615 #[ inline( always) ]
612616 fn unlisten_fifo_error ( & mut self ) {
613617 unsafe { Self :: st ( ) }
614- . fcr
618+ . fcr ( )
615619 . modify ( |_, w| w. feie ( ) . clear_bit ( ) ) ;
616620 }
617621
618622 #[ inline( always) ]
619623 fn set_double_buffer ( & mut self , double_buffer : bool ) {
620624 unsafe { Self :: st ( ) }
621- . cr
625+ . cr ( )
622626 . modify ( |_, w| w. dbm ( ) . bit ( double_buffer) ) ;
623627 }
624628
625629 #[ inline( always) ]
626630 fn set_fifo_threshold ( & mut self , fifo_threshold : config:: FifoThreshold ) {
627631 unsafe { Self :: st ( ) }
628- . fcr
629- . modify ( |_, w| w. fth ( ) . bits ( fifo_threshold. bits ( ) ) ) ;
632+ . fcr ( )
633+ . modify ( |_, w| w. fth ( ) . set ( fifo_threshold. bits ( ) ) ) ;
630634 }
631635
632636 #[ inline( always) ]
633637 fn set_fifo_enable ( & mut self , fifo_enable : bool ) {
634638 //Register is actually direct mode disable rather than fifo enable
635639 unsafe { Self :: st ( ) }
636- . fcr
640+ . fcr ( )
637641 . modify ( |_, w| w. dmdis ( ) . bit ( fifo_enable) ) ;
638642 }
639643
640644 #[ inline( always) ]
641645 fn set_memory_burst ( & mut self , memory_burst : config:: BurstMode ) {
642646 unsafe { Self :: st ( ) }
643- . cr
644- . modify ( |_, w| w. mburst ( ) . bits ( memory_burst. bits ( ) ) ) ;
647+ . cr ( )
648+ . modify ( |_, w| w. mburst ( ) . set ( memory_burst. bits ( ) ) ) ;
645649 }
646650
647651 #[ inline( always) ]
648652 fn set_peripheral_burst ( & mut self , peripheral_burst : config:: BurstMode ) {
649653 unsafe { Self :: st ( ) }
650- . cr
651- . modify ( |_, w| w. pburst ( ) . bits ( peripheral_burst. bits ( ) ) ) ;
654+ . cr ( )
655+ . modify ( |_, w| w. pburst ( ) . set ( peripheral_burst. bits ( ) ) ) ;
652656 }
653657
654658 #[ inline( always) ]
655659 fn fifo_level ( & self ) -> FifoLevel {
656- unsafe { Self :: st ( ) } . fcr . read ( ) . fs ( ) . bits ( ) . into ( )
660+ unsafe { Self :: st ( ) } . fcr ( ) . read ( ) . fs ( ) . bits ( ) . into ( )
657661 }
658662
659663 fn current_buffer ( & self ) -> CurrentBuffer {
660- if unsafe { Self :: st ( ) } . cr . read ( ) . ct ( ) . bit_is_set ( ) {
664+ if unsafe { Self :: st ( ) } . cr ( ) . read ( ) . ct ( ) . bit_is_set ( ) {
661665 CurrentBuffer :: SecondBuffer
662666 } else {
663667 CurrentBuffer :: FirstBuffer
@@ -675,7 +679,7 @@ where
675679 enable : Option < BitFlags < DmaEvent > > ,
676680 ) {
677681 unsafe {
678- Self :: st ( ) . cr . modify ( |r, w| {
682+ Self :: st ( ) . cr ( ) . modify ( |r, w| {
679683 w. bits ( {
680684 let mut bits = r. bits ( ) ;
681685 if let Some ( d) = disable {
@@ -704,7 +708,7 @@ macro_rules! dma_stream {
704708 #[ inline( always) ]
705709 fn clear_flags( & mut self , flags: impl Into <BitFlags <DmaFlag >>) {
706710 let dma = unsafe { & * I :: ptr( ) } ;
707- dma. $ifcr. write( |w| unsafe { w. bits( flags. into( ) . bits( ) << $isr_shift) } ) ;
711+ dma. $ifcr( ) . write( |w| unsafe { w. bits( flags. into( ) . bits( ) << $isr_shift) } ) ;
708712 }
709713 }
710714
@@ -717,7 +721,7 @@ macro_rules! dma_stream {
717721 //NOTE(unsafe) Atomic read with no side effects
718722 let dma = unsafe { & * I :: ptr( ) } ;
719723 BitFlags :: from_bits_truncate(
720- ( ( dma. $isr. read( ) . bits( ) >> $isr_shift) )
724+ ( ( dma. $isr( ) . read( ) . bits( ) >> $isr_shift) )
721725 )
722726 }
723727 }
0 commit comments