Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
evbme_messages.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Cascoda Ltd.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. Neither the name of the copyright holder nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
40 #ifndef EVBME_MESSAGES_H
41 #define EVBME_MESSAGES_H
42 
43 #include <stdint.h>
44 
45 #include "ca821x_config.h"
46 #include "ca821x_error.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
54 {
59 
65  EVBME_DFU_CMD = 0xA3,
66 
67  EVBME_RXRDY = 0xAA,
68  EVBME_RXFAIL = 0xAB,
69 };
70 
73 {
74  EVBME_RESETRF = 0x00,
75  EVBME_CFGPINS = 0x01,
76  EVBME_WAKEUPRF = 0x02,
77 
78  EVBME_VERSTRING = 0x80,
80  EVBME_APPSTRING = 0x82,
81  EVBME_SERIALNO = 0x83,
82  EVBME_OT_EUI64 = 0x84,
86 };
87 
92 {
94 };
95 
100 {
102  DFU_ERASE = 1,
103  DFU_WRITE = 2,
104  DFU_CHECK = 3,
107 };
108 
113 {
116 };
117 
122 {
123  uint8_t rebootMode;
124 };
125 
130 {
131  uint8_t startAddr[4];
132  uint8_t eraseLen[4];
133 };
134 
139 {
140  uint8_t startAddr[4];
141  uint8_t data[];
142 };
143 
148 {
149  uint8_t startAddr[4];
150  uint8_t checkLen[4];
151  uint8_t checksum[4];
152 };
153 
158 {
159  uint8_t status;
160 };
161 
166 {
167  uint8_t bootMode;
168 };
169 
174 {
181 };
182 
187 {
188  uint8_t mStatus;
189  uint8_t mAttributeId;
190  uint8_t mAttributeLen;
191  uint8_t mAttribute[];
192 };
193 
198 {
199  uint8_t mAttributeId;
200 };
201 
206 {
207  uint8_t mStatus;
208 };
209 
214 {
215  uint8_t mAttributeId;
216  uint8_t mAttributeLen;
217  uint8_t mAttribute[];
218 };
219 
224 {
225  char mMessage[1]; //Flexible length, but need at least one member
226 };
227 
230 {
231  uint8_t mHandle;
232  uint8_t mDelay;
233  uint8_t mIndCount;
234  uint8_t mIndSize;
235  uint8_t mPayload[];
236 };
237 
240 {
241  uint8_t mHandle;
242  uint8_t mPayload[];
243 };
244 
249 {
250  uint8_t mDfuSubCmdId;
251  union evbme_dfu_sub_cmd mSubCmd;
252 };
253 
258 {
259  uint8_t mCmdId;
260  uint8_t mLen;
261  union
262  {
270  struct EVBME_DFU_cmd DFU_cmd;
271  uint8_t data[254];
272  } EVBME;
273 };
274 
275 #ifdef __cplusplus
276 }
277 #endif
278 
283 #endif // EVBME_MESSAGES_H
Global error declarations for use across the Cascoda SDK.
evbme_dfu_cmdid
Command IDs for DFU commands.
Definition: evbme_messages.h:100
evbme_dfu_const
General constants for DFU.
Definition: evbme_messages.h:92
evbme_command_ids
EVBME Command IDs.
Definition: evbme_messages.h:54
evbme_dfu_rebootmode
Reboot mode.
Definition: evbme_messages.h:113
evbme_attribute
EVBME attribute ids for use with EVBME_SET_REQUEST and EVBME_GET_REQUEST.
Definition: evbme_messages.h:73
@ DFU_BOOTMODE
Set default boot mode of device.
Definition: evbme_messages.h:106
@ DFU_ERASE
Erase given flash pages.
Definition: evbme_messages.h:102
@ DFU_REBOOT
Reboot into DFU or non-dfu mode.
Definition: evbme_messages.h:101
@ DFU_STATUS
Status command returned from chili to host.
Definition: evbme_messages.h:105
@ DFU_WRITE
Write given data to already erased flash.
Definition: evbme_messages.h:103
@ DFU_CHECK
Check flash checksum in given range.
Definition: evbme_messages.h:104
@ DFU_WRITE_MAX_LEN
Maximum number of bytes that can be written in one command.
Definition: evbme_messages.h:93
@ EVBME_HOST_CONNECTED
M->S Notification from host that connection is established.
Definition: evbme_messages.h:60
@ EVBME_COMM_INDICATION
M<-S Communication check indication from slave to master as requested.
Definition: evbme_messages.h:64
@ EVBME_GET_CONFIRM
M<-S Response containing EVBME parameter data (sync resp)
Definition: evbme_messages.h:55
@ EVBME_COMM_CHECK
M->S Communication check message from host that generates COMM_INDICATIONS.
Definition: evbme_messages.h:63
@ EVBME_SET_CONFIRM
M<-S Response including status for EVBME set (sync resp)
Definition: evbme_messages.h:57
@ EVBME_RXRDY
M<>S RXRDY signal, used for interfaces without built in flow control like raw UART.
Definition: evbme_messages.h:67
@ EVBME_DFU_CMD
M<>S DFU Commands for Device Firmware Upgrade in system.
Definition: evbme_messages.h:65
@ EVBME_HOST_DISCONNECTED
M->S Notification from host that connection is about to be terminated.
Definition: evbme_messages.h:61
@ EVBME_MESSAGE_INDICATION
M<-S Text message to be printed by host.
Definition: evbme_messages.h:62
@ EVBME_RXFAIL
M<>S RXFAIL signal, used for interfaces without built in flow control like raw UART.
Definition: evbme_messages.h:68
@ EVBME_SET_REQUEST
M->S Set an EVBME parameter (sync req)
Definition: evbme_messages.h:58
@ EVBME_GET_REQUEST
M->S Get an EVBME parameter (sync req)
Definition: evbme_messages.h:56
@ EVBME_DFU_REBOOT_DFU
Reboot into Device Firmware Upgrade mode.
Definition: evbme_messages.h:115
@ EVBME_DFU_REBOOT_APROM
Reboot into application.
Definition: evbme_messages.h:114
@ EVBME_ONBOARD_FLASH_INFO
Information about the usage of onboard flash - Read only.
Definition: evbme_messages.h:85
@ EVBME_SERIALNO
SerialNo 64 bit binary - Read only.
Definition: evbme_messages.h:81
@ EVBME_APPSTRING
Application string - Read only.
Definition: evbme_messages.h:80
@ EVBME_OT_EUI64
Openthread EUI64 for commissioning - Read only.
Definition: evbme_messages.h:82
@ EVBME_WAKEUPRF
Wakeup CA8211 - Write only.
Definition: evbme_messages.h:76
@ EVBME_RESETRF
ResetRF - Write only.
Definition: evbme_messages.h:74
@ EVBME_EXTERNAL_FLASH_AVAILABLE
Whether an external flash chip is available - Read only.
Definition: evbme_messages.h:84
@ EVBME_CFGPINS
CfgPins - Write only.
Definition: evbme_messages.h:75
@ EVBME_PLATSTRING
Platform string - Read only.
Definition: evbme_messages.h:79
@ EVBME_OT_JOINCRED
Openthread joining credential for commissioning - Read only.
Definition: evbme_messages.h:83
@ EVBME_VERSTRING
Version string - Read only.
Definition: evbme_messages.h:78
Structure of the EVBME_COMM_CHECK message that can be used to test comms by host.
Definition: evbme_messages.h:230
uint8_t mIndCount
Number of indications to send up.
Definition: evbme_messages.h:233
uint8_t mIndSize
Size of the indications to send.
Definition: evbme_messages.h:234
uint8_t mPayload[]
Redundant payload to stress the interface.
Definition: evbme_messages.h:235
uint8_t mDelay
Delay before sending responses.
Definition: evbme_messages.h:232
uint8_t mHandle
Handle identifying this comm check.
Definition: evbme_messages.h:231
Structure of the EVBME_COMM_INDICATION message that is used in response to EVBME_COMM_CHECK_request.
Definition: evbme_messages.h:240
uint8_t mPayload[]
Additional data to stress comm link as specified by mIndSize in EVBME_COMM_CHECK_request.
Definition: evbme_messages.h:242
uint8_t mHandle
Handle identifying this comm check.
Definition: evbme_messages.h:241
EVBME DFU command holder, contains various sub-dfu commands from evbme_dfu_sub_cmd.
Definition: evbme_messages.h:249
union evbme_dfu_sub_cmd mSubCmd
Dfu subcommand data.
Definition: evbme_messages.h:251
uint8_t mDfuSubCmdId
DFU sub command ID evbme_dfu_cmdid.
Definition: evbme_messages.h:250
EVBME Get data confirm structure.
Definition: evbme_messages.h:187
uint8_t mAttribute[]
Definition: evbme_messages.h:191
uint8_t mAttributeId
Definition: evbme_messages.h:189
uint8_t mStatus
Definition: evbme_messages.h:188
uint8_t mAttributeLen
Definition: evbme_messages.h:190
EVBME Get data request structure.
Definition: evbme_messages.h:198
uint8_t mAttributeId
Definition: evbme_messages.h:199
EVBME Message indication structure.
Definition: evbme_messages.h:224
char mMessage[1]
Definition: evbme_messages.h:225
EVBME Message command in Cascoda TLV format.
Definition: evbme_messages.h:258
struct EVBME_MESSAGE_indication MESSAGE_indication
Definition: evbme_messages.h:267
uint8_t mCmdId
see evbme_command_ids
Definition: evbme_messages.h:259
struct EVBME_SET_request SET_request
Definition: evbme_messages.h:266
uint8_t mLen
Length of the EVBME command data.
Definition: evbme_messages.h:260
struct EVBME_COMM_CHECK_request COMM_CHECK_request
Definition: evbme_messages.h:268
struct EVBME_SET_confirm SET_confirm
Definition: evbme_messages.h:265
union EVBME_Message::@12 EVBME
struct EVBME_DFU_cmd DFU_cmd
Definition: evbme_messages.h:270
struct EVBME_GET_request GET_request
Definition: evbme_messages.h:264
struct EVBME_GET_confirm GET_confirm
Definition: evbme_messages.h:263
uint8_t data[254]
To access as raw data.
Definition: evbme_messages.h:271
struct EVBME_COMM_indication COMM_indication
Definition: evbme_messages.h:269
EVBME Set data confirm structure.
Definition: evbme_messages.h:206
uint8_t mStatus
Definition: evbme_messages.h:207
EVBME Set data request structure.
Definition: evbme_messages.h:214
uint8_t mAttribute[]
Definition: evbme_messages.h:217
uint8_t mAttributeLen
Definition: evbme_messages.h:216
uint8_t mAttributeId
Definition: evbme_messages.h:215
Boot mode command to set default boot into DFU or APROM.
Definition: evbme_messages.h:166
uint8_t bootMode
0=APROM, 1=DFU - see evbme_dfu_rebootmode
Definition: evbme_messages.h:167
Check command to validate flash against a checksum.
Definition: evbme_messages.h:148
uint8_t checksum[4]
checksum to validate against
Definition: evbme_messages.h:151
uint8_t startAddr[4]
startAddr to check - must be page-aligned
Definition: evbme_messages.h:149
uint8_t checkLen[4]
amount of data to check - must be whole pages
Definition: evbme_messages.h:150
Erase command to erase whole pages.
Definition: evbme_messages.h:130
uint8_t startAddr[4]
startAddr to write to - must be page-aligned
Definition: evbme_messages.h:131
uint8_t eraseLen[4]
amount of data to erase - must be whole pages
Definition: evbme_messages.h:132
Reboot command to boot into DFU or APROM.
Definition: evbme_messages.h:122
uint8_t rebootMode
0=APROM, 1=DFU - see evbme_dfu_rebootmode
Definition: evbme_messages.h:123
Status command used as a reply from the Chili2 to host.
Definition: evbme_messages.h:158
uint8_t status
ca_error status
Definition: evbme_messages.h:159
Write command to write words of data.
Definition: evbme_messages.h:139
uint8_t startAddr[4]
Start address for writing - must be word aligned.
Definition: evbme_messages.h:140
uint8_t data[]
Data to write, must be whole words.
Definition: evbme_messages.h:141
Union of all DFU sub-commands.
Definition: evbme_messages.h:174
struct evbme_dfu_write_cmd write_cmd
Definition: evbme_messages.h:177
struct evbme_dfu_status_cmd status_cmd
Definition: evbme_messages.h:179
struct evbme_dfu_erase_cmd erase_cmd
Definition: evbme_messages.h:176
struct evbme_dfu_reboot_cmd reboot_cmd
Definition: evbme_messages.h:175
struct evbme_dfu_bootmode_cmd bootmode_cmd
Definition: evbme_messages.h:180
struct evbme_dfu_check_cmd check_cmd
Definition: evbme_messages.h:178