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