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_simplelink.cpp
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 #include "cc3000.h" 00042 #include "cc3000_common.h" 00043 00044 namespace mbed_cc3000 { 00045 00046 cc3000_simple_link::cc3000_simple_link() { 00047 } 00048 00049 cc3000_simple_link::~cc3000_simple_link() { 00050 } 00051 00052 void cc3000_simple_link::create_txrx_buffers(uint32_t tx_size, uint32_t rx_size) { 00053 _rx_buffer = new uint8_t[rx_size]; 00054 _tx_buffer = new uint8_t[tx_size]; 00055 _rx_buffer[rx_size - 1] = CC3000_BUFFER_MAGIC_NUMBER; 00056 _tx_buffer[tx_size - 1] = CC3000_BUFFER_MAGIC_NUMBER; 00057 } 00058 00059 uint8_t cc3000_simple_link::get_data_received_flag() { 00060 return _data_received_flag; 00061 } 00062 00063 void *cc3000_simple_link::get_func_pointer(FunctionNumber function){ 00064 void *result; 00065 /* casting to void *, will be casted back once used */ 00066 switch(function) { 00067 case FW_PATCHES: 00068 result = (void *)_fFWPatches; 00069 break; 00070 case DRIVER_PATCHES: 00071 result = (void *)_fDriverPatches; 00072 break; 00073 case BOOTLOADER_PATCHES: 00074 result = (void *)_fBootLoaderPatches; 00075 break; 00076 default: 00077 result = 0; 00078 } 00079 return result; 00080 } 00081 00082 uint8_t* cc3000_simple_link::get_transmit_buffer() { 00083 return _tx_buffer; 00084 } 00085 00086 uint8_t* cc3000_simple_link::get_received_buffer() { 00087 return _rx_buffer; 00088 } 00089 00090 void cc3000_simple_link::set_op_code(uint16_t code) { 00091 _rx_event_opcode = code; 00092 } 00093 00094 void cc3000_simple_link::set_pending_data(uint16_t value) { 00095 _rx_data_pending = value; 00096 } 00097 00098 uint16_t cc3000_simple_link::get_pending_data() { 00099 return _rx_data_pending; 00100 } 00101 00102 void cc3000_simple_link::set_number_free_buffers(uint16_t value) { 00103 _free_buffers = value; 00104 } 00105 00106 void cc3000_simple_link::set_number_of_released_packets(uint16_t value) { 00107 _released_packets = value; 00108 } 00109 00110 00111 void cc3000_simple_link::set_tx_complete_signal(bool value) { 00112 _tx_complete_signal = value; 00113 } 00114 00115 bool cc3000_simple_link::get_tx_complete_signal() { 00116 return _tx_complete_signal; 00117 } 00118 00119 void cc3000_simple_link::set_data_received_flag(uint8_t value) { 00120 _data_received_flag = value; 00121 } 00122 00123 uint16_t cc3000_simple_link::get_number_free_buffers() { 00124 return _free_buffers; 00125 } 00126 00127 uint16_t cc3000_simple_link::get_buffer_length() { 00128 return _buffer_length; 00129 } 00130 00131 void cc3000_simple_link::set_buffer_length(uint16_t value) { 00132 _buffer_length = value; 00133 } 00134 00135 uint16_t cc3000_simple_link::get_op_code() { 00136 return _rx_event_opcode; 00137 } 00138 00139 uint16_t cc3000_simple_link::get_released_packets() { 00140 return _released_packets; 00141 } 00142 00143 uint16_t cc3000_simple_link::get_sent_packets() { 00144 return _sent_packets; 00145 } 00146 00147 void cc3000_simple_link::set_sent_packets(uint16_t value) { 00148 _sent_packets = value; 00149 } 00150 00151 void cc3000_simple_link::set_transmit_error(int32_t value){ 00152 _transmit_data_error = value; 00153 } 00154 00155 int32_t cc3000_simple_link::get_transmit_error(){ 00156 return _transmit_data_error; 00157 } 00158 00159 void cc3000_simple_link::set_buffer_size(uint16_t value) { 00160 _buffer_size = value; 00161 } 00162 00163 uint16_t cc3000_simple_link::get_buffer_size(void) { 00164 return _buffer_size; 00165 } 00166 00167 uint8_t *cc3000_simple_link::get_received_data(void) { 00168 return _received_data; 00169 } 00170 00171 void cc3000_simple_link::set_received_data(uint8_t *pointer) { 00172 _received_data = pointer; 00173 } 00174 00175 } // mbed_cc3000 namespace
Generated on Fri Jul 15 2022 02:23:47 by
1.7.2
