@@ -460,6 +460,9 @@ mod common {
460
460
w. dcyc( ) . bits( dummy_cycles) . instruction( ) . bits( ir) . fmode( ) . bits( fmode)
461
461
} ;
462
462
463
+ #[ cfg( any( feature = "rm0455" , feature = "rm0468" ) ) ]
464
+ let w = w. isize ( ) . bits( instruction. size( ) ) ;
465
+
463
466
w. imode( )
464
467
. bits( imode)
465
468
. admode( )
@@ -479,6 +482,25 @@ mod common {
479
482
self . rb. tcr. write( |w| unsafe { w. dcyc( ) . bits( dummy_cycles) } ) ;
480
483
self . rb. cr. modify( |_, w| unsafe { w. fmode( ) . bits( fmode) } ) ;
481
484
}
485
+
486
+ // Write alternate-bytes
487
+ self . rb. abr. write( |w| unsafe {
488
+ w. alternate( ) . bits( alternate_bytes. bits( ) )
489
+ } ) ;
490
+
491
+ #[ cfg( any( feature = "rm0455" , feature = "rm0468" ) ) ]
492
+ if instruction != XspiWord :: None {
493
+ self . rb. ir. write( |w| unsafe {
494
+ w. instruction( ) . bits( instruction. bits( ) )
495
+ } ) ;
496
+ }
497
+
498
+ if address != XspiWord :: None {
499
+ // Write the address. The transaction starts on the next write
500
+ // to DATA, unless there is no DATA phase configured, in which
501
+ // case it starts here.
502
+ self . rb. ar. write( |w| unsafe { w. address( ) . bits( address. bits( ) ) } ) ;
503
+ }
482
504
}
483
505
484
506
/// Begin a write over the XSPI interface. This is mostly useful for use with
@@ -596,33 +618,9 @@ mod common {
596
618
597
619
// Setup extended mode. Typically no dummy cycles in write mode
598
620
self . setup_extended( instruction, address, alternate_bytes, 0 , !data. is_empty( ) , false ) ;
599
- // Write alternate-bytes
600
- self . rb. abr. write( |w| unsafe {
601
- w. alternate( ) . bits( alternate_bytes. bits( ) )
602
- } ) ;
603
-
604
- if instruction != XspiWord :: None {
605
- // Write instruction. If there is no address or data phase, the
606
- // transaction starts here.
607
- #[ cfg( any( feature = "rm0433" , feature = "rm0399" ) ) ]
608
- {
609
- let ir = instruction. bits_u8( ) ?;
610
- self . rb. ccr. modify( |_, w| unsafe { w. instruction( ) . bits( ir) } ) ;
611
- }
612
- #[ cfg( any( feature = "rm0455" , feature = "rm0468" ) ) ]
613
- self . rb. ir. write( |w| unsafe {
614
- w. instruction( ) . bits( instruction. bits( ) )
615
- } ) ;
616
- }
617
-
618
- if address != XspiWord :: None {
619
- // Write the address. The transaction starts on the next write
620
- // to DATA, unless there is no DATA phase configured, in which
621
- // case it starts here.
622
- self . rb. ar. write( |w| unsafe { w. address( ) . bits( address. bits( ) ) } ) ;
623
- }
624
621
625
622
// Write data to the FIFO in a byte-wise manner.
623
+ // Transaction starts here
626
624
unsafe {
627
625
for byte in data {
628
626
ptr:: write_volatile( & self . rb. dr as * const _ as * mut u8 , * byte) ;
@@ -765,37 +763,11 @@ mod common {
765
763
. dlr
766
764
. write( |w| unsafe { w. dl( ) . bits( dest. len( ) as u32 - 1 ) } ) ;
767
765
768
- // Setup extended mode. Read operations always have a data phase. if there is no
769
- // address, this will start the transaction
766
+ // Setup extended mode. Read operations always have a data phase.
767
+ // Transaction starts here
770
768
self . setup_extended( instruction, address, alternate_bytes,
771
769
dummy_cycles, true , true ) ;
772
770
773
- // Write alternate-bytes
774
- self . rb. abr. write( |w| unsafe {
775
- w. alternate( ) . bits( alternate_bytes. bits( ) )
776
- } ) ;
777
-
778
- /*
779
- * p894
780
- *
781
- * If neither the address register (QUADSPI_AR) nor the data register (QUADSPI_DR)
782
- * need to be updated for a particular command, then the command sequence starts as
783
- * soon as QUADSPI_CCR is written. This is the case when both ADMODE and DMODE are
784
- * 00, or if just ADMODE = 00 when in indirect read mode (FMODE = 01).
785
- *
786
- * When an address is required (ADMODE is not 00) and the data register does not
787
- * need to be written (when FMODE = 01 or DMODE = 00), the command sequence starts
788
- * as soon as the address is updated with a write to QUADSPI_AR.
789
- *
790
- * In case of data transmission (FMODE = 00 and DMODE! = 00), the communication
791
- * start is triggered by a write in the FIFO through QUADSPI_DR.
792
- */
793
-
794
- // Write the address if there is one, transaction starts here
795
- if address != XspiWord :: None {
796
- self . rb. ar. write( |w| unsafe { w. address( ) . bits( address. bits( ) ) } ) ;
797
- }
798
-
799
771
// Wait for the transaction to complete
800
772
while self . rb. sr. read( ) . tcf( ) . bit_is_clear( ) { }
801
773
0 commit comments