| Summary | |
#include <file_config.h>
int fs_spi_ReadData (
U32 adr, /* data starting address */
U32 size, /* size of the data page */
U8 *buf); /* working buffer to copy data to */
|
| Description | | The fs_spi_ReadData is a user-provided routine that reads the contents of SPI Data Flash memory starting at address adr into the buffer buf for size bytes. The fs_spi_ReadData function is part of RL-FlashFS. The prototype is defined in file_config.h. You can customize the function in fs_spi_flashprg.c. |
| Return Value | | The fs_spi_ReadData function returns a value of 0 if successful or a value of 1 if unsuccessful. |
| See Also | | finit, fs_spi_EraseSector, fs_spi_Init, fs_spi_ProgramPage |
| Example | |
int fs_spi_ReadData (U32 adr, U32 sz, U8 *buf) {
/* Read Data */
spi_ss (0);
spi_send (SPI_READ_DATA);
spi_send ((U8)(adr >> 16));
spi_send ((U8)(adr >> 8));
spi_send ((U8)(adr >> 0));
while (sz--) {
*buf++ = spi_send (0xFF);
}
spi_ss (1);
return (0);
}
|