version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of cc3000_hostdriver_mbedsocket by
cc3000_event.h@47:e9d12b82813e, 2014-06-25 (annotated)
- Committer:
- erezi
- Date:
- Wed Jun 25 06:08:39 2014 +0000
- Revision:
- 47:e9d12b82813e
- Parent:
- 20:30b6ed7bf8fd
version_2.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 20:30b6ed7bf8fd | 1 | /***************************************************************************** |
Kojto | 20:30b6ed7bf8fd | 2 | * |
Kojto | 20:30b6ed7bf8fd | 3 | * C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to |
Kojto | 20:30b6ed7bf8fd | 4 | * Jim Carver and Frank Vannieuwkerke for their inital cc3000 mbed port and |
Kojto | 20:30b6ed7bf8fd | 5 | * provided help. |
Kojto | 20:30b6ed7bf8fd | 6 | * |
Kojto | 20:30b6ed7bf8fd | 7 | * This version of "host driver" uses CC3000 Host Driver Implementation. Thus |
Kojto | 20:30b6ed7bf8fd | 8 | * read the following copyright: |
Kojto | 20:30b6ed7bf8fd | 9 | * |
Kojto | 20:30b6ed7bf8fd | 10 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
Kojto | 20:30b6ed7bf8fd | 11 | * |
Kojto | 20:30b6ed7bf8fd | 12 | * Redistribution and use in source and binary forms, with or without |
Kojto | 20:30b6ed7bf8fd | 13 | * modification, are permitted provided that the following conditions |
Kojto | 20:30b6ed7bf8fd | 14 | * are met: |
Kojto | 20:30b6ed7bf8fd | 15 | * |
Kojto | 20:30b6ed7bf8fd | 16 | * Redistributions of source code must retain the above copyright |
Kojto | 20:30b6ed7bf8fd | 17 | * notice, this list of conditions and the following disclaimer. |
Kojto | 20:30b6ed7bf8fd | 18 | * |
Kojto | 20:30b6ed7bf8fd | 19 | * Redistributions in binary form must reproduce the above copyright |
Kojto | 20:30b6ed7bf8fd | 20 | * notice, this list of conditions and the following disclaimer in the |
Kojto | 20:30b6ed7bf8fd | 21 | * documentation and/or other materials provided with the |
Kojto | 20:30b6ed7bf8fd | 22 | * distribution. |
Kojto | 20:30b6ed7bf8fd | 23 | * |
Kojto | 20:30b6ed7bf8fd | 24 | * Neither the name of Texas Instruments Incorporated nor the names of |
Kojto | 20:30b6ed7bf8fd | 25 | * its contributors may be used to endorse or promote products derived |
Kojto | 20:30b6ed7bf8fd | 26 | * from this software without specific prior written permission. |
Kojto | 20:30b6ed7bf8fd | 27 | * |
Kojto | 20:30b6ed7bf8fd | 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
Kojto | 20:30b6ed7bf8fd | 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
Kojto | 20:30b6ed7bf8fd | 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
Kojto | 20:30b6ed7bf8fd | 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
Kojto | 20:30b6ed7bf8fd | 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
Kojto | 20:30b6ed7bf8fd | 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
Kojto | 20:30b6ed7bf8fd | 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
Kojto | 20:30b6ed7bf8fd | 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
Kojto | 20:30b6ed7bf8fd | 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Kojto | 20:30b6ed7bf8fd | 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 20:30b6ed7bf8fd | 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 20:30b6ed7bf8fd | 39 | * |
Kojto | 20:30b6ed7bf8fd | 40 | *****************************************************************************/ |
Kojto | 20:30b6ed7bf8fd | 41 | #ifndef CC3000_EVENT_H |
Kojto | 20:30b6ed7bf8fd | 42 | #define CC3000_EVENT_H |
Kojto | 20:30b6ed7bf8fd | 43 | |
Kojto | 20:30b6ed7bf8fd | 44 | typedef struct _bsd_read_return_t |
Kojto | 20:30b6ed7bf8fd | 45 | { |
Kojto | 20:30b6ed7bf8fd | 46 | int32_t iSocketDescriptor; |
Kojto | 20:30b6ed7bf8fd | 47 | int32_t iNumberOfBytes; |
Kojto | 20:30b6ed7bf8fd | 48 | uint32_t uiFlags; |
Kojto | 20:30b6ed7bf8fd | 49 | } tBsdReadReturnParams; |
Kojto | 20:30b6ed7bf8fd | 50 | |
Kojto | 20:30b6ed7bf8fd | 51 | typedef struct _bsd_getsockopt_return_t |
Kojto | 20:30b6ed7bf8fd | 52 | { |
Kojto | 20:30b6ed7bf8fd | 53 | uint8_t ucOptValue[4]; |
Kojto | 20:30b6ed7bf8fd | 54 | uint8_t iStatus; |
Kojto | 20:30b6ed7bf8fd | 55 | } tBsdGetSockOptReturnParams; |
Kojto | 20:30b6ed7bf8fd | 56 | |
Kojto | 20:30b6ed7bf8fd | 57 | typedef struct _bsd_accept_return_t |
Kojto | 20:30b6ed7bf8fd | 58 | { |
Kojto | 20:30b6ed7bf8fd | 59 | int32_t iSocketDescriptor; |
Kojto | 20:30b6ed7bf8fd | 60 | int32_t iStatus; |
Kojto | 20:30b6ed7bf8fd | 61 | sockaddr tSocketAddress; |
Kojto | 20:30b6ed7bf8fd | 62 | |
Kojto | 20:30b6ed7bf8fd | 63 | } tBsdReturnParams; |
Kojto | 20:30b6ed7bf8fd | 64 | |
Kojto | 20:30b6ed7bf8fd | 65 | typedef struct _bsd_select_return_t |
Kojto | 20:30b6ed7bf8fd | 66 | { |
Kojto | 20:30b6ed7bf8fd | 67 | int32_t iStatus; |
Kojto | 20:30b6ed7bf8fd | 68 | uint32_t uiRdfd; |
Kojto | 20:30b6ed7bf8fd | 69 | uint32_t uiWrfd; |
Kojto | 20:30b6ed7bf8fd | 70 | uint32_t uiExfd; |
Kojto | 20:30b6ed7bf8fd | 71 | } tBsdSelectRecvParams; |
Kojto | 20:30b6ed7bf8fd | 72 | |
Kojto | 20:30b6ed7bf8fd | 73 | typedef struct _bsd_gethostbyname_return_t |
Kojto | 20:30b6ed7bf8fd | 74 | { |
Kojto | 20:30b6ed7bf8fd | 75 | int32_t retVal; |
Kojto | 20:30b6ed7bf8fd | 76 | int32_t outputAddress; |
Kojto | 20:30b6ed7bf8fd | 77 | } tBsdGethostbynameParams; |
Kojto | 20:30b6ed7bf8fd | 78 | |
Kojto | 20:30b6ed7bf8fd | 79 | #define FLOW_CONTROL_EVENT_HANDLE_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 80 | #define FLOW_CONTROL_EVENT_BLOCK_MODE_OFFSET (1) |
Kojto | 20:30b6ed7bf8fd | 81 | #define FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET (2) |
Kojto | 20:30b6ed7bf8fd | 82 | #define FLOW_CONTROL_EVENT_SIZE (4) |
Kojto | 20:30b6ed7bf8fd | 83 | |
Kojto | 20:30b6ed7bf8fd | 84 | #define BSD_RSP_PARAMS_SOCKET_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 85 | #define BSD_RSP_PARAMS_STATUS_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 86 | |
Kojto | 20:30b6ed7bf8fd | 87 | #define GET_HOST_BY_NAME_RETVAL_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 88 | #define GET_HOST_BY_NAME_ADDR_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 89 | |
Kojto | 20:30b6ed7bf8fd | 90 | #define ACCEPT_SD_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 91 | #define ACCEPT_RETURN_STATUS_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 92 | #define ACCEPT_ADDRESS__OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 93 | |
Kojto | 20:30b6ed7bf8fd | 94 | #define SL_RECEIVE_SD_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 95 | #define SL_RECEIVE_NUM_BYTES_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 96 | #define SL_RECEIVE__FLAGS__OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 97 | |
Kojto | 20:30b6ed7bf8fd | 98 | |
Kojto | 20:30b6ed7bf8fd | 99 | #define SELECT_STATUS_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 100 | #define SELECT_READFD_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 101 | #define SELECT_WRITEFD_OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 102 | #define SELECT_EXFD_OFFSET (12) |
Kojto | 20:30b6ed7bf8fd | 103 | |
Kojto | 20:30b6ed7bf8fd | 104 | |
Kojto | 20:30b6ed7bf8fd | 105 | #define NETAPP_IPCONFIG_IP_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 106 | #define NETAPP_IPCONFIG_SUBNET_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 107 | #define NETAPP_IPCONFIG_GW_OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 108 | #define NETAPP_IPCONFIG_DHCP_OFFSET (12) |
Kojto | 20:30b6ed7bf8fd | 109 | #define NETAPP_IPCONFIG_DNS_OFFSET (16) |
Kojto | 20:30b6ed7bf8fd | 110 | #define NETAPP_IPCONFIG_MAC_OFFSET (20) |
Kojto | 20:30b6ed7bf8fd | 111 | #define NETAPP_IPCONFIG_SSID_OFFSET (26) |
Kojto | 20:30b6ed7bf8fd | 112 | |
Kojto | 20:30b6ed7bf8fd | 113 | #define NETAPP_IPCONFIG_IP_LENGTH (4) |
Kojto | 20:30b6ed7bf8fd | 114 | #define NETAPP_IPCONFIG_MAC_LENGTH (6) |
Kojto | 20:30b6ed7bf8fd | 115 | #define NETAPP_IPCONFIG_SSID_LENGTH (32) |
Kojto | 20:30b6ed7bf8fd | 116 | |
Kojto | 20:30b6ed7bf8fd | 117 | |
Kojto | 20:30b6ed7bf8fd | 118 | #define NETAPP_PING_PACKETS_SENT_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 119 | #define NETAPP_PING_PACKETS_RCVD_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 120 | #define NETAPP_PING_MIN_RTT_OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 121 | #define NETAPP_PING_MAX_RTT_OFFSET (12) |
Kojto | 20:30b6ed7bf8fd | 122 | #define NETAPP_PING_AVG_RTT_OFFSET (16) |
Kojto | 20:30b6ed7bf8fd | 123 | |
Kojto | 20:30b6ed7bf8fd | 124 | #define GET_SCAN_RESULTS_TABlE_COUNT_OFFSET (0) |
Kojto | 20:30b6ed7bf8fd | 125 | #define GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 126 | #define GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET (8) |
Kojto | 20:30b6ed7bf8fd | 127 | #define GET_SCAN_RESULTS_FRAME_TIME_OFFSET (10) |
Kojto | 20:30b6ed7bf8fd | 128 | #define GET_SCAN_RESULTS_SSID_MAC_LENGTH (38) |
Kojto | 20:30b6ed7bf8fd | 129 | |
Kojto | 20:30b6ed7bf8fd | 130 | #define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((uint8_t *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE) |
Kojto | 20:30b6ed7bf8fd | 131 | |
Kojto | 20:30b6ed7bf8fd | 132 | #define SOCKET_STATUS_ACTIVE 0 |
Kojto | 20:30b6ed7bf8fd | 133 | #define SOCKET_STATUS_INACTIVE 1 |
Kojto | 20:30b6ed7bf8fd | 134 | /* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE. |
Kojto | 20:30b6ed7bf8fd | 135 | Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */ |
Kojto | 20:30b6ed7bf8fd | 136 | #define SOCKET_STATUS_INIT_VAL 0xFFFF |
Kojto | 20:30b6ed7bf8fd | 137 | #define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7)) |
Kojto | 20:30b6ed7bf8fd | 138 | #define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE)) |
Kojto | 20:30b6ed7bf8fd | 139 | |
Kojto | 20:30b6ed7bf8fd | 140 | #define BSD_RECV_FROM_FROMLEN_OFFSET (4) |
Kojto | 20:30b6ed7bf8fd | 141 | #define BSD_RECV_FROM_FROM_OFFSET (16) |
Kojto | 20:30b6ed7bf8fd | 142 | |
Kojto | 20:30b6ed7bf8fd | 143 | #endif |