English
Language : 

SH7262 Datasheet, PDF (37/45 Pages) Renesas Technology Corp – High-speed Read/Write Serial Flash Memory
SH7262/SH7264 Group
High-speed Read/Write Serial Flash Memory
Using the Renesas Serial Peripheral Interface
3.19 Sample Program Listing "serial_flash.c" (16/19)
638
/* ---- MISO (read data) ---- */
639
RSPI0.SPCMD0.BIT.CPOL= 0;
/* RSPCK when idling is 0 */
640
RSPI0.SPCMD0.BIT.CPHA= 1;
/* Latches data on even (falling) edge */
641
642
RSPI0.SPBFCR.BYTE = 0xC0u;
/* Resets buffer */
643
RSPI0.SPBFCR.BYTE = 0x00u;
644
645
RSPI0.SPDCR.BIT.SPLW = 3;
/* Access width to the SPDR register: 32-bit */
646
RSPI0.SPCMD0.BIT.SPB = 3;
/* Transfer data length: 32-bit */
647
648
RSPI0.SPDCR.BIT.TXDMY = 1;
/* Enables to transmit the dummy data */
649
rd_sz >>= 2;
/* Calculates the number of transfers in longword */
650
while( rd_sz-- ){
651
while( RSPI0.SPSR.BIT.SPRF == 0){
652
/* wait */
653
}
654
*rd++ = RSPI0.SPDR.LONG;
655
}
656
RSPI0.SPDCR.BIT.TXDMY = 0;
/* Disables to transmit the dummy data */
657
io_wait_tx_end();
/* Waits for transfer end */
658
659
/* ==== Restores the SPI to default setting ==== */
660
RSPI0.SPCR.BIT.SPE = 0;
661
RSPI0.SPDCR.BIT.SPLW = 1;
/* Access width to the SPDR register: 8-bit */
662
RSPI0.SPCMD0.BIT.SPB = 7;
/* Transfer data length: 8-bit */
663 }
664 #ifdef SF_USE_DMAC
REJ06B0889-0100/Rev.1.00
June 2009
Page 37 of 45