DRV_SST39_PageWrite Function
C
bool DRV_SST39_PageWrite( const DRV_HANDLE handle, void *tx_data, uint32_t address )
Summary
Writes one page of data starting at the specified address.
Description
This function schedules a blocking write operation for writing maximum one page of data into flash memory.
Preconditions
The DRV_SST39_Open() routine must have been called for the specified SST39 driver instance.
The flash address location which has to be written, must have been erased before using the SST39_xxxErase() routine.
The flash address has to be a Page aligned address.
Parameters
Param | Description |
---|---|
handle | A valid open-instance handle, returned from the driver's open routine |
tx_data | The source buffer containing data to be programmed into SST39 Flash |
address | Write memory start address from where the data should be written |
Returns
true
If the write request is successfully sent to the flash
false
If Write enable fails before sending sector erase command to flash
If write command itself fails
Example
#define PAGE_SIZE 256 #define BUFFER_SIZE 1024 #define MEM_ADDRESS 0x0 DRV_HANDLE handle; uint8_t CACHE_ALIGN writeBuffer[BUFFER_SIZE]; bool status = false; if(false == DRV_SST39_SectorErase(handle)) { printf("Error handling here"); } for (uint32_t j = 0; j < BUFFER_SIZE; j += PAGE_SIZE) { if (DRV_SST39_PageWrite(handle, (void *)&writeBuffer[j], (MEM_ADDRESS + j)) == false) { status = false; break; } status = true; } if(status == false) { printf("Error handling here"); }
Remarks
None.