c_types.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (c) 2010 - 2011 Espressif System
  3. *
  4. */
  5. // Modified for meta-id to confiorm with c99 using the patch included with
  6. // esp-open-sdk https://github.com/pfalcon/esp-open-sdk/blob/master/c_types-c99.patch
  7. // This is included here because otherwise there is a discrepancy between users that use
  8. // the original Espressif SDK vs ones who want to use the SDK included with esp-open-sdk.
  9. // This is a mess, if only Espressif fixed their crap!
  10. #ifndef _C_TYPES_H_
  11. #define _C_TYPES_H_
  12. #include <stdint.h>
  13. #include <stdbool.h>
  14. //typedef unsigned char uint8_t;
  15. typedef signed char sint8_t;
  16. //typedef signed char int8_t;
  17. //typedef unsigned short uint16_t;
  18. typedef signed short sint16_t;
  19. //typedef signed short int16_t;
  20. //typedef unsigned long uint32_t;
  21. typedef signed long sint32_t;
  22. //typedef signed long int32_t;
  23. typedef signed long long sint64_t;
  24. //typedef unsigned long long uint64_t;
  25. typedef unsigned long long u_int64_t;
  26. typedef float real32_t;
  27. typedef double real64_t;
  28. typedef unsigned char uint8;
  29. typedef unsigned char u8;
  30. typedef signed char sint8;
  31. typedef signed char int8;
  32. typedef signed char s8;
  33. typedef unsigned short uint16;
  34. typedef unsigned short u16;
  35. typedef signed short sint16;
  36. typedef signed short s16;
  37. typedef unsigned int uint32;
  38. typedef unsigned int u_int;
  39. typedef unsigned int u32;
  40. typedef signed int sint32;
  41. typedef signed int s32;
  42. typedef int int32;
  43. typedef signed long long sint64;
  44. typedef unsigned long long uint64;
  45. typedef unsigned long long u64;
  46. typedef float real32;
  47. typedef double real64;
  48. #define __le16 u16
  49. typedef unsigned int size_t;
  50. #define __packed __attribute__((packed))
  51. #define LOCAL static
  52. #ifndef NULL
  53. #define NULL (void *)0
  54. #endif /* NULL */
  55. /* probably should not put STATUS here */
  56. typedef enum {
  57. OK = 0,
  58. FAIL,
  59. PENDING,
  60. BUSY,
  61. CANCEL,
  62. } STATUS;
  63. #define BIT(nr) (1UL << (nr))
  64. #define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
  65. #define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
  66. #define DMEM_ATTR __attribute__((section(".bss")))
  67. #define SHMEM_ATTR
  68. #ifdef ICACHE_FLASH
  69. #define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
  70. #define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
  71. #else
  72. #define ICACHE_FLASH_ATTR
  73. #define ICACHE_RODATA_ATTR
  74. #endif /* ICACHE_FLASH */
  75. #define STORE_ATTR __attribute__((aligned(4)))
  76. #ifndef __cplusplus
  77. //typedef unsigned char bool;
  78. #define BOOL bool
  79. //#define true (1)
  80. //#define false (0)
  81. #define TRUE true
  82. #define FALSE false
  83. #endif /* !__cplusplus */
  84. #endif /* _C_TYPES_H_ */