A board support package for the LPC4088 Display Module.
Dependencies: DM_HttpServer DM_USBHost
Dependents: lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more
Fork of DMSupport by
SPIFI Class Reference
#include <SPIFI.h>
Public Member Functions | |
SpifiError | init () |
Initializes the SPIFI ROM driver making the content of the external serial flash available. | |
Device | device () |
Returns the detected external serial flash. | |
uint32_t | memorySize () |
Returns the size (in bytes) of the external serial flash. | |
uint32_t | eraseBlockSize () |
Returns the size of an erase block (in bytes) on the external serial flash. | |
uint32_t | getVerificationErrorAddr () |
Returns the address where the verifcation failed. | |
void | internalData (SPIFIobj **initData, const SPIFI_RTNS **romPtr) |
Used by the QSPIFileSystem class to get access to all spifi internal data. | |
SpifiError | program (uint32_t dest, unsigned len, char *src, Options options, bool verify=false, char *scratch=NULL) |
Copies len data from src to dest. | |
SpifiError | erase (uint32_t dest, unsigned len, bool verify=false, char *scratch=NULL) |
Erases the content of the memory at the specified address. |
Detailed Description
SPIFI Example.
#include "mbed.h" #include "SPIFI.h" int main(void) { SPIFI::SpifiError err; err = SPIFI::instance().init(); if (err != SPIFI::Ok) { printf("Failed to initialize SPIFI, error %d\n", err); } // Write "Hello World!" into the first bytes of the SPIFI char buff[20] = "Hello World!"; err = SPIFI::instance().program(0, strlen(buff)+1, buff, SPIFI::EraseAsRequired); if (err != SPIFI::Ok) { printf("Failed to write to SPIFI, error %d\n", err); } // Now verify that it can be read if (memcmp((char*)SPIFI::SpifiMemBase, buff, strlen(buff)+1) == 0) { printf("Readback from memory OK: '%s'\n", SPIFI::SpifiMemBase); } else { printf("Spifi does not contain the correct data!\n"); } }
Definition at line 54 of file SPIFI.h.
Member Function Documentation
Device device | ( | ) |
SPIFI::SpifiError erase | ( | uint32_t | dest, |
unsigned | len, | ||
bool | verify = false , |
||
char * | scratch = NULL |
||
) |
Erases the content of the memory at the specified address.
Scratch should be NULL or the address of an area of RAM that the SPIFI driver can use to save data during erase operations. If provided, the scratch area should be as large as the smallest erase size that is available throughout the serial flash device. If scratch is NULL (zero) and an erase is necessary, any bytes in the first erase block before dest are left in erased state (all ones), as are any bytes in the last erase block after dest + len
- Parameters:
-
dest Address to start erasing at, highest byte must be 0x00 or 0x28 as in 0x28000000 len Number of bytes to erase verify Should the erased area be verified to make sure it is all 0xff scratch Used to preserve content of flash outside of erased area. Size of buffer must be at least the size of one erase block.
- Returns:
- Ok on success An error code on failure
uint32_t eraseBlockSize | ( | ) |
uint32_t getVerificationErrorAddr | ( | ) |
SPIFI::SpifiError init | ( | ) |
void internalData | ( | SPIFIobj ** | initData, |
const SPIFI_RTNS ** | romPtr | ||
) |
Used by the QSPIFileSystem class to get access to all spifi internal data.
- Parameters:
-
initData The parameter returned by spifi_init romPtr The location of the SPIFI ROM driver in memory
uint32_t memorySize | ( | ) |
SPIFI::SpifiError program | ( | uint32_t | dest, |
unsigned | len, | ||
char * | src, | ||
Options | options, | ||
bool | verify = false , |
||
char * | scratch = NULL |
||
) |
Copies len data from src to dest.
This function will split len > 256 into writes of 256 bytes each.
Programming means that a bit can either be left at 0, or programmed from 1 to 0. Changing bits from 0 to 1 requires an erase operation. While bits can be individually programmed from 1 to 0, erasing bits from 0 to 1 must be done in larger chunks (manufacturer dependant but typically 4Kbyte to 64KByte at a time).
Specify how/when erasing is done with the options parameter:
- ForceErase causes len bytes to be erased starting at dest. If a scratch buffer (must be the size of an erase block) is provided then only the len bytes will be erased. If no scratch buffer is provided then the erase block surrounding dest will be erased.
- EraseAsRequired tests if the destination can be written to without erasing. If it can then no erasing is done. If it can't then behaviour is the same as if ForceErase was specified.
- CallerErase tests if the destination can be written to without erasing. If it can then a data is written. If it can't then an error code is returned and nothing is written.
Scratch should be NULL or the address of an area of RAM that the SPIFI driver can use to save data during erase operations. If provided, the scratch area should be as large as the smallest erase size that is available throughout the serial flash device. If scratch is NULL (zero) and an erase is necessary, any bytes in the first erase block before dest are left in erased state (all ones), as are any bytes in the last erase block after dest + len
- Parameters:
-
dest Address to write to, highest byte must be 0x00 or 0x28 as in 0x28000000 len Number of bytes to write src Data to write options How to handle content of destination verify Should all writes be verified or not scratch Used with ForceErase and EraseAsRequired option to preserve content of flash outside of written area. Size of buffer must be at least the size of one erase block.
- Returns:
- Ok on success An error code on failure
Generated on Tue Jul 12 2022 14:18:31 by 1.7.2