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

Dependencies:   ChaNFSSD TFTPServer RMFWeb

Dependents:   RMFWeb

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ED7418 0:51f1ef89ec7b 1 /**
ED7418 0:51f1ef89ec7b 2 * @file
ED7418 0:51f1ef89ec7b 3 * Common functions used throughout the stack.
ED7418 0:51f1ef89ec7b 4 *
ED7418 0:51f1ef89ec7b 5 */
ED7418 0:51f1ef89ec7b 6
ED7418 0:51f1ef89ec7b 7 /*
ED7418 0:51f1ef89ec7b 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
ED7418 0:51f1ef89ec7b 9 * All rights reserved.
ED7418 0:51f1ef89ec7b 10 *
ED7418 0:51f1ef89ec7b 11 * Redistribution and use in source and binary forms, with or without modification,
ED7418 0:51f1ef89ec7b 12 * are permitted provided that the following conditions are met:
ED7418 0:51f1ef89ec7b 13 *
ED7418 0:51f1ef89ec7b 14 * 1. Redistributions of source code must retain the above copyright notice,
ED7418 0:51f1ef89ec7b 15 * this list of conditions and the following disclaimer.
ED7418 0:51f1ef89ec7b 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
ED7418 0:51f1ef89ec7b 17 * this list of conditions and the following disclaimer in the documentation
ED7418 0:51f1ef89ec7b 18 * and/or other materials provided with the distribution.
ED7418 0:51f1ef89ec7b 19 * 3. The name of the author may not be used to endorse or promote products
ED7418 0:51f1ef89ec7b 20 * derived from this software without specific prior written permission.
ED7418 0:51f1ef89ec7b 21 *
ED7418 0:51f1ef89ec7b 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
ED7418 0:51f1ef89ec7b 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
ED7418 0:51f1ef89ec7b 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
ED7418 0:51f1ef89ec7b 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
ED7418 0:51f1ef89ec7b 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
ED7418 0:51f1ef89ec7b 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
ED7418 0:51f1ef89ec7b 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
ED7418 0:51f1ef89ec7b 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
ED7418 0:51f1ef89ec7b 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
ED7418 0:51f1ef89ec7b 31 * OF SUCH DAMAGE.
ED7418 0:51f1ef89ec7b 32 *
ED7418 0:51f1ef89ec7b 33 * This file is part of the lwIP TCP/IP stack.
ED7418 0:51f1ef89ec7b 34 *
ED7418 0:51f1ef89ec7b 35 * Author: Simon Goldschmidt
ED7418 0:51f1ef89ec7b 36 *
ED7418 0:51f1ef89ec7b 37 */
ED7418 0:51f1ef89ec7b 38
ED7418 0:51f1ef89ec7b 39 #include "lwip/opt.h"
ED7418 0:51f1ef89ec7b 40 #include "lwip/def.h"
ED7418 0:51f1ef89ec7b 41
ED7418 0:51f1ef89ec7b 42 /**
ED7418 0:51f1ef89ec7b 43 * These are reference implementations of the byte swapping functions.
ED7418 0:51f1ef89ec7b 44 * Again with the aim of being simple, correct and fully portable.
ED7418 0:51f1ef89ec7b 45 * Byte swapping is the second thing you would want to optimize. You will
ED7418 0:51f1ef89ec7b 46 * need to port it to your architecture and in your cc.h:
ED7418 0:51f1ef89ec7b 47 *
ED7418 0:51f1ef89ec7b 48 * #define LWIP_PLATFORM_BYTESWAP 1
ED7418 0:51f1ef89ec7b 49 * #define LWIP_PLATFORM_HTONS(x) <your_htons>
ED7418 0:51f1ef89ec7b 50 * #define LWIP_PLATFORM_HTONL(x) <your_htonl>
ED7418 0:51f1ef89ec7b 51 *
ED7418 0:51f1ef89ec7b 52 * Note ntohs() and ntohl() are merely references to the htonx counterparts.
ED7418 0:51f1ef89ec7b 53 */
ED7418 0:51f1ef89ec7b 54
ED7418 0:51f1ef89ec7b 55 #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
ED7418 0:51f1ef89ec7b 56
ED7418 0:51f1ef89ec7b 57 /**
ED7418 0:51f1ef89ec7b 58 * Convert an u16_t from host- to network byte order.
ED7418 0:51f1ef89ec7b 59 *
ED7418 0:51f1ef89ec7b 60 * @param n u16_t in host byte order
ED7418 0:51f1ef89ec7b 61 * @return n in network byte order
ED7418 0:51f1ef89ec7b 62 */
ED7418 0:51f1ef89ec7b 63 u16_t
ED7418 0:51f1ef89ec7b 64 lwip_htons(u16_t n)
ED7418 0:51f1ef89ec7b 65 {
ED7418 0:51f1ef89ec7b 66 return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
ED7418 0:51f1ef89ec7b 67 }
ED7418 0:51f1ef89ec7b 68
ED7418 0:51f1ef89ec7b 69 /**
ED7418 0:51f1ef89ec7b 70 * Convert an u16_t from network- to host byte order.
ED7418 0:51f1ef89ec7b 71 *
ED7418 0:51f1ef89ec7b 72 * @param n u16_t in network byte order
ED7418 0:51f1ef89ec7b 73 * @return n in host byte order
ED7418 0:51f1ef89ec7b 74 */
ED7418 0:51f1ef89ec7b 75 u16_t
ED7418 0:51f1ef89ec7b 76 lwip_ntohs(u16_t n)
ED7418 0:51f1ef89ec7b 77 {
ED7418 0:51f1ef89ec7b 78 return lwip_htons(n);
ED7418 0:51f1ef89ec7b 79 }
ED7418 0:51f1ef89ec7b 80
ED7418 0:51f1ef89ec7b 81 /**
ED7418 0:51f1ef89ec7b 82 * Convert an u32_t from host- to network byte order.
ED7418 0:51f1ef89ec7b 83 *
ED7418 0:51f1ef89ec7b 84 * @param n u32_t in host byte order
ED7418 0:51f1ef89ec7b 85 * @return n in network byte order
ED7418 0:51f1ef89ec7b 86 */
ED7418 0:51f1ef89ec7b 87 u32_t
ED7418 0:51f1ef89ec7b 88 lwip_htonl(u32_t n)
ED7418 0:51f1ef89ec7b 89 {
ED7418 0:51f1ef89ec7b 90 return ((n & 0xff) << 24) |
ED7418 0:51f1ef89ec7b 91 ((n & 0xff00) << 8) |
ED7418 0:51f1ef89ec7b 92 ((n & 0xff0000UL) >> 8) |
ED7418 0:51f1ef89ec7b 93 ((n & 0xff000000UL) >> 24);
ED7418 0:51f1ef89ec7b 94 }
ED7418 0:51f1ef89ec7b 95
ED7418 0:51f1ef89ec7b 96 /**
ED7418 0:51f1ef89ec7b 97 * Convert an u32_t from network- to host byte order.
ED7418 0:51f1ef89ec7b 98 *
ED7418 0:51f1ef89ec7b 99 * @param n u32_t in network byte order
ED7418 0:51f1ef89ec7b 100 * @return n in host byte order
ED7418 0:51f1ef89ec7b 101 */
ED7418 0:51f1ef89ec7b 102 u32_t
ED7418 0:51f1ef89ec7b 103 lwip_ntohl(u32_t n)
ED7418 0:51f1ef89ec7b 104 {
ED7418 0:51f1ef89ec7b 105 return lwip_htonl(n);
ED7418 0:51f1ef89ec7b 106 }
ED7418 0:51f1ef89ec7b 107
ED7418 0:51f1ef89ec7b 108 #endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */