version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of cc3000_hostdriver_mbedsocket by
cc3000.h@23:fed7f64dd520, 2013-10-03 (annotated)
- Committer:
- SolderSplashLabs
- Date:
- Thu Oct 03 21:00:00 2013 +0000
- Revision:
- 23:fed7f64dd520
- Parent:
- 21:fb34ac8d9af5
- Child:
- 24:ba3fa29197ac
Added separate debug messages and VT100 formatting
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SolderSplashLabs | 23:fed7f64dd520 | 1 | /***************************************************************************** |
SolderSplashLabs | 23:fed7f64dd520 | 2 | * |
SolderSplashLabs | 23:fed7f64dd520 | 3 | * C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to |
SolderSplashLabs | 23:fed7f64dd520 | 4 | * Jim Carver and Frank Vannieuwkerke for their inital cc3000 mbed port and |
SolderSplashLabs | 23:fed7f64dd520 | 5 | * provided help. |
SolderSplashLabs | 23:fed7f64dd520 | 6 | * |
SolderSplashLabs | 23:fed7f64dd520 | 7 | * This version of "host driver" uses CC3000 Host Driver Implementation. Thus |
SolderSplashLabs | 23:fed7f64dd520 | 8 | * read the following copyright: |
SolderSplashLabs | 23:fed7f64dd520 | 9 | * |
SolderSplashLabs | 23:fed7f64dd520 | 10 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
SolderSplashLabs | 23:fed7f64dd520 | 11 | * |
SolderSplashLabs | 23:fed7f64dd520 | 12 | * Redistribution and use in source and binary forms, with or without |
SolderSplashLabs | 23:fed7f64dd520 | 13 | * modification, are permitted provided that the following conditions |
SolderSplashLabs | 23:fed7f64dd520 | 14 | * are met: |
SolderSplashLabs | 23:fed7f64dd520 | 15 | * |
SolderSplashLabs | 23:fed7f64dd520 | 16 | * Redistributions of source code must retain the above copyright |
SolderSplashLabs | 23:fed7f64dd520 | 17 | * notice, this list of conditions and the following disclaimer. |
SolderSplashLabs | 23:fed7f64dd520 | 18 | * |
SolderSplashLabs | 23:fed7f64dd520 | 19 | * Redistributions in binary form must reproduce the above copyright |
SolderSplashLabs | 23:fed7f64dd520 | 20 | * notice, this list of conditions and the following disclaimer in the |
SolderSplashLabs | 23:fed7f64dd520 | 21 | * documentation and/or other materials provided with the |
SolderSplashLabs | 23:fed7f64dd520 | 22 | * distribution. |
SolderSplashLabs | 23:fed7f64dd520 | 23 | * |
SolderSplashLabs | 23:fed7f64dd520 | 24 | * Neither the name of Texas Instruments Incorporated nor the names of |
SolderSplashLabs | 23:fed7f64dd520 | 25 | * its contributors may be used to endorse or promote products derived |
SolderSplashLabs | 23:fed7f64dd520 | 26 | * from this software without specific prior written permission. |
SolderSplashLabs | 23:fed7f64dd520 | 27 | * |
SolderSplashLabs | 23:fed7f64dd520 | 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
SolderSplashLabs | 23:fed7f64dd520 | 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
SolderSplashLabs | 23:fed7f64dd520 | 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
SolderSplashLabs | 23:fed7f64dd520 | 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
SolderSplashLabs | 23:fed7f64dd520 | 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
SolderSplashLabs | 23:fed7f64dd520 | 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
SolderSplashLabs | 23:fed7f64dd520 | 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
SolderSplashLabs | 23:fed7f64dd520 | 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
SolderSplashLabs | 23:fed7f64dd520 | 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
SolderSplashLabs | 23:fed7f64dd520 | 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
SolderSplashLabs | 23:fed7f64dd520 | 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
SolderSplashLabs | 23:fed7f64dd520 | 39 | * |
SolderSplashLabs | 23:fed7f64dd520 | 40 | *****************************************************************************/ |
SolderSplashLabs | 23:fed7f64dd520 | 41 | #ifndef CC3000_H |
SolderSplashLabs | 23:fed7f64dd520 | 42 | #define CC3000_H |
SolderSplashLabs | 23:fed7f64dd520 | 43 | |
SolderSplashLabs | 23:fed7f64dd520 | 44 | #include "mbed.h" |
SolderSplashLabs | 23:fed7f64dd520 | 45 | #include "cc3000_common.h" |
SolderSplashLabs | 23:fed7f64dd520 | 46 | #include "cc3000_spi.h" |
SolderSplashLabs | 23:fed7f64dd520 | 47 | #include "cc3000_simplelink.h" |
SolderSplashLabs | 23:fed7f64dd520 | 48 | #include "cc3000_netapp.h" |
SolderSplashLabs | 23:fed7f64dd520 | 49 | #include "cc3000_nvmem.h" |
SolderSplashLabs | 23:fed7f64dd520 | 50 | #include "cc3000_socket.h" |
SolderSplashLabs | 23:fed7f64dd520 | 51 | |
SolderSplashLabs | 23:fed7f64dd520 | 52 | #define MAX_SOCKETS 4 |
SolderSplashLabs | 23:fed7f64dd520 | 53 | |
SolderSplashLabs | 23:fed7f64dd520 | 54 | /** Enable debug messages, comment out the ones you don't want |
SolderSplashLabs | 23:fed7f64dd520 | 55 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 56 | #define CC3000_DEBUG_SOCKET |
SolderSplashLabs | 23:fed7f64dd520 | 57 | #define CC3000_DEBUG_HCI_TX |
SolderSplashLabs | 23:fed7f64dd520 | 58 | #define CC3000_DEBUG_HCI_RX |
SolderSplashLabs | 23:fed7f64dd520 | 59 | #define CC3000_DEBUG |
SolderSplashLabs | 23:fed7f64dd520 | 60 | |
SolderSplashLabs | 23:fed7f64dd520 | 61 | // Add color too the debug messages, requires a VT100 terminal like putty, comment out to remove |
SolderSplashLabs | 23:fed7f64dd520 | 62 | #define VT100_COLOUR |
SolderSplashLabs | 23:fed7f64dd520 | 63 | |
SolderSplashLabs | 23:fed7f64dd520 | 64 | #ifdef CC3000_DEBUG_SOCKET |
SolderSplashLabs | 23:fed7f64dd520 | 65 | |
SolderSplashLabs | 23:fed7f64dd520 | 66 | #ifdef VT100_COLOUR |
SolderSplashLabs | 23:fed7f64dd520 | 67 | #define DBG_SOCKET(x, ...) std::printf("\x1b[2;32;40m[CC3000 : SOCKET] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 68 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 69 | #define DBG_SOCKET(x, ...) std::printf("[CC3000 : SOCKET] "x"\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 70 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 71 | |
SolderSplashLabs | 23:fed7f64dd520 | 72 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 73 | #define DBG_SOCKET(x, ...) |
SolderSplashLabs | 23:fed7f64dd520 | 74 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 75 | |
SolderSplashLabs | 23:fed7f64dd520 | 76 | #ifdef CC3000_DEBUG_HCI_TX |
SolderSplashLabs | 23:fed7f64dd520 | 77 | |
SolderSplashLabs | 23:fed7f64dd520 | 78 | #ifdef VT100_COLOUR |
SolderSplashLabs | 23:fed7f64dd520 | 79 | #define DBG_HCI(x, ...) std::printf("\x1b[2;35;40m[CC3000 : HCI RX] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 80 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 81 | #define DBG_HCI(x, ...) std::printf("[CC3000 : HCI RX] "x"\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 82 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 83 | |
SolderSplashLabs | 23:fed7f64dd520 | 84 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 85 | #define DBG_HCI(x, ...) |
SolderSplashLabs | 23:fed7f64dd520 | 86 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 87 | |
SolderSplashLabs | 23:fed7f64dd520 | 88 | #ifdef CC3000_DEBUG_HCI_RX |
SolderSplashLabs | 23:fed7f64dd520 | 89 | |
SolderSplashLabs | 23:fed7f64dd520 | 90 | #ifdef VT100_COLOUR |
SolderSplashLabs | 23:fed7f64dd520 | 91 | #define DBG_HCI_CMD(x, ...) std::printf("\x1b[2;36;40m[CC3000 : HCI TX] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 92 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 93 | #define DBG_HCI_CMD(x, ...) std::printf("[CC3000 : HCI TX] "x"\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 94 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 95 | |
SolderSplashLabs | 23:fed7f64dd520 | 96 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 97 | #define DBG_HCI_CMD(x, ...) |
SolderSplashLabs | 23:fed7f64dd520 | 98 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 99 | |
SolderSplashLabs | 23:fed7f64dd520 | 100 | |
SolderSplashLabs | 23:fed7f64dd520 | 101 | #ifdef CC3000_DEBUG |
SolderSplashLabs | 23:fed7f64dd520 | 102 | |
SolderSplashLabs | 23:fed7f64dd520 | 103 | #ifdef VT100_COLOUR |
SolderSplashLabs | 23:fed7f64dd520 | 104 | #define DBG_CC(x, ...) std::printf("\x1b[2;32;40m[CC3000] "x"\x1b[0;37;40m\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 105 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 106 | #define DBG_CC(x, ...) std::printf("[CC3000] "x"\r\n", ##__VA_ARGS__); |
SolderSplashLabs | 23:fed7f64dd520 | 107 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 108 | |
SolderSplashLabs | 23:fed7f64dd520 | 109 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 110 | #define DBG_HCI_CMD(x, ...) |
SolderSplashLabs | 23:fed7f64dd520 | 111 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 112 | |
SolderSplashLabs | 23:fed7f64dd520 | 113 | namespace mbed_cc3000 { |
SolderSplashLabs | 23:fed7f64dd520 | 114 | |
SolderSplashLabs | 23:fed7f64dd520 | 115 | /** User info structure |
SolderSplashLabs | 23:fed7f64dd520 | 116 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 117 | typedef struct { |
SolderSplashLabs | 23:fed7f64dd520 | 118 | uint8_t FTC; // First time config performed |
SolderSplashLabs | 23:fed7f64dd520 | 119 | uint8_t PP_version[2]; // Patch Programmer version |
SolderSplashLabs | 23:fed7f64dd520 | 120 | uint8_t SERV_PACK[2]; // Service Pack Version |
SolderSplashLabs | 23:fed7f64dd520 | 121 | uint8_t DRV_VER[3]; // Driver Version |
SolderSplashLabs | 23:fed7f64dd520 | 122 | uint8_t FW_VER[3]; // Firmware Version |
SolderSplashLabs | 23:fed7f64dd520 | 123 | uint8_t validCIK; // CIK[] is valid (Client Interface Key) |
SolderSplashLabs | 23:fed7f64dd520 | 124 | uint8_t CIK[40]; |
SolderSplashLabs | 23:fed7f64dd520 | 125 | } tUserFS; |
SolderSplashLabs | 23:fed7f64dd520 | 126 | |
SolderSplashLabs | 23:fed7f64dd520 | 127 | /** Function pointers which are not yet implemented |
SolderSplashLabs | 23:fed7f64dd520 | 128 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 129 | enum FunctionNumber { |
SolderSplashLabs | 23:fed7f64dd520 | 130 | FW_PATCHES = 0, |
SolderSplashLabs | 23:fed7f64dd520 | 131 | DRIVER_PATCHES = 1, |
SolderSplashLabs | 23:fed7f64dd520 | 132 | BOOTLOADER_PATCHES = 2, |
SolderSplashLabs | 23:fed7f64dd520 | 133 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 134 | |
SolderSplashLabs | 23:fed7f64dd520 | 135 | /** CC3000 Simple Link class which contains status of cc3000. |
SolderSplashLabs | 23:fed7f64dd520 | 136 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 137 | class cc3000_simple_link { |
SolderSplashLabs | 23:fed7f64dd520 | 138 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 139 | /** ctor - sets magic number in the buffers (overflow mark). |
SolderSplashLabs | 23:fed7f64dd520 | 140 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 141 | cc3000_simple_link(); |
SolderSplashLabs | 23:fed7f64dd520 | 142 | /** dtor |
SolderSplashLabs | 23:fed7f64dd520 | 143 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 144 | ~cc3000_simple_link(); |
SolderSplashLabs | 23:fed7f64dd520 | 145 | /** Returns data received flag. |
SolderSplashLabs | 23:fed7f64dd520 | 146 | * \return |
SolderSplashLabs | 23:fed7f64dd520 | 147 | * if data have been received. |
SolderSplashLabs | 23:fed7f64dd520 | 148 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 149 | uint8_t get_data_received_flag(); |
SolderSplashLabs | 23:fed7f64dd520 | 150 | /** Set data received flag. |
SolderSplashLabs | 23:fed7f64dd520 | 151 | * \param value The value to be set. |
SolderSplashLabs | 23:fed7f64dd520 | 152 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 153 | void set_data_received_flag(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 154 | /** Returns if tx was completed. |
SolderSplashLabs | 23:fed7f64dd520 | 155 | * \return |
SolderSplashLabs | 23:fed7f64dd520 | 156 | * true if tx was completed, |
SolderSplashLabs | 23:fed7f64dd520 | 157 | * false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 158 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 159 | bool get_tx_complete_signal(); |
SolderSplashLabs | 23:fed7f64dd520 | 160 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 161 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 162 | void set_tx_complete_signal(bool value); |
SolderSplashLabs | 23:fed7f64dd520 | 163 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 164 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 165 | uint8_t *get_received_buffer(); |
SolderSplashLabs | 23:fed7f64dd520 | 166 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 167 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 168 | void set_received_buffer(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 169 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 170 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 171 | uint8_t *get_transmit_buffer(); |
SolderSplashLabs | 23:fed7f64dd520 | 172 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 173 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 174 | void set_transmit_buffer(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 175 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 176 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 177 | uint16_t get_number_free_buffers(); |
SolderSplashLabs | 23:fed7f64dd520 | 178 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 179 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 180 | void set_number_free_buffers(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 181 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 182 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 183 | uint16_t get_buffer_length(); |
SolderSplashLabs | 23:fed7f64dd520 | 184 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 185 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 186 | void set_buffer_length(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 187 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 188 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 189 | uint16_t get_pending_data(); |
SolderSplashLabs | 23:fed7f64dd520 | 190 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 191 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 192 | void set_pending_data(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 193 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 194 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 195 | uint16_t get_op_code(); |
SolderSplashLabs | 23:fed7f64dd520 | 196 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 197 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 198 | void set_op_code(uint16_t code); |
SolderSplashLabs | 23:fed7f64dd520 | 199 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 200 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 201 | uint16_t get_released_packets(); |
SolderSplashLabs | 23:fed7f64dd520 | 202 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 203 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 204 | void set_number_of_released_packets(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 205 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 206 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 207 | uint16_t get_sent_packets(); |
SolderSplashLabs | 23:fed7f64dd520 | 208 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 209 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 210 | void set_sent_packets(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 211 | |
SolderSplashLabs | 23:fed7f64dd520 | 212 | int32_t get_transmit_error(); |
SolderSplashLabs | 23:fed7f64dd520 | 213 | void set_transmit_error(int32_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 214 | |
SolderSplashLabs | 23:fed7f64dd520 | 215 | uint16_t get_buffer_size(void); |
SolderSplashLabs | 23:fed7f64dd520 | 216 | void set_buffer_size(uint16_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 217 | |
SolderSplashLabs | 23:fed7f64dd520 | 218 | void *get_func_pointer(FunctionNumber function); |
SolderSplashLabs | 23:fed7f64dd520 | 219 | |
SolderSplashLabs | 23:fed7f64dd520 | 220 | uint8_t *get_received_data(void); |
SolderSplashLabs | 23:fed7f64dd520 | 221 | void set_received_data(uint8_t *pointer); |
SolderSplashLabs | 23:fed7f64dd520 | 222 | |
SolderSplashLabs | 23:fed7f64dd520 | 223 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 224 | uint8_t _data_received_flag; |
SolderSplashLabs | 23:fed7f64dd520 | 225 | bool _tx_complete_signal; |
SolderSplashLabs | 23:fed7f64dd520 | 226 | uint16_t _rx_event_opcode; |
SolderSplashLabs | 23:fed7f64dd520 | 227 | uint16_t _free_buffers; |
SolderSplashLabs | 23:fed7f64dd520 | 228 | uint16_t _buffer_length; |
SolderSplashLabs | 23:fed7f64dd520 | 229 | uint16_t _buffer_size; |
SolderSplashLabs | 23:fed7f64dd520 | 230 | uint16_t _rx_data_pending; |
SolderSplashLabs | 23:fed7f64dd520 | 231 | uint16_t _sent_packets; |
SolderSplashLabs | 23:fed7f64dd520 | 232 | uint16_t _released_packets; |
SolderSplashLabs | 23:fed7f64dd520 | 233 | int32_t _transmit_data_error; |
SolderSplashLabs | 23:fed7f64dd520 | 234 | uint8_t *_received_data; |
SolderSplashLabs | 23:fed7f64dd520 | 235 | uint8_t _rx_buffer[CC3000_RX_BUFFER_SIZE]; |
SolderSplashLabs | 23:fed7f64dd520 | 236 | uint8_t _tx_buffer[CC3000_TX_BUFFER_SIZE]; |
SolderSplashLabs | 23:fed7f64dd520 | 237 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 238 | int8_t *(* _fFWPatches)(uint32_t *length); |
SolderSplashLabs | 23:fed7f64dd520 | 239 | int8_t *(* _fDriverPatches)(uint32_t *length); |
SolderSplashLabs | 23:fed7f64dd520 | 240 | int8_t *(* _fBootLoaderPatches)(uint32_t *length); |
SolderSplashLabs | 23:fed7f64dd520 | 241 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 242 | |
SolderSplashLabs | 23:fed7f64dd520 | 243 | /** Forward declaration classes |
SolderSplashLabs | 23:fed7f64dd520 | 244 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 245 | class cc3000_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 246 | class cc3000_nvmem; |
SolderSplashLabs | 23:fed7f64dd520 | 247 | class cc3000_spi; |
SolderSplashLabs | 23:fed7f64dd520 | 248 | class cc3000; |
SolderSplashLabs | 23:fed7f64dd520 | 249 | |
SolderSplashLabs | 23:fed7f64dd520 | 250 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 251 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 252 | class cc3000_event { |
SolderSplashLabs | 23:fed7f64dd520 | 253 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 254 | cc3000_event(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_spi &spi, cc3000 &cc3000); |
SolderSplashLabs | 23:fed7f64dd520 | 255 | ~cc3000_event(); |
SolderSplashLabs | 23:fed7f64dd520 | 256 | |
SolderSplashLabs | 23:fed7f64dd520 | 257 | void hci_unsol_handle_patch_request(uint8_t *event_hdr); |
SolderSplashLabs | 23:fed7f64dd520 | 258 | uint8_t *hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen); |
SolderSplashLabs | 23:fed7f64dd520 | 259 | int32_t hci_unsol_event_handler(uint8_t *event_hdr); |
SolderSplashLabs | 23:fed7f64dd520 | 260 | int32_t hci_unsolicited_event_handler(void); |
SolderSplashLabs | 23:fed7f64dd520 | 261 | int32_t get_socket_active_status(int32_t sd); |
SolderSplashLabs | 23:fed7f64dd520 | 262 | void set_socket_active_status(int32_t sd, int32_t status); |
SolderSplashLabs | 23:fed7f64dd520 | 263 | int32_t hci_event_unsol_flowcontrol_handler(uint8_t *event); |
SolderSplashLabs | 23:fed7f64dd520 | 264 | void update_socket_active_status(uint8_t *resp_params); |
SolderSplashLabs | 23:fed7f64dd520 | 265 | void simplelink_wait_event(uint16_t op_code, void *ret_param); |
SolderSplashLabs | 23:fed7f64dd520 | 266 | void simplelink_wait_data(uint8_t *buffer, uint8_t *from, uint8_t *fromlen); |
SolderSplashLabs | 23:fed7f64dd520 | 267 | |
SolderSplashLabs | 23:fed7f64dd520 | 268 | void received_handler(uint8_t *buffer); |
SolderSplashLabs | 23:fed7f64dd520 | 269 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 270 | uint32_t socket_active_status; |
SolderSplashLabs | 23:fed7f64dd520 | 271 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 272 | cc3000_hci &_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 273 | cc3000_spi &_spi; |
SolderSplashLabs | 23:fed7f64dd520 | 274 | cc3000 &_cc3000; |
SolderSplashLabs | 23:fed7f64dd520 | 275 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 276 | |
SolderSplashLabs | 23:fed7f64dd520 | 277 | class cc3000_netapp { |
SolderSplashLabs | 23:fed7f64dd520 | 278 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 279 | cc3000_netapp(cc3000_simple_link &simple_link, cc3000_nvmem &nvmem, cc3000_hci &hci, cc3000_event &event); |
SolderSplashLabs | 23:fed7f64dd520 | 280 | ~cc3000_netapp(); |
SolderSplashLabs | 23:fed7f64dd520 | 281 | int32_t config_mac_adrress(uint8_t *mac); |
SolderSplashLabs | 23:fed7f64dd520 | 282 | int32_t dhcp(uint32_t *ip, uint32_t *subnet_mask,uint32_t *default_gateway, uint32_t *dns_server); |
SolderSplashLabs | 23:fed7f64dd520 | 283 | #ifndef CC3000_TINY_DRIVER |
SolderSplashLabs | 23:fed7f64dd520 | 284 | void ipconfig(tNetappIpconfigRetArgs *ipconfig); |
SolderSplashLabs | 23:fed7f64dd520 | 285 | int32_t timeout_values(uint32_t *dhcp, uint32_t *arp,uint32_t *keep_alive, uint32_t *inactivity); |
SolderSplashLabs | 23:fed7f64dd520 | 286 | int32_t ping_send(uint32_t *ip, uint32_t ping_attempts, uint32_t ping_size, uint32_t ping_timeout); |
SolderSplashLabs | 23:fed7f64dd520 | 287 | void ping_report(); |
SolderSplashLabs | 23:fed7f64dd520 | 288 | int32_t ping_stop(); |
SolderSplashLabs | 23:fed7f64dd520 | 289 | int32_t arp_flush(); |
SolderSplashLabs | 23:fed7f64dd520 | 290 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 291 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 292 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 293 | cc3000_nvmem &_nvmem; |
SolderSplashLabs | 23:fed7f64dd520 | 294 | cc3000_hci &_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 295 | cc3000_event &_event; |
SolderSplashLabs | 23:fed7f64dd520 | 296 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 297 | |
SolderSplashLabs | 23:fed7f64dd520 | 298 | #ifndef CC3000_UNENCRYPTED_SMART_CONFIG |
SolderSplashLabs | 23:fed7f64dd520 | 299 | class cc3000_security { |
SolderSplashLabs | 23:fed7f64dd520 | 300 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 301 | void expandKey(uint8_t *expanded_key, uint8_t *key); |
SolderSplashLabs | 23:fed7f64dd520 | 302 | uint8_t galois_mul2(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 303 | void aes_encr(uint8_t *state, uint8_t *expanded_key); |
SolderSplashLabs | 23:fed7f64dd520 | 304 | void aes_decr(uint8_t *state, uint8_t *expanded_key); |
SolderSplashLabs | 23:fed7f64dd520 | 305 | void aes_encrypt(uint8_t *state, uint8_t *key); |
SolderSplashLabs | 23:fed7f64dd520 | 306 | void aes_decrypt(uint8_t *state, uint8_t *key); |
SolderSplashLabs | 23:fed7f64dd520 | 307 | int32_t aes_read_key(uint8_t *key); |
SolderSplashLabs | 23:fed7f64dd520 | 308 | int32_t aes_write_key(uint8_t *key); |
SolderSplashLabs | 23:fed7f64dd520 | 309 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 310 | uint8_t _expanded_key[176]; |
SolderSplashLabs | 23:fed7f64dd520 | 311 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 312 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 313 | |
SolderSplashLabs | 23:fed7f64dd520 | 314 | class cc3000_socket { |
SolderSplashLabs | 23:fed7f64dd520 | 315 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 316 | cc3000_socket(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_event &event); |
SolderSplashLabs | 23:fed7f64dd520 | 317 | ~cc3000_socket(); |
SolderSplashLabs | 23:fed7f64dd520 | 318 | int32_t socket(int32_t domain, int32_t type, int32_t protocol); |
SolderSplashLabs | 23:fed7f64dd520 | 319 | int32_t accept(int32_t sd, sockaddr *addr, socklen_t *addrlen); |
SolderSplashLabs | 23:fed7f64dd520 | 320 | int32_t bind(int32_t sd, const sockaddr *addr, int32_t addrlen); |
SolderSplashLabs | 23:fed7f64dd520 | 321 | int32_t HostFlowControlConsumeBuff(int32_t sd); |
SolderSplashLabs | 23:fed7f64dd520 | 322 | int32_t closesocket(int32_t sd); |
SolderSplashLabs | 23:fed7f64dd520 | 323 | int32_t listen(int32_t sd, int32_t backlog); |
SolderSplashLabs | 23:fed7f64dd520 | 324 | int32_t connect(int32_t sd, const sockaddr *addr, int32_t addrlen); |
SolderSplashLabs | 23:fed7f64dd520 | 325 | int32_t select(int32_t nfds, fd_set *readsds, fd_set *writesds, fd_set *exceptsds, struct timeval *timeout); |
SolderSplashLabs | 23:fed7f64dd520 | 326 | int32_t getsockopt (int32_t sd, int32_t level, int32_t optname, void *optval, socklen_t *optlen); |
SolderSplashLabs | 23:fed7f64dd520 | 327 | int32_t simple_link_recv(int32_t sd, void *buf, int32_t len, int32_t flags, sockaddr *from, socklen_t *fromlen, int32_t opcode); |
SolderSplashLabs | 23:fed7f64dd520 | 328 | int32_t simple_link_send(int32_t sd, const void *buf, int32_t len, int32_t flags, const sockaddr *to, int32_t tolen, int32_t opcode); |
SolderSplashLabs | 23:fed7f64dd520 | 329 | int32_t recv(int32_t sd, void *buf, int32_t len, int32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 330 | int32_t recvfrom(int32_t sd, void *buf, int32_t len, int32_t flags, sockaddr *from, socklen_t *fromlen); |
SolderSplashLabs | 23:fed7f64dd520 | 331 | int32_t send(int32_t sd, const void *buf, int32_t len, int32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 332 | int32_t sendto(int32_t sd, const void *buf, int32_t len, int32_t flags, const sockaddr *to, socklen_t tolen); |
SolderSplashLabs | 23:fed7f64dd520 | 333 | int32_t mdns_advertiser(uint16_t mdns_enabled, uint8_t * device_service_name, uint16_t device_service_name_length); |
SolderSplashLabs | 23:fed7f64dd520 | 334 | #ifndef CC3000_TINY_DRIVER |
SolderSplashLabs | 23:fed7f64dd520 | 335 | int32_t gethostbyname(uint8_t *hostname, uint16_t name_length, uint32_t *out_ip_addr); |
SolderSplashLabs | 23:fed7f64dd520 | 336 | int32_t setsockopt(int32_t sd, int32_t level, int32_t optname, const void *optval, socklen_t optlen); |
SolderSplashLabs | 23:fed7f64dd520 | 337 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 338 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 339 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 340 | cc3000_hci &_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 341 | cc3000_event &_event; |
SolderSplashLabs | 23:fed7f64dd520 | 342 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 343 | |
SolderSplashLabs | 23:fed7f64dd520 | 344 | /** SPI communication class |
SolderSplashLabs | 23:fed7f64dd520 | 345 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 346 | class cc3000_spi { |
SolderSplashLabs | 23:fed7f64dd520 | 347 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 348 | /** ctor |
SolderSplashLabs | 23:fed7f64dd520 | 349 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 350 | cc3000_spi(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, IRQn_Type irq_port, cc3000_event &event, cc3000_simple_link &simple_link); |
SolderSplashLabs | 23:fed7f64dd520 | 351 | /** dtor |
SolderSplashLabs | 23:fed7f64dd520 | 352 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 353 | ~cc3000_spi(); |
SolderSplashLabs | 23:fed7f64dd520 | 354 | /** Close SPI - disables IRQ and set received buffer to 0 |
SolderSplashLabs | 23:fed7f64dd520 | 355 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 356 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 357 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 358 | void close(); |
SolderSplashLabs | 23:fed7f64dd520 | 359 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 360 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 361 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 362 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 363 | void open(); |
SolderSplashLabs | 23:fed7f64dd520 | 364 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 365 | * \param buffer |
SolderSplashLabs | 23:fed7f64dd520 | 366 | * \param length |
SolderSplashLabs | 23:fed7f64dd520 | 367 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 368 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 369 | uint32_t first_write(uint8_t *buffer, uint16_t length); |
SolderSplashLabs | 23:fed7f64dd520 | 370 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 371 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 372 | uint32_t write(uint8_t *buffer, uint16_t length); |
SolderSplashLabs | 23:fed7f64dd520 | 373 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 374 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 375 | void write_synchronous(uint8_t *data, uint16_t size); |
SolderSplashLabs | 23:fed7f64dd520 | 376 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 377 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 378 | void read_synchronous(uint8_t *data, uint16_t size); |
SolderSplashLabs | 23:fed7f64dd520 | 379 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 380 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 381 | uint32_t read_data_cont(); |
SolderSplashLabs | 23:fed7f64dd520 | 382 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 383 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 384 | void wlan_irq_enable(); |
SolderSplashLabs | 23:fed7f64dd520 | 385 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 386 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 387 | void wlan_irq_disable(); |
SolderSplashLabs | 23:fed7f64dd520 | 388 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 389 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 390 | void wlan_irq_set(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 391 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 392 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 393 | uint32_t wlan_irq_read(); |
SolderSplashLabs | 23:fed7f64dd520 | 394 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 395 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 396 | void WLAN_IRQHandler(); |
SolderSplashLabs | 23:fed7f64dd520 | 397 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 398 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 399 | void write_wlan_en(uint8_t value); |
SolderSplashLabs | 23:fed7f64dd520 | 400 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 401 | tSpiInfo _spi_info; |
SolderSplashLabs | 23:fed7f64dd520 | 402 | InterruptIn _wlan_irq; |
SolderSplashLabs | 23:fed7f64dd520 | 403 | DigitalOut _wlan_en; |
SolderSplashLabs | 23:fed7f64dd520 | 404 | DigitalOut _wlan_cs; |
SolderSplashLabs | 23:fed7f64dd520 | 405 | SPI _wlan_spi; |
SolderSplashLabs | 23:fed7f64dd520 | 406 | IRQn_Type _irq_port; |
SolderSplashLabs | 23:fed7f64dd520 | 407 | pFunctionPointer_t _function_pointer; |
SolderSplashLabs | 23:fed7f64dd520 | 408 | cc3000_event &_event; |
SolderSplashLabs | 23:fed7f64dd520 | 409 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 410 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 411 | |
SolderSplashLabs | 23:fed7f64dd520 | 412 | class cc3000_hci { |
SolderSplashLabs | 23:fed7f64dd520 | 413 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 414 | cc3000_hci(cc3000_spi &spi); |
SolderSplashLabs | 23:fed7f64dd520 | 415 | ~cc3000_hci(); |
SolderSplashLabs | 23:fed7f64dd520 | 416 | uint16_t command_send(uint16_t op_code, uint8_t *buffer, uint8_t length); |
SolderSplashLabs | 23:fed7f64dd520 | 417 | uint32_t data_send(uint8_t op_code, uint8_t *args, uint16_t arg_length, |
SolderSplashLabs | 23:fed7f64dd520 | 418 | uint16_t data_length, const uint8_t *tail, uint16_t tail_length); |
SolderSplashLabs | 23:fed7f64dd520 | 419 | void data_command_send(uint16_t op_code, uint8_t *buffer, uint8_t arg_length, |
SolderSplashLabs | 23:fed7f64dd520 | 420 | uint16_t data_length); |
SolderSplashLabs | 23:fed7f64dd520 | 421 | void patch_send(uint8_t op_code, uint8_t *buffer, uint8_t *patch, uint16_t data_length); |
SolderSplashLabs | 23:fed7f64dd520 | 422 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 423 | cc3000_spi &_spi; |
SolderSplashLabs | 23:fed7f64dd520 | 424 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 425 | |
SolderSplashLabs | 23:fed7f64dd520 | 426 | class cc3000_nvmem { |
SolderSplashLabs | 23:fed7f64dd520 | 427 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 428 | cc3000_nvmem(cc3000_hci &hci, cc3000_event &_event,cc3000_simple_link &simple_link); |
SolderSplashLabs | 23:fed7f64dd520 | 429 | ~cc3000_nvmem(); |
SolderSplashLabs | 23:fed7f64dd520 | 430 | int32_t read(uint32_t file_id, uint32_t length, uint32_t offset, uint8_t *buff); |
SolderSplashLabs | 23:fed7f64dd520 | 431 | int32_t write(uint32_t file_id, uint32_t length, uint32_t entry_offset, uint8_t *buff); |
SolderSplashLabs | 23:fed7f64dd520 | 432 | uint8_t set_mac_address(uint8_t *mac); |
SolderSplashLabs | 23:fed7f64dd520 | 433 | uint8_t get_mac_address(uint8_t *mac); |
SolderSplashLabs | 23:fed7f64dd520 | 434 | uint8_t write_patch(uint32_t file_id, uint32_t length, const uint8_t *data); |
SolderSplashLabs | 23:fed7f64dd520 | 435 | int32_t create_entry(uint32_t file_id, uint32_t new_len); |
SolderSplashLabs | 23:fed7f64dd520 | 436 | #ifndef CC3000_TINY_DRIVER |
SolderSplashLabs | 23:fed7f64dd520 | 437 | uint8_t read_sp_version(uint8_t* patch_ver); |
SolderSplashLabs | 23:fed7f64dd520 | 438 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 439 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 440 | cc3000_hci &_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 441 | cc3000_event &_event; |
SolderSplashLabs | 23:fed7f64dd520 | 442 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 443 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 444 | |
SolderSplashLabs | 23:fed7f64dd520 | 445 | class cc3000_wlan { |
SolderSplashLabs | 23:fed7f64dd520 | 446 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 447 | cc3000_wlan(cc3000_simple_link &simple_link, cc3000_event &event, cc3000_spi &spi, cc3000_hci &hci); |
SolderSplashLabs | 23:fed7f64dd520 | 448 | ~cc3000_wlan(); |
SolderSplashLabs | 23:fed7f64dd520 | 449 | /** Send SIMPLE LINK START to cc3000 |
SolderSplashLabs | 23:fed7f64dd520 | 450 | * \param patches_available_host Flag to indicate if patches are available |
SolderSplashLabs | 23:fed7f64dd520 | 451 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 452 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 453 | void simpleLink_init_start(uint16_t patches_available_host); |
SolderSplashLabs | 23:fed7f64dd520 | 454 | /** Start wlan device. Blocking call until init is completed |
SolderSplashLabs | 23:fed7f64dd520 | 455 | * \param patches_available_host Flag to indicate if patches are available |
SolderSplashLabs | 23:fed7f64dd520 | 456 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 457 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 458 | void start(uint16_t patches_available_host); |
SolderSplashLabs | 23:fed7f64dd520 | 459 | /** Stop wlan device |
SolderSplashLabs | 23:fed7f64dd520 | 460 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 461 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 462 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 463 | void stop(void); |
SolderSplashLabs | 23:fed7f64dd520 | 464 | #ifndef CC3000_TINY_DRIVER |
SolderSplashLabs | 23:fed7f64dd520 | 465 | int32_t connect(uint32_t sec_type, const uint8_t *ssid, int32_t ssid_length, uint8_t *b_ssid, uint8_t *key, int32_t key_len); |
SolderSplashLabs | 23:fed7f64dd520 | 466 | int32_t add_profile(uint32_t sec_type, uint8_t* ssid, uint32_t ssid_length, uint8_t *b_ssid, uint32_t priority, uint32_t pairwise_cipher_or_tx_key_len, uint32_t group_cipher_tx_key_index, |
SolderSplashLabs | 23:fed7f64dd520 | 467 | uint32_t key_mgmt, uint8_t* pf_or_key, uint32_t pass_phrase_length); |
SolderSplashLabs | 23:fed7f64dd520 | 468 | int32_t ioctl_get_scan_results(uint32_t scan_timeout, uint8_t *results); |
SolderSplashLabs | 23:fed7f64dd520 | 469 | int32_t ioctl_set_scan_params(uint32_t enable, uint32_t min_dwell_time, uint32_t max_dwell_time, uint32_t num_probe_requests, |
SolderSplashLabs | 23:fed7f64dd520 | 470 | uint32_t channel_mask, int32_t rssi_threshold, uint32_t snr_threshold, uint32_t default_tx_power, uint32_t *interval_list); |
SolderSplashLabs | 23:fed7f64dd520 | 471 | int32_t ioctl_statusget(void); |
SolderSplashLabs | 23:fed7f64dd520 | 472 | #else |
SolderSplashLabs | 23:fed7f64dd520 | 473 | int32_t connect(const uint8_t *ssid, int32_t ssid_length); |
SolderSplashLabs | 23:fed7f64dd520 | 474 | int32_t add_profile(uint32_t sec_type, uint8_t *ssid, uint32_t ssid_length, uint8_t *b_ssid, uint32_t priority, |
SolderSplashLabs | 23:fed7f64dd520 | 475 | uint32_t pairwise_cipher_or_tx_key_len, uint32_t group_cipher_tx_key_index, uint32_t key_mgmt, |
SolderSplashLabs | 23:fed7f64dd520 | 476 | uint8_t* pf_or_key, uint32_t pass_phrase_length); |
SolderSplashLabs | 23:fed7f64dd520 | 477 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 478 | #ifndef CC3000_UNENCRYPTED_SMART_CONFIG |
SolderSplashLabs | 23:fed7f64dd520 | 479 | int32_t smart_config_process(void); |
SolderSplashLabs | 23:fed7f64dd520 | 480 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 481 | int32_t disconnect(); |
SolderSplashLabs | 23:fed7f64dd520 | 482 | int32_t ioctl_set_connection_policy(uint32_t should_connect_to_open_ap, uint32_t use_fast_connect, uint32_t use_profiles); |
SolderSplashLabs | 23:fed7f64dd520 | 483 | int32_t ioctl_del_profile(uint32_t index); |
SolderSplashLabs | 23:fed7f64dd520 | 484 | int32_t set_event_mask(uint32_t mask); |
SolderSplashLabs | 23:fed7f64dd520 | 485 | int32_t smart_config_start(uint32_t encrypted_flag); |
SolderSplashLabs | 23:fed7f64dd520 | 486 | int32_t smart_config_stop(void); |
SolderSplashLabs | 23:fed7f64dd520 | 487 | int32_t smart_config_set_prefix(uint8_t *new_prefix); |
SolderSplashLabs | 23:fed7f64dd520 | 488 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 489 | cc3000_simple_link &_simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 490 | cc3000_event &_event; |
SolderSplashLabs | 23:fed7f64dd520 | 491 | cc3000_spi &_spi; |
SolderSplashLabs | 23:fed7f64dd520 | 492 | cc3000_hci &_hci; |
SolderSplashLabs | 23:fed7f64dd520 | 493 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 494 | |
SolderSplashLabs | 23:fed7f64dd520 | 495 | /** Client TCP/UDP class - TODO - not complete client |
SolderSplashLabs | 23:fed7f64dd520 | 496 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 497 | class cc3000_client { |
SolderSplashLabs | 23:fed7f64dd520 | 498 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 499 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 500 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 501 | cc3000_client(cc3000 &cc3000_ref); |
SolderSplashLabs | 23:fed7f64dd520 | 502 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 503 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 504 | cc3000_client(cc3000 &cc3000_ref, int16_t socket); |
SolderSplashLabs | 23:fed7f64dd520 | 505 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 506 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 507 | bool connected(void); |
SolderSplashLabs | 23:fed7f64dd520 | 508 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 509 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 510 | int16_t write(const void *buffer, uint16_t length, uint32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 511 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 512 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 513 | int16_t read(void *buffer, uint16_t length, uint32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 514 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 515 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 516 | void close(void); |
SolderSplashLabs | 23:fed7f64dd520 | 517 | |
SolderSplashLabs | 23:fed7f64dd520 | 518 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 519 | int16_t _current_socket; |
SolderSplashLabs | 23:fed7f64dd520 | 520 | cc3000 &_cc3000; |
SolderSplashLabs | 23:fed7f64dd520 | 521 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 522 | |
SolderSplashLabs | 23:fed7f64dd520 | 523 | /** Server TCP/UDP |
SolderSplashLabs | 23:fed7f64dd520 | 524 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 525 | class cc3000_server { |
SolderSplashLabs | 23:fed7f64dd520 | 526 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 527 | /** ctor (server was not created successfully) |
SolderSplashLabs | 23:fed7f64dd520 | 528 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 529 | cc3000_server(cc3000 &cc3000_ref, sockaddr socket_add); |
SolderSplashLabs | 23:fed7f64dd520 | 530 | /** ctor |
SolderSplashLabs | 23:fed7f64dd520 | 531 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 532 | cc3000_server(cc3000 &cc3000_ref, sockaddr socket_add, int16_t socket); |
SolderSplashLabs | 23:fed7f64dd520 | 533 | /** Blocking accept |
SolderSplashLabs | 23:fed7f64dd520 | 534 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 535 | int32_t accept(void); |
SolderSplashLabs | 23:fed7f64dd520 | 536 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 537 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 538 | int32_t receive(void *buffer, uint16_t length, uint32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 539 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 540 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 541 | int32_t send(void *buffer, uint16_t length, uint32_t flags); |
SolderSplashLabs | 23:fed7f64dd520 | 542 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 543 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 544 | void bind(void); |
SolderSplashLabs | 23:fed7f64dd520 | 545 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 546 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 547 | void listen(uint32_t backlog); |
SolderSplashLabs | 23:fed7f64dd520 | 548 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 549 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 550 | void close(void); |
SolderSplashLabs | 23:fed7f64dd520 | 551 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 552 | int16_t _current_socket; |
SolderSplashLabs | 23:fed7f64dd520 | 553 | sockaddr _socket_address; |
SolderSplashLabs | 23:fed7f64dd520 | 554 | cc3000 &_cc3000; |
SolderSplashLabs | 23:fed7f64dd520 | 555 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 556 | |
SolderSplashLabs | 23:fed7f64dd520 | 557 | /** The main class of entire cc3000 implementation |
SolderSplashLabs | 23:fed7f64dd520 | 558 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 559 | class cc3000 { |
SolderSplashLabs | 23:fed7f64dd520 | 560 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 561 | typedef struct { |
SolderSplashLabs | 23:fed7f64dd520 | 562 | bool dhcp; |
SolderSplashLabs | 23:fed7f64dd520 | 563 | bool connected; |
SolderSplashLabs | 23:fed7f64dd520 | 564 | uint8_t socket; |
SolderSplashLabs | 23:fed7f64dd520 | 565 | bool smart_config_complete; |
SolderSplashLabs | 23:fed7f64dd520 | 566 | bool stop_smart_config; |
SolderSplashLabs | 23:fed7f64dd520 | 567 | bool dhcp_configured; |
SolderSplashLabs | 23:fed7f64dd520 | 568 | bool ok_to_shut_down; |
SolderSplashLabs | 23:fed7f64dd520 | 569 | } tStatus; |
SolderSplashLabs | 23:fed7f64dd520 | 570 | /** ctor for cc3000 class. |
SolderSplashLabs | 23:fed7f64dd520 | 571 | * \param cc3000_irq IRQ pin |
SolderSplashLabs | 23:fed7f64dd520 | 572 | * \param cc3000_en Enable pin |
SolderSplashLabs | 23:fed7f64dd520 | 573 | * \param cc3000_cs Chip select pin |
SolderSplashLabs | 23:fed7f64dd520 | 574 | * \param cc3000_spi SPI interface |
SolderSplashLabs | 23:fed7f64dd520 | 575 | * \param irq_port IRQ pin's port |
SolderSplashLabs | 23:fed7f64dd520 | 576 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 577 | cc3000(PinName cc3000_irq, PinName cc3000_en, PinName cc3000_cs, SPI cc3000_spi, IRQn_Type irq_port); |
SolderSplashLabs | 23:fed7f64dd520 | 578 | /** dtor |
SolderSplashLabs | 23:fed7f64dd520 | 579 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 580 | ~cc3000(); |
SolderSplashLabs | 23:fed7f64dd520 | 581 | /** Initiate cc3000. It starts the wlan communication and deletes profiles. |
SolderSplashLabs | 23:fed7f64dd520 | 582 | * \param patch Patch |
SolderSplashLabs | 23:fed7f64dd520 | 583 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 584 | void start(uint8_t patch); |
SolderSplashLabs | 23:fed7f64dd520 | 585 | /** Stops the wlan communication. |
SolderSplashLabs | 23:fed7f64dd520 | 586 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 587 | void stop(); |
SolderSplashLabs | 23:fed7f64dd520 | 588 | /** Restarts the wlan communication. |
SolderSplashLabs | 23:fed7f64dd520 | 589 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 590 | void restart(uint8_t patch); |
SolderSplashLabs | 23:fed7f64dd520 | 591 | /** Disconnect wlan device |
SolderSplashLabs | 23:fed7f64dd520 | 592 | * |
SolderSplashLabs | 23:fed7f64dd520 | 593 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 594 | bool disconnect(void); |
SolderSplashLabs | 23:fed7f64dd520 | 595 | /** Callback which is called from the event class. This updates status of cc3000. |
SolderSplashLabs | 23:fed7f64dd520 | 596 | * \param event_type Type of the event |
SolderSplashLabs | 23:fed7f64dd520 | 597 | * \param data Pointer to data |
SolderSplashLabs | 23:fed7f64dd520 | 598 | * \param length Length of data |
SolderSplashLabs | 23:fed7f64dd520 | 599 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 600 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 601 | void usync_callback(int32_t event_type, uint8_t *data, uint8_t length); |
SolderSplashLabs | 23:fed7f64dd520 | 602 | /** Connect to SSID (open/secured) with timeout (10ms). |
SolderSplashLabs | 23:fed7f64dd520 | 603 | * \param ssid SSID name |
SolderSplashLabs | 23:fed7f64dd520 | 604 | * \param key Security key (if key = 0, open connection) |
SolderSplashLabs | 23:fed7f64dd520 | 605 | * \param security_mode Security mode |
SolderSplashLabs | 23:fed7f64dd520 | 606 | * \return true if connection was established, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 607 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 608 | bool connect_to_AP(const uint8_t *ssid, const uint8_t *key, int32_t security_mode); |
SolderSplashLabs | 23:fed7f64dd520 | 609 | /** Connect to SSID which is secured |
SolderSplashLabs | 23:fed7f64dd520 | 610 | * \param ssid SSID name |
SolderSplashLabs | 23:fed7f64dd520 | 611 | * \param key Security key |
SolderSplashLabs | 23:fed7f64dd520 | 612 | * \param security_mode Security mode |
SolderSplashLabs | 23:fed7f64dd520 | 613 | * \return true if connection was established, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 614 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 615 | bool connect_secure(const uint8_t *ssid, const uint8_t *key, int32_t security_mode); |
SolderSplashLabs | 23:fed7f64dd520 | 616 | /** Connect to SSID which is open (no security) |
SolderSplashLabs | 23:fed7f64dd520 | 617 | * \param ssid SSID name |
SolderSplashLabs | 23:fed7f64dd520 | 618 | * \return true if connection was established, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 619 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 620 | bool connect_open(const uint8_t *ssid); |
SolderSplashLabs | 23:fed7f64dd520 | 621 | /** Status of the cc3000 connection. |
SolderSplashLabs | 23:fed7f64dd520 | 622 | * \return true if it's connected, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 623 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 624 | bool is_connected(); |
SolderSplashLabs | 23:fed7f64dd520 | 625 | /** Status of DHCP. |
SolderSplashLabs | 23:fed7f64dd520 | 626 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 627 | * \return true if DCHP is configured, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 628 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 629 | bool is_dhcp_configured(); |
SolderSplashLabs | 23:fed7f64dd520 | 630 | /** Status of smart confing completation. |
SolderSplashLabs | 23:fed7f64dd520 | 631 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 632 | * \return smart config was set, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 633 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 634 | bool is_smart_confing_completed(); |
SolderSplashLabs | 23:fed7f64dd520 | 635 | /** Return the cc3000's mac address. |
SolderSplashLabs | 23:fed7f64dd520 | 636 | * \param address Retreived mac address. |
SolderSplashLabs | 23:fed7f64dd520 | 637 | * \return |
SolderSplashLabs | 23:fed7f64dd520 | 638 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 639 | uint8_t get_mac_address(uint8_t address[6]); |
SolderSplashLabs | 23:fed7f64dd520 | 640 | /** Set the cc3000's mac address |
SolderSplashLabs | 23:fed7f64dd520 | 641 | * \param address Mac address to be set |
SolderSplashLabs | 23:fed7f64dd520 | 642 | * \return |
SolderSplashLabs | 23:fed7f64dd520 | 643 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 644 | uint8_t set_mac_address(uint8_t address[6]); |
SolderSplashLabs | 23:fed7f64dd520 | 645 | /** Get user file info |
SolderSplashLabs | 23:fed7f64dd520 | 646 | * \param info_file Pointer where info will be stored |
SolderSplashLabs | 23:fed7f64dd520 | 647 | * \param size Available size |
SolderSplashLabs | 23:fed7f64dd520 | 648 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 649 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 650 | void get_user_file_info(uint8_t *info_file, size_t size); |
SolderSplashLabs | 23:fed7f64dd520 | 651 | /** Set user filo info |
SolderSplashLabs | 23:fed7f64dd520 | 652 | * \param info_file Pointer to user's info |
SolderSplashLabs | 23:fed7f64dd520 | 653 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 654 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 655 | void set_user_file_info(uint8_t *info_file, size_t size); |
SolderSplashLabs | 23:fed7f64dd520 | 656 | /** Start smart config |
SolderSplashLabs | 23:fed7f64dd520 | 657 | * \param smart_config_key Pointer to smart config key |
SolderSplashLabs | 23:fed7f64dd520 | 658 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 659 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 660 | void start_smart_config(const uint8_t *smart_config_key); /* TODO enable AES ? */ |
SolderSplashLabs | 23:fed7f64dd520 | 661 | #ifndef CC3000_TINY_DRIVER |
SolderSplashLabs | 23:fed7f64dd520 | 662 | /** Return ip configuration |
SolderSplashLabs | 23:fed7f64dd520 | 663 | * \param ip_config Pointer to ipconfig data |
SolderSplashLabs | 23:fed7f64dd520 | 664 | * \return true if it's connected and info was retrieved, false otherwise. |
SolderSplashLabs | 23:fed7f64dd520 | 665 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 666 | bool get_ip_config(tNetappIpconfigRetArgs *ip_config); |
SolderSplashLabs | 23:fed7f64dd520 | 667 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 668 | /** Creates tcp client |
SolderSplashLabs | 23:fed7f64dd520 | 669 | * \param ip_address Client's IP address |
SolderSplashLabs | 23:fed7f64dd520 | 670 | * \param port Client's PORT |
SolderSplashLabs | 23:fed7f64dd520 | 671 | * \return client with socket != -1 |
SolderSplashLabs | 23:fed7f64dd520 | 672 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 673 | cc3000_client create_tcp_client(uint32_t ip_address, uint16_t port); |
SolderSplashLabs | 23:fed7f64dd520 | 674 | /** Creates tcp server |
SolderSplashLabs | 23:fed7f64dd520 | 675 | * \param ip_address Server's IP address |
SolderSplashLabs | 23:fed7f64dd520 | 676 | * \param port Server's PORT |
SolderSplashLabs | 23:fed7f64dd520 | 677 | * \return server with socket != -1 |
SolderSplashLabs | 23:fed7f64dd520 | 678 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 679 | cc3000_server create_tcp_server(uint32_t ip_address, uint16_t port); |
SolderSplashLabs | 23:fed7f64dd520 | 680 | /** Creates udp client |
SolderSplashLabs | 23:fed7f64dd520 | 681 | * \param ip_address Server's IP address |
SolderSplashLabs | 23:fed7f64dd520 | 682 | * \param port Server's PORT |
SolderSplashLabs | 23:fed7f64dd520 | 683 | * \return client with socket != -1 |
SolderSplashLabs | 23:fed7f64dd520 | 684 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 685 | cc3000_client create_udp_client(uint32_t ip_address, uint16_t port); |
SolderSplashLabs | 23:fed7f64dd520 | 686 | /** Delete all stored profiles |
SolderSplashLabs | 23:fed7f64dd520 | 687 | * \param none |
SolderSplashLabs | 23:fed7f64dd520 | 688 | * \return none |
SolderSplashLabs | 23:fed7f64dd520 | 689 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 690 | void delete_profiles(void); |
SolderSplashLabs | 23:fed7f64dd520 | 691 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 692 | * |
SolderSplashLabs | 23:fed7f64dd520 | 693 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 694 | uint32_t ping(uint32_t ip, uint8_t attempts, uint16_t timeout, uint8_t size); |
SolderSplashLabs | 23:fed7f64dd520 | 695 | |
SolderSplashLabs | 23:fed7f64dd520 | 696 | static cc3000 *get_instance() { |
SolderSplashLabs | 23:fed7f64dd520 | 697 | return _inst; |
SolderSplashLabs | 23:fed7f64dd520 | 698 | } |
SolderSplashLabs | 23:fed7f64dd520 | 699 | public: |
SolderSplashLabs | 23:fed7f64dd520 | 700 | cc3000_simple_link _simple_link; |
SolderSplashLabs | 23:fed7f64dd520 | 701 | cc3000_event _event; |
SolderSplashLabs | 23:fed7f64dd520 | 702 | #ifndef CC3000_UNENCRYPTED_SMART_CONFIG |
SolderSplashLabs | 23:fed7f64dd520 | 703 | cc3000_security _security; |
SolderSplashLabs | 23:fed7f64dd520 | 704 | #endif |
SolderSplashLabs | 23:fed7f64dd520 | 705 | cc3000_socket _socket; |
SolderSplashLabs | 23:fed7f64dd520 | 706 | cc3000_spi _spi; |
SolderSplashLabs | 23:fed7f64dd520 | 707 | cc3000_hci _hci; |
SolderSplashLabs | 23:fed7f64dd520 | 708 | cc3000_nvmem _nvmem; |
SolderSplashLabs | 23:fed7f64dd520 | 709 | cc3000_netapp _netapp; |
SolderSplashLabs | 23:fed7f64dd520 | 710 | cc3000_wlan _wlan; |
SolderSplashLabs | 23:fed7f64dd520 | 711 | protected: |
SolderSplashLabs | 23:fed7f64dd520 | 712 | static cc3000 *_inst; |
SolderSplashLabs | 23:fed7f64dd520 | 713 | private: |
SolderSplashLabs | 23:fed7f64dd520 | 714 | tStatus _status; |
SolderSplashLabs | 23:fed7f64dd520 | 715 | netapp_pingreport_args_t _ping_report; |
SolderSplashLabs | 23:fed7f64dd520 | 716 | bool _closed_sockets[MAX_SOCKETS]; |
SolderSplashLabs | 23:fed7f64dd520 | 717 | }; |
SolderSplashLabs | 23:fed7f64dd520 | 718 | |
SolderSplashLabs | 23:fed7f64dd520 | 719 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 720 | * Copy 32 bit to stream while converting to little endian format. |
SolderSplashLabs | 23:fed7f64dd520 | 721 | * @param p pointer to the new stream |
SolderSplashLabs | 23:fed7f64dd520 | 722 | * @param u32 pointer to the 32 bit |
SolderSplashLabs | 23:fed7f64dd520 | 723 | * @return pointer to the new stream |
SolderSplashLabs | 23:fed7f64dd520 | 724 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 725 | uint8_t *UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32); |
SolderSplashLabs | 23:fed7f64dd520 | 726 | |
SolderSplashLabs | 23:fed7f64dd520 | 727 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 728 | * Copy 16 bit to stream while converting to little endian format. |
SolderSplashLabs | 23:fed7f64dd520 | 729 | * @param p pointer to the new stream |
SolderSplashLabs | 23:fed7f64dd520 | 730 | * @param u32 pointer to the 16 bit |
SolderSplashLabs | 23:fed7f64dd520 | 731 | * @return pointer to the new stream |
SolderSplashLabs | 23:fed7f64dd520 | 732 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 733 | uint8_t *UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16); |
SolderSplashLabs | 23:fed7f64dd520 | 734 | |
SolderSplashLabs | 23:fed7f64dd520 | 735 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 736 | * Copy received stream to 16 bit in little endian format. |
SolderSplashLabs | 23:fed7f64dd520 | 737 | * @param p pointer to the stream |
SolderSplashLabs | 23:fed7f64dd520 | 738 | * @param offset offset in the stream |
SolderSplashLabs | 23:fed7f64dd520 | 739 | * @return pointer to the new 16 bit |
SolderSplashLabs | 23:fed7f64dd520 | 740 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 741 | uint16_t STREAM_TO_UINT16_f(uint8_t* p, uint16_t offset); |
SolderSplashLabs | 23:fed7f64dd520 | 742 | |
SolderSplashLabs | 23:fed7f64dd520 | 743 | /** |
SolderSplashLabs | 23:fed7f64dd520 | 744 | * Copy received stream to 32 bit in little endian format. |
SolderSplashLabs | 23:fed7f64dd520 | 745 | * @param p pointer to the stream |
SolderSplashLabs | 23:fed7f64dd520 | 746 | * @param offset offset in the stream |
SolderSplashLabs | 23:fed7f64dd520 | 747 | * @return pointer to the new 32 bit |
SolderSplashLabs | 23:fed7f64dd520 | 748 | */ |
SolderSplashLabs | 23:fed7f64dd520 | 749 | uint32_t STREAM_TO_UINT32_f(uint8_t* p, uint16_t offset); |
SolderSplashLabs | 23:fed7f64dd520 | 750 | |
SolderSplashLabs | 23:fed7f64dd520 | 751 | } /* end of mbed_cc3000 namespace */ |
SolderSplashLabs | 23:fed7f64dd520 | 752 | |
SolderSplashLabs | 23:fed7f64dd520 | 753 | |
SolderSplashLabs | 23:fed7f64dd520 | 754 | #endif |