English
Language : 

SH7262 Datasheet, PDF (23/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.5
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
Sample Program Listing "serial_flash.c" (2/19)
/* ==== Macro definition ==== */
#define SFLASHCMD_CHIP_ERASE 0xc7
#define SFLASHCMD_SECTOR_ERASE 0xd8
#define SFLASHCMD_BYTE_PROGRAM 0x02
#define SFLASHCMD_BYTE_READ
0x0B
#define SFLASHCMD_BYTE_READ_LOW 0x03
#define SFLASHCMD_WRITE_ENABLE 0x06
#define SFLASHCMD_WRITE_DISABLE 0x04
#define SFLASHCMD_READ_STATUS 0x05
#define SFLASHCMD_WRITE_STATUS 0x01
#define UNPROTECT_WR_STATUS
0x00
#define PROTECT_WR_STATUS
0x3C
#define SF_USE_DMAC
/* Define this macro when using the function
(sf_byte_read_long)in the DMA transfer */
/* ==== Function prototype declaration ==== */
/*** Local function ***/
static void write_enable(void);
static void write_disable(void);
static void busy_wait(void);
static unsigned char read_status(void);
static void write_status(unsigned char status);
static void io_init_rspi(void);
static void io_cmd_exe(unsigned char *ope, int ope_sz, unsigned char *data, int data_sz);
static void io_cmd_exe_rdmode(unsigned char *ope, int ope_sz, unsigned char *rd, int rd_sz);
static void io_cmd_exe_rdmode_cpu_l(unsigned char *ope, int ope_sz, unsigned long *rd, int rd_sz);
static void io_cmd_exe_rdmode_dma_l(unsigned char *ope, int ope_sz, unsigned long *rd, int rd_sz);
static void io_wait_tx_end(void);
/* ==== Variable definition ==== */
/*""FUNC COMMENT""**************************************************************
* ID
:
* Outline
: Serial flash memory initialization
*------------------------------------------------------------------------------
* Include
:
*------------------------------------------------------------------------------
* Declaration : void sf_init_serial_flash(void);
*------------------------------------------------------------------------------
* Description : Initializes serial flash memory for being accessed.
*
: Initializes channel 0 of the Renesas Serial Peripheral
*
: Interface (RSPI).
*------------------------------------------------------------------------------
* Argument
: void
*------------------------------------------------------------------------------
* Return Value : void
*------------------------------------------------------------------------------
* Note
: None
*""FUNC COMMENT END""**********************************************************/
REJ06B0889-0100/Rev.1.00
June 2009
Page 23 of 45