Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.
cc3100_protocol.h
00001 /* 00002 * protocol.h - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 /*******************************************************************************\ 00038 * 00039 * FILE NAME: protocol.h 00040 * 00041 * DESCRIPTION: Constant and data structure definitions and function 00042 * prototypes for the SL protocol module, which implements 00043 * processing of SimpleLink Commands. 00044 * 00045 * AUTHOR: 00046 * 00047 \*******************************************************************************/ 00048 00049 #ifndef SL_PROTOCOL_TYPES_H_ 00050 #define SL_PROTOCOL_TYPES_H_ 00051 00052 namespace mbed_cc3100 { 00053 00054 /**************************************************************************** 00055 ** 00056 ** User I/F pools definitions 00057 ** 00058 ****************************************************************************/ 00059 00060 /**************************************************************************** 00061 ** 00062 ** Definitions for SimpleLink Commands 00063 ** 00064 ****************************************************************************/ 00065 00066 00067 /* pattern for LE 8/16/32 or BE*/ 00068 #define H2N_SYNC_PATTERN {0xBBDDEEFF,0x4321,0x34,0x12} 00069 #define H2N_CNYS_PATTERN {0xBBDDEEFF,0x8765,0x78,0x56} 00070 00071 const uint32_t H2N_DUMMY_PATTERN = (uint32_t)0xFFFFFFFF; 00072 const uint32_t N2H_SYNC_PATTERN = (uint32_t)0xABCDDCBA; 00073 const uint32_t SYNC_PATTERN_LEN = (uint32_t)sizeof(uint32_t); 00074 const uint32_t UART_SET_MODE_MAGIC_CODE = (uint32_t)0xAA55AA55; 00075 #define SPI_16BITS_BUG(pattern) (uint32_t)((uint32_t)pattern & (uint32_t)0xFFFF7FFF) 00076 #define SPI_8BITS_BUG(pattern) (uint32_t)((uint32_t)pattern & (uint32_t)0xFFFFFF7F) 00077 00078 00079 00080 typedef struct { 00081 uint16_t Opcode; 00082 uint16_t Len; 00083 } _SlGenericHeader_t; 00084 00085 00086 typedef struct { 00087 uint32_t Long; 00088 uint16_t Short; 00089 uint8_t Byte1; 00090 uint8_t Byte2; 00091 } _SlSyncPattern_t; 00092 00093 typedef _SlGenericHeader_t _SlCommandHeader_t; 00094 00095 typedef struct { 00096 _SlGenericHeader_t GenHeader; 00097 uint8_t TxPoolCnt; 00098 uint8_t DevStatus; 00099 uint8_t SocketTXFailure; 00100 uint8_t SocketNonBlocking; 00101 } _SlResponseHeader_t; 00102 00103 #define _SL_RESP_SPEC_HDR_SIZE (sizeof(_SlResponseHeader_t) - sizeof(_SlGenericHeader_t)) 00104 #define _SL_RESP_HDR_SIZE sizeof(_SlResponseHeader_t) 00105 #define _SL_CMD_HDR_SIZE sizeof(_SlCommandHeader_t) 00106 00107 #define _SL_RESP_ARGS_START(_pMsg) (((_SlResponseHeader_t *)(_pMsg)) + 1) 00108 00109 /* Used only in NWP! */ 00110 typedef struct { 00111 _SlCommandHeader_t sl_hdr; 00112 uint8_t func_args_start; 00113 } T_SCMD; 00114 00115 00116 const uint8_t WLAN_CONN_STATUS_BIT = 0x01; 00117 const uint8_t EVENTS_Q_STATUS_BIT = 0x02; 00118 const uint8_t PENDING_RCV_CMD_BIT = 0x04; 00119 const uint8_t FW_BUSY_PACKETS_BIT = 0x08; 00120 00121 const uint32_t INIT_STA_OK = 0x11111111; 00122 const uint32_t INIT_STA_ERR = 0x22222222; 00123 const uint32_t INIT_AP_OK = 0x33333333; 00124 const uint32_t INIT_AP_ERR = 0x44444444; 00125 const uint32_t INIT_P2P_OK = 0x55555555; 00126 const uint32_t INIT_P2P_ERR = 0x66666666; 00127 00128 /**************************************************************************** 00129 ** OPCODES 00130 ****************************************************************************/ 00131 const uint16_t SL_IPV4_IPV6_OFFSET = ( 9 ); 00132 const uint16_t SL_OPCODE_IPV4 = ( 0x0 << SL_IPV4_IPV6_OFFSET ); 00133 const uint16_t SL_OPCODE_IPV6 = ( 0x1 << SL_IPV4_IPV6_OFFSET ); 00134 00135 const uint16_t SL_SYNC_ASYNC_OFFSET = ( 10 ); 00136 const uint16_t SL_OPCODE_SYNC = (0x1 << SL_SYNC_ASYNC_OFFSET ); 00137 const uint16_t SL_OPCODE_SILO_OFFSET = ( 11 ); 00138 const uint16_t SL_OPCODE_SILO_MASK = ( 0xF << SL_OPCODE_SILO_OFFSET ); 00139 const uint16_t SL_OPCODE_SILO_DEVICE = ( 0x0 << SL_OPCODE_SILO_OFFSET ); 00140 const uint16_t SL_OPCODE_SILO_WLAN = ( 0x1 << SL_OPCODE_SILO_OFFSET ); 00141 const uint16_t SL_OPCODE_SILO_SOCKET = ( 0x2 << SL_OPCODE_SILO_OFFSET ); 00142 const uint16_t SL_OPCODE_SILO_NETAPP = ( 0x3 << SL_OPCODE_SILO_OFFSET ); 00143 const uint16_t SL_OPCODE_SILO_NVMEM = ( 0x4 << SL_OPCODE_SILO_OFFSET ); 00144 const uint16_t SL_OPCODE_SILO_NETCFG = ( 0x5 << SL_OPCODE_SILO_OFFSET ); 00145 00146 const uint16_t SL_FAMILY_SHIFT = (0x4); 00147 const uint16_t SL_FLAGS_MASK = (0xF); 00148 00149 const uint16_t SL_OPCODE_DEVICE_INITCOMPLETE = 0x0008; 00150 const uint16_t SL_OPCODE_DEVICE_ABORT = 0x000C; 00151 const uint16_t SL_OPCODE_DEVICE_STOP_COMMAND = 0x8473; 00152 const uint16_t SL_OPCODE_DEVICE_STOP_RESPONSE = 0x0473; 00153 const uint16_t SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE = 0x0073; 00154 const uint16_t SL_OPCODE_DEVICE_DEVICEASYNCDUMMY = 0x0063; 00155 00156 const uint16_t SL_OPCODE_DEVICE_VERSIONREADCOMMAND = 0x8470; 00157 const uint16_t SL_OPCODE_DEVICE_VERSIONREADRESPONSE = 0x0470; 00158 const uint16_t SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR = 0x0078; 00159 const uint16_t SL_OPCODE_WLAN_WLANCONNECTCOMMAND = 0x8C80; 00160 const uint16_t SL_OPCODE_WLAN_WLANCONNECTRESPONSE = 0x0C80; 00161 const uint16_t SL_OPCODE_WLAN_WLANASYNCCONNECTEDRESPONSE = 0x0880; 00162 const uint16_t SL_OPCODE_WLAN_P2P_DEV_FOUND = 0x0830; 00163 const uint16_t SL_OPCODE_WLAN_CONNECTION_FAILED = 0x0831; 00164 const uint16_t SL_OPCODE_WLAN_P2P_NEG_REQ_RECEIVED = 0x0832; 00165 00166 const uint16_t SL_OPCODE_WLAN_WLANDISCONNECTCOMMAND = 0x8C81; 00167 const uint16_t SL_OPCODE_WLAN_WLANDISCONNECTRESPONSE = 0x0C81; 00168 const uint16_t SL_OPCODE_WLAN_WLANASYNCDISCONNECTEDRESPONSE = 0x0881; 00169 const uint16_t SL_OPCODE_WLAN_WLANCONNECTEAPCOMMAND = 0x8C82; 00170 const uint16_t SL_OPCODE_WLAN_WLANCONNECTEAPCRESPONSE = 0x0C82; 00171 const uint16_t SL_OPCODE_WLAN_PROFILEADDCOMMAND = 0x8C83; 00172 const uint16_t SL_OPCODE_WLAN_PROFILEADDRESPONSE = 0x0C83; 00173 const uint16_t SL_OPCODE_WLAN_PROFILEGETCOMMAND = 0x8C84; 00174 const uint16_t SL_OPCODE_WLAN_PROFILEGETRESPONSE = 0x0C84; 00175 const uint16_t SL_OPCODE_WLAN_PROFILEDELCOMMAND = 0x8C85; 00176 const uint16_t SL_OPCODE_WLAN_PROFILEDELRESPONSE = 0x0C85; 00177 const uint16_t SL_OPCODE_WLAN_POLICYSETCOMMAND = 0x8C86; 00178 const uint16_t SL_OPCODE_WLAN_POLICYSETRESPONSE = 0x0C86; 00179 const uint16_t SL_OPCODE_WLAN_POLICYGETCOMMAND = 0x8C87; 00180 const uint16_t SL_OPCODE_WLAN_POLICYGETRESPONSE = 0x0C87; 00181 const uint16_t SL_OPCODE_WLAN_FILTERADD = 0x8C88; 00182 const uint16_t SL_OPCODE_WLAN_FILTERADDRESPONSE = 0x0C88; 00183 const uint16_t SL_OPCODE_WLAN_FILTERGET = 0x8C89; 00184 const uint16_t SL_OPCODE_WLAN_FILTERGETRESPONSE = 0x0C89; 00185 const uint16_t SL_OPCODE_WLAN_FILTERDELETE = 0x8C8A; 00186 const uint16_t SL_OPCODE_WLAN_FILTERDELETERESPOSNE = 0x0C8A; 00187 const uint16_t SL_OPCODE_WLAN_WLANGETSTATUSCOMMAND = 0x8C8F; 00188 const uint16_t SL_OPCODE_WLAN_WLANGETSTATUSRESPONSE = 0x0C8F; 00189 const uint16_t SL_OPCODE_WLAN_STARTTXCONTINUESCOMMAND = 0x8CAA; 00190 const uint16_t SL_OPCODE_WLAN_STARTTXCONTINUESRESPONSE = 0x0CAA; 00191 const uint16_t SL_OPCODE_WLAN_STOPTXCONTINUESCOMMAND = 0x8CAB; 00192 const uint16_t SL_OPCODE_WLAN_STOPTXCONTINUESRESPONSE = 0x0CAB; 00193 const uint16_t SL_OPCODE_WLAN_STARTRXSTATCOMMAND = 0x8CAC; 00194 const uint16_t SL_OPCODE_WLAN_STARTRXSTATRESPONSE = 0x0CAC; 00195 const uint16_t SL_OPCODE_WLAN_STOPRXSTATCOMMAND = 0x8CAD; 00196 const uint16_t SL_OPCODE_WLAN_STOPRXSTATRESPONSE = 0x0CAD; 00197 const uint16_t SL_OPCODE_WLAN_GETRXSTATCOMMAND = 0x8CAF; 00198 const uint16_t SL_OPCODE_WLAN_GETRXSTATRESPONSE = 0x0CAF; 00199 const uint16_t SL_OPCODE_WLAN_POLICYSETCOMMANDNEW = 0x8CB0; 00200 const uint16_t SL_OPCODE_WLAN_POLICYSETRESPONSENEW = 0x0CB0; 00201 const uint16_t SL_OPCODE_WLAN_POLICYGETCOMMANDNEW = 0x8CB1; 00202 const uint16_t SL_OPCODE_WLAN_POLICYGETRESPONSENEW = 0x0CB1; 00203 00204 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_COMMAND = 0x8CB2; 00205 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_RESPONSE = 0x0CB2; 00206 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE = 0x08B2; 00207 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_COMMAND = 0x8CB3; 00208 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_RESPONSE = 0x0CB3; 00209 const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE = 0x08B3; 00210 const uint16_t SL_OPCODE_WLAN_SET_MODE = 0x8CB4; 00211 const uint16_t SL_OPCODE_WLAN_SET_MODE_RESPONSE = 0x0CB4; 00212 const uint16_t SL_OPCODE_WLAN_CFG_SET = 0x8CB5; 00213 const uint16_t SL_OPCODE_WLAN_CFG_SET_RESPONSE = 0x0CB5; 00214 const uint16_t SL_OPCODE_WLAN_CFG_GET = 0x8CB6; 00215 const uint16_t SL_OPCODE_WLAN_CFG_GET_RESPONSE = 0x0CB6; 00216 const uint16_t SL_OPCODE_WLAN_STA_CONNECTED = 0x082E; 00217 const uint16_t SL_OPCODE_WLAN_STA_DISCONNECTED = 0x082F; 00218 const uint16_t SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND = 0x8C67; 00219 const uint16_t SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND_RESPONSE = 0x0C67; 00220 00221 const uint16_t SL_OPCODE_SOCKET_SOCKET = 0x9401; 00222 const uint16_t SL_OPCODE_SOCKET_SOCKETRESPONSE = 0x1401; 00223 const uint16_t SL_OPCODE_SOCKET_CLOSE = 0x9402; 00224 const uint16_t SL_OPCODE_SOCKET_CLOSERESPONSE = 0x1402; 00225 const uint16_t SL_OPCODE_SOCKET_ACCEPT = 0x9403; 00226 const uint16_t SL_OPCODE_SOCKET_ACCEPTRESPONSE = 0x1403; 00227 const uint16_t SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE = 0x1003; 00228 const uint16_t SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE_V6 = 0x1203; 00229 const uint16_t SL_OPCODE_SOCKET_BIND = 0x9404; 00230 const uint16_t SL_OPCODE_SOCKET_BIND_V6 = 0x9604; 00231 const uint16_t SL_OPCODE_SOCKET_BINDRESPONSE = 0x1404; 00232 const uint16_t SL_OPCODE_SOCKET_LISTEN = 0x9405; 00233 const uint16_t SL_OPCODE_SOCKET_LISTENRESPONSE = 0x1405; 00234 const uint16_t SL_OPCODE_SOCKET_CONNECT = 0x9406; 00235 const uint16_t SL_OPCODE_SOCKET_CONNECT_V6 = 0x9606; 00236 const uint16_t SL_OPCODE_SOCKET_CONNECTRESPONSE = 0x1406; 00237 const uint16_t SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE = 0x1006; 00238 const uint16_t SL_OPCODE_SOCKET_SELECT = 0x9407; 00239 const uint16_t SL_OPCODE_SOCKET_SELECTRESPONSE = 0x1407; 00240 const uint16_t SL_OPCODE_SOCKET_SELECTASYNCRESPONSE = 0x1007; 00241 const uint16_t SL_OPCODE_SOCKET_SETSOCKOPT = 0x9408; 00242 const uint16_t SL_OPCODE_SOCKET_SETSOCKOPTRESPONSE = 0x1408; 00243 const uint16_t SL_OPCODE_SOCKET_GETSOCKOPT = 0x9409; 00244 const uint16_t SL_OPCODE_SOCKET_GETSOCKOPTRESPONSE = 0x1409; 00245 const uint16_t SL_OPCODE_SOCKET_RECV = 0x940A; 00246 const uint16_t SL_OPCODE_SOCKET_RECVASYNCRESPONSE = 0x100A; 00247 const uint16_t SL_OPCODE_SOCKET_RECVFROM = 0x940B; 00248 const uint16_t SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE = 0x100B; 00249 const uint16_t SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6 = 0x120B; 00250 const uint16_t SL_OPCODE_SOCKET_SEND = 0x940C; 00251 const uint16_t SL_OPCODE_SOCKET_SENDTO = 0x940D; 00252 const uint16_t SL_OPCODE_SOCKET_SENDTO_V6 = 0x960D; 00253 const uint16_t SL_OPCODE_SOCKET_TXFAILEDASYNCRESPONSE = 0x100E; 00254 const uint16_t SL_OPCODE_SOCKET_SOCKETASYNCEVENT = 0x100F; 00255 const uint16_t SL_OPCODE_NETAPP_START_COMMAND = 0x9C0A; 00256 const uint16_t SL_OPCODE_NETAPP_START_RESPONSE = 0x1C0A; 00257 const uint16_t SL_OPCODE_NETAPP_NETAPPSTARTRESPONSE = 0x1C0A; 00258 const uint16_t SL_OPCODE_NETAPP_STOP_COMMAND = 0x9C61; 00259 const uint16_t SL_OPCODE_NETAPP_STOP_RESPONSE = 0x1C61; 00260 const uint16_t SL_OPCODE_NETAPP_NETAPPSET = 0x9C0B; 00261 const uint16_t SL_OPCODE_NETAPP_NETAPPSETRESPONSE = 0x1C0B; 00262 const uint16_t SL_OPCODE_NETAPP_NETAPPGET = 0x9C27; 00263 const uint16_t SL_OPCODE_NETAPP_NETAPPGETRESPONSE = 0x1C27; 00264 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAME = 0x9C20; 00265 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMERESPONSE = 0x1C20; 00266 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE = 0x1820; 00267 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6 = 0x1A20; 00268 const uint16_t SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE = 0x9C71; 00269 const uint16_t SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE_RESPONSE = 0x1C72; 00270 const uint16_t SL_OPCODE_NETAPP_MDNSREGISTERSERVICE = 0x9C34; 00271 const uint16_t SL_OPCODE_NETAPP_MDNSREGISTERSERVICERESPONSE = 0x1C34; 00272 const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICE = 0x9C35; 00273 const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICERESPONSE = 0x1C35; 00274 const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE = 0x1835; 00275 const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6 = 0x1A35; 00276 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDR = 0x9C26; 00277 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDR_V6 = 0x9E26; 00278 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDRRESPONSE = 0x1C26; 00279 const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDRASYNCRESPONSE = 0x1826; 00280 const uint16_t SL_OPCODE_NETAPP_PINGSTART = 0x9C21; 00281 const uint16_t SL_OPCODE_NETAPP_PINGSTART_V6 = 0x9E21; 00282 const uint16_t SL_OPCODE_NETAPP_PINGSTARTRESPONSE = 0x1C21; 00283 const uint16_t SL_OPCODE_NETAPP_PINGREPORTREQUEST = 0x9C22; 00284 const uint16_t SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE = 0x1822; 00285 const uint16_t SL_OPCODE_NETAPP_PINGSTOP = 0x9C23; 00286 const uint16_t SL_OPCODE_NETAPP_PINGSTOPRESPONSE = 0x1C23; 00287 const uint16_t SL_OPCODE_NETAPP_ARPFLUSH = 0x9C24; 00288 const uint16_t SL_OPCODE_NETAPP_ARPFLUSHRESPONSE = 0x1C24; 00289 const uint16_t SL_OPCODE_NETAPP_IPACQUIRED = 0x1825; 00290 const uint16_t SL_OPCODE_NETAPP_IPV4_LOST = 0x1832; 00291 const uint16_t SL_OPCODE_NETAPP_DHCP_IPV4_ACQUIRE_TIMEOUT = 0x1833; 00292 const uint16_t SL_OPCODE_NETAPP_IPACQUIRED_V6 = 0x1A25; 00293 const uint16_t SL_OPCODE_NETAPP_IPERFSTARTCOMMAND = 0x9C28; 00294 const uint16_t SL_OPCODE_NETAPP_IPERFSTARTRESPONSE = 0x1C28; 00295 const uint16_t SL_OPCODE_NETAPP_IPERFSTOPCOMMAND = 0x9C29; 00296 const uint16_t SL_OPCODE_NETAPP_IPERFSTOPRESPONSE = 0x1C29; 00297 const uint16_t SL_OPCODE_NETAPP_CTESTSTARTCOMMAND = 0x9C2A; 00298 const uint16_t SL_OPCODE_NETAPP_CTESTSTARTRESPONSE = 0x1C2A; 00299 const uint16_t SL_OPCODE_NETAPP_CTESTASYNCRESPONSE = 0x182A; 00300 const uint16_t SL_OPCODE_NETAPP_CTESTSTOPCOMMAND = 0x9C2B; 00301 const uint16_t SL_OPCODE_NETAPP_CTESTSTOPRESPONSE = 0x1C2B; 00302 const uint16_t SL_OPCODE_NETAPP_IP_LEASED = 0x182C; 00303 const uint16_t SL_OPCODE_NETAPP_IP_RELEASED = 0x182D; 00304 const uint16_t SL_OPCODE_NETAPP_HTTPGETTOKENVALUE = 0x182E; 00305 const uint16_t SL_OPCODE_NETAPP_HTTPSENDTOKENVALUE = 0x9C2F; 00306 const uint16_t SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE = 0x1830; 00307 const uint16_t SL_OPCODE_NVMEM_FILEOPEN = 0xA43C; 00308 const uint16_t SL_OPCODE_NVMEM_FILEOPENRESPONSE = 0x243C; 00309 const uint16_t SL_OPCODE_NVMEM_FILECLOSE = 0xA43D; 00310 const uint16_t SL_OPCODE_NVMEM_FILECLOSERESPONSE = 0x243D; 00311 const uint16_t SL_OPCODE_NVMEM_FILEREADCOMMAND = 0xA440; 00312 const uint16_t SL_OPCODE_NVMEM_FILEREADRESPONSE = 0x2440; 00313 const uint16_t SL_OPCODE_NVMEM_FILEWRITECOMMAND = 0xA441; 00314 const uint16_t SL_OPCODE_NVMEM_FILEWRITERESPONSE = 0x2441; 00315 const uint16_t SL_OPCODE_NVMEM_FILEGETINFOCOMMAND = 0xA442; 00316 const uint16_t SL_OPCODE_NVMEM_FILEGETINFORESPONSE = 0x2442; 00317 const uint16_t SL_OPCODE_NVMEM_FILEDELCOMMAND = 0xA443; 00318 const uint16_t SL_OPCODE_NVMEM_FILEDELRESPONSE = 0x2443; 00319 const uint16_t SL_OPCODE_NVMEM_NVMEMFORMATCOMMAND = 0xA444; 00320 const uint16_t SL_OPCODE_NVMEM_NVMEMFORMATRESPONSE = 0x2444; 00321 00322 const uint16_t SL_OPCODE_DEVICE_SETDEBUGLEVELCOMMAND = 0x846A; 00323 const uint16_t SL_OPCODE_DEVICE_SETDEBUGLEVELRESPONSE = 0x046A; 00324 00325 const uint16_t SL_OPCODE_DEVICE_NETCFG_SET_COMMAND = 0x8432; 00326 const uint16_t SL_OPCODE_DEVICE_NETCFG_SET_RESPONSE = 0x0432; 00327 const uint16_t SL_OPCODE_DEVICE_NETCFG_GET_COMMAND = 0x8433; 00328 const uint16_t SL_OPCODE_DEVICE_NETCFG_GET_RESPONSE = 0x0433; 00329 /* */ 00330 const uint16_t SL_OPCODE_DEVICE_SETUARTMODECOMMAND = 0x846B; 00331 const uint16_t SL_OPCODE_DEVICE_SETUARTMODERESPONSE = 0x046B; 00332 const uint16_t SL_OPCODE_DEVICE_SSISIZESETCOMMAND = 0x846B; 00333 const uint16_t SL_OPCODE_DEVICE_SSISIZESETRESPONSE = 0x046B; 00334 00335 /* */ 00336 const uint16_t SL_OPCODE_DEVICE_EVENTMASKSET = 0x8464; 00337 const uint16_t SL_OPCODE_DEVICE_EVENTMASKSETRESPONSE = 0x0464; 00338 const uint16_t SL_OPCODE_DEVICE_EVENTMASKGET = 0x8465; 00339 const uint16_t SL_OPCODE_DEVICE_EVENTMASKGETRESPONSE = 0x0465; 00340 00341 const uint16_t SL_OPCODE_DEVICE_DEVICEGET = 0x8466; 00342 const uint16_t SL_OPCODE_DEVICE_DEVICEGETRESPONSE = 0x0466; 00343 const uint16_t SL_OPCODE_DEVICE_DEVICESET = 0x84B7; 00344 const uint16_t SL_OPCODE_DEVICE_DEVICESETRESPONSE = 0x04B7; 00345 00346 const uint16_t SL_OPCODE_WLAN_SCANRESULTSGETCOMMAND = 0x8C8C; 00347 const uint16_t SL_OPCODE_WLAN_SCANRESULTSGETRESPONSE = 0x0C8C; 00348 const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTSET = 0x8C8D; 00349 const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTSETRESPONSE = 0x0C8D; 00350 const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTGET = 0x8C8E; 00351 const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTGETRESPONSE = 0x0C8E; 00352 00353 00354 /* Rx Filters opcodes */ 00355 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND = 0x8C6C; 00356 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERADDRESPONSE = 0x0C6C; 00357 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERSETCOMMAND = 0x8C6D; 00358 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERSETRESPONSE = 0x0C6D; 00359 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFOCOMMAND = 0x8C6E; 00360 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFORESPONSE = 0x0C6E; 00361 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETCOMMAND = 0x8C6F; 00362 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETRESPONSE = 0x0C6F; 00363 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETINFO = 0x8C70; 00364 const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETINFORESPONSE = 0x0C70; 00365 00366 00367 /******************************************************************************************/ 00368 /* Device structs */ 00369 /******************************************************************************************/ 00370 typedef uint32_t InitStatus_t; 00371 00372 00373 typedef struct { 00374 int32_t Status; 00375 } InitComplete_t; 00376 00377 typedef struct { 00378 int16_t status; 00379 uint16_t padding; 00380 00381 } _BasicResponse_t; 00382 00383 typedef struct { 00384 uint16_t Timeout; 00385 uint16_t padding; 00386 } _DevStopCommand_t; 00387 00388 typedef struct { 00389 uint32_t group; 00390 uint32_t mask; 00391 } _DevMaskEventSetCommand_t; 00392 00393 typedef _BasicResponse_t _DevMaskEventSetResponse_t; 00394 00395 00396 typedef struct { 00397 uint32_t group; 00398 } _DevMaskEventGetCommand_t; 00399 00400 00401 typedef struct { 00402 uint32_t group; 00403 uint32_t mask; 00404 } _DevMaskEventGetResponse_t; 00405 00406 00407 typedef struct { 00408 uint32_t group; 00409 } _DevStatusGetCommand_t; 00410 00411 00412 typedef struct { 00413 uint32_t group; 00414 uint32_t status; 00415 } _DevStatusGetResponse_t; 00416 00417 typedef struct { 00418 uint32_t ChipId; 00419 uint32_t FwVersion[4]; 00420 uint8_t PhyVersion[4]; 00421 } _Device_VersionReadResponsePart_t; 00422 00423 typedef struct { 00424 _Device_VersionReadResponsePart_t part; 00425 uint32_t NwpVersion[4]; 00426 uint16_t RomVersion; 00427 uint16_t Padding; 00428 } _Device_VersionReadResponseFull_t; 00429 00430 00431 typedef struct { 00432 uint32_t BaudRate; 00433 uint8_t FlowControlEnable; 00434 } _DevUartSetModeCommand_t; 00435 00436 typedef _BasicResponse_t _DevUartSetModeResponse_t; 00437 00438 /******************************************************/ 00439 00440 typedef struct { 00441 uint8_t SsiSizeInBytes; 00442 uint8_t Padding[3]; 00443 } _StellarisSsiSizeSet_t; 00444 00445 /*****************************************************************************************/ 00446 /* WLAN structs */ 00447 /*****************************************************************************************/ 00448 #define MAXIMAL_PASSWORD_LENGTH (64) 00449 00450 typedef struct { 00451 uint8_t SecType; 00452 uint8_t SsidLen; 00453 uint8_t Bssid[6]; 00454 uint8_t PasswordLen; 00455 } _WlanConnectCommon_t; 00456 00457 #define SSID_STRING(pCmd) (int8_t *)((_WlanConnectCommon_t *)(pCmd) + 1) 00458 #define PASSWORD_STRING(pCmd) (SSID_STRING(pCmd) + ((_WlanConnectCommon_t *)(pCmd))->SsidLen) 00459 00460 typedef struct { 00461 _WlanConnectCommon_t Common; 00462 uint8_t UserLen; 00463 uint8_t AnonUserLen; 00464 uint8_t CertIndex; 00465 uint32_t EapBitmask; 00466 } _WlanConnectEapCommand_t; 00467 00468 #define EAP_SSID_STRING(pCmd) (int8_t *)((_WlanConnectEapCommand_t *)(pCmd) + 1) 00469 #define EAP_PASSWORD_STRING(pCmd) (EAP_SSID_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->Common.SsidLen) 00470 #define EAP_USER_STRING(pCmd) (EAP_PASSWORD_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->Common.PasswordLen) 00471 #define EAP_ANON_USER_STRING(pCmd) (EAP_USER_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->UserLen) 00472 00473 00474 typedef struct { 00475 uint8_t PolicyType; 00476 uint8_t Padding; 00477 uint8_t PolicyOption; 00478 uint8_t PolicyOptionLen; 00479 } _WlanPoliciySetGet_t; 00480 00481 00482 typedef struct { 00483 uint32_t minDwellTime; 00484 uint32_t maxDwellTime; 00485 uint32_t numProbeResponse; 00486 uint32_t G_Channels_mask; 00487 int32_t rssiThershold; 00488 int32_t snrThershold; 00489 int32_t defaultTXPower; 00490 uint16_t intervalList[16]; 00491 } _WlanScanParamSetCommand_t; 00492 00493 00494 typedef struct { 00495 int8_t SecType; 00496 uint8_t SsidLen; 00497 uint8_t Priority; 00498 uint8_t Bssid[6]; 00499 uint8_t PasswordLen; 00500 uint8_t WepKeyId; 00501 } _WlanAddGetProfile_t; 00502 00503 00504 typedef struct { 00505 _WlanAddGetProfile_t Common; 00506 uint8_t UserLen; 00507 uint8_t AnonUserLen; 00508 uint8_t CertIndex; 00509 uint16_t padding; 00510 uint32_t EapBitmask; 00511 } _WlanAddGetEapProfile_t; 00512 00513 #define PROFILE_SSID_STRING(pCmd) ((int8_t *)((_WlanAddGetProfile_t *)(pCmd) + 1)) 00514 #define PROFILE_PASSWORD_STRING(pCmd) (PROFILE_SSID_STRING(pCmd) + ((_WlanAddGetProfile_t *)(pCmd))->SsidLen) 00515 00516 #define EAP_PROFILE_SSID_STRING(pCmd) (int8_t *)((_WlanAddGetEapProfile_t *)(pCmd) + 1) 00517 #define EAP_PROFILE_PASSWORD_STRING(pCmd) (EAP_PROFILE_SSID_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->Common.SsidLen) 00518 #define EAP_PROFILE_USER_STRING(pCmd) (EAP_PROFILE_PASSWORD_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->Common.PasswordLen) 00519 #define EAP_PROFILE_ANON_USER_STRING(pCmd) (EAP_PROFILE_USER_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->UserLen) 00520 00521 typedef struct { 00522 uint8_t index; 00523 uint8_t padding[3]; 00524 } _WlanProfileDelGetCommand_t; 00525 00526 typedef _BasicResponse_t _WlanGetNetworkListResponse_t; 00527 00528 typedef struct { 00529 uint8_t index; 00530 uint8_t count; 00531 int8_t padding[2]; 00532 } _WlanGetNetworkListCommand_t; 00533 00534 00535 00536 00537 typedef struct { 00538 uint32_t groupIdBitmask; 00539 uint8_t cipher; 00540 uint8_t publicKeyLen; 00541 uint8_t group1KeyLen; 00542 uint8_t group2KeyLen; 00543 } _WlanSmartConfigStartCommand_t; 00544 00545 #define SMART_CONFIG_START_PUBLIC_KEY_STRING(pCmd) ((int8_t *)((_WlanSmartConfigStartCommand_t *)(pCmd) + 1)) 00546 #define SMART_CONFIG_START_GROUP1_KEY_STRING(pCmd) ((int8_t *) (SMART_CONFIG_START_PUBLIC_KEY_STRING(pCmd) + ((_WlanSmartConfigStartCommand_t *)(pCmd))->publicKeyLen)) 00547 #define SMART_CONFIG_START_GROUP2_KEY_STRING(pCmd) ((int8_t *) (SMART_CONFIG_START_GROUP1_KEY_STRING(pCmd) + ((_WlanSmartConfigStartCommand_t *)(pCmd))->group1KeyLen)) 00548 00549 typedef struct { 00550 uint8_t mode; 00551 uint8_t padding[3]; 00552 } _WlanSetMode_t; 00553 00554 00555 00556 00557 typedef struct { 00558 uint16_t Status; 00559 uint16_t ConfigId; 00560 uint16_t ConfigOpt; 00561 uint16_t ConfigLen; 00562 } _WlanCfgSetGet_t; 00563 00564 00565 //wlan_rx_filters moved 00566 00567 typedef struct { 00568 uint16_t status; 00569 uint8_t WlanRole; /* 0 = station, 2 = AP */ 00570 uint8_t Ipv6Enabled; 00571 uint8_t Ipv6DhcpEnabled; 00572 00573 uint32_t ipV6Global[4]; 00574 uint32_t ipV6Local[4]; 00575 uint32_t ipV6DnsServer[4]; 00576 uint8_t Ipv6DhcpState; 00577 00578 } _NetappIpV6configRetArgs_t; 00579 00580 00581 typedef struct { 00582 uint8_t ipV4[4]; 00583 uint8_t ipV4Mask[4]; 00584 uint8_t ipV4Gateway[4]; 00585 uint8_t ipV4DnsServer[4]; 00586 uint8_t ipV4Start[4]; 00587 uint8_t ipV4End[4]; 00588 } _NetCfgIpV4AP_Args_t; 00589 00590 00591 00592 typedef struct { 00593 uint16_t status; 00594 uint8_t MacAddr[6]; 00595 } _MAC_Address_SetGet_t; 00596 00597 00598 typedef struct { 00599 uint16_t Status; 00600 uint16_t ConfigId; 00601 uint16_t ConfigOpt; 00602 uint16_t ConfigLen; 00603 } _NetCfgSetGet_t; 00604 00605 typedef struct { 00606 uint16_t Status; 00607 uint16_t DeviceSetId; 00608 uint16_t Option; 00609 uint16_t ConfigLen; 00610 } _DeviceSetGet_t; 00611 00612 00613 00614 00615 /******************************************************************************************/ 00616 /* Socket structs */ 00617 /******************************************************************************************/ 00618 00619 typedef struct { 00620 uint8_t Domain; 00621 uint8_t Type; 00622 uint8_t Protocol; 00623 uint8_t Padding; 00624 } _SocketCommand_t; 00625 00626 00627 typedef struct { 00628 int16_t statusOrLen; 00629 uint8_t sd; 00630 uint8_t padding; 00631 } _SocketResponse_t; 00632 00633 typedef struct { 00634 uint8_t sd; 00635 uint8_t family; 00636 uint8_t padding1; 00637 uint8_t padding2; 00638 } _AcceptCommand_t; 00639 00640 00641 typedef struct { 00642 int16_t statusOrLen; 00643 uint8_t sd; 00644 uint8_t family; 00645 uint16_t port; 00646 uint16_t paddingOrAddr; 00647 uint32_t address; 00648 } _SocketAddrAsyncIPv4Response_t; 00649 00650 typedef struct { 00651 int16_t statusOrLen; 00652 uint8_t sd; 00653 uint8_t family; 00654 uint16_t port; 00655 uint8_t address[6]; 00656 } _SocketAddrAsyncIPv6EUI48Response_t; 00657 typedef struct { 00658 int16_t statusOrLen; 00659 uint8_t sd; 00660 uint8_t family; 00661 uint16_t port; 00662 uint16_t paddingOrAddr; 00663 uint32_t address[4]; 00664 } _SocketAddrAsyncIPv6Response_t; 00665 00666 00667 typedef struct { 00668 int16_t lenOrPadding; 00669 uint8_t sd; 00670 uint8_t FamilyAndFlags; 00671 uint16_t port; 00672 uint16_t paddingOrAddr; 00673 uint32_t address; 00674 } _SocketAddrIPv4Command_t; 00675 00676 typedef struct { 00677 int16_t lenOrPadding; 00678 uint8_t sd; 00679 uint8_t FamilyAndFlags; 00680 uint16_t port; 00681 uint8_t address[6]; 00682 } _SocketAddrIPv6EUI48Command_t; 00683 typedef struct { 00684 int16_t lenOrPadding; 00685 uint8_t sd; 00686 uint8_t FamilyAndFlags; 00687 uint16_t port; 00688 uint16_t paddingOrAddr; 00689 uint32_t address[4]; 00690 } _SocketAddrIPv6Command_t; 00691 00692 typedef union { 00693 _SocketAddrIPv4Command_t IpV4; 00694 _SocketAddrIPv6EUI48Command_t IpV6EUI48; 00695 #ifdef SL_SUPPORT_IPV6 00696 _SocketAddrIPv6Command_t IpV6; 00697 #endif 00698 } _SocketAddrCommand_u; 00699 00700 typedef union { 00701 _SocketAddrAsyncIPv4Response_t IpV4; 00702 _SocketAddrAsyncIPv6EUI48Response_t IpV6EUI48; 00703 #ifdef SL_SUPPORT_IPV6 00704 _SocketAddrAsyncIPv6Response_t IpV6; 00705 #endif 00706 } _SocketAddrResponse_u; 00707 00708 typedef struct { 00709 uint8_t sd; 00710 uint8_t backlog; 00711 uint8_t padding1; 00712 uint8_t padding2; 00713 } _ListenCommand_t; 00714 00715 typedef struct { 00716 uint8_t sd; 00717 uint8_t padding0; 00718 uint8_t padding1; 00719 uint8_t padding2; 00720 } _CloseCommand_t; 00721 00722 00723 typedef struct { 00724 uint8_t nfds; 00725 uint8_t readFdsCount; 00726 uint8_t writeFdsCount; 00727 uint8_t padding; 00728 uint16_t readFds; 00729 uint16_t writeFds; 00730 uint16_t tv_usec; 00731 uint16_t tv_sec; 00732 } _SelectCommand_t; 00733 00734 00735 typedef struct { 00736 uint16_t status; 00737 uint8_t readFdsCount; 00738 uint8_t writeFdsCount; 00739 uint16_t readFds; 00740 uint16_t writeFds; 00741 } _SelectAsyncResponse_t; 00742 00743 typedef struct { 00744 uint8_t sd; 00745 uint8_t level; 00746 uint8_t optionName; 00747 uint8_t optionLen; 00748 } _setSockOptCommand_t; 00749 00750 typedef struct { 00751 uint8_t sd; 00752 uint8_t level; 00753 uint8_t optionName; 00754 uint8_t optionLen; 00755 } _getSockOptCommand_t; 00756 00757 typedef struct { 00758 int16_t status; 00759 uint8_t sd; 00760 uint8_t optionLen; 00761 } _getSockOptResponse_t; 00762 00763 00764 typedef struct { 00765 uint16_t StatusOrLen; 00766 uint8_t sd; 00767 uint8_t FamilyAndFlags; 00768 } _sendRecvCommand_t; 00769 00770 //netapp structs moved 00771 00772 /***************************************************************************************** 00773 * FS structs 00774 ******************************************************************************************/ 00775 00776 typedef struct { 00777 uint32_t FileHandle; 00778 uint32_t Offset; 00779 uint16_t Len; 00780 uint16_t Padding; 00781 } _FsReadCommand_t; 00782 00783 typedef struct { 00784 uint32_t Mode; 00785 uint32_t Token; 00786 } _FsOpenCommand_t; 00787 00788 typedef struct { 00789 uint32_t FileHandle; 00790 uint32_t Token; 00791 } _FsOpenResponse_t; 00792 00793 00794 typedef struct { 00795 uint32_t FileHandle; 00796 uint32_t CertificFileNameLength; 00797 uint32_t SignatureLen; 00798 } _FsCloseCommand_t; 00799 00800 00801 typedef _BasicResponse_t _FsReadResponse_t; 00802 typedef _BasicResponse_t _FsDeleteResponse_t; 00803 typedef _BasicResponse_t _FsCloseResponse_t; 00804 00805 typedef struct { 00806 uint16_t Status; 00807 uint16_t flags; 00808 uint32_t FileLen; 00809 uint32_t AllocatedLen; 00810 uint32_t Token[4]; 00811 } _FsGetInfoResponse_t; 00812 00813 typedef struct { 00814 uint8_t DeviceID; 00815 uint8_t Padding[3]; 00816 } _FsFormatCommand_t; 00817 00818 typedef _BasicResponse_t _FsFormatResponse_t; 00819 00820 typedef struct { 00821 uint32_t Token; 00822 } _FsDeleteCommand_t; 00823 00824 typedef _FsDeleteCommand_t _FsGetInfoCommand_t; 00825 00826 typedef struct { 00827 uint32_t FileHandle; 00828 uint32_t Offset; 00829 uint16_t Len; 00830 uint16_t Padding; 00831 } _FsWriteCommand_t; 00832 00833 typedef _BasicResponse_t _FsWriteResponse_t; 00834 00835 00836 /* TODO: Set MAx Async Payload length depending on flavor (Tiny, Small, etc.) */ 00837 00838 #ifdef SL_TINY_EXT 00839 #define SL_ASYNC_MAX_PAYLOAD_LEN 120 /* size must be aligned to 4 */ 00840 #else 00841 #define SL_ASYNC_MAX_PAYLOAD_LEN 160 /* size must be aligned to 4 */ 00842 #endif 00843 #define SL_ASYNC_MAX_MSG_LEN (_SL_RESP_HDR_SIZE + SL_ASYNC_MAX_PAYLOAD_LEN) 00844 00845 #define RECV_ARGS_SIZE (sizeof(_SocketResponse_t)) 00846 #define RECVFROM_IPV4_ARGS_SIZE (sizeof(_SocketAddrAsyncIPv4Response_t)) 00847 #define RECVFROM_IPV6_ARGS_SIZE (sizeof(_SocketAddrAsyncIPv6Response_t)) 00848 00849 #define SL_IPV4_ADDRESS_SIZE (sizeof(uint32_t)) 00850 #define SL_IPV6_ADDRESS_SIZE (4 * sizeof(uint32_t)) 00851 00852 }//namespace mbed_cc3100 00853 00854 #endif /* _SL_PROTOCOL_TYPES_H_ */ 00855
Generated on Tue Jul 12 2022 22:22:38 by 1.7.2