Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Utility internal functions.

Utility internal functions.

Functions

static void cmd_queue_element_init (uint32_t index)
 Initializes command queue element.
static void cmd_queue_init (void)
 Initializes command queue.
static uint32_t cmd_queue_enqueue (uint8_t opcode, pstorage_handle_t *p_storage_addr, uint8_t *p_data_addr, pstorage_size_t size, pstorage_size_t offset)
 Routine to enqueue a flash access operation.
static uint32_t cmd_queue_dequeue (void)
 Dequeues a command element.
static void app_notify (uint32_t result)
 Routine to notify application of any errors.
void pstorage_sys_event_handler (uint32_t sys_evt)
 Handles Flash Access Result Events declared in pstorage_platform.h.
static uint32_t swap_state_process (cmd_queue_element_t *p_cmd, uint32_t page_number, uint32_t head_word_size, uint32_t tail_word_size)
 Function for handling flash accesses when using swap.
static uint32_t cmd_process (void)
 Routine called to actually issue the flash access request to the SoftDevice.

Detailed Description

Utility functions needed for interfacing with flash through SoC APIs. SoC APIs are non blocking and provide the result of flash access through an event.

Note:
Only one flash access operation is permitted at a time by SoC. Hence a queue is maintained by this module.

Function Documentation

static void app_notify ( uint32_t  result ) [static]

Routine to notify application of any errors.

Parameters:
[in]resultResult of event being notified.

Definition at line 396 of file pstorage.c.

static uint32_t cmd_process ( void   ) [static]

Routine called to actually issue the flash access request to the SoftDevice.

Return values:
NRF_SUCCESSon success, else an error code indicating reason for failure.

Definition at line 699 of file pstorage.c.

static uint32_t cmd_queue_dequeue ( void   ) [static]

Dequeues a command element.

Return values:
NRF_SUCCESSon success, else an error code indicating reason for failure.

Definition at line 362 of file pstorage.c.

static void cmd_queue_element_init ( uint32_t  index ) [static]

Initializes command queue element.

Parameters:
[in]indexElement index being initialized.

Definition at line 267 of file pstorage.c.

static uint32_t cmd_queue_enqueue ( uint8_t  opcode,
pstorage_handle_t *  p_storage_addr,
uint8_t *  p_data_addr,
pstorage_size_t  size,
pstorage_size_t  offset 
) [static]

Routine to enqueue a flash access operation.

Parameters:
[in]opcodeIdentifies operation requested to be enqueued.
[in]p_storage_addrIdentiifes module and flash address on which operation is requested.
[in]p_data_addrIdentifies data address for flash access.
[in]sizeSize in bytes of data requested for the access operation.
[in]offsetOffset within the flash memory block at which operation is requested.
Return values:
NRF_SUCCESSon success, else an error code indicating reason for failure.
Note:
All paramater check should be performed before requesting in an enqueue.

Definition at line 312 of file pstorage.c.

static void cmd_queue_init ( void   ) [static]

Initializes command queue.

Definition at line 282 of file pstorage.c.

void pstorage_sys_event_handler ( uint32_t  sys_evt )

Handles Flash Access Result Events declared in pstorage_platform.h.

Parameters:
[in]sys_evtSystem event to be handled.

Definition at line 428 of file pstorage.c.

static uint32_t swap_state_process ( cmd_queue_element_t *  p_cmd,
uint32_t  page_number,
uint32_t  head_word_size,
uint32_t  tail_word_size 
) [static]

Function for handling flash accesses when using swap.

__________________________________________________________ | Page | |________________________________________________________| | head | affected body (to be updated or cleared) | tail | |______|__________________________________________|______|

Parameters:
[in]p_cmdQueue element being processed.
[in]page_numberThe affected page number.
[in]head_word_sizeSize of the head in number of words.
[in]tail_word_sizeSize of the tail in number of words.
Return values:
NRF_SUCCESSon success, else an error code indicating reason for failure.

Definition at line 545 of file pstorage.c.