ProjetoBB
Dependencies: F7_Ethernet WebSocketClient mbed mcp3008
Fork of Nucleo_F746ZG_Ethernet by
F7_Ethernet/lwip/include/lwip/def.h@0:f9b6112278fe, 2016-06-18 (annotated)
- Committer:
- DieterGraef
- Date:
- Sat Jun 18 10:49:12 2016 +0000
- Revision:
- 0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DieterGraef | 0:f9b6112278fe | 1 | /* |
DieterGraef | 0:f9b6112278fe | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
DieterGraef | 0:f9b6112278fe | 3 | * All rights reserved. |
DieterGraef | 0:f9b6112278fe | 4 | * |
DieterGraef | 0:f9b6112278fe | 5 | * Redistribution and use in source and binary forms, with or without modification, |
DieterGraef | 0:f9b6112278fe | 6 | * are permitted provided that the following conditions are met: |
DieterGraef | 0:f9b6112278fe | 7 | * |
DieterGraef | 0:f9b6112278fe | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
DieterGraef | 0:f9b6112278fe | 9 | * this list of conditions and the following disclaimer. |
DieterGraef | 0:f9b6112278fe | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
DieterGraef | 0:f9b6112278fe | 11 | * this list of conditions and the following disclaimer in the documentation |
DieterGraef | 0:f9b6112278fe | 12 | * and/or other materials provided with the distribution. |
DieterGraef | 0:f9b6112278fe | 13 | * 3. The name of the author may not be used to endorse or promote products |
DieterGraef | 0:f9b6112278fe | 14 | * derived from this software without specific prior written permission. |
DieterGraef | 0:f9b6112278fe | 15 | * |
DieterGraef | 0:f9b6112278fe | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
DieterGraef | 0:f9b6112278fe | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
DieterGraef | 0:f9b6112278fe | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
DieterGraef | 0:f9b6112278fe | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
DieterGraef | 0:f9b6112278fe | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
DieterGraef | 0:f9b6112278fe | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
DieterGraef | 0:f9b6112278fe | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
DieterGraef | 0:f9b6112278fe | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
DieterGraef | 0:f9b6112278fe | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
DieterGraef | 0:f9b6112278fe | 25 | * OF SUCH DAMAGE. |
DieterGraef | 0:f9b6112278fe | 26 | * |
DieterGraef | 0:f9b6112278fe | 27 | * This file is part of the lwIP TCP/IP stack. |
DieterGraef | 0:f9b6112278fe | 28 | * |
DieterGraef | 0:f9b6112278fe | 29 | * Author: Adam Dunkels <adam@sics.se> |
DieterGraef | 0:f9b6112278fe | 30 | * |
DieterGraef | 0:f9b6112278fe | 31 | */ |
DieterGraef | 0:f9b6112278fe | 32 | #ifndef __LWIP_DEF_H__ |
DieterGraef | 0:f9b6112278fe | 33 | #define __LWIP_DEF_H__ |
DieterGraef | 0:f9b6112278fe | 34 | |
DieterGraef | 0:f9b6112278fe | 35 | /* arch.h might define NULL already */ |
DieterGraef | 0:f9b6112278fe | 36 | #include "lwip/arch.h" |
DieterGraef | 0:f9b6112278fe | 37 | #include "lwip/opt.h" |
DieterGraef | 0:f9b6112278fe | 38 | |
DieterGraef | 0:f9b6112278fe | 39 | #ifdef __cplusplus |
DieterGraef | 0:f9b6112278fe | 40 | extern "C" { |
DieterGraef | 0:f9b6112278fe | 41 | #endif |
DieterGraef | 0:f9b6112278fe | 42 | |
DieterGraef | 0:f9b6112278fe | 43 | #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y)) |
DieterGraef | 0:f9b6112278fe | 44 | #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y)) |
DieterGraef | 0:f9b6112278fe | 45 | |
DieterGraef | 0:f9b6112278fe | 46 | #ifndef NULL |
DieterGraef | 0:f9b6112278fe | 47 | #define NULL ((void *)0) |
DieterGraef | 0:f9b6112278fe | 48 | #endif |
DieterGraef | 0:f9b6112278fe | 49 | |
DieterGraef | 0:f9b6112278fe | 50 | /* Endianess-optimized shifting of two u8_t to create one u16_t */ |
DieterGraef | 0:f9b6112278fe | 51 | #if BYTE_ORDER == LITTLE_ENDIAN |
DieterGraef | 0:f9b6112278fe | 52 | #define LWIP_MAKE_U16(a, b) ((a << 8) | b) |
DieterGraef | 0:f9b6112278fe | 53 | #else |
DieterGraef | 0:f9b6112278fe | 54 | #define LWIP_MAKE_U16(a, b) ((b << 8) | a) |
DieterGraef | 0:f9b6112278fe | 55 | #endif |
DieterGraef | 0:f9b6112278fe | 56 | |
DieterGraef | 0:f9b6112278fe | 57 | #ifndef LWIP_PLATFORM_BYTESWAP |
DieterGraef | 0:f9b6112278fe | 58 | #define LWIP_PLATFORM_BYTESWAP 0 |
DieterGraef | 0:f9b6112278fe | 59 | #endif |
DieterGraef | 0:f9b6112278fe | 60 | |
DieterGraef | 0:f9b6112278fe | 61 | #ifndef LWIP_PREFIX_BYTEORDER_FUNCS |
DieterGraef | 0:f9b6112278fe | 62 | /* workaround for naming collisions on some platforms */ |
DieterGraef | 0:f9b6112278fe | 63 | |
DieterGraef | 0:f9b6112278fe | 64 | #ifdef htons |
DieterGraef | 0:f9b6112278fe | 65 | #undef htons |
DieterGraef | 0:f9b6112278fe | 66 | #endif /* htons */ |
DieterGraef | 0:f9b6112278fe | 67 | #ifdef htonl |
DieterGraef | 0:f9b6112278fe | 68 | #undef htonl |
DieterGraef | 0:f9b6112278fe | 69 | #endif /* htonl */ |
DieterGraef | 0:f9b6112278fe | 70 | #ifdef ntohs |
DieterGraef | 0:f9b6112278fe | 71 | #undef ntohs |
DieterGraef | 0:f9b6112278fe | 72 | #endif /* ntohs */ |
DieterGraef | 0:f9b6112278fe | 73 | #ifdef ntohl |
DieterGraef | 0:f9b6112278fe | 74 | #undef ntohl |
DieterGraef | 0:f9b6112278fe | 75 | #endif /* ntohl */ |
DieterGraef | 0:f9b6112278fe | 76 | |
DieterGraef | 0:f9b6112278fe | 77 | #define htons(x) lwip_htons(x) |
DieterGraef | 0:f9b6112278fe | 78 | #define ntohs(x) lwip_ntohs(x) |
DieterGraef | 0:f9b6112278fe | 79 | #define htonl(x) lwip_htonl(x) |
DieterGraef | 0:f9b6112278fe | 80 | #define ntohl(x) lwip_ntohl(x) |
DieterGraef | 0:f9b6112278fe | 81 | #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */ |
DieterGraef | 0:f9b6112278fe | 82 | |
DieterGraef | 0:f9b6112278fe | 83 | #if BYTE_ORDER == BIG_ENDIAN |
DieterGraef | 0:f9b6112278fe | 84 | #define lwip_htons(x) (x) |
DieterGraef | 0:f9b6112278fe | 85 | #define lwip_ntohs(x) (x) |
DieterGraef | 0:f9b6112278fe | 86 | #define lwip_htonl(x) (x) |
DieterGraef | 0:f9b6112278fe | 87 | #define lwip_ntohl(x) (x) |
DieterGraef | 0:f9b6112278fe | 88 | #define PP_HTONS(x) (x) |
DieterGraef | 0:f9b6112278fe | 89 | #define PP_NTOHS(x) (x) |
DieterGraef | 0:f9b6112278fe | 90 | #define PP_HTONL(x) (x) |
DieterGraef | 0:f9b6112278fe | 91 | #define PP_NTOHL(x) (x) |
DieterGraef | 0:f9b6112278fe | 92 | #else /* BYTE_ORDER != BIG_ENDIAN */ |
DieterGraef | 0:f9b6112278fe | 93 | #if LWIP_PLATFORM_BYTESWAP |
DieterGraef | 0:f9b6112278fe | 94 | #define lwip_htons(x) LWIP_PLATFORM_HTONS(x) |
DieterGraef | 0:f9b6112278fe | 95 | #define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x) |
DieterGraef | 0:f9b6112278fe | 96 | #define lwip_htonl(x) LWIP_PLATFORM_HTONL(x) |
DieterGraef | 0:f9b6112278fe | 97 | #define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x) |
DieterGraef | 0:f9b6112278fe | 98 | #else /* LWIP_PLATFORM_BYTESWAP */ |
DieterGraef | 0:f9b6112278fe | 99 | u16_t lwip_htons(u16_t x); |
DieterGraef | 0:f9b6112278fe | 100 | u16_t lwip_ntohs(u16_t x); |
DieterGraef | 0:f9b6112278fe | 101 | u32_t lwip_htonl(u32_t x); |
DieterGraef | 0:f9b6112278fe | 102 | u32_t lwip_ntohl(u32_t x); |
DieterGraef | 0:f9b6112278fe | 103 | #endif /* LWIP_PLATFORM_BYTESWAP */ |
DieterGraef | 0:f9b6112278fe | 104 | |
DieterGraef | 0:f9b6112278fe | 105 | /* These macros should be calculated by the preprocessor and are used |
DieterGraef | 0:f9b6112278fe | 106 | with compile-time constants only (so that there is no little-endian |
DieterGraef | 0:f9b6112278fe | 107 | overhead at runtime). */ |
DieterGraef | 0:f9b6112278fe | 108 | #define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) |
DieterGraef | 0:f9b6112278fe | 109 | #define PP_NTOHS(x) PP_HTONS(x) |
DieterGraef | 0:f9b6112278fe | 110 | #define PP_HTONL(x) ((((x) & 0xff) << 24) | \ |
DieterGraef | 0:f9b6112278fe | 111 | (((x) & 0xff00) << 8) | \ |
DieterGraef | 0:f9b6112278fe | 112 | (((x) & 0xff0000UL) >> 8) | \ |
DieterGraef | 0:f9b6112278fe | 113 | (((x) & 0xff000000UL) >> 24)) |
DieterGraef | 0:f9b6112278fe | 114 | #define PP_NTOHL(x) PP_HTONL(x) |
DieterGraef | 0:f9b6112278fe | 115 | |
DieterGraef | 0:f9b6112278fe | 116 | #endif /* BYTE_ORDER == BIG_ENDIAN */ |
DieterGraef | 0:f9b6112278fe | 117 | |
DieterGraef | 0:f9b6112278fe | 118 | #ifdef __cplusplus |
DieterGraef | 0:f9b6112278fe | 119 | } |
DieterGraef | 0:f9b6112278fe | 120 | #endif |
DieterGraef | 0:f9b6112278fe | 121 | |
DieterGraef | 0:f9b6112278fe | 122 | #endif /* __LWIP_DEF_H__ */ |
DieterGraef | 0:f9b6112278fe | 123 |