test
Fork of nrf51-sdk by
Flash Manager
Module for accessing flash memory. More...
Functions | |
uint32_t | ble_flash_page_write (uint8_t page_num, uint32_t *p_in_array, uint8_t word_count) |
Function for erasing the specified flash page, and then writes the given data to this page. | |
uint32_t | ble_flash_page_read (uint8_t page_num, uint32_t *p_out_array, uint8_t *p_word_count) |
Function for reading data from flash to RAM. | |
uint32_t | ble_flash_page_erase (uint8_t page_num) |
Function for erasing a flash page. | |
uint32_t | ble_flash_word_write (uint32_t *p_address, uint32_t value) |
Function for writing one word to flash. | |
uint32_t | ble_flash_block_write (uint32_t *p_address, uint32_t *p_in_array, uint16_t word_count) |
Function for writing a data block to flash. | |
uint32_t | ble_flash_page_addr (uint8_t page_num, uint32_t **pp_page_addr) |
Function for computing pointer to start of specified flash page. | |
uint16_t | ble_flash_crc16_compute (uint8_t *p_data, uint16_t size, uint16_t *p_crc) |
Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme. | |
void | ble_flash_on_radio_active_evt (bool radio_active) |
Function for handling flashing module Radio Notification event. |
Detailed Description
Module for accessing flash memory.
It contains functions for reading, writing and erasing one page in flash.
The module uses the first 32 bits of the flash page to write a magic number in order to determine if the page has been written or not.
- Note:
- Be careful not to use a page number in the SoftDevice area (which currently occupies the range 0 to 127), or in your application space! In both cases, this would end up with a hard fault.
Function Documentation
uint32_t ble_flash_block_write | ( | uint32_t * | p_address, |
uint32_t * | p_in_array, | ||
uint16_t | word_count | ||
) |
Function for writing a data block to flash.
- Note:
- Flash locations to be written must have been erased previously.
- Parameters:
-
[in] p_address Pointer to start of flash location to be written. [in] p_in_array Pointer to start of flash block to be written. [in] word_count Number of words to be written.
- Returns:
- NRF_SUCCESS.
Definition at line 173 of file ble_flash.c.
uint16_t ble_flash_crc16_compute | ( | uint8_t * | p_data, |
uint16_t | size, | ||
uint16_t * | p_crc | ||
) |
Function for calculating a 16 bit CRC using the CRC-16-CCITT scheme.
- Parameters:
-
[in] p_data Pointer to data on which the CRC is to be calulated. [in] size Number of bytes on which the CRC is to be calulated. [in] p_crc Initial CRC value (if NULL, a preset value is used as the initial value).
- Returns:
- Calculated CRC.
Definition at line 47 of file ble_flash.c.
void ble_flash_on_radio_active_evt | ( | bool | radio_active ) |
Function for handling flashing module Radio Notification event.
- Note:
- For flash writing to work safely while in a connection or while advertising, this function MUST be called from the Radio Notification module's event handler (see Radio Notification Event Handler for details).
- Parameters:
-
[in] radio_active TRUE if radio is active (or about to become active), FALSE otherwise.
Definition at line 303 of file ble_flash.c.
uint32_t ble_flash_page_addr | ( | uint8_t | page_num, |
uint32_t ** | pp_page_addr | ||
) |
Function for computing pointer to start of specified flash page.
- Parameters:
-
[in] page_num Page number. [out] pp_page_addr Pointer to start of flash page.
- Returns:
- NRF_SUCCESS.
Definition at line 296 of file ble_flash.c.
uint32_t ble_flash_page_erase | ( | uint8_t | page_num ) |
Function for erasing a flash page.
- Note:
- This operation blocks the CPU, so it should not be done while the radio is running!
- Parameters:
-
[in] page_num Page number to erase.
- Returns:
- NRF_SUCCESS on success, an error_code otherwise.
Definition at line 187 of file ble_flash.c.
uint32_t ble_flash_page_read | ( | uint8_t | page_num, |
uint32_t * | p_out_array, | ||
uint8_t * | p_word_count | ||
) |
Function for reading data from flash to RAM.
- Parameters:
-
[in] page_num Page number to read. [out] p_out_array Pointer to a RAM area where the found data will be written. This area has to be 32 bits aligned. [out] p_word_count Number of 32 bits words read.
- Returns:
- NRF_SUCCESS on successful upload, NRF_ERROR_NOT_FOUND if no valid data has been found in flash (first 32 bits not equal to the MAGIC_NUMBER+CRC).
Definition at line 250 of file ble_flash.c.
uint32_t ble_flash_page_write | ( | uint8_t | page_num, |
uint32_t * | p_in_array, | ||
uint8_t | word_count | ||
) |
Function for erasing the specified flash page, and then writes the given data to this page.
- Warning:
- This operation blocks the CPU. DO NOT use while in a connection!
- Parameters:
-
[in] page_num Page number to update. [in] p_in_array Pointer to a RAM area containing the elements to write in flash. This area has to be 32 bits aligned. [in] word_count Number of 32 bits words to write in flash.
- Returns:
- NRF_SUCCESS on successful flash write, otherwise an error code.
Definition at line 196 of file ble_flash.c.
uint32_t ble_flash_word_write | ( | uint32_t * | p_address, |
uint32_t | value | ||
) |
Function for writing one word to flash.
- Note:
- Flash location to be written must have been erased previously.
- Parameters:
-
[in] p_address Pointer to flash location to be written. [in] value Value to write to flash.
- Returns:
- NRF_SUCCESS.
Definition at line 166 of file ble_flash.c.
Generated on Tue Jul 12 2022 15:51:32 by 1.7.2