KEIS

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
mbed_official
Date:
Fri Jun 22 09:25:39 2012 +0000
Revision:
0:51ac1d130fd4
Initial import from lwip-1.4.0: http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:51ac1d130fd4 1 /**
mbed_official 0:51ac1d130fd4 2 * @file
mbed_official 0:51ac1d130fd4 3 * Ethernet Interface Skeleton
mbed_official 0:51ac1d130fd4 4 *
mbed_official 0:51ac1d130fd4 5 */
mbed_official 0:51ac1d130fd4 6
mbed_official 0:51ac1d130fd4 7 /*
mbed_official 0:51ac1d130fd4 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbed_official 0:51ac1d130fd4 9 * All rights reserved.
mbed_official 0:51ac1d130fd4 10 *
mbed_official 0:51ac1d130fd4 11 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 0:51ac1d130fd4 12 * are permitted provided that the following conditions are met:
mbed_official 0:51ac1d130fd4 13 *
mbed_official 0:51ac1d130fd4 14 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 0:51ac1d130fd4 15 * this list of conditions and the following disclaimer.
mbed_official 0:51ac1d130fd4 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 0:51ac1d130fd4 17 * this list of conditions and the following disclaimer in the documentation
mbed_official 0:51ac1d130fd4 18 * and/or other materials provided with the distribution.
mbed_official 0:51ac1d130fd4 19 * 3. The name of the author may not be used to endorse or promote products
mbed_official 0:51ac1d130fd4 20 * derived from this software without specific prior written permission.
mbed_official 0:51ac1d130fd4 21 *
mbed_official 0:51ac1d130fd4 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbed_official 0:51ac1d130fd4 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbed_official 0:51ac1d130fd4 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbed_official 0:51ac1d130fd4 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbed_official 0:51ac1d130fd4 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbed_official 0:51ac1d130fd4 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 0:51ac1d130fd4 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 0:51ac1d130fd4 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbed_official 0:51ac1d130fd4 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbed_official 0:51ac1d130fd4 31 * OF SUCH DAMAGE.
mbed_official 0:51ac1d130fd4 32 *
mbed_official 0:51ac1d130fd4 33 * This file is part of the lwIP TCP/IP stack.
mbed_official 0:51ac1d130fd4 34 *
mbed_official 0:51ac1d130fd4 35 * Author: Adam Dunkels <adam@sics.se>
mbed_official 0:51ac1d130fd4 36 *
mbed_official 0:51ac1d130fd4 37 */
mbed_official 0:51ac1d130fd4 38
mbed_official 0:51ac1d130fd4 39 /*
mbed_official 0:51ac1d130fd4 40 * This file is a skeleton for developing Ethernet network interface
mbed_official 0:51ac1d130fd4 41 * drivers for lwIP. Add code to the low_level functions and do a
mbed_official 0:51ac1d130fd4 42 * search-and-replace for the word "ethernetif" to replace it with
mbed_official 0:51ac1d130fd4 43 * something that better describes your network interface.
mbed_official 0:51ac1d130fd4 44 */
mbed_official 0:51ac1d130fd4 45
mbed_official 0:51ac1d130fd4 46 #include "lwip/opt.h"
mbed_official 0:51ac1d130fd4 47
mbed_official 0:51ac1d130fd4 48 #if 0 /* don't build, this is only a skeleton, see previous comment */
mbed_official 0:51ac1d130fd4 49
mbed_official 0:51ac1d130fd4 50 #include "lwip/def.h"
mbed_official 0:51ac1d130fd4 51 #include "lwip/mem.h"
mbed_official 0:51ac1d130fd4 52 #include "lwip/pbuf.h"
mbed_official 0:51ac1d130fd4 53 #include "lwip/sys.h"
mbed_official 0:51ac1d130fd4 54 #include <lwip/stats.h>
mbed_official 0:51ac1d130fd4 55 #include <lwip/snmp.h>
mbed_official 0:51ac1d130fd4 56 #include "netif/etharp.h"
mbed_official 0:51ac1d130fd4 57 #include "netif/ppp_oe.h"
mbed_official 0:51ac1d130fd4 58
mbed_official 0:51ac1d130fd4 59 /* Define those to better describe your network interface. */
mbed_official 0:51ac1d130fd4 60 #define IFNAME0 'e'
mbed_official 0:51ac1d130fd4 61 #define IFNAME1 'n'
mbed_official 0:51ac1d130fd4 62
mbed_official 0:51ac1d130fd4 63 /**
mbed_official 0:51ac1d130fd4 64 * Helper struct to hold private data used to operate your ethernet interface.
mbed_official 0:51ac1d130fd4 65 * Keeping the ethernet address of the MAC in this struct is not necessary
mbed_official 0:51ac1d130fd4 66 * as it is already kept in the struct netif.
mbed_official 0:51ac1d130fd4 67 * But this is only an example, anyway...
mbed_official 0:51ac1d130fd4 68 */
mbed_official 0:51ac1d130fd4 69 struct ethernetif {
mbed_official 0:51ac1d130fd4 70 struct eth_addr *ethaddr;
mbed_official 0:51ac1d130fd4 71 /* Add whatever per-interface state that is needed here. */
mbed_official 0:51ac1d130fd4 72 };
mbed_official 0:51ac1d130fd4 73
mbed_official 0:51ac1d130fd4 74 /* Forward declarations. */
mbed_official 0:51ac1d130fd4 75 static void ethernetif_input(struct netif *netif);
mbed_official 0:51ac1d130fd4 76
mbed_official 0:51ac1d130fd4 77 /**
mbed_official 0:51ac1d130fd4 78 * In this function, the hardware should be initialized.
mbed_official 0:51ac1d130fd4 79 * Called from ethernetif_init().
mbed_official 0:51ac1d130fd4 80 *
mbed_official 0:51ac1d130fd4 81 * @param netif the already initialized lwip network interface structure
mbed_official 0:51ac1d130fd4 82 * for this ethernetif
mbed_official 0:51ac1d130fd4 83 */
mbed_official 0:51ac1d130fd4 84 static void
mbed_official 0:51ac1d130fd4 85 low_level_init(struct netif *netif)
mbed_official 0:51ac1d130fd4 86 {
mbed_official 0:51ac1d130fd4 87 struct ethernetif *ethernetif = netif->state;
mbed_official 0:51ac1d130fd4 88
mbed_official 0:51ac1d130fd4 89 /* set MAC hardware address length */
mbed_official 0:51ac1d130fd4 90 netif->hwaddr_len = ETHARP_HWADDR_LEN;
mbed_official 0:51ac1d130fd4 91
mbed_official 0:51ac1d130fd4 92 /* set MAC hardware address */
mbed_official 0:51ac1d130fd4 93 netif->hwaddr[0] = ;
mbed_official 0:51ac1d130fd4 94 ...
mbed_official 0:51ac1d130fd4 95 netif->hwaddr[5] = ;
mbed_official 0:51ac1d130fd4 96
mbed_official 0:51ac1d130fd4 97 /* maximum transfer unit */
mbed_official 0:51ac1d130fd4 98 netif->mtu = 1500;
mbed_official 0:51ac1d130fd4 99
mbed_official 0:51ac1d130fd4 100 /* device capabilities */
mbed_official 0:51ac1d130fd4 101 /* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
mbed_official 0:51ac1d130fd4 102 netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
mbed_official 0:51ac1d130fd4 103
mbed_official 0:51ac1d130fd4 104 /* Do whatever else is needed to initialize interface. */
mbed_official 0:51ac1d130fd4 105 }
mbed_official 0:51ac1d130fd4 106
mbed_official 0:51ac1d130fd4 107 /**
mbed_official 0:51ac1d130fd4 108 * This function should do the actual transmission of the packet. The packet is
mbed_official 0:51ac1d130fd4 109 * contained in the pbuf that is passed to the function. This pbuf
mbed_official 0:51ac1d130fd4 110 * might be chained.
mbed_official 0:51ac1d130fd4 111 *
mbed_official 0:51ac1d130fd4 112 * @param netif the lwip network interface structure for this ethernetif
mbed_official 0:51ac1d130fd4 113 * @param p the MAC packet to send (e.g. IP packet including MAC addresses and type)
mbed_official 0:51ac1d130fd4 114 * @return ERR_OK if the packet could be sent
mbed_official 0:51ac1d130fd4 115 * an err_t value if the packet couldn't be sent
mbed_official 0:51ac1d130fd4 116 *
mbed_official 0:51ac1d130fd4 117 * @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to
mbed_official 0:51ac1d130fd4 118 * strange results. You might consider waiting for space in the DMA queue
mbed_official 0:51ac1d130fd4 119 * to become availale since the stack doesn't retry to send a packet
mbed_official 0:51ac1d130fd4 120 * dropped because of memory failure (except for the TCP timers).
mbed_official 0:51ac1d130fd4 121 */
mbed_official 0:51ac1d130fd4 122
mbed_official 0:51ac1d130fd4 123 static err_t
mbed_official 0:51ac1d130fd4 124 low_level_output(struct netif *netif, struct pbuf *p)
mbed_official 0:51ac1d130fd4 125 {
mbed_official 0:51ac1d130fd4 126 struct ethernetif *ethernetif = netif->state;
mbed_official 0:51ac1d130fd4 127 struct pbuf *q;
mbed_official 0:51ac1d130fd4 128
mbed_official 0:51ac1d130fd4 129 initiate transfer();
mbed_official 0:51ac1d130fd4 130
mbed_official 0:51ac1d130fd4 131 #if ETH_PAD_SIZE
mbed_official 0:51ac1d130fd4 132 pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
mbed_official 0:51ac1d130fd4 133 #endif
mbed_official 0:51ac1d130fd4 134
mbed_official 0:51ac1d130fd4 135 for(q = p; q != NULL; q = q->next) {
mbed_official 0:51ac1d130fd4 136 /* Send the data from the pbuf to the interface, one pbuf at a
mbed_official 0:51ac1d130fd4 137 time. The size of the data in each pbuf is kept in the ->len
mbed_official 0:51ac1d130fd4 138 variable. */
mbed_official 0:51ac1d130fd4 139 send data from(q->payload, q->len);
mbed_official 0:51ac1d130fd4 140 }
mbed_official 0:51ac1d130fd4 141
mbed_official 0:51ac1d130fd4 142 signal that packet should be sent();
mbed_official 0:51ac1d130fd4 143
mbed_official 0:51ac1d130fd4 144 #if ETH_PAD_SIZE
mbed_official 0:51ac1d130fd4 145 pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
mbed_official 0:51ac1d130fd4 146 #endif
mbed_official 0:51ac1d130fd4 147
mbed_official 0:51ac1d130fd4 148 LINK_STATS_INC(link.xmit);
mbed_official 0:51ac1d130fd4 149
mbed_official 0:51ac1d130fd4 150 return ERR_OK;
mbed_official 0:51ac1d130fd4 151 }
mbed_official 0:51ac1d130fd4 152
mbed_official 0:51ac1d130fd4 153 /**
mbed_official 0:51ac1d130fd4 154 * Should allocate a pbuf and transfer the bytes of the incoming
mbed_official 0:51ac1d130fd4 155 * packet from the interface into the pbuf.
mbed_official 0:51ac1d130fd4 156 *
mbed_official 0:51ac1d130fd4 157 * @param netif the lwip network interface structure for this ethernetif
mbed_official 0:51ac1d130fd4 158 * @return a pbuf filled with the received packet (including MAC header)
mbed_official 0:51ac1d130fd4 159 * NULL on memory error
mbed_official 0:51ac1d130fd4 160 */
mbed_official 0:51ac1d130fd4 161 static struct pbuf *
mbed_official 0:51ac1d130fd4 162 low_level_input(struct netif *netif)
mbed_official 0:51ac1d130fd4 163 {
mbed_official 0:51ac1d130fd4 164 struct ethernetif *ethernetif = netif->state;
mbed_official 0:51ac1d130fd4 165 struct pbuf *p, *q;
mbed_official 0:51ac1d130fd4 166 u16_t len;
mbed_official 0:51ac1d130fd4 167
mbed_official 0:51ac1d130fd4 168 /* Obtain the size of the packet and put it into the "len"
mbed_official 0:51ac1d130fd4 169 variable. */
mbed_official 0:51ac1d130fd4 170 len = ;
mbed_official 0:51ac1d130fd4 171
mbed_official 0:51ac1d130fd4 172 #if ETH_PAD_SIZE
mbed_official 0:51ac1d130fd4 173 len += ETH_PAD_SIZE; /* allow room for Ethernet padding */
mbed_official 0:51ac1d130fd4 174 #endif
mbed_official 0:51ac1d130fd4 175
mbed_official 0:51ac1d130fd4 176 /* We allocate a pbuf chain of pbufs from the pool. */
mbed_official 0:51ac1d130fd4 177 p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
mbed_official 0:51ac1d130fd4 178
mbed_official 0:51ac1d130fd4 179 if (p != NULL) {
mbed_official 0:51ac1d130fd4 180
mbed_official 0:51ac1d130fd4 181 #if ETH_PAD_SIZE
mbed_official 0:51ac1d130fd4 182 pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
mbed_official 0:51ac1d130fd4 183 #endif
mbed_official 0:51ac1d130fd4 184
mbed_official 0:51ac1d130fd4 185 /* We iterate over the pbuf chain until we have read the entire
mbed_official 0:51ac1d130fd4 186 * packet into the pbuf. */
mbed_official 0:51ac1d130fd4 187 for(q = p; q != NULL; q = q->next) {
mbed_official 0:51ac1d130fd4 188 /* Read enough bytes to fill this pbuf in the chain. The
mbed_official 0:51ac1d130fd4 189 * available data in the pbuf is given by the q->len
mbed_official 0:51ac1d130fd4 190 * variable.
mbed_official 0:51ac1d130fd4 191 * This does not necessarily have to be a memcpy, you can also preallocate
mbed_official 0:51ac1d130fd4 192 * pbufs for a DMA-enabled MAC and after receiving truncate it to the
mbed_official 0:51ac1d130fd4 193 * actually received size. In this case, ensure the tot_len member of the
mbed_official 0:51ac1d130fd4 194 * pbuf is the sum of the chained pbuf len members.
mbed_official 0:51ac1d130fd4 195 */
mbed_official 0:51ac1d130fd4 196 read data into(q->payload, q->len);
mbed_official 0:51ac1d130fd4 197 }
mbed_official 0:51ac1d130fd4 198 acknowledge that packet has been read();
mbed_official 0:51ac1d130fd4 199
mbed_official 0:51ac1d130fd4 200 #if ETH_PAD_SIZE
mbed_official 0:51ac1d130fd4 201 pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
mbed_official 0:51ac1d130fd4 202 #endif
mbed_official 0:51ac1d130fd4 203
mbed_official 0:51ac1d130fd4 204 LINK_STATS_INC(link.recv);
mbed_official 0:51ac1d130fd4 205 } else {
mbed_official 0:51ac1d130fd4 206 drop packet();
mbed_official 0:51ac1d130fd4 207 LINK_STATS_INC(link.memerr);
mbed_official 0:51ac1d130fd4 208 LINK_STATS_INC(link.drop);
mbed_official 0:51ac1d130fd4 209 }
mbed_official 0:51ac1d130fd4 210
mbed_official 0:51ac1d130fd4 211 return p;
mbed_official 0:51ac1d130fd4 212 }
mbed_official 0:51ac1d130fd4 213
mbed_official 0:51ac1d130fd4 214 /**
mbed_official 0:51ac1d130fd4 215 * This function should be called when a packet is ready to be read
mbed_official 0:51ac1d130fd4 216 * from the interface. It uses the function low_level_input() that
mbed_official 0:51ac1d130fd4 217 * should handle the actual reception of bytes from the network
mbed_official 0:51ac1d130fd4 218 * interface. Then the type of the received packet is determined and
mbed_official 0:51ac1d130fd4 219 * the appropriate input function is called.
mbed_official 0:51ac1d130fd4 220 *
mbed_official 0:51ac1d130fd4 221 * @param netif the lwip network interface structure for this ethernetif
mbed_official 0:51ac1d130fd4 222 */
mbed_official 0:51ac1d130fd4 223 static void
mbed_official 0:51ac1d130fd4 224 ethernetif_input(struct netif *netif)
mbed_official 0:51ac1d130fd4 225 {
mbed_official 0:51ac1d130fd4 226 struct ethernetif *ethernetif;
mbed_official 0:51ac1d130fd4 227 struct eth_hdr *ethhdr;
mbed_official 0:51ac1d130fd4 228 struct pbuf *p;
mbed_official 0:51ac1d130fd4 229
mbed_official 0:51ac1d130fd4 230 ethernetif = netif->state;
mbed_official 0:51ac1d130fd4 231
mbed_official 0:51ac1d130fd4 232 /* move received packet into a new pbuf */
mbed_official 0:51ac1d130fd4 233 p = low_level_input(netif);
mbed_official 0:51ac1d130fd4 234 /* no packet could be read, silently ignore this */
mbed_official 0:51ac1d130fd4 235 if (p == NULL) return;
mbed_official 0:51ac1d130fd4 236 /* points to packet payload, which starts with an Ethernet header */
mbed_official 0:51ac1d130fd4 237 ethhdr = p->payload;
mbed_official 0:51ac1d130fd4 238
mbed_official 0:51ac1d130fd4 239 switch (htons(ethhdr->type)) {
mbed_official 0:51ac1d130fd4 240 /* IP or ARP packet? */
mbed_official 0:51ac1d130fd4 241 case ETHTYPE_IP:
mbed_official 0:51ac1d130fd4 242 case ETHTYPE_ARP:
mbed_official 0:51ac1d130fd4 243 #if PPPOE_SUPPORT
mbed_official 0:51ac1d130fd4 244 /* PPPoE packet? */
mbed_official 0:51ac1d130fd4 245 case ETHTYPE_PPPOEDISC:
mbed_official 0:51ac1d130fd4 246 case ETHTYPE_PPPOE:
mbed_official 0:51ac1d130fd4 247 #endif /* PPPOE_SUPPORT */
mbed_official 0:51ac1d130fd4 248 /* full packet send to tcpip_thread to process */
mbed_official 0:51ac1d130fd4 249 if (netif->input(p, netif)!=ERR_OK)
mbed_official 0:51ac1d130fd4 250 { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n"));
mbed_official 0:51ac1d130fd4 251 pbuf_free(p);
mbed_official 0:51ac1d130fd4 252 p = NULL;
mbed_official 0:51ac1d130fd4 253 }
mbed_official 0:51ac1d130fd4 254 break;
mbed_official 0:51ac1d130fd4 255
mbed_official 0:51ac1d130fd4 256 default:
mbed_official 0:51ac1d130fd4 257 pbuf_free(p);
mbed_official 0:51ac1d130fd4 258 p = NULL;
mbed_official 0:51ac1d130fd4 259 break;
mbed_official 0:51ac1d130fd4 260 }
mbed_official 0:51ac1d130fd4 261 }
mbed_official 0:51ac1d130fd4 262
mbed_official 0:51ac1d130fd4 263 /**
mbed_official 0:51ac1d130fd4 264 * Should be called at the beginning of the program to set up the
mbed_official 0:51ac1d130fd4 265 * network interface. It calls the function low_level_init() to do the
mbed_official 0:51ac1d130fd4 266 * actual setup of the hardware.
mbed_official 0:51ac1d130fd4 267 *
mbed_official 0:51ac1d130fd4 268 * This function should be passed as a parameter to netif_add().
mbed_official 0:51ac1d130fd4 269 *
mbed_official 0:51ac1d130fd4 270 * @param netif the lwip network interface structure for this ethernetif
mbed_official 0:51ac1d130fd4 271 * @return ERR_OK if the loopif is initialized
mbed_official 0:51ac1d130fd4 272 * ERR_MEM if private data couldn't be allocated
mbed_official 0:51ac1d130fd4 273 * any other err_t on error
mbed_official 0:51ac1d130fd4 274 */
mbed_official 0:51ac1d130fd4 275 err_t
mbed_official 0:51ac1d130fd4 276 ethernetif_init(struct netif *netif)
mbed_official 0:51ac1d130fd4 277 {
mbed_official 0:51ac1d130fd4 278 struct ethernetif *ethernetif;
mbed_official 0:51ac1d130fd4 279
mbed_official 0:51ac1d130fd4 280 LWIP_ASSERT("netif != NULL", (netif != NULL));
mbed_official 0:51ac1d130fd4 281
mbed_official 0:51ac1d130fd4 282 ethernetif = mem_malloc(sizeof(struct ethernetif));
mbed_official 0:51ac1d130fd4 283 if (ethernetif == NULL) {
mbed_official 0:51ac1d130fd4 284 LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
mbed_official 0:51ac1d130fd4 285 return ERR_MEM;
mbed_official 0:51ac1d130fd4 286 }
mbed_official 0:51ac1d130fd4 287
mbed_official 0:51ac1d130fd4 288 #if LWIP_NETIF_HOSTNAME
mbed_official 0:51ac1d130fd4 289 /* Initialize interface hostname */
mbed_official 0:51ac1d130fd4 290 netif->hostname = "lwip";
mbed_official 0:51ac1d130fd4 291 #endif /* LWIP_NETIF_HOSTNAME */
mbed_official 0:51ac1d130fd4 292
mbed_official 0:51ac1d130fd4 293 /*
mbed_official 0:51ac1d130fd4 294 * Initialize the snmp variables and counters inside the struct netif.
mbed_official 0:51ac1d130fd4 295 * The last argument should be replaced with your link speed, in units
mbed_official 0:51ac1d130fd4 296 * of bits per second.
mbed_official 0:51ac1d130fd4 297 */
mbed_official 0:51ac1d130fd4 298 NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, LINK_SPEED_OF_YOUR_NETIF_IN_BPS);
mbed_official 0:51ac1d130fd4 299
mbed_official 0:51ac1d130fd4 300 netif->state = ethernetif;
mbed_official 0:51ac1d130fd4 301 netif->name[0] = IFNAME0;
mbed_official 0:51ac1d130fd4 302 netif->name[1] = IFNAME1;
mbed_official 0:51ac1d130fd4 303 /* We directly use etharp_output() here to save a function call.
mbed_official 0:51ac1d130fd4 304 * You can instead declare your own function an call etharp_output()
mbed_official 0:51ac1d130fd4 305 * from it if you have to do some checks before sending (e.g. if link
mbed_official 0:51ac1d130fd4 306 * is available...) */
mbed_official 0:51ac1d130fd4 307 netif->output = etharp_output;
mbed_official 0:51ac1d130fd4 308 netif->linkoutput = low_level_output;
mbed_official 0:51ac1d130fd4 309
mbed_official 0:51ac1d130fd4 310 ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
mbed_official 0:51ac1d130fd4 311
mbed_official 0:51ac1d130fd4 312 /* initialize the hardware */
mbed_official 0:51ac1d130fd4 313 low_level_init(netif);
mbed_official 0:51ac1d130fd4 314
mbed_official 0:51ac1d130fd4 315 return ERR_OK;
mbed_official 0:51ac1d130fd4 316 }
mbed_official 0:51ac1d130fd4 317
mbed_official 0:51ac1d130fd4 318 #endif /* 0 */