Wirepas SDK
wms_memory_area.h
Go to the documentation of this file.
1 /* Copyright 2018 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
20 #ifndef APP_LIB_MEMORY_AREA_H_
21 #define APP_LIB_MEMORY_AREA_H_
22 
23 #include <stdlib.h>
24 #include <stdint.h>
25 #include <stdbool.h>
26 
27 #include "wms_app.h"
28 
30 #define APP_LIB_MEMORY_AREA_NAME 0x01fd3b49
31 
33 #define APP_LIB_MEMORY_AREA_VERSION 0x200
34 
36 typedef enum
37 {
52 
58 #define APP_LIB_MEM_AREA_MAX_AREAS 8
59 
61 typedef uint32_t app_lib_mem_area_id_t;
62 
69 typedef enum
70 {
76 
83 typedef struct
84 {
101  uint32_t byte_write_time;
103  uint32_t page_write_time;
119 
126 typedef struct
127 {
131  size_t area_size;
139 
140 
160  void * to,
161  uint32_t from,
162  size_t amount);
163 
189  uint32_t to,
190  const void * from,
191  size_t amount);
192 
213  uint32_t * sector_base,
214  size_t * number_of_sector);
215 
222 typedef bool
224 
237  app_lib_mem_area_info_t * info);
238 
248 typedef void
250  uint8_t * num_areas);
251 
255  typedef struct
256  {
264 
265 #endif /* APP_LIB_MEMORY_AREA_H_ */
app_lib_mem_area_info_t::external_flash
bool external_flash
Definition: wms_memory_area.h:135
app_lib_mem_area_info_t
memory area information
Definition: wms_memory_area.h:126
app_lib_mem_area_info_t::type
app_lib_mem_area_type_e type
Definition: wms_memory_area.h:137
app_lib_mem_area_flash_info_t::sector_erase_time
uint32_t sector_erase_time
Definition: wms_memory_area.h:105
app_lib_mem_area_id_t
uint32_t app_lib_mem_area_id_t
Memory Area id definition.
Definition: wms_memory_area.h:61
app_lib_mem_area_startWrite_f
app_lib_mem_area_res_e(* app_lib_mem_area_startWrite_f)(app_lib_mem_area_id_t id, uint32_t to, const void *from, size_t amount)
Block write to a memory area.
Definition: wms_memory_area.h:188
wms_app.h
APP_LIB_MEM_AREA_TYPE_USER
@ APP_LIB_MEM_AREA_TYPE_USER
Definition: wms_memory_area.h:74
app_lib_memory_area_t::startErase
app_lib_mem_area_startErase_f startErase
Definition: wms_memory_area.h:259
app_lib_memory_area_t::getAreaList
app_lib_mem_area_getAreaList_f getAreaList
Definition: wms_memory_area.h:262
app_lib_mem_area_flash_info_t::byte_write_call_time
uint32_t byte_write_call_time
Definition: wms_memory_area.h:108
app_lib_mem_area_isBusy_f
bool(* app_lib_mem_area_isBusy_f)(app_lib_mem_area_id_t id)
Checks if underlying flash driver is busy.
Definition: wms_memory_area.h:223
app_lib_mem_area_startErase_f
app_lib_mem_area_res_e(* app_lib_mem_area_startErase_f)(app_lib_mem_area_id_t id, uint32_t *sector_base, size_t *number_of_sector)
Erase one or multiple sectors in the memory area.
Definition: wms_memory_area.h:212
app_lib_mem_area_flash_info_t::sector_erase_call_time
uint32_t sector_erase_call_time
Definition: wms_memory_area.h:114
app_lib_mem_area_flash_info_t
Information on flash peripheral.
Definition: wms_memory_area.h:83
APP_LIB_MEM_AREA_TYPE_APPLICATION
@ APP_LIB_MEM_AREA_TYPE_APPLICATION
Definition: wms_memory_area.h:72
app_lib_memory_area_t::getAreaInfo
app_lib_mem_area_getAreaInfo_f getAreaInfo
Definition: wms_memory_area.h:261
app_lib_mem_area_flash_info_t::page_write_time
uint32_t page_write_time
Definition: wms_memory_area.h:103
app_lib_mem_area_flash_info_t::is_busy_call_time
uint32_t is_busy_call_time
Definition: wms_memory_area.h:117
APP_LIB_MEM_AREA_RES_PARAM
@ APP_LIB_MEM_AREA_RES_PARAM
Definition: wms_memory_area.h:48
app_lib_mem_area_flash_info_t::write_alignment
size_t write_alignment
Definition: wms_memory_area.h:93
APP_LIB_MEM_AREA_RES_NODRIVER
@ APP_LIB_MEM_AREA_RES_NODRIVER
Definition: wms_memory_area.h:46
app_lib_mem_area_flash_info_t::page_write_call_time
uint32_t page_write_call_time
Definition: wms_memory_area.h:111
APP_LIB_MEM_AREA_RES_BUSY
@ APP_LIB_MEM_AREA_RES_BUSY
Definition: wms_memory_area.h:44
APP_LIB_MEM_AREA_RES_OK
@ APP_LIB_MEM_AREA_RES_OK
Definition: wms_memory_area.h:39
app_lib_mem_area_type_e
app_lib_mem_area_type_e
Lists the types of areas accessible from application side.
Definition: wms_memory_area.h:69
APP_LIB_MEM_AREA_RES_ERROR
@ APP_LIB_MEM_AREA_RES_ERROR
Definition: wms_memory_area.h:42
app_lib_mem_area_getAreaList_f
void(* app_lib_mem_area_getAreaList_f)(app_lib_mem_area_id_t *list, uint8_t *num_areas)
Returns the list of areas defined in the bootloader and accessible from the application.
Definition: wms_memory_area.h:249
app_lib_memory_area_t::isBusy
app_lib_mem_area_isBusy_f isBusy
Definition: wms_memory_area.h:260
app_lib_mem_area_flash_info_t::byte_write_time
uint32_t byte_write_time
Definition: wms_memory_area.h:101
app_lib_mem_area_info_t::area_id
app_lib_mem_area_id_t area_id
Definition: wms_memory_area.h:129
app_lib_memory_area_t::startRead
app_lib_mem_area_startRead_f startRead
Definition: wms_memory_area.h:257
app_lib_mem_area_info_t::flash
app_lib_mem_area_flash_info_t flash
Definition: wms_memory_area.h:133
APP_LIB_MEM_AREA_RES_INVALID_AREA
@ APP_LIB_MEM_AREA_RES_INVALID_AREA
Definition: wms_memory_area.h:50
app_lib_mem_area_res_e
app_lib_mem_area_res_e
memory area operations result
Definition: wms_memory_area.h:36
app_lib_mem_area_flash_info_t::erase_sector_size
size_t erase_sector_size
Definition: wms_memory_area.h:88
app_lib_mem_area_flash_info_t::write_page_size
size_t write_page_size
Definition: wms_memory_area.h:86
app_lib_mem_area_getAreaInfo_f
app_lib_mem_area_res_e(* app_lib_mem_area_getAreaInfo_f)(app_lib_mem_area_id_t id, app_lib_mem_area_info_t *info)
Fills a structure with info about memory area and flash timings and topology.
Definition: wms_memory_area.h:236
app_lib_memory_area_t
List of library functions.
Definition: wms_memory_area.h:255
app_lib_memory_area_t::startWrite
app_lib_mem_area_startWrite_f startWrite
Definition: wms_memory_area.h:258
app_lib_mem_area_startRead_f
app_lib_mem_area_res_e(* app_lib_mem_area_startRead_f)(app_lib_mem_area_id_t id, void *to, uint32_t from, size_t amount)
Block read from a memory area.
Definition: wms_memory_area.h:159
app_lib_mem_area_info_t::area_size
size_t area_size
Definition: wms_memory_area.h:131