version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Committer:
Kojto
Date:
Tue Oct 08 07:04:07 2013 +0200
Revision:
33:9e23b24fb4f3
Parent:
20:30b6ed7bf8fd
Child:
45:50ab13d8f2dc
Removed code (set buffers) - non-sense, doxygen comments for simple link class

Who changed what in which revision?

UserRevisionLine numberNew 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 #include "cc3000.h"
Kojto 20:30b6ed7bf8fd 42 #include "cc3000_common.h"
Kojto 20:30b6ed7bf8fd 43
Kojto 20:30b6ed7bf8fd 44 namespace mbed_cc3000 {
Kojto 20:30b6ed7bf8fd 45
Kojto 20:30b6ed7bf8fd 46 cc3000_simple_link::cc3000_simple_link() {
Kojto 20:30b6ed7bf8fd 47 _rx_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
Kojto 20:30b6ed7bf8fd 48 _tx_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
Kojto 20:30b6ed7bf8fd 49 }
Kojto 20:30b6ed7bf8fd 50
Kojto 20:30b6ed7bf8fd 51 cc3000_simple_link::~cc3000_simple_link() {
Kojto 20:30b6ed7bf8fd 52 }
Kojto 20:30b6ed7bf8fd 53
Kojto 20:30b6ed7bf8fd 54 uint8_t cc3000_simple_link::get_data_received_flag() {
Kojto 20:30b6ed7bf8fd 55 return _data_received_flag;
Kojto 20:30b6ed7bf8fd 56 }
Kojto 20:30b6ed7bf8fd 57
Kojto 20:30b6ed7bf8fd 58 void *cc3000_simple_link::get_func_pointer(FunctionNumber function){
Kojto 20:30b6ed7bf8fd 59 void *result;
Kojto 20:30b6ed7bf8fd 60 /* casting to void *, will be casted back once used */
Kojto 20:30b6ed7bf8fd 61 switch(function) {
Kojto 20:30b6ed7bf8fd 62 case FW_PATCHES:
Kojto 20:30b6ed7bf8fd 63 result = (void *)_fFWPatches;
Kojto 20:30b6ed7bf8fd 64 break;
Kojto 20:30b6ed7bf8fd 65 case DRIVER_PATCHES:
Kojto 20:30b6ed7bf8fd 66 result = (void *)_fDriverPatches;
Kojto 20:30b6ed7bf8fd 67 break;
Kojto 20:30b6ed7bf8fd 68 case BOOTLOADER_PATCHES:
Kojto 20:30b6ed7bf8fd 69 result = (void *)_fBootLoaderPatches;
Kojto 20:30b6ed7bf8fd 70 break;
Kojto 20:30b6ed7bf8fd 71 // case WLAN_CB:
Kojto 20:30b6ed7bf8fd 72 // result = (void *)_fWlanCB;
Kojto 20:30b6ed7bf8fd 73 // break;
Kojto 20:30b6ed7bf8fd 74 default:
Kojto 20:30b6ed7bf8fd 75 result = 0;
Kojto 20:30b6ed7bf8fd 76 }
Kojto 20:30b6ed7bf8fd 77 return result;
Kojto 20:30b6ed7bf8fd 78 }
Kojto 20:30b6ed7bf8fd 79
Kojto 20:30b6ed7bf8fd 80 uint8_t *cc3000_simple_link::get_transmit_buffer() {
Kojto 20:30b6ed7bf8fd 81 return _tx_buffer;
Kojto 20:30b6ed7bf8fd 82 }
Kojto 20:30b6ed7bf8fd 83
Kojto 20:30b6ed7bf8fd 84 uint8_t *cc3000_simple_link::get_received_buffer() {
Kojto 20:30b6ed7bf8fd 85 return _rx_buffer;
Kojto 20:30b6ed7bf8fd 86 }
Kojto 20:30b6ed7bf8fd 87
Kojto 20:30b6ed7bf8fd 88 void cc3000_simple_link::set_op_code(uint16_t code) {
Kojto 20:30b6ed7bf8fd 89 _rx_event_opcode = code;
Kojto 20:30b6ed7bf8fd 90 }
Kojto 20:30b6ed7bf8fd 91
Kojto 20:30b6ed7bf8fd 92 void cc3000_simple_link::set_pending_data(uint16_t value) {
Kojto 20:30b6ed7bf8fd 93 _rx_data_pending = value;
Kojto 20:30b6ed7bf8fd 94 }
Kojto 20:30b6ed7bf8fd 95
Kojto 20:30b6ed7bf8fd 96 uint16_t cc3000_simple_link::get_pending_data() {
Kojto 20:30b6ed7bf8fd 97 return _rx_data_pending;
Kojto 20:30b6ed7bf8fd 98 }
Kojto 20:30b6ed7bf8fd 99
Kojto 20:30b6ed7bf8fd 100 void cc3000_simple_link::set_number_free_buffers(uint16_t value) {
Kojto 20:30b6ed7bf8fd 101 _free_buffers = value;
Kojto 20:30b6ed7bf8fd 102 }
Kojto 20:30b6ed7bf8fd 103
Kojto 20:30b6ed7bf8fd 104 void cc3000_simple_link::set_number_of_released_packets(uint16_t value) {
Kojto 20:30b6ed7bf8fd 105 _released_packets = value;
Kojto 20:30b6ed7bf8fd 106 }
Kojto 20:30b6ed7bf8fd 107
Kojto 20:30b6ed7bf8fd 108
Kojto 20:30b6ed7bf8fd 109 void cc3000_simple_link::set_tx_complete_signal(bool value) {
Kojto 20:30b6ed7bf8fd 110 _tx_complete_signal = value;
Kojto 20:30b6ed7bf8fd 111 }
Kojto 20:30b6ed7bf8fd 112
Kojto 20:30b6ed7bf8fd 113 bool cc3000_simple_link::get_tx_complete_signal() {
Kojto 20:30b6ed7bf8fd 114 return _tx_complete_signal;
Kojto 20:30b6ed7bf8fd 115 }
Kojto 20:30b6ed7bf8fd 116
Kojto 20:30b6ed7bf8fd 117 void cc3000_simple_link::set_data_received_flag(uint8_t value) {
Kojto 20:30b6ed7bf8fd 118 _data_received_flag = value;
Kojto 20:30b6ed7bf8fd 119 }
Kojto 20:30b6ed7bf8fd 120
Kojto 20:30b6ed7bf8fd 121 uint16_t cc3000_simple_link::get_number_free_buffers() {
Kojto 20:30b6ed7bf8fd 122 return _free_buffers;
Kojto 20:30b6ed7bf8fd 123 }
Kojto 20:30b6ed7bf8fd 124
Kojto 20:30b6ed7bf8fd 125 uint16_t cc3000_simple_link::get_buffer_length() {
Kojto 20:30b6ed7bf8fd 126 return _buffer_length;
Kojto 20:30b6ed7bf8fd 127 }
Kojto 20:30b6ed7bf8fd 128
Kojto 20:30b6ed7bf8fd 129 void cc3000_simple_link::set_buffer_length(uint16_t value) {
Kojto 20:30b6ed7bf8fd 130 _buffer_length = value;
Kojto 20:30b6ed7bf8fd 131 }
Kojto 20:30b6ed7bf8fd 132
Kojto 20:30b6ed7bf8fd 133 uint16_t cc3000_simple_link::get_op_code() {
Kojto 20:30b6ed7bf8fd 134 return _rx_event_opcode;
Kojto 20:30b6ed7bf8fd 135 }
Kojto 20:30b6ed7bf8fd 136
Kojto 20:30b6ed7bf8fd 137 uint16_t cc3000_simple_link::get_released_packets() {
Kojto 20:30b6ed7bf8fd 138 return _released_packets;
Kojto 20:30b6ed7bf8fd 139 }
Kojto 20:30b6ed7bf8fd 140
Kojto 20:30b6ed7bf8fd 141 uint16_t cc3000_simple_link::get_sent_packets() {
Kojto 20:30b6ed7bf8fd 142 return _sent_packets;
Kojto 20:30b6ed7bf8fd 143 }
Kojto 20:30b6ed7bf8fd 144
Kojto 20:30b6ed7bf8fd 145 void cc3000_simple_link::set_sent_packets(uint16_t value) {
Kojto 20:30b6ed7bf8fd 146 _sent_packets = value;
Kojto 20:30b6ed7bf8fd 147 }
Kojto 20:30b6ed7bf8fd 148
Kojto 20:30b6ed7bf8fd 149 void cc3000_simple_link::set_transmit_error(int32_t value){
Kojto 20:30b6ed7bf8fd 150 _transmit_data_error = value;
Kojto 20:30b6ed7bf8fd 151 }
Kojto 20:30b6ed7bf8fd 152
Kojto 20:30b6ed7bf8fd 153 int32_t cc3000_simple_link::get_transmit_error(){
Kojto 20:30b6ed7bf8fd 154 return _transmit_data_error;
Kojto 20:30b6ed7bf8fd 155 }
Kojto 20:30b6ed7bf8fd 156
Kojto 20:30b6ed7bf8fd 157 void cc3000_simple_link::set_buffer_size(uint16_t value) {
Kojto 20:30b6ed7bf8fd 158 _buffer_size = value;
Kojto 20:30b6ed7bf8fd 159 }
Kojto 20:30b6ed7bf8fd 160
Kojto 20:30b6ed7bf8fd 161 uint16_t cc3000_simple_link::get_buffer_size(void) {
Kojto 20:30b6ed7bf8fd 162 return _buffer_size;
Kojto 20:30b6ed7bf8fd 163 }
Kojto 20:30b6ed7bf8fd 164
Kojto 20:30b6ed7bf8fd 165 uint8_t *cc3000_simple_link::get_received_data(void) {
Kojto 20:30b6ed7bf8fd 166 return _received_data;
Kojto 20:30b6ed7bf8fd 167 }
Kojto 20:30b6ed7bf8fd 168
Kojto 20:30b6ed7bf8fd 169 void cc3000_simple_link::set_received_data(uint8_t *pointer) {
Kojto 20:30b6ed7bf8fd 170 _received_data = pointer;
Kojto 20:30b6ed7bf8fd 171 }
Kojto 20:30b6ed7bf8fd 172
Kojto 20:30b6ed7bf8fd 173 //void cc3000_simple_link::set_wlan_cb(tWlanCB fpointer) {
Kojto 20:30b6ed7bf8fd 174 // _fWlanCB = fpointer;
Kojto 20:30b6ed7bf8fd 175 //}
Kojto 20:30b6ed7bf8fd 176
Kojto 20:30b6ed7bf8fd 177 }