Nordic Semiconductor nRF5 AirFuel SDK  version 2.2.0
pru_pstorage.c File Reference
#include "pru_pstorage.h"
#include "pru.h"
#include "nrf_error.h"
#include "nrf_soc.h"
#include "string.h"

Go to the source code of this file.

Macros

#define PRU_PSTORAGE_EMPTY_FLASH_PATTERN   0xffffffff
 
#define PRU_PSTORAGE_FLASH_PAGE_SIZE   ((uint16_t)NRF_FICR->CODEPAGESIZE)
 
#define PRU_PSTORAGE_FLASH_START_PAGE   (NRF_FICR->CODESIZE - 4)
 
#define PRU_PSTORAGE_FLASH_START_ADDR   (PRU_PSTORAGE_FLASH_PAGE_SIZE * PRU_PSTORAGE_FLASH_START_PAGE)
 

Functions

API implementation
void pru_pstorage_sys_evt_handler (uint32_t event)
 Handles system callbacks. More...
 
void pru_pstorage_write (pru_pstorage_appdata_t *p_appdata)
 Writes application data to flash. More...
 
bool pru_pstorage_read (pru_pstorage_appdata_t *p_appdata)
 Reads application data from flash. More...
 
void pru_pstorage_erase_appdata (void)
 Erase all of PRU appdata.
 
void pru_pstorage_status (bool *p_complete, bool *p_success)
 Read status of pstorage operation. More...
 

Static functions and variables

enum  pru_pstorage_state { PRU_PSTORAGE_STATE_IDLE, PRU_PSTORAGE_STATE_ERASE, PRU_PSTORAGE_STATE_WRITE }
 Pstorage state.
 
static volatile bool m_operation_success
 
static volatile pru_pstorage_state m_state
 

Macro Definition Documentation

#define PRU_PSTORAGE_EMPTY_FLASH_PATTERN   0xffffffff

Empty flash pattern

Definition at line 23 of file pru_pstorage.c.

#define PRU_PSTORAGE_FLASH_PAGE_SIZE   ((uint16_t)NRF_FICR->CODEPAGESIZE)

Page size in bytes

Definition at line 24 of file pru_pstorage.c.

#define PRU_PSTORAGE_FLASH_START_PAGE   (NRF_FICR->CODESIZE - 4)

Start page for PRU PSTORAGE

Definition at line 25 of file pru_pstorage.c.

#define PRU_PSTORAGE_FLASH_START_ADDR   (PRU_PSTORAGE_FLASH_PAGE_SIZE * PRU_PSTORAGE_FLASH_START_PAGE)

Start address of PRU PSTORAGE flash

Definition at line 26 of file pru_pstorage.c.

Variable Documentation

volatile bool m_operation_success
static

Was the last operation successful?

Definition at line 41 of file pru_pstorage.c.

volatile pru_pstorage_state m_state
static

Current state of this module

Definition at line 42 of file pru_pstorage.c.