Freeman Oldman / NUCLEO_STM32F401RE_CC3000_ILI9341
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cc3000_event.h Source File

cc3000_event.h

00001 /*****************************************************************************
00002 *
00003 *  C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to
00004 *  Jim Carver and Frank Vannieuwkerke for their inital cc3000 mbed port and
00005 *  provided help.
00006 *
00007 *  This version of "host driver" uses CC3000 Host Driver Implementation. Thus
00008 *  read the following copyright:
00009 *
00010 *  Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
00011 *
00012 *  Redistribution and use in source and binary forms, with or without
00013 *  modification, are permitted provided that the following conditions
00014 *  are met:
00015 *
00016 *    Redistributions of source code must retain the above copyright
00017 *    notice, this list of conditions and the following disclaimer.
00018 *
00019 *    Redistributions in binary form must reproduce the above copyright
00020 *    notice, this list of conditions and the following disclaimer in the
00021 *    documentation and/or other materials provided with the
00022 *    distribution.
00023 *
00024 *    Neither the name of Texas Instruments Incorporated nor the names of
00025 *    its contributors may be used to endorse or promote products derived
00026 *    from this software without specific prior written permission.
00027 *
00028 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00031 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00032 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00033 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00034 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00035 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00036 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00038 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039 *
00040 *****************************************************************************/
00041 #ifndef CC3000_EVENT_H
00042 #define CC3000_EVENT_H
00043 
00044 typedef struct _bsd_read_return_t
00045 {
00046     int32_t             iSocketDescriptor;
00047     int32_t             iNumberOfBytes;
00048     uint32_t    uiFlags;
00049 } tBsdReadReturnParams;
00050 
00051 typedef struct _bsd_getsockopt_return_t
00052 {
00053     uint8_t ucOptValue[4];
00054     uint8_t          iStatus;
00055 } tBsdGetSockOptReturnParams;
00056 
00057 typedef struct _bsd_accept_return_t
00058 {
00059     int32_t             iSocketDescriptor;
00060     int32_t             iStatus;
00061     sockaddr         tSocketAddress;
00062 
00063 } tBsdReturnParams;
00064 
00065 typedef struct _bsd_select_return_t
00066 {
00067     int32_t            iStatus;
00068     uint32_t           uiRdfd;
00069     uint32_t           uiWrfd;
00070     uint32_t           uiExfd;
00071 } tBsdSelectRecvParams;
00072 
00073 typedef struct _bsd_gethostbyname_return_t
00074 {
00075     int32_t  retVal;
00076     int32_t  outputAddress;
00077 } tBsdGethostbynameParams;
00078 
00079 #define FLOW_CONTROL_EVENT_HANDLE_OFFSET        (0)
00080 #define FLOW_CONTROL_EVENT_BLOCK_MODE_OFFSET    (1)
00081 #define FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET    (2)
00082 #define FLOW_CONTROL_EVENT_SIZE                 (4)
00083 
00084 #define BSD_RSP_PARAMS_SOCKET_OFFSET            (0)
00085 #define BSD_RSP_PARAMS_STATUS_OFFSET            (4)
00086 
00087 #define GET_HOST_BY_NAME_RETVAL_OFFSET          (0)
00088 #define GET_HOST_BY_NAME_ADDR_OFFSET            (4)
00089 
00090 #define ACCEPT_SD_OFFSET                        (0)
00091 #define ACCEPT_RETURN_STATUS_OFFSET             (4)
00092 #define ACCEPT_ADDRESS__OFFSET                  (8)
00093 
00094 #define SL_RECEIVE_SD_OFFSET                    (0)
00095 #define SL_RECEIVE_NUM_BYTES_OFFSET             (4)
00096 #define SL_RECEIVE__FLAGS__OFFSET               (8)
00097 
00098 
00099 #define SELECT_STATUS_OFFSET                    (0)
00100 #define SELECT_READFD_OFFSET                    (4)
00101 #define SELECT_WRITEFD_OFFSET                   (8)
00102 #define SELECT_EXFD_OFFSET                      (12)
00103 
00104 
00105 #define NETAPP_IPCONFIG_IP_OFFSET               (0)
00106 #define NETAPP_IPCONFIG_SUBNET_OFFSET           (4)
00107 #define NETAPP_IPCONFIG_GW_OFFSET               (8)
00108 #define NETAPP_IPCONFIG_DHCP_OFFSET             (12)
00109 #define NETAPP_IPCONFIG_DNS_OFFSET              (16)
00110 #define NETAPP_IPCONFIG_MAC_OFFSET              (20)
00111 #define NETAPP_IPCONFIG_SSID_OFFSET             (26)
00112 
00113 #define NETAPP_IPCONFIG_IP_LENGTH               (4)
00114 #define NETAPP_IPCONFIG_MAC_LENGTH              (6)
00115 #define NETAPP_IPCONFIG_SSID_LENGTH             (32)
00116 
00117 
00118 #define NETAPP_PING_PACKETS_SENT_OFFSET         (0)
00119 #define NETAPP_PING_PACKETS_RCVD_OFFSET         (4)
00120 #define NETAPP_PING_MIN_RTT_OFFSET              (8)
00121 #define NETAPP_PING_MAX_RTT_OFFSET              (12)
00122 #define NETAPP_PING_AVG_RTT_OFFSET              (16)
00123 
00124 #define GET_SCAN_RESULTS_TABlE_COUNT_OFFSET              (0)
00125 #define GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET        (4)
00126 #define GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET       (8)
00127 #define GET_SCAN_RESULTS_FRAME_TIME_OFFSET               (10)
00128 #define GET_SCAN_RESULTS_SSID_MAC_LENGTH                 (38)
00129 
00130 #define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((uint8_t *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
00131 
00132 #define SOCKET_STATUS_ACTIVE       0
00133 #define SOCKET_STATUS_INACTIVE     1
00134 /* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
00135    Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
00136 #define SOCKET_STATUS_INIT_VAL  0xFFFF
00137 #define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
00138 #define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
00139 
00140 #define BSD_RECV_FROM_FROMLEN_OFFSET    (4)
00141 #define BSD_RECV_FROM_FROM_OFFSET       (16)
00142 
00143 #endif
00144