cc.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (c) 2001, Swedish Institute of Computer Science.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the Institute nor the names of its contributors
  14. * may be used to endorse or promote products derived from this software
  15. * without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
  18. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
  21. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27. * SUCH DAMAGE.
  28. *
  29. * This file is part of the lwIP TCP/IP stack.
  30. *
  31. * Author: Adam Dunkels <adam@sics.se>
  32. *
  33. */
  34. #ifndef __ARCH_CC_H__
  35. #define __ARCH_CC_H__
  36. //#include <string.h>
  37. #include "c_types.h"
  38. #include "ets_sys.h"
  39. #include "osapi.h"
  40. #define EFAULT 14
  41. //#define LWIP_PROVIDE_ERRNO
  42. #if (1)
  43. #define BYTE_ORDER LITTLE_ENDIAN
  44. #else
  45. #define BYTE_ORDER BIG_ENDIAN
  46. #endif
  47. typedef uint8_t u8_t;
  48. typedef int8_t s8_t;
  49. typedef uint16_t u16_t;
  50. typedef int16_t s16_t;
  51. typedef uint32_t u32_t;
  52. typedef int32_t s32_t;
  53. typedef uint32_t mem_ptr_t;
  54. #define S16_F "d"
  55. #define U16_F "d"
  56. #define X16_F "x"
  57. #define S32_F "d"
  58. #define U32_F "d"
  59. #define X32_F "x"
  60. #define LWIP_ERR_T s32_t
  61. //#define PACK_STRUCT_FIELD(x) x __attribute__((packed))
  62. #define PACK_STRUCT_FIELD(x) x
  63. #define PACK_STRUCT_STRUCT __attribute__((packed))
  64. #define PACK_STRUCT_BEGIN
  65. #define PACK_STRUCT_END
  66. //#define LWIP_DEBUG
  67. #ifdef LWIP_DEBUG
  68. #define LWIP_PLATFORM_DIAG(x) os_printf x
  69. #define LWIP_PLATFORM_ASSERT(x) ETS_ASSERT(x)
  70. #else
  71. #define LWIP_PLATFORM_DIAG(x)
  72. #define LWIP_PLATFORM_ASSERT(x)
  73. #endif
  74. #define SYS_ARCH_DECL_PROTECT(x)
  75. #define SYS_ARCH_PROTECT(x)
  76. #define SYS_ARCH_UNPROTECT(x)
  77. #define LWIP_PLATFORM_BYTESWAP 1
  78. #define LWIP_PLATFORM_HTONS(_n) ((u16_t)((((_n) & 0xff) << 8) | (((_n) >> 8) & 0xff)))
  79. #define LWIP_PLATFORM_HTONL(_n) ((u32_t)( (((_n) & 0xff) << 24) | (((_n) & 0xff00) << 8) | (((_n) >> 8) & 0xff00) | (((_n) >> 24) & 0xff) ))
  80. #if LWIP_RAW
  81. extern u8_t memp_memory_RAW_PCB_base[];
  82. #endif /* LWIP_RAW */
  83. #if LWIP_UDP
  84. extern u8_t memp_memory_UDP_PCB_base[];
  85. #endif /* LWIP_UDP */
  86. #if LWIP_TCP
  87. extern u8_t memp_memory_TCP_PCB_base[];
  88. extern u8_t memp_memory_TCP_PCB_LISTEN_base[];
  89. extern u8_t memp_memory_TCP_SEG_base[] SHMEM_ATTR;
  90. #endif /* LWIP_TCP */
  91. #if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */
  92. extern u8_t memp_memory_SYS_TIMEOUT_base[];
  93. #endif /* LWIP_TIMERS */
  94. extern u8_t memp_memory_PBUF_base[];
  95. extern u8_t memp_memory_PBUF_POOL_base[];
  96. #endif /* __ARCH_CC_H__ */