Webserver+3d print

Dependents:   Nucleo

Committer:
Sergunb
Date:
Sat Feb 04 18:15:49 2017 +0000
Revision:
0:8918a71cdbe9
nothing else

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:8918a71cdbe9 1 /**
Sergunb 0:8918a71cdbe9 2 * @file nic.c
Sergunb 0:8918a71cdbe9 3 * @brief Network interface controller abstraction layer
Sergunb 0:8918a71cdbe9 4 *
Sergunb 0:8918a71cdbe9 5 * @section License
Sergunb 0:8918a71cdbe9 6 *
Sergunb 0:8918a71cdbe9 7 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
Sergunb 0:8918a71cdbe9 8 *
Sergunb 0:8918a71cdbe9 9 * This file is part of CycloneTCP Open.
Sergunb 0:8918a71cdbe9 10 *
Sergunb 0:8918a71cdbe9 11 * This program is free software; you can redistribute it and/or
Sergunb 0:8918a71cdbe9 12 * modify it under the terms of the GNU General Public License
Sergunb 0:8918a71cdbe9 13 * as published by the Free Software Foundation; either version 2
Sergunb 0:8918a71cdbe9 14 * of the License, or (at your option) any later version.
Sergunb 0:8918a71cdbe9 15 *
Sergunb 0:8918a71cdbe9 16 * This program is distributed in the hope that it will be useful,
Sergunb 0:8918a71cdbe9 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Sergunb 0:8918a71cdbe9 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Sergunb 0:8918a71cdbe9 19 * GNU General Public License for more details.
Sergunb 0:8918a71cdbe9 20 *
Sergunb 0:8918a71cdbe9 21 * You should have received a copy of the GNU General Public License
Sergunb 0:8918a71cdbe9 22 * along with this program; if not, write to the Free Software Foundation,
Sergunb 0:8918a71cdbe9 23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Sergunb 0:8918a71cdbe9 24 *
Sergunb 0:8918a71cdbe9 25 * @author Oryx Embedded SARL (www.oryx-embedded.com)
Sergunb 0:8918a71cdbe9 26 * @version 1.7.6
Sergunb 0:8918a71cdbe9 27 **/
Sergunb 0:8918a71cdbe9 28
Sergunb 0:8918a71cdbe9 29 //Switch to the appropriate trace level
Sergunb 0:8918a71cdbe9 30 #define TRACE_LEVEL NIC_TRACE_LEVEL
Sergunb 0:8918a71cdbe9 31
Sergunb 0:8918a71cdbe9 32 //Dependencies
Sergunb 0:8918a71cdbe9 33 #include "core/net.h"
Sergunb 0:8918a71cdbe9 34 #include "core/nic.h"
Sergunb 0:8918a71cdbe9 35 #include "core/socket.h"
Sergunb 0:8918a71cdbe9 36 #include "core/raw_socket.h"
Sergunb 0:8918a71cdbe9 37 #include "core/tcp_misc.h"
Sergunb 0:8918a71cdbe9 38 #include "core/udp.h"
Sergunb 0:8918a71cdbe9 39 #include "ipv4/ipv4.h"
Sergunb 0:8918a71cdbe9 40 #include "ipv6/ipv6.h"
Sergunb 0:8918a71cdbe9 41 #include "dns/dns_cache.h"
Sergunb 0:8918a71cdbe9 42 #include "dns/dns_client.h"
Sergunb 0:8918a71cdbe9 43 #include "mdns/mdns_client.h"
Sergunb 0:8918a71cdbe9 44 #include "mdns/mdns_responder.h"
Sergunb 0:8918a71cdbe9 45 #include "dns_sd/dns_sd.h"
Sergunb 0:8918a71cdbe9 46 #include "mibs/mib2_module.h"
Sergunb 0:8918a71cdbe9 47 #include "debug.h"
Sergunb 0:8918a71cdbe9 48
Sergunb 0:8918a71cdbe9 49 //Tick counter to handle periodic operations
Sergunb 0:8918a71cdbe9 50 systime_t nicTickCounter;
Sergunb 0:8918a71cdbe9 51
Sergunb 0:8918a71cdbe9 52
Sergunb 0:8918a71cdbe9 53 /**
Sergunb 0:8918a71cdbe9 54 * @brief Network controller timer handler
Sergunb 0:8918a71cdbe9 55 *
Sergunb 0:8918a71cdbe9 56 * This routine is periodically called by the TCP/IP stack to
Sergunb 0:8918a71cdbe9 57 * handle periodic operations such as polling the link state
Sergunb 0:8918a71cdbe9 58 *
Sergunb 0:8918a71cdbe9 59 * @param[in] interface Underlying network interface
Sergunb 0:8918a71cdbe9 60 **/
Sergunb 0:8918a71cdbe9 61
Sergunb 0:8918a71cdbe9 62 void nicTick(NetInterface *interface)
Sergunb 0:8918a71cdbe9 63 {
Sergunb 0:8918a71cdbe9 64 //Disable interrupts
Sergunb 0:8918a71cdbe9 65 interface->nicDriver->disableIrq(interface);
Sergunb 0:8918a71cdbe9 66
Sergunb 0:8918a71cdbe9 67 //Handle periodic operations
Sergunb 0:8918a71cdbe9 68 interface->nicDriver->tick(interface);
Sergunb 0:8918a71cdbe9 69
Sergunb 0:8918a71cdbe9 70 //Re-enable interrupts if necessary
Sergunb 0:8918a71cdbe9 71 if(interface->configured)
Sergunb 0:8918a71cdbe9 72 interface->nicDriver->enableIrq(interface);
Sergunb 0:8918a71cdbe9 73 }
Sergunb 0:8918a71cdbe9 74
Sergunb 0:8918a71cdbe9 75
Sergunb 0:8918a71cdbe9 76 /**
Sergunb 0:8918a71cdbe9 77 * @brief Send a packet to the network controller
Sergunb 0:8918a71cdbe9 78 * @param[in] interface Underlying network interface
Sergunb 0:8918a71cdbe9 79 * @param[in] buffer Multi-part buffer containing the data to send
Sergunb 0:8918a71cdbe9 80 * @param[in] offset Offset to the first data byte
Sergunb 0:8918a71cdbe9 81 * @return Error code
Sergunb 0:8918a71cdbe9 82 **/
Sergunb 0:8918a71cdbe9 83
Sergunb 0:8918a71cdbe9 84 error_t nicSendPacket(NetInterface *interface, const NetBuffer *buffer, size_t offset)
Sergunb 0:8918a71cdbe9 85 {
Sergunb 0:8918a71cdbe9 86 error_t error;
Sergunb 0:8918a71cdbe9 87 bool_t status;
Sergunb 0:8918a71cdbe9 88
Sergunb 0:8918a71cdbe9 89 #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
Sergunb 0:8918a71cdbe9 90 //Retrieve the length of the packet
Sergunb 0:8918a71cdbe9 91 size_t length = netBufferGetLength(buffer) - offset;
Sergunb 0:8918a71cdbe9 92
Sergunb 0:8918a71cdbe9 93 //Debug message
Sergunb 0:8918a71cdbe9 94 TRACE_DEBUG("Sending packet (%" PRIuSIZE " bytes)...\r\n", length);
Sergunb 0:8918a71cdbe9 95 TRACE_DEBUG_NET_BUFFER(" ", buffer, offset, length);
Sergunb 0:8918a71cdbe9 96 #endif
Sergunb 0:8918a71cdbe9 97
Sergunb 0:8918a71cdbe9 98 //Wait for the transmitter to be ready to send
Sergunb 0:8918a71cdbe9 99 status = osWaitForEvent(&interface->nicTxEvent, NIC_MAX_BLOCKING_TIME);
Sergunb 0:8918a71cdbe9 100
Sergunb 0:8918a71cdbe9 101 //Check whether the specified event is in signaled state
Sergunb 0:8918a71cdbe9 102 if(status)
Sergunb 0:8918a71cdbe9 103 {
Sergunb 0:8918a71cdbe9 104 //Disable interrupts
Sergunb 0:8918a71cdbe9 105 interface->nicDriver->disableIrq(interface);
Sergunb 0:8918a71cdbe9 106
Sergunb 0:8918a71cdbe9 107 //Send Ethernet frame
Sergunb 0:8918a71cdbe9 108 error = interface->nicDriver->sendPacket(interface, buffer, offset);
Sergunb 0:8918a71cdbe9 109
Sergunb 0:8918a71cdbe9 110 //Re-enable interrupts if necessary
Sergunb 0:8918a71cdbe9 111 if(interface->configured)
Sergunb 0:8918a71cdbe9 112 interface->nicDriver->enableIrq(interface);
Sergunb 0:8918a71cdbe9 113 }
Sergunb 0:8918a71cdbe9 114 else
Sergunb 0:8918a71cdbe9 115 {
Sergunb 0:8918a71cdbe9 116 //The transmitter is busy...
Sergunb 0:8918a71cdbe9 117 return ERROR_TRANSMITTER_BUSY;
Sergunb 0:8918a71cdbe9 118 }
Sergunb 0:8918a71cdbe9 119
Sergunb 0:8918a71cdbe9 120 //Return status code
Sergunb 0:8918a71cdbe9 121 return error;
Sergunb 0:8918a71cdbe9 122 }
Sergunb 0:8918a71cdbe9 123
Sergunb 0:8918a71cdbe9 124
Sergunb 0:8918a71cdbe9 125 /**
Sergunb 0:8918a71cdbe9 126 * @brief Configure multicast MAC address filtering
Sergunb 0:8918a71cdbe9 127 * @param[in] interface Underlying network interface
Sergunb 0:8918a71cdbe9 128 * @return Error code
Sergunb 0:8918a71cdbe9 129 **/
Sergunb 0:8918a71cdbe9 130
Sergunb 0:8918a71cdbe9 131 error_t nicSetMulticastFilter(NetInterface *interface)
Sergunb 0:8918a71cdbe9 132 {
Sergunb 0:8918a71cdbe9 133 error_t error;
Sergunb 0:8918a71cdbe9 134
Sergunb 0:8918a71cdbe9 135 //Disable interrupts
Sergunb 0:8918a71cdbe9 136 interface->nicDriver->disableIrq(interface);
Sergunb 0:8918a71cdbe9 137
Sergunb 0:8918a71cdbe9 138 //Update MAC filter table
Sergunb 0:8918a71cdbe9 139 error = interface->nicDriver->setMulticastFilter(interface);
Sergunb 0:8918a71cdbe9 140
Sergunb 0:8918a71cdbe9 141 //Re-enable interrupts if necessary
Sergunb 0:8918a71cdbe9 142 if(interface->configured)
Sergunb 0:8918a71cdbe9 143 interface->nicDriver->enableIrq(interface);
Sergunb 0:8918a71cdbe9 144
Sergunb 0:8918a71cdbe9 145 //Return status code
Sergunb 0:8918a71cdbe9 146 return error;
Sergunb 0:8918a71cdbe9 147 }
Sergunb 0:8918a71cdbe9 148
Sergunb 0:8918a71cdbe9 149
Sergunb 0:8918a71cdbe9 150 /**
Sergunb 0:8918a71cdbe9 151 * @brief Handle a packet received by the network controller
Sergunb 0:8918a71cdbe9 152 * @param[in] interface Underlying network interface
Sergunb 0:8918a71cdbe9 153 * @param[in] packet Incoming packet to process
Sergunb 0:8918a71cdbe9 154 * @param[in] length Total packet length
Sergunb 0:8918a71cdbe9 155 **/
Sergunb 0:8918a71cdbe9 156
Sergunb 0:8918a71cdbe9 157 void nicProcessPacket(NetInterface *interface, void *packet, size_t length)
Sergunb 0:8918a71cdbe9 158 {
Sergunb 0:8918a71cdbe9 159 NicType type;
Sergunb 0:8918a71cdbe9 160
Sergunb 0:8918a71cdbe9 161 //Re-enable interrupts if necessary
Sergunb 0:8918a71cdbe9 162 if(interface->configured)
Sergunb 0:8918a71cdbe9 163 interface->nicDriver->enableIrq(interface);
Sergunb 0:8918a71cdbe9 164
Sergunb 0:8918a71cdbe9 165 //Debug message
Sergunb 0:8918a71cdbe9 166 TRACE_DEBUG("Packet received (%" PRIuSIZE " bytes)...\r\n", length);
Sergunb 0:8918a71cdbe9 167 TRACE_DEBUG_ARRAY(" ", packet, length);
Sergunb 0:8918a71cdbe9 168
Sergunb 0:8918a71cdbe9 169 //Retrieve network interface type
Sergunb 0:8918a71cdbe9 170 type = interface->nicDriver->type;
Sergunb 0:8918a71cdbe9 171
Sergunb 0:8918a71cdbe9 172 //Ethernet interface?
Sergunb 0:8918a71cdbe9 173 if(type == NIC_TYPE_ETHERNET)
Sergunb 0:8918a71cdbe9 174 {
Sergunb 0:8918a71cdbe9 175 #if (ETH_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 176 //Process incoming Ethernet frame
Sergunb 0:8918a71cdbe9 177 ethProcessFrame(interface, packet, length);
Sergunb 0:8918a71cdbe9 178 #endif
Sergunb 0:8918a71cdbe9 179 }
Sergunb 0:8918a71cdbe9 180 //PPP interface?
Sergunb 0:8918a71cdbe9 181 else if(type == NIC_TYPE_PPP)
Sergunb 0:8918a71cdbe9 182 {
Sergunb 0:8918a71cdbe9 183 #if (PPP_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 184 //Process incoming PPP frame
Sergunb 0:8918a71cdbe9 185 pppProcessFrame(interface, packet, length);
Sergunb 0:8918a71cdbe9 186 #endif
Sergunb 0:8918a71cdbe9 187 }
Sergunb 0:8918a71cdbe9 188 //6LoWPAN interface?
Sergunb 0:8918a71cdbe9 189 else if(type == NIC_TYPE_6LOWPAN)
Sergunb 0:8918a71cdbe9 190 {
Sergunb 0:8918a71cdbe9 191 #if (IPV6_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 192 NetBuffer1 buffer;
Sergunb 0:8918a71cdbe9 193
Sergunb 0:8918a71cdbe9 194 //The incoming packet fits in a single chunk
Sergunb 0:8918a71cdbe9 195 buffer.chunkCount = 1;
Sergunb 0:8918a71cdbe9 196 buffer.maxChunkCount = 1;
Sergunb 0:8918a71cdbe9 197 buffer.chunk[0].address = packet;
Sergunb 0:8918a71cdbe9 198 buffer.chunk[0].length = length;
Sergunb 0:8918a71cdbe9 199 buffer.chunk[0].size = 0;
Sergunb 0:8918a71cdbe9 200
Sergunb 0:8918a71cdbe9 201 //Process incoming IPv6 packet
Sergunb 0:8918a71cdbe9 202 ipv6ProcessPacket(interface, (NetBuffer *) &buffer, 0);
Sergunb 0:8918a71cdbe9 203 #endif
Sergunb 0:8918a71cdbe9 204 }
Sergunb 0:8918a71cdbe9 205
Sergunb 0:8918a71cdbe9 206 //Disable interrupts
Sergunb 0:8918a71cdbe9 207 interface->nicDriver->disableIrq(interface);
Sergunb 0:8918a71cdbe9 208 }
Sergunb 0:8918a71cdbe9 209
Sergunb 0:8918a71cdbe9 210
Sergunb 0:8918a71cdbe9 211 /**
Sergunb 0:8918a71cdbe9 212 * @brief Process link state change event
Sergunb 0:8918a71cdbe9 213 * @param[in] interface Underlying network interface
Sergunb 0:8918a71cdbe9 214 **/
Sergunb 0:8918a71cdbe9 215
Sergunb 0:8918a71cdbe9 216 void nicNotifyLinkChange(NetInterface *interface)
Sergunb 0:8918a71cdbe9 217 {
Sergunb 0:8918a71cdbe9 218 uint_t i;
Sergunb 0:8918a71cdbe9 219 Socket *socket;
Sergunb 0:8918a71cdbe9 220
Sergunb 0:8918a71cdbe9 221 //Re-enable interrupts if necessary
Sergunb 0:8918a71cdbe9 222 if(interface->configured)
Sergunb 0:8918a71cdbe9 223 interface->nicDriver->enableIrq(interface);
Sergunb 0:8918a71cdbe9 224
Sergunb 0:8918a71cdbe9 225 //Check link state
Sergunb 0:8918a71cdbe9 226 if(interface->linkState)
Sergunb 0:8918a71cdbe9 227 {
Sergunb 0:8918a71cdbe9 228 //Display link state
Sergunb 0:8918a71cdbe9 229 TRACE_INFO("Link is up (%s)...\r\n", interface->name);
Sergunb 0:8918a71cdbe9 230
Sergunb 0:8918a71cdbe9 231 //Display link speed
Sergunb 0:8918a71cdbe9 232 if(interface->linkSpeed == NIC_LINK_SPEED_1GBPS)
Sergunb 0:8918a71cdbe9 233 {
Sergunb 0:8918a71cdbe9 234 //1000BASE-T
Sergunb 0:8918a71cdbe9 235 TRACE_INFO(" Link speed = 1000 Mbps\r\n");
Sergunb 0:8918a71cdbe9 236 }
Sergunb 0:8918a71cdbe9 237 else if(interface->linkSpeed == NIC_LINK_SPEED_100MBPS)
Sergunb 0:8918a71cdbe9 238 {
Sergunb 0:8918a71cdbe9 239 //100BASE-TX
Sergunb 0:8918a71cdbe9 240 TRACE_INFO(" Link speed = 100 Mbps\r\n");
Sergunb 0:8918a71cdbe9 241 }
Sergunb 0:8918a71cdbe9 242 else if(interface->linkSpeed == NIC_LINK_SPEED_10MBPS)
Sergunb 0:8918a71cdbe9 243 {
Sergunb 0:8918a71cdbe9 244 //10BASE-T
Sergunb 0:8918a71cdbe9 245 TRACE_INFO(" Link speed = 10 Mbps\r\n");
Sergunb 0:8918a71cdbe9 246 }
Sergunb 0:8918a71cdbe9 247 else if(interface->linkSpeed != NIC_LINK_SPEED_UNKNOWN)
Sergunb 0:8918a71cdbe9 248 {
Sergunb 0:8918a71cdbe9 249 //10BASE-T
Sergunb 0:8918a71cdbe9 250 TRACE_INFO(" Link speed = %" PRIu32 " bps\r\n", interface->linkSpeed);
Sergunb 0:8918a71cdbe9 251 }
Sergunb 0:8918a71cdbe9 252
Sergunb 0:8918a71cdbe9 253 //Display duplex mode
Sergunb 0:8918a71cdbe9 254 if(interface->duplexMode == NIC_FULL_DUPLEX_MODE)
Sergunb 0:8918a71cdbe9 255 {
Sergunb 0:8918a71cdbe9 256 //1000BASE-T
Sergunb 0:8918a71cdbe9 257 TRACE_INFO(" Duplex mode = Full-Duplex\r\n");
Sergunb 0:8918a71cdbe9 258 }
Sergunb 0:8918a71cdbe9 259 else if(interface->duplexMode == NIC_HALF_DUPLEX_MODE)
Sergunb 0:8918a71cdbe9 260 {
Sergunb 0:8918a71cdbe9 261 //100BASE-TX
Sergunb 0:8918a71cdbe9 262 TRACE_INFO(" Duplex mode = Half-Duplex\r\n");
Sergunb 0:8918a71cdbe9 263 }
Sergunb 0:8918a71cdbe9 264 }
Sergunb 0:8918a71cdbe9 265 else
Sergunb 0:8918a71cdbe9 266 {
Sergunb 0:8918a71cdbe9 267 //Display link state
Sergunb 0:8918a71cdbe9 268 TRACE_INFO("Link is down (%s)...\r\n", interface->name);
Sergunb 0:8918a71cdbe9 269 }
Sergunb 0:8918a71cdbe9 270
Sergunb 0:8918a71cdbe9 271 //Interface's current bandwidth
Sergunb 0:8918a71cdbe9 272 MIB2_SET_GAUGE32(interface->mibIfEntry->ifSpeed, interface->linkSpeed);
Sergunb 0:8918a71cdbe9 273
Sergunb 0:8918a71cdbe9 274 //The current operational state of the interface
Sergunb 0:8918a71cdbe9 275 if(interface->linkState)
Sergunb 0:8918a71cdbe9 276 MIB2_SET_INTEGER(interface->mibIfEntry->ifOperStatus, MIB2_IF_OPER_STATUS_UP);
Sergunb 0:8918a71cdbe9 277 else
Sergunb 0:8918a71cdbe9 278 MIB2_SET_INTEGER(interface->mibIfEntry->ifOperStatus, MIB2_IF_OPER_STATUS_DOWN);
Sergunb 0:8918a71cdbe9 279
Sergunb 0:8918a71cdbe9 280 //The time at which the interface entered its current operational state
Sergunb 0:8918a71cdbe9 281 MIB2_SET_TIME_TICKS(interface->mibIfEntry->ifLastChange, osGetSystemTime() / 10);
Sergunb 0:8918a71cdbe9 282
Sergunb 0:8918a71cdbe9 283 #if (IPV4_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 284 //Notify IPv4 of link state changes
Sergunb 0:8918a71cdbe9 285 ipv4LinkChangeEvent(interface);
Sergunb 0:8918a71cdbe9 286 #endif
Sergunb 0:8918a71cdbe9 287
Sergunb 0:8918a71cdbe9 288 #if (IPV6_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 289 //Notify IPv6 of link state changes
Sergunb 0:8918a71cdbe9 290 ipv6LinkChangeEvent(interface);
Sergunb 0:8918a71cdbe9 291 #endif
Sergunb 0:8918a71cdbe9 292
Sergunb 0:8918a71cdbe9 293 #if (DNS_CLIENT_SUPPORT == ENABLED || MDNS_CLIENT_SUPPORT == ENABLED || \
Sergunb 0:8918a71cdbe9 294 NBNS_CLIENT_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 295 //Flush DNS cache
Sergunb 0:8918a71cdbe9 296 dnsFlushCache(interface);
Sergunb 0:8918a71cdbe9 297 #endif
Sergunb 0:8918a71cdbe9 298
Sergunb 0:8918a71cdbe9 299 #if (MDNS_RESPONDER_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 300 //Perform probing and announcing
Sergunb 0:8918a71cdbe9 301 mdnsResponderLinkChangeEvent(interface->mdnsResponderContext);
Sergunb 0:8918a71cdbe9 302 #endif
Sergunb 0:8918a71cdbe9 303
Sergunb 0:8918a71cdbe9 304 #if (DNS_SD_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 305 //Perform probing and announcing
Sergunb 0:8918a71cdbe9 306 dnsSdLinkChangeEvent(interface->dnsSdContext);
Sergunb 0:8918a71cdbe9 307 #endif
Sergunb 0:8918a71cdbe9 308
Sergunb 0:8918a71cdbe9 309 //Notify registered users of link state changes
Sergunb 0:8918a71cdbe9 310 netInvokeLinkChangeCallback(interface, interface->linkState);
Sergunb 0:8918a71cdbe9 311
Sergunb 0:8918a71cdbe9 312 //Loop through opened sockets
Sergunb 0:8918a71cdbe9 313 for(i = 0; i < SOCKET_MAX_COUNT; i++)
Sergunb 0:8918a71cdbe9 314 {
Sergunb 0:8918a71cdbe9 315 //Point to the current socket
Sergunb 0:8918a71cdbe9 316 socket = socketTable + i;
Sergunb 0:8918a71cdbe9 317
Sergunb 0:8918a71cdbe9 318 #if (TCP_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 319 //Connection-oriented socket?
Sergunb 0:8918a71cdbe9 320 if(socket->type == SOCKET_TYPE_STREAM)
Sergunb 0:8918a71cdbe9 321 {
Sergunb 0:8918a71cdbe9 322 tcpUpdateEvents(socket);
Sergunb 0:8918a71cdbe9 323 }
Sergunb 0:8918a71cdbe9 324 #endif
Sergunb 0:8918a71cdbe9 325 #if (UDP_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 326 //Connectionless socket?
Sergunb 0:8918a71cdbe9 327 if(socket->type == SOCKET_TYPE_DGRAM)
Sergunb 0:8918a71cdbe9 328 {
Sergunb 0:8918a71cdbe9 329 udpUpdateEvents(socket);
Sergunb 0:8918a71cdbe9 330 }
Sergunb 0:8918a71cdbe9 331 #endif
Sergunb 0:8918a71cdbe9 332 #if (RAW_SOCKET_SUPPORT == ENABLED)
Sergunb 0:8918a71cdbe9 333 //Raw socket?
Sergunb 0:8918a71cdbe9 334 if(socket->type == SOCKET_TYPE_RAW_IP ||
Sergunb 0:8918a71cdbe9 335 socket->type == SOCKET_TYPE_RAW_ETH)
Sergunb 0:8918a71cdbe9 336 {
Sergunb 0:8918a71cdbe9 337 rawSocketUpdateEvents(socket);
Sergunb 0:8918a71cdbe9 338 }
Sergunb 0:8918a71cdbe9 339 #endif
Sergunb 0:8918a71cdbe9 340 }
Sergunb 0:8918a71cdbe9 341
Sergunb 0:8918a71cdbe9 342 //Disable interrupts
Sergunb 0:8918a71cdbe9 343 interface->nicDriver->disableIrq(interface);
Sergunb 0:8918a71cdbe9 344 }
Sergunb 0:8918a71cdbe9 345