Defines | |
#define | FLASH_CHIP_BASE 0x00000000 |
Base address of the flash memory chip. | |
#define | FLASH_CONF_SECTOR 0x00078000 |
Address offset of the configuration sector. | |
#define | FLASH_CONF_SIZE 256 |
Size of the configuration area. | |
#define | IAP_Call iap_entry |
Typedefs | |
typedef void(* | IAP )(uint32_t *cmd, uint32_t *result) |
typedef uint32_t | flashdat_t |
typedef unsigned long | flashadr_t |
typedef volatile flashdat_t * | flashptr_t |
Functions | |
uint32_t | Lpc17xxIapGetSectorNr (uint32_t addr) |
Get Sector Number. | |
IAP_STATUS_CODE | Lpc17xxIapSectorRead (uint32_t addr, void *data, size_t len) |
Read data from flash memory. | |
IAP_STATUS_CODE | Lpc17xxIapSectorWrite (uint32_t dest, void *source, IAP_WRITE_SIZE size) |
Write data to flash. | |
IAP_STATUS_CODE | Lpc17xxIapSectorErase (uint32_t start_sec, uint32_t end_sec) |
Erase sector(s) | |
IAP_STATUS_CODE | Lpc17xxIapSectorBlankCheck (uint32_t start_sec, uint32_t end_sec, uint32_t *first_nblank_off, uint32_t *first_nblank_val) |
Blank check sector(s) | |
IAP_STATUS_CODE | Lpc17xxIapReadBootCodeVersion (uint8_t *major, uint8_t *minor) |
Read boot code version. The version is interpreted as <major>.<minor>. | |
IAP_STATUS_CODE | Lpc17xxIapReadDeviceSerialNumber (uint32_t *uid) |
Read Device serial number. | |
int | Lpc17xxIapParamRead (unsigned int pos, void *data, size_t len) |
Load configuration parameters from embedded flash memory. | |
int | Lpc17xxIapParamWrite (unsigned int pos, const void *data, size_t len) |
Store configuration parameters in embedded flash memory. | |
Variables | |
IAP | iap_entry = (IAP) IAP_LOCATION |
#define FLASH_CHIP_BASE 0x00000000 |
Base address of the flash memory chip.
Referenced by Lpc17xxIapSectorRead(), and ShowHardwareConfiguration().
#define FLASH_CONF_SECTOR 0x00078000 |
Address offset of the configuration sector.
Referenced by Lpc17xxIapParamRead(), and Lpc17xxIapParamWrite().
#define FLASH_CONF_SIZE 256 |
Size of the configuration area.
During write operations a buffer with this size is allocated from heap and may cause memory problems with large sectors. Thus, this value may be less than the size of the configuration sector, in which case the rest of the sector is unused.
Currently only 1 sector can be used for system configurations.
Referenced by Lpc17xxIapParamWrite().
#define IAP_Call iap_entry |
typedef uint32_t flashdat_t |
typedef unsigned long flashadr_t |
typedef volatile flashdat_t* flashptr_t |
Get Sector Number.
IAP API.
addr | Sector address |
Referenced by Lpc17xxIapSectorWrite().
IAP_STATUS_CODE Lpc17xxIapSectorRead | ( | uint32_t | addr, |
void * | data, | ||
size_t | len | ||
) |
Read data from flash memory.
addr | Start location within the chip, starting at 0. |
data | Points to a buffer that receives the data. |
len | Number of bytes to read. |
References CMD_SUCCESS, DST_ADDR_ERROR, FLASH_CHIP_BASE, memcpy(), and NULL.
Referenced by Lpc17xxIapParamRead(), and Lpc17xxIapParamWrite().
IAP_STATUS_CODE Lpc17xxIapSectorWrite | ( | uint32_t | dest, |
void * | source, | ||
IAP_WRITE_SIZE | size | ||
) |
Write data to flash.
dest | destination buffer (in Flash memory) (must be 256 byte aligned). |
source | source buffer (in RAM) (should be word aligned) |
size | the write size. |
References IAP_COMMAND_Type::cmd, CMD_SUCCESS, IAP_Call, IAP_COPY_RAM2FLASH, Lpc17xxIapGetSectorNr(), NUT_HWCLK_CPU, NutArchClockGet(), IAP_COMMAND_Type::param, and IAP_COMMAND_Type::status.
Referenced by Lpc17xxIapParamWrite().
IAP_STATUS_CODE Lpc17xxIapSectorErase | ( | uint32_t | start_sec, |
uint32_t | end_sec | ||
) |
Erase sector(s)
start_sec | Number of start sector |
end_sec | Number of end sector |
References IAP_COMMAND_Type::cmd, CMD_SUCCESS, IAP_Call, IAP_ERASE, NUT_HWCLK_CPU, NutArchClockGet(), IAP_COMMAND_Type::param, and IAP_COMMAND_Type::status.
IAP_STATUS_CODE Lpc17xxIapSectorBlankCheck | ( | uint32_t | start_sec, |
uint32_t | end_sec, | ||
uint32_t * | first_nblank_off, | ||
uint32_t * | first_nblank_val | ||
) |
Blank check sector(s)
start_sec | Number of start sector |
end | _sec Number of end sector |
first_nblank_off | The offset of the first non-blank word |
first_nblank_val | The value of the first non-blank word |
References IAP_COMMAND_Type::cmd, IAP_BLANK_CHECK, IAP_Call, NULL, IAP_COMMAND_Type::param, IAP_COMMAND_Type::result, SECTOR_NOT_BLANK, and IAP_COMMAND_Type::status.
IAP_STATUS_CODE Lpc17xxIapReadBootCodeVersion | ( | uint8_t * | major, |
uint8_t * | minor | ||
) |
Read boot code version. The version is interpreted as <major>.<minor>.
major | Returns major version number |
minor | Returns minor version number |
References IAP_COMMAND_Type::cmd, CMD_SUCCESS, IAP_Call, IAP_READ_BOOT_VER, NULL, IAP_COMMAND_Type::result, and IAP_COMMAND_Type::status.
IAP_STATUS_CODE Lpc17xxIapReadDeviceSerialNumber | ( | uint32_t * | uid | ) |
Read Device serial number.
uid | Serial number |
References IAP_COMMAND_Type::cmd, CMD_SUCCESS, IAP_Call, IAP_READ_SERIAL_NUMBER, NULL, IAP_COMMAND_Type::result, and IAP_COMMAND_Type::status.
int Lpc17xxIapParamRead | ( | unsigned int | pos, |
void * | data, | ||
size_t | len | ||
) |
Load configuration parameters from embedded flash memory.
Applications should call NutNvMemLoad().
pos | Start location within configuration sector. |
data | Points to a buffer that receives the contents. |
len | Number of bytes to read. |
References FLASH_CONF_SECTOR, and Lpc17xxIapSectorRead().
Referenced by NutNvMemLoad().
int Lpc17xxIapParamWrite | ( | unsigned int | pos, |
const void * | data, | ||
size_t | len | ||
) |
Store configuration parameters in embedded flash memory.
Applications should call NutNvMemSave().
pos | Start location within configuration sector. |
data | Points to a buffer that contains the bytes to store. |
len | Number of bytes to store. |
References CMD_SUCCESS, FLASH_CONF_SECTOR, FLASH_CONF_SIZE, free(), Lpc17xxIapSectorRead(), Lpc17xxIapSectorWrite(), malloc(), memcmp(), memcpy(), NULL, and rc.
Referenced by NutNvMemSave().