Example program for the lwIP TCP/IP stack (library lwip_1_4_0_rc2) and the QP state machine framework (library qp). This program demonstrates use of lwIP in hard real-time applications, in which the TCP/IP stack is used to monitor and configure the embedded device as well as to provide remote user interface (e.g., by means of a web browser). In particular, the lwIP stack, which is not reentrant, is strictly encapsulated inside a dedicated QP state machine object (active object in QP), so interrupt locking around calls to lwIP is unnecessary. Also, the Ethernet interrupt service routine (ISR) runs very fast without performing any lengthy copy operations. All this means that hard-real-time processing can be done at the task level, especially when you use the preemptive QK kernel built into QP for executing your application. No external RTOS component is needed to achieve fully deterministic real-time response of active object tasks prioritized above the lwiP task. The lwIP-QP integration uses exclusively the event-driven lwIP API. The heavyweight Berkeley-like socket API requiring a blocking RTOS and is not used, which results in much better performance of the lwIP stack and less memory consumption. NOTE: This example compiles cleanly, but does not run just yet because the low-level Ethernet driver in the lwIP library needs to be completed. See comments in the lwip_1_4_0_rc2 library for more information.

Dependencies:   mbed

Committer:
QL
Date:
Sun Mar 27 16:50:21 2011 +0000
Revision:
0:84f3d3d7e5d9
0.9

Who changed what in which revision?

UserRevisionLine numberNew contents of line
QL 0:84f3d3d7e5d9 1 /*
QL 0:84f3d3d7e5d9 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
QL 0:84f3d3d7e5d9 3 * All rights reserved.
QL 0:84f3d3d7e5d9 4 *
QL 0:84f3d3d7e5d9 5 * Redistribution and use in source and binary forms, with or without
QL 0:84f3d3d7e5d9 6 * modification, are permitted provided that the following conditions are met:
QL 0:84f3d3d7e5d9 7 *
QL 0:84f3d3d7e5d9 8 * 1. Redistributions of source code must retain the above copyright notice,
QL 0:84f3d3d7e5d9 9 * this list of conditions and the following disclaimer.
QL 0:84f3d3d7e5d9 10 * 2. Redistributions in binary form must reproduce the above copyright
QL 0:84f3d3d7e5d9 11 * notice, this list of conditions and the following disclaimer in the
QL 0:84f3d3d7e5d9 12 * documentation and/or other materials provided with the distribution.
QL 0:84f3d3d7e5d9 13 * 3. The name of the author may not be used to endorse or promote products
QL 0:84f3d3d7e5d9 14 * derived from this software without specific prior written permission.
QL 0:84f3d3d7e5d9 15 *
QL 0:84f3d3d7e5d9 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
QL 0:84f3d3d7e5d9 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
QL 0:84f3d3d7e5d9 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
QL 0:84f3d3d7e5d9 19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
QL 0:84f3d3d7e5d9 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
QL 0:84f3d3d7e5d9 21 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
QL 0:84f3d3d7e5d9 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
QL 0:84f3d3d7e5d9 23 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
QL 0:84f3d3d7e5d9 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
QL 0:84f3d3d7e5d9 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
QL 0:84f3d3d7e5d9 26 *
QL 0:84f3d3d7e5d9 27 * This file is part of the lwIP TCP/IP stack.
QL 0:84f3d3d7e5d9 28 *
QL 0:84f3d3d7e5d9 29 * Author: Adam Dunkels <adam@sics.se>
QL 0:84f3d3d7e5d9 30 */
QL 0:84f3d3d7e5d9 31 #ifndef __FS_H__
QL 0:84f3d3d7e5d9 32 #define __FS_H__
QL 0:84f3d3d7e5d9 33
QL 0:84f3d3d7e5d9 34 struct fs_file {
QL 0:84f3d3d7e5d9 35 char *data;
QL 0:84f3d3d7e5d9 36 int len;
QL 0:84f3d3d7e5d9 37 int index;
QL 0:84f3d3d7e5d9 38 void *pextension;
QL 0:84f3d3d7e5d9 39 };
QL 0:84f3d3d7e5d9 40
QL 0:84f3d3d7e5d9 41 /* A file will be allocated and filled in by the fs_open function.
QL 0:84f3d3d7e5d9 42 * A file will be freed by the fs_close function.
QL 0:84f3d3d7e5d9 43 */
QL 0:84f3d3d7e5d9 44 struct fs_file *fs_open(char const *name);
QL 0:84f3d3d7e5d9 45 void fs_close(struct fs_file *file);
QL 0:84f3d3d7e5d9 46 int fs_read(struct fs_file *file, char *buffer, int count);
QL 0:84f3d3d7e5d9 47
QL 0:84f3d3d7e5d9 48 #endif /* __FS_H__ */