mirror of
https://github.com/apache/nuttx.git
synced 2025-12-11 21:20:26 +08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27192d3a00 | ||
|
|
ab1f88c3b8 | ||
|
|
0e1b8b8b11 | ||
|
|
ca5e8b5998 | ||
|
|
5698f351b1 | ||
|
|
dd0e40bbed | ||
|
|
8c0dd44a5e | ||
|
|
5d7b5add5d | ||
|
|
5ea5c4cf09 | ||
|
|
9b0f9f10d6 | ||
|
|
a2affa9a9c | ||
|
|
69cbd66244 | ||
|
|
f6547ca194 | ||
|
|
d622214165 | ||
|
|
22cd175fd7 | ||
|
|
81d093e29e |
13
ChangeLog
13
ChangeLog
@@ -217,5 +217,16 @@
|
||||
* ARP timer is now built into the network layer
|
||||
* Basic client functionality verified: socket(), bind(), connect(), recv(), send().
|
||||
|
||||
0.3.1 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.3.1 2007-11-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Separated net/uip/uip.c into several functions in several files.
|
||||
* Corrected a TCP problem where packets were dropped because there was no
|
||||
recv() in place but the packet was being ACKed. There are still TCP
|
||||
recv buffering issues, but this is part of a larger buffering issue.
|
||||
* Basic server functionality verified: listen(), accept()
|
||||
* Fix DM90x0 driver problem that caused TX overruns
|
||||
* Add strncmp()
|
||||
* Added TCP/IP read-ahead buffer to minimize failed ACKs and packet loss.
|
||||
|
||||
0.3.2 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||
<p>Last Updated: November 6, 2007</p>
|
||||
<p>Last Updated: November 19, 2007</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -183,7 +183,7 @@
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The 12th release of NuttX (nuttx-0.3.0) is available for download
|
||||
The 13th release of NuttX (nuttx-0.3.0) is available for download
|
||||
from the <a href="http://sourceforge.net/project/showfiles.php?group_id=189573">SourceForge</a>
|
||||
website.
|
||||
The change log associated with the release is available <a href="#currentrelease">here</a>.
|
||||
@@ -191,15 +191,19 @@
|
||||
These unreleased changes are listed <a href="#pendingchanges">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
NuttX 30.3.0 includes the initial integration of a network subsystem and
|
||||
a TCP/IP stack based on <a href="http://www.sics.se/~adam/uip/index.php/Main_Page">uIP</a>.
|
||||
Also included is a device driver for the Davicom DM90x0 ethernet controller.
|
||||
NuttX 0.3.1 is the second release containing the integration of a network
|
||||
subsystem and the uIP TCP/IP, UDP, and ICMP stacks based on
|
||||
<a href="http://www.sics.se/~adam/uip/index.php/Main_Page">uIP</a>
|
||||
into NuttX.
|
||||
</p>
|
||||
</p>
|
||||
This integration is very preliminary. Only a small portion of the
|
||||
network functionality has been integrated and there are a number of
|
||||
open issues. The network subsystem is pre-alpha this point in time.
|
||||
I expect that it will stabilize and mature over the next few releases.
|
||||
<p>
|
||||
Many network-related problems have been fixed from version 0.3.0
|
||||
and the implementation has matured significantly.
|
||||
However, the level of network reliability is probably still at the
|
||||
pre-alpha or early level.
|
||||
It is sufficiently complete that you may begin to perform some network
|
||||
integration and is exepcted to achieve beta level of reliability over
|
||||
the next few releases.
|
||||
</p>
|
||||
<p>
|
||||
The baseline functionality of NuttX continues to mature and remains at
|
||||
@@ -355,11 +359,12 @@ is available that be used to build a NuttX-compatible arm-elf toolchain.</blockq
|
||||
</pre>
|
||||
<p><b>DM320 (ARM9)</b>
|
||||
This build for the ARM9 target includes a signficant subset of OS
|
||||
features, ethernet driver and full TCP/IP stack (via uIP).
|
||||
features, ethernet driver and full TCP/IP, UDP and (minimal) ICMP
|
||||
stacks (via uIP). (11/8/07)
|
||||
</p>
|
||||
<pre>
|
||||
text data bss dec hex filename
|
||||
51368 296 6072 57736 e188 nuttx
|
||||
49472 296 3972 53740 d1ec nuttx
|
||||
</pre>
|
||||
<p><b>87C52</b>
|
||||
A reduced functionality OS test for the 8052 target requires only
|
||||
@@ -434,13 +439,13 @@ Other memory:
|
||||
</table>
|
||||
|
||||
<ul><pre>
|
||||
0.1.0 2007-03-09 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.1.0 2007-03-09 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Initial Release
|
||||
* Support for Linux user mode simulation and TI
|
||||
TMS320C5471 (Arm7) provided
|
||||
|
||||
0.1.1 2007-03-14 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.1.1 2007-03-14 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Corrected an error in interrupt level context switching
|
||||
for C5471
|
||||
@@ -468,7 +473,7 @@ Other memory:
|
||||
issue when SP enters indirect address space.
|
||||
* Documentation updates
|
||||
|
||||
0.1.2 2007-03-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.1.2 2007-03-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Add dirent.h, opendir(), readdir(), closedir(), etc.
|
||||
* Add strerror()
|
||||
@@ -493,7 +498,7 @@ Other memory:
|
||||
cause various problems
|
||||
* Added a test for roundrobin scheduler.
|
||||
|
||||
0.2.1 2007-03-22 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.1 2007-03-22 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Fix error in handing signed decimal in vsprintf().
|
||||
* Major restructuring of header files to get closer to
|
||||
@@ -505,7 +510,7 @@ Other memory:
|
||||
* Some Documentation updates
|
||||
* Added support for the Neuros OSD / DM320
|
||||
|
||||
0.2.2 2007-03-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.2 2007-03-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Created the configs/ directory; separated board configuration
|
||||
from processor architecture logic
|
||||
* Add memory leak detection test to examples/ostest
|
||||
@@ -525,7 +530,7 @@ Other memory:
|
||||
* Added directories to hold board-specific header files
|
||||
* Added directories to hold board-specific drivers
|
||||
|
||||
0.2.3 2007-03-29 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.3 2007-03-29 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* mq_receive and mq_send now return errno's appropriately
|
||||
* mq_receive and mq_send are now correctly awakened by signals.
|
||||
@@ -547,7 +552,7 @@ Other memory:
|
||||
pthread_join. In the failure condition, memory was being
|
||||
deallocated while still in use.
|
||||
|
||||
0.2.4 2007-04-28 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.4 2007-04-28 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Verfied c5471 build under Cygwin on WinXP
|
||||
* Makesystem changes to better support different SoCs.
|
||||
@@ -557,7 +562,7 @@ Other memory:
|
||||
arch/c5471 and arch/dm320 are deprecated and will be removed
|
||||
when the new c5471 and dm320 logic is verified.
|
||||
|
||||
0.2.5 2007-05-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.5 2007-05-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Corrected some build/configuration issues introduced with the
|
||||
last release.
|
||||
@@ -574,7 +579,7 @@ Other memory:
|
||||
* Added fsync()
|
||||
* Added strspn() and strcspn()
|
||||
|
||||
0.2.6 2007-05-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.6 2007-05-26 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Added unlink(), mkdir(), rmdir(), and rename()
|
||||
* Fixed several serious FAT errors with oflags handling (&& instead of &)
|
||||
@@ -584,7 +589,7 @@ Other memory:
|
||||
* Fixed ARM compilation errors introduced in 0.2.5 (that is what I get
|
||||
for only testing on the simulation).
|
||||
|
||||
0.2.7 2007-06-09 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.7 2007-06-09 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Added stat() to fs layer and to FAT
|
||||
* Fixed reference counting errors associated with mounted filesystems
|
||||
@@ -613,7 +618,7 @@ Other memory:
|
||||
* examples/ostest/barrier.c: Don't call usleep() when signals are
|
||||
disabled.
|
||||
|
||||
0.2.8 2007-07-02 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.2.8 2007-07-02 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* tools/Makefile.mkconfig: Under Cygwin, executable has a different name
|
||||
* tools/mkdeps.sh & arch/arm/src/Makefile: Corrected a problem makeing dependencies
|
||||
* tools/zipme.sh: Force directory name to be nuttx-xx.yy.zz
|
||||
@@ -634,18 +639,8 @@ Other memory:
|
||||
* lib/: Added strrchr, basename, dirname
|
||||
* examples/nsh/: Add cp, rm, rmdir, set, unset commands. echo will now print
|
||||
environment variables.
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="currentrelease">ChangeLog for Current Release</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<pre><ul>
|
||||
0.3.0 2007-11-06 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.3.0 2007-11-06 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Imported uIP into the tree (see
|
||||
http://www.sics.se/~adam/uip/index.php/Main_Page)
|
||||
@@ -664,6 +659,27 @@ Other memory:
|
||||
* Basic client functionality verified: socket(), bind(), connect(), recv(), send().
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<a name="currentrelease">ChangeLog for Current Release</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<pre><ul>
|
||||
0.3.1 2007-11-19 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* Separated net/uip/uip.c into several functions in several files.
|
||||
* Corrected a TCP problem where packets were dropped because there was no
|
||||
recv() in place but the packet was being ACKed. There are still TCP
|
||||
recv buffering issues, but this is part of a larger buffering issue.
|
||||
* Basic server functionality verified: listen(), accept()
|
||||
* Fix DM90x0 driver problem that caused TX overruns
|
||||
* Add strncmp()
|
||||
* Added TCP/IP read-ahead buffer to minimize failed ACKs and packet loss.
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
<tr bgcolor="#e4e4e4">
|
||||
<td>
|
||||
@@ -673,7 +689,7 @@ Other memory:
|
||||
</table>
|
||||
|
||||
<pre><ul>
|
||||
0.3.1 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
0.3.2 2007-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
</pre></ul>
|
||||
|
||||
<table width ="100%">
|
||||
|
||||
@@ -1353,7 +1353,7 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
<code>CONFIG_NSOCKET_DESCRIPTORS</code>: Maximum number of socket descriptors per task/thread.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_MAX_CONNECTIONS</code>: Maximum number of TCP connections (all tasks).
|
||||
<code>CONFIG_NET_TCP_CONNS</code>: Maximum number of TCP connections (all tasks).
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_MAX_LISTENPORTS</code>: Maximum number of listening TCP ports (all tasks).
|
||||
@@ -1362,10 +1362,13 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
<code>CONFIG_NET_SOCKOPTS</code>: Enable or disable support for socket options.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_BUFFER_SIZE</code>: uIP buffer size
|
||||
<code>CONFIG_NET_BUFSIZE</code>: uIP buffer size
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_LOGGING</code>: Logging on or off
|
||||
<code>CONFIG_NET_TCP_READAHEAD_BUFSIZE</code>: Size of TCP read-ahead buffers
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_NTCP_READAHEAD_BUFFERS</code>: Number of TCP read-ahead buffers (may be zero)
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_UDP</code>: UDP support on or off
|
||||
|
||||
22
ReleaseNotes
22
ReleaseNotes
@@ -1,16 +1,16 @@
|
||||
nuttx-0.3.0
|
||||
nuttx-0.3.1
|
||||
^^^^^^^^^^^
|
||||
|
||||
This is the 12th release of NuttX. This release includes the initial
|
||||
integration of a network subsystem and the uIP TCP/IP stack into NuttX
|
||||
(see http://www.sics.se/~adam/uip/index.php/Main_Page). Also included
|
||||
is a device driver for the Davicom DM90x0 ethernet controller.
|
||||
This is the 13th release of NuttX and the second release containing
|
||||
the integration of a network subsystem and the uIP TCP/IP, UDP, and
|
||||
ICMP stacks into NuttX (see http://www.sics.se/~adam/uip/index.php/Main_Page).
|
||||
|
||||
This integration is very preliminary. Only a small portion of the
|
||||
network functionality has been integrated and there are a number of
|
||||
open issues (see the TODO file). The network subsystem is pre-alpha
|
||||
at this point in time. I expect that it will stabilize and mature
|
||||
over the next few releases.
|
||||
Many network-related problems have been fixed and the implementation
|
||||
has matured significantly. However, the level of network reliability
|
||||
is probably still at the pre-alpha or early level. It is sufficiently
|
||||
complete that you may begin to perform some network integration and
|
||||
is exepcted to achieve beta level of reliability over the next few
|
||||
releases.
|
||||
|
||||
The baseline functionality of NuttX continues to mature and remains at
|
||||
post-beta (as long as the network is not used).
|
||||
@@ -20,4 +20,4 @@ See the ChangeLog for a complete list of changes.
|
||||
This release has been verified only on the Neuros OSD (DM320 ARM9)
|
||||
platform using the DM90x0 driver.
|
||||
|
||||
This tarball contains a complete CVS snapshot from November 6, 2007.
|
||||
This tarball contains a complete CVS snapshot from November 19, 2007.
|
||||
|
||||
25
TODO
25
TODO
@@ -31,37 +31,26 @@ o C++ Support
|
||||
o Network
|
||||
- Did not implement send() and sendto() timeouts. Option is setable via setsockopt,
|
||||
but is not implemented.
|
||||
- netutils/webserver netutils/telnetd (and maybe others) are seriously broken.
|
||||
- netutils/telnetd (and maybe others) are seriously broken.
|
||||
Need to be re-written to use listen() and accept()
|
||||
- Should implement SOCK_RAW
|
||||
- listen() and accept() are untested.
|
||||
- accept() and recvfrom() need to return connection address
|
||||
- Performance Improvements (uIP is not very fast):
|
||||
- Improve performance by queing TX operations
|
||||
Add simple buffer management. CONFIG_NET_BUFFERS
|
||||
(1) On write, queue buffer for output get a new buffer for the socket (waiting if
|
||||
nececcesary
|
||||
(2) Copy buffer structure into uip_driver_structure when driver requests write
|
||||
data
|
||||
- Improve performance by stimulating the driver to accept new TX data before the
|
||||
next polling interval.
|
||||
|
||||
Add a txail callback into driver to eliminate send delays. Since we want to
|
||||
support multiple network devices, this means we will have to add some infrastructure
|
||||
to map to device.
|
||||
- Break uip_interrupt() (in uip.c) into several functions.
|
||||
- uIP polling issues:
|
||||
(1) uIP expects a single driver to poll at a 500ms interval (dm90x0 currently
|
||||
polls a 5sec).
|
||||
(2) Current logic will not support multiple ethernet drivers. Each driver should
|
||||
(1) Current logic will not support multiple ethernet drivers. Each driver should
|
||||
poll on TCP connections connect on the network supported by the driver; UDP
|
||||
polling should respond with TX data only if the UDP packet is intended for the
|
||||
the network supported by the driver.
|
||||
(3) If there were multiple drivers, polling would occur at double the rate.
|
||||
- TCP Bug:
|
||||
When TCP data is received with no read in place, it appears that uIP ACKs the data
|
||||
even though it was not taken accepted. We must either (1) buffer incoming data, or
|
||||
(2) not ACK it so that it will be re-sent.
|
||||
(2) If there were multiple drivers, polling would occur at double the rate.i
|
||||
Fix by using bound IP address in TCP connection (lipaddr) and verifying that it
|
||||
is in the subnet served by the driver.
|
||||
- uIP/Socket callback logic is not thread safe. This means that a socket cannot be
|
||||
used concurrently by two threads. Minimal fix: Add mutex to support exclusion.
|
||||
|
||||
o USB
|
||||
- Implement USB device support
|
||||
|
||||
@@ -95,8 +95,6 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
boolean switch_needed;
|
||||
|
||||
lldbg("Blocking TCB=%p\n", tcb);
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list. If we
|
||||
* are blocking the task at the head of the task list (the
|
||||
* most likely case), then a context switch to the next
|
||||
@@ -138,7 +136,6 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
*/
|
||||
|
||||
rtcb = (_TCB*)g_readytorun.head;
|
||||
lldbg("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
@@ -157,7 +154,6 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
||||
*/
|
||||
|
||||
rtcb = (_TCB*)g_readytorun.head;
|
||||
lldbg("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
|
||||
void up_sigdeliver(void)
|
||||
{
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
uint32 regs[XCPTCONTEXT_REGS];
|
||||
sig_deliver_t sigdeliver;
|
||||
@@ -132,4 +133,5 @@ void up_sigdeliver(void)
|
||||
|
||||
up_ledoff(LED_SIGNAL);
|
||||
up_fullcontextrestore(regs);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -91,8 +91,6 @@ void up_unblock_task(_TCB *tcb)
|
||||
{
|
||||
_TCB *rtcb = (_TCB*)g_readytorun.head;
|
||||
|
||||
lldbg("Unblocking TCB=%p\n", tcb);
|
||||
|
||||
/* Remove the task from the blocked task list */
|
||||
|
||||
sched_removeblocked(tcb);
|
||||
@@ -130,7 +128,6 @@ void up_unblock_task(_TCB *tcb)
|
||||
*/
|
||||
|
||||
rtcb = (_TCB*)g_readytorun.head;
|
||||
lldbg("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
@@ -151,7 +148,6 @@ void up_unblock_task(_TCB *tcb)
|
||||
*/
|
||||
|
||||
rtcb = (_TCB*)g_readytorun.head;
|
||||
lldbg("New Active Task TCB=%p\n", rtcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
|
||||
@@ -217,10 +217,10 @@ static inline void dump_ethhdr(const char *msg, unsigned char *buf, int buflen)
|
||||
lib_rawprintf(" %02x:%02x:%02x:%02x:%02x:%02x %02x:%02x:%02x:%02x:%02x:%02x %02x%02x\n",
|
||||
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
|
||||
buf[6], buf[7], buf[8], buf[9], buf[10], buf[11],
|
||||
#if UIP_BYTE_ORDER == UIP_LITTLE_ENDIAN
|
||||
buf[12], buf[13]);
|
||||
#else
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
buf[13], buf[12]);
|
||||
#else
|
||||
buf[12], buf[13]);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -87,7 +87,7 @@ static struct uip_driver_s g_sim_dev;
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void timer_set( struct timer *t, unsigned int interval )
|
||||
static void timer_set(struct timer *t, unsigned int interval)
|
||||
{
|
||||
t->interval = interval;
|
||||
t->start = up_getwalltime();
|
||||
@@ -104,9 +104,9 @@ void timer_reset(struct timer *t)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_PROMISCUOUS
|
||||
# define uipdriver_comparemac(a,b) (0)
|
||||
# define up_comparemac(a,b) (0)
|
||||
#else
|
||||
static inline int uip_comparemac(struct uip_eth_addr *paddr1, struct uip_eth_addr *paddr2)
|
||||
static inline int up_comparemac(struct uip_eth_addr *paddr1, struct uip_eth_addr *paddr2)
|
||||
{
|
||||
return memcmp(paddr1, paddr2, sizeof(struct uip_eth_addr));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ void uipdriver_loop(void)
|
||||
|
||||
/* tapdev_read will return 0 on a timeout event and >0 on a data received event */
|
||||
|
||||
g_sim_dev.d_len = tapdev_read((unsigned char*)g_sim_dev.d_buf, UIP_BUFSIZE);
|
||||
g_sim_dev.d_len = tapdev_read((unsigned char*)g_sim_dev.d_buf, CONFIG_NET_BUFSIZE);
|
||||
|
||||
/* Disable preemption through to the following so that it behaves a little more
|
||||
* like an interrupt (otherwise, the following logic gets pre-empted an behaves
|
||||
@@ -155,7 +155,7 @@ void uipdriver_loop(void)
|
||||
* MAC address
|
||||
*/
|
||||
|
||||
if (g_sim_dev.d_len > UIP_LLH_LEN && uip_comparemac( &BUF->dest, &g_sim_dev.d_mac) == 0)
|
||||
if (g_sim_dev.d_len > UIP_LLH_LEN && up_comparemac( &BUF->dest, &g_sim_dev.d_mac) == 0)
|
||||
{
|
||||
/* We only accept IP packets of the configured type and ARP packets */
|
||||
|
||||
@@ -201,7 +201,7 @@ void uipdriver_loop(void)
|
||||
else if (timer_expired(&g_periodic_timer))
|
||||
{
|
||||
timer_reset(&g_periodic_timer);
|
||||
uip_poll(&g_sim_dev, sim_uiptxpoll, UIP_DRV_TIMER);
|
||||
uip_poll(&g_sim_dev, sim_uiptxpoll, 1);
|
||||
}
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
@@ -213,12 +213,14 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors
|
||||
per task/thread.
|
||||
CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
|
||||
CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
CONFIG_NET_LOGGING - Logging on or off
|
||||
CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers
|
||||
(may be zero)
|
||||
CONFIG_NET_UDP - UDP support on or off
|
||||
CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP
|
||||
|
||||
@@ -254,11 +254,12 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -272,11 +273,10 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
|
||||
@@ -243,11 +243,12 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -261,11 +262,10 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
|
||||
@@ -267,11 +267,12 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -285,11 +286,10 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
|
||||
@@ -252,11 +252,12 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -270,11 +271,10 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
@@ -293,8 +293,22 @@ CONFIG_NET_BROADCAST=n
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
CONFIG_EXAMPLE_UIP_SMTP=n
|
||||
CONFIG_EXAMPLE_UIP_TELNETD=n
|
||||
CONFIG_EXAMPLE_UIP_WEBSERVER=y
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
CONFIG_EXAMPLE_UIP_RESOLV=n
|
||||
CONFIG_EXAMPLE_UIP_WEBCLIENT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
@@ -304,7 +318,7 @@ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1)
|
||||
# DM90x0 Driver Settings
|
||||
CONFIG_NET_DM90x0=n
|
||||
CONFIG_DM9X_NINTERFACES=1
|
||||
CONFIG_DM9X_STATS=1
|
||||
CONFIG_DM9X_STATS=n
|
||||
CONFIG_DM9X_BASE=0xd0000300
|
||||
CONFIG_DM9X_IRQ=27
|
||||
CONFIG_DM9X_BUSWIDTH8=n
|
||||
|
||||
@@ -63,7 +63,7 @@ CONFIG_DRAM_SIZE=0x01000000
|
||||
CONFIG_DRAM_START=0x01000000
|
||||
CONFIG_DRAM_VSTART=0x00000000
|
||||
CONFIG_DRAM_NUTTXENTRY=0x01008000
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_STACKDUMP=n
|
||||
|
||||
#
|
||||
# DM320 specific device driver settings
|
||||
@@ -253,11 +253,12 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -271,15 +272,14 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=8
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_TCP_CONNS=8
|
||||
CONFIG_NET_MAX_LISTENPORTS=8
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
CONFIG_NET_STATISTICS=n
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
@@ -294,8 +294,22 @@ CONFIG_NET_BROADCAST=n
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
CONFIG_EXAMPLE_UIP_SMTP=n
|
||||
CONFIG_EXAMPLE_UIP_TELNETD=n
|
||||
CONFIG_EXAMPLE_UIP_WEBSERVER=y
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
CONFIG_EXAMPLE_UIP_RESOLV=n
|
||||
CONFIG_EXAMPLE_UIP_WEBCLIENT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=(10<<24|0<<16|0<<8|2)
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(10<<24|0<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
@@ -305,7 +319,7 @@ CONFIG_EXAMPLE_NETTEST_CLIENTIP=(10<<24|0<<16|0<<8|1)
|
||||
# DM90x0 Driver Settings
|
||||
CONFIG_NET_DM90x0=y
|
||||
CONFIG_DM9X_NINTERFACES=1
|
||||
CONFIG_DM9X_STATS=1
|
||||
CONFIG_DM9X_STATS=n
|
||||
CONFIG_DM9X_BASE=0xd0000300
|
||||
CONFIG_DM9X_IRQ=27
|
||||
CONFIG_DM9X_BUSWIDTH8=n
|
||||
|
||||
@@ -240,11 +240,12 @@ CONFIG_PREALLOC_TIMERS=0
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -258,11 +259,10 @@ CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
|
||||
@@ -214,11 +214,12 @@ CONFIG_FS_FAT=y
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -232,11 +233,10 @@ CONFIG_FS_FAT=y
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
@@ -260,15 +260,17 @@ CONFIG_NET_RESOLV_ENTRIES=4
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(192<<24|168<<16|0<<8|128)
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(192<<24|168<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
#CONFIG_EXAMPLE_UIP_SMTP=
|
||||
#CONFIG_EXAMPLE_UIP_TELNETD=
|
||||
#CONFIG_EXAMPLE_UIP_WEBSERVER=
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=y
|
||||
#CONFIG_EXAMPLE_UIP_RESOLV=
|
||||
#CONFIG_EXAMPLE_UIP_WEBCLIENT=
|
||||
CONFIG_EXAMPLE_UIP_SMTP=n
|
||||
CONFIG_EXAMPLE_UIP_TELNETD=n
|
||||
CONFIG_EXAMPLE_UIP_WEBSERVER=y
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
CONFIG_EXAMPLE_UIP_RESOLV=n
|
||||
CONFIG_EXAMPLE_UIP_WEBCLIENT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=(192<<24|168<<16|0<<8|128)
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(192<<24|168<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
|
||||
@@ -215,11 +215,12 @@ CONFIG_FS_FAT=y
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
@@ -233,11 +234,10 @@ CONFIG_FS_FAT=y
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=8
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_BUFSIZE=420
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
@@ -261,15 +261,17 @@ CONFIG_NET_RESOLV_ENTRIES=4
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=(192<<24|168<<16|0<<8|128)
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=(192<<24|168<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
#CONFIG_EXAMPLE_UIP_SMTP=
|
||||
#CONFIG_EXAMPLE_UIP_TELNETD=
|
||||
#CONFIG_EXAMPLE_UIP_WEBSERVER=
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=y
|
||||
#CONFIG_EXAMPLE_UIP_RESOLV=
|
||||
#CONFIG_EXAMPLE_UIP_WEBCLIENT=
|
||||
CONFIG_EXAMPLE_UIP_SMTP=n
|
||||
CONFIG_EXAMPLE_UIP_TELNETD=n
|
||||
CONFIG_EXAMPLE_UIP_WEBSERVER=y
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
CONFIG_EXAMPLE_UIP_RESOLV=n
|
||||
CONFIG_EXAMPLE_UIP_WEBCLIENT=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=(192<<24|168<<16|0<<8|128)
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=(192<<24|168<<16|0<<8|1)
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=(255<<24|255<<16|255<<8|0)
|
||||
|
||||
@@ -260,9 +260,10 @@
|
||||
# define CONFIG_DM9X_MODE DM9X_MODE_AUTO
|
||||
#endif
|
||||
|
||||
/* TX poll deley = 5 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
/* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per second */
|
||||
|
||||
#define DM6X_WDDELAY (5*CLK_TCK)
|
||||
#define DM6X_WDDELAY (1*CLK_TCK)
|
||||
#define DM6X_POLLHSEC (1*2)
|
||||
|
||||
/* TX timeout = 1 minute */
|
||||
|
||||
@@ -297,7 +298,7 @@ struct dm9x_driver_s
|
||||
WDOG_ID dm_txpoll; /* TX poll timer */
|
||||
WDOG_ID dm_txtimeout; /* TX timeout timer */
|
||||
uint8 dm_ntxpending; /* Count of packets pending transmission */
|
||||
uint8 ncrxpackets; /* Number of continuous rx packets */
|
||||
uint8 ncrxpackets; /* Number of continuous rx packets */
|
||||
|
||||
/* Mode-dependent function to move data in 8/16/32 I/O modes */
|
||||
|
||||
@@ -762,46 +763,54 @@ static inline boolean dm9x_rxchecksumready(uint8 rxbyte)
|
||||
|
||||
static int dm9x_transmit(struct dm9x_driver_s *dm9x)
|
||||
{
|
||||
/* Increment count of packets transmitted */
|
||||
/* Check if there is room in the DM90x0 to hold another packet. In 100M mode,
|
||||
* that can be 2 packets, otherwise it is a single packet.
|
||||
*/
|
||||
|
||||
dm9x->dm_ntxpending++;
|
||||
if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2))
|
||||
{
|
||||
/* Increment count of packets transmitted */
|
||||
|
||||
dm9x->dm_ntxpending++;
|
||||
#if defined(CONFIG_DM9X_STATS)
|
||||
dm9x->dm_ntxpackets++;
|
||||
dm9x->dm_ntxbytes += dm9x->dm_dev.d_len;
|
||||
dm9x->dm_ntxpackets++;
|
||||
dm9x->dm_ntxbytes += dm9x->dm_dev.d_len;
|
||||
#endif
|
||||
|
||||
/* Disable all DM90x0 interrupts */
|
||||
/* Disable all DM90x0 interrupts */
|
||||
|
||||
putreg(DM9X_IMR, DM9X_IMRDISABLE);
|
||||
putreg(DM9X_IMR, DM9X_IMRDISABLE);
|
||||
|
||||
/* Set the TX length */
|
||||
/* Set the TX length */
|
||||
|
||||
putreg(DM9X_TXPLL, (dm9x->dm_dev.d_len & 0xff));
|
||||
putreg(DM9X_TXPLH, (dm9x->dm_dev.d_len >> 8) & 0xff);
|
||||
putreg(DM9X_TXPLL, (dm9x->dm_dev.d_len & 0xff));
|
||||
putreg(DM9X_TXPLH, (dm9x->dm_dev.d_len >> 8) & 0xff);
|
||||
|
||||
/* Move the data to be sent into TX SRAM */
|
||||
/* Move the data to be sent into TX SRAM */
|
||||
|
||||
DM9X_INDEX = DM9X_MWCMD;
|
||||
dm9x->dm_write(dm9x->dm_dev.d_buf, dm9x->dm_dev.d_len);
|
||||
DM9X_INDEX = DM9X_MWCMD;
|
||||
dm9x->dm_write(dm9x->dm_dev.d_buf, dm9x->dm_dev.d_len);
|
||||
|
||||
#if !defined(CONFIG_DM9X_ETRANS)
|
||||
/* Issue TX polling command */
|
||||
/* Issue TX polling command */
|
||||
|
||||
putreg(DM9X_TXC, 0x1); /* Cleared after TX complete*/
|
||||
putreg(DM9X_TXC, 0x1); /* Cleared after TX complete*/
|
||||
#endif
|
||||
|
||||
/* Clear count of back-to-back RX packet transfers */
|
||||
/* Clear count of back-to-back RX packet transfers */
|
||||
|
||||
dm9x->ncrxpackets = 0;
|
||||
dm9x->ncrxpackets = 0;
|
||||
|
||||
/* Re-enable DM90x0 interrupts */
|
||||
/* Re-enable DM90x0 interrupts */
|
||||
|
||||
putreg(DM9X_IMR, DM9X_IMRENABLE);
|
||||
putreg(DM9X_IMR, DM9X_IMRENABLE);
|
||||
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
|
||||
(void)wd_start(dm9x->dm_txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x);
|
||||
return OK;
|
||||
(void)wd_start(dm9x->dm_txtimeout, DM6X_TXTIMEOUT, dm9x_txtimeout, 1, (uint32)dm9x);
|
||||
return OK;
|
||||
}
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -949,7 +958,7 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
|
||||
|
||||
/* Also check if the packet is a valid size for the uIP configuration */
|
||||
|
||||
else if (rx.desc.rx_len < UIP_LLH_LEN || rx.desc.rx_len > (UIP_BUFSIZE + 2))
|
||||
else if (rx.desc.rx_len < UIP_LLH_LEN || rx.desc.rx_len > (CONFIG_NET_BUFSIZE + 2))
|
||||
{
|
||||
#if defined(CONFIG_DM9X_STATS)
|
||||
dm9x->dm_nrxlengtherrors++;
|
||||
@@ -977,9 +986,8 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
|
||||
uip_arp_ipin();
|
||||
uip_input(&dm9x->dm_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
* should be sent out on the network, the global variable
|
||||
* d_len is set to a value > 0.
|
||||
/* 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 (dm9x->dm_dev.d_len > 0)
|
||||
@@ -992,10 +1000,9 @@ static void dm9x_receive(struct dm9x_driver_s *dm9x)
|
||||
{
|
||||
uip_arp_arpin(&dm9x->dm_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that
|
||||
* should be sent out on the network, the global variable
|
||||
* d_len is set to a value > 0.
|
||||
*/
|
||||
/* 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 (dm9x->dm_dev.d_len > 0)
|
||||
{
|
||||
@@ -1074,7 +1081,7 @@ static void dm9x_txdone(struct dm9x_driver_s *dm9x)
|
||||
|
||||
/* Then poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_DRV_POLL);
|
||||
(void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1219,7 +1226,9 @@ static void dm9x_txtimeout(int argc, uint32 arg, ...)
|
||||
#endif
|
||||
|
||||
dbg(" TX packet count: %d\n", dm9x->dm_ntxpending);
|
||||
#if defined(CONFIG_DM9X_STATS)
|
||||
dbg(" TX timeouts: %d\n", dm9x->dm_ntxtimeouts);
|
||||
#endif
|
||||
dbg(" TX read pointer address: 0x%02x:%02x\n",
|
||||
getreg(DM9X_TRPAH), getreg(DM9X_TRPAL));
|
||||
dbg(" Memory data write address: 0x%02x:%02x (DM9010)\n",
|
||||
@@ -1231,7 +1240,7 @@ static void dm9x_txtimeout(int argc, uint32 arg, ...)
|
||||
|
||||
/* Then poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_DRV_POLL);
|
||||
(void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1255,8 +1264,6 @@ static void dm9x_polltimer(int argc, uint32 arg, ...)
|
||||
{
|
||||
struct dm9x_driver_s *dm9x = (struct dm9x_driver_s *)arg;
|
||||
|
||||
dbg("Poll timer expiration\n");
|
||||
|
||||
/* If the number of contiguous RX packets exceeds a threshold, reset the counter and
|
||||
* re-enable RX interrupts
|
||||
*/
|
||||
@@ -1273,9 +1280,9 @@ static void dm9x_polltimer(int argc, uint32 arg, ...)
|
||||
|
||||
if (dm9x->dm_ntxpending < 1 || (dm9x->dm_b100M && dm9x->dm_ntxpending < 2))
|
||||
{
|
||||
/* If so, poll uIP for new XMIT data */
|
||||
/* If so, update TCP timing states and poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&dm9x->dm_dev, dm9x_uiptxpoll, UIP_DRV_TIMER);
|
||||
(void)uip_timer(&dm9x->dm_dev, dm9x_uiptxpoll, DM6X_POLLHSEC);
|
||||
}
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
@@ -1350,7 +1357,9 @@ static int dm9x_ifup(struct uip_driver_s *dev)
|
||||
uint8 netstatus;
|
||||
int i;
|
||||
|
||||
dbg("Bringing the interface up\n" );
|
||||
dbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
|
||||
|
||||
/* Initilize DM90x0 chip */
|
||||
|
||||
@@ -1524,8 +1533,8 @@ static void dm9x_bringup(struct dm9x_driver_s *dm9x)
|
||||
|
||||
/* Initialize statistics */
|
||||
|
||||
dm9x->ncrxpackets = 0; /* Number of continuous RX packets */
|
||||
dm9x->dm_ntxpending = 0; /* Number of pending TX packets */
|
||||
dm9x->ncrxpackets = 0; /* Number of continuous RX packets */
|
||||
dm9x->dm_ntxpending = 0; /* Number of pending TX packets */
|
||||
dm9x_resetstatistics(dm9x);
|
||||
|
||||
/* Activate DM9000A/DM9010 */
|
||||
@@ -1565,7 +1574,9 @@ static void dm9x_reset(struct dm9x_driver_s *dm9x)
|
||||
|
||||
save = (uint8)DM9X_INDEX;
|
||||
|
||||
#if defined(CONFIG_DM9X_STATS)
|
||||
dm9x->dm_nresets++;
|
||||
#endif
|
||||
dm9x_bringup(dm9x);
|
||||
|
||||
/* Wait up to 1 second for the link to be OK */
|
||||
|
||||
@@ -42,7 +42,7 @@ TARG_ASRCS =
|
||||
TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT))
|
||||
|
||||
TARG_CSRCS = nettest.c
|
||||
ifeq ($(CONFIG_NETTEST_SERVER),y)
|
||||
ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y)
|
||||
TARG_CSRCS += nettest-server.c
|
||||
else
|
||||
TARG_CSRCS += nettest-client.c
|
||||
@@ -55,13 +55,14 @@ TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS)
|
||||
|
||||
TARG_BIN = lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
||||
|
||||
HOSTCFLAGS += -DCONFIG_NETTEST_HOST=1
|
||||
ifeq ($(CONFIG_NETTEST_SERVER),y)
|
||||
HOSTCFLAGS += -DCONFIG_NETTEST_SERVER=1
|
||||
HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_HOST=1
|
||||
ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y)
|
||||
HOSTCFLAGS += -DCONFIG_EXAMPLE_NETTEST_SERVER=1 \
|
||||
-DCONFIG_EXAMPLE_NETTEST_CLIENTIP="$(CONFIG_EXAMPLE_NETTEST_CLIENTIP)"
|
||||
endif
|
||||
|
||||
HOST_SRCS = host.c
|
||||
ifeq ($(CONFIG_NETTEST_SERVER),y)
|
||||
ifeq ($(CONFIG_EXAMPLE_NETTEST_SERVER),y)
|
||||
HOST_SRCS += nettest-client.c
|
||||
else
|
||||
HOST_SRCS += nettest-server.c
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
#ifdef CONFIG_NETTEST_SERVER
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_SERVER
|
||||
send_client();
|
||||
#else
|
||||
recv_server();
|
||||
|
||||
@@ -57,13 +57,14 @@ void send_client(void)
|
||||
{
|
||||
struct sockaddr_in myaddr;
|
||||
char outbuf[SENDSIZE];
|
||||
#ifndef CONFIG_NETTEST_PERFORMANCE
|
||||
#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||
char inbuf[SENDSIZE];
|
||||
#endif
|
||||
int sockfd;
|
||||
int nbytessent;
|
||||
#ifndef CONFIG_NETTEST_PERFORMANCE
|
||||
#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||
int nbytesrecvd;
|
||||
int totalbytesrecvd;
|
||||
#endif
|
||||
int ch;
|
||||
int i;
|
||||
@@ -107,7 +108,7 @@ void send_client(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETTEST_PERFORMANCE
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||
/* Then receive messages forever */
|
||||
|
||||
for (;;)
|
||||
@@ -141,24 +142,31 @@ void send_client(void)
|
||||
}
|
||||
else if (nbytessent != SENDSIZE)
|
||||
{
|
||||
message("client: Bad send length=%d: %d\n", nbytessent);
|
||||
message("client: Bad send length: %d Expected: %d\n", nbytessent, SENDSIZE);
|
||||
close(sockfd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
message("client: Receiving...\n");
|
||||
nbytesrecvd = recv(sockfd, inbuf, SENDSIZE, 0);
|
||||
message("client: Received %d bytes\n", nbytesrecvd);
|
||||
totalbytesrecvd = 0;
|
||||
do
|
||||
{
|
||||
message("client: Receiving...\n");
|
||||
nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], SENDSIZE - totalbytesrecvd, 0);
|
||||
|
||||
if (nbytesrecvd < 0)
|
||||
{
|
||||
message("client: recv failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
exit(-1);
|
||||
if (nbytesrecvd < 0)
|
||||
{
|
||||
message("client: recv failed: %d\n", errno);
|
||||
close(sockfd);
|
||||
exit(-1);
|
||||
}
|
||||
totalbytesrecvd += nbytesrecvd;
|
||||
message("client: Received %d of %d bytes\n", totalbytesrecvd, SENDSIZE);
|
||||
}
|
||||
else if (nbytesrecvd != SENDSIZE)
|
||||
while (totalbytesrecvd < SENDSIZE);
|
||||
|
||||
if (totalbytesrecvd != SENDSIZE)
|
||||
{
|
||||
message("client: Bad recv length=%d: %d\n", nbytessent);
|
||||
message("client: Bad recv length: %d Expected: %d\n", totalbytesrecvd, SENDSIZE);
|
||||
close(sockfd);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ void recv_server(void)
|
||||
int acceptsd;
|
||||
socklen_t addrlen;
|
||||
int nbytesread;
|
||||
#ifndef CONFIG_NETTEST_PERFORMANCE
|
||||
#ifndef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||
int totalbytesread;
|
||||
int nbytessent;
|
||||
int ch;
|
||||
@@ -133,7 +133,7 @@ void recv_server(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NETTEST_PERFORMANCE
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_PERFORMANCE
|
||||
/* Then receive data forever */
|
||||
|
||||
for (;;)
|
||||
@@ -194,19 +194,9 @@ void recv_server(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETTEST_HOST
|
||||
/* At present, data received by the target before it is completed the
|
||||
* the write opertion and started the read operation results in a failure
|
||||
* (the data is not received, but it is ACKed). This will have to be
|
||||
* fixed.
|
||||
*/
|
||||
|
||||
# warning "FIXME: This should not be necessary"
|
||||
sleep(10);
|
||||
#endif
|
||||
|
||||
/* Then send the same data back to the client */
|
||||
|
||||
message("server: Sending %d bytes\n", totalbytesread);
|
||||
nbytessent = send(acceptsd, buffer, totalbytesread, 0);
|
||||
if (nbytessent <= 0)
|
||||
{
|
||||
|
||||
@@ -94,7 +94,7 @@ int user_start(int argc, char *argv[])
|
||||
addr.s_addr = HTONL(CONFIG_EXAMPLE_NETTEST_NETMASK);
|
||||
uip_setnetmask("eth0", &addr);
|
||||
|
||||
#ifdef CONFIG_NETTEST_SERVER
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_SERVER
|
||||
recv_server();
|
||||
#else
|
||||
send_client();
|
||||
@@ -102,16 +102,3 @@ int user_start(int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* uip_log
|
||||
****************************************************************************/
|
||||
|
||||
void uip_log(char *m)
|
||||
{
|
||||
/* Since uip_log is called from interrupt handling logic, it cannot use
|
||||
* or other standard I/O. This should work from an interrupt handler:
|
||||
*/
|
||||
|
||||
lib_rawprintf("uIP log message: %s\n", m);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NETTEST_HOST
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_HOST
|
||||
#else
|
||||
# include <debug.h>
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NETTEST_HOST
|
||||
#ifdef CONFIG_EXAMPLE_NETTEST_HOST
|
||||
/* HTONS/L macros are unique to uIP */
|
||||
|
||||
# define HTONS(a) htons(a)
|
||||
|
||||
@@ -119,16 +119,16 @@ int user_start(int argc, char *argv[])
|
||||
#if !defined(CONFIG_EXAMPLE_UIP_DHCPC)
|
||||
struct in_addr addr;
|
||||
#endif
|
||||
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || !defined(CONFIG_ARCH_SIM)
|
||||
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_NOMAC)
|
||||
uint8 mac[IFHWADDRLEN];
|
||||
#endif
|
||||
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_SMTP)
|
||||
void *handle;
|
||||
#endif
|
||||
|
||||
/* Most embedded network interfaces must have a software assigned MAC */
|
||||
/* Many embedded network interfaces must have a software assigned MAC */
|
||||
|
||||
#if !defined(CONFIG_ARCH_SIM)
|
||||
#ifdef CONFIG_EXAMPLE_UIP_NOMAC
|
||||
mac[0] = 0x00;
|
||||
mac[1] = 0xe0;
|
||||
mac[2] = 0xb0;
|
||||
@@ -208,15 +208,6 @@ int user_start(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uip_log(char *m)
|
||||
{
|
||||
/* Since uip_log is called from interrupt handling logic, it cannot use
|
||||
* or other standard I/O. This should work from an interrupt handler:
|
||||
*/
|
||||
|
||||
lib_rawprintf("uIP log message: %s\n", m);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_EXAMPLE_UIP_WEBCLIENT)
|
||||
void webclient_closed(void)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,9 @@ int open(const char *path, int oflags, ...)
|
||||
struct filelist *list;
|
||||
FAR struct inode *inode;
|
||||
const char *relpath = NULL;
|
||||
#ifdef CONFIG_FILE_MODE
|
||||
mode_t mode = 0666;
|
||||
#endif
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
|
||||
@@ -1,11 +1,19 @@
|
||||
/* httpd.h
|
||||
/****************************************************************************
|
||||
* net/uip/httpd.h
|
||||
*
|
||||
* Copyright (c) 2001-2005, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Based on uIP which also has a BSD style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2001-2005, Adam Dunkels.
|
||||
* 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
|
||||
@@ -26,13 +34,22 @@
|
||||
* 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.
|
||||
*/
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _NET_UIP_HTTPD_H
|
||||
#define _NET_UIP_HTTPD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
extern void httpd_init(void);
|
||||
extern int httpd_listen(void);
|
||||
|
||||
|
||||
@@ -57,32 +57,6 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The following flags are passed as an argument to the uip_interrupt()
|
||||
* function. They are used to distinguish between the two cases where
|
||||
* uip_interrupt() is called. It can be called either because we have
|
||||
* incoming data that should be processed, or because the periodic
|
||||
* timer has fired. These values are never used directly, but only in
|
||||
* the macrose defined in this file.
|
||||
*
|
||||
* UIP_DRV_RECEIVE - There is new incoming data from the driver in the d_buf
|
||||
* field of the uip_driver_s structure. The length of the
|
||||
* new data is provided in the d_len field of the
|
||||
* uip_driver_s structure.
|
||||
* UIP_DRV_TIMER - Called periodically from driver to service timeout-
|
||||
* related activities to and to get timeout-related
|
||||
* responses (e.g., reset)
|
||||
* UIP_DRV_POLL - Poll TCP for data to be transmitted
|
||||
* UIP_DRV_UDPPOLL - Poll for UDP data to be transmitted. This value is used
|
||||
* internally by the uip_poll logic.
|
||||
*/
|
||||
|
||||
#define UIP_DRV_RECEIVE 1
|
||||
#define UIP_DRV_TIMER 2
|
||||
#define UIP_DRV_POLL 3
|
||||
#ifdef CONFIG_NET_UDP
|
||||
# define UIP_DRV_UDPPOLL 4
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -142,7 +116,7 @@ struct uip_driver_s
|
||||
* }
|
||||
*/
|
||||
|
||||
uint8 d_buf[UIP_BUFSIZE + 2];
|
||||
uint8 d_buf[CONFIG_NET_BUFSIZE + 2];
|
||||
|
||||
/* d_appdata points to the location where application data can be read from
|
||||
* or written into a packet.
|
||||
@@ -217,7 +191,7 @@ struct uip_driver_s
|
||||
*
|
||||
* dev->d_len = devicedriver_poll();
|
||||
* if(dev->d_len > 0) {
|
||||
* uip_input();
|
||||
* uip_input(dev);
|
||||
* if(dev->d_len > 0) {
|
||||
* devicedriver_send();
|
||||
* }
|
||||
@@ -233,7 +207,7 @@ struct uip_driver_s
|
||||
* if(dev->d_len > 0) {
|
||||
* if(BUF->type == HTONS(UIP_ETHTYPE_IP)) {
|
||||
* uip_arp_ipin();
|
||||
* uip_input();
|
||||
* uip_input(dev);
|
||||
* if(dev->d_len > 0) {
|
||||
* uip_arp_out();
|
||||
* devicedriver_send();
|
||||
@@ -246,29 +220,26 @@ struct uip_driver_s
|
||||
* }
|
||||
*/
|
||||
|
||||
#define uip_input(dev) uip_interrupt(dev, UIP_DRV_RECEIVE)
|
||||
extern void uip_input(struct uip_driver_s *dev);
|
||||
|
||||
/* Polling of connections.
|
||||
/* Polling of connections
|
||||
*
|
||||
* This function will traverse each active uIP connection structure and
|
||||
* perform uip_interrupt with the specified event. After each polling each
|
||||
* active uIP connection structure, this function will call the provided
|
||||
* callback function if the poll resulted in new data to be send. The poll
|
||||
* will continue until all connections have been polled or until the user-
|
||||
* suplied function returns a non-zero value (which is would do only if
|
||||
* it cannot accept further write data).
|
||||
* These functions will traverse each active uIP connection structure and
|
||||
* perform appropriate operatios: uip_timer() will perform TCP timer
|
||||
* operations (and UDP polling operations); uip_poll() will perform TCP
|
||||
* and UDP polling operations. The CAN driver MUST implement logic to
|
||||
* periodically call uip_timer(); uip_poll() may be called asychronously
|
||||
* from the network driver can accept another outgoing packet.
|
||||
*
|
||||
* This function should be called periodically with event == UIP_DRV_TIMER
|
||||
* to perform TCP. This function may also be called with UIP_DRV_POLL to
|
||||
* obtain pending TX data.
|
||||
*
|
||||
* This function is called from the CAN device driver and may be called from
|
||||
* the timer interrupt/watchdog handle level.
|
||||
* In both cases, these functions will call the provided callback function
|
||||
* for every active connection. Polling will continue until all connections
|
||||
* have been polled or until the user-suplied function returns a non-zero
|
||||
* value (which it should do only if it cannot accept further write data).
|
||||
*
|
||||
* When the callback function is called, there may be an outbound packet
|
||||
* waiting for service in the uIP packet buffer, and if so the d_len field
|
||||
* is set to a value larger than zero. The device driver should be called to
|
||||
* send out the packet.
|
||||
* is set to a value larger than zero. The device driver should then send
|
||||
* out the packet.
|
||||
*
|
||||
* Example:
|
||||
* int driver_callback(struct uip_driver_dev *dev)
|
||||
@@ -282,7 +253,7 @@ struct uip_driver_s
|
||||
* }
|
||||
*
|
||||
* ...
|
||||
* uip_poll(dev, driver_callback, UIP_DRV_TIMER);
|
||||
* uip_poll(dev, driver_callback);
|
||||
*
|
||||
* Note: If you are writing a uIP device driver that needs ARP (Address
|
||||
* Resolution Protocol), e.g., when running uIP over Ethernet, you will
|
||||
@@ -302,19 +273,8 @@ struct uip_driver_s
|
||||
*/
|
||||
|
||||
typedef int (*uip_poll_callback_t)(struct uip_driver_s *dev);
|
||||
extern int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback, int event);
|
||||
|
||||
/* uip_poll helper functions */
|
||||
|
||||
#define uip_periodic(dev,cb) uip_poll(dev, db, UIP_DRV_TIMER);
|
||||
|
||||
/* Architecure support
|
||||
*
|
||||
* The actual uIP function which does all the work. Called from the
|
||||
* interrupt level by a device driver.
|
||||
*/
|
||||
|
||||
extern void uip_interrupt(struct uip_driver_s *dev, uint8 event);
|
||||
extern int uip_poll(struct uip_driver_s *dev, uip_poll_callback_t callback);
|
||||
extern int uip_timer(struct uip_driver_s *dev, uip_poll_callback_t callback, int hsec);
|
||||
|
||||
/* By defining UIP_ARCH_CHKSUM, the architecture can replace the following
|
||||
* functions with hardware assisted solutions.
|
||||
@@ -322,23 +282,23 @@ extern void uip_interrupt(struct uip_driver_s *dev, uint8 event);
|
||||
|
||||
/* Carry out a 32-bit addition.
|
||||
*
|
||||
* Because not all architectures for which uIP is intended has native
|
||||
* 32-bit arithmetic, uIP uses an external C function for doing the
|
||||
* required 32-bit additions in the TCP protocol processing. This
|
||||
* function should add the two arguments and place the result in the
|
||||
* global variable uip_acc32.
|
||||
* op32 - A pointer to a 4-byte array representing a 32-bit
|
||||
* integer in network byte order (big endian). This value may not
|
||||
* be word aligned.
|
||||
*
|
||||
* Note: The 32-bit integer pointed to by the op32 parameter and the
|
||||
* result in the uip_acc32 variable are in network byte order (big
|
||||
* endian).
|
||||
* For uip_incr32, the value pointed to by op32 is modified in place
|
||||
* For uip_add32, the value pointed to by op32 is unmodified
|
||||
*
|
||||
* op16 - A 16-bit integer in host byte order.
|
||||
*
|
||||
* op32 A pointer to a 4-byte array representing a 32-bit
|
||||
* integer in network byte order (big endian).
|
||||
* sum - The location to return the result (32-bit, network byte order,
|
||||
* possibly unaligned).
|
||||
*
|
||||
* op16 A 16-bit integer in host byte order.
|
||||
* uip_add32 only.
|
||||
*/
|
||||
|
||||
extern void uip_add32(uint8 *op32, uint16 op16);
|
||||
extern void uip_add32(const uint8 *op32, uint16 op16, uint8 *sum);
|
||||
extern void uip_incr32(uint8 *op32, uint16 op16);
|
||||
|
||||
/* Calculate the Internet checksum over a buffer.
|
||||
*
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
struct uip_eth_hdr
|
||||
{
|
||||
|
||||
uint8 dest[6]; /* Ethernet destination address (6 bytes) */
|
||||
uint8 src[6]; /* Ethernet source address (6 bytes) */
|
||||
uint16 type; /* Type code (2 bytes) */
|
||||
|
||||
@@ -42,9 +42,33 @@
|
||||
#ifndef __UIPLIB_H__
|
||||
#define __UIPLIB_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <pthread.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* SOCK_DGRAM is the preferred socket type to use when we just want a
|
||||
* socket for performing drive ioctls. However, we can't use SOCK_DRAM
|
||||
* if UDP is disabled.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_UDP
|
||||
# define UIPLIB_SOCK_IOCTL SOCK_DGRAM
|
||||
#else
|
||||
# define UIPLIB_SOCK_IOCTL SOCK_STREAM
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Convert a textual representation of an IP address to a numerical representation.
|
||||
*
|
||||
* This function takes a textual representation of an IP address in
|
||||
@@ -80,4 +104,8 @@ extern int uip_setdraddr(const char *ifname, const struct in_addr *addr);
|
||||
extern int uip_setnetmask(const char *ifname, const struct in_addr *addr);
|
||||
#endif
|
||||
|
||||
/* Generic server logic */
|
||||
|
||||
extern void uip_server(uint16 portno, pthread_startroutine_t handler, int stacksize);
|
||||
|
||||
#endif /* __UIPLIB_H__ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -69,22 +69,6 @@
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Static configuration options */
|
||||
|
||||
/* Ping IP address asignment.
|
||||
*
|
||||
* uIP uses a "ping" packets for setting its own IP address if this
|
||||
* option is set. If so, uIP will start with an empty IP address and
|
||||
* the destination IP address of the first incoming "ping" (ICMP echo)
|
||||
* packet will be used for setting the hosts IP address.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_PINGADDRCONF
|
||||
#define UIP_PINGADDRCONF CONFIG_NET_PINGADDRCONF
|
||||
#else /* CONFIG_NET_PINGADDRCONF */
|
||||
#define UIP_PINGADDRCONF 0
|
||||
#endif /* CONFIG_NET_PINGADDRCONF */
|
||||
|
||||
/* IP configuration options */
|
||||
|
||||
/* The IP TTL (time to live) of IP packets sent by uIP.
|
||||
@@ -92,7 +76,7 @@
|
||||
* This should normally not be changed.
|
||||
*/
|
||||
|
||||
#define UIP_TTL 64
|
||||
#define UIP_TTL 64
|
||||
|
||||
/* Turn on support for IP packet reassembly.
|
||||
*
|
||||
@@ -100,7 +84,7 @@
|
||||
* requires an additonal amount of RAM to hold the reassembly buffer
|
||||
* and the reassembly code size is approximately 700 bytes. The
|
||||
* reassembly buffer is of the same size as the d_buf buffer
|
||||
* (configured by UIP_BUFSIZE).
|
||||
* (configured by CONFIG_NET_BUFSIZE).
|
||||
*
|
||||
* Note: IP packet reassembly is not heavily tested.
|
||||
*/
|
||||
@@ -108,33 +92,20 @@
|
||||
#define UIP_REASSEMBLY 0
|
||||
|
||||
/* The maximum time an IP fragment should wait in the reassembly
|
||||
* buffer before it is dropped.
|
||||
* buffer before it is dropped. Units are deci-seconds, the range
|
||||
* of the timer is 8-bits.
|
||||
*/
|
||||
|
||||
#define UIP_REASS_MAXAGE 40
|
||||
#define UIP_REASS_MAXAGE (20*10) /* 20 seconds */
|
||||
|
||||
/* UDP configuration options */
|
||||
|
||||
/* Toggles if UDP checksums should be used or not.
|
||||
*
|
||||
* Note: Support for UDP checksums is currently not included in uIP,
|
||||
* so this option has no function.
|
||||
*/
|
||||
/* The maximum amount of concurrent UDP connection, Default: 10 */
|
||||
|
||||
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
||||
# define UIP_UDP_CHECKSUMS CONFIG_NET_UDP_CHECKSUMS
|
||||
#else
|
||||
# define UIP_UDP_CHECKSUMS 0
|
||||
#ifndef CONFIG_NET_UDP_CONNS
|
||||
# define CONFIG_NET_UDP_CONNS 10
|
||||
#endif
|
||||
|
||||
/* The maximum amount of concurrent UDP connections. */
|
||||
|
||||
#ifdef CONFIG_NET_UDP_CONNS
|
||||
# define UIP_UDP_CONNS CONFIG_NET_UDP_CONNS
|
||||
#else /* CONFIG_NET_UDP_CONNS */
|
||||
# define UIP_UDP_CONNS 10
|
||||
#endif /* CONFIG_NET_UDP_CONNS */
|
||||
|
||||
/* TCP configuration options */
|
||||
|
||||
/* The maximum number of simultaneously open TCP connections.
|
||||
@@ -144,11 +115,9 @@
|
||||
* connection requires approximatly 30 bytes of memory.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_MAX_CONNECTIONS
|
||||
# define UIP_CONNS 10
|
||||
#else /* CONFIG_NET_MAX_CONNECTIONS */
|
||||
# define UIP_CONNS CONFIG_NET_MAX_CONNECTIONS
|
||||
#endif /* CONFIG_NET_MAX_CONNECTIONS */
|
||||
#ifndef CONFIG_NET_TCP_CONNS
|
||||
# define CONFIG_NET_TCP_CONNS 10
|
||||
#endif
|
||||
|
||||
/* The maximum number of simultaneously listening TCP ports.
|
||||
*
|
||||
@@ -156,10 +125,8 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_MAX_LISTENPORTS
|
||||
# define UIP_LISTENPORTS 20
|
||||
#else /* CONFIG_NET_MAX_LISTENPORTS */
|
||||
# define UIP_LISTENPORTS CONFIG_NET_MAX_LISTENPORTS
|
||||
#endif /* CONFIG_NET_MAX_LISTENPORTS */
|
||||
# define CONFIG_NET_MAX_LISTENPORTS 20
|
||||
#endif
|
||||
|
||||
/* Determines if support for TCP urgent data notification should be
|
||||
* compiled in.
|
||||
@@ -168,14 +135,14 @@
|
||||
* very seldom would be required.
|
||||
*/
|
||||
|
||||
#define UIP_URGDATA 0
|
||||
#define UIP_URGDATA 0
|
||||
|
||||
/* The initial retransmission timeout counted in timer pulses.
|
||||
*
|
||||
* This should not be changed.
|
||||
*/
|
||||
|
||||
#define UIP_RTO 3
|
||||
#define UIP_RTO 3
|
||||
|
||||
/* The maximum number of times a segment should be retransmitted
|
||||
* before the connection should be aborted.
|
||||
@@ -183,7 +150,7 @@
|
||||
* This should not be changed.
|
||||
*/
|
||||
|
||||
#define UIP_MAXRTX 8
|
||||
#define UIP_MAXRTX 8
|
||||
|
||||
/* The maximum number of times a SYN segment should be retransmitted
|
||||
* before a connection request should be deemed to have been
|
||||
@@ -192,15 +159,15 @@
|
||||
* This should not need to be changed.
|
||||
*/
|
||||
|
||||
#define UIP_MAXSYNRTX 5
|
||||
#define UIP_MAXSYNRTX 5
|
||||
|
||||
/* The TCP maximum segment size.
|
||||
*
|
||||
* This is should not be to set to more than
|
||||
* UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
|
||||
* CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN.
|
||||
*/
|
||||
|
||||
#define UIP_TCP_MSS (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
|
||||
#define UIP_TCP_MSS (CONFIG_NET_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
|
||||
|
||||
/* The size of the advertised receiver's window.
|
||||
*
|
||||
@@ -210,18 +177,16 @@
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_RECEIVE_WINDOW
|
||||
# define UIP_RECEIVE_WINDOW UIP_TCP_MSS
|
||||
#else
|
||||
# define UIP_RECEIVE_WINDOW CONFIG_NET_RECEIVE_WINDOW
|
||||
# define CONFIG_NET_RECEIVE_WINDOW UIP_TCP_MSS
|
||||
#endif
|
||||
|
||||
/* How long a connection should stay in the TIME_WAIT state.
|
||||
*
|
||||
* This configiration option has no real implication, and it should be
|
||||
* left untouched.
|
||||
* left untouched. Units: half second.
|
||||
*/
|
||||
|
||||
#define UIP_TIME_WAIT_TIMEOUT 120
|
||||
#define UIP_TIME_WAIT_TIMEOUT (60*2)
|
||||
|
||||
/* ARP configuration options */
|
||||
|
||||
@@ -231,10 +196,8 @@
|
||||
* have many connections from the local network.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_ARPTAB_SIZE
|
||||
# define UIP_ARPTAB_SIZE CONFIG_NET_ARPTAB_SIZE
|
||||
#else
|
||||
# define UIP_ARPTAB_SIZE 8
|
||||
#ifndef CONFIG_NET_ARPTAB_SIZE
|
||||
# define CONFIG_NET_ARPTAB_SIZE 8
|
||||
#endif
|
||||
|
||||
/* The maxium age of ARP table entries measured in 10ths of seconds.
|
||||
@@ -254,34 +217,21 @@
|
||||
* TCP throughput, larger size results in higher TCP throughput.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_BUFFER_SIZE
|
||||
# define UIP_BUFSIZE 400
|
||||
#else /* CONFIG_NET_BUFFER_SIZE */
|
||||
# define UIP_BUFSIZE CONFIG_NET_BUFFER_SIZE
|
||||
#endif /* CONFIG_NET_BUFFER_SIZE */
|
||||
#ifndef CONFIG_NET_BUFSIZE
|
||||
# define CONFIG_NET_BUFSIZE 400
|
||||
#endif
|
||||
|
||||
/* Determines if statistics support should be compiled in.
|
||||
*
|
||||
* The statistics is useful for debugging and to show the user.
|
||||
*/
|
||||
/* Number of TCP read-ahead buffers (may be zero) */
|
||||
|
||||
#ifndef CONFIG_NET_STATISTICS
|
||||
# define UIP_STATISTICS 0
|
||||
#else /* CONFIG_NET_STATISTICS */
|
||||
# define UIP_STATISTICS CONFIG_NET_STATISTICS
|
||||
#endif /* CONFIG_NET_STATISTICS */
|
||||
#ifndef CONFIG_NET_NTCP_READAHEAD_BUFFERS
|
||||
# define CONFIG_NET_NTCP_READAHEAD_BUFFERS 4
|
||||
#endif
|
||||
|
||||
/* Broadcast support.
|
||||
*
|
||||
* This flag configures IP broadcast support. This is useful only
|
||||
* together with UDP.
|
||||
*/
|
||||
/* The size of the TCP read buffer size */
|
||||
|
||||
#ifndef CONFIG_NET_BROADCAST
|
||||
# define UIP_BROADCAST 0
|
||||
#else /* CONFIG_NET_BROADCAST */
|
||||
# define UIP_BROADCAST CONFIG_NET_BROADCAST
|
||||
#endif /* CONFIG_NET_BROADCAST */
|
||||
#ifndef CONFIG_NET_TCP_READAHEAD_BUFSIZE
|
||||
# define CONFIG_NET_TCP_READAHEAD_BUFSIZE UIP_TCP_MSS
|
||||
#endif
|
||||
|
||||
/* The link level header length.
|
||||
*
|
||||
@@ -292,32 +242,8 @@
|
||||
|
||||
#ifdef CONFIG_NET_LLH_LEN
|
||||
# define UIP_LLH_LEN CONFIG_NET_LLH_LEN
|
||||
#else /* CONFIG_NET_LLH_LEN */
|
||||
# define UIP_LLH_LEN 14
|
||||
#endif /* CONFIG_NET_LLH_LEN */
|
||||
|
||||
/* CPU architecture configuration
|
||||
*
|
||||
* The CPU architecture configuration is where the endianess of the
|
||||
* CPU on which uIP is to be run is specified. Most CPUs today are
|
||||
* little endian, and the most notable exception are the Motorolas
|
||||
* which are big endian. The CONFIG_ENDIAN_BIG macro should be changed
|
||||
* if uIP is to be run on a big endian architecture.
|
||||
*/
|
||||
|
||||
/* The byte order of the CPU architecture on which uIP is to be run.
|
||||
*
|
||||
* This option can be either CONFIG_ENDIAN_BIG (Motorola byte order) or
|
||||
* default little endian byte order (Intel byte order).
|
||||
*/
|
||||
|
||||
#define UIP_BIG_ENDIAN 1234
|
||||
#define UIP_LITTLE_ENDIAN 3412
|
||||
|
||||
#ifdef CONFIG_ENDIAN_BIG
|
||||
# define UIP_BYTE_ORDER UIP_BIG_ENDIAN
|
||||
#else
|
||||
# define UIP_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||
# define UIP_LLH_LEN 14
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
11
lib/Makefile
11
lib/Makefile
@@ -1,5 +1,5 @@
|
||||
############################################################################
|
||||
# Makefile
|
||||
# lib/Makefile
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
@@ -45,10 +45,11 @@ ifneq ($(CONFIG_NFILE_STREAMS),0)
|
||||
MISC_SRCS += lib_streamsem.c
|
||||
endif
|
||||
|
||||
STRING_SRCS = lib_memset.c lib_memcpy.c lib_memcmp.c lib_memmove.c lib_strcpy.c \
|
||||
lib_strncpy.c lib_strcmp.c lib_strlen.c lib_strdup.c lib_strtol.c lib_strchr.c \
|
||||
lib_strrchr.c lib_strspn.c lib_strcspn.c lib_strtok.c lib_strtokr.c \
|
||||
lib_strerror.c
|
||||
STRING_SRCS = lib_memset.c lib_memcpy.c lib_memcmp.c lib_memmove.c \
|
||||
lib_strcpy.c lib_strncpy.c lib_strcmp.c lib_strncmp.c \
|
||||
lib_strlen.c lib_strdup.c lib_strtol.c lib_strchr.c \
|
||||
lib_strrchr.c lib_strspn.c lib_strcspn.c lib_strtok.c \
|
||||
lib_strtokr.c lib_strerror.c
|
||||
|
||||
CTYPE_SRCS =
|
||||
|
||||
|
||||
65
lib/lib_strncmp.c
Normal file
65
lib/lib_strncmp.c
Normal file
@@ -0,0 +1,65 @@
|
||||
/************************************************************
|
||||
* lib_strncmp.c
|
||||
*
|
||||
* Copyright (C) 2007 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 Gregory Nutt 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.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Compilation Switches
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
|
||||
/************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRNCMP
|
||||
int strncmp(const char *cs, const char *ct, size_t nb)
|
||||
{
|
||||
register signed char result = 0;
|
||||
for (; nb > 0; nb--)
|
||||
{
|
||||
if ((result = *cs - *ct++) != 0 || !*cs++)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
49
net/accept.c
49
net/accept.c
@@ -42,9 +42,12 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <semaphore.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
#include "net-internal.h"
|
||||
@@ -61,7 +64,6 @@ struct accept_s
|
||||
#else
|
||||
FAR const struct sockaddr_in *acpt_addr; /* Return connection adress */
|
||||
#endif
|
||||
FAR struct uip_conn *acpt_listenconn; /* The listener connection */
|
||||
FAR struct uip_conn *acpt_newconn; /* The accepted connection */
|
||||
int acpt_result; /* The result of the wait */
|
||||
};
|
||||
@@ -80,29 +82,41 @@ struct accept_s
|
||||
* Description:
|
||||
* Receive interrupt level callbacks when connections occur
|
||||
*
|
||||
* Parameters:
|
||||
* listener The conection stucture of the listener
|
||||
* conn The connection stucture that was just accepted
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Running at the interrupt level
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int accept_interrupt(void *private, struct uip_conn *conn)
|
||||
static int accept_interrupt(struct uip_conn *listener, struct uip_conn *conn)
|
||||
{
|
||||
struct accept_s *pstate = (struct accept_s *)private;
|
||||
struct accept_s *pstate = (struct accept_s *)listener->accept_private;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (pstate)
|
||||
{
|
||||
/* Get the connection address */
|
||||
#warning "need to return the address of the connection"
|
||||
|
||||
/* Save the connection structure */
|
||||
|
||||
pstate->acpt_newconn = conn;
|
||||
pstate->acpt_result = OK;
|
||||
|
||||
pstate->acpt_newconn = conn;
|
||||
pstate->acpt_result = OK;
|
||||
sem_post(&pstate->acpt_sem);
|
||||
|
||||
|
||||
/* Stop any further callbacks */
|
||||
|
||||
pstate->acpt_listenconn->accept_private = NULL;
|
||||
pstate->acpt_listenconn->accept = NULL;
|
||||
ret = OK;
|
||||
listener->accept_private = NULL;
|
||||
listener->accept = NULL;
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -256,12 +270,12 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
}
|
||||
|
||||
pnewsock = sockfd_socket(newfd);
|
||||
if (newfd)
|
||||
if (!pnewsock)
|
||||
{
|
||||
err = ENFILE;
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
|
||||
/* Set the socket state to accepting */
|
||||
|
||||
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_ACCEPT);
|
||||
@@ -275,9 +289,9 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
|
||||
save = irqsave();
|
||||
state.acpt_addr = inaddr;
|
||||
state.acpt_listenconn = psock->s_conn;
|
||||
state.acpt_newconn = NULL;
|
||||
state.acpt_result = OK;
|
||||
sem_init(&state.acpt_sem, 0, 0);
|
||||
|
||||
/* Set up the callback in the connection */
|
||||
|
||||
@@ -291,7 +305,7 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
* automatically re-enabled when the task restarts.
|
||||
*/
|
||||
|
||||
ret = sem_wait(&state. acpt_sem);
|
||||
ret = sem_wait(&state.acpt_sem);
|
||||
|
||||
/* Make sure that no further interrupts are processed */
|
||||
|
||||
@@ -325,10 +339,11 @@ int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
|
||||
goto errout_with_socket;
|
||||
}
|
||||
|
||||
/* Initialize the socket structure */
|
||||
/* Initialize the socket structure and mark the socket as connected */
|
||||
|
||||
pnewsock->s_type = SOCK_STREAM;
|
||||
pnewsock->s_conn = state.acpt_newconn;
|
||||
pnewsock->s_type = SOCK_STREAM;
|
||||
pnewsock->s_conn = state.acpt_newconn;
|
||||
pnewsock->s_flags |= _SF_CONNECTED;
|
||||
return newfd;
|
||||
|
||||
errout_with_socket:
|
||||
|
||||
@@ -128,7 +128,7 @@ int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
err = -EBADF;
|
||||
err = EBADF;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,11 +65,12 @@ struct tcp_connect_s
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static void connection_event(void *private);
|
||||
static void connection_event(struct uip_conn *conn, uint8 flags);
|
||||
static inline void tcp_setup_callbacks(struct uip_conn *conn, FAR struct socket *psock,
|
||||
FAR struct tcp_connect_s *pstate);
|
||||
static inline void tcp_teardown_callbacks(struct uip_conn *conn, int status);
|
||||
static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private);
|
||||
static uint8 tcp_connect_interrupt(struct uip_driver_s *dev,
|
||||
struct uip_conn *conn, uint8 flags);
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
static inline int tcp_connect(FAR struct socket *psock, const struct sockaddr_in6 *inaddr);
|
||||
#else
|
||||
@@ -87,7 +88,8 @@ static inline int tcp_connect(FAR struct socket *psock, const struct sockaddr_in
|
||||
*
|
||||
* Parameters:
|
||||
* dev The sructure of the network driver that caused the interrupt
|
||||
* private An instance of struct recvfrom_s cast to void*
|
||||
* conn The connection structure associated with the socket
|
||||
* flags Set of events describing why the callback was invoked
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -97,19 +99,19 @@ static inline int tcp_connect(FAR struct socket *psock, const struct sockaddr_in
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void connection_event(void *private)
|
||||
static void connection_event(struct uip_conn *conn, uint8 flags)
|
||||
{
|
||||
FAR struct socket *psock = (FAR struct socket *)private;
|
||||
FAR struct socket *psock = (FAR struct socket *)conn->connection_private;
|
||||
|
||||
if (psock)
|
||||
{
|
||||
vdbg("uip_flags: %02x s_flags: %02x\n", uip_flags, psock->s_flags);
|
||||
vdbg("flags: %02x s_flags: %02x\n", flags, psock->s_flags);
|
||||
|
||||
/* UIP_CLOSE: The remote host has closed the connection
|
||||
* UIP_ABORT: The remote host has aborted the connection
|
||||
* UIP_TIMEDOUT: Connection aborted due to too many retransmissions.
|
||||
*/
|
||||
if ((uip_flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
{
|
||||
/* Indicate that the socket is no longer connected */
|
||||
|
||||
@@ -118,7 +120,7 @@ static void connection_event(void *private)
|
||||
|
||||
/* UIP_CONNECTED: The socket is successfully connected */
|
||||
|
||||
else if ((uip_flags & UIP_CONNECTED) != 0)
|
||||
else if ((flags & UIP_CONNECTED) != 0)
|
||||
{
|
||||
/* Indicate that the socket is now connected */
|
||||
|
||||
@@ -178,7 +180,8 @@ static inline void tcp_teardown_callbacks(struct uip_conn *conn, int status)
|
||||
*
|
||||
* Parameters:
|
||||
* dev The sructure of the network driver that caused the interrupt
|
||||
* private An instance of struct recvfrom_s cast to void*
|
||||
* conn The connection structure associated with the socket
|
||||
* flags Set of events describing why the callback was invoked
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -188,11 +191,12 @@ static inline void tcp_teardown_callbacks(struct uip_conn *conn, int status)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
static uint8 tcp_connect_interrupt(struct uip_driver_s *dev,
|
||||
struct uip_conn *conn, uint8 flags)
|
||||
{
|
||||
struct tcp_connect_s *pstate = (struct tcp_connect_s *)private;
|
||||
struct tcp_connect_s *pstate = (struct tcp_connect_s *)conn->data_private;
|
||||
|
||||
vdbg("uip_flags: %02x\n", uip_flags);
|
||||
vdbg("flags: %02x\n", flags);
|
||||
|
||||
/* 'private' might be null in some race conditions (?) */
|
||||
|
||||
@@ -213,7 +217,7 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
* UIP_ABORT: The remote host has aborted the connection
|
||||
*/
|
||||
|
||||
if ((uip_flags & (UIP_CLOSE|UIP_ABORT)) != 0)
|
||||
if ((flags & (UIP_CLOSE|UIP_ABORT)) != 0)
|
||||
{
|
||||
/* Indicate that remote host refused the connection */
|
||||
|
||||
@@ -222,7 +226,7 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* UIP_TIMEDOUT: Connection aborted due to too many retransmissions. */
|
||||
|
||||
else if ((uip_flags & UIP_TIMEDOUT) != 0)
|
||||
else if ((flags & UIP_TIMEDOUT) != 0)
|
||||
{
|
||||
/* Indicate that the remote host is unreachable (or should this be timedout?) */
|
||||
|
||||
@@ -231,7 +235,7 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* UIP_CONNECTED: The socket is successfully connected */
|
||||
|
||||
else if ((uip_flags & UIP_CONNECTED) != 0)
|
||||
else if ((flags & UIP_CONNECTED) != 0)
|
||||
{
|
||||
/* Indicate that the socket is no longer connected */
|
||||
|
||||
@@ -242,7 +246,7 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
else
|
||||
{
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
vdbg("Resuming: %d\n", pstate->tc_result);
|
||||
@@ -255,6 +259,8 @@ static void tcp_connect_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
sem_post(&pstate->tc_sem);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -87,8 +87,6 @@ static WDOG_ID g_arptimer; /* ARP timer */
|
||||
|
||||
static void arptimer_poll(int argc, uint32 arg, ...)
|
||||
{
|
||||
dbg("ARP timer expiration\n");
|
||||
|
||||
/* Call the ARP timer function every 10 seconds. */
|
||||
|
||||
uip_arp_timer();
|
||||
|
||||
@@ -100,7 +100,7 @@ void net_initialize(void)
|
||||
{
|
||||
/* Initialize the uIP layer */
|
||||
|
||||
uip_init();
|
||||
uip_initialize();
|
||||
|
||||
/* Initialize the socket layer */
|
||||
|
||||
|
||||
@@ -41,7 +41,10 @@
|
||||
#if defined(CONFIG_NET) && defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
#include "net-internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -70,6 +73,7 @@ int net_timeo(uint32 start_time, socktimeo_t timeo)
|
||||
{
|
||||
uint32 timeo_ticks = DSEC2TICK(timeo);
|
||||
uint32 elapsed = g_system_timer - start_time;
|
||||
|
||||
if (elapsed >= timeo_ticks)
|
||||
{
|
||||
return TRUE;
|
||||
@@ -78,3 +82,4 @@ int net_timeo(uint32 start_time, socktimeo_t timeo)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_SOCKOPTS && !CONFIG_DISABLE_CLOCK */
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ int netdev_ioctl(int sockfd, int cmd, struct ifreq *req)
|
||||
break;
|
||||
|
||||
case SIOCGIFMTU: /* Get MTU size */
|
||||
req->ifr_mtu = UIP_BUFSIZE;
|
||||
req->ifr_mtu = CONFIG_NET_BUFSIZE;
|
||||
break;
|
||||
|
||||
case SIOCGIFHWADDR: /* Get hardware address */
|
||||
|
||||
496
net/recvfrom.c
496
net/recvfrom.c
File diff suppressed because it is too large
Load Diff
34
net/send.c
34
net/send.c
@@ -89,7 +89,8 @@ struct send_s
|
||||
*
|
||||
* Parameters:
|
||||
* dev The sructure of the network driver that caused the interrupt
|
||||
* private An instance of struct send_s cast to void*
|
||||
* conn The connection structure associated with the socket
|
||||
* flags Set of events describing why the callback was invoked
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -99,22 +100,21 @@ struct send_s
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void send_interrupt(struct uip_driver_s *dev, void *private)
|
||||
static uint8 send_interrupt(struct uip_driver_s *dev, struct uip_conn *conn, uint8 flags)
|
||||
{
|
||||
struct send_s *pstate = (struct send_s *)private;
|
||||
struct uip_conn *conn;
|
||||
struct send_s *pstate = (struct send_s *)conn->data_private;
|
||||
|
||||
vdbg("uip_flags: %02x state: %d\n", uip_flags, pstate->snd_state);
|
||||
vdbg("flags: %02x state: %d\n", flags, pstate->snd_state);
|
||||
|
||||
/* If the data has not been sent OR if it needs to be retransmitted,
|
||||
* then send it now.
|
||||
*/
|
||||
|
||||
if (pstate->snd_state != STATE_DATA_SENT || uip_rexmit_event())
|
||||
if (pstate->snd_state != STATE_DATA_SENT || uip_rexmit_event(flags))
|
||||
{
|
||||
if (pstate->snd_buflen > uip_mss())
|
||||
if (pstate->snd_buflen > uip_mss(conn))
|
||||
{
|
||||
uip_send(dev, pstate->snd_buffer, uip_mss());
|
||||
uip_send(dev, pstate->snd_buffer, uip_mss(conn));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,17 +126,17 @@ static void send_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* Check if all data has been sent and acknowledged */
|
||||
|
||||
else if (pstate->snd_state == STATE_DATA_SENT && uip_ack_event())
|
||||
else if (pstate->snd_state == STATE_DATA_SENT && uip_ack_event(flags))
|
||||
{
|
||||
/* Yes.. the data has been sent AND acknowledged */
|
||||
|
||||
if (pstate->snd_buflen > uip_mss())
|
||||
if (pstate->snd_buflen > uip_mss(conn))
|
||||
{
|
||||
/* Not all data has been sent */
|
||||
|
||||
pstate->snd_sent += uip_mss();
|
||||
pstate->snd_buflen -= uip_mss();
|
||||
pstate->snd_buffer += uip_mss();
|
||||
pstate->snd_sent += uip_mss(conn);
|
||||
pstate->snd_buflen -= uip_mss(conn);
|
||||
pstate->snd_buffer += uip_mss(conn);
|
||||
|
||||
/* Send again on the next poll */
|
||||
|
||||
@@ -152,7 +152,6 @@ static void send_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
conn = (struct uip_conn *)pstate->snd_sock->s_conn;
|
||||
conn->data_private = NULL;
|
||||
conn->data_event = NULL;
|
||||
|
||||
@@ -166,11 +165,10 @@ static void send_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* Check for a loss of connection */
|
||||
|
||||
else if ((uip_flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
{
|
||||
/* Stop further callbacks */
|
||||
|
||||
conn = (struct uip_conn *)pstate->snd_sock->s_conn;
|
||||
conn->data_private = NULL;
|
||||
conn->data_event = NULL;
|
||||
|
||||
@@ -182,6 +180,8 @@ static void send_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
sem_post(&pstate->snd_sem);
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -259,7 +259,7 @@ ssize_t send(int sockfd, const void *buf, size_t len, int flags)
|
||||
struct send_s state;
|
||||
irqstate_t save;
|
||||
int err;
|
||||
int ret;
|
||||
int ret = OK;
|
||||
|
||||
/* Verify that the sockfd corresponds to valid, allocated socket */
|
||||
|
||||
|
||||
13
net/sendto.c
13
net/sendto.c
@@ -79,6 +79,7 @@ struct sendto_s
|
||||
* Parameters:
|
||||
* dev The sructure of the network driver that caused the interrupt
|
||||
* private An instance of struct sendto_s cast to void*
|
||||
* flags Set of events describing why the callback was invoked
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
@@ -89,14 +90,14 @@ struct sendto_s
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UDP
|
||||
void sendto_interrupt(struct uip_driver_s *dev, void *private)
|
||||
void sendto_interrupt(struct uip_driver_s *dev, struct uip_udp_conn *conn, uint8 flags)
|
||||
{
|
||||
struct sendto_s *pstate = (struct sendto_s *)private;
|
||||
if (private)
|
||||
struct sendto_s *pstate = (struct sendto_s *)conn->private;
|
||||
if (pstate)
|
||||
{
|
||||
/* Check if the connectin was rejected */
|
||||
|
||||
if ((uip_flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0)
|
||||
{
|
||||
pstate->st_sndlen = -ENOTCONN;
|
||||
}
|
||||
@@ -111,8 +112,8 @@ void sendto_interrupt(struct uip_driver_s *dev, void *private)
|
||||
|
||||
/* Don't allow any further call backs. */
|
||||
|
||||
uip_udp_conn->private = NULL;
|
||||
uip_udp_conn->event = NULL;
|
||||
conn->private = NULL;
|
||||
conn->event = NULL;
|
||||
|
||||
/* Wake up the waiting thread */
|
||||
|
||||
|
||||
@@ -135,7 +135,10 @@ int socket(int domain, int type, int protocol)
|
||||
psock->s_type = type;
|
||||
psock->s_conn = NULL;
|
||||
|
||||
/* Allocate the appropriate connection structure */
|
||||
/* Allocate the appropriate connection structure. This reserves the
|
||||
* the connection structure is is unallocated at this point. It will
|
||||
* not actually be initialized until the socket is connected.
|
||||
*/
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
# 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.
|
||||
#
|
||||
@@ -34,6 +34,38 @@
|
||||
############################################################################
|
||||
|
||||
UIP_ASRCS =
|
||||
UIP_CSRCS = uip-arp.c uip.c uip-send.c uip-fw.c uip-neighbor.c uip-split.c \
|
||||
uip-tcpconn.c uip-udpconn.c uip-listen.c uip-poll.c
|
||||
UIP_CSRCS =
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
|
||||
# Common network source files
|
||||
|
||||
UIP_CSRCS += uip-initialize.c uip-setipid.c uip-arp.c uip-input.c uip-send.c \
|
||||
uip-fw.c uip-split.c uip-poll.c uip-chksum.c
|
||||
|
||||
ifeq ($(CONFIG_NET_IPv6),y)
|
||||
UIP_CSRCS += uip-neighbor.c
|
||||
endif
|
||||
|
||||
# TCP source files
|
||||
|
||||
UIP_CSRCS += uip-tcpconn.c uip-tcppoll.c uip-tcptimer.c uip-tcpsend.c \
|
||||
uip-tcpinput.c uip-tcpappsend.c uip-listen.c uip-tcpcallback.c \
|
||||
uip-tcpreadahead.c
|
||||
|
||||
# UDP source files
|
||||
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
|
||||
UIP_CSRCS += uip-udpconn.c uip-udppoll.c uip-udpsend.c uip-udpinput.c \
|
||||
uip-udpcallback.c
|
||||
|
||||
endif
|
||||
|
||||
#ICMP source files
|
||||
|
||||
UIP_CSRCS += uip-icmpinput.c
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ static const struct uip_eth_addr broadcast_ethaddr =
|
||||
{{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
|
||||
static const uint16 broadcast_ipaddr[2] = {0xffff, 0xffff};
|
||||
|
||||
static struct arp_entry arp_table[UIP_ARPTAB_SIZE];
|
||||
static struct arp_entry arp_table[CONFIG_NET_ARPTAB_SIZE];
|
||||
static uint8 g_arptime;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ static void uip_arp_update(uint16 *pipaddr, uint8 *ethaddr)
|
||||
* inserted in the ARP table.
|
||||
*/
|
||||
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
tabptr = &arp_table[i];
|
||||
|
||||
@@ -198,7 +198,7 @@ static void uip_arp_update(uint16 *pipaddr, uint8 *ethaddr)
|
||||
|
||||
/* First, we try to find an unused entry in the ARP table. */
|
||||
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
tabptr = &arp_table[i];
|
||||
if (tabptr->at_ipaddr == 0)
|
||||
@@ -211,11 +211,11 @@ static void uip_arp_update(uint16 *pipaddr, uint8 *ethaddr)
|
||||
* throw it away.
|
||||
*/
|
||||
|
||||
if (i == UIP_ARPTAB_SIZE)
|
||||
if (i == CONFIG_NET_ARPTAB_SIZE)
|
||||
{
|
||||
uint8 tmpage = 0;
|
||||
int j = 0;
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
tabptr = &arp_table[i];
|
||||
if (g_arptime - tabptr->at_time > tmpage)
|
||||
@@ -246,7 +246,7 @@ static void uip_arp_update(uint16 *pipaddr, uint8 *ethaddr)
|
||||
void uip_arp_init(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
memset(&arp_table[i].at_ipaddr, 0, sizeof(in_addr_t));
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void uip_arp_timer(void)
|
||||
int i;
|
||||
|
||||
++g_arptime;
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
tabptr = &arp_table[i];
|
||||
if (tabptr->at_ipaddr != 0 && g_arptime - tabptr->at_time >= UIP_ARP_MAXAGE)
|
||||
@@ -451,7 +451,7 @@ void uip_arp_out(struct uip_driver_s *dev)
|
||||
|
||||
/* Check if we already have this destination address in the ARP table */
|
||||
|
||||
for (i = 0; i < UIP_ARPTAB_SIZE; ++i)
|
||||
for (i = 0; i < CONFIG_NET_ARPTAB_SIZE; ++i)
|
||||
{
|
||||
tabptr = &arp_table[i];
|
||||
if (uip_ipaddr_cmp(ipaddr, tabptr->at_ipaddr))
|
||||
@@ -460,7 +460,7 @@ void uip_arp_out(struct uip_driver_s *dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (i == UIP_ARPTAB_SIZE)
|
||||
if (i == CONFIG_NET_ARPTAB_SIZE)
|
||||
{
|
||||
/* The destination address was not in our ARP table, so we
|
||||
* overwrite the IP packet with an ARP request.
|
||||
|
||||
229
net/uip/uip-chksum.c
Normal file
229
net/uip/uip-chksum.c
Normal file
@@ -0,0 +1,229 @@
|
||||
/****************************************************************************
|
||||
* net/uip/uip-chksum.c
|
||||
*
|
||||
* Copyright (C) 2007 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <net/uip/uipopt.h>
|
||||
#include <net/uip/uip.h>
|
||||
#include <net/uip/uip-arch.h>
|
||||
|
||||
#include "uip-internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BUF ((struct uip_tcpip_hdr *)&dev->d_buf[UIP_LLH_LEN])
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if !UIP_ARCH_CHKSUM
|
||||
static uint16 chksum(uint16 sum, const uint8 *data, uint16 len)
|
||||
{
|
||||
uint16 t;
|
||||
const uint8 *dataptr;
|
||||
const uint8 *last_byte;
|
||||
|
||||
dataptr = data;
|
||||
last_byte = data + len - 1;
|
||||
|
||||
while(dataptr < last_byte)
|
||||
{
|
||||
/* At least two more bytes */
|
||||
|
||||
t = (dataptr[0] << 8) + dataptr[1];
|
||||
sum += t;
|
||||
if (sum < t)
|
||||
{
|
||||
sum++; /* carry */
|
||||
}
|
||||
dataptr += 2;
|
||||
}
|
||||
|
||||
if (dataptr == last_byte)
|
||||
{
|
||||
t = (dataptr[0] << 8) + 0;
|
||||
sum += t;
|
||||
if (sum < t)
|
||||
{
|
||||
sum++; /* carry */
|
||||
}
|
||||
}
|
||||
|
||||
/* Return sum in host byte order. */
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static uint16 upper_layer_chksum(struct uip_driver_s *dev, uint8 proto)
|
||||
{
|
||||
uint16 upper_layer_len;
|
||||
uint16 sum;
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
upper_layer_len = (((uint16)(BUF->len[0]) << 8) + BUF->len[1]);
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
upper_layer_len = (((uint16)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* First sum pseudoheader. */
|
||||
|
||||
/* IP protocol and length fields. This addition cannot carry. */
|
||||
|
||||
sum = upper_layer_len + proto;
|
||||
|
||||
/* Sum IP source and destination addresses. */
|
||||
|
||||
sum = chksum(sum, (uint8 *)&BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
|
||||
|
||||
/* Sum TCP header and data. */
|
||||
|
||||
sum = chksum(sum, &dev->d_buf[UIP_IPH_LEN + UIP_LLH_LEN], upper_layer_len);
|
||||
|
||||
return (sum == 0) ? 0xffff : htons(sum);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
static uint16 uip_icmp6chksum(struct uip_driver_s *dev)
|
||||
{
|
||||
return upper_layer_chksum(dev, UIP_PROTO_ICMP6);
|
||||
}
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
#endif /* UIP_ARCH_CHKSUM */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Calculate the Internet checksum over a buffer. */
|
||||
|
||||
#if !UIP_ARCH_ADD32
|
||||
static void uip_carry32(uint8 *sum, uint16 op16)
|
||||
{
|
||||
if (sum[2] < (op16 >> 8))
|
||||
{
|
||||
++sum[1];
|
||||
if (sum[1] == 0)
|
||||
{
|
||||
++sum[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (sum[3] < (op16 & 0xff))
|
||||
{
|
||||
++sum[2];
|
||||
if (sum[2] == 0)
|
||||
{
|
||||
++sum[1];
|
||||
if (sum[1] == 0)
|
||||
{
|
||||
++sum[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void uip_add32(const uint8 *op32, uint16 op16, uint8 *sum)
|
||||
{
|
||||
/* op32 and the sum are in network order (big-endian); op16 is host order. */
|
||||
|
||||
sum[3] = op32[3] + (op16 & 0xff);
|
||||
sum[2] = op32[2] + (op16 >> 8);
|
||||
sum[1] = op32[1];
|
||||
sum[0] = op32[0];
|
||||
uip_carry32(sum, op16);
|
||||
}
|
||||
|
||||
void uip_incr32(uint8 *op32, uint16 op16)
|
||||
{
|
||||
op32[3] += (op16 & 0xff);
|
||||
op32[2] += (op16 >> 8);
|
||||
uip_carry32(op32, op16);
|
||||
}
|
||||
|
||||
#endif /* UIP_ARCH_ADD32 */
|
||||
|
||||
#if !UIP_ARCH_CHKSUM
|
||||
uint16 uip_chksum(uint16 *data, uint16 len)
|
||||
{
|
||||
return htons(chksum(0, (uint8 *)data, len));
|
||||
}
|
||||
|
||||
/* Calculate the IP header checksum of the packet header in d_buf. */
|
||||
|
||||
#ifndef UIP_ARCH_IPCHKSUM
|
||||
uint16 uip_ipchksum(struct uip_driver_s *dev)
|
||||
{
|
||||
uint16 sum;
|
||||
|
||||
sum = chksum(0, &dev->d_buf[UIP_LLH_LEN], UIP_IPH_LEN);
|
||||
return (sum == 0) ? 0xffff : htons(sum);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Calculate the TCP checksum of the packet in d_buf and d_appdata. */
|
||||
|
||||
uint16 uip_tcpchksum(struct uip_driver_s *dev)
|
||||
{
|
||||
return upper_layer_chksum(dev, UIP_PROTO_TCP);
|
||||
}
|
||||
|
||||
/* Calculate the UDP checksum of the packet in d_buf and d_appdata. */
|
||||
|
||||
#ifdef CONFIG_NET_UDP_CHECKSUMS
|
||||
uint16 uip_udpchksum(struct uip_driver_s *dev)
|
||||
{
|
||||
return upper_layer_chksum(dev, UIP_PROTO_UDP);
|
||||
}
|
||||
#endif
|
||||
#endif /* UIP_ARCH_CHKSUM */
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user