c_types.h.orig 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * ESPRESSIF MIT License
  3. *
  4. * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
  5. *
  6. * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
  7. * it is free of charge, to any person obtaining a copy of this software and associated
  8. * documentation files (the "Software"), to deal in the Software without restriction, including
  9. * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  10. * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
  11. * to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in all copies or
  14. * substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. */
  24. #ifndef _C_TYPES_H_
  25. #define _C_TYPES_H_
  26. typedef unsigned char uint8_t;
  27. typedef signed char sint8_t;
  28. typedef signed char int8_t;
  29. typedef unsigned short uint16_t;
  30. typedef signed short sint16_t;
  31. typedef signed short int16_t;
  32. typedef unsigned int uint32_t;
  33. typedef signed long sint32_t;
  34. typedef signed int int32_t;
  35. typedef signed long long sint64_t;
  36. typedef unsigned long long uint64_t;
  37. typedef unsigned long long u_int64_t;
  38. typedef float real32_t;
  39. typedef double real64_t;
  40. typedef unsigned char uint8;
  41. typedef unsigned char u8;
  42. typedef signed char sint8;
  43. typedef signed char int8;
  44. typedef signed char s8;
  45. typedef unsigned short uint16;
  46. typedef unsigned short u16;
  47. typedef signed short sint16;
  48. typedef signed short s16;
  49. typedef unsigned int uint32;
  50. typedef unsigned int u_int;
  51. typedef unsigned int u32;
  52. typedef signed int sint32;
  53. typedef signed int s32;
  54. typedef int int32;
  55. typedef signed long long sint64;
  56. typedef unsigned long long uint64;
  57. typedef unsigned long long u64;
  58. typedef float real32;
  59. typedef double real64;
  60. #define __le16 u16
  61. typedef unsigned int size_t;
  62. #define __packed __attribute__((packed))
  63. #define LOCAL static
  64. #ifndef NULL
  65. #define NULL (void *)0
  66. #endif /* NULL */
  67. /* probably should not put STATUS here */
  68. typedef enum {
  69. OK = 0,
  70. FAIL,
  71. PENDING,
  72. BUSY,
  73. CANCEL,
  74. } STATUS;
  75. #define BIT(nr) (1UL << (nr))
  76. #define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
  77. #define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
  78. #define DMEM_ATTR __attribute__((section(".bss")))
  79. #define SHMEM_ATTR
  80. #ifdef ICACHE_FLASH
  81. #define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
  82. #define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
  83. #else
  84. #define ICACHE_FLASH_ATTR
  85. #define ICACHE_RODATA_ATTR
  86. #endif /* ICACHE_FLASH */
  87. #define STORE_ATTR __attribute__((aligned(4)))
  88. #ifndef __cplusplus
  89. typedef unsigned char bool;
  90. #define BOOL bool
  91. #define true (1)
  92. #define false (0)
  93. #define TRUE true
  94. #define FALSE false
  95. #endif /* !__cplusplus */
  96. #endif /* _C_TYPES_H_ */