CC3X00 Simplelink OTA Extlib API User's Guide: ota_api.h Source File

CC3X00 Simplelink OTA Extlib API

CC3X00 Simplelink OTA Extlib API User's Guide  1.1.0
ota_api.h
1 /*
2  * ota_api.h - Header file for OTA library APIs
3  *
4  *
5  * Copyright (C) 2014 Texas Instruments Incorporated
6  *
7  * All rights reserved. Property of Texas Instruments Incorporated.
8  * Restricted rights to use, duplicate or disclose this code are
9  * granted through contract.
10  * The program may not be used without the written permission of
11  * Texas Instruments Incorporated or against the terms and conditions
12  * stipulated in the agreement under which this program has been supplied,
13  * and under no circumstances can it be used with non-TI connectivity device.
14  *
15 */
16 #ifndef __OTA_APP_EXT_H__
17 #define __OTA_APP_EXT_H__
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define OTA_LIB_VERSION "1.00"
24 #define OTA_VENDOR_TEMPLATE_STR "Vid00_Pid00_Ver00"
25 #define OTASTAT_FILENAME "/sys/otastat.txt"
26 
27 #define MAX_EAGAIN_RETRIES 10
28 #define MAX_RESOURCES 16
29 #define MAX_CONSECUTIVE_NET_ACCESS_ERRORS 10
30 
31 #define MAX_SERVER_NAME 32
32 #define MAX_PATH_PREFIX 48
33 #define MAX_REST_HDRS_SIZE 96
34 #define MAX_USER_NAME_STR 8
35 #define MAX_USER_PASS_STR 8
36 #define MAX_CERT_STR 32
37 #define MAX_KEY_STR 32
38 
39 /******************************************************************************
40  * Server info Structure
41 ******************************************************************************/
42 typedef struct
43 {
44  _i32 ip_address; /* 0x0 � use server name */
45  _i32 secured_connection;
46  _u8 server_domain[MAX_SERVER_NAME];
47  _u8 rest_update_chk[MAX_PATH_PREFIX];
48  _u8 rest_rsrc_metadata[MAX_PATH_PREFIX];
49  _u8 rest_hdr[MAX_REST_HDRS_SIZE];
50  _u8 rest_hdr_val[MAX_REST_HDRS_SIZE];
51  _u8 user_name[MAX_USER_NAME_STR];
52  _u8 user_pass[MAX_USER_PASS_STR];
53  _u8 ca_cert_filename[MAX_CERT_STR];
54  _u8 client_cert_filename[MAX_CERT_STR];
55  _u8 privatekey_filename[MAX_KEY_STR];
56  /* logger */
57  _u8 log_server_name[MAX_SERVER_NAME];
58  _u8 rest_files_put[MAX_REST_HDRS_SIZE];
59  _u8 log_mac_address[6];
61 
62 /******************************************************************************
63  * typedefs
64 ******************************************************************************/
65 typedef _i32 (*OpenFileCB) (_u8 *file_name, _i32 file_size, _u32 *ulToken, _i32
66  *lFileHandle, _i32 open_flags);
67 typedef _i32 (*WriteFileCB) (_i32 fileHandle, _i32 offset, _u8 *buf, _i32 len);
68 typedef _i32 (*ReadFileCB) (_i32 fileHandle, _i32 offset, _u8 *buf, _i32 len);
69 typedef _i32 (*CloseFileCB) (_i32 fileHandle, _u8 *pCeritificateFileName,
70  _u8 *pSignature ,_u32 SignatureLen);
71 typedef _i32 (*AbortFileCB)(_i32 fileHandle);
72 typedef _i32 (*CheckConvertFileCB)(_u8* file_name);
73 
74 /******************************************************************************
75  * FLC structure
76 ******************************************************************************/
77 typedef struct
78 {
79  OpenFileCB pOpenFile;
80  WriteFileCB pWriteFile;
81  ReadFileCB pReadFile;
82  CloseFileCB pCloseFile;
83  AbortFileCB pAbortFile;
84 } FlcCb_t;
85 
86 /******************************************************************************
87  * File metadata Structure
88 ******************************************************************************/
89 typedef struct
90 {
91  /* files server name */
92  _u8 cdn_url[256];
93 
94  /* file flags */
95  _i32 flags;
96 
97  /* file name */
98  _u8 rsrc_file_name[256];
99  _u8 *p_file_name;
100  _i32 sflash_file_size;
101 
102  /* certificate file name */
103  _u8 cert1_filename[64];
104  _u8 cert2_filename[64];
105  _u8 *p_cert_filename;
106 
107  /* signiture file name */
108  _u8 signature_filename[64];
109  _u8 *p_signature;
110  _u8 signature[256];
111  _i32 signature_len;
113 
114 /******************************************************************************
115  * Enumerations
116 ******************************************************************************/
117 typedef enum
118 {
119  EXTLIB_OTA_SET_OPT_SERVER_INFO = 0, /* see OtaOptServerInfo_t */
120  EXTLIB_OTA_SET_OPT_VENDOR_ID,
121  EXTLIB_OTA_SET_OPT_IMAGE_TEST,
122  EXTLIB_OTA_SET_OPT_IMAGE_COMMIT
123 } OtaSetOpt_e;
124 
125 typedef enum
126 {
127  EXTLIB_OTA_GET_OPT_IS_ACTIVE,
128  EXTLIB_OTA_GET_OPT_IS_PENDING_COMMIT,
129  EXTLIB_OTA_GET_OPT_PRINT_STAT
130 } OtaGetOpt_e;
131 
132 /******************************************************************************
133  * Macros
134 ******************************************************************************/
135 /* RunMode bitmap */
136 #define RUN_MODE_OS (0 << 0) /* bit 0: 1-NoneOs, 0-Os */
137 #define RUN_MODE_NONE_OS (1 << 0)
138 #define RUN_MODE_BLOCKING (0 << 1) /* bit 1: 1-NoneBlocking, 0-Blocking */
139 #define RUN_MODE_NONE_BLOCKING (1 << 1)
140 
141 /* RunStatus */
142 #define RUN_STAT_DOWNLOAD_DONE 0x0002
143 #define RUN_STAT_NO_UPDATES 0x0001
144 #define RUN_STAT_OK 0
145 #define RUN_STAT_CONTINUE 0
146 #define RUN_STAT_ERROR -1
147 #define RUN_STAT_ERROR_TIMEOUT -2
148 #define RUN_STAT_ERROR_CONNECT_OTA_SERVER -3
149 #define RUN_STAT_ERROR_RESOURCE_LIST -4
150 #define RUN_STAT_ERROR_METADATA -5
151 #define RUN_STAT_ERROR_CONNECT_CDN_SERVER -6
152 #define RUN_STAT_ERROR_DOWNLOAD_SAVE -7
153 #define RUN_STAT_ERROR_CONTINUOUS_ACCESS_FAILURES -1000
154 
155 /* commit process decisions */
156 #define OTA_ACTION_RESET_MCU 0x1
157 #define OTA_ACTION_RESET_NWP 0x2
158 
159 #define OTA_ACTION_IMAGE_COMMITED 1
160 #define OTA_ACTION_IMAGE_NOT_COMMITED 0
161 
162 /*****************************************************************************
163  * API Prototypes
164  *****************************************************************************/
165 
205 void *sl_extLib_OtaInit(_i32 runMode, FlcCb_t *pFlcHostCb);
206 
243 _i32 sl_extLib_OtaRun(void *pvOtaApp);
244 
273 _i32 sl_extLib_OtaSet(void *pvOtaApp, _i32 Option, _i32 OptionLen, _u8 *pOptionVal);
274 
306 _i32 sl_extLib_OtaGet(void *pvOtaApp, _i32 Option, _i32 *OptionLen, _u8 *pOptionVal);
307 
308 #ifdef __cplusplus
309 }
310 #endif /* __cplusplus */
311 
312 #endif /* __OTA_APP_EXT_H__ */
_i32 sl_extLib_OtaSet(void *pvOtaApp, _i32 Option, _i32 OptionLen, _u8 *pOptionVal)
Set OTA command/parameter.
void * sl_extLib_OtaInit(_i32 runMode, FlcCb_t *pFlcHostCb)
Initialize OTA application.
_i32 sl_extLib_OtaGet(void *pvOtaApp, _i32 Option, _i32 *OptionLen, _u8 *pOptionVal)
Get the current OTA status.
Definition: ota_api.h:77
Definition: ota_api.h:89
_i32 sl_extLib_OtaRun(void *pvOtaApp)
Run the OTA App state machine.
Definition: ota_api.h:42
Generated on Wed Mar 4 2015 15:37:50 for CC3X00 Simplelink OTA Extlib API User's Guide by   doxygen 1.8.7