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 
61 typedef enum
62 {
64  APP_LIB_OTAP_STATUS_OK = 0x00000000,
68 
74 typedef enum
75 {
93 
100 typedef enum
101 {
113 
124 typedef uint8_t app_lib_otap_seq_t;
125 
131 typedef size_t
133 
139 typedef size_t
141 
150 typedef size_t
152 
161 typedef app_lib_otap_seq_t
163 
173 typedef uint16_t
175 
181 typedef app_lib_otap_type_e
183 
190 typedef app_lib_otap_status_e
192 
202 typedef size_t
204 
214 typedef app_lib_otap_seq_t
216 
226 typedef uint16_t
228 
238 typedef uint32_t
240 
251 typedef bool
253 
263 typedef bool
265 
271 typedef bool
273 
299 typedef app_res_e
300  (*app_lib_otap_read_f)(uint32_t start,
301  size_t num_bytes,
302  void * bytes);
303 
317 typedef app_res_e
319 
348 typedef app_res_e
349  (*app_lib_otap_begin_f)(size_t num_bytes,
350  app_lib_otap_seq_t seq);
351 
375  (*app_lib_otap_write_f)(uint32_t start,
376  size_t num_bytes,
377  const void * bytes);
378 
391 typedef app_res_e
393 
457  app_lib_otap_seq_t target_sequence,
458  uint16_t target_crc,
459  app_lib_otap_action_e action,
460  uint8_t delay);
461 
478 typedef app_res_e
480  app_lib_otap_seq_t * target_sequence,
481  uint16_t * target_crc,
482  app_lib_otap_action_e * action,
483  uint8_t * delay);
484 
488 typedef struct
489 {
512 
513 #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:151
app_lib_otap_t::getProcessedNumBytes
app_lib_otap_get_processed_num_bytes_f getProcessedNumBytes
Definition: wms_otap.h:497
app_lib_otap_seq_t
uint8_t app_lib_otap_seq_t
Type for OTAP sequence number.
Definition: wms_otap.h:124
app_lib_otap_t::getSeq
app_lib_otap_get_seq_f getSeq
Definition: wms_otap.h:493
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:132
app_lib_otap_t::getProcessedSeq
app_lib_otap_get_processed_seq_f getProcessedSeq
Definition: wms_otap.h:498
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:349
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:491
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:300
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:499
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:392
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:500
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:456
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:490
app_lib_otap_t::begin
app_lib_otap_begin_f begin
Definition: wms_otap.h:506
app_lib_otap_t::clear
app_lib_otap_clear_f clear
Definition: wms_otap.h:505
app_lib_otap_t::isProcessed
app_lib_otap_is_processed_f isProcessed
Definition: wms_otap.h:502
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:203
app_lib_otap_t::getTargetScratchpadAndAction
app_lib_otap_get_target_scratchpad_and_action_f getTargetScratchpadAndAction
Definition: wms_otap.h:510
app_lib_otap_t::isSetToBeProcessed
app_lib_otap_is_set_to_be_processed_f isSetToBeProcessed
Definition: wms_otap.h:503
app_lib_otap_is_valid_f
bool(* app_lib_otap_is_valid_f)(void)
Get the scratchpad validity status.
Definition: wms_otap.h:252
app_lib_otap_t::setToBeProcessed
app_lib_otap_set_to_be_processed_f setToBeProcessed
Definition: wms_otap.h:508
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:191
app_lib_otap_t::getCrc
app_lib_otap_get_crc_f getCrc
Definition: wms_otap.h:494
app_lib_otap_t::getStatus
app_lib_otap_get_status_f getStatus
Definition: wms_otap.h:496
app_lib_otap_t
Definition: wms_otap.h:488
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:239
app_lib_otap_t::write
app_lib_otap_write_f write
Definition: wms_otap.h:507
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:479
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:182
app_lib_otap_t::getMaxBlockNumBytes
app_lib_otap_get_max_block_num_bytes_f getMaxBlockNumBytes
Definition: wms_otap.h:492
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:174
app_lib_otap_t::isValid
app_lib_otap_is_valid_f isValid
Definition: wms_otap.h:501
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:375
app_lib_otap_t::getType
app_lib_otap_get_type_f getType
Definition: wms_otap.h:495
app_lib_otap_t::read
app_lib_otap_read_f read
Definition: wms_otap.h:504
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:140
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:227
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_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:318
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:264
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:162
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:272
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:215
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:509