Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
ca821x-posix-evbme.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Cascoda
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  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
43 #ifndef POSIX_CA821X_POSIX_INCLUDE_CA821X_POSIX_CA821X_POSIX_EVBME_H_
44 #define POSIX_CA821X_POSIX_INCLUDE_CA821X_POSIX_CA821X_POSIX_EVBME_H_
45 
46 #include "ca821x_api.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 //Callback definitions ------------------------------------------------------------------------
53 
54 typedef ca_error (*EVBME_Message_callback)(struct EVBME_Message *params, struct ca821x_dev *pDeviceRef);
55 
57 {
61 };
62 
63 //Structure to store version numbers in a convenient format
65 {
68 };
69 
78 struct EVBME_callbacks *EVBME_GetCallbackStruct(struct ca821x_dev *pDeviceRef);
79 
80 //Asynchronous commands -----------------------------------------------------------------------
81 
96 ca_error EVBME_COMM_CHECK_request(uint8_t aHandle,
97  uint8_t aDelay,
98  uint8_t aIndCount,
99  uint8_t aIndSize,
100  uint8_t aPayloadLen,
101  struct ca821x_dev *pDeviceRef);
102 
114 
126 
136 ca_error EVBME_DFU_REBOOT_request(enum evbme_dfu_rebootmode aRebootMode, struct ca821x_dev *pDeviceRef);
137 
160 ca_error EVBME_DFU_ERASE_request(uint32_t aStartAddr, uint32_t aEraseLen, struct ca821x_dev *pDeviceRef);
161 
185 ca_error EVBME_DFU_WRITE_request(uint32_t aStartAddr,
186  size_t aWriteLen,
187  void *aWriteData,
188  struct ca821x_dev *pDeviceRef);
189 
213 ca_error EVBME_DFU_CHECK_request(uint32_t aStartAddr,
214  uint32_t aCheckLen,
215  uint32_t aChecksum,
216  struct ca821x_dev *pDeviceRef);
217 
228 ca_error EVBME_DFU_BOOTMODE_request(enum evbme_dfu_rebootmode aBootMode, struct ca821x_dev *pDeviceRef);
229 
230 //Synchronous commands -----------------------------------------------------------------------
231 
247  size_t aAttrLen,
248  uint8_t *aAttrData,
249  struct ca821x_dev *pDeviceRef);
250 
266  size_t aMaxAttrLen,
267  uint8_t *aAttrData,
268  uint8_t *aAttrLen,
269  struct ca821x_dev *pDeviceRef);
270 
286 int EVBME_CompareVersions(const char *aVersion1,
287  const char *aVersion2,
288  struct ca_version_number *aVersion1Number,
289  struct ca_version_number *aVersion2Number);
290 
305 ca_error EVBME_CheckVersion(const char *aMinVerString, struct ca821x_dev *pDeviceRef);
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 
311 #endif /* POSIX_CA821X_POSIX_INCLUDE_CA821X_POSIX_CA821X_POSIX_EVBME_H_ */
312 
The main ca821x-api include file.
ca_error
Cascoda error type.
Definition: ca821x_error.h:51
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
ca_error EVBME_DFU_WRITE_request(uint32_t aStartAddr, size_t aWriteLen, void *aWriteData, struct ca821x_dev *pDeviceRef)
Send a DFU request for Write to a given device.
Definition: ca821x-posix-evbme.c:147
ca_error EVBME_DFU_BOOTMODE_request(enum evbme_dfu_rebootmode aBootMode, struct ca821x_dev *pDeviceRef)
Send a DFU request to set the default boot mode of the given device.
Definition: ca821x-posix-evbme.c:183
ca_error EVBME_HOST_DISCONNECTED_notify(struct ca821x_dev *pDeviceRef)
Send a notification to the given device to reset and release control of it.
Definition: ca821x-posix-evbme.c:110
ca_error EVBME_DFU_ERASE_request(uint32_t aStartAddr, uint32_t aEraseLen, struct ca821x_dev *pDeviceRef)
Send a DFU request for Erase to a given device.
Definition: ca821x-posix-evbme.c:133
ca_error EVBME_COMM_CHECK_request(uint8_t aHandle, uint8_t aDelay, uint8_t aIndCount, uint8_t aIndSize, uint8_t aPayloadLen, struct ca821x_dev *pDeviceRef)
Send an asynchronous EVBME COMM CHECK request to the given device.
Definition: ca821x-posix-evbme.c:74
struct EVBME_callbacks * EVBME_GetCallbackStruct(struct ca821x_dev *pDeviceRef)
Get the mutable callback structure for the given device.
Definition: ca821x-posix-evbme.c:67
ca_error EVBME_GET_request_sync(enum evbme_attribute aAttrId, size_t aMaxAttrLen, uint8_t *aAttrData, uint8_t *aAttrLen, struct ca821x_dev *pDeviceRef)
Send an EVBME GET request to get the value of an EVBME attribute.
Definition: ca821x-posix-evbme.c:226
ca_error EVBME_DFU_CHECK_request(uint32_t aStartAddr, uint32_t aCheckLen, uint32_t aChecksum, struct ca821x_dev *pDeviceRef)
Send a DFU request to verify a flash range of a given device.
Definition: ca821x-posix-evbme.c:165
int EVBME_CompareVersions(const char *aVersion1, const char *aVersion2, struct ca_version_number *aVersion1Number, struct ca_version_number *aVersion2Number)
Compares two input version strings and returns the result.
Definition: ca821x-posix-evbme.c:273
ca_error EVBME_DFU_REBOOT_request(enum evbme_dfu_rebootmode aRebootMode, struct ca821x_dev *pDeviceRef)
Send a DFU request for reboot to the given device.
Definition: ca821x-posix-evbme.c:120
ca_error EVBME_SET_request_sync(enum evbme_attribute aAttrId, size_t aAttrLen, uint8_t *aAttrData, struct ca821x_dev *pDeviceRef)
Send an EVBME SET request to set the value of an EVBME attribute.
Definition: ca821x-posix-evbme.c:196
ca_error EVBME_HOST_CONNECTED_notify(struct ca821x_dev *pDeviceRef)
Send a notification to the given device to reset and take control of it.
Definition: ca821x-posix-evbme.c:100
ca_error(* EVBME_Message_callback)(struct EVBME_Message *params, struct ca821x_dev *pDeviceRef)
Definition: ca821x-posix-evbme.h:54
ca_error EVBME_CheckVersion(const char *aMinVerString, struct ca821x_dev *pDeviceRef)
Check the EVBME version of the device and compare it to the SDK version of the application.
Definition: ca821x-posix-evbme.c:302
EVBME Message command in Cascoda TLV format.
Definition: evbme_messages.h:258
Definition: ca821x-posix-evbme.h:57
EVBME_Message_callback EVBME_MESSAGE_indication
Definition: ca821x-posix-evbme.h:58
EVBME_Message_callback EVBME_COMM_indication
Definition: ca821x-posix-evbme.h:59
EVBME_Message_callback EVBME_DFU_cmd
Definition: ca821x-posix-evbme.h:60
CA-821x Device reference struct.
Definition: ca821x_api.h:123
Definition: ca821x-posix-evbme.h:65
int minor_version
Definition: ca821x-posix-evbme.h:67
int major_version
Definition: ca821x-posix-evbme.h:66