English
Language : 

SH7262 Datasheet, PDF (20/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.2 Sample Program Listing "main.c" (2/3)
45 #include <stdio.h>
46 #include "serial_flash.h"
47
48 /* ==== Macro definition ==== */
49 #define TOP_ADDRESS 0
/* Start address of serial flash memory */
50
51 /* ==== Function prototype declaration ==== */
52 void main(void);
53
54 /* ==== Variable definition ==== */
55 #pragma section LARGE_ONCHIP_RAM
56 static unsigned char data[SF_SECTOR_SIZE];
57 static unsigned long rbuf[SF_SECTOR_SIZE/sizeof(long)];
58 #pragma section
59
60 /*""FUNC COMMENT""**************************************************************
61
* ID
:
62
* Outline
: Accessing serial flash memory main
63
*------------------------------------------------------------------------------
64
* Include
: "serial_flash.h"
65
*------------------------------------------------------------------------------
66
* Declaration : void main(void);
67
*------------------------------------------------------------------------------
68
* Description : Erases, programs, and reads serial flash memory.
69
*
: After initializing the RSPI channel 0, erases the entire memory
70
*
: array, and writes data from the start address. Reads the
71
*
: written data to compare to the provided data.
72
*------------------------------------------------------------------------------
73
* Argument
: void
74
*------------------------------------------------------------------------------
75
* Return Value : void
76
*------------------------------------------------------------------------------
77
* Note
: None
78
*""FUNC COMMENT END""**********************************************************/
79 void main(void)
80 {
81
int i, j;
82
unsigned char *p;
83
static unsigned long addr;
84
85
/* ==== Initializes the RSPI ==== */
86
sf_init_serial_flash();
87
88
/* ==== Unprotects serial flash memory ==== */
89
sf_protect_ctrl( SF_REQ_UNPROTECT );
90
REJ06B0889-0100/Rev.1.00
June 2009
Page 20 of 45