aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-09-27 18:48:47 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-09-27 18:48:47 +0000
commitc9bfcaa15ec3d03ee088ecfa5cf6cf82e718cb38 (patch)
tree0bcfd6b978bb7004587ce6f70ad17ed95bda13b8 /demos/ARM7-AT91SAM7X-LWIP-GCC/lwip
parentee0d07151a144a8425d8cfd0740098d1b76711c2 (diff)
downloadChibiOS-c9bfcaa15ec3d03ee088ecfa5cf6cf82e718cb38.tar.gz
ChibiOS-c9bfcaa15ec3d03ee088ecfa5cf6cf82e718cb38.tar.bz2
ChibiOS-c9bfcaa15ec3d03ee088ecfa5cf6cf82e718cb38.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1192 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARM7-AT91SAM7X-LWIP-GCC/lwip')
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/netif/ethernetif.c130
1 files changed, 55 insertions, 75 deletions
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/netif/ethernetif.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/netif/ethernetif.c
index 5716f6e58..ccd7bd67f 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/netif/ethernetif.c
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/netif/ethernetif.c
@@ -1,55 +1,3 @@
-/*
- ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
-
- This file is part of ChibiOS/RT.
-
- ChibiOS/RT is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/RT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-/*
- **** This file incorporates work covered by the following copyright and ****
- **** permission notice: ****
-
- Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
- SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- OF SUCH DAMAGE.
-
- This file is part of the lwIP TCP/IP stack.
-
- Author: Adam Dunkels <adam@sics.se>
-*/
-
/**
* @file
* Ethernet Interface Skeleton
@@ -57,6 +5,38 @@
*/
/*
+ * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+ * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * This file is part of the lwIP TCP/IP stack.
+ *
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ */
+
+/*
* This file is a skeleton for developing Ethernet network interface
* drivers for lwIP. Add code to the low_level functions and do a
* search-and-replace for the word "ethernetif" to replace it with
@@ -65,7 +45,7 @@
#include "lwip/opt.h"
-#if 1 /* don't build, this is only a skeleton, see previous comment */
+#if 0 /* don't build, this is only a skeleton, see previous comment */
#include "lwip/def.h"
#include "lwip/mem.h"
@@ -105,23 +85,23 @@ static void
low_level_init(struct netif *netif)
{
struct ethernetif *ethernetif = netif->state;
-
+
/* set MAC hardware address length */
netif->hwaddr_len = ETHARP_HWADDR_LEN;
/* set MAC hardware address */
-////////// netif->hwaddr[0] = ;
-////////// ...
-////////// netif->hwaddr[5] = ;
+ netif->hwaddr[0] = ;
+ ...
+ netif->hwaddr[5] = ;
/* maximum transfer unit */
netif->mtu = 1500;
-
+
/* device capabilities */
/* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */
netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP;
-
- /* Do whatever else is needed to initialize interface. */
+
+ /* Do whatever else is needed to initialize interface. */
}
/**
@@ -146,8 +126,8 @@ low_level_output(struct netif *netif, struct pbuf *p)
struct ethernetif *ethernetif = netif->state;
struct pbuf *q;
-////////// initiate transfer();
-
+ initiate transfer();
+
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
@@ -156,15 +136,15 @@ low_level_output(struct netif *netif, struct pbuf *p)
/* Send the data from the pbuf to the interface, one pbuf at a
time. The size of the data in each pbuf is kept in the ->len
variable. */
-////////// send data from(q->payload, q->len);
+ send data from(q->payload, q->len);
}
-////////// signal that packet should be sent();
+ signal that packet should be sent();
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
#endif
-
+
LINK_STATS_INC(link.xmit);
return ERR_OK;
@@ -187,7 +167,7 @@ low_level_input(struct netif *netif)
/* Obtain the size of the packet and put it into the "len"
variable. */
-////////// len = ;
+ len = ;
#if ETH_PAD_SIZE
len += ETH_PAD_SIZE; /* allow room for Ethernet padding */
@@ -195,7 +175,7 @@ low_level_input(struct netif *netif)
/* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
-
+
if (p != NULL) {
#if ETH_PAD_SIZE
@@ -208,9 +188,9 @@ low_level_input(struct netif *netif)
/* Read enough bytes to fill this pbuf in the chain. The
* available data in the pbuf is given by the q->len
* variable. */
-////////// read data into(q->payload, q->len);
+ read data into(q->payload, q->len);
}
-////////// acknowledge that packet has been read();
+ acknowledge that packet has been read();
#if ETH_PAD_SIZE
pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */
@@ -218,12 +198,12 @@ low_level_input(struct netif *netif)
LINK_STATS_INC(link.recv);
} else {
-////////// drop packet();
+ drop packet();
LINK_STATS_INC(link.memerr);
LINK_STATS_INC(link.drop);
}
- return p;
+ return p;
}
/**
@@ -293,7 +273,7 @@ ethernetif_init(struct netif *netif)
struct ethernetif *ethernetif;
LWIP_ASSERT("netif != NULL", (netif != NULL));
-
+
ethernetif = mem_malloc(sizeof(struct ethernetif));
if (ethernetif == NULL) {
LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n"));
@@ -310,7 +290,7 @@ ethernetif_init(struct netif *netif)
* The last argument should be replaced with your link speed, in units
* of bits per second.
*/
- NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, ???);
+ NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, LINK_SPEED_OF_YOUR_NETIF_IN_BPS);
netif->state = ethernetif;
netif->name[0] = IFNAME0;
@@ -321,9 +301,9 @@ ethernetif_init(struct netif *netif)
* is available...) */
netif->output = etharp_output;
netif->linkoutput = low_level_output;
-
+
ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
-
+
/* initialize the hardware */
low_level_init(netif);