Add SLIP test configuration

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3371 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2011-03-12 16:33:55 +00:00
parent 1ead79b6d5
commit f0d143ee29
12 changed files with 1390 additions and 80 deletions
+3
View File
@@ -1550,3 +1550,6 @@
CONFIG_SCHED_ATEXIT. It your application is currently using atexit(), CONFIG_SCHED_ATEXIT. It your application is currently using atexit(),
you will need to add CONFIG_SCHED_ATEXT to your configuration file. you will need to add CONFIG_SCHED_ATEXT to your configuration file.
* drivers/net/slip.c - Add a SLIP driver (untested on initial check-in). * drivers/net/slip.c - Add a SLIP driver (untested on initial check-in).
* configs/olimex-lpc1766stk/slip-httpd - An example that uses SLIP to
provide a serial-port based THTTPD web server.
+14 -12
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
<p>Last Updated: March 11, 2011</p> <p>Last Updated: March 12, 2011</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -2122,16 +2122,16 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* NSH: Correct a redirection bug in NSH. The following would not work; it * NSH: Correct a redirection bug in NSH. The following would not work; it
resulted in a hang after the 'cat /dev/fifo': resulted in a hang after the 'cat /dev/fifo':
nsh> mkfile /dev/fifo nsh&gt; mkfile /dev/fifo
nsh> cd /tmp # /tmp is a mounted RAM disk nsh&gt; cd /tmp # /tmp is a mounted RAM disk
nsh> cat /dev/fifo > test.txt & nsh&gt; cat /dev/fifo &gt; test.txt &amp;
nsh> echo "This is a test" > /dev/fifo nsh&gt; echo &quot;This is a test&quot; &gt; /dev/fifo
The error was caused because (1) there was a path that resulted in stdout The error was caused because (1) there was a path that resulted in stdout
being closed (the "hang") and also (2) the 'cat' command was always outputting being closed (the &quot;hang&quot;) and also (2) the 'cat' command was always outputting
to stdout, not to the redirected file descriptor. Now: to stdout, not to the redirected file descriptor. Now:
nsh> cat test.txt nsh&gt; cat test.txt
This is a test This is a test
* drivers/pipes/pipe_common.c -- Driver open method eas not returning an EINTR * drivers/pipes/pipe_common.c -- Driver open method eas not returning an EINTR
@@ -2144,7 +2144,7 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
occurs. occurs.
* configs/olimex-lpc1766stk -- Added an LED encoded to indicate if the LPC1766 * configs/olimex-lpc1766stk -- Added an LED encoded to indicate if the LPC1766
is in sleeping. is in sleeping.
* examples/mm -- This is a simplified version of the "built-in" memory manager * examples/mm -- This is a simplified version of the &quot;built-in&quot; memory manager
test of mm/mm_test.c. It is simplified because it does not have access to test of mm/mm_test.c. It is simplified because it does not have access to
the internals of the memory manager as does mm/mm_test.c, but it has the the internals of the memory manager as does mm/mm_test.c, but it has the
advantage that it runs in the actual NuttX tasking environment (the advantage that it runs in the actual NuttX tasking environment (the
@@ -2153,7 +2153,7 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* arch/x86 - Provide support for x86 architectures. Support for the i486 * arch/x86 - Provide support for x86 architectures. Support for the i486
architecture under QEMU is provided under arch/x86/include/i486, architecture under QEMU is provided under arch/x86/include/i486,
arch/x86/include/qemu, arch/x86/src/i486, and arch/x86/src/qemu. arch/x86/include/qemu, arch/x86/src/i486, and arch/x86/src/qemu.
* configs/qemu-i486 - "Board" support configurations for verifying the QEME * configs/qemu-i486 - &quot;Board&quot; support configurations for verifying the QEME
i486 port. i486 port.
* arch/arm/src/stm32/stm32_spi.c -- Correct base address of SPI3 (reported by * arch/arm/src/stm32/stm32_spi.c -- Correct base address of SPI3 (reported by
Uros Platise). Uros Platise).
@@ -2181,15 +2181,17 @@ nuttx-5.19 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
CONFIG_SCHED_ATEXIT. It your application is currently using atexit(), CONFIG_SCHED_ATEXIT. It your application is currently using atexit(),
you will need to add CONFIG_SCHED_ATEXT to your configuration file. you will need to add CONFIG_SCHED_ATEXT to your configuration file.
* drivers/net/slip.c - Add a SLIP driver (untested on initial check-in). * drivers/net/slip.c - Add a SLIP driver (untested on initial check-in).
* configs/olimex-lpc1766stk/slip-httpd - An example that uses SLIP to
provide a serial-port based THTTPD web server.
pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-2.1 2011-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr> buildroot-1.10 2011-xx-xx &lt;spudmonkey@racsa.co.cr&gt;
* Add patch submitted by Dimiter Georgiev to work around problems in building * Add patch submitted by Dimiter Georgiev to work around problems in building
GDB 6.8 with versions of Cygwin > 1.7. GDB 6.8 with versions of Cygwin &gt; 1.7.
* configs/i486-defconfig-4.3.3 - Builds an i486 cross development toolchain * configs/i486-defconfig-4.3.3 - Builds an i486 cross development toolchain
using gcc 4.3.3. Why wouldyou want such a thing? On Linux, of course, using gcc 4.3.3. Why would you want such a thing? On Linux, of course,
such a thing is not needed because you can use the installed GCC to build such a thing is not needed because you can use the installed GCC to build
i486 ELF binaries. But that will not work under Cygwin! The Cygwin i486 ELF binaries. But that will not work under Cygwin! The Cygwin
toolchain (and probably MinGW), build DOS MZ format executables (i.e., toolchain (and probably MinGW), build DOS MZ format executables (i.e.,
+6
View File
@@ -800,6 +800,12 @@ Where <subdir> is one of the following:
This configuration directory, performs a simple OS test using This configuration directory, performs a simple OS test using
examples/ostest. examples/ostest.
slip-httpd:
This configuration is identical to the thttpd configuration except that
it uses the SLIP data link layer via a serial driver instead of the
Ethernet data link layer. The Ethernet driver is disabled; SLIP IP
packets are exchanged on UART1; UART0 is still the serial console.
thttpd: thttpd:
This builds the THTTPD web server example using the THTTPD and This builds the THTTPD web server example using the THTTPD and
the examples/thttpd application. the examples/thttpd application.
+165
View File
@@ -0,0 +1,165 @@
############################################################################
# configs/olimex-lpc1766stk/slip-httpd/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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
# COPYRIGHT OWNER OR CONTRIBUTORS 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.
#
############################################################################
include ${TOPDIR}/.config
# Setup for the selected toolchain
ifeq ($(CONFIG_LPC17_CODESOURCERYW),y)
# CodeSourcery under Windows
CROSSDEV = arm-none-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_LPC17_CODESOURCERYL),y)
# CodeSourcery under Linux
CROSSDEV = arm-none-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
MAXOPTIMIZATION = -O2
endif
ifeq ($(CONFIG_LPC17_DEVKITARM),y)
# devkitARM under Windows
CROSSDEV = arm-eabi-
WINTOOL = y
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
ifeq ($(CONFIG_LPC17_BUILDROOT),y)
# NuttX buildroot under Linux or Cygwin
CROSSDEV = arm-elf-
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
MAXOPTIMIZATION = -Os
endif
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/winlink.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/slip-httpd/ld.script}"
MAXOPTIMIZATION = -O2
else
# Linux/Cygwin-native toolchain
MKDEP = $(TOPDIR)/tools/mkdeps.sh
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/slip-httpd/ld.script
endif
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
MKNXFLAT = mknxflat
LDNXFLAT = ldnxflat
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
ifeq ("${CONFIG_DEBUG_SYMBOLS}","y")
ARCHOPTIMIZATION = -g
else
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
ARCHWARNINGSXX = -Wall -Wshadow
ARCHDEFINES =
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
OBJEXT = .o
LIBEXT = .a
EXEEXT =
ifneq ($(CROSSDEV),arm-elf-)
LDFLAGS += -nostartfiles -nodefaultlibs
endif
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
LDFLAGS += -g
endif
define PREPROCESS
@echo "CPP: $1->$2"
@$(CPP) $(CPPFLAGS) $1 -o $2
endef
define COMPILE
@echo "CC: $1"
@$(CC) -c $(CFLAGS) $1 -o $2
endef
define COMPILEXX
@echo "CXX: $1"
@$(CXX) -c $(CXXFLAGS) $1 -o $2
endef
define ASSEMBLE
@echo "AS: $1"
@$(CC) -c $(AFLAGS) $1 -o $2
endef
define ARCHIVE
echo "AR: $2"; \
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
endef
define CLEAN
@rm -f *.o *.a
endef
HOSTCC = gcc
HOSTINCLUDES = -I.
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
HOSTLDFLAGS =
File diff suppressed because it is too large Load Diff
+109
View File
@@ -0,0 +1,109 @@
/****************************************************************************
* configs/olimex-lpc1766stk/slip-httpd/ld.script
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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
* COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
****************************************************************************/
/* The LPC1766 has 256Kb of FLASH beginning at address 0x0000:0000 and
* 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address
* 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses
* 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit
* into the 32Kb CPU SRAM address range.
*/
MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 256K
sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
}
OUTPUT_ARCH(arm)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.); /* See below */
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
_edata = ABSOLUTE(.);
} > sram AT > flash
.ARM.extab : {
*(.ARM.extab*)
} >sram
.ARM.exidx : {
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} >sram
.bss : { /* BSS */
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
# configs/olimex-lpc1766stk/slip-httpd/setenv.sh
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# 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. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "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
# COPYRIGHT OWNER OR CONTRIBUTORS 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.
#
if [ "$(basename $0)" = "setenv.sh" ] ; then
echo "You must source this script, not run it!" 1>&2
exit 1
fi
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
WD=`pwd`
export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools"
export BUILDROOT_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
export PATH="${BUILDROOT_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
echo "PATH : ${PATH}"
+18 -44
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* drivers/net/slip.c * drivers/net/slip.c
* *
* Copyright (C) 2010 Gregory Nutt. All rights reserved. * Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Reference: RFC 1055 * Reference: RFC 1055
@@ -60,7 +60,6 @@
#include <nuttx/net.h> #include <nuttx/net.h>
#include <net/uip/uip.h> #include <net/uip/uip.h>
#include <net/uip/uip-arp.h>
#include <net/uip/uip-arch.h> #include <net/uip/uip-arch.h>
#if defined(CONFIG_NET) && defined(CONFIG_NET_SLIP) #if defined(CONFIG_NET) && defined(CONFIG_NET_SLIP)
@@ -117,10 +116,6 @@
# define SLIP_STAT(p,f) # define SLIP_STAT(p,f)
#endif #endif
/* This is a helper pointer for accessing the contents of the Ethernet header */
#define BUF ((struct uip_eth_hdr *)priv->dev.d_buf)
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@@ -131,10 +126,7 @@
struct slip_statistics_s struct slip_statistics_s
{ {
uint32_t transmitted; /* Number of packets transmitted */ uint32_t transmitted; /* Number of packets transmitted */
/* Number of packets received is the sum of: */ uint32_t received /* Number of packets received */
uint32_t rxip; /* Number of IP packets received */
uint32_t rxarp; /* + Number of ARP packets received */
uint32_t rxproto; /* + Number of unsupported packets received */
}; };
#endif #endif
@@ -185,11 +177,11 @@ static inline void slip_putc(FAR struct slip_driver_s *priv, int ch);
static int slip_transmit(FAR struct slip_driver_s *priv); static int slip_transmit(FAR struct slip_driver_s *priv);
static int slip_uiptxpoll(struct uip_driver_s *dev); static int slip_uiptxpoll(struct uip_driver_s *dev);
/* Interrupt handling */ /* Packet receiver task */
static inline int slip_getc(FAR struct slip_driver_s *priv); static inline int slip_getc(FAR struct slip_driver_s *priv);
static inline void slip_readpacket(FAR struct slip_driver_s *priv); static inline void slip_readpacket(FAR struct slip_driver_s *priv);
static void slip_receive(FAR struct slip_driver_s *priv); static inline void slip_receive(FAR struct slip_driver_s *priv);
static int slip_rxtask(int argc, char *argv[]); static int slip_rxtask(int argc, char *argv[]);
/* Watchdog timer expirations */ /* Watchdog timer expirations */
@@ -306,6 +298,7 @@ static int slip_transmit(FAR struct slip_driver_s *priv)
/* Increment statistics */ /* Increment statistics */
nvdbg("Sending packet size %d\n", priv->dev.d_len);
SLIP_STAT(priv, transmitted); SLIP_STAT(priv, transmitted);
/* Send an initial END character to flush out any data that may have /* Send an initial END character to flush out any data that may have
@@ -423,7 +416,6 @@ static int slip_uiptxpoll(struct uip_driver_s *dev)
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{ {
uip_arp_out(&priv->dev);
slip_transmit(priv); slip_transmit(priv);
} }
@@ -479,6 +471,7 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
* packet if we run out of room. * packet if we run out of room.
*/ */
nvdbg("Receiving packet\n");
for (;;) for (;;)
{ {
/* Get the next character in the stream */ /* Get the next character in the stream */
@@ -494,6 +487,8 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
*/ */
case SLIP_END: case SLIP_END:
nvdbg("END\n");
/* a minor optimization: if there is no data in the packet, ignore /* a minor optimization: if there is no data in the packet, ignore
* it. This is meant to avoid bothering IP with all the empty * it. This is meant to avoid bothering IP with all the empty
* packets generated by the duplicate END characters which are in * packets generated by the duplicate END characters which are in
@@ -502,6 +497,7 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
if (nbytes > 0) if (nbytes > 0)
{ {
nvdbg("Received packet size %d\n", nbytes);
priv->dev.d_len = nbytes; priv->dev.d_len = nbytes;
return; return;
} }
@@ -513,6 +509,7 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
*/ */
case SLIP_ESC: case SLIP_ESC:
nvdbg("ESC\n");
ch = slip_getc(priv); ch = slip_getc(priv);
/* if "ch" is not one of these two, then we have a protocol /* if "ch" is not one of these two, then we have a protocol
@@ -523,8 +520,10 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
switch (ch) switch (ch)
{ {
case SLIP_ESC_END: case SLIP_ESC_END:
nvdbg("ESC-END\n");
ch = SLIP_END; ch = SLIP_END;
break; break;
nvdbg("ESC-ESC\n");
case SLIP_ESC_ESC: case SLIP_ESC_ESC:
ch = SLIP_ESC; ch = SLIP_ESC;
break; break;
@@ -564,24 +563,19 @@ static inline void slip_readpacket(FAR struct slip_driver_s *priv)
* *
****************************************************************************/ ****************************************************************************/
static void slip_receive(FAR struct slip_driver_s *priv) static inline void slip_receive(FAR struct slip_driver_s *priv)
{ {
/* Copy the data data from the hardware to priv->dev.d_buf until we put /* Copy the data data from the hardware to priv->dev.d_buf until we put
* together a whole packet. * together a whole packet.
*/ */
slip_readpacket(priv); slip_readpacket(priv);
SLIP_STAT(priv, received);
/* We only accept IP packets of the configured type and ARP packets */ /* All packets are assumed to be IP packets (we don't have a choice.. there
* is no Ethernet header containing the EtherType)
*/
#ifdef CONFIG_NET_IPv6
if (BUF->type == HTONS(UIP_ETHTYPE_IP6))
#else
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
#endif
{
SLIP_STAT(priv, rxip);
uip_arp_ipin(&priv->dev);
uip_input(&priv->dev); uip_input(&priv->dev);
/* If the above function invocation resulted in data that should be /* If the above function invocation resulted in data that should be
@@ -590,28 +584,8 @@ static void slip_receive(FAR struct slip_driver_s *priv)
if (priv->dev.d_len > 0) if (priv->dev.d_len > 0)
{ {
uip_arp_out(&priv->dev);
slip_transmit(priv); slip_transmit(priv);
} }
}
else if (BUF->type == htons(UIP_ETHTYPE_ARP))
{
SLIP_STAT(priv, rxarp);
uip_arp_arpin(&priv->dev);
/* If the above function invocation resulted in data that should be
* sent out on the network, the field d_len will set to a value > 0.
*/
if (priv->dev.d_len > 0)
{
slip_transmit(priv);
}
}
else
{
SLIP_STAT(priv, rxproto);
}
} }
/**************************************************************************** /****************************************************************************
@@ -912,7 +886,7 @@ int slip_initialize(int intf, const char *devname)
/* Get the interface structure associated with this interface number. */ /* Get the interface structure associated with this interface number. */
DEBUGASSERT(inf < CONFIG_SLIP_NINTERFACES); DEBUGASSERT(intf < CONFIG_SLIP_NINTERFACES);
priv = &g_slip[intf]; priv = &g_slip[intf];
/* Initialize the driver structure */ /* Initialize the driver structure */
+5 -2
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/thttpd/netstat/netstat.c * examples/thttpd/netstat/netstat.c
* *
* Copyright (C) 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include <unistd.h> #include <unistd.h>
#include <netinet/ether.h> #include <netinet/ether.h>
#include <net/uip/uipopt.h>
#include <net/uip/uip-arch.h> #include <net/uip/uip-arch.h>
/**************************************************************************** /****************************************************************************
@@ -85,7 +86,9 @@
struct in_addr addr; struct in_addr addr;
printf(" <dt>%s\r\n", dev->d_ifname); printf(" <dt>%s\r\n", dev->d_ifname);
printf(" <dd>HWaddr %s<br>\r\n", ether_ntoa(&dev->d_mac)); #ifdef CONFIG_NET_ETHERNET
printf(" <dd>HWaddr: %s<br>\r\n", ether_ntoa(&dev->d_mac));
#endif
addr.s_addr = dev->d_ipaddr; addr.s_addr = dev->d_ipaddr;
printf(" IPaddr: %s<br>\r\n", inet_ntoa(addr)); printf(" IPaddr: %s<br>\r\n", inet_ntoa(addr));
addr.s_addr = dev->d_draddr; addr.s_addr = dev->d_draddr;
+43 -6
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/thttpd/main.c * examples/thttpd/main.c
* *
* Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,9 @@
#include <nuttx/ramdisk.h> #include <nuttx/ramdisk.h>
#include <nuttx/binfmt.h> #include <nuttx/binfmt.h>
#include <nuttx/nxflat.h> #include <nuttx/nxflat.h>
#ifdef CONFIG_NET_SLIP
# include <nuttx/net.h>
#endif
#include "content/romfs.h" #include "content/romfs.h"
#include "content/symtab.h" #include "content/symtab.h"
@@ -89,6 +92,29 @@
# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" # error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file"
#endif #endif
/* SLIP-specific configuration */
#ifdef CONFIG_NET_SLIP
/* No MAC address operations */
# undef CONFIG_EXAMPLE_THTTPD_NOMAC
/* TTY device to use */
# ifndef CONFIG_NET_SLIPTTY
# define CONFIG_NET_SLIPTTY "/dev/ttyS1"
# endif
# define SLIP_DEVNO 0
# define NET_DEVNAME "slip0"
#else
/* Otherwise, use the standard ethernet device name */
# define NET_DEVNAME "eth0"
#endif
/* Describe the ROMFS file system */ /* Describe the ROMFS file system */
#define SECTORSIZE 512 #define SECTORSIZE 512
@@ -175,24 +201,35 @@ int user_start(int argc, char *argv[])
mac[3] = 0x0b; mac[3] = 0x0b;
mac[4] = 0xba; mac[4] = 0xba;
mac[5] = 0xbe; mac[5] = 0xbe;
uip_setmacaddr("eth0", mac); uip_setmacaddr(NET_DEVNAME, mac);
#endif
/* Configure SLIP */
#ifdef CONFIG_NET_SLIP
ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY);
if (ret < 0)
{
message("ERROR: SLIP initialization failed: %d\n", ret);
exit(1);
}
#endif #endif
/* Set up our host address */ /* Set up our host address */
message("Setup network addresses\n"); message("Setup network addresses\n");
addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR); addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR);
uip_sethostaddr("eth0", &addr); uip_sethostaddr(NET_DEVNAME, &addr);
/* Set up the default router address */ /* Set up the default router address */
addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_DRIPADDR); addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_DRIPADDR);
uip_setdraddr("eth0", &addr); uip_setdraddr(NET_DEVNAME, &addr);
/* Setup the subnet mask */ /* Setup the subnet mask */
addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_NETMASK); addr.s_addr = HTONL(CONFIG_EXAMPLE_THTTPD_NETMASK);
uip_setnetmask("eth0", &addr); uip_setnetmask(NET_DEVNAME, &addr);
/* Initialize the NXFLAT binary loader */ /* Initialize the NXFLAT binary loader */
@@ -201,7 +238,7 @@ int user_start(int argc, char *argv[])
if (ret < 0) if (ret < 0)
{ {
message("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); message("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret);
exit(1); exit(2);
} }
/* Create a ROM disk for the ROMFS filesystem */ /* Create a ROM disk for the ROMFS filesystem */
+8 -2
View File
@@ -3,7 +3,7 @@
* Various non-standard APIs to support netutils. All non-standard and * Various non-standard APIs to support netutils. All non-standard and
* intended only for internal use. * intended only for internal use.
* *
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* *
* Some of these APIs derive from uIP but all of them use the uip_ prefix * Some of these APIs derive from uIP but all of them use the uip_ prefix
@@ -54,7 +54,9 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <pthread.h> #include <pthread.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <net/uip/uipopt.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@@ -93,10 +95,14 @@
extern bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr); extern bool uiplib_ipaddrconv(const char *addrstr, uint8_t *addr);
/* Get and set IP/MAC addresses */ /* Get and set IP/MAC addresses (Ethernet L2 only) */
#ifdef CONFIG_NET_ETHERNET
extern int uip_setmacaddr(const char *ifname, const uint8_t *macaddr); extern int uip_setmacaddr(const char *ifname, const uint8_t *macaddr);
extern int uip_getmacaddr(const char *ifname, uint8_t *macaddr); extern int uip_getmacaddr(const char *ifname, uint8_t *macaddr);
#endif
/* IP address support */
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
extern int uip_gethostaddr(const char *ifname, struct in6_addr *addr); extern int uip_gethostaddr(const char *ifname, struct in6_addr *addr);
+12 -5
View File
@@ -1,7 +1,7 @@
############################################################################ ############################################################################
# Make.defs # Make.defs
# #
# Copyright (C) 2007, 2010 Gregory Nutt. All rights reserved. # Copyright (C) 2007, 2010-2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr> # Author: Gregory Nutt <spudmonkey@racsa.co.cr>
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -34,10 +34,17 @@
############################################################################ ############################################################################
UIPLIB_ASRCS = UIPLIB_ASRCS =
UIPLIB_CSRCS = uiplib.c uip_setmacaddr.c uip_getmacaddr.c uip_sethostaddr.c \ UIPLIB_CSRCS = uiplib.c uip_sethostaddr.c uip_gethostaddr.c uip_setdraddr.c \
uip_gethostaddr.c uip_setdraddr.c uip_setnetmask.c uip_parsehttpurl.c \ uip_setnetmask.c uip_parsehttpurl.c uip_server.c\
uip_server.c
# No MAC address support for SLIP (Ethernet only)
ifneq ($(CONFIG_NET_SLIP),y)
UIPLIB_CSRCS += uip_setmacaddr.c uip_getmacaddr.c
endif
# IGMP support
ifeq ($(CONFIG_NET_IGMP),y) ifeq ($(CONFIG_NET_IGMP),y)
UIPLIB_CSRCS += uip_ipmsfilter.c UIPLIB_CSRCS += uip_ipmsfilter.c
endif endif