Wirepas SDK
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 "app/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 
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_type_e
app_lib_otap_type_e
Different scratchpad type.
Definition: otap.h:41
APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
@ APP_LIB_OTAP_WRITE_RES_NOT_ONGOING
Definition: otap.h:83
app_lib_otap_t::getStatus
app_lib_otap_get_status_f getStatus
Definition: otap.h:493
APP_LIB_OTAP_TYPE_PRESENT
@ APP_LIB_OTAP_TYPE_PRESENT
Definition: otap.h:47
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS
Definition: otap.h:107
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: otap.h:242
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: 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: otap.h:165
app_lib_otap_get_max_num_bytes_f
size_t(* app_lib_otap_get_max_num_bytes_f)(void)
Get maximum scratchpad size.
Definition: otap.h:135
APP_LIB_OTAP_STATUS_NEW
@ APP_LIB_OTAP_STATUS_NEW
Definition: otap.h:66
app_lib_otap_t::setToBeProcessed
app_lib_otap_set_to_be_processed_f setToBeProcessed
Definition: otap.h:505
app_lib_otap_write_res_e
app_lib_otap_write_res_e
Write function return code.
Definition: otap.h:74
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: otap.h:185
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: otap.h:177
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: otap.h:303
app_lib_otap_t::getType
app_lib_otap_get_type_f getType
Definition: otap.h:492
app_lib_otap_t::setTargetScratchpadAndAction
app_lib_otap_set_target_scratchpad_and_action_f setTargetScratchpadAndAction
Definition: otap.h:506
app_lib_joining_received_beacon_s::num_bytes
size_t num_bytes
Definition: joining.h:137
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: otap.h:275
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: otap.h:194
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: otap.h:378
app_lib_otap_get_num_bytes_f
size_t(* app_lib_otap_get_num_bytes_f)(void)
Get stored scratchpad size.
Definition: otap.h:143
APP_LIB_OTAP_TYPE_BLANK
@ APP_LIB_OTAP_TYPE_BLANK
Definition: otap.h:44
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: otap.h:395
app_lib_otap_t::getMaxBlockNumBytes
app_lib_otap_get_max_block_num_bytes_f getMaxBlockNumBytes
Definition: otap.h:489
app_lib_otap_t::read
app_lib_otap_read_f read
Definition: otap.h:501
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: otap.h:453
app_lib_otap_clear_f
app_res_e(* app_lib_otap_clear_f)(void)
Erase a stored scratchpad from memory.
Definition: otap.h:321
app_lib_otap_t::isValid
app_lib_otap_is_valid_f isValid
Definition: otap.h:498
APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
@ APP_LIB_OTAP_WRITE_RES_INVALID_HEADER
Definition: otap.h:89
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: otap.h:206
app_lib_otap_action_e
app_lib_otap_action_e
Scratchpad possible actions.
Definition: otap.h:100
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: otap.h:476
app_lib_otap_t::clear
app_lib_otap_clear_f clear
Definition: otap.h:502
app_lib_otap_t::getProcessedNumBytes
app_lib_otap_get_processed_num_bytes_f getProcessedNumBytes
Definition: otap.h:494
app_lib_otap_t::getTargetScratchpadAndAction
app_lib_otap_get_target_scratchpad_and_action_f getTargetScratchpadAndAction
Definition: otap.h:507
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: otap.h:154
app.h
app_lib_otap_t
Definition: otap.h:485
app_lib_otap_t::getProcessedAreaId
app_lib_otap_get_processed_area_id_f getProcessedAreaId
Definition: otap.h:497
app_lib_otap_t::getCrc
app_lib_otap_get_crc_f getCrc
Definition: otap.h:491
APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
@ APP_LIB_OTAP_ACTION_PROPAGATE_AND_PROCESS_WITH_DELAY
Definition: otap.h:111
app_lib_otap_is_valid_f
bool(* app_lib_otap_is_valid_f)(void)
Get the scratchpad validity status.
Definition: otap.h:255
app_lib_otap_t::getProcessedSeq
app_lib_otap_get_processed_seq_f getProcessedSeq
Definition: otap.h:495
app_lib_otap_t::isSetToBeProcessed
app_lib_otap_is_set_to_be_processed_f isSetToBeProcessed
Definition: otap.h:500
APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
@ APP_LIB_OTAP_ACTION_PROPAGATE_ONLY
Definition: otap.h:105
app_lib_otap_t::getProcessedCrc
app_lib_otap_get_processed_crc_f getProcessedCrc
Definition: otap.h:496
APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NULL_BYTES
Definition: otap.h:91
app_lib_otap_t::getNumBytes
app_lib_otap_get_num_bytes_f getNumBytes
Definition: otap.h:488
APP_LIB_OTAP_WRITE_RES_OK
@ APP_LIB_OTAP_WRITE_RES_OK
Definition: otap.h:77
app_lib_otap_status_e
app_lib_otap_status_e
Status code from the bootloader.
Definition: otap.h:61
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: otap.h:218
app_lib_otap_seq_t
uint8_t app_lib_otap_seq_t
Type for OTAP sequence number.
Definition: otap.h:127
app_lib_otap_t::getMaxNumBytes
app_lib_otap_get_max_num_bytes_f getMaxNumBytes
Definition: otap.h:487
APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
@ APP_LIB_OTAP_WRITE_RES_INVALID_NUM_BYTES
Definition: otap.h:87
APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_ERROR
Definition: otap.h:81
app_lib_otap_t::begin
app_lib_otap_begin_f begin
Definition: otap.h:503
app_lib_otap_t::getSeq
app_lib_otap_get_seq_f getSeq
Definition: otap.h:490
APP_LIB_OTAP_WRITE_RES_INVALID_START
@ APP_LIB_OTAP_WRITE_RES_INVALID_START
Definition: otap.h:85
APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
@ APP_LIB_OTAP_WRITE_RES_COMPLETED_OK
Definition: otap.h:79
APP_LIB_OTAP_ACTION_LEGACY
@ APP_LIB_OTAP_ACTION_LEGACY
Definition: otap.h:114
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: otap.h:352
APP_LIB_OTAP_TYPE_PROCESS
@ APP_LIB_OTAP_TYPE_PROCESS
Definition: otap.h:49
APP_LIB_OTAP_STATUS_OK
@ APP_LIB_OTAP_STATUS_OK
Definition: otap.h:64
app_res_e
app_res_e
Definition: app.h:201
app_lib_otap_t::isProcessed
app_lib_otap_is_processed_f isProcessed
Definition: otap.h:499
APP_LIB_OTAP_ACTION_NO_OTAP
@ APP_LIB_OTAP_ACTION_NO_OTAP
Definition: otap.h:103
app_lib_otap_t::write
app_lib_otap_write_f write
Definition: otap.h:504
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: otap.h:230