Wirepas SDK
wms_otap.h
Go to the documentation of this file.
1 /* Copyright 2017 Wirepas Ltd. All Rights Reserved.
2  *
3  * See file LICENSE.txt for full license details.
4  *
5  */
6 
20 #ifndef APP_LIB_OTAP_H_
21 #define APP_LIB_OTAP_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_OTAP_NAME 0x000f2338
31 
32 
33 #define APP_LIB_OTAP_VERSION 0x201
34 
41 typedef enum
42 {
51 
61 typedef enum
62 {
64  APP_LIB_OTAP_STATUS_OK = 0x00000000,
68 
74 typedef enum
75 {
93 
100 typedef enum
101 {
116 
127 typedef uint8_t app_lib_otap_seq_t;
128 
134 typedef size_t
136 
142 typedef size_t
144 
153 typedef size_t
155 
164 typedef app_lib_otap_seq_t
166 
176 typedef uint16_t
178 
184 typedef app_lib_otap_type_e
186 
193 typedef app_lib_otap_status_e
195 
205 typedef size_t
207 
217 typedef app_lib_otap_seq_t
219 
229 typedef uint16_t
231 
241 typedef uint32_t
243 
254 typedef bool
256 
266 typedef bool
268 
274 typedef bool
276 
302 typedef app_res_e
303  (*app_lib_otap_read_f)(uint32_t start,
304  size_t num_bytes,
305  void * bytes);
306 
320 typedef app_res_e
322 
351 typedef app_res_e
353  app_lib_otap_seq_t seq);
354 
378  (*app_lib_otap_write_f)(uint32_t start,
379  size_t num_bytes,
380  const void * bytes);
381 
394 typedef app_res_e
396 
460  app_lib_otap_seq_t target_sequence,
461  uint16_t target_crc,
462  app_lib_otap_action_e action,
463  uint8_t delay);
464 
481 typedef app_res_e
483  app_lib_otap_seq_t * target_sequence,
484  uint16_t * target_crc,
485  app_lib_otap_action_e * action,
486  uint8_t * delay);
487 
491 typedef struct
492 {
515 
516 #endif /* APP_LIB_OTAP_H_ */
app_lib_otap_get_max_block_num_bytes_f
size_t(* app_lib_otap_get_max_block_num_bytes_f)(void)
Get maximum block size in bytes.
Definition: wms_otap.h:154
app_lib_otap_t::getProcessedNumBytes
app_lib_otap_get_processed_num_bytes_f getProcessedNumBytes
Definition: wms_otap.h:500
app_lib_otap_seq_t
uint8_t app_lib_otap_seq_t
Type for OTAP sequence number.
Definition: wms_otap.h:127
app_lib_otap_t::getSeq
app_lib_otap_get_seq_f getSeq
Definition: wms_otap.h:496
app_lib_otap_get_max_num_bytes_f
size_t(* app_lib_otap_get_max_num_bytes_f)(void)
Get maximum scratchpad size.
Definition: wms_otap.h:135
app_lib_otap_t::getProcessedSeq
app_lib_otap_get_processed_seq_f getProcessedSeq
Definition: wms_otap.h:501
app_lib_otap_begin_f
app_res_e(* app_lib_otap_begin_f)(size_t num_bytes, app_lib_otap_seq_t seq)
Start writing a new scratchpad.
Definition: wms_otap.h:352
APP_LIB_OTAP_STATUS_NEW
@ APP_LIB_OTAP_STATUS_NEW
Definition: wms_otap.h:66
app_lib_otap_t::getNumBytes
app_lib_otap_get_num_bytes_f getNumBytes
Definition: wms_otap.h:494
APP_LIB_OTAP_TYPE_BLANK
@ APP_LIB_OTAP_TYPE_BLANK
Definition: wms_otap.h:44
app_lib_otap_read_f
app_res_e(* app_lib_otap_read_f)(uint32_t start, size_t num_bytes, void *bytes)
Read a block of scratchpad.
Definition: wms_otap.h:303
app_res_e
app_res_e
Definition: wms_app.h:201
app_lib_otap_t::getProcessedCrc
app_lib_otap_get_processed_crc_f getProcessedCrc
Definition: wms_otap.h:502
APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
Definition: wms_otap.h:81
wms_app.h
app_lib_otap_set_to_be_processed_f
app_res_e(* app_lib_otap_set_to_be_processed_f)(void)
Mark the stored scratchpad to be eligible for processing by the bootloader.
Definition: wms_otap.h:395
APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
@ APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
Definition: wms_otap.h:83
app_lib_otap_t::getProcessedAreaId
app_lib_otap_get_processed_area_id_f getProcessedAreaId
Definition: wms_otap.h:503
app_lib_otap_set_target_scratchpad_and_action_f
app_res_e(* app_lib_otap_set_target_scratchpad_and_action_f)(app_lib_otap_seq_t target_sequence, uint16_t target_crc, app_lib_otap_action_e action, uint8_t delay)
This service allows to set the information for scratchpad in the sink tree. What is the target scratc...
Definition: wms_otap.h:459
APP_LIB_OTAP_TYPE_PRESENT
@ APP_LIB_OTAP_TYPE_PRESENT
Definition: wms_otap.h:47
APP_LIB_OTAP_WRITE_RES_OK
@ APP_LIB_OTAP_WRITE_RES_OK
Definition: wms_otap.h:77
app_lib_otap_t::getMaxNumBytes
app_lib_otap_get_max_num_bytes_f getMaxNumBytes
Definition: wms_otap.h:493
app_lib_otap_t::begin
app_lib_otap_begin_f begin
Definition: wms_otap.h:509
app_lib_otap_t::clear
app_lib_otap_clear_f clear
Definition: wms_otap.h:508
app_lib_otap_t::isProcessed
app_lib_otap_is_processed_f isProcessed
Definition: wms_otap.h:505
APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
Definition: wms_otap.h:91
app_lib_otap_write_res_e
app_lib_otap_write_res_e
Write function return code.
Definition: wms_otap.h:74
app_lib_otap_get_processed_num_bytes_f
size_t(* app_lib_otap_get_processed_num_bytes_f)(void)
Get the size of scratchpad, in bytes, that produced the running stack firmware.
Definition: wms_otap.h:206
app_lib_otap_t::getTargetScratchpadAndAction
app_lib_otap_get_target_scratchpad_and_action_f getTargetScratchpadAndAction
Definition: wms_otap.h:513
app_lib_otap_t::isSetToBeProcessed
app_lib_otap_is_set_to_be_processed_f isSetToBeProcessed
Definition: wms_otap.h:506
app_lib_otap_is_valid_f
bool(* app_lib_otap_is_valid_f)(void)
Get the scratchpad validity status.
Definition: wms_otap.h:255
app_lib_otap_t::setToBeProcessed
app_lib_otap_set_to_be_processed_f setToBeProcessed
Definition: wms_otap.h:511
app_lib_otap_get_status_f
app_lib_otap_status_e(* app_lib_otap_get_status_f)(void)
Get the bootloader status of the stored scratchpad.
Definition: wms_otap.h:194
APP_LIB_OTAP_ACTION_LEGACY
@ APP_LIB_OTAP_ACTION_LEGACY
Definition: wms_otap.h:114
app_lib_otap_t::getCrc
app_lib_otap_get_crc_f getCrc
Definition: wms_otap.h:497
app_lib_otap_t::getStatus
app_lib_otap_get_status_f getStatus
Definition: wms_otap.h:499
app_lib_otap_t
Definition: wms_otap.h:491
app_lib_otap_get_processed_area_id_f
uint32_t(* app_lib_otap_get_processed_area_id_f)(void)
Get the area ID of the file in the scratchpad that produced the running stack firmware.
Definition: wms_otap.h:242
app_lib_otap_t::write
app_lib_otap_write_f write
Definition: wms_otap.h:510
app_lib_otap_get_target_scratchpad_and_action_f
app_res_e(* app_lib_otap_get_target_scratchpad_and_action_f)(app_lib_otap_seq_t *target_sequence, uint16_t *target_crc, app_lib_otap_action_e *action, uint8_t *delay)
This service allows to get the information for scratchpad in the sink tree. What is the target scratc...
Definition: wms_otap.h:482
app_lib_otap_get_type_f
app_lib_otap_type_e(* app_lib_otap_get_type_f)(void)
Get the type of the stored scratchpad.
Definition: wms_otap.h:185
app_lib_otap_t::getMaxBlockNumBytes
app_lib_otap_get_max_block_num_bytes_f getMaxBlockNumBytes
Definition: wms_otap.h:495
app_lib_otap_get_crc_f
uint16_t(* app_lib_otap_get_crc_f)(void)
Get the 16-bit CRC of the stored scratchpad.
Definition: wms_otap.h:177
app_lib_otap_t::isValid
app_lib_otap_is_valid_f isValid
Definition: wms_otap.h:504
app_lib_otap_action_e
app_lib_otap_action_e
Scratchpad possible actions.
Definition: wms_otap.h:100
app_lib_otap_write_f
app_lib_otap_write_res_e(* app_lib_otap_write_f)(uint32_t start, size_t num_bytes, const void *bytes)
Write a block of scratchpad.
Definition: wms_otap.h:378
app_lib_otap_t::getType
app_lib_otap_get_type_f getType
Definition: wms_otap.h:498
app_lib_otap_t::read
app_lib_otap_read_f read
Definition: wms_otap.h:507
APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
@ APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
Definition: wms_otap.h:89
APP_LIB_OTAP_WRITE_RES_INVALID_START
@ APP_LIB_OTAP_WRITE_RES_INVALID_START
Definition: wms_otap.h:85
app_lib_otap_type_e
app_lib_otap_type_e
Different scratchpad type.
Definition: wms_otap.h:41
app_lib_otap_get_num_bytes_f
size_t(* app_lib_otap_get_num_bytes_f)(void)
Get stored scratchpad size.
Definition: wms_otap.h:143
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
Definition: wms_otap.h:107
app_lib_otap_get_processed_crc_f
uint16_t(* app_lib_otap_get_processed_crc_f)(void)
Get the 16-bit CRC of the scratchpad that produced the running stack firmware.
Definition: wms_otap.h:230
APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
Definition: wms_otap.h:87
APP_LIB_OTAP_TYPE_PROCESS
@ APP_LIB_OTAP_TYPE_PROCESS
Definition: wms_otap.h:49
app_lib_joining_received_beacon_s::num_bytes
size_t num_bytes
Definition: wms_joining.h:137
app_lib_otap_status_e
app_lib_otap_status_e
Status code from the bootloader.
Definition: wms_otap.h:61
app_lib_otap_clear_f
app_res_e(* app_lib_otap_clear_f)(void)
Erase a stored scratchpad from memory.
Definition: wms_otap.h:321
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
Definition: wms_otap.h:111
app_lib_otap_is_processed_f
bool(* app_lib_otap_is_processed_f)(void)
Check if the stored scratchpad has been processed by the bootloader.
Definition: wms_otap.h:267
app_lib_otap_get_seq_f
app_lib_otap_seq_t(* app_lib_otap_get_seq_f)(void)
Get the OTAP sequence number.
Definition: wms_otap.h:165
APP_LIB_OTAP_STATUS_OK
@ APP_LIB_OTAP_STATUS_OK
Definition: wms_otap.h:64
APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
Definition: wms_otap.h:79
APP_LIB_OTAP_ACTION_NO_OTAP
@ APP_LIB_OTAP_ACTION_NO_OTAP
Definition: wms_otap.h:103
app_lib_otap_is_set_to_be_processed_f
bool(* app_lib_otap_is_set_to_be_processed_f)(void)
Check if scratchpad is set to be processed.
Definition: wms_otap.h:275
app_lib_otap_get_processed_seq_f
app_lib_otap_seq_t(* app_lib_otap_get_processed_seq_f)(void)
Get the OTAP sequence number of the scratchpad that produced the running stack firmware.
Definition: wms_otap.h:218
APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
@ APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
Definition: wms_otap.h:105
app_lib_otap_t::setTargetScratchpadAndAction
app_lib_otap_set_target_scratchpad_and_action_f setTargetScratchpadAndAction
Definition: wms_otap.h:512