1 /*
2  * protocol.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
5  *
6  *
7  *  Redistribution and use in source and binary forms, with or without
8  *  modification, are permitted provided that the following conditions
9  *  are met:
10  *
11  *    Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *
14  *    Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the
17  *    distribution.
18  *
19  *    Neither the name of Texas Instruments Incorporated nor the names of
20  *    its contributors may be used to endorse or promote products derived
21  *    from this software without specific prior written permission.
22  *
23  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  *
35 */
36 
37 
38 /*******************************************************************************\
39 *
40 *   FILE NAME:      protocol.h
41 *
42 *   DESCRIPTION:    Constant and data structure definitions and function
43 *                   prototypes for the SL protocol module, which implements
44 *                   processing of SimpleLink Commands.
45 *
46 *   AUTHOR:
47 *
48 \*******************************************************************************/
49 
50 #ifndef _SL_PROTOCOL_TYPES_H_
51 #define _SL_PROTOCOL_TYPES_H_
52 
53 #ifdef    __cplusplus
54 extern "C" {
55 #endif
56 
57 /****************************************************************************
58 **
59 **  User I/F pools definitions
60 **
61 ****************************************************************************/
62 
63 /****************************************************************************
64 **
65 **  Definitions for SimpleLink Commands
66 **
67 ****************************************************************************/
68 
69 
70 /* pattern for LE 8/16/32 or BE*/
71 #define H2N_SYNC_PATTERN     {0xBBDDEEFF,0x4321,0x34,0x12}
72 #define H2N_CNYS_PATTERN     {0xBBDDEEFF,0x8765,0x78,0x56}
73 
74 #define H2N_DUMMY_PATTERN    (_u32)0xFFFFFFFF
75 #define N2H_SYNC_PATTERN     (_u32)0xABCDDCBA
76 #define SYNC_PATTERN_LEN     (_u32)sizeof(_u32)
77 #define UART_SET_MODE_MAGIC_CODE    (_u32)0xAA55AA55
78 #define SPI_16BITS_BUG(pattern)     (_u32)((_u32)pattern & (_u32)0xFFFF7FFF)
79 #define SPI_8BITS_BUG(pattern)      (_u32)((_u32)pattern & (_u32)0xFFFFFF7F)
80 
81 
82 typedef struct
83 {
84     _u16 Opcode;
85     _u16 Len;
86 }_SlGenericHeader_t;
87 
88 
89 typedef struct
90 {
91     _u32  Long;
92     _u16  Short;
93     _u8  Byte1;
94     _u8  Byte2;
95 }_SlSyncPattern_t;
96 
97 typedef _SlGenericHeader_t _SlCommandHeader_t;
98 
99 typedef struct
100 {
101     _SlGenericHeader_t  GenHeader;
102     _u8                 TxPoolCnt;
103     _u8                 DevStatus;
104     _u16                MinMaxPayload;
105     _u16                SocketTXFailure;
106     _u16                SocketNonBlocking;
107 }_SlResponseHeader_t;
108 
109 #define _SL_RESP_SPEC_HDR_SIZE (sizeof(_SlResponseHeader_t) - sizeof(_SlGenericHeader_t))
110 #define _SL_RESP_HDR_SIZE       sizeof(_SlResponseHeader_t)
111 #define _SL_CMD_HDR_SIZE        sizeof(_SlCommandHeader_t)
112 
113 #define _SL_RESP_ARGS_START(_pMsg) (((_SlResponseHeader_t *)(_pMsg)) + 1)
114 
115 /* Used only in NWP! */
116 typedef struct
117 {
118     _SlCommandHeader_t  sl_hdr;
119     _u8                 func_args_start;
120 } T_SCMD;
121 
122 /* _SlResponseHeader_t DevStatus bits */
123 #define _SL_DEV_STATUS_BIT_WLAN_CONN                    0x01
124 #define _SL_DEV_STATUS_BIT_DROPPED_EVENTS               0x02
125 #define _SL_DEV_STATUS_BIT_LOCKED                       0x04
126 #define _SL_DEV_STATUS_BIT_PROVISIONING_ACTIVE          0x08
127 #define _SL_DEV_STATUS_BIT_PROVISIONING_USER_INITIATED  0x10
128 #define _SL_DEV_STATUS_BIT_PRESERVATION                 0x20
129 #define _SL_DEV_STATUS_BIT_PROVISIONING_ENABLE_API      0x40
130 
131 
132 /* Internal driver bits status  (g_SlDeviceStatus) */
133 #define _SL_DRV_STATUS_BIT_RESTART_REQUIRED          0x100
134 #define _SL_DRV_STATUS_BIT_DEVICE_STARTED            0x200
135 #define _SL_DRV_STATUS_BIT_STOP_IN_PROGRESS          0x400
136 #define _SL_DRV_STATUS_BIT_START_IN_PROGRESS         0x800
137 #define _SL_DRV_STATUS_BIT_GLOBAL_LOCK_INIT          0x1000
138 #define _SL_DRV_STATUS_BIT_RX_STAT_IN_PROGRESS       0x2000
139 #define _SL_DRV_STATUS_BIT_DEVICE_STAT_IN_PROGRESS   0x4000
140 
141 
142 /****************************************************************************
143 **  OPCODES
144 ****************************************************************************/
145 #define SL_IPV4_IPV6_OFFSET                            ( 9 )
146 #define SL_OPCODE_IPV4                                 ( 0x0 << SL_IPV4_IPV6_OFFSET )
147 #define SL_OPCODE_IPV6                                 ( 0x1 << SL_IPV4_IPV6_OFFSET )
148 
149 #define SL_SYNC_ASYNC_OFFSET                           ( 10 )
150 #define SL_OPCODE_SYNC                                 (0x1 << SL_SYNC_ASYNC_OFFSET )
151 #define SL_OPCODE_SILO_OFFSET                          ( 11 )
152 #define SL_OPCODE_SILO_MASK                            ( 0xF << SL_OPCODE_SILO_OFFSET )
153 #define SL_OPCODE_SILO_DEVICE                          ( 0x0 << SL_OPCODE_SILO_OFFSET )
154 #define SL_OPCODE_SILO_WLAN                            ( 0x1 << SL_OPCODE_SILO_OFFSET )
155 #define SL_OPCODE_SILO_SOCKET                          ( 0x2 << SL_OPCODE_SILO_OFFSET )
156 #define SL_OPCODE_SILO_NETAPP                          ( 0x3 << SL_OPCODE_SILO_OFFSET )
157 #define SL_OPCODE_SILO_FS                              ( 0x4 << SL_OPCODE_SILO_OFFSET )
158 #define SL_OPCODE_SILO_NETCFG                          ( 0x5 << SL_OPCODE_SILO_OFFSET )
159 #define SL_OPCODE_SILO_NETUTIL                         ( 0x6 << SL_OPCODE_SILO_OFFSET )
160 
161 #define SL_FAMILY_SHIFT                                (0x4)
162 #define SL_FLAGS_MASK                                  (0xF)
163 
164 #define SL_OPCODE_DEVICE_INITCOMPLETE                                   0x0008
165 #define SL_OPCODE_DEVICE_ABORT                                          0x000C
166 #define SL_OPCODE_DEVICE_STOP_COMMAND                                   0x8473
167 #define SL_OPCODE_DEVICE_STOP_RESPONSE                                  0x0473
168 #define SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE                            0x0073
169 #define SL_OPCODE_DEVICE_DEVICEASYNCDUMMY                               0x0063
170 
171 #define SL_OPCODE_DEVICE_VERSIONREADCOMMAND                             0x8470
172 #define SL_OPCODE_DEVICE_VERSIONREADRESPONSE                            0x0470
173 #define SL_OPCODE_DEVICE_DEVICE_ASYNC_GENERAL_ERROR                     0x0078
174 #define SL_OPCODE_DEVICE_FLOW_CTRL_ASYNC_EVENT                          0x0079
175 
176 #define SL_OPCODE_WLAN_WLANCONNECTCOMMAND                               0x8C80
177 #define SL_OPCODE_WLAN_WLANCONNECTRESPONSE                              0x0C80
178 #define SL_OPCODE_WLAN_STA_ASYNCCONNECTEDRESPONSE                       0x0880
179 #define SL_OPCODE_WLAN_P2PCL_ASYNCCONNECTEDRESPONSE                     0x0892
180 
181 #define SL_OPCODE_WLAN_WLANDISCONNECTCOMMAND                            0x8C81
182 #define SL_OPCODE_WLAN_WLANDISCONNECTRESPONSE                           0x0C81
183 #define SL_OPCODE_WLAN_STA_ASYNCDISCONNECTEDRESPONSE                    0x0881
184 #define SL_OPCODE_WLAN_P2PCL_ASYNCDISCONNECTEDRESPONSE                  0x0894
185 
186 #define SL_OPCODE_WLAN_ASYNC_STA_ADDED                                  0x082E
187 #define SL_OPCODE_WLAN_ASYNC_P2PCL_ADDED                                0x0896
188 #define SL_OPCODE_WLAN_ASYNC_STA_REMOVED                                0x082F
189 #define SL_OPCODE_WLAN_ASYNC_P2PCL_REMOVED                              0x0898
190 
191 #define SL_OPCODE_WLAN_P2P_DEV_FOUND                                    0x0830
192 #define SL_OPCODE_WLAN_P2P_CONNECTION_FAILED                            0x0831
193 #define SL_OPCODE_WLAN_P2P_NEG_REQ_RECEIVED                             0x0832
194 
195 #define SL_OPCODE_WLAN_WLANCONNECTEAPCOMMAND                            0x8C82
196 #define SL_OPCODE_WLAN_WLANCONNECTEAPCRESPONSE                          0x0C82
197 #define SL_OPCODE_WLAN_PROFILEADDCOMMAND                                0x8C83
198 #define SL_OPCODE_WLAN_PROFILEADDRESPONSE                               0x0C83
199 #define SL_OPCODE_WLAN_PROFILEUPDATECOMMAND                             0x8CC2
200 #define SL_OPCODE_WLAN_PROFILEUPDATERESPONSE                            0x0CC2
201 #define SL_OPCODE_WLAN_PROFILEEAPUPDATECOMMAND                          0x8CC3
202 #define SL_OPCODE_WLAN_PROFILEEAPUPDATERESPONSE                         0x0CC0
203 #define SL_OPCODE_WLAN_PROFILEGETCOMMAND                                0x8C84
204 #define SL_OPCODE_WLAN_PROFILEGETRESPONSE                               0x0C84
205 #define SL_OPCODE_WLAN_PROFILEDELCOMMAND                                0x8C85
206 #define SL_OPCODE_WLAN_PROFILEDELRESPONSE                               0x0C85
207 #define SL_OPCODE_WLAN_POLICYSETCOMMAND                                 0x8C86
208 #define SL_OPCODE_WLAN_POLICYSETRESPONSE                                0x0C86
209 #define SL_OPCODE_WLAN_POLICYGETCOMMAND                                 0x8C87
210 #define SL_OPCODE_WLAN_POLICYGETRESPONSE                                0x0C87
211 #define SL_OPCODE_WLAN_FILTERADD                                        0x8C88
212 #define SL_OPCODE_WLAN_FILTERADDRESPONSE                                0x0C88
213 #define SL_OPCODE_WLAN_FILTERGET                                        0x8C89
214 #define SL_OPCODE_WLAN_FILTERGETRESPONSE                                0x0C89
215 #define SL_OPCODE_WLAN_FILTERDELETE                                     0x8C8A
216 #define SL_OPCODE_WLAN_FILTERDELETERESPOSNE                             0x0C8A
217 #define SL_OPCODE_WLAN_WLANGETSTATUSCOMMAND                             0x8C8F
218 #define SL_OPCODE_WLAN_WLANGETSTATUSRESPONSE                            0x0C8F
219 #define SL_OPCODE_WLAN_STARTTXCONTINUESCOMMAND                          0x8CAA
220 #define SL_OPCODE_WLAN_STARTTXCONTINUESRESPONSE                         0x0CAA
221 #define SL_OPCODE_WLAN_STOPTXCONTINUESCOMMAND                           0x8CAB
222 #define SL_OPCODE_WLAN_STOPTXCONTINUESRESPONSE                          0x0CAB
223 #define SL_OPCODE_WLAN_STARTRXSTATCOMMAND                               0x8CAC
224 #define SL_OPCODE_WLAN_STARTRXSTATRESPONSE                              0x0CAC
225 #define SL_OPCODE_WLAN_STOPRXSTATCOMMAND                                0x8CAD
226 #define SL_OPCODE_WLAN_STOPRXSTATRESPONSE                               0x0CAD
227 #define SL_OPCODE_WLAN_GETRXSTATCOMMAND                                 0x8CAF
228 #define SL_OPCODE_WLAN_GETRXSTATRESPONSE                                0x0CAF
229 #define SL_OPCODE_WLAN_POLICYSETCOMMANDNEW                              0x8CB0
230 #define SL_OPCODE_WLAN_POLICYSETRESPONSENEW                             0x0CB0
231 #define SL_OPCODE_WLAN_POLICYGETCOMMANDNEW                              0x8CB1
232 #define SL_OPCODE_WLAN_POLICYGETRESPONSENEW                             0x0CB1
233 
234 #define SL_OPCODE_WLAN_PROVISIONING_PROFILE_ADDED_ASYNC_RESPONSE        0x08B2
235 #define SL_OPCODE_WLAN_SET_MODE                                         0x8CB4
236 #define SL_OPCODE_WLAN_SET_MODE_RESPONSE                                0x0CB4
237 #define SL_OPCODE_WLAN_CFG_SET                                          0x8CB5
238 #define SL_OPCODE_WLAN_CFG_SET_RESPONSE                                 0x0CB5
239 #define SL_OPCODE_WLAN_CFG_GET                                          0x8CB6
240 #define SL_OPCODE_WLAN_CFG_GET_RESPONSE                                 0x0CB6
241 #define SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND                            0x8C67
242 #define SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND_RESPONSE                   0x0C67
243 #define SL_OPCODE_WLAN_LINK_QUALITY_RESPONSE                            0x08BA
244 
245 #define SL_OPCODE_SOCKET_SOCKET                                         0x9401
246 #define SL_OPCODE_SOCKET_SOCKETRESPONSE                                 0x1401
247 #define SL_OPCODE_SOCKET_CLOSE                                          0x9402
248 #define SL_OPCODE_SOCKET_CLOSERESPONSE                                  0x1402
249 #define SL_OPCODE_SOCKET_ACCEPT                                         0x9403
250 #define SL_OPCODE_SOCKET_ACCEPTRESPONSE                                 0x1403
251 #define SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE                            0x1003
252 #define SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE_V6                         0x1203
253 #define SL_OPCODE_SOCKET_BIND                                           0x9404
254 #define SL_OPCODE_SOCKET_BIND_V6                                        0x9604
255 #define SL_OPCODE_SOCKET_BINDRESPONSE                                   0x1404
256 #define SL_OPCODE_SOCKET_LISTEN                                         0x9405
257 #define SL_OPCODE_SOCKET_LISTENRESPONSE                                 0x1405
258 #define SL_OPCODE_SOCKET_CONNECT                                        0x9406
259 #define SL_OPCODE_SOCKET_CONNECT_V6                                     0x9606
260 #define SL_OPCODE_SOCKET_CONNECTRESPONSE                                0x1406
261 #define SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE                           0x1006
262 #define SL_OPCODE_SOCKET_SELECT                                         0x9407
263 #define SL_OPCODE_SOCKET_SELECTRESPONSE                                 0x1407
264 #define SL_OPCODE_SOCKET_SELECTASYNCRESPONSE                            0x1007
265 #define SL_OPCODE_SOCKET_SETSOCKOPT                                     0x9408
266 #define SL_OPCODE_SOCKET_SETSOCKOPTRESPONSE                             0x1408
267 #define SL_OPCODE_SOCKET_GETSOCKOPT                                     0x9409
268 #define SL_OPCODE_SOCKET_GETSOCKOPTRESPONSE                             0x1409
269 #define SL_OPCODE_SOCKET_RECV                                           0x940A
270 #define SL_OPCODE_SOCKET_RECVASYNCRESPONSE                              0x100A
271 #define SL_OPCODE_SOCKET_RECVFROM                                       0x940B
272 #define SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE                          0x100B
273 #define SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6                       0x120B
274 #define SL_OPCODE_SOCKET_SEND                                           0x940C
275 #define SL_OPCODE_SOCKET_SENDTO                                         0x940D
276 #define SL_OPCODE_SOCKET_SENDTO_V6                                      0x960D
277 #define SL_OPCODE_SOCKET_TXFAILEDASYNCRESPONSE                          0x100E
278 #define SL_OPCODE_SOCKET_SOCKETASYNCEVENT                               0x100F
279 #define SL_OPCODE_SOCKET_SOCKETCLOSEASYNCEVENT                          0x1010
280 #define SL_OPCODE_NETAPP_START_COMMAND                                  0x9C0A
281 #define SL_OPCODE_NETAPP_START_RESPONSE                                 0x1C0A
282 #define SL_OPCODE_NETAPP_NETAPPSTARTRESPONSE                            0x1C0A
283 #define SL_OPCODE_NETAPP_STOP_COMMAND                                   0x9C61
284 #define SL_OPCODE_NETAPP_STOP_RESPONSE                                  0x1C61
285 #define SL_OPCODE_NETAPP_NETAPPSET                                      0x9C0B
286 #define SL_OPCODE_NETAPP_NETAPPSETRESPONSE                              0x1C0B
287 #define SL_OPCODE_NETAPP_NETAPPGET                                      0x9C27
288 #define SL_OPCODE_NETAPP_NETAPPGETRESPONSE                              0x1C27
289 #define SL_OPCODE_NETAPP_DNSGETHOSTBYNAME                               0x9C20
290 #define SL_OPCODE_NETAPP_DNSGETHOSTBYNAMERESPONSE                       0x1C20
291 #define SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE                  0x1820
292 #define SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6               0x1A20
293 #define SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE                     0x9C71
294 #define SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE_RESPONSE            0x1C72
295 #define SL_OPCODE_NETAPP_MDNSREGISTERSERVICE                            0x9C34
296 #define SL_OPCODE_NETAPP_MDNSREGISTERSERVICERESPONSE                    0x1C34
297 #define SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICE                           0x9C35
298 #define SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICERESPONSE                   0x1C35
299 #define SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE              0x1835
300 #define SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6           0x1A35
301 #define SL_OPCODE_NETAPP_DNSGETHOSTBYADDR                               0x9C26
302 #define SL_OPCODE_NETAPP_DNSGETHOSTBYADDR_V6                            0x9E26
303 #define SL_OPCODE_NETAPP_DNSGETHOSTBYADDRRESPONSE                       0x1C26
304 #define SL_OPCODE_NETAPP_DNSGETHOSTBYADDRASYNCRESPONSE                  0x1826
305 #define SL_OPCODE_NETAPP_PINGSTART                                      0x9C21
306 #define SL_OPCODE_NETAPP_PINGSTART_V6                                   0x9E21
307 #define SL_OPCODE_NETAPP_PINGSTARTRESPONSE                              0x1C21
308 #define SL_OPCODE_NETAPP_PINGREPORTREQUEST                              0x9C22
309 #define SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE                      0x1822
310 #define SL_OPCODE_NETAPP_ARPFLUSH                                       0x9C24
311 #define SL_OPCODE_NETAPP_ARPFLUSHRESPONSE                               0x1C24
312 #define SL_OPCODE_NETAPP_NDFLUSH_V6                                     0x9EC2
313 #define SL_OPCODE_NETAPP_NDFLUSHHRESPONSE_V6                            0x1EC3
314 #define SL_OPCODE_NETAPP_IPACQUIRED                                 	0x1825
315 #define SL_OPCODE_NETAPP_IPV4_LOST                                      0x1832
316 #define SL_OPCODE_NETAPP_DHCP_IPV4_ACQUIRE_TIMEOUT                      0x1833
317 #define SL_OPCODE_LINK_QUALITY_EVENT                                    0x1834
318 #define SL_OPCODE_NETAPP_IPACQUIRED_V6                                  0x1A25
319 #define SL_OPCODE_NETAPP_IPV6_LOST_V6                                   0x1A32
320 #define SL_OPCODE_NETAPP_IPERFSTARTCOMMAND                              0x9C28
321 #define SL_OPCODE_NETAPP_IPERFSTARTRESPONSE                             0x1C28
322 #define SL_OPCODE_NETAPP_IPERFSTOPCOMMAND                               0x9C29
323 #define SL_OPCODE_NETAPP_IPERFSTOPRESPONSE                              0x1C29
324 #define SL_OPCODE_NETAPP_CTESTSTARTCOMMAND                              0x9C2A
325 #define SL_OPCODE_NETAPP_CTESTSTARTRESPONSE                             0x1C2A
326 #define SL_OPCODE_NETAPP_CTESTASYNCRESPONSE                             0x182A
327 #define SL_OPCODE_NETAPP_CTESTSTOPCOMMAND                               0x9C2B
328 #define SL_OPCODE_NETAPP_CTESTSTOPRESPONSE                              0x1C2B
329 #define SL_OPCODE_NETAPP_IP_LEASED                                      0x182C
330 #define SL_OPCODE_NETAPP_IP_RELEASED                                    0x182D
331 #define SL_OPCODE_NETAPP_HTTPGETTOKENVALUE                              0x182E
332 #define SL_OPCODE_NETAPP_HTTPSENDTOKENVALUE                             0x9C2F
333 #define SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE                             0x1830
334 #define SL_OPCODE_NETAPP_IP_COLLISION                                   0x1831
335 #define SL_OPCODE_NETAPP_NO_IP_COLLISION_DETECTED                       0x18C4
336 #define SL_OPCODE_NETAPP_NO_LOCAL_IP_COLLISION_DETECTED_V6              0x1AC5
337 #define SL_OPCODE_NETAPP_NO_GLOBAL_IP_COLLISION_DETECTED_V6             0x1AC6
338 
339 #define SL_OPCODE_NETAPP_REQUEST                                        0x1878
340 #define SL_OPCODE_NETAPP_RESPONSE                                       0x9C78
341 #define SL_OPCODE_NETAPP_SEND                                           0x9C79
342 #define SL_OPCODE_NETAPP_SENDRESPONSE                                   0x1C79
343 #define SL_OPCODE_NETAPP_RECEIVEREQUEST                                 0x9C7A
344 #define SL_OPCODE_NETAPP_RECEIVE                                        0x187B
345 
346 #define SL_OPCODE_NVMEM_FILEOPEN                                        0xA43C
347 #define SL_OPCODE_NVMEM_FILEOPENRESPONSE                                0x243C
348 #define SL_OPCODE_NVMEM_FILECLOSE                                       0xA43D
349 #define SL_OPCODE_NVMEM_FILECLOSERESPONSE                               0x243D
350 #define SL_OPCODE_NVMEM_FILEREADCOMMAND                                 0xA440
351 #define SL_OPCODE_NVMEM_FILEREADRESPONSE                                0x2440
352 #define SL_OPCODE_NVMEM_FILEWRITECOMMAND                                0xA441
353 #define SL_OPCODE_NVMEM_FILEWRITERESPONSE                               0x2441
354 #define SL_OPCODE_NVMEM_FILEGETINFOCOMMAND                              0xA442
355 #define SL_OPCODE_NVMEM_FILEGETINFORESPONSE                             0x2442
356 #define SL_OPCODE_NVMEM_FILEDELCOMMAND                                  0xA443
357 #define SL_OPCODE_NVMEM_FILEDELRESPONSE                                 0x2443
358 #define SL_OPCODE_NVMEM_NVMEMFORMATCOMMAND                              0xA444
359 #define SL_OPCODE_NVMEM_NVMEMFORMATRESPONSE                             0x2444
360 #define SL_OPCODE_NVMEM_NVMEMGETFILELISTCOMMAND                         0xA448
361 #define SL_OPCODE_NVMEM_NVMEMGETFILELISTRESPONSE                        0x2448
362 
363 #define SL_OPCODE_NVMEM_NVMEMFSPROGRAMMINGCOMMAND                       0xA44A
364 #define SL_OPCODE_NVMEM_NVMEMFSPROGRAMMINGRESPONSE                      0x244A
365 #define SL_OPCODE_NVMEM_NVMEMFILESYSTEMCONTROLCOMMAND                   0xA44B
366 #define SL_OPCODE_NVMEM_NVMEMFILESYSTEMCONTROLRESPONSE                  0x244B
367 #define SL_OPCODE_NVMEM_NVMEMBUNDLECONTROLCOMMAND                       0xA44C
368 #define SL_OPCODE_NVMEM_NVMEMBUNDLECONTROLRESPONSE                      0x244C
369 
370 
371 #define SL_OPCODE_DEVICE_SETDEBUGLEVELCOMMAND                           0x846A
372 #define SL_OPCODE_DEVICE_SETDEBUGLEVELRESPONSE                          0x046A
373 
374 #define SL_OPCODE_DEVICE_NETCFG_SET_COMMAND                             0x8432
375 #define SL_OPCODE_DEVICE_NETCFG_SET_RESPONSE                            0x0432
376 #define SL_OPCODE_DEVICE_NETCFG_GET_COMMAND                             0x8433
377 #define SL_OPCODE_DEVICE_NETCFG_GET_RESPONSE                            0x0433
378 /*  */
379 #define SL_OPCODE_DEVICE_SETUARTMODECOMMAND                             0x846B
380 #define SL_OPCODE_DEVICE_SETUARTMODERESPONSE                            0x046B
381 #define SL_OPCODE_DEVICE_SSISIZESETCOMMAND                              0x846B
382 #define SL_OPCODE_DEVICE_SSISIZESETRESPONSE                             0x046B
383 
384 /*  */
385 #define SL_OPCODE_DEVICE_EVENTMASKSET                                   0x8464
386 #define SL_OPCODE_DEVICE_EVENTMASKSETRESPONSE                           0x0464
387 #define SL_OPCODE_DEVICE_EVENTMASKGET                                   0x8465
388 #define SL_OPCODE_DEVICE_EVENTMASKGETRESPONSE                           0x0465
389 
390 #define SL_OPCODE_DEVICE_DEVICEGET                                      0x8466
391 #define SL_OPCODE_DEVICE_DEVICEGETRESPONSE                              0x0466
392 #define SL_OPCODE_DEVICE_DEVICESET                                      0x84B7
393 #define SL_OPCODE_DEVICE_DEVICESETRESPONSE                              0x04B7
394 
395 #define SL_OPCODE_WLAN_SCANRESULTSGETCOMMAND                            0x8C8C
396 #define SL_OPCODE_WLAN_SCANRESULTSGETRESPONSE                           0x0C8C
397 #define SL_OPCODE_WLAN_EXTSCANRESULTSGETCOMMAND                         0x8C8D
398 #define SL_OPCODE_WLAN_EXTSCANRESULTSGETRESPONSE                        0x0C8D
399 #define SL_OPCODE_WLAN_SMARTCONFIGOPTGET                                0x8C8E
400 #define SL_OPCODE_WLAN_SMARTCONFIGOPTGETRESPONSE                        0x0C8E
401 
402 #define SL_OPCODE_WLAN_PROVISIONING_COMMAND                             0x8C98
403 #define SL_OPCODE_WLAN_PROVISIONING_RESPONSE                            0x0C98
404 #define SL_OPCODE_DEVICE_RESET_REQUEST_ASYNC_EVENT                      0x0099
405 #define SL_OPCODE_WLAN_PROVISIONING_STATUS_ASYNC_EVENT                  0x089A
406 
407 #define SL_OPCODE_FREE_BSD_RECV_BUFFER                                  0xCCCB
408 #define SL_OPCODE_FREE_NON_BSD_READ_BUFFER                              0xCCCD
409 
410 
411 /* Rx Filters opcodes */
412 #define SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND                           0x8C6C
413 #define SL_OPCODE_WLAN_WLANRXFILTERADDRESPONSE                          0x0C6C
414 #define SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFOCOMMAND             0x8C6E
415 #define SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFORESPONSE            0x0C6E
416 #define SL_OPCODE_WLAN_WLANRXFILTERGETINFO                              0x8C70
417 #define SL_OPCODE_WLAN_WLANRXFILTERGETINFORESPONSE                      0x0C70
418 #define SL_OPCODE_WLAN_RX_FILTER_ASYNC_RESPONSE                         0x089D
419 
420 /* Utils */
421 #define SL_OPCODE_NETUTIL_SET                                           0xB4BE
422 #define SL_OPCODE_NETUTIL_SETRESPONSE                                   0x34BE
423 #define SL_OPCODE_NETUTIL_GET                                           0xB4C0
424 #define SL_OPCODE_NETUTIL_GETRESPONSE                                   0x34C0
425 #define SL_OPCODE_NETUTIL_COMMAND                                       0xB4C1
426 #define SL_OPCODE_NETUTIL_COMMANDRESPONSE                               0x34C1
427 #define SL_OPCODE_NETUTIL_COMMANDASYNCRESPONSE                          0x30C1
428 
429 /******************************************************************************************/
430 /*   Device structs  */
431 /******************************************************************************************/
432 typedef _u32 InitStatus_t;
433 
434 typedef struct
435 {
436     _i32 Status;
437     _i32 ChipId;
438     _i32 MoreData;
439 }InitComplete_t;
440 
441 typedef struct
442 {
443     _i16 status;
444     _u16 sender;
445 }_BasicResponse_t;
446 
447 typedef struct
448 {
449     _u32 SessionNumber;
450     _u16 Caller;
451     _u16 Padding;
452 }SlDeviceResetRequestData_t;
453 
454 typedef struct
455 {
456     _u16 Timeout;
457     _u16 Padding;
458 }SlDeviceStopCommand_t;
459 
460 typedef struct
461 {
462     _u32 Group;
463     _u32 Mask;
464 }SlDeviceMaskEventSetCommand_t;
465 
466 typedef _BasicResponse_t _DevMaskEventSetResponse_t;
467 
468 typedef struct
469 {
470     _u32 Group;
471 } SlDeviceMaskEventGetCommand_t;
472 
473 typedef struct
474 {
475     _u32 Group;
476     _u32 Mask;
477 } SlDeviceMaskEventGetResponse_t;
478 
479 typedef struct
480 {
481     _u32 Group;
482 } SlDeviceStatusGetCommand_t;
483 
484 typedef struct
485 {
486     _u32 Group;
487     _u32 Status;
488 } SlDeviceStatusGetResponse_t;
489 
490 typedef struct
491 {
492     _u32  ChipId;
493     _u32  FwVersion[4];
494     _u8   PhyVersion[4];
495 } SlDeviceVersionReadResponsePart_t;
496 
497 typedef struct
498 {
499     SlDeviceVersionReadResponsePart_t   part;
500     _u32                                NwpVersion[4];
501     _u16                                RomVersion;
502     _u16                                Padding;
503 } SlDeviceVersionReadResponseFull_t;
504 
505 typedef struct
506 {
507     _u16    MinTxPayloadSize;
508     _u8     padding[6];
509 } SlDeviceFlowCtrlAsyncEvent_t;
510 
511 typedef struct
512 {
513     _u32 BaudRate;
514     _u8  FlowControlEnable;
515 } SlDeviceUartSetModeCommand_t;
516 
517 typedef _BasicResponse_t SlDeviceUartSetModeResponse_t;
518 
519 /******************************************************/
520 
521 typedef struct
522 {
523     _u8 SsiSizeInBytes;
524     _u8 Padding[3];
525 }_StellarisSsiSizeSet_t;
526 
527 /*****************************************************************************************/
528 /*   WLAN structs */
529 /*****************************************************************************************/
530 #define MAXIMAL_PASSWORD_LENGTH                    (64)
531 
532 typedef struct
533 {
534     _u8     ProvisioningCmd;
535     _u8     RequestedRoleAfterSuccess;
536     _u16    InactivityTimeoutSec;
537     _u32    Flags;
538 } SlWlanProvisioningParams_t;
539 
540 typedef struct{
541     _u8    SecType;
542     _u8    SsidLen;
543     _u8    Bssid[6];
544     _u8    PasswordLen;
545 } SlWlanConnectCommon_t;
546 
547 #define SSID_STRING(pCmd)       (_i8 *)((SlWlanConnectCommon_t *)(pCmd) + 1)
548 #define PASSWORD_STRING(pCmd)   (SSID_STRING(pCmd) + ((SlWlanConnectCommon_t *)(pCmd))->SsidLen)
549 
550 typedef struct{
551     SlWlanConnectCommon_t       Common;
552     _u8                         UserLen;
553     _u8                         AnonUserLen;
554     _u8                         CertIndex;
555     _u32                        EapBitmask;
556 } SlWlanConnectEapCommand_t;
557 
558 #define EAP_SSID_STRING(pCmd)       (_i8 *)((SlWlanConnectEapCommand_t *)(pCmd) + 1)
559 #define EAP_PASSWORD_STRING(pCmd)   (EAP_SSID_STRING(pCmd) + ((SlWlanConnectEapCommand_t *)(pCmd))->Common.SsidLen)
560 #define EAP_USER_STRING(pCmd)       (EAP_PASSWORD_STRING(pCmd) + ((SlWlanConnectEapCommand_t *)(pCmd))->Common.PasswordLen)
561 #define EAP_ANON_USER_STRING(pCmd)  (EAP_USER_STRING(pCmd) + ((SlWlanConnectEapCommand_t *)(pCmd))->UserLen)
562 
563 typedef struct
564 {
565     _u8    PolicyType;
566     _u8    Padding;
567     _u8    PolicyOption;
568     _u8    PolicyOptionLen;
569 } SlWlanPolicySetGet_t;
570 
571 typedef struct{
572     _u32    MinDwellTime;
573     _u32    MaxDwellTime;
574     _u32    NumProbeResponse;
575     _u32    G_Channels_mask;
576     _i32    RssiThershold;
577     _i32    SnrThershold;
578     _i32    DefaultTXPower;
579     _u16    IntervalList[16];
580 } SlWlanScanParamSetCommand_t;
581 
582 typedef struct{
583     _i16    SecType;
584     _u8     SsidLen;
585     _u8     Priority;
586     _u8     Bssid[6];
587     _u8     PasswordLen;
588     _u8     WepKeyId;
589 } SlWlanAddGetProfile_t;
590 
591 typedef struct{
592     SlWlanAddGetProfile_t    Common;
593     _u8                      UserLen;
594     _u8                      AnonUserLen;
595     _u8                      CertIndex;
596     _u8                      padding;
597     _u32                     EapBitmask;
598 } SlWlanAddGetEapProfile_t;
599 
600 
601 typedef struct{
602     _i16   SecType;
603     _u8    SsidLen;
604     _u8    Priority;
605     _u8    Bssid[6];
606     _u8    PasswordLen;
607     _u8    WepKeyId;
608     _u32   Index;
609     _u8    UserLen;
610     _u8    AnonUserLen;
611     _u8    CertIndex;
612     _u8    padding;
613     _u32   EapBitmask;
614 } SlWlanUpdateProfile_t;
615 
616 #define PROFILE_SSID_STRING(pCmd)       ((_i8 *)((SlWlanAddGetProfile_t *)(pCmd) + 1))
617 #define PROFILE_PASSWORD_STRING(pCmd)   (PROFILE_SSID_STRING(pCmd) + ((SlWlanAddGetProfile_t *)(pCmd))->SsidLen)
618 
619 #define EAP_PROFILE_SSID_STRING(pCmd)       (_i8 *)((SlWlanAddGetEapProfile_t *)(pCmd) + 1)
620 #define EAP_PROFILE_PASSWORD_STRING(pCmd)   (EAP_PROFILE_SSID_STRING(pCmd) + ((SlWlanAddGetEapProfile_t *)(pCmd))->Common.SsidLen)
621 #define EAP_PROFILE_USER_STRING(pCmd)       (EAP_PROFILE_PASSWORD_STRING(pCmd) + ((SlWlanAddGetEapProfile_t *)(pCmd))->Common.PasswordLen)
622 #define EAP_PROFILE_ANON_USER_STRING(pCmd)  (EAP_PROFILE_USER_STRING(pCmd) + ((SlWlanAddGetEapProfile_t *)(pCmd))->UserLen)
623 
624 #define PROFILE_SSID_STRING(pCmd)       ((_i8 *)((SlWlanAddGetProfile_t *)(pCmd) + 1))
625 #define PROFILE_PASSWORD_STRING(pCmd)   (PROFILE_SSID_STRING(pCmd) + ((SlWlanAddGetProfile_t *)(pCmd))->SsidLen)
626 
627 #define UPDATE_PROFILE_SSID_STRING(pCmd)       (_i8 *)((SlWlanUpdateProfile_t *)(pCmd) + 1)
628 #define UPDATE_PROFILE_PASSWORD_STRING(pCmd)   (UPDATE_PROFILE_SSID_STRING(pCmd) + ((SlWlanUpdateProfile_t *)(pCmd))->SsidLen)
629 #define UPDATE_PROFILE_USER_STRING(pCmd)       (UPDATE_PROFILE_PASSWORD_STRING(pCmd) + ((SlWlanUpdateProfile_t *)(pCmd))->PasswordLen)
630 #define UPDATE_PROFILE_ANON_USER_STRING(pCmd)  (UPDATE_PROFILE_USER_STRING(pCmd) + ((SlWlanUpdateProfile_t *)(pCmd))->UserLen)
631 
632 
633 typedef struct
634 {
635     _u8    Index;
636     _u8    Padding[3];
637 } SlWlanProfileDelGetCommand_t;
638 
639 typedef _BasicResponse_t _WlanGetNetworkListResponse_t;
640 
641 typedef struct
642 {
643     _u8     Index;
644     _u8     Count;
645     _i8     padding[2];
646 } SlWlanGetNetworkListCommand_t;
647 
648 typedef _BasicResponse_t _WlanGetExtNetworkListResponse_t;
649 
650 typedef struct
651 {
652     _u8  Index;
653     _u8  Count;
654     _i8  padding[2];
655 } SlWlanGetExtNetworkListCommand_t;
656 
657 typedef struct
658 {
659     _u32    GroupIdBitmask;
660     _u8     Cipher;
661     _u8     PublicKeyLen;
662     _u8     Padding[2];
663 } SlWlanSmartConfigParams_t;
664 
665 #define SMART_CONFIG_START_PUBLIC_KEY_STRING(pCmd)       ((_i8 *)((SlWlanSmartConfigParams_t *)(pCmd) + 1))
666 
667 typedef    struct
668 {
669     _u8    Mode;
670     _u8    Padding[3];
671 } SlWlanSetMode_t;
672 
673 typedef struct
674 {
675     _u16  Status;
676     _u16  ConfigId;
677     _u16  ConfigOpt;
678     _u16  ConfigLen;
679 } SlWlanCfgSetGet_t;
680 
681 
682 /* ******************************************************************************/
683 /*     RX filters - Start  */
684 /* ******************************************************************************/
685 
686 typedef struct
687 {
688     SlWlanRxFilterRuleType_t  RuleType;
689     SlWlanRxFilterFlags_u     Flags;
690     SlWlanRxFilterID_t        FilterId;
691     _u8                       Padding;
692     SlWlanRxFilterRule_u      Rule;
693     SlWlanRxFilterTrigger_t   Trigger;
694     SlWlanRxFilterAction_t    Action;
695 } SlWlanRxFilterAddCommand_t;
696 
697 typedef struct
698 {
699     SlWlanRxFilterID_t  FilterId;
700     _i16                Status;
701     _u8                 Padding[1];
702 } SlWlanRxFilterAddCommandReponse_t;
703 
704 typedef struct
705 {
706     _i16  Status;
707     _u8   Padding[2];
708 } SlWlanRxFilterSetCommandReponse_t;
709 
710 typedef struct
711 {
712     _i16  Status;
713     _u16  OutputBufferLength;
714 
715 } SlWlanRxFilterGetCommandReponse_t;
716 
717 
718 /* ******************************************************************************/
719 /*     RX filters -- End  */
720 /* ******************************************************************************/
721 
722 typedef struct
723 {
724     _u16 Status;
725     _u8  WlanRole;     /* 0 = station, 2 = AP */
726     _u8  Ipv6Enabled;
727     _u8  DhcpEnabled;
728 
729     _u32 Global[4];
730     _u32 Local[4];
731     _u32 DnsServer[4];
732     _u8  DhcpState;
733 } SlNetappIpV6configRetArgs_t;
734 
735 typedef struct
736 {
737     _u8  Ip[4];
738     _u8  IpMask[4];
739     _u8  IpGateway[4];
740     _u8  IpDnsServer[4];
741     _u8  IpStart[4];
742     _u8  IpEnd[4];
743 } SlNetCfgIpV4APArgs_t;
744 
745 typedef struct
746 {
747   _u16 Status;
748   _u8  MacAddr[6];
749 } SlMacAddressSetGet_t;
750 
751 typedef struct
752 {
753     _u16    Status;
754     _u16    ConfigId;
755     _u16    ConfigOpt;
756     _u16    ConfigLen;
757 } SlNetCfgSetGet_t;
758 
759 typedef struct
760 {
761     _u16  Status;
762     _u16  DeviceSetId;
763     _u16  Option;
764     _u16  ConfigLen;
765 } SlDeviceSetGet_t;
766 
767 
768 /******************************************************************************************/
769 /*   Socket structs  */
770 /******************************************************************************************/
771 
772 typedef struct
773 {
774     _u8 Domain;
775     _u8 Type;
776     _u8 Protocol;
777     _u8 Padding;
778 } SlSocketCommand_t;
779 
780 typedef struct
781 {
782     _i16 StatusOrLen;
783     _u8  Sd;
784     _u8  Padding;
785 } SlSocketResponse_t;
786 
787 typedef struct
788 {
789     _u8 Sd;
790     _u8 Family;
791     _u8 Padding1;
792     _u8 Padding2;
793 } SlAcceptCommand_t;
794 
795 typedef struct
796 {
797     _i16 StatusOrLen;
798     _u8  Sd;
799     _u8  Family;
800     _u16 Port;
801     _u16 PaddingOrAddr;
802     _u32 Address;
803 } SlSocketAddrAsyncIPv4Response_t;
804 
805 typedef struct
806 {
807     _i16 StatusOrLen;
808     _u8  Sd;
809     _u8  Family;
810     _u16 Port;
811     _u8  Address[6];
812 } SlSocketAddrAsyncIPv6EUI48Response_t;
813 
814 typedef struct
815 {
816     _i16 StatusOrLen;
817     _u8  Sd;
818     _u8  Family;
819     _u16 Port;
820     _u16 PaddingOrAddr;
821     _u32 Address[4];
822 } SlSocketAddrAsyncIPv6Response_t;
823 
824 typedef struct
825 {
826     _i16 LenOrPadding;
827     _u8  Sd;
828     _u8  FamilyAndFlags;
829     _u16 Port;
830     _u16 PaddingOrAddr;
831     _u32 Address;
832 } SlSocketAddrIPv4Command_t;
833 
834 typedef struct
835 {
836     _i16 LenOrPadding;
837     _u8  Sd;
838     _u8  FamilyAndFlags;
839     _u16 Port;
840     _u8  Address[6];
841 } SlSocketAddrIPv6EUI48Command_t;
842 
843 typedef struct
844 {
845     _i16 LenOrPadding;
846     _u8  Sd;
847     _u8  FamilyAndFlags;
848     _u16 Port;
849     _u16 PaddingOrAddr;
850     _u32 Address[4];
851 } SlSocketAddrIPv6Command_t;
852 
853 typedef union {
854     SlSocketAddrIPv4Command_t      IpV4;
855     SlSocketAddrIPv6EUI48Command_t IpV6EUI48;
856 #ifdef SL_SUPPORT_IPV6
857     SlSocketAddrIPv6Command_t      IpV6;
858 #endif
859 } SlSocketAddrCommand_u;
860 
861 typedef union {
862     SlSocketAddrAsyncIPv4Response_t      IpV4;
863     SlSocketAddrAsyncIPv6EUI48Response_t IpV6EUI48;
864 #ifdef SL_SUPPORT_IPV6
865     SlSocketAddrAsyncIPv6Response_t IpV6;
866 #endif
867 } SlSocketAddrResponse_u;
868 
869 typedef struct
870 {
871     _u8 Sd;
872     _u8 Backlog;
873     _u8 Padding1;
874     _u8 Padding2;
875 } SlListenCommand_t;
876 
877 typedef struct
878 {
879     _u8 Sd;
880     _u8 Padding0;
881     _u8 Padding1;
882     _u8 Padding2;
883 } SlCloseCommand_t;
884 
885 typedef struct
886 {
887     _u8  Nfds;
888     _u8  ReadFdsCount;
889     _u8  WriteFdsCount;
890     _u8  Padding;
891     _u16 ReadFds;
892     _u16 WriteFds;
893     _u16 tv_usec;
894     _u16 tv_sec;
895 } SlSelectCommand_t;
896 
897 typedef struct
898 {
899     _u16 Status;
900     _u8  ReadFdsCount;
901     _u8  WriteFdsCount;
902     _u16 ReadFds;
903     _u16 WriteFds;
904 } SlSelectAsyncResponse_t;
905 
906 typedef struct
907 {
908     _u8 Sd;
909     _u8 Level;
910     _u8 OptionName;
911     _u8 OptionLen;
912 } SlSetSockOptCommand_t;
913 
914 typedef struct
915 {
916     _u8 Sd;
917     _u8 Level;
918     _u8 OptionName;
919     _u8 OptionLen;
920 } SlGetSockOptCommand_t;
921 
922 typedef struct
923 {
924     _i16 Status;
925     _u8  Sd;
926     _u8  OptionLen;
927 } SlGetSockOptResponse_t;
928 
929 typedef struct
930 {
931     _u16 StatusOrLen;
932     _u8  Sd;
933     _u8  FamilyAndFlags;
934 } SlSendRecvCommand_t;
935 
936 /*****************************************************************************************
937 *   NETAPP structs
938 ******************************************************************************************/
939 
940 typedef _BasicResponse_t _NetAppStartStopResponse_t;
941 
942 typedef struct
943 {
944     _u32  AppId;
945 }_NetAppStartStopCommand_t;
946 
947 typedef struct
948 {
949     _u16    Status;
950     _u16    AppId;
951     _u16    ConfigOpt;
952     _u16    ConfigLen;
953 } SlNetAppSetGet_t;
954 typedef struct
955 {
956     _u16  PortNumber;
957 } SlNetAppHttpServerGetSetPortNum_t;
958 
959 typedef struct
960 {
961     _u8  AuthEnable;
962 } SlNetAppHttpServerGetSetAuthEnable_t;
963 
964 typedef struct _SlNetAppHttpServerGetToken_t
965 {
966     _u8     TokenNameLen;
967     _u8     Padd1;
968     _u16    Padd2;
969 }SlNetAppHttpServerGetToken_t;
970 
971 typedef struct _SlNetAppHttpServerSendToken_t
972 {
973     _u8   TokenValueLen;
974     _u8   TokenNameLen;
975     _u8   TokenName[SL_NETAPP_MAX_TOKEN_NAME_LEN];
976     _u16  Padd;
977 } SlNetAppHttpServerSendToken_t;
978 
979 typedef struct _SlNetAppHttpServerPostToken_t
980 {
981     _u8 PostActionLen;
982     _u8 TokenNameLen;
983     _u8 TokenValueLen;
984     _u8 padding;
985 } SlNetAppHttpServerPostToken_t;
986 
987 /*****************************************************************************************
988 *   NETAPP Request/Response/Send/Receive
989 ******************************************************************************************/
990 typedef struct _SlProtocolNetAppRequest_t
991 {
992     _u8     AppId;
993     _u8     RequestType;
994     _u16    Handle;
995     _u16    MetadataLen;
996     _u16    PayloadLen;
997     _u32    Flags;
998 } SlProtocolNetAppRequest_t;
999 
1000 typedef struct _SlProtocolNetAppResponse_t
1001 {
1002     _u16    Handle;
1003     _u16    status;
1004     _u16    MetadataLen;
1005     _u16    PayloadLen;
1006     _u32    Flags;
1007 } SlProtocolNetAppResponse_t;
1008 
1009 typedef struct _SlProtocolNetAppSend_t
1010 {
1011     _u16    Handle;
1012     _u16    DataLen;  /* can be data payload or metadata, depends on bit 1 in flags */
1013     _u32    Flags;
1014 } SlProtocolNetAppSend_t;
1015 
1016 typedef struct _SlProtocolNetAppReceiveRequest_t
1017 {
1018     _u16 Handle;
1019     _u16 MaxBufferLen;
1020     _u32 Flags;
1021 } SlProtocolNetAppReceiveRequest_t;
1022 
1023 typedef struct _SlProtocolNetAppReceive_t
1024 {
1025     _u16 Handle;
1026     _u16 PayloadLen;
1027     _u32 Flags;
1028 } SlProtocolNetAppReceive_t;
1029 
1030 typedef struct
1031 {
1032     _u16 Len;
1033     _u8  Family;
1034     _u8  Padding;
1035 } NetAppGetHostByNameCommand_t;
1036 
1037 typedef struct
1038 {
1039     _u16 Status;
1040     _u16 Padding;
1041     _u32 Ip0;
1042     _u32 Ip1;
1043     _u32 Ip2;
1044     _u32 Ip3;
1045 } NetAppGetHostByNameIPv6AsyncResponse_t;
1046 
1047 typedef struct
1048 {
1049     _u16 Status;
1050     _u8  Padding1;
1051     _u8  Padding2;
1052     _u32 Ip0;
1053 } NetAppGetHostByNameIPv4AsyncResponse_t;
1054 
1055 typedef enum
1056 {
1057     CTST_BSD_UDP_TX,
1058     CTST_BSD_UDP_RX,
1059     CTST_BSD_TCP_TX,
1060     CTST_BSD_TCP_RX,
1061     CTST_BSD_TCP_SERVER_BI_DIR,
1062     CTST_BSD_TCP_CLIENT_BI_DIR,
1063     CTST_BSD_UDP_BI_DIR,
1064     CTST_BSD_RAW_TX,
1065     CTST_BSD_RAW_RX,
1066     CTST_BSD_RAW_BI_DIR,
1067     CTST_BSD_SECURED_TCP_TX,
1068     CTST_BSD_SECURED_TCP_RX,
1069     CTST_BSD_SECURED_TCP_SERVER_BI_DIR,
1070     CTST_BSD_SECURED_TCP_CLIENT_BI_DIR,
1071     CTST_BSD_UDP_TX_IPV6,
1072     CTST_BSD_UDP_RX_IPV6,
1073     CTST_BSD_TCP_TX_IPV6,
1074     CTST_BSD_TCP_RX_IPV6,
1075     CTST_BSD_TCP_SERVER_BI_DIR_IPV6,
1076     CTST_BSD_TCP_CLIENT_BI_DIR_IPV6,
1077     CTST_BSD_UDP_BI_DIR_IPV6,
1078     CTST_BSD_RAW_TX_IPV6,
1079     CTST_BSD_RAW_RX_IPV6,
1080     CTST_BSD_RAW_BI_DIR_IPV6,
1081     CTST_BSD_SECURED_TCP_TX_IPV6,
1082     CTST_BSD_SECURED_TCP_RX_IPV6,
1083     CTST_BSD_SECURED_TCP_SERVER_BI_DIR_IPV6,
1084     CTST_BSD_SECURED_TCP_CLIENT_BI_DIR_IPV6,
1085     CTST_RAW_TX,
1086     CTST_RAW_RX
1087  }CommTest_e;
1088 
1089 typedef struct _sl_protocol_CtestStartCommand_t
1090 {
1091     _u32 Test;
1092     _u16 DestPort;
1093     _u16 SrcPort;
1094     _u32 DestAddr[4];
1095     _u32 PayloadSize;
1096     _u32 Timeout;
1097     _u32 CsEnabled;
1098     _u32 Secure;
1099     _u32 RawProtocol;
1100     _u8  Reserved1[4];
1101 }_CtestStartCommand_t;
1102 
1103 typedef struct
1104 {
1105     _u8  Test;
1106     _u8  Socket;
1107     _i16 Status;
1108     _u32 StartTime;
1109     _u32 EndTime;
1110     _u16 TxKbitsSec;
1111     _u16 RxKbitsSec;
1112     _u32 OutOfOrderPackets;
1113     _u32 MissedPackets;
1114     _i16 Token;
1115 }_CtestAsyncResponse_t;
1116 
1117 typedef struct
1118 {
1119     _u16 Status;
1120     _u16 RttMin;
1121     _u16 RttMax;
1122     _u16 RttAvg;
1123     _u32 NumSuccsessPings;
1124     _u32 NumSendsPings;
1125     _u32 TestTime;
1126 } SlPingReportResponse_t;
1127 
1128 typedef struct
1129 {
1130     _u32 Ip;
1131     _u32 Gateway;
1132     _u32 Dns;
1133 } IpV4AcquiredAsync_t;
1134 
1135 typedef enum
1136 {
1137     ACQUIRED_IPV6_LOCAL = 1,
1138     ACQUIRED_IPV6_GLOBAL
1139 }IpV6AcquiredType_e;
1140 
1141 typedef struct
1142 {
1143     _u32 Type;
1144     _u32 Ip[4];
1145     _u32 Gateway[4];
1146     _u32 Dns[4];
1147 } IpV6AcquiredAsync_t;
1148 
1149 typedef union
1150 {
1151     SlSocketCommand_t     EventMask;
1152     SlSendRecvCommand_t   DeviceInit;
1153 }_device_commands_t;
1154 
1155 /*****************************************************************************************
1156 *   FS structs
1157 ******************************************************************************************/
1158 
1159 typedef struct
1160 {
1161     _u32 FileHandle;
1162     _u32 Offset;
1163     _u16 Len;
1164     _u16 Padding;
1165 } SlFsReadCommand_t;
1166 
1167 typedef struct
1168 {
1169     _u32 Mode;
1170     _u32 Token;
1171 } SlFsOpenCommand_t;
1172 
1173 typedef struct
1174 {
1175     _u32 FileHandle;
1176     _u32 Token;
1177 } SlFsOpenResponse_t;
1178 
1179 
1180 typedef struct
1181 {
1182     _u32 FileHandle;
1183     _u32 CertificFileNameLength;
1184     _u32 SignatureLen;
1185 } SlFsCloseCommand_t;
1186 
1187 typedef _BasicResponse_t  SlFsReadResponse_t;
1188 typedef _BasicResponse_t  SlFsDeleteResponse_t;
1189 typedef _BasicResponse_t  SlFsCloseResponse_t;
1190 
1191 typedef struct
1192 {
1193     _u16 Status;
1194     _u16 Flags;
1195     _u32 FileLen;
1196     _u32 AllocatedLen;
1197     _u32 Token[4];
1198     _u32 FileStorageSize; /* The total size that the file required on the storage */
1199     _u32 FileWriteCounter; /* number of times in which the file have been written successfully */
1200 } SlFsGetInfoResponse_t;
1201 
1202 typedef struct
1203 {
1204     _u8 DeviceID;
1205     _u8 Padding[3];
1206 } SlFsFormatCommand_t;
1207 
1208 typedef _BasicResponse_t  SlFsFormatResponse_t;
1209 
1210 typedef struct
1211 {
1212     _u32 Token;
1213 } SlFsDeleteCommand_t;
1214 
1215 typedef  SlFsDeleteCommand_t  SlFsGetInfoCommand_t;
1216 
1217 typedef struct
1218 {
1219     _u32 FileHandle;
1220     _u32 Offset;
1221     _u16 Len;
1222     _u16 Padding;
1223 } SlFsWriteCommand_t;
1224 
1225 typedef _BasicResponse_t SlFsWriteResponse_t;
1226 
1227 typedef struct
1228 {
1229     _u32         Token;
1230     _u8          Operation;
1231     _u8          Padding[3];
1232     _u32         FileNameLength;
1233     _u32         BufferLength;
1234 } SlFsFileSysControlCommand_t;
1235 
1236 typedef struct
1237 {
1238     _i32          Status;
1239     _u32          Token;
1240     _u32          Len;
1241 } SlFsFileSysControlResponse_t;
1242 
1243 typedef struct
1244 {
1245     _u16         IncludeFileFilters;
1246     _u8          Operation;
1247     _u8          Padding;
1248 } SlFsBundleControlCommand_t;
1249 
1250 typedef struct
1251 {
1252     _i32         Status;
1253     _u8          BundleState;
1254     _u8          Padding[3];
1255 } SlFsBundleControlResponse_t;
1256 
1257 typedef struct
1258 {
1259     _u16        KeyLen;
1260     _u16        ChunkLen;
1261     _u32        Flags;
1262 } SlFsProgramCommand_t;
1263 
1264 typedef struct
1265 {
1266     _i32          Status;
1267 } SlFsProgramResponse_t;
1268 
1269 typedef struct
1270 {
1271     _i32  Index;  /* start point is -1 */
1272     _u8   Count;
1273     _u8   MaxEntryLen;
1274     _u8   Flags;
1275     _u8   Padding;
1276 } SlFsGetFileListCommand_t;
1277 
1278 typedef struct
1279 {
1280     _i32    NumOfEntriesOrError;
1281     _i32    Index; /* -1 , nothing was read */
1282     _u32    OutputBufferLength;
1283 } SlFsGetFileListResponse_t;
1284 
1285 /* TODO: Set MAx Async Payload length depending on flavor (Tiny, Small, etc.) */
1286 
1287 #define SL_ASYNC_HTTP_SRV_EVENT_LEN    1600  /* size must be aligned to 4 */
1288 
1289 #if defined(slcb_NetAppRequestHdlr) || defined(EXT_LIB_REGISTERED_NETAPP_REQUEST_EVENTS)
1290 #define SL_ASYNC_MAX_PAYLOAD_LEN             SL_ASYNC_HTTP_SRV_EVENT_LEN
1291 #else
1292 #define SL_ASYNC_MAX_PAYLOAD_LEN    220 /* size must be aligned to 4 */
1293 #endif
1294 
1295 #define  SL_ASYNC_MAX_MSG_LEN         (_SL_RESP_HDR_SIZE + SL_ASYNC_MAX_PAYLOAD_LEN)
1296 
1297 #define RECV_ARGS_SIZE                  (sizeof(SlSocketResponse_t))
1298 #define RECVFROM_IPV4_ARGS_SIZE         (sizeof(SlSocketAddrAsyncIPv4Response_t))
1299 #define RECVFROM_IPV6_ARGS_SIZE         (sizeof(SlSocketAddrAsyncIPv6Response_t))
1300 
1301 #define SL_IPV4_ADDRESS_SIZE             (sizeof(_u32))
1302 #define SL_IPV6_ADDRESS_SIZE             (4 * sizeof(_u32))
1303 
1304 
1305 /*****************************************************************************************
1306 *   NetUtil structures
1307 ******************************************************************************************/
1308 /* Utils Set Get Header */
1309 typedef struct
1310 {
1311     _u32    ObjId;
1312     _i16    Status;
1313     _u16    Option;
1314     _u16    ValueLen;
1315     _u8     Padding[2];
1316 } SlNetUtilSetGet_t;
1317 
1318 
1319 /* NetUtil Command Header */
1320 typedef struct
1321 {
1322     _u16    Cmd;
1323     _u16    AttribLen;
1324     _u16    InputLen;
1325     _u16    OutputLen;
1326 } SlNetUtilCmd_t;
1327 
1328 /* NetUtil Command Response Header */
1329 typedef struct
1330 {
1331     _u32    ObjId;
1332     _i16    Status;
1333     _u16    Cmd;
1334     _u16    OutputLen;
1335     _u8     Padding[2];
1336 } SlNetUtilCmdRsp_t;
1337 
1338 #ifdef  __cplusplus
1339 }
1340 #endif /* __cplusplus */
1341 
1342 #endif /*  _SL_PROTOCOL_TYPES_H_  */
1343