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 0x202
34 
41 typedef enum
42 {
51 
60 typedef enum
61 {
63  APP_LIB_OTAP_STATUS_OK = 0x00000000,
67 
73 typedef enum
74 {
92 
98 typedef enum
99 {
111 
122 typedef uint8_t app_lib_otap_seq_t;
123 
129 typedef size_t
131 
137 typedef size_t
139 
148 typedef size_t
150 
159 typedef app_lib_otap_seq_t
161 
171 typedef uint16_t
173 
179 typedef app_lib_otap_type_e
181 
188 typedef app_lib_otap_status_e
190 
200 typedef size_t
202 
212 typedef app_lib_otap_seq_t
214 
224 typedef uint16_t
226 
236 typedef uint32_t
238 
249 typedef bool
251 
261 typedef bool
263 
269 typedef bool
271 
297 typedef app_res_e
298  (*app_lib_otap_read_f)(uint32_t start,
299  size_t num_bytes,
300  void * bytes);
301 
315 typedef app_res_e
317 
346 typedef app_res_e
348  app_lib_otap_seq_t seq);
349 
372  (*app_lib_otap_write_f)(uint32_t start,
373  size_t num_bytes,
374  const void * bytes);
375 
388 typedef app_res_e
390 
454  app_lib_otap_seq_t target_sequence,
455  uint16_t target_crc,
456  app_lib_otap_action_e action,
457  uint8_t delay);
458 
475 typedef app_res_e
477  app_lib_otap_seq_t * target_sequence,
478  uint16_t * target_crc,
479  app_lib_otap_action_e * action,
480  uint8_t * delay);
481 
485 typedef struct
486 {
509 
510 #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:149
app_lib_otap_t::getProcessedNumBytes
app_lib_otap_get_processed_num_bytes_f getProcessedNumBytes
Definition: wms_otap.h:494
app_lib_otap_seq_t
uint8_t app_lib_otap_seq_t
Type for OTAP sequence number.
Definition: wms_otap.h:122
app_lib_otap_t::getSeq
app_lib_otap_get_seq_f getSeq
Definition: wms_otap.h:490
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:130
app_lib_otap_t::getProcessedSeq
app_lib_otap_get_processed_seq_f getProcessedSeq
Definition: wms_otap.h:495
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:347
APP_LIB_OTAP_STATUS_NEW
@ APP_LIB_OTAP_STATUS_NEW
Definition: wms_otap.h:65
app_lib_otap_t::getNumBytes
app_lib_otap_get_num_bytes_f getNumBytes
Definition: wms_otap.h:488
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:298
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:496
APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
Definition: wms_otap.h:80
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:389
APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
@ APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
Definition: wms_otap.h:82
app_lib_otap_t::getProcessedAreaId
app_lib_otap_get_processed_area_id_f getProcessedAreaId
Definition: wms_otap.h:497
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:453
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:76
app_lib_otap_t::getMaxNumBytes
app_lib_otap_get_max_num_bytes_f getMaxNumBytes
Definition: wms_otap.h:487
app_lib_otap_t::begin
app_lib_otap_begin_f begin
Definition: wms_otap.h:503
app_lib_otap_t::clear
app_lib_otap_clear_f clear
Definition: wms_otap.h:502
app_lib_otap_t::isProcessed
app_lib_otap_is_processed_f isProcessed
Definition: wms_otap.h:499
APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
Definition: wms_otap.h:90
app_lib_otap_write_res_e
app_lib_otap_write_res_e
Write function return code.
Definition: wms_otap.h:73
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:201
app_lib_otap_t::getTargetScratchpadAndAction
app_lib_otap_get_target_scratchpad_and_action_f getTargetScratchpadAndAction
Definition: wms_otap.h:507
app_lib_otap_t::isSetToBeProcessed
app_lib_otap_is_set_to_be_processed_f isSetToBeProcessed
Definition: wms_otap.h:500
app_lib_otap_is_valid_f
bool(* app_lib_otap_is_valid_f)(void)
Get the scratchpad validity status.
Definition: wms_otap.h:250
app_lib_otap_t::setToBeProcessed
app_lib_otap_set_to_be_processed_f setToBeProcessed
Definition: wms_otap.h:505
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:189
app_lib_otap_t::getCrc
app_lib_otap_get_crc_f getCrc
Definition: wms_otap.h:491
app_lib_otap_t::getStatus
app_lib_otap_get_status_f getStatus
Definition: wms_otap.h:493
app_lib_otap_t
Definition: wms_otap.h:485
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:237
app_lib_otap_t::write
app_lib_otap_write_f write
Definition: wms_otap.h:504
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:476
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:180
app_lib_otap_t::getMaxBlockNumBytes
app_lib_otap_get_max_block_num_bytes_f getMaxBlockNumBytes
Definition: wms_otap.h:489
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:172
app_lib_otap_t::isValid
app_lib_otap_is_valid_f isValid
Definition: wms_otap.h:498
app_lib_otap_action_e
app_lib_otap_action_e
Scratchpad possible actions.
Definition: wms_otap.h:98
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:372
app_lib_otap_t::getType
app_lib_otap_get_type_f getType
Definition: wms_otap.h:492
app_lib_otap_t::read
app_lib_otap_read_f read
Definition: wms_otap.h:501
APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
@ APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
Definition: wms_otap.h:88
APP_LIB_OTAP_WRITE_RES_INVALID_START
@ APP_LIB_OTAP_WRITE_RES_INVALID_START
Definition: wms_otap.h:84
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:138
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
Definition: wms_otap.h:105
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:225
APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
Definition: wms_otap.h:86
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:129
app_lib_otap_status_e
app_lib_otap_status_e
Status code from the bootloader.
Definition: wms_otap.h:60
app_lib_otap_clear_f
app_res_e(* app_lib_otap_clear_f)(void)
Erase a stored scratchpad from memory.
Definition: wms_otap.h:316
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
Definition: wms_otap.h:109
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:262
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:160
APP_LIB_OTAP_STATUS_OK
@ APP_LIB_OTAP_STATUS_OK
Definition: wms_otap.h:63
APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
Definition: wms_otap.h:78
APP_LIB_OTAP_ACTION_NO_OTAP
@ APP_LIB_OTAP_ACTION_NO_OTAP
Definition: wms_otap.h:101
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:270
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:213
APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
@ APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
Definition: wms_otap.h:103
app_lib_otap_t::setTargetScratchpadAndAction
app_lib_otap_set_target_scratchpad_and_action_f setTargetScratchpadAndAction
Definition: wms_otap.h:506