Document Number: 002-00833 Rev. *L
Page 32 of 74
S29VS256R
S29VS128R
S29XS256R
S29XS128R
Software Functions and Sample Code
Notes:
1. Base = Base Address.
2. Last = Last cycle of write buffer program operation; depending on number of words written, the total number of cycles may be from 6 to 37.
3. For maximum efficiency, it is recommended that the write buffer be loaded with the highest number of words (N words) possible.
The following is a C source code example of using the write buffer program function. Refer to the
Cypress Low Level Driver User’s
Guide
(available on
) for general information on Cypress Flash memory software development guidelines.
/* Example: Write Buffer Programming Command */
/* NOTES: Write buffer programming limited to 32 words. */
/* All addresses to be written to the flash in */
/* one operation must be within the same flash */
/* page. A flash page begins at addresses
*/
/* evenly divisible by 0x20. */
UINT16 *src = source_of_data;
/* address of source data */
UINT16 *dst = destination_of_data; /* flash destination address
*/
UINT16 wc = words_to_program -1; /* word count (minus 1) */
*( (UINT16 *)sector_a 0x555 ) = 0x0025; /* write write buffer load command */
*( (UINT16 *)sector_a 0x2AA) = wc;
/* write word count (minus 1) */
do{
*dst = *src; /* ALL dst MUST BE SAME PAGE */ /* write source data to destination */
dst++; /* increment destination pointer */
src++; /* increment source pointer */
wc--; /* decrement word count */
}while ( wc >= 0 ); /* do it again */
*( (UINT16 *)sector_a 0x555) = 0x0029; /* write confirm command */
/* poll for completion */
Table 30. Write Buffer Program
Cycle
Description
Operation
Byte Address
Word Address
Data
1
Write Buffer Load Command
Write
Sector A AAAh
Sector A 555h
0025h
2
Write Word Count
Write
Sector A 555h
Sector A 2AA
Word Count (N–1)h
Number of words (N) loaded into the write buffer can be from 1 to 32 words.
3 to 34
Load Buffer Word N
Write
Program Address, Word N
Word N
Last
Write Buffer to Flash
Write
Sector A AAAh
Sector A 555h
0029h