CC3000HostDriver for device TI CC3000 some changes were made due to mbed compiler and the use of void*
Embed:
(wiki syntax)
Show/hide line numbers
hci.h
00001 /***************************************************************************** 00002 * 00003 * hci.h - CC3000 Host Driver Implementation. 00004 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * Neither the name of Texas Instruments Incorporated nor the names of 00019 * its contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 *****************************************************************************/ 00035 #ifndef __HCI_H__ 00036 #define __HCI_H__ 00037 00038 #include "cc3000_common.h" 00039 00040 //***************************************************************************** 00041 // 00042 // If building with a C++ compiler, make all of the definitions in this header 00043 // have a C binding. 00044 // 00045 //***************************************************************************** 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 00051 #define SPI_HEADER_SIZE (5) 00052 #define SIMPLE_LINK_HCI_CMND_HEADER_SIZE (4) 00053 #define HEADERS_SIZE_CMD (SPI_HEADER_SIZE + SIMPLE_LINK_HCI_CMND_HEADER_SIZE) 00054 #define SIMPLE_LINK_HCI_DATA_CMND_HEADER_SIZE (5) 00055 #define SIMPLE_LINK_HCI_DATA_HEADER_SIZE (5) 00056 #define SIMPLE_LINK_HCI_PATCH_HEADER_SIZE (2) 00057 00058 00059 //***************************************************************************** 00060 // 00061 // Values that can be used as HCI Commands and HCI Packet header defines 00062 // 00063 //***************************************************************************** 00064 #define HCI_TYPE_CMND 0x1 00065 #define HCI_TYPE_DATA 0x2 00066 #define HCI_TYPE_PATCH 0x3 00067 #define HCI_TYPE_EVNT 0x4 00068 00069 00070 #define HCI_EVENT_PATCHES_DRV_REQ (1) 00071 #define HCI_EVENT_PATCHES_FW_REQ (2) 00072 #define HCI_EVENT_PATCHES_BOOTLOAD_REQ (3) 00073 00074 00075 #define HCI_CMND_WLAN_BASE (0x0000) 00076 #define HCI_CMND_WLAN_CONNECT 0x0001 00077 #define HCI_CMND_WLAN_DISCONNECT 0x0002 00078 #define HCI_CMND_WLAN_IOCTL_SET_SCANPARAM 0x0003 00079 #define HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY 0x0004 00080 #define HCI_CMND_WLAN_IOCTL_ADD_PROFILE 0x0005 00081 #define HCI_CMND_WLAN_IOCTL_DEL_PROFILE 0x0006 00082 #define HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS 0x0007 00083 #define HCI_CMND_EVENT_MASK 0x0008 00084 #define HCI_CMND_WLAN_IOCTL_STATUSGET 0x0009 00085 #define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START 0x000A 00086 #define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP 0x000B 00087 #define HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX 0x000C 00088 #define HCI_CMND_WLAN_CONFIGURE_PATCH 0x000D 00089 00090 00091 #define HCI_CMND_SOCKET_BASE 0x1000 00092 #define HCI_CMND_SOCKET 0x1001 00093 #define HCI_CMND_BIND 0x1002 00094 #define HCI_CMND_RECV 0x1004 00095 #define HCI_CMND_ACCEPT 0x1005 00096 #define HCI_CMND_LISTEN 0x1006 00097 #define HCI_CMND_CONNECT 0x1007 00098 #define HCI_CMND_BSD_SELECT 0x1008 00099 #define HCI_CMND_SETSOCKOPT 0x1009 00100 #define HCI_CMND_GETSOCKOPT 0x100A 00101 #define HCI_CMND_CLOSE_SOCKET 0x100B 00102 #define HCI_CMND_RECVFROM 0x100D 00103 #define HCI_CMND_GETHOSTNAME 0x1010 00104 #define HCI_CMND_MDNS_ADVERTISE 0x1011 00105 00106 00107 #define HCI_DATA_BASE 0x80 00108 00109 #define HCI_CMND_SEND (0x01 + HCI_DATA_BASE) 00110 #define HCI_CMND_SENDTO (0x03 + HCI_DATA_BASE) 00111 #define HCI_DATA_BSD_RECVFROM (0x04 + HCI_DATA_BASE) 00112 #define HCI_DATA_BSD_RECV (0x05 + HCI_DATA_BASE) 00113 00114 00115 #define HCI_CMND_NVMEM_CBASE (0x0200) 00116 00117 00118 #define HCI_CMND_NVMEM_CREATE_ENTRY (0x0203) 00119 #define HCI_CMND_NVMEM_SWAP_ENTRY (0x0205) 00120 #define HCI_CMND_NVMEM_READ (0x0201) 00121 #define HCI_CMND_NVMEM_WRITE (0x0090) 00122 #define HCI_CMND_NVMEM_WRITE_PATCH (0x0204) 00123 #define HCI_CMND_READ_SP_VERSION (0x0207) 00124 00125 #define HCI_CMND_READ_BUFFER_SIZE 0x400B 00126 #define HCI_CMND_SIMPLE_LINK_START 0x4000 00127 00128 #define HCI_CMND_NETAPP_BASE 0x2000 00129 00130 #define HCI_NETAPP_DHCP (0x0001 + HCI_CMND_NETAPP_BASE) 00131 #define HCI_NETAPP_PING_SEND (0x0002 + HCI_CMND_NETAPP_BASE) 00132 #define HCI_NETAPP_PING_REPORT (0x0003 + HCI_CMND_NETAPP_BASE) 00133 #define HCI_NETAPP_PING_STOP (0x0004 + HCI_CMND_NETAPP_BASE) 00134 #define HCI_NETAPP_IPCONFIG (0x0005 + HCI_CMND_NETAPP_BASE) 00135 #define HCI_NETAPP_ARP_FLUSH (0x0006 + HCI_CMND_NETAPP_BASE) 00136 #define HCI_NETAPP_SET_DEBUG_LEVEL (0x0008 + HCI_CMND_NETAPP_BASE) 00137 #define HCI_NETAPP_SET_TIMERS (0x0009 + HCI_CMND_NETAPP_BASE) 00138 00139 00140 00141 00142 00143 00144 //***************************************************************************** 00145 // 00146 // Values that can be used as HCI Events defines 00147 // 00148 //***************************************************************************** 00149 #define HCI_EVNT_WLAN_BASE 0x0000 00150 #define HCI_EVNT_WLAN_CONNECT 0x0001 00151 #define HCI_EVNT_WLAN_DISCONNECT \ 00152 0x0002 00153 #define HCI_EVNT_WLAN_IOCTL_ADD_PROFILE \ 00154 0x0005 00155 00156 00157 #define HCI_EVNT_SOCKET HCI_CMND_SOCKET 00158 #define HCI_EVNT_BIND HCI_CMND_BIND 00159 #define HCI_EVNT_RECV HCI_CMND_RECV 00160 #define HCI_EVNT_ACCEPT HCI_CMND_ACCEPT 00161 #define HCI_EVNT_LISTEN HCI_CMND_LISTEN 00162 #define HCI_EVNT_CONNECT HCI_CMND_CONNECT 00163 #define HCI_EVNT_SELECT HCI_CMND_BSD_SELECT 00164 #define HCI_EVNT_CLOSE_SOCKET HCI_CMND_CLOSE_SOCKET 00165 #define HCI_EVNT_RECVFROM HCI_CMND_RECVFROM 00166 #define HCI_EVNT_SETSOCKOPT HCI_CMND_SETSOCKOPT 00167 #define HCI_EVNT_GETSOCKOPT HCI_CMND_GETSOCKOPT 00168 #define HCI_EVNT_BSD_GETHOSTBYNAME HCI_CMND_GETHOSTNAME 00169 #define HCI_EVNT_MDNS_ADVERTISE HCI_CMND_MDNS_ADVERTISE 00170 00171 #define HCI_EVNT_SEND 0x1003 00172 #define HCI_EVNT_WRITE 0x100E 00173 #define HCI_EVNT_SENDTO 0x100F 00174 00175 #define HCI_EVNT_PATCHES_REQ 0x1000 00176 00177 #define HCI_EVNT_UNSOL_BASE 0x4000 00178 00179 #define HCI_EVNT_WLAN_UNSOL_BASE (0x8000) 00180 00181 #define HCI_EVNT_WLAN_UNSOL_CONNECT (0x0001 + HCI_EVNT_WLAN_UNSOL_BASE) 00182 #define HCI_EVNT_WLAN_UNSOL_DISCONNECT (0x0002 + HCI_EVNT_WLAN_UNSOL_BASE) 00183 #define HCI_EVNT_WLAN_UNSOL_INIT (0x0004 + HCI_EVNT_WLAN_UNSOL_BASE) 00184 #define HCI_EVNT_WLAN_TX_COMPLETE (0x0008 + HCI_EVNT_WLAN_UNSOL_BASE) 00185 #define HCI_EVNT_WLAN_UNSOL_DHCP (0x0010 + HCI_EVNT_WLAN_UNSOL_BASE) 00186 #define HCI_EVNT_WLAN_ASYNC_PING_REPORT (0x0040 + HCI_EVNT_WLAN_UNSOL_BASE) 00187 #define HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE (0x0080 + HCI_EVNT_WLAN_UNSOL_BASE) 00188 #define HCI_EVNT_WLAN_KEEPALIVE (0x0200 + HCI_EVNT_WLAN_UNSOL_BASE) 00189 #define HCI_EVNT_BSD_TCP_CLOSE_WAIT (0x0800 + HCI_EVNT_WLAN_UNSOL_BASE) 00190 00191 #define HCI_EVNT_DATA_UNSOL_FREE_BUFF \ 00192 0x4100 00193 00194 #define HCI_EVNT_NVMEM_CREATE_ENTRY \ 00195 HCI_CMND_NVMEM_CREATE_ENTRY 00196 #define HCI_EVNT_NVMEM_SWAP_ENTRY HCI_CMND_NVMEM_SWAP_ENTRY 00197 00198 #define HCI_EVNT_NVMEM_READ HCI_CMND_NVMEM_READ 00199 #define HCI_EVNT_NVMEM_WRITE (0x0202) 00200 00201 #define HCI_EVNT_READ_SP_VERSION \ 00202 HCI_CMND_READ_SP_VERSION 00203 00204 #define HCI_EVNT_INPROGRESS 0xFFFF 00205 00206 00207 #define HCI_DATA_RECVFROM 0x84 00208 #define HCI_DATA_RECV 0x85 00209 #define HCI_DATA_NVMEM 0x91 00210 00211 #define HCI_EVENT_CC3000_CAN_SHUT_DOWN 0x99 00212 00213 //***************************************************************************** 00214 // 00215 // Prototypes for the structures for APIs. 00216 // 00217 //***************************************************************************** 00218 00219 #define HCI_DATA_HEADER_SIZE (5) 00220 #define HCI_EVENT_HEADER_SIZE (5) 00221 #define HCI_DATA_CMD_HEADER_SIZE (5) 00222 #define HCI_PATCH_HEADER_SIZE (6) 00223 00224 #define HCI_PACKET_TYPE_OFFSET (0) 00225 #define HCI_PACKET_ARGSIZE_OFFSET (2) 00226 #define HCI_PACKET_LENGTH_OFFSET (3) 00227 00228 00229 #define HCI_EVENT_OPCODE_OFFSET (1) 00230 #define HCI_EVENT_LENGTH_OFFSET (3) 00231 #define HCI_EVENT_STATUS_OFFSET (4) 00232 #define HCI_DATA_LENGTH_OFFSET (3) 00233 00234 00235 00236 00237 //***************************************************************************** 00238 // 00239 // Prototypes for the APIs. 00240 // 00241 //***************************************************************************** 00242 00243 //***************************************************************************** 00244 // 00245 //! hci_command_send 00246 //! 00247 //! @param usOpcode command operation code 00248 //! @param pucBuff pointer to the command's arguments buffer 00249 //! @param ucArgsLength length of the arguments 00250 //! 00251 //! @return none 00252 //! 00253 //! @brief Initiate an HCI command. 00254 // 00255 //***************************************************************************** 00256 extern unsigned short hci_command_send(unsigned short usOpcode, 00257 unsigned char *ucArgs, 00258 unsigned char ucArgsLength); 00259 00260 00261 //***************************************************************************** 00262 // 00263 //! hci_data_send 00264 //! 00265 //! @param usOpcode command operation code 00266 //! @param ucArgs pointer to the command's arguments buffer 00267 //! @param usArgsLength length of the arguments 00268 //! @param ucTail pointer to the data buffer 00269 //! @param usTailLength buffer length 00270 //! 00271 //! @return none 00272 //! 00273 //! @brief Initiate an HCI data write operation 00274 // 00275 //***************************************************************************** 00276 extern long hci_data_send(unsigned char ucOpcode, 00277 unsigned char *ucArgs, 00278 unsigned short usArgsLength, 00279 unsigned short usDataLength, 00280 const unsigned char *ucTail, 00281 unsigned short usTailLength); 00282 00283 00284 //***************************************************************************** 00285 // 00286 //! hci_data_command_send 00287 //! 00288 //! @param usOpcode command operation code 00289 //! @param pucBuff pointer to the data buffer 00290 //! @param ucArgsLength arguments length 00291 //! @param ucDataLength data length 00292 //! 00293 //! @return none 00294 //! 00295 //! @brief Prepare HCI header and initiate an HCI data write operation 00296 // 00297 //***************************************************************************** 00298 extern void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff, 00299 unsigned char ucArgsLength, unsigned short ucDataLength); 00300 00301 //***************************************************************************** 00302 // 00303 //! hci_patch_send 00304 //! 00305 //! @param usOpcode command operation code 00306 //! @param pucBuff pointer to the command's arguments buffer 00307 //! @param patch pointer to patch content buffer 00308 //! @param usDataLength data length 00309 //! 00310 //! @return none 00311 //! 00312 //! @brief Prepare HCI header and initiate an HCI patch write operation 00313 // 00314 //***************************************************************************** 00315 extern void hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsigned short usDataLength); 00316 00317 00318 00319 //***************************************************************************** 00320 // 00321 // Mark the end of the C bindings section for C++ compilers. 00322 // 00323 //***************************************************************************** 00324 #ifdef __cplusplus 00325 } 00326 #endif // __cplusplus 00327 00328 #endif // __HCI_H__ 00329
Generated on Tue Jul 12 2022 19:26:44 by 1.7.2