mbed-os for GR-LYCHEE

Dependents:   mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more

Committer:
dkato
Date:
Fri Feb 02 05:42:23 2018 +0000
Revision:
0:f782d9c66c49
mbed-os for GR-LYCHEE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dkato 0:f782d9c66c49 1 /*
dkato 0:f782d9c66c49 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
dkato 0:f782d9c66c49 3 * All rights reserved.
dkato 0:f782d9c66c49 4 *
dkato 0:f782d9c66c49 5 * Redistribution and use in source and binary forms, with or without modification,
dkato 0:f782d9c66c49 6 * are permitted provided that the following conditions are met:
dkato 0:f782d9c66c49 7 *
dkato 0:f782d9c66c49 8 * 1. Redistributions of source code must retain the above copyright notice,
dkato 0:f782d9c66c49 9 * this list of conditions and the following disclaimer.
dkato 0:f782d9c66c49 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
dkato 0:f782d9c66c49 11 * this list of conditions and the following disclaimer in the documentation
dkato 0:f782d9c66c49 12 * and/or other materials provided with the distribution.
dkato 0:f782d9c66c49 13 * 3. The name of the author may not be used to endorse or promote products
dkato 0:f782d9c66c49 14 * derived from this software without specific prior written permission.
dkato 0:f782d9c66c49 15 *
dkato 0:f782d9c66c49 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
dkato 0:f782d9c66c49 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dkato 0:f782d9c66c49 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
dkato 0:f782d9c66c49 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dkato 0:f782d9c66c49 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
dkato 0:f782d9c66c49 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dkato 0:f782d9c66c49 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dkato 0:f782d9c66c49 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
dkato 0:f782d9c66c49 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
dkato 0:f782d9c66c49 25 * OF SUCH DAMAGE.
dkato 0:f782d9c66c49 26 *
dkato 0:f782d9c66c49 27 * This file is part of the lwIP TCP/IP stack.
dkato 0:f782d9c66c49 28 *
dkato 0:f782d9c66c49 29 * Author: Adam Dunkels <adam@sics.se>
dkato 0:f782d9c66c49 30 *
dkato 0:f782d9c66c49 31 */
dkato 0:f782d9c66c49 32 #ifndef __CC_H__
dkato 0:f782d9c66c49 33 #define __CC_H__
dkato 0:f782d9c66c49 34
dkato 0:f782d9c66c49 35 #include <stdint.h>
dkato 0:f782d9c66c49 36 #include <stddef.h> /* for size_t */
dkato 0:f782d9c66c49 37
dkato 0:f782d9c66c49 38 /* ARM/LPC17xx is little endian only */
dkato 0:f782d9c66c49 39 #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)
dkato 0:f782d9c66c49 40 #ifdef BYTE_ORDER
dkato 0:f782d9c66c49 41 #undef BYTE_ORDER
dkato 0:f782d9c66c49 42 #endif
dkato 0:f782d9c66c49 43 #define BYTE_ORDER LITTLE_ENDIAN
dkato 0:f782d9c66c49 44 #endif
dkato 0:f782d9c66c49 45
dkato 0:f782d9c66c49 46 /* Use LWIP error codes */
dkato 0:f782d9c66c49 47 #define LWIP_PROVIDE_ERRNO
dkato 0:f782d9c66c49 48
dkato 0:f782d9c66c49 49 #if defined(__arm__) && defined(__ARMCC_VERSION)
dkato 0:f782d9c66c49 50 /* Keil uVision4 tools */
dkato 0:f782d9c66c49 51 #define PACK_STRUCT_BEGIN __packed
dkato 0:f782d9c66c49 52 #define PACK_STRUCT_STRUCT
dkato 0:f782d9c66c49 53 #define PACK_STRUCT_END
dkato 0:f782d9c66c49 54 #define PACK_STRUCT_FIELD(fld) fld
dkato 0:f782d9c66c49 55 #define ALIGNED(n) __align(n)
dkato 0:f782d9c66c49 56 #elif defined (__IAR_SYSTEMS_ICC__)
dkato 0:f782d9c66c49 57 /* IAR Embedded Workbench tools */
dkato 0:f782d9c66c49 58 #define PACK_STRUCT_BEGIN __packed
dkato 0:f782d9c66c49 59 #define PACK_STRUCT_STRUCT
dkato 0:f782d9c66c49 60 #define PACK_STRUCT_END
dkato 0:f782d9c66c49 61 #define PACK_STRUCT_FIELD(fld) fld
dkato 0:f782d9c66c49 62 #define IAR_STR(a) #a
dkato 0:f782d9c66c49 63 #define ALIGNED(n) _Pragma(IAR_STR(data_alignment= ## n ##))
dkato 0:f782d9c66c49 64 #else
dkato 0:f782d9c66c49 65 /* GCC tools (CodeSourcery) */
dkato 0:f782d9c66c49 66 #define PACK_STRUCT_BEGIN
dkato 0:f782d9c66c49 67 #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
dkato 0:f782d9c66c49 68 #define PACK_STRUCT_END
dkato 0:f782d9c66c49 69 #define PACK_STRUCT_FIELD(fld) fld
dkato 0:f782d9c66c49 70 #define ALIGNED(n) __attribute__((aligned (n)))
dkato 0:f782d9c66c49 71 #endif
dkato 0:f782d9c66c49 72
dkato 0:f782d9c66c49 73 /* Provide Thumb-2 routines for GCC to improve performance */
dkato 0:f782d9c66c49 74 #if defined(TOOLCHAIN_GCC) && defined(__thumb2__)
dkato 0:f782d9c66c49 75 #define MEMCPY(dst,src,len) thumb2_memcpy(dst,src,len)
dkato 0:f782d9c66c49 76 #define LWIP_CHKSUM thumb2_checksum
dkato 0:f782d9c66c49 77 /* Set algorithm to 0 so that unused lwip_standard_chksum function
dkato 0:f782d9c66c49 78 doesn't generate compiler warning */
dkato 0:f782d9c66c49 79 #define LWIP_CHKSUM_ALGORITHM 0
dkato 0:f782d9c66c49 80
dkato 0:f782d9c66c49 81 void* thumb2_memcpy(void* pDest, const void* pSource, size_t length);
dkato 0:f782d9c66c49 82 uint16_t thumb2_checksum(const void* pData, int length);
dkato 0:f782d9c66c49 83 #else
dkato 0:f782d9c66c49 84 /* Used with IP headers only */
dkato 0:f782d9c66c49 85 #define LWIP_CHKSUM_ALGORITHM 1
dkato 0:f782d9c66c49 86 #endif
dkato 0:f782d9c66c49 87
dkato 0:f782d9c66c49 88
dkato 0:f782d9c66c49 89 #ifdef LWIP_DEBUG
dkato 0:f782d9c66c49 90
dkato 0:f782d9c66c49 91 #include "stdio.h"
dkato 0:f782d9c66c49 92
dkato 0:f782d9c66c49 93 void assert_printf(char *msg, int line, char *file);
dkato 0:f782d9c66c49 94
dkato 0:f782d9c66c49 95 /* Plaform specific diagnostic output */
dkato 0:f782d9c66c49 96 #define LWIP_PLATFORM_DIAG(vars) printf vars
dkato 0:f782d9c66c49 97 #define LWIP_PLATFORM_ASSERT(flag) { assert_printf((flag), __LINE__, __FILE__); }
dkato 0:f782d9c66c49 98 #else
dkato 0:f782d9c66c49 99 #define LWIP_PLATFORM_DIAG(msg) { ; }
dkato 0:f782d9c66c49 100 #define LWIP_PLATFORM_ASSERT(flag) { ; }
dkato 0:f782d9c66c49 101 #endif
dkato 0:f782d9c66c49 102
dkato 0:f782d9c66c49 103 #include "cmsis.h"
dkato 0:f782d9c66c49 104 #define LWIP_PLATFORM_HTONS(x) __REV16(x)
dkato 0:f782d9c66c49 105 #define LWIP_PLATFORM_HTONL(x) __REV(x)
dkato 0:f782d9c66c49 106
dkato 0:f782d9c66c49 107 #endif /* __CC_H__ */