1 /**
2  *
3  * \file
4  *
5  * \brief WINC Application Interface Internal Types.
6  *
7  * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved.
8  *
9  * \asf_license_start
10  *
11  * \page License
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  *
16  * 1. Redistributions of source code must retain the above copyright notice,
17  *    this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright notice,
20  *    this list of conditions and the following disclaimer in the documentation
21  *    and/or other materials provided with the distribution.
22  *
23  * 3. The name of Atmel may not be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
27  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
29  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
30  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
34  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  *
38  * \asf_license_stop
39  *
40  */
41 
42 #ifndef __M2M_WIFI_TYPES_H__
43 #define __M2M_WIFI_TYPES_H__
44 
45 
46 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
47 INCLUDES
48 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
49 
50 #ifndef	_BOOT_
51 #ifndef _FIRMWARE_
52 #include "common/include/nm_common.h"
53 #else
54 #include "m2m_common.h"
55 #endif
56 #endif
57 
58 
59 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
60 MACROS
61 *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
62 /**@defgroup  WlanDefines Defines
63  * @ingroup m2m_wifi
64  */
65 /**@{*/
66 #define M2M_MAJOR_SHIFT (8)
67 #define M2M_MINOR_SHIFT (4)
68 #define M2M_PATCH_SHIFT (0)
69 
70 #define M2M_DRV_VERSION_SHIFT (16)
71 #define M2M_FW_VERSION_SHIFT (0)
72 
73 #define M2M_GET_MAJOR(ver_info_hword) ((uint8)((ver_info_hword) >> M2M_MAJOR_SHIFT) & 0xff)
74 #define M2M_GET_MINOR(ver_info_hword) ((uint8)((ver_info_hword) >> M2M_MINOR_SHIFT) & 0x0f)
75 #define M2M_GET_PATCH(ver_info_hword) ((uint8)((ver_info_hword) >> M2M_PATCH_SHIFT) & 0x0f)
76 
77 #define M2M_GET_FW_VER(ver_info_word)  ((uint16) ((ver_info_word) >> M2M_FW_VERSION_SHIFT))
78 #define M2M_GET_DRV_VER(ver_info_word) ((uint16) ((ver_info_word) >> M2M_DRV_VERSION_SHIFT))
79 
80 #define M2M_GET_DRV_MAJOR(ver_info_word) M2M_GET_MAJOR(M2M_GET_DRV_VER(ver_info_word))
81 #define M2M_GET_DRV_MINOR(ver_info_word) M2M_GET_MINOR(M2M_GET_DRV_VER(ver_info_word))
82 #define M2M_GET_DRV_PATCH(ver_info_word) M2M_GET_PATCH(M2M_GET_DRV_VER(ver_info_word))
83 
84 #define M2M_GET_FW_MAJOR(ver_info_word) M2M_GET_MAJOR(M2M_GET_FW_VER(ver_info_word))
85 #define M2M_GET_FW_MINOR(ver_info_word) M2M_GET_MINOR(M2M_GET_FW_VER(ver_info_word))
86 #define M2M_GET_FW_PATCH(ver_info_word) M2M_GET_PATCH(M2M_GET_FW_VER(ver_info_word))
87 
88 #define M2M_MAKE_VERSION(major, minor, patch) ( \
89 	((uint16)((major)  & 0xff)  << M2M_MAJOR_SHIFT) | \
90 	((uint16)((minor)  & 0x0f)  << M2M_MINOR_SHIFT) | \
91 	((uint16)((patch)  & 0x0f)  << M2M_PATCH_SHIFT))
92 
93 #define M2M_MAKE_VERSION_INFO(fw_major, fw_minor, fw_patch, drv_major, drv_minor, drv_patch) \
94 	( \
95 	( ((uint32)M2M_MAKE_VERSION((fw_major),  (fw_minor),  (fw_patch)))  << M2M_FW_VERSION_SHIFT) | \
96 	( ((uint32)M2M_MAKE_VERSION((drv_major), (drv_minor), (drv_patch))) << M2M_DRV_VERSION_SHIFT))
97 
98 #define REL_19_5_2_VER			M2M_MAKE_VERSION_INFO(19,5,2,19,3,0)
99 #define REL_19_5_1_VER			M2M_MAKE_VERSION_INFO(19,5,1,19,3,0)
100 #define REL_19_5_0_VER			M2M_MAKE_VERSION_INFO(19,5,0,19,3,0)
101 #define REL_19_4_6_VER			M2M_MAKE_VERSION_INFO(19,4,6,19,3,0)
102 #define REL_19_4_5_VER			M2M_MAKE_VERSION_INFO(19,4,5,19,3,0)
103 #define REL_19_4_4_VER			M2M_MAKE_VERSION_INFO(19,4,4,19,3,0)
104 #define REL_19_4_3_VER			M2M_MAKE_VERSION_INFO(19,4,3,19,3,0)
105 #define REL_19_4_2_VER			M2M_MAKE_VERSION_INFO(19,4,2,19,3,0)
106 #define REL_19_4_1_VER			M2M_MAKE_VERSION_INFO(19,4,1,19,3,0)
107 #define REL_19_4_0_VER			M2M_MAKE_VERSION_INFO(19,4,0,19,3,0)
108 #define REL_19_3_1_VER			M2M_MAKE_VERSION_INFO(19,3,1,19,3,0)
109 #define REL_19_3_0_VER			M2M_MAKE_VERSION_INFO(19,3,0,19,3,0)
110 #define REL_19_2_2_VER			M2M_MAKE_VERSION_INFO(19,2,2,19,2,0)
111 #define REL_19_2_1_VER			M2M_MAKE_VERSION_INFO(19,2,1,19,2,0)
112 #define REL_19_2_0_VER			M2M_MAKE_VERSION_INFO(19,2,0,19,2,0)
113 #define REL_19_1_0_VER			M2M_MAKE_VERSION_INFO(19,1,0,18,2,0)
114 #define REL_19_0_0_VER			M2M_MAKE_VERSION_INFO(19,0,0,18,1,1)
115 
116 /*======*======*======*======*
117 		FIRMWARE VERSION NO INFO
118  *======*======*======*======*/
119 
120 #define M2M_RELEASE_VERSION_MAJOR_NO 						(19)
121 /*!< Firmware Major release version number.
122 */
123 
124 
125 #define M2M_RELEASE_VERSION_MINOR_NO						(5)
126 /*!< Firmware Minor release version number.
127 */
128 
129 #define M2M_RELEASE_VERSION_PATCH_NO						(2)
130 /*!< Firmware patch release version number.
131 */
132 
133 /*======*======*======*======*
134   SUPPORTED DRIVER VERSION NO INFO
135  *======*======*======*======*/
136 
137 #define	M2M_MIN_REQ_DRV_VERSION_MAJOR_NO 						(19)
138 /*!< Driver Major release version number.
139 */
140 
141 
142 #define M2M_MIN_REQ_DRV_VERSION_MINOR_NO						(3)
143 /*!< Driver Minor release version number.
144 */
145 
146 #define M2M_MIN_REQ_DRV_VERSION_PATCH_NO						(0)
147 /*!< Driver patch release version number.
148 */
149 
150 #define M2M_MIN_REQ_DRV_SVN_VERSION								(0)
151 /*!< Driver svn version.
152 */
153 
154 
155 
156 #if !defined(M2M_RELEASE_VERSION_MAJOR_NO) || !defined(M2M_RELEASE_VERSION_MINOR_NO)
157 #error Undefined version number
158 #endif
159 
160 #define M2M_BUFFER_MAX_SIZE								(1600UL - 4)
161 /*!< Maximum size for the shared packet buffer.
162  */
163 
164 
165 #define M2M_MAC_ADDRES_LEN                               6
166 /*!< The size fo 802 MAC address.
167  */
168 
169 #define M2M_ETHERNET_HDR_OFFSET							34
170 /*!< The offset of the Ethernet header within the WLAN Tx Buffer.
171  */
172 
173 
174 #define M2M_ETHERNET_HDR_LEN							14
175 /*!< Length of the Etherenet header in bytes.
176 */
177 
178 
179 #define M2M_MAX_SSID_LEN 								33
180 /*!< Maximum size for the Wi-Fi SSID including the NULL termination.
181  */
182 
183 
184 #define M2M_MAX_PSK_LEN           						65
185 /*!< Maximum size for the WPA PSK including the NULL termination.
186  */
187 
188 #define M2M_MIN_PSK_LEN           						9
189 /*!< Maximum size for the WPA PSK including the NULL termination.
190  */
191 
192 #define M2M_DEVICE_NAME_MAX								48
193 /*!< Maximum Size for the device name including the NULL termination.
194  */
195 
196 
197 #define M2M_LISTEN_INTERVAL 							1
198 /*!< The STA uses the Listen Interval parameter to indicate to the AP how
199 	many beacon intervals it shall sleep before it retrieves the queued frames
200 	from the AP.
201 */
202 
203 #define MAX_HIDDEN_SITES 								4
204 /*!<
205 	max number of hidden SSID suuported by scan request
206 */
207 
208 
209 #define M2M_1X_USR_NAME_MAX								21
210 /*!< The maximum size of the user name including the NULL termination.
211 	It is used for RADIUS authentication in case of connecting the device to
212 	an AP secured with WPA-Enterprise.
213 */
214 
215 
216 #define M2M_1X_PWD_MAX									41
217 /*!< The maximum size of the password including the NULL termination.
218 	It is used for RADIUS authentication in case of connecting the device to
219 	an AP secured with WPA-Enterprise.
220 */
221 
222 #define M2M_CUST_IE_LEN_MAX								252
223 /*!< The maximum size of IE (Information Element).
224 */
225 
226 #define PWR_DEFAULT                                        PWR_HIGH
227 /*********************
228  *
229  * WIFI GROUP requests
230  */
231 
232 #define M2M_CONFIG_CMD_BASE									1
233 /*!< The base value of all the host configuration commands opcodes.
234 */
235 #define M2M_STA_CMD_BASE									40
236 /*!< The base value of all the station mode host commands opcodes.
237 */
238 #define M2M_AP_CMD_BASE										70
239 /*!< The base value of all the Access Point mode host commands opcodes.
240 */
241 #define M2M_P2P_CMD_BASE									90
242 /*!< The base value of all the P2P mode host commands opcodes.
243 */
244 #define M2M_SERVER_CMD_BASE									100
245 /*!< The base value of all the power save mode host commands codes.
246 */
247 /**********************
248  * OTA GROUP requests
249  */
250 #define M2M_OTA_CMD_BASE									100
251 /*!< The base value of all the OTA mode host commands opcodes.
252  * The OTA Have special group so can extended from 1-M2M_MAX_GRP_NUM_REQ
253 */
254 /***********************
255  *
256  * CRYPTO group requests
257  */
258 #define M2M_CRYPTO_CMD_BASE									1
259 /*!< The base value of all the crypto mode host commands opcodes.
260  * The crypto Have special group so can extended from 1-M2M_MAX_GRP_NUM_REQ
261 */
262 
263 #define M2M_MAX_GRP_NUM_REQ									(127)
264 /*!< max number of request in one group equal to 127 as the last bit reserved for config or data pkt
265 */
266 
267 #define WEP_40_KEY_STRING_SIZE 								((uint8)10)
268 /*!< Indicate the wep key size in bytes for 40 bit string passphrase.
269 */
270 
271 #define WEP_104_KEY_STRING_SIZE 							((uint8)26)
272 /*!< Indicate the wep key size in bytes for 104 bit string passphrase.
273 */
274 #define WEP_KEY_MAX_INDEX									((uint8)4)
275 /*!< Indicate the max key index value for WEP authentication
276 */
277 #define M2M_SHA256_CONTEXT_BUFF_LEN							(128)
278 /*!< sha256 context size
279 */
280 #define M2M_SCAN_DEFAULT_NUM_SLOTS							(2)
281 /*!< The default. number of scan slots performed by the WINC board.
282 */
283 #define M2M_SCAN_DEFAULT_SLOT_TIME							(30)
284 /*!< The default. duration in miliseconds of a scan slots performed by the WINC board.
285 */
286 #define M2M_SCAN_DEFAULT_NUM_PROBE							(2)
287 /*!< The default. number of scan slots performed by the WINC board.
288 */
289 
290 
291 /*======*======*======*======*
292 	CONNECTION ERROR DEFINITIONS
293  *======*======*======*======*/
294 typedef enum {
295 	M2M_DEFAULT_CONN_INPROGRESS = ((sint8)-23),
296 	/*!<
297 	A failure that indicates that a default connection or forced connection is in progress
298 	*/
299 	M2M_DEFAULT_CONN_FAIL,
300 	/*!<
301 	A failure response that indicates that the winc failed to connect to the cached network
302 	*/
303 	 M2M_DEFAULT_CONN_SCAN_MISMATCH,
304 	/*!<
305 	A failure response that indicates that no one of the cached networks
306 	was found in the scan results, as a result to the function call m2m_default_connect.
307 	*/
308 	M2M_DEFAULT_CONN_EMPTY_LIST
309 	/*!<
310 	A failure response that indicates an empty network list as
311 	a result to the function call m2m_default_connect.
312 	*/
313 
314 }tenuM2mDefaultConnErrcode;
315 
316 
317 
318 /*======*======*======*======*
319 	TLS DEFINITIONS
320  *======*======*======*======*/
321 #define TLS_FILE_NAME_MAX								48
322 /*!<  Maximum length for each TLS certificate file name including null terminator.
323 */
324 #define TLS_SRV_SEC_MAX_FILES							8
325 /*!<  Maximum number of certificates allowed in TLS_SRV section.
326 */
327 #define TLS_SRV_SEC_START_PATTERN_LEN					8
328 /*!<  Length of certificate struct start pattern.
329 */
330 /*======*======*======*======*
331 	OTA DEFINITIONS
332  *======*======*======*======*/
333 
334 #define OTA_STATUS_VALID					(0x12526285)
335 /*!<
336 	Magic value updated in the Control structure in case of ROLLACK image Valid
337 */
338 #define OTA_STATUS_INVALID					(0x23987718)
339 /*!<
340 	Magic value updated in the Control structure in case of ROLLACK image InValid
341 */
342 #define OTA_MAGIC_VALUE						(0x1ABCDEF9)
343 /*!<
344 	Magic value set at the beginning of the OTA image header
345 */
346 #define M2M_MAGIC_APP 						(0xef522f61UL)
347 /*!<
348 	Magic value set at the beginning of the Cortus OTA image header
349 */
350 
351 #define OTA_FORMAT_VER_0					(0)	/*Till 19.2.2 format*/
352 #define OTA_FORMAT_VER_1					(1) /*starting from 19.3.0 CRC is used and sequence number is used*/
353 /*!<
354 	Control structure format version
355 */
356 #define OTA_SHA256_DIGEST_SIZE 				(32)
357 /*!<
358  Sha256 digest size in the OTA image,
359  the sha256 digest is set at the beginning of image before the OTA header
360  */
361 
362 /*======*======*======*======*
363 	SSL DEFINITIONS
364  *======*======*======*======*/
365 
366 #define TLS_CRL_DATA_MAX_LEN	64
367 /*<!
368 	Maximum data length in a CRL entry (= Hash length for SHA512)
369 */
370 #define TLS_CRL_MAX_ENTRIES		10
371 /*<!
372 	Maximum number of entries in a CRL
373 */
374 
375 #define TLS_CRL_TYPE_NONE		0
376 /*<!
377 	No CRL check
378 */
379 #define TLS_CRL_TYPE_CERT_HASH	1
380 /*<!
381 	CRL contains certificate hashes
382 */
383 
384 /**@}*/
385 
386 /**
387 * @addtogroup WlanEnums Enumerations and Typedefs
388 * @ingroup m2m_wifi
389 */
390  /**@{*/
391 
392 typedef enum {
393 	OTA_SUCCESS = (0),
394 	/*!<
395 	 OTA Success status
396 	 */
397 	OTA_ERR_WORKING_IMAGE_LOAD_FAIL = ((sint8) -1),
398 	/*!<
399 	 Failure to load the firmware image
400 	 */
401 	OTA_ERR_INVAILD_CONTROL_SEC = ((sint8) -2),
402 	/*!<
403 	 Control structure is being corrupted
404 	 */
405 	M2M_ERR_OTA_SWITCH_FAIL = ((sint8) -3),
406 	/*!<
407 	 switching to the updated image failed as may be the image is invalid
408 	 */
409 	M2M_ERR_OTA_START_UPDATE_FAIL = ((sint8) -4),
410 	/*!<
411 	 OTA update fail due to multiple reasons
412 	 - Connection failure
413 	 - Image integrity fail
414 
415 	 */
416 	M2M_ERR_OTA_ROLLBACK_FAIL = ((sint8) -5),
417 	/*!<
418 	 Roll-back failed due to Roll-back image is not valid
419 	 */
420 	M2M_ERR_OTA_INVAILD_FLASH_SIZE = ((sint8) -6),
421 	/*!<
422 	 The OTA Support at least 4MB flash size, if the above error will appear if the current flash is less than 4M
423 	 */
424 	M2M_ERR_OTA_INVAILD_ARG = ((sint8) -7),
425 	/*!<
426 	 * Ota still in progress
427 	 */
428 	M2M_ERR_OTA_INPROGRESS = ((sint8) -8)
429 /*!<
430  Invalid argument in any OTA Function
431  */
432 } tenuOtaError;
433 
434 /*!
435 @enum	\
436 	tenuM2mConnChangedErrcode
437 
438 @brief
439 
440 */
441 typedef enum {
442 	 M2M_ERR_SCAN_FAIL = ((uint8)1),
443 	/*!< Indicate that the WINC board has failed to perform the scan operation.
444 	*/
445 	 M2M_ERR_JOIN_FAIL,
446 	/*!< Indicate that the WINC board has failed to join the BSS .
447 	*/
448 	 M2M_ERR_AUTH_FAIL,
449 	/*!< Indicate that the WINC board has failed to authenticate with the AP.
450 	*/
451 	 M2M_ERR_ASSOC_FAIL,
452 	/*!< Indicate that the WINC board has failed to associate with the AP.
453 	*/
454 	 M2M_ERR_CONN_INPROGRESS
455 	 /*!< Indicate that the WINC board has another connection request in progress.
456 	*/
457 }tenuM2mConnChangedErrcode;
458 /*!
459 @enum	\
460 	tenuM2mWepKeyIndex
461 
462 @brief
463 
464 */
465 typedef enum {
466 	M2M_WIFI_WEP_KEY_INDEX_1 = ((uint8) 1),
467 	M2M_WIFI_WEP_KEY_INDEX_2,
468 	M2M_WIFI_WEP_KEY_INDEX_3,
469 	M2M_WIFI_WEP_KEY_INDEX_4
470 	/*!< Index for WEP key Authentication
471 	*/
472 }tenuM2mWepKeyIndex;
473 
474 /*!
475 @enum	\
476 	tenuM2mPwrMode
477 
478 @brief
479 
480 */
481 typedef enum {
482 	PWR_AUTO = ((uint8) 1),
483 	/*!< FW will decide the best power mode to use internally. */
484 	PWR_LOW1,
485 	/*low power mode #1*/
486 	PWR_LOW2,
487 	/*low power mode #2*/
488 	PWR_HIGH
489 	/* high power mode*/
490 }tenuM2mPwrMode;
491 
492 /*!
493 @struct	\
494 	tstrM2mPwrState
495 
496 @brief
497 	Power Mode
498 */
499 typedef struct {
500 	uint8	u8PwrMode;
501 	/*!< power Save Mode
502 	*/
503 	uint8	__PAD24__[3];
504 	/*!< Padding bytes for forcing 4-byte alignment
505 	*/
506 }tstrM2mPwrMode;
507 /*!
508 @enum	\
509 	tenuM2mTxPwrLevel
510 
511 @brief
512 
513 */
514 typedef enum {
515 	TX_PWR_HIGH = ((uint8) 1),
516 	/*!< PPA Gain 6dbm	PA Gain 18dbm */
517 	TX_PWR_MED,
518 	/*!< PPA Gain 6dbm	PA Gain 12dbm */
519 	TX_PWR_LOW
520 	/*!< PPA Gain 6dbm	PA Gain 6dbm */
521 }tenuM2mTxPwrLevel;
522 
523 /*!
524 @struct	\
525 	tstrM2mTxPwrLevel
526 
527 @brief
528 	Tx power level
529 */
530 typedef struct {
531 	uint8	u8TxPwrLevel;
532 	/*!< Tx power level
533 	*/
534 	uint8	__PAD24__[3];
535 	/*!< Padding bytes for forcing 4-byte alignment
536 	*/
537 }tstrM2mTxPwrLevel;
538 
539 /*!
540 @struct	\
541 	tstrM2mEnableLogs
542 
543 @brief
544 	Enable Firmware logs
545 */
546 typedef struct {
547 	uint8	u8Enable;
548 	/*!< Enable/Disable firmware logs
549 	*/
550 	uint8	__PAD24__[3];
551 	/*!< Padding bytes for forcing 4-byte alignment
552 	*/
553 }tstrM2mEnableLogs;
554 
555 /*!
556 @struct	\
557 	tstrM2mBatteryVoltage
558 
559 @brief
560 	Battery Voltage
561 */
562 typedef struct {
563 	//Note: on SAMD D21 the size of double is 8 Bytes
564 	uint16	u16BattVolt;
565 	/*!< Battery Voltage
566 	*/
567 	uint8	__PAD16__[2];
568 	/*!< Padding bytes for forcing 4-byte alignment
569 	*/
570 }tstrM2mBatteryVoltage;
571 
572 /*!
573 @enum	\
574 	tenuM2mReqGroup
575 
576 @brief
577 */
578 typedef enum{
579 	M2M_REQ_GROUP_MAIN = 0,
580 	M2M_REQ_GROUP_WIFI,
581 	M2M_REQ_GROUP_IP,
582 	M2M_REQ_GROUP_HIF,
583 	M2M_REQ_GROUP_OTA,
584 	M2M_REQ_GROUP_SSL,
585 	M2M_REQ_GROUP_CRYPTO,
586 	M2M_REQ_GROUP_SIGMA
587 }tenuM2mReqGroup;
588 
589 /*!
590 @enum	\
591 	tenuM2mReqpkt
592 
593 @brief
594 */
595 typedef enum{
596 	M2M_REQ_CONFIG_PKT,
597 	M2M_REQ_DATA_PKT = 0x80 /*BIT7*/
598 }tenuM2mReqpkt;
599 /*!
600 @enum	\
601 	tenuM2mConfigCmd
602 
603 @brief
604 	This enum contains all the host commands used to configure the WINC board.
605 
606 */
607 typedef enum {
608 	M2M_WIFI_REQ_RESTART = M2M_CONFIG_CMD_BASE,
609 	/*!<
610 		Restart the WINC MAC layer, it's doesn't restart the IP layer.
611 	*/
612 	M2M_WIFI_REQ_SET_MAC_ADDRESS,
613 	/*!<
614 		Set the WINC mac address (not possible for production effused boards).
615 	*/
616 	M2M_WIFI_REQ_CURRENT_RSSI,
617 	/*!<
618 		Request the current connected AP RSSI.
619 	*/
620 	M2M_WIFI_RESP_CURRENT_RSSI,
621 	/*!<
622 		Response to M2M_WIFI_REQ_CURRENT_RSSI with the RSSI value.
623 	*/
624 	M2M_WIFI_REQ_GET_CONN_INFO,
625 	/*!< Request connection information command.
626 	*/
627 	M2M_WIFI_RESP_CONN_INFO,
628 
629 	/*!< Connect with default AP response.
630 	*/
631 	M2M_WIFI_REQ_SET_DEVICE_NAME,
632 	/*!<
633 		Set the WINC device name property.
634 	*/
635 	M2M_WIFI_REQ_START_PROVISION_MODE,
636 	/*!<
637 		Start the provisioning mode for the M2M Device.
638 	*/
639 	M2M_WIFI_RESP_PROVISION_INFO,
640 	/*!<
641 		Send the provisioning information to the host.
642 	*/
643 	M2M_WIFI_REQ_STOP_PROVISION_MODE,
644 	/*!<
645 		Stop the current running provision mode.
646 	*/
647 	M2M_WIFI_REQ_SET_SYS_TIME,
648 	/*!<
649 		Set time of day from host.
650 	*/
651 	M2M_WIFI_REQ_ENABLE_SNTP_CLIENT,
652 	/*!<
653 		Enable the simple network time protocol to get the
654 		time from the Internet. this is required for security purposes.
655 	*/
656 	M2M_WIFI_REQ_DISABLE_SNTP_CLIENT,
657 	/*!<
658 		Disable the simple network time protocol for applications that
659 		do not need it.
660 	*/
661 	M2M_WIFI_RESP_MEMORY_RECOVER,
662 	/*!<
663 	 * Reserved for debuging
664 	 * */
665 	M2M_WIFI_REQ_CUST_INFO_ELEMENT,
666 	/*!< Add Custom ELement to Beacon Managament Frame.
667 	*/
668 	M2M_WIFI_REQ_SCAN,
669 	/*!< Request scan command.
670 	*/
671 	M2M_WIFI_RESP_SCAN_DONE,
672 	/*!< Scan complete notification response.
673 	*/
674 	M2M_WIFI_REQ_SCAN_RESULT,
675 	/*!< Request Scan results command.
676 	*/
677 	M2M_WIFI_RESP_SCAN_RESULT,
678 	/*!< Request Scan results resopnse.
679 	*/
680 	M2M_WIFI_REQ_SET_SCAN_OPTION,
681 	/*!< Set Scan options "slot time, slot number .. etc" .
682 	*/
683 	M2M_WIFI_REQ_SET_SCAN_REGION,
684 	/*!< Set scan region.
685 	*/
686 	M2M_WIFI_REQ_SET_POWER_PROFILE,
687 	/*!< The API shall set power mode to one of 3 modes
688 	*/
689 	M2M_WIFI_REQ_SET_TX_POWER,
690 	/*!<  API to set TX power.
691 	*/
692 	M2M_WIFI_REQ_SET_BATTERY_VOLTAGE,
693 	/*!<  API to set Battery Voltage.
694 	*/
695 	M2M_WIFI_REQ_SET_ENABLE_LOGS,
696 	/*!<  API to set Battery Voltage.
697 	*/
698 	M2M_WIFI_REQ_GET_SYS_TIME,
699 	/*!<
700 		REQ GET time of day from WINC.
701 	*/
702 	M2M_WIFI_RESP_GET_SYS_TIME,
703 	/*!<
704 		RESP time of day from host.
705 	*/
706 	M2M_WIFI_REQ_SEND_ETHERNET_PACKET,
707 	/*!< Send Ethernet packet in bypass mode.
708 	*/
709 	M2M_WIFI_RESP_ETHERNET_RX_PACKET,
710 	/*!< Receive Ethernet packet in bypass mode.
711 	*/
712 	M2M_WIFI_REQ_SET_MAC_MCAST,
713 	/*!< Set the WINC multicast filters.
714 	*/
715 	M2M_WIFI_REQ_GET_PRNG,
716 	/*!< Request PRNG.
717 	*/
718 	M2M_WIFI_RESP_GET_PRNG,
719 	/*!< Response for PRNG.
720 	*/
721 	M2M_WIFI_REQ_SCAN_SSID_LIST,
722 	/*!< Request scan with list of hidden SSID plus the broadcast scan.
723 	*/
724 	M2M_WIFI_REQ_SET_GAINS,
725 	/*!< Request set the PPA gain
726 	*/
727 	M2M_WIFI_REQ_PASSIVE_SCAN,
728 	/*!< Request a passivr scan command.
729 	*/
730 	M2M_WIFI_MAX_CONFIG_ALL
731 }tenuM2mConfigCmd;
732 
733 /*!
734 @enum	\
735 	tenuM2mStaCmd
736 
737 @brief
738 	This enum contains all the WINC commands while in Station mode.
739 */
740 typedef enum {
741 	M2M_WIFI_REQ_CONNECT = M2M_STA_CMD_BASE,
742 	/*!< Connect with AP command.
743 	*/
744 	M2M_WIFI_REQ_DEFAULT_CONNECT,
745 	/*!< Connect with default AP command.
746 	*/
747 	M2M_WIFI_RESP_DEFAULT_CONNECT,
748 	/*!< Request connection information response.
749 	*/
750 	M2M_WIFI_REQ_DISCONNECT,
751 	/*!< Request to disconnect from AP command.
752 	*/
753 	M2M_WIFI_RESP_CON_STATE_CHANGED,
754 	/*!< Connection state changed response.
755 	*/
756 	M2M_WIFI_REQ_SLEEP,
757 	/*!< Set PS mode command.
758 	*/
759 	M2M_WIFI_REQ_WPS_SCAN,
760 	/*!< Request WPS scan command.
761 	*/
762 	M2M_WIFI_REQ_WPS,
763 	/*!< Request WPS start command.
764 	*/
765 	M2M_WIFI_REQ_START_WPS,
766 	/*!< This command is for internal use by the WINC and
767 		should not be used by the host driver.
768 	*/
769 	M2M_WIFI_REQ_DISABLE_WPS,
770 	/*!< Request to disable WPS command.
771 	*/
772 	M2M_WIFI_REQ_DHCP_CONF,
773 	/*!< Response indicating that IP address was obtained.
774 	*/
775 	M2M_WIFI_RESP_IP_CONFIGURED,
776 	/*!< This command is for internal use by the WINC and
777 		should not be used by the host driver.
778 	*/
779 	M2M_WIFI_RESP_IP_CONFLICT,
780 	/*!< Response indicating a conflict in obtained IP address.
781 		The user should re attempt the DHCP request.
782 	*/
783 	M2M_WIFI_REQ_ENABLE_MONITORING,
784 	/*!< Request to enable monitor mode  command.
785 	*/
786 	M2M_WIFI_REQ_DISABLE_MONITORING,
787 	/*!< Request to disable monitor mode  command.
788 	*/
789 	M2M_WIFI_RESP_WIFI_RX_PACKET,
790 	/*!< Indicate that a packet was received in monitor mode.
791 	*/
792 	M2M_WIFI_REQ_SEND_WIFI_PACKET,
793 	/*!< Send packet in monitor mode.
794 	*/
795 	M2M_WIFI_REQ_LSN_INT,
796 	/*!< Set WiFi listen interval.
797 	*/
798 	M2M_WIFI_REQ_DOZE,
799 	/*!< Used to force the WINC to sleep in manual PS mode.
800 	*/
801 	M2M_WIFI_MAX_STA_ALL
802 } tenuM2mStaCmd;
803 
804 /*!
805 @enum	\
806 	tenuM2mApCmd
807 
808 @brief
809 	This enum contains all the WINC commands while in AP mode.
810 */
811 typedef enum {
812 	M2M_WIFI_REQ_ENABLE_AP = M2M_AP_CMD_BASE,
813 	/*!< Enable AP mode command.
814 	*/
815 	M2M_WIFI_REQ_DISABLE_AP,
816 	/*!< Disable AP mode command.
817 	*/
818 	M2M_WIFI_REQ_RESTART_AP,
819 	/*!<
820 	*/
821 	M2M_WIFI_MAX_AP_ALL
822 }tenuM2mApCmd;
823 
824 /*!
825 @enum	\
826 	tenuM2mP2pCmd
827 
828 @brief
829 	This enum contains all the WINC commands while in P2P mode.
830 */
831 typedef enum {
832 	M2M_WIFI_REQ_P2P_INT_CONNECT = M2M_P2P_CMD_BASE,
833 	/*!< This command is for internal use by the WINC and
834 		should not be used by the host driver.
835 	*/
836 	M2M_WIFI_REQ_ENABLE_P2P,
837 	/*!< Enable P2P mode command.
838 	*/
839 	M2M_WIFI_REQ_DISABLE_P2P,
840 	/*!< Disable P2P mode command.
841 	*/
842 	M2M_WIFI_REQ_P2P_REPOST,
843 	/*!< This command is for internal use by the WINC and
844 		should not be used by the host driver.
845 	*/
846 	M2M_WIFI_MAX_P2P_ALL
847 }tenuM2mP2pCmd;
848 
849 
850 
851 /*!
852 @enum	\
853 	tenuM2mServerCmd
854 
855 @brief
856 	This enum contains all the WINC commands while in PS mode.
857 	These command are currently not supported.
858 */
859 typedef enum {
860 	M2M_WIFI_REQ_CLIENT_CTRL = M2M_SERVER_CMD_BASE,
861 	M2M_WIFI_RESP_CLIENT_INFO,
862 	M2M_WIFI_REQ_SERVER_INIT,
863 	M2M_WIFI_MAX_SERVER_ALL
864 }tenuM2mServerCmd;
865 
866 
867 
868 /*!
869 @enum	\
870 	tenuM2mOtaCmd
871 
872 @brief
873 
874 */
875 typedef enum {
876 	M2M_OTA_REQ_NOTIF_SET_URL = M2M_OTA_CMD_BASE,
877 	M2M_OTA_REQ_NOTIF_CHECK_FOR_UPDATE,
878 	M2M_OTA_REQ_NOTIF_SCHED,
879 	M2M_OTA_REQ_START_FW_UPDATE,
880 	M2M_OTA_REQ_SWITCH_FIRMWARE,
881 	M2M_OTA_REQ_ROLLBACK_FW,
882 	M2M_OTA_RESP_NOTIF_UPDATE_INFO,
883 	M2M_OTA_RESP_UPDATE_STATUS,
884 	M2M_OTA_REQ_TEST,
885 	M2M_OTA_REQ_START_CRT_UPDATE,
886 	M2M_OTA_REQ_SWITCH_CRT_IMG,
887 	M2M_OTA_REQ_ROLLBACK_CRT,
888 	M2M_OTA_REQ_ABORT,
889 	M2M_OTA_MAX_ALL,
890 }tenuM2mOtaCmd;
891 
892 /*!
893 @enum	\
894 	tenuM2mCryptoCmd
895 
896 @brief
897 
898 */
899 typedef enum {
900 	M2M_CRYPTO_REQ_SHA256_INIT = M2M_CRYPTO_CMD_BASE,
901 	M2M_CRYPTO_RESP_SHA256_INIT,
902 	M2M_CRYPTO_REQ_SHA256_UPDATE,
903 	M2M_CRYPTO_RESP_SHA256_UPDATE,
904 	M2M_CRYPTO_REQ_SHA256_FINSIH,
905 	M2M_CRYPTO_RESP_SHA256_FINSIH,
906 	M2M_CRYPTO_REQ_RSA_SIGN_GEN,
907 	M2M_CRYPTO_RESP_RSA_SIGN_GEN,
908 	M2M_CRYPTO_REQ_RSA_SIGN_VERIFY,
909 	M2M_CRYPTO_RESP_RSA_SIGN_VERIFY,
910 	M2M_CRYPTO_MAX_ALL
911 }tenuM2mCryptoCmd;
912 
913 /*!
914 @enum	\
915 	tenuM2mIpCmd
916 
917 @brief
918 
919 */
920 typedef enum {
921 	/* Request IDs corresponding to the IP GROUP. */
922 	M2M_IP_REQ_STATIC_IP_CONF = ((uint8) 10),
923 	M2M_IP_REQ_ENABLE_DHCP,
924 	M2M_IP_REQ_DISABLE_DHCP
925 } tenuM2mIpCmd;
926 
927 /*!
928 @enum	\
929 	tenuM2mSigmaCmd
930 
931 @brief
932 
933 */
934 typedef enum {
935 	/* Request IDs corresponding to the IP GROUP. */
936 	M2M_SIGMA_ENABLE = ((uint8) 3),
937 	M2M_SIGMA_TA_START,
938 	M2M_SIGMA_TA_STATS,
939 	M2M_SIGMA_TA_RECEIVE_STOP,
940 	M2M_SIGMA_ICMP_ARP,
941 	M2M_SIGMA_ICMP_RX,
942 	M2M_SIGMA_ICMP_TX,
943 	M2M_SIGMA_UDP_TX,
944 	M2M_SIGMA_UDP_TX_DEFER,
945 	M2M_SIGMA_SECURITY_POLICY,
946 	M2M_SIGMA_SET_SYSTIME
947 } tenuM2mSigmaCmd;
948 
949 
950 typedef enum{
951 	M2M_SSL_REQ_CERT_VERIF,
952 	M2M_SSL_REQ_ECC,
953 	M2M_SSL_RESP_ECC,
954 	M2M_SSL_IND_CRL,
955 	M2M_SSL_IND_CERTS_ECC,
956 	M2M_SSL_REQ_SET_CS_LIST,
957 	M2M_SSL_RESP_SET_CS_LIST
958 }tenuM2mSslCmd;
959 
960 /*!
961 @enum	\
962 	tenuM2mConnState
963 
964 @brief
965 	Wi-Fi Connection State.
966 */
967 typedef enum {
968 	M2M_WIFI_DISCONNECTED = 0,
969 	/*!< Wi-Fi state is disconnected.
970 	*/
971 	M2M_WIFI_CONNECTED,
972 	/*!< Wi-Fi state is connected.
973 	*/
974 	M2M_WIFI_UNDEF = 0xff
975 	/*!< Undefined Wi-Fi State.
976 	*/
977 }tenuM2mConnState;
978 
979 /*!
980 @enum	\
981 	tenuM2mSecType
982 
983 @brief
984 	Wi-Fi Supported Security types.
985 */
986 typedef enum {
987 	M2M_WIFI_SEC_INVALID = 0,
988 	/*!< Invalid security type.
989 	*/
990 	M2M_WIFI_SEC_OPEN,
991 	/*!< Wi-Fi network is not secured.
992 	*/
993 	M2M_WIFI_SEC_WPA_PSK,
994 	/*!< Wi-Fi network is secured with WPA/WPA2 personal(PSK).
995 	*/
996 	M2M_WIFI_SEC_WEP,
997 	/*!< Security type WEP (40 or 104) OPEN OR SHARED.
998 	*/
999 	M2M_WIFI_SEC_802_1X
1000 	/*!< Wi-Fi network is secured with WPA/WPA2 Enterprise.IEEE802.1x user-name/password authentication.
1001 	 */
1002 }tenuM2mSecType;
1003 
1004 
1005 /*!
1006 @enum	\
1007 	tenuM2mSecType
1008 
1009 @brief
1010 	Wi-Fi Supported SSID types.
1011 */
1012 typedef enum {
1013 	SSID_MODE_VISIBLE = 0,
1014 	/*!< SSID is visible to others.
1015 	*/
1016 	SSID_MODE_HIDDEN
1017 	/*!< SSID is hidden.
1018 	*/
1019 }tenuM2mSsidMode;
1020 
1021 /*!
1022 @enum	\
1023 	tenuM2mScanCh
1024 
1025 @brief
1026 	Wi-Fi RF Channels.
1027 @sa
1028 	tstrM2MScan
1029 	tstrM2MScanOption
1030 */
1031 typedef enum {
1032 	M2M_WIFI_CH_1 = ((uint8) 1),
1033 	M2M_WIFI_CH_2,
1034 	M2M_WIFI_CH_3,
1035 	M2M_WIFI_CH_4,
1036 	M2M_WIFI_CH_5,
1037 	M2M_WIFI_CH_6,
1038 	M2M_WIFI_CH_7,
1039 	M2M_WIFI_CH_8,
1040 	M2M_WIFI_CH_9,
1041 	M2M_WIFI_CH_10,
1042 	M2M_WIFI_CH_11,
1043 	M2M_WIFI_CH_12,
1044 	M2M_WIFI_CH_13,
1045 	M2M_WIFI_CH_14,
1046 	M2M_WIFI_CH_ALL = ((uint8) 255)
1047 }tenuM2mScanCh;
1048 
1049 /*!
1050 @enum	\
1051 	tenuM2mScanRegion
1052 
1053 @brief
1054 	Wi-Fi RF Channels.
1055 */
1056 typedef enum {
1057 
1058 	REG_CH_1 = ((uint16) 1 << 0),
1059 	REG_CH_2 = ((uint16) 1 << 1),
1060 	REG_CH_3 = ((uint16) 1 << 2),
1061 	REG_CH_4 = ((uint16) 1 << 3),
1062 	REG_CH_5 = ((uint16) 1 << 4),
1063 	REG_CH_6 = ((uint16) 1 << 5),
1064 	REG_CH_7 = ((uint16) 1 << 6),
1065 	REG_CH_8 = ((uint16) 1 << 7),
1066 	REG_CH_9 = ((uint16) 1 << 8),
1067 	REG_CH_10 = ((uint16) 1 << 9),
1068 	REG_CH_11 = ((uint16) 1 << 10),
1069 	REG_CH_12 = ((uint16) 1 << 11),
1070 	REG_CH_13 = ((uint16) 1 << 12),
1071 	REG_CH_14 = ((uint16) 1 << 13),
1072 	REG_CH_ALL = ((uint16) 0x3FFF),
1073 	NORTH_AMERICA = ((uint16) 0x7FF),
1074 	/** 11 channel
1075 	*/
1076 	EUROPE		=   ((uint16) 0x1FFF),
1077 	/** 13 channel
1078 	*/
1079 	ASIA		=   ((uint16) 0x3FFF)
1080 	/* 14 channel
1081 	*/
1082 }tenuM2mScanRegion;
1083 
1084 
1085 /*!
1086 @enum	\
1087 	tenuPowerSaveModes
1088 
1089 @brief
1090 	Power Save Modes.
1091 */
1092 typedef enum {
1093 	M2M_NO_PS,
1094 	/*!< Power save is disabled.
1095 	*/
1096 	M2M_PS_AUTOMATIC,
1097 	/*!< Power save is done automatically by the WINC.
1098 		This mode doesn't disable all of the WINC modules and
1099 		use higher amount of power than the H_AUTOMATIC and
1100 		the DEEP_AUTOMATIC modes..
1101 	*/
1102 	M2M_PS_H_AUTOMATIC,
1103 	/*!< Power save is done automatically by the WINC.
1104 		Achieve higher power save than the AUTOMATIC mode
1105 		by shutting down more parts of the WINC board.
1106 	*/
1107 	M2M_PS_DEEP_AUTOMATIC,
1108 	/*!< Power save is done automatically by the WINC.
1109 		Achieve the highest possible power save.
1110 	*/
1111 	M2M_PS_MANUAL
1112 	/*!< Power save is done manually by the user.
1113 	*/
1114 }tenuPowerSaveModes;
1115 
1116 /*!
1117 @enum	\
1118 	tenuM2mWifiMode
1119 
1120 @brief
1121 	Wi-Fi Operation Mode.
1122 */
1123 typedef enum {
1124 	M2M_WIFI_MODE_NORMAL = ((uint8) 1),
1125 	/*!< Normal Mode means to run customer firmware version.
1126 	 */
1127 	M2M_WIFI_MODE_ATE_HIGH,
1128 	/*!< Config Mode in HIGH POWER means to run production test firmware version which is known as ATE (Burst) firmware.
1129 	 */
1130 	M2M_WIFI_MODE_ATE_LOW,
1131 	/*!< Config Mode in LOW POWER means to run production test firmware version which is known as ATE (Burst) firmware.
1132 	 */
1133 	M2M_WIFI_MODE_ETHERNET,
1134 	/*!< etherent Mode
1135 	 */
1136 	M2M_WIFI_MODE_MAX
1137 }tenuM2mWifiMode;
1138 
1139 /*!
1140 @enum	\
1141 	tenuWPSTrigger
1142 
1143 @brief
1144 	WPS Triggering Methods.
1145 */
1146 typedef enum{
1147 	WPS_PIN_TRIGGER = 0,
1148 	/*!< WPS is triggered in PIN method.
1149 	*/
1150 	WPS_PBC_TRIGGER = 4
1151 	/*!< WPS is triggered via push button.
1152 	*/
1153 }tenuWPSTrigger;
1154 
1155 /*!
1156 @struct	\
1157 	tstrM2mWifiGainsParams
1158 
1159 @brief
1160 	Gain Values
1161 */
1162 typedef struct{
1163 	uint16	u8PPAGFor11B;
1164 	/*!< PPA gain for 11B (as the RF document represenation)
1165 	PPA_AGC<0:2> Every bit have 3dB gain control each.
1166 	for example:
1167 	1 ->3db
1168 	3 ->6db
1169 	7 ->9db
1170 	*/
1171 	uint16	u8PPAGFor11GN;
1172 	/*!< PPA gain for 11GN (as the RF document represented)
1173 	PPA_AGC<0:2> Every bit have 3dB gain control each.
1174 		for example:
1175 	1 ->3db
1176 	3 ->6db
1177 	7 ->9db
1178 	*/
1179 }tstrM2mWifiGainsParams;
1180 
1181 /*!
1182 @struct	\
1183 	tstrM2mWifiWepParams
1184 
1185 @brief
1186 	WEP security key parameters.
1187 */
1188 typedef struct{
1189 	uint8	u8KeyIndx;
1190 	/*!< Wep key Index.
1191 	*/
1192 	uint8	u8KeySz;
1193 	/*!< Wep key Size.
1194 	*/
1195 	uint8	au8WepKey[WEP_104_KEY_STRING_SIZE + 1];
1196 	/*!< WEP Key represented as a NULL terminated ASCII string.
1197 	*/
1198 	uint8	__PAD24__[3];
1199 	/*!< Padding bytes to keep the structure word alligned.
1200 	*/
1201 }tstrM2mWifiWepParams;
1202 
1203 
1204 /*!
1205 @struct	\
1206 	tstr1xAuthCredentials
1207 
1208 @brief
1209 	Credentials for the user to authenticate with the AAA server (WPA-Enterprise Mode IEEE802.1x).
1210 */
1211 typedef struct{
1212 	uint8	au8UserName[M2M_1X_USR_NAME_MAX];
1213 	/*!< User Name. It must be Null terminated string.
1214 	*/
1215 	uint8	au8Passwd[M2M_1X_PWD_MAX];
1216 	/*!< Password corresponding to the user name. It must be Null terminated string.
1217 	*/
1218 }tstr1xAuthCredentials;
1219 
1220 
1221 /*!
1222 @union	\
1223 	tuniM2MWifiAuth
1224 
1225 @brief
1226 	Wi-Fi Security Parameters for all supported security modes.
1227 */
1228 typedef union{
1229 	uint8				au8PSK[M2M_MAX_PSK_LEN];
1230 	/*!< Pre-Shared Key in case of WPA-Personal security.
1231 	*/
1232 	tstr1xAuthCredentials	strCred1x;
1233 	/*!< Credentials for RADIUS server authentication in case of WPA-Enterprise security.
1234 	*/
1235 	tstrM2mWifiWepParams	strWepInfo;
1236 	/*!< WEP key parameters in case of WEP security.
1237 	*/
1238 }tuniM2MWifiAuth;
1239 
1240 
1241 /*!
1242 @struct	\
1243 	tstrM2MWifiSecInfo
1244 
1245 @brief
1246 	Authentication credentials to connect to a Wi-Fi network.
1247 */
1248 typedef struct{
1249 	tuniM2MWifiAuth		uniAuth;
1250 	/*!< Union holding all possible authentication parameters corresponding the current security types.
1251 	*/
1252 	uint8				u8SecType;
1253 	/*!< Wi-Fi network security type. See tenuM2mSecType for supported security types.
1254 	*/
1255 #define __PADDING__		(4 - ((sizeof(tuniM2MWifiAuth) + 1) % 4))
1256 	uint8				__PAD__[__PADDING__];
1257 	/*!< Padding bytes for forcing 4-byte alignment
1258 	*/
1259 }tstrM2MWifiSecInfo;
1260 
1261 
1262 /*!
1263 @struct	\
1264 	tstrM2mWifiConnect
1265 
1266 @brief
1267 	Wi-Fi Connect Request
1268 */
1269 typedef struct{
1270 	tstrM2MWifiSecInfo		strSec;
1271 	/*!< Security parameters for authenticating with the AP.
1272 	*/
1273 	uint16				u16Ch;
1274 	/*!< RF Channel for the target SSID.
1275 	*/
1276 	uint8				au8SSID[M2M_MAX_SSID_LEN];
1277 	/*!< SSID of the desired AP. It must be NULL terminated string.
1278 	*/
1279 	uint8 				u8NoSaveCred;
1280 #define __CONN_PAD_SIZE__		(4 - ((sizeof(tstrM2MWifiSecInfo) + M2M_MAX_SSID_LEN + 3) % 4))
1281 	uint8				__PAD__[__CONN_PAD_SIZE__];
1282 	/*!< Padding bytes for forcing 4-byte alignment
1283 	*/
1284 }tstrM2mWifiConnect;
1285 
1286 
1287 /*!
1288 @struct	\
1289 	tstrM2MWPSConnect
1290 
1291 @brief
1292 	WPS Configuration parameters
1293 
1294 @sa
1295 	tenuWPSTrigger
1296 */
1297 typedef struct {
1298 	uint8 	u8TriggerType;
1299 	/*!< WPS triggering method (Push button or PIN)
1300 	*/
1301 	char         acPinNumber[8];
1302 	/*!< WPS PIN No (for PIN method)
1303 	*/
1304 	uint8	__PAD24__[3];
1305 	/*!< Padding bytes for forcing 4-byte alignment
1306 	*/
1307 }tstrM2MWPSConnect;
1308 
1309 
1310 /*!
1311 @struct	\
1312 	tstrM2MWPSInfo
1313 
1314 @brief	WPS Result
1315 
1316 	This structure is passed to the application in response to a WPS request. If the WPS session is completed successfully, the
1317 	structure will have Non-ZERO authentication type. If the WPS Session fails (due to error or timeout) the authentication type
1318 	is set to ZERO.
1319 
1320 @sa
1321 	tenuM2mSecType
1322 */
1323 typedef struct{
1324 	uint8	u8AuthType;
1325 	/*!< Network authentication type.
1326 	*/
1327 	uint8   	u8Ch;
1328 	/*!< RF Channel for the AP.
1329 	*/
1330 	uint8	au8SSID[M2M_MAX_SSID_LEN];
1331 	/*!< SSID obtained from WPS.
1332 	*/
1333 	uint8	au8PSK[M2M_MAX_PSK_LEN];
1334 	/*!< PSK for the network obtained from WPS.
1335 	*/
1336 }tstrM2MWPSInfo;
1337 
1338 
1339 /*!
1340 @struct	\
1341 	tstrM2MDefaultConnResp
1342 
1343 @brief
1344 	Response error of the m2m_default_connect
1345 
1346 @sa
1347 	M2M_DEFAULT_CONN_SCAN_MISMATCH
1348 	M2M_DEFAULT_CONN_EMPTY_LIST
1349 */
1350 typedef struct{
1351 	sint8		s8ErrorCode;
1352 	/*!<
1353 		Default connect error code. possible values are:
1354 		- M2M_DEFAULT_CONN_EMPTY_LIST
1355 		- M2M_DEFAULT_CONN_SCAN_MISMATCH
1356 	*/
1357 	uint8	__PAD24__[3];
1358 }tstrM2MDefaultConnResp;
1359 
1360 /*!
1361 @struct	\
1362 	tstrM2MScanOption
1363 
1364 @brief
1365 	Scan options and configurations.
1366 
1367 @sa
1368 	tenuM2mScanCh
1369 	tstrM2MScan
1370 */
1371 typedef struct {
1372 	uint8   u8NumOfSlot;
1373 	/*|< The min number of slots is 2 for every channel,
1374 	every slot the soc will send Probe Request on air, and wait/listen for PROBE RESP/BEACONS for the u16slotTime
1375 	*/
1376 	uint8   u8SlotTime;
1377 	/*|< the time that the Soc will wait on every channel listening to the frames on air
1378 		when that time increaseed number of AP will increased in the scan results
1379 		min time is 10 ms and the max is 250 ms
1380 	*/
1381 	uint8  u8ProbesPerSlot;
1382 	/*!< Number of probe requests to be sent per channel scan slot.
1383 	*/
1384 	sint8   s8RssiThresh;
1385 	/*! < The RSSI threshold of the AP which will be connected to directly.
1386 	*/
1387 
1388 }tstrM2MScanOption;
1389 
1390 /*!
1391 @struct	\
1392 	tstrM2MScanRegion
1393 
1394 @brief
1395 	Wi-Fi channel regulation region information.
1396 
1397 @sa
1398 	tenuM2mScanRegion
1399 */
1400 typedef struct {
1401 	uint16   u16ScanRegion;
1402 	/*|< Specifies the number of channels allowed in the region (e.g. North America = 11 ... etc.).
1403 	*/
1404 	uint8 __PAD16__[2];
1405 
1406 }tstrM2MScanRegion;
1407 
1408 /*!
1409 @struct	\
1410 	tstrM2MScan
1411 
1412 @brief
1413 	Wi-Fi Scan Request
1414 
1415 @sa
1416 	tenuM2mScanCh
1417 	tstrM2MScanOption
1418 */
1419 typedef struct {
1420 	uint8 	u8ChNum;
1421 	/*!< The Wi-Fi RF Channel number
1422 	*/
1423 	uint8	__RSVD8__[1];
1424 	/*!< Reserved for future use.
1425 	*/
1426 	uint16 	u16PassiveScanTime;
1427 	/*!< Passive Scan Timeout in ms. The field is ignored for active scan.
1428 	*/
1429 }tstrM2MScan;
1430 
1431 /*!
1432 @struct	\
1433 	tstrCyptoResp
1434 
1435 @brief
1436 	crypto response
1437 */
1438 typedef struct {
1439 	sint8 s8Resp;
1440 	/***/
1441 	uint8 __PAD24__[3];
1442 	/*
1443 	*/
1444 }tstrCyptoResp;
1445 
1446 
1447 /*!
1448 @struct	\
1449 	tstrM2mScanDone
1450 
1451 @brief
1452 	Wi-Fi Scan Result
1453 */
1454 typedef struct{
1455 	uint8 	u8NumofCh;
1456 	/*!< Number of found APs
1457 	*/
1458 	sint8 	s8ScanState;
1459 	/*!< Scan status
1460 	*/
1461 	uint8	__PAD16__[2];
1462 	/*!< Padding bytes for forcing 4-byte alignment
1463 	*/
1464 }tstrM2mScanDone;
1465 
1466 
1467 /*!
1468 @struct	\
1469 	tstrM2mReqScanResult
1470 
1471 @brief	Scan Result Request
1472 
1473 	The Wi-Fi Scan results list is stored in Firmware. The application can request a certain scan result by its index.
1474 */
1475 typedef struct {
1476 	uint8 	u8Index;
1477 	/*!< Index of the desired scan result
1478 	*/
1479 	uint8	__PAD24__[3];
1480 	/*!< Padding bytes for forcing 4-byte alignment
1481 	*/
1482 }tstrM2mReqScanResult;
1483 
1484 
1485 /*!
1486 @struct	\
1487 	tstrM2mWifiscanResult
1488 
1489 @brief	Wi-Fi Scan Result
1490 
1491 	Information corresponding to an AP in the Scan Result list identified by its order (index) in the list.
1492 */
1493 typedef struct {
1494 	uint8 	u8index;
1495 	/*!< AP index in the scan result list.
1496 	*/
1497 	sint8 	s8rssi;
1498 	/*!< AP signal strength.
1499 	*/
1500 	uint8 	u8AuthType;
1501 	/*!< AP authentication type.
1502 	*/
1503 	uint8 	u8ch;
1504 	/*!< AP RF channel.
1505 	*/
1506 	uint8	au8BSSID[6];
1507 	/*!< BSSID of the AP.
1508 	*/
1509 	uint8 	au8SSID[M2M_MAX_SSID_LEN];
1510 	/*!< AP ssid.
1511 	*/
1512 	uint8 	_PAD8_;
1513 	/*!< Padding bytes for forcing 4-byte alignment
1514 	*/
1515 }tstrM2mWifiscanResult;
1516 
1517 
1518 /*!
1519 @struct	\
1520 	tstrM2mWifiStateChanged
1521 
1522 @brief
1523 	Wi-Fi Connection State
1524 
1525 @sa
1526 	M2M_WIFI_DISCONNECTED, M2M_WIFI_CONNECTED, M2M_WIFI_REQ_CON_STATE_CHANGED,tenuM2mConnChangedErrcode
1527 */
1528 typedef struct {
1529 	uint8	u8CurrState;
1530 	/*!< Current Wi-Fi connection state
1531 	*/
1532 	uint8  u8ErrCode;
1533 	/*!< Error type review tenuM2mConnChangedErrcode
1534 	*/
1535 	uint8	__PAD16__[2];
1536 	/*!< Padding bytes for forcing 4-byte alignment
1537 	*/
1538 }tstrM2mWifiStateChanged;
1539 
1540 
1541 /*!
1542 @struct	\
1543 	tstrM2mPsType
1544 
1545 @brief
1546 	Power Save Configuration
1547 
1548 @sa
1549 	tenuPowerSaveModes
1550 */
1551 typedef struct{
1552 	uint8 	u8PsType;
1553 	/*!< Power save operating mode
1554 	*/
1555 	uint8 	u8BcastEn;
1556 	/*!<
1557 	*/
1558 	uint8	__PAD16__[2];
1559 	/*!< Padding bytes for forcing 4-byte alignment
1560 	*/
1561 }tstrM2mPsType;
1562 
1563 /*!
1564 @struct	\
1565 	tstrM2mSlpReqTime
1566 
1567 @brief
1568 	Manual power save request sleep time
1569 
1570 */
1571 typedef struct {
1572 	/*!< Sleep time in ms
1573 	*/
1574 	uint32 u32SleepTime;
1575 
1576 } tstrM2mSlpReqTime;
1577 
1578 /*!
1579 @struct	\
1580 	tstrM2mLsnInt
1581 
1582 @brief	Listen interval
1583 
1584 	It is the value of the Wi-Fi STA listen interval for power saving. It is given in units of Beacon period.
1585 	Periodically after the listen interval fires, the WINC is wakeup and listen to the beacon and check for any buffered frames for it from the AP.
1586 */
1587 typedef struct {
1588 	uint16 	u16LsnInt;
1589 	/*!< Listen interval in Beacon period count.
1590 	*/
1591 	uint8	__PAD16__[2];
1592 	/*!< Padding bytes for forcing 4-byte alignment
1593 	*/
1594 }tstrM2mLsnInt;
1595 
1596 
1597 /*!
1598 @struct	\
1599 	tstrM2MWifiMonitorModeCtrl
1600 
1601 @brief	Wi-Fi Monitor Mode Filter
1602 
1603 	This structure sets the filtering criteria for WLAN packets when monitoring mode is enable.
1604 	The received packets matching the filtering parameters, are passed directly to the application.
1605 */
1606 typedef struct{
1607 	uint8	u8ChannelID;
1608 	/* !< RF Channel ID. It must use values from tenuM2mScanCh
1609 	*/
1610 	uint8	u8FrameType;
1611 	/*!< It must use values from tenuWifiFrameType.
1612 	*/
1613 	uint8	u8FrameSubtype;
1614 	/*!< It must use values from tenuSubTypes.
1615 	*/
1616 	uint8	au8SrcMacAddress[6];
1617 	/* ZERO means DO NOT FILTER Source address.
1618 	*/
1619 	uint8	au8DstMacAddress[6];
1620 	/* ZERO means DO NOT FILTER Destination address.
1621 	*/
1622 	uint8	au8BSSID[6];
1623 	/* ZERO means DO NOT FILTER BSSID.
1624 	*/
1625 	uint8 u8EnRecvHdr;
1626 	/*
1627 	 Enable recv the full hder before the payload
1628 	*/
1629 	uint8	__PAD16__[2];
1630 	/*!< Padding bytes for forcing 4-byte alignment
1631 	*/
1632 }tstrM2MWifiMonitorModeCtrl;
1633 
1634 
1635 /*!
1636 @struct	\
1637 	tstrM2MWifiRxPacketInfo
1638 
1639 @brief	Wi-Fi RX Frame Header
1640 
1641 	The M2M application has the ability to allow Wi-Fi monitoring mode for receiving all Wi-Fi Raw frames matching a well defined filtering criteria.
1642 	When a target Wi-Fi packet is received, the header information are extracted and assigned in this structure.
1643 */
1644 typedef struct{
1645 	uint8	u8FrameType;
1646 	/*!< It must use values from tenuWifiFrameType.
1647 	*/
1648 	uint8	u8FrameSubtype;
1649 	/*!< It must use values from tenuSubTypes.
1650 	*/
1651 	uint8	u8ServiceClass;
1652 	/*!< Service class from Wi-Fi header.
1653 	*/
1654 	uint8	u8Priority;
1655 	/*!< Priority from Wi-Fi header.
1656 	*/
1657 	uint8	u8HeaderLength;
1658 	/*!< Frame Header length.
1659 	*/
1660 	uint8	u8CipherType;
1661 	/*!< Encryption type for the rx packet.
1662 	*/
1663 	uint8	au8SrcMacAddress[6];
1664 	/* ZERO means DO NOT FILTER Source address.
1665 	*/
1666 	uint8	au8DstMacAddress[6];
1667 	/* ZERO means DO NOT FILTER Destination address.
1668 	*/
1669 	uint8	au8BSSID[6];
1670 	/* ZERO means DO NOT FILTER BSSID.
1671 	*/
1672 	uint16	u16DataLength;
1673 	/*!< Data payload length (Header excluded).
1674 	*/
1675 	uint16	u16FrameLength;
1676 	/*!< Total frame length (Header + Data).
1677 	*/
1678 	uint32	u32DataRateKbps;
1679 	/*!< Data Rate in Kbps.
1680 	*/
1681 	sint8		s8RSSI;
1682 	/*!< RSSI.
1683 	*/
1684 	uint8	__PAD24__[3];
1685 	/*!< Padding bytes for forcing 4-byte alignment
1686 	*/
1687 }tstrM2MWifiRxPacketInfo;
1688 
1689 
1690 /*!
1691 @struct	\
1692 	tstrM2MWifiTxPacketInfo
1693 
1694 @brief	Wi-Fi TX Packet Info
1695 
1696 	The M2M Application has the ability to compose a RAW Wi-Fi frames (under the application responsibility).
1697 	When transmitting a Wi-Fi packet, the application must supply the firmware with this structure for sending the target frame.
1698 */
1699 typedef struct{
1700 	uint16	u16PacketSize;
1701 	/*!< Wlan frame length.
1702 	*/
1703 	uint16	u16HeaderLength;
1704 	/*!< Wlan frame header length.
1705 	*/
1706 }tstrM2MWifiTxPacketInfo;
1707 
1708 
1709 /*!
1710  @struct	\
1711  	tstrM2MP2PConnect
1712 
1713  @brief
1714  	Set the device to operate in the Wi-Fi Direct (P2P) mode.
1715 */
1716 typedef struct {
1717 	uint8 	u8ListenChannel;
1718 	/*!< P2P Listen Channel (1, 6 or 11)
1719 	*/
1720 	uint8	__PAD24__[3];
1721 	/*!< Padding bytes for forcing 4-byte alignment
1722 	*/
1723 }tstrM2MP2PConnect;
1724 
1725 /*!
1726 @struct	\
1727 	tstrM2MAPConfig
1728 
1729 @brief	AP Configuration
1730 
1731 	This structure holds the configuration parameters for the M2M AP mode. It should be set by the application when
1732 	it requests to enable the M2M AP operation mode. The M2M AP mode currently supports only WEP security (with
1733 	the NO Security option available of course).
1734 */
1735 typedef struct {
1736 	/*!<
1737 		Configuration parameters for the WiFi AP.
1738 	*/
1739 	uint8 	au8SSID[M2M_MAX_SSID_LEN];
1740 	/*!< AP SSID
1741 	*/
1742 	uint8 	u8ListenChannel;
1743 	/*!< Wi-Fi RF Channel which the AP will operate on
1744 	*/
1745 	uint8	u8KeyIndx;
1746 	/*!< Wep key Index
1747 	*/
1748 	uint8	u8KeySz;
1749 	/*!< Wep/WPA key Size
1750 	*/
1751 	uint8	au8WepKey[WEP_104_KEY_STRING_SIZE + 1];
1752 	/*!< Wep key
1753 	*/
1754 	uint8 	u8SecType;
1755 	/*!< Security type: Open or WEP or WPA in the current implementation
1756 	*/
1757 	uint8 	u8SsidHide;
1758 	/*!< SSID Status "Hidden(1)/Visible(0)"
1759 	*/
1760 	uint8	au8DHCPServerIP[4];
1761 	/*!< Ap IP server address
1762 	*/
1763 	uint8	au8Key[M2M_MAX_PSK_LEN];
1764 	/*!< WPA key
1765 	*/
1766 	uint8	__PAD24__[2];
1767 	/*!< Padding bytes for forcing alignment
1768 	*/
1769 }tstrM2MAPConfig;
1770 
1771 
1772 /*!
1773 @struct	\
1774 	tstrM2mServerInit
1775 
1776 @brief
1777 	PS Server initialization.
1778 */
1779 typedef struct {
1780 	uint8 	u8Channel;
1781 	/*!< Server Listen channel
1782 	*/
1783 	uint8	__PAD24__[3];
1784 	/*!< Padding bytes for forcing 4-byte alignment
1785 	*/
1786 }tstrM2mServerInit;
1787 
1788 
1789 /*!
1790 @struct	\
1791 	tstrM2mClientState
1792 
1793 @brief
1794 	PS Client State.
1795 */
1796 typedef struct {
1797 	uint8 	u8State;
1798 	/*!< PS Client State
1799 	*/
1800 	uint8	__PAD24__[3];
1801 	/*!< Padding bytes for forcing 4-byte alignment
1802 	*/
1803 }tstrM2mClientState;
1804 
1805 
1806 /*!
1807 @struct	\
1808 	tstrM2Mservercmd
1809 
1810 @brief
1811 	PS Server CMD
1812 */
1813 typedef struct {
1814 	uint8	u8cmd;
1815 	/*!< PS Server Cmd
1816 	*/
1817 	uint8	__PAD24__[3];
1818 	/*!< Padding bytes for forcing 4-byte alignment
1819 	*/
1820 }tstrM2Mservercmd;
1821 
1822 
1823 /*!
1824 @struct	\
1825 	tstrM2mSetMacAddress
1826 
1827 @brief
1828 	Sets the MAC address from application. The WINC load the mac address from the effuse by default to the WINC configuration memory,
1829 	but that function is used to let the application overwrite the configuration memory with the mac address from the host.
1830 
1831 @note
1832 	It's recommended to call this only once before calling connect request and after the m2m_wifi_init
1833 */
1834 typedef struct {
1835 	uint8 	au8Mac[6];
1836 	/*!< MAC address array
1837 	*/
1838 	uint8	__PAD16__[2];
1839 	/*!< Padding bytes for forcing 4-byte alignment
1840 	*/
1841 }tstrM2mSetMacAddress;
1842 
1843 
1844 /*!
1845 @struct	\
1846  	tstrM2MDeviceNameConfig
1847 
1848 @brief	Device name
1849 
1850 	It is assigned by the application. It is used mainly for Wi-Fi Direct device
1851 	discovery and WPS device information.
1852 */
1853 typedef struct {
1854 	uint8 	au8DeviceName[M2M_DEVICE_NAME_MAX];
1855 	/*!< NULL terminated device name
1856 	*/
1857 }tstrM2MDeviceNameConfig;
1858 
1859 
1860 /*!
1861 @struct	\
1862  	tstrM2MIPConfig
1863 
1864 @brief
1865  	Static IP configuration.
1866 
1867 @note
1868  	All member IP addresses are expressed in Network Byte Order (eg. "192.168.10.1" will be expressed as 0x010AA8C0).
1869  */
1870 typedef struct {
1871 	uint32 	u32StaticIP;
1872 	/*!< The static IP assigned to the device.
1873 	*/
1874 	uint32 	u32Gateway;
1875 	/*!< IP of the Default internet gateway.
1876 	*/
1877 	uint32 	u32DNS;
1878 	/*!< IP for the DNS server.
1879 	*/
1880 	uint32 	u32SubnetMask;
1881 	/*!< Subnet mask for the local area network.
1882 	*/
1883 	uint32 u32DhcpLeaseTime;
1884 	/*!< Dhcp Lease Time in sec
1885 	*/
1886 } tstrM2MIPConfig;
1887 
1888 /*!
1889 @struct	\
1890  	tstrM2mIpRsvdPkt
1891 
1892 @brief
1893  	Received Packet Size and Data Offset
1894 
1895  */
1896 typedef struct{
1897 	uint16	u16PktSz;
1898 	uint16	u16PktOffset;
1899 } tstrM2mIpRsvdPkt;
1900 
1901 
1902 /*!
1903 @struct	\
1904  	tstrM2MProvisionModeConfig
1905 
1906 @brief
1907  	M2M Provisioning Mode Configuration
1908  */
1909 
1910 typedef struct {
1911 	tstrM2MAPConfig		strApConfig;
1912 	/*!<
1913 		Configuration parameters for the WiFi AP.
1914 	*/
1915 	char				acHttpServerDomainName[64];
1916 	/*!<
1917 		The device domain name for HTTP provisioning.
1918 	*/
1919 	uint8				u8EnableRedirect;
1920 	/*!<
1921 		A flag to enable/disable HTTP redirect feature for the HTTP Provisioning server. If the Redirect is enabled,
1922 		all HTTP traffic (http://URL) from the device associated with WINC AP will be redirected to the HTTP Provisioning Web page.
1923 		- 0 : Disable HTTP Redirect.
1924 		- 1 : Enable HTTP Redirect.
1925 	*/
1926 	uint8			__PAD24__[3];
1927 }tstrM2MProvisionModeConfig;
1928 
1929 
1930 /*!
1931 @struct	\
1932  	tstrM2MProvisionInfo
1933 
1934 @brief
1935  	M2M Provisioning Information obtained from the HTTP Provisioning server.
1936  */
1937 typedef struct{
1938 	uint8	au8SSID[M2M_MAX_SSID_LEN];
1939 	/*!<
1940 		Provisioned SSID.
1941 	*/
1942 	uint8	au8Password[M2M_MAX_PSK_LEN];
1943 	/*!<
1944 		Provisioned Password.
1945 	*/
1946 	uint8	u8SecType;
1947 	/*!<
1948 		Wifi Security type.
1949 	*/
1950 	uint8	u8Status;
1951 	/*!<
1952 		Provisioning status. It must be checked before reading the provisioning information. It may be
1953 		- M2M_SUCCESS 	: Provision successful.
1954 		- M2M_FAIL		: Provision Failed.
1955 	*/
1956 }tstrM2MProvisionInfo;
1957 
1958 
1959 /*!
1960 @struct	\
1961  	tstrM2MConnInfo
1962 
1963 @brief
1964  	M2M Provisioning Information obtained from the HTTP Provisioning server.
1965  */
1966 typedef struct{
1967 	char		acSSID[M2M_MAX_SSID_LEN];
1968 	/*!< AP connection SSID name  */
1969 	uint8	u8SecType;
1970 	/*!< Security type */
1971 	uint8	au8IPAddr[4];
1972 	/*!< Connection IP address */
1973 	uint8	au8MACAddress[6];
1974 	/*!< MAC address of the peer Wi-Fi station */
1975 	sint8	s8RSSI;
1976 	/*!< Connection RSSI signal */
1977 	uint8	__PAD24__[3];
1978 	/*!< Padding bytes for forcing 4-byte alignment */
1979 }tstrM2MConnInfo;
1980 
1981 /*!
1982 @struct	\
1983  	tstrOtaInitHdr
1984 
1985 @brief
1986  	OTA Image Header
1987  */
1988 
1989 typedef struct{
1990 	uint32 u32OtaMagicValue;
1991 	/*!< Magic value kept in the OTA image after the
1992 	sha256 Digest buffer to define the Start of OTA Header */
1993 	uint32 u32OtaPayloadSzie;
1994 	/*!<
1995 	The Total OTA image payload size, include the sha256 key size
1996 	*/
1997 
1998 }tstrOtaInitHdr;
1999 
2000 
2001 /*!
2002 @struct	\
2003  	tstrOtaControlSec
2004 
2005 @brief
2006  	Control section structure is used to define the working image and
2007 	the validity of the roll-back image and its offset, also both firmware versions is kept in that structure.
2008  */
2009 
2010 typedef struct {
2011 	uint32 u32OtaMagicValue;
2012 /*!<
2013 	Magic value used to ensure the structure is valid or not
2014 */
2015 	uint32 u32OtaFormatVersion;
2016 /*!<
2017 		NA   NA   NA   Flash version   cs struct version
2018 		00   00   00   00              00
2019 	Control structure format version, the value will be incremented in case of structure changed or updated
2020 */
2021 	uint32 u32OtaSequenceNumber;
2022 /*!<
2023 	Sequence number is used while update the control structure to keep track of how many times that section updated
2024 */
2025 	uint32 u32OtaLastCheckTime;
2026 /*!<
2027 	Last time OTA check for update
2028 */
2029 	uint32 u32OtaCurrentworkingImagOffset;
2030 /*!<
2031 	Current working offset in flash
2032 */
2033 	uint32 u32OtaCurrentworkingImagFirmwareVer;
2034 /*!<
2035 	current working image version ex 18.0.1
2036 */
2037 	uint32 u32OtaRollbackImageOffset;
2038 /*!<
2039 	Roll-back image offset in flash
2040 */
2041 	uint32 u32OtaRollbackImageValidStatus;
2042 /*!<
2043 	roll-back image valid status
2044 */
2045 	uint32 u32OtaRollbackImagFirmwareVer;
2046 /*!<
2047 	Roll-back image version (ex 18.0.3)
2048 */
2049 	uint32 u32OtaCortusAppWorkingOffset;
2050 /*!<
2051 	cortus app working offset in flash
2052 */
2053 	uint32 u32OtaCortusAppWorkingValidSts;
2054 /*!<
2055 	Working Cortus app valid status
2056 */
2057 	uint32 u32OtaCortusAppWorkingVer;
2058 /*!<
2059 	Working cortus app version (ex 18.0.3)
2060 */
2061 	uint32 u32OtaCortusAppRollbackOffset;
2062 /*!<
2063 	cortus app rollback offset in flash
2064 */
2065 	uint32 u32OtaCortusAppRollbackValidSts;
2066 /*!<
2067 	roll-back cortus app valid status
2068 */
2069 	uint32 u32OtaCortusAppRollbackVer;
2070 /*!<
2071 	Roll-back cortus app version (ex 18.0.3)
2072 */
2073 	uint32 u32OtaControlSecCrc;
2074 /*!<
2075 	CRC for the control structure to ensure validity
2076 */
2077 } tstrOtaControlSec;
2078 
2079 /*!
2080 @enum	\
2081 	tenuOtaUpdateStatus
2082 
2083 @brief
2084 	OTA return status
2085 */
2086 typedef enum {
2087 	OTA_STATUS_SUCSESS        = 0,
2088 	/*!< OTA Success with not errors. */
2089 	OTA_STATUS_FAIL           = 1,
2090 	/*!< OTA generic fail. */
2091 	OTA_STATUS_INVAILD_ARG    = 2,
2092 	/*!< Invalid or malformed download URL. */
2093 	OTA_STATUS_INVAILD_RB_IMAGE    = 3,
2094 	/*!< Invalid rollback image. */
2095 	OTA_STATUS_INVAILD_FLASH_SIZE    = 4,
2096 	/*!< Flash size on device is not enough for OTA. */
2097 	OTA_STATUS_AlREADY_ENABLED    = 5,
2098 	/*!< An OTA operation is already enabled. */
2099 	OTA_STATUS_UPDATE_INPROGRESS    = 6,
2100 	/*!< An OTA operation update is in progress */
2101 	OTA_STATUS_IMAGE_VERIF_FAILED = 7,
2102 	/*!<  OTA Verfication failed */
2103 	OTA_STATUS_CONNECTION_ERROR = 8,
2104 	/*!< OTA connection error */
2105 	OTA_STATUS_SERVER_ERROR = 9,
2106 	/*!< OTA server Error (file not found or else ...) */
2107 	OTA_STATUS_ABORTED        = 10
2108 	/*!< OTA download has been aborted by the application. */
2109 } tenuOtaUpdateStatus;
2110 /*!
2111 @enum	\
2112 	tenuOtaUpdateStatusType
2113 
2114 @brief
2115 	OTA update Status type
2116 */
2117 typedef enum {
2118 
2119 	DL_STATUS        = 1,
2120 	/*!< Download OTA file status
2121 	*/
2122 	SW_STATUS        = 2,
2123 	/*!< Switching to the upgrade firmware status
2124 	*/
2125 	RB_STATUS        = 3,
2126 	/*!< Roll-back status
2127 	*/
2128 	AB_STATUS        = 4
2129 	/*!< Abort status
2130 	*/
2131 }tenuOtaUpdateStatusType;
2132 
2133 
2134 /*!
2135 @struct	\
2136 	tstrOtaUpdateStatusResp
2137 
2138 @brief
2139 	OTA Update Information
2140 
2141 @sa
2142 	tenuWPSTrigger
2143 */
2144 typedef struct {
2145 	uint8	u8OtaUpdateStatusType;
2146 	/*!<
2147 		Status type tenuOtaUpdateStatusType
2148 	*/
2149 	uint8	u8OtaUpdateStatus;
2150 	/*!<
2151 	OTA_SUCCESS
2152 	OTA_ERR_WORKING_IMAGE_LOAD_FAIL
2153 	OTA_ERR_INVAILD_CONTROL_SEC
2154 	M2M_ERR_OTA_SWITCH_FAIL
2155 	M2M_ERR_OTA_START_UPDATE_FAIL
2156 	M2M_ERR_OTA_ROLLBACK_FAIL
2157 	M2M_ERR_OTA_INVAILD_FLASH_SIZE
2158 	M2M_ERR_OTA_INVAILD_ARG
2159 	*/
2160 	uint8 _PAD16_[2];
2161 }tstrOtaUpdateStatusResp;
2162 
2163 /*!
2164 @struct	\
2165 	tstrOtaUpdateInfo
2166 
2167 @brief
2168 	OTA Update Information
2169 
2170 @sa
2171 	tenuWPSTrigger
2172 */
2173 typedef struct {
2174 	uint32	u8NcfUpgradeVersion;
2175 	/*!< NCF OTA Upgrade Version
2176 	*/
2177 	uint32	u8NcfCurrentVersion;
2178 	/*!< NCF OTA Current firmware version
2179 	*/
2180 	uint32	u8NcdUpgradeVersion;
2181 	/*!< NCD (host) upgraded version (if the u8NcdRequiredUpgrade == true)
2182 	*/
2183 	uint8	u8NcdRequiredUpgrade;
2184 	/*!< NCD Required upgrade to the above version
2185 	*/
2186 	uint8 	u8DownloadUrlOffset;
2187 	/*!< Download URL offset in the received packet
2188 	*/
2189 	uint8 	u8DownloadUrlSize;
2190 	/*!< Download URL size in the received packet
2191 	*/
2192 	uint8	__PAD8__;
2193 	/*!< Padding bytes for forcing 4-byte alignment
2194 	*/
2195 } tstrOtaUpdateInfo;
2196 
2197 /*!
2198 @struct	\
2199 	tstrSystemTime
2200 
2201 @brief
2202 	Used for time storage.
2203 */
2204 typedef struct{
2205 	uint16	u16Year;
2206 	uint8	u8Month;
2207 	uint8	u8Day;
2208 	uint8	u8Hour;
2209 	uint8	u8Minute;
2210 	uint8	u8Second;
2211 	uint8	__PAD8__;
2212 }tstrSystemTime;
2213 
2214 /*!
2215 @struct	\
2216  	tstrM2MMulticastMac
2217 
2218 @brief
2219  	M2M add/remove multi-cast mac address
2220  */
2221  typedef struct {
2222 	uint8 au8macaddress[M2M_MAC_ADDRES_LEN];
2223 	/*!<
2224 		Mac address needed to be added or removed from filter.
2225 	*/
2226 	uint8 u8AddRemove;
2227 	/*!<
2228 		set by 1 to add or 0 to remove from filter.
2229 	*/
2230 	uint8	__PAD8__;
2231 	/*!< Padding bytes for forcing 4-byte alignment
2232 	*/
2233 }tstrM2MMulticastMac;
2234 
2235 /*!
2236 @struct	\
2237  	tstrPrng
2238 
2239 @brief
2240  	M2M Request PRNG
2241  */
2242  typedef struct {
2243 	 /*!<
2244 		return buffer address
2245 	*/
2246 	uint8 *pu8RngBuff;
2247 	 /*!<
2248 		PRNG size requested
2249 	*/
2250 	uint16 	u16PrngSize;
2251 	/*!<
2252 		PRNG pads
2253 	*/
2254 	uint8 __PAD16__[2];
2255 }tstrPrng;
2256 
2257 /*
2258  * TLS certificate revocation list
2259  * Typedefs common between fw and host
2260  */
2261 
2262 /*!
2263 @struct	\
2264  	tstrTlsCrlEntry
2265 
2266 @brief
2267  	Certificate data for inclusion in a revocation list (CRL)
2268 */
2269 typedef struct {
2270 	uint8	u8DataLen;
2271 	/*!<
2272 		Length of certificate data (maximum possible is @ref TLS_CRL_DATA_MAX_LEN)
2273 	*/
2274 	uint8	au8Data[TLS_CRL_DATA_MAX_LEN];
2275 	/*!<
2276 		Certificate data
2277 	*/
2278 	uint8	__PAD24__[3];
2279 	/*!<
2280 		Padding bytes for forcing 4-byte alignment
2281 	*/
2282 }tstrTlsCrlEntry;
2283 
2284 /*!
2285 @struct	\
2286  	tstrTlsCrlInfo
2287 
2288 @brief
2289  	Certificate revocation list details
2290 */
2291 typedef struct {
2292 	uint8			u8CrlType;
2293 	/*!<
2294 		Type of certificate data contained in list
2295 	*/
2296 	uint8			u8Rsv1;
2297 	/*!<
2298 		Reserved for future use
2299 	*/
2300 	uint8			u8Rsv2;
2301 	/*!<
2302 		Reserved for future use
2303 	*/
2304 	uint8			u8Rsv3;
2305 	/*!<
2306 		Reserved for future use
2307 	*/
2308 	tstrTlsCrlEntry	astrTlsCrl[TLS_CRL_MAX_ENTRIES];
2309 	/*!<
2310 		List entries
2311 	*/
2312 }tstrTlsCrlInfo;
2313 
2314  /*!
2315 @enum\
2316 	tenuSslCertExpSettings
2317 
2318 @brief	SSL Certificate Expiry Validation Options
2319 */
2320 typedef enum{
2321 	SSL_CERT_EXP_CHECK_DISABLE,
2322 	/*!<
2323 		ALWAYS OFF.
2324 		Ignore certificate expiration date validation. If a certificate is
2325 		expired or there is no configured system time, the SSL connection SUCCEEDs.
2326 	*/
2327 	SSL_CERT_EXP_CHECK_ENABLE,
2328 	/*!<
2329 		ALWAYS ON.
2330 		Validate certificate expiration date. If a certificate is expired or
2331 		there is no configured system time, the SSL connection FAILs.
2332 	*/
2333 	SSL_CERT_EXP_CHECK_EN_IF_SYS_TIME
2334 	/*!<
2335 		CONDITIONAL VALIDATION (Default setting at startup).
2336 		Validate the certificate expiration date only if there is a configured system time.
2337 		If there is no configured system time, the certificate expiration is bypassed and the
2338 		SSL connection SUCCEEDs.
2339 	*/
2340 }tenuSslCertExpSettings;
2341 
2342 
2343 /*!
2344 @struct	\
2345  	tstrTlsSrvSecFileEntry
2346 
2347 @brief
2348  	This struct contains a TLS certificate.
2349  */
2350 typedef struct{
2351 	char	acFileName[TLS_FILE_NAME_MAX];
2352 	/*!< Name of the certificate.	*/
2353 	uint32	u32FileSize;
2354 	/*!< Size of the certificate.	*/
2355 	uint32	u32FileAddr;
2356 	/*!< Error Code.	*/
2357 }tstrTlsSrvSecFileEntry;
2358 
2359 /*!
2360 @struct	\
2361  	tstrTlsSrvSecHdr
2362 
2363 @brief
2364  	This struct contains a set of TLS certificates.
2365  */
2366 typedef struct{
2367 	uint8					au8SecStartPattern[TLS_SRV_SEC_START_PATTERN_LEN];
2368 	/*!< Start pattern.	*/
2369 	uint32					u32nEntries;
2370 	/*!< Number of certificates stored in the struct.	*/
2371 	uint32					u32NextWriteAddr;
2372 	/*!< TLS Certificates.	*/
2373 	tstrTlsSrvSecFileEntry	astrEntries[TLS_SRV_SEC_MAX_FILES];
2374 }tstrTlsSrvSecHdr;
2375 
2376 typedef struct{
2377 	uint32	u32CsBMP;
2378 }tstrSslSetActiveCsList;
2379 
2380 
2381  /**@}*/
2382 
2383 #endif
2384