@@ -383,12 +383,12 @@ impl<DMA: Instance, const S: u8> StreamX<DMA, S> {
383
383
#[ cfg( not( any( feature = "gpio-f411" , feature = "gpio-f413" , feature = "gpio-f410" ) ) ) ]
384
384
#[ inline( always) ]
385
385
unsafe fn st ( ) -> & ' static pac:: dma2:: ST {
386
- & ( * DMA :: ptr ( ) ) . st [ S as usize ]
386
+ ( * DMA :: ptr ( ) ) . st ( S as usize )
387
387
}
388
388
#[ cfg( any( feature = "gpio-f411" , feature = "gpio-f413" , feature = "gpio-f410" ) ) ]
389
389
#[ inline( always) ]
390
390
unsafe fn st ( ) -> & ' static pac:: dma1:: ST {
391
- & ( * DMA :: ptr ( ) ) . st [ S as usize ]
391
+ ( * DMA :: ptr ( ) ) . st ( S as usize )
392
392
}
393
393
}
394
394
@@ -481,183 +481,187 @@ where
481
481
#[ inline( always) ]
482
482
fn set_peripheral_address ( & mut self , value : u32 ) {
483
483
unsafe { Self :: st ( ) }
484
- . par
484
+ . par ( )
485
485
. write ( |w| unsafe { w. pa ( ) . bits ( value) } ) ;
486
486
}
487
487
488
488
#[ inline( always) ]
489
489
fn set_memory_address ( & mut self , value : u32 ) {
490
490
unsafe { Self :: st ( ) }
491
- . m0ar
491
+ . m0ar ( )
492
492
. write ( |w| unsafe { w. m0a ( ) . bits ( value) } ) ;
493
493
}
494
494
495
495
#[ inline( always) ]
496
496
fn memory_address ( & self ) -> u32 {
497
- unsafe { Self :: st ( ) } . m0ar . read ( ) . m0a ( ) . bits ( )
497
+ unsafe { Self :: st ( ) } . m0ar ( ) . read ( ) . m0a ( ) . bits ( )
498
498
}
499
499
500
500
#[ inline( always) ]
501
501
fn set_alternate_memory_address ( & mut self , value : u32 ) {
502
502
unsafe { Self :: st ( ) }
503
- . m1ar
503
+ . m1ar ( )
504
504
. write ( |w| unsafe { w. m1a ( ) . bits ( value) } ) ;
505
505
}
506
506
507
507
#[ inline( always) ]
508
508
fn alternate_memory_address ( & self ) -> u32 {
509
- unsafe { Self :: st ( ) } . m1ar . read ( ) . m1a ( ) . bits ( )
509
+ unsafe { Self :: st ( ) } . m1ar ( ) . read ( ) . m1a ( ) . bits ( )
510
510
}
511
511
512
512
#[ inline( always) ]
513
513
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) ) ;
515
515
}
516
516
517
517
#[ inline( always) ]
518
518
fn number_of_transfers ( & self ) -> u16 {
519
- unsafe { Self :: st ( ) } . ndtr . read ( ) . ndt ( ) . bits ( )
519
+ unsafe { Self :: st ( ) } . ndtr ( ) . read ( ) . ndt ( ) . bits ( )
520
520
}
521
521
522
522
#[ inline( always) ]
523
523
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 ( ) ) ;
525
525
}
526
526
527
527
#[ inline( always) ]
528
528
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 ( )
530
530
}
531
531
532
532
#[ inline( always) ]
533
533
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 ( ) ) ;
535
535
}
536
536
537
537
#[ inline( always) ]
538
538
fn set_channel ( & mut self , channel : DmaChannel ) {
539
539
unsafe { Self :: st ( ) }
540
- . cr
541
- . modify ( |_, w| w. chsel ( ) . bits ( channel. bits ( ) ) ) ;
540
+ . cr ( )
541
+ . modify ( |_, w| w. chsel ( ) . set ( channel. bits ( ) ) ) ;
542
542
}
543
543
544
544
#[ inline( always) ]
545
545
fn set_priority ( & mut self , priority : config:: Priority ) {
546
546
unsafe { Self :: st ( ) }
547
- . cr
548
- . modify ( |_, w| w. pl ( ) . bits ( priority. bits ( ) ) ) ;
547
+ . cr ( )
548
+ . modify ( |_, w| w. pl ( ) . set ( priority. bits ( ) ) ) ;
549
549
}
550
550
551
551
#[ inline( always) ]
552
552
fn set_peripheral_increment_offset ( & mut self , value : PeripheralIncrementOffset ) {
553
553
unsafe { Self :: st ( ) }
554
- . cr
554
+ . cr ( )
555
555
. modify ( |_, w| w. pincos ( ) . bit ( value. bits ( ) ) ) ;
556
556
}
557
557
558
558
#[ inline( always) ]
559
559
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 ( ) ) ) ;
561
561
}
562
562
563
563
#[ inline( always) ]
564
564
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 ( ) ) ) ;
566
566
}
567
567
568
568
#[ inline( always) ]
569
569
fn set_memory_increment ( & mut self , increment : bool ) {
570
570
unsafe { Self :: st ( ) }
571
- . cr
571
+ . cr ( )
572
572
. modify ( |_, w| w. minc ( ) . bit ( increment) ) ;
573
573
}
574
574
575
575
#[ inline( always) ]
576
576
fn set_peripheral_increment ( & mut self , increment : bool ) {
577
577
unsafe { Self :: st ( ) }
578
- . cr
578
+ . cr ( )
579
579
. modify ( |_, w| w. pinc ( ) . bit ( increment) ) ;
580
580
}
581
581
582
582
#[ inline( always) ]
583
583
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) ) ;
585
587
}
586
588
587
589
#[ inline( always) ]
588
590
fn set_direction ( & mut self , direction : DmaDirection ) {
589
591
unsafe { Self :: st ( ) }
590
- . cr
592
+ . cr ( )
591
593
. modify ( |_, w| unsafe { w. dir ( ) . bits ( direction. bits ( ) ) } ) ;
592
594
}
593
595
594
596
#[ inline( always) ]
595
597
fn set_flow_controller ( & mut self , value : DmaFlowController ) {
596
598
unsafe { Self :: st ( ) }
597
- . cr
599
+ . cr ( )
598
600
. modify ( |_, w| w. pfctrl ( ) . bit ( value. bits ( ) ) ) ;
599
601
}
600
602
601
603
#[ inline( always) ]
602
604
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 ( ) )
604
606
}
605
607
606
608
#[ inline( always) ]
607
609
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 ( ) ) ;
609
613
}
610
614
611
615
#[ inline( always) ]
612
616
fn unlisten_fifo_error ( & mut self ) {
613
617
unsafe { Self :: st ( ) }
614
- . fcr
618
+ . fcr ( )
615
619
. modify ( |_, w| w. feie ( ) . clear_bit ( ) ) ;
616
620
}
617
621
618
622
#[ inline( always) ]
619
623
fn set_double_buffer ( & mut self , double_buffer : bool ) {
620
624
unsafe { Self :: st ( ) }
621
- . cr
625
+ . cr ( )
622
626
. modify ( |_, w| w. dbm ( ) . bit ( double_buffer) ) ;
623
627
}
624
628
625
629
#[ inline( always) ]
626
630
fn set_fifo_threshold ( & mut self , fifo_threshold : config:: FifoThreshold ) {
627
631
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 ( ) ) ) ;
630
634
}
631
635
632
636
#[ inline( always) ]
633
637
fn set_fifo_enable ( & mut self , fifo_enable : bool ) {
634
638
//Register is actually direct mode disable rather than fifo enable
635
639
unsafe { Self :: st ( ) }
636
- . fcr
640
+ . fcr ( )
637
641
. modify ( |_, w| w. dmdis ( ) . bit ( fifo_enable) ) ;
638
642
}
639
643
640
644
#[ inline( always) ]
641
645
fn set_memory_burst ( & mut self , memory_burst : config:: BurstMode ) {
642
646
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 ( ) ) ) ;
645
649
}
646
650
647
651
#[ inline( always) ]
648
652
fn set_peripheral_burst ( & mut self , peripheral_burst : config:: BurstMode ) {
649
653
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 ( ) ) ) ;
652
656
}
653
657
654
658
#[ inline( always) ]
655
659
fn fifo_level ( & self ) -> FifoLevel {
656
- unsafe { Self :: st ( ) } . fcr . read ( ) . fs ( ) . bits ( ) . into ( )
660
+ unsafe { Self :: st ( ) } . fcr ( ) . read ( ) . fs ( ) . bits ( ) . into ( )
657
661
}
658
662
659
663
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 ( ) {
661
665
CurrentBuffer :: SecondBuffer
662
666
} else {
663
667
CurrentBuffer :: FirstBuffer
@@ -675,7 +679,7 @@ where
675
679
enable : Option < BitFlags < DmaEvent > > ,
676
680
) {
677
681
unsafe {
678
- Self :: st ( ) . cr . modify ( |r, w| {
682
+ Self :: st ( ) . cr ( ) . modify ( |r, w| {
679
683
w. bits ( {
680
684
let mut bits = r. bits ( ) ;
681
685
if let Some ( d) = disable {
@@ -704,7 +708,7 @@ macro_rules! dma_stream {
704
708
#[ inline( always) ]
705
709
fn clear_flags( & mut self , flags: impl Into <BitFlags <DmaFlag >>) {
706
710
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) } ) ;
708
712
}
709
713
}
710
714
@@ -717,7 +721,7 @@ macro_rules! dma_stream {
717
721
//NOTE(unsafe) Atomic read with no side effects
718
722
let dma = unsafe { & * I :: ptr( ) } ;
719
723
BitFlags :: from_bits_truncate(
720
- ( ( dma. $isr. read( ) . bits( ) >> $isr_shift) )
724
+ ( ( dma. $isr( ) . read( ) . bits( ) >> $isr_shift) )
721
725
)
722
726
}
723
727
}
0 commit comments