|
rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
|
Functions | |
| int | rflpc_iap_get_serial_number (unsigned long result[4]) |
| Gets the flash serial number. More... | |
| void * | rflpc_iap_get_address_from_sector (int sector) |
| Flash memory sector-address mapping. More... | |
| int | rflpc_iap_get_sector_from_address (const void *address) |
| Flash memory address-sector mapping. More... | |
| int | rflpc_iap_prepare_sectors_for_writing (int start_sector, int end_sector) |
| Prepare sectors for a writing operation (write/erase). More... | |
| int | rflpc_iap_erase_sectors (int start_sector, int end_sector) |
| Erase Flash sectors. More... | |
| int | rflpc_iap_copy_ram_to_flash (const void *destination, const void *source, int length) |
| Copy RAM to Flash. More... | |
| int | rflpc_iap_write_buffer_to_sector (const void *buffer, int sector_number) |
| Copy a 4k buffer to Flash. More... | |
| int | rflpc_iap_write_to_sector (const void *destination, const void *buffer, int length) |
| Copy a buffer <= 4K to Flash. More... | |
| int | rflpc_iap_write_buffer (const void *destination, const void *buffer, int length) |
| Copy a buffer to Flash. More... | |
| int | rflpc_iap_transfert_4ks_to_32k (const void *destination32k, const void *source4ks, int length) |
| Transfer memory from the 4k sectors to one 32k sector. More... | |
| int rflpc_iap_copy_ram_to_flash | ( | const void * | destination, |
| const void * | source, | ||
| int | length | ||
| ) |
Copy RAM to Flash.
After preparing the sectors, call this function to write RAM contents to flash
| [out] | destination | destination Flash address where bytes are to be written. Should be a 256 bytes boundary. |
| [in] | source | source RAM address from which bytes are to be read. Should be a word boundary. |
| [in] | length | the number of bytes to be written. Should be 256 | 512 | 1024 | 4096. |
| int rflpc_iap_erase_sectors | ( | int | start_sector, |
| int | end_sector | ||
| ) |
Erase Flash sectors.
After preparing the sectors, call this function to erase Flash sectors contents.
| void* rflpc_iap_get_address_from_sector | ( | int | sector | ) |
Flash memory sector-address mapping.
Use this function when an address is needed for a given sector.
| [in] | sector | a sector identifier |
| int rflpc_iap_get_sector_from_address | ( | const void * | address | ) |
Flash memory address-sector mapping.
For a given address, returns the sector it belongs to.
| [in] | address |
| int rflpc_iap_get_serial_number | ( | unsigned long | result[4] | ) |
Gets the flash serial number.
This can be used to uniquely identify the LPC17xx running the program.
| [out] | result | the serial number as four 32 bits word |
| int rflpc_iap_prepare_sectors_for_writing | ( | int | start_sector, |
| int | end_sector | ||
| ) |
Prepare sectors for a writing operation (write/erase).
Needed to unprotect the sectors for the writing operation.
| [in] | start_sector | a valid sector to start with. |
| [in] | end_sector | should be greater than or equal to start_sector. |
| int rflpc_iap_transfert_4ks_to_32k | ( | const void * | destination32k, |
| const void * | source4ks, | ||
| int | length | ||
| ) |
Transfer memory from the 4k sectors to one 32k sector.
| [in] | destination32k | |
| [in] | source4ks | memory lying into 4ks sectors. |
| [in] | length | length of the destination <= 32k. |
| int rflpc_iap_write_buffer | ( | const void * | destination, |
| const void * | buffer, | ||
| int | length | ||
| ) |
Copy a buffer to Flash.
This function handles multiple sectors overlap.
| [in] | destination | |
| [in] | buffer | a buffer. |
| [in] | length |
| int rflpc_iap_write_buffer_to_sector | ( | const void * | buffer, |
| int | sector_number | ||
| ) |
Copy a 4k buffer to Flash.
| [in] | buffer | a 4K buffer. |
| [in] | sector_number | see nxp user's manual. |
| int rflpc_iap_write_to_sector | ( | const void * | destination, |
| const void * | buffer, | ||
| int | length | ||
| ) |
Copy a buffer <= 4K to Flash.
If the buffer is over multiple sectors the function returns -1.
| [in] | destination | |
| [in] | buffer | a buffer less than or equal to 4K, inside the same sector. |
| [in] | length | length of the buffer (<= 4k). |