ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
fds.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "sdk_errors.h"
#include "app_util_platform.h"

Go to the source code of this file.

Data Structures

struct  fds_header_t
 The record metadata as stored in flash. More...
 
struct  fds_record_desc_t
 The record descriptor structure that is used to manipulate records. More...
 
struct  fds_flash_record_t
 Structure that can be used to read the contents of a record stored in flash. More...
 
struct  fds_record_t
 A record to be written to flash. More...
 
struct  fds_reserve_token_t
 A token to a reserved space in flash, created by fds_reserve. More...
 
struct  fds_find_token_t
 A token to keep information about the progress of fds_record_find, fds_record_find_by_key, and fds_record_find_in_file. More...
 
struct  fds_evt_t
 An FDS event. More...
 
struct  fds_stat_t
 File system statistics. More...
 

Macros

#define FDS_FILE_ID_INVALID   (0xFFFF)
 Invalid file ID. More...
 
#define FDS_RECORD_KEY_DIRTY   (0x0000)
 Record key for deleted records. More...
 
#define FDS_BOUND_NOT_SET   (0)
 Value for unconfigured FDS physical bound. More...
 

Typedefs

typedef void(* fds_cb_t) (fds_evt_t const *p_evt)
 FDS event handler function prototype. More...
 

Enumerations

enum  {
  FDS_SUCCESS = NRF_SUCCESS , FDS_ERR_OPERATION_TIMEOUT , FDS_ERR_NOT_INITIALIZED , FDS_ERR_UNALIGNED_ADDR ,
  FDS_ERR_INVALID_ARG , FDS_ERR_NULL_ARG , FDS_ERR_NO_OPEN_RECORDS , FDS_ERR_NO_SPACE_IN_FLASH ,
  FDS_ERR_NO_SPACE_IN_QUEUES , FDS_ERR_RECORD_TOO_LARGE , FDS_ERR_NOT_FOUND , FDS_ERR_NO_PAGES ,
  FDS_ERR_USER_LIMIT_REACHED , FDS_ERR_CRC_CHECK_FAILED , FDS_ERR_BUSY , FDS_ERR_INTERNAL
}
 FDS return values. More...
 
enum  fds_evt_id_t {
  FDS_EVT_INIT , FDS_EVT_WRITE , FDS_EVT_UPDATE , FDS_EVT_DEL_RECORD ,
  FDS_EVT_DEL_FILE , FDS_EVT_GC
}
 FDS event IDs. More...
 

Functions

ret_code_t fds_register (fds_cb_t cb)
 Function for registering an FDS event handler. More...
 
ret_code_t fds_init (void)
 Function for initializing the module. More...
 
ret_code_t fds_record_write (fds_record_desc_t *p_desc, fds_record_t const *p_record)
 Function for writing a record to flash. More...
 
ret_code_t fds_reserve (fds_reserve_token_t *p_token, uint16_t length_words)
 Function for reserving space in flash. More...
 
ret_code_t fds_reserve_cancel (fds_reserve_token_t *p_token)
 Function for canceling an fds_reserve operation. More...
 
ret_code_t fds_record_write_reserved (fds_record_desc_t *p_desc, fds_record_t const *p_record, fds_reserve_token_t const *p_token)
 Function for writing a record to a space in flash that was reserved using fds_reserve. More...
 
ret_code_t fds_record_delete (fds_record_desc_t *p_desc)
 Function for deleting a record. More...
 
ret_code_t fds_file_delete (uint16_t file_id)
 Function for deleting all records in a file. More...
 
ret_code_t fds_record_update (fds_record_desc_t *p_desc, fds_record_t const *p_record)
 Function for updating a record. More...
 
ret_code_t fds_record_iterate (fds_record_desc_t *p_desc, fds_find_token_t *p_token)
 Function for iterating through all records in flash. More...
 
ret_code_t fds_record_find (uint16_t file_id, uint16_t record_key, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
 Function for searching for records with a given record key in a file. More...
 
ret_code_t fds_record_find_by_key (uint16_t record_key, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
 Function for searching for records with a given record key. More...
 
ret_code_t fds_record_find_in_file (uint16_t file_id, fds_record_desc_t *p_desc, fds_find_token_t *p_token)
 Function for searching for any record in a file. More...
 
ret_code_t fds_record_open (fds_record_desc_t *p_desc, fds_flash_record_t *p_flash_record)
 Function for opening a record for reading. More...
 
ret_code_t fds_record_close (fds_record_desc_t *p_desc)
 Function for closing a record. More...
 
ret_code_t fds_gc (void)
 Function for running garbage collection. More...
 
ret_code_t fds_descriptor_from_rec_id (fds_record_desc_t *p_desc, uint32_t record_id)
 Function for obtaining a descriptor from a record ID. More...
 
ret_code_t fds_record_id_from_desc (fds_record_desc_t const *p_desc, uint32_t *p_record_id)
 Function for obtaining a record ID from a record descriptor. More...
 
ret_code_t fds_stat (fds_stat_t *p_stat)
 Function for retrieving file system statistics. More...
 
ret_code_t flash_bounds_set (const uint32_t start_addr, const uint32_t end_addr)
 Set physical boundaries for FDS. More...
 

Variables

 ANON_UNIONS_ENABLE
 
 ANON_UNIONS_DISABLE