Small Testprogram to have WebAccess via Webserver to a 433Mhz tranmitter to control remotly some devices from remote, with TFTP, NTP and RMF. This could be a base to develop applications.

Dependencies:   ChaNFSSD TFTPServer RMFWeb

Dependents:   RMFWeb

Committer:
ED7418
Date:
Mon Jun 16 07:40:08 2014 +0000
Revision:
1:809b59c7a800
Parent:
0:51f1ef89ec7b
mbed-lib and other libs are a based on a project, published in a Elektor-book "ARM-microkontroller Part II".

Who changed what in which revision?

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