c_types.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) 2010 - 2011 Espressif System
  3. *
  4. */
  5. #ifndef _C_TYPES_H_
  6. #define _C_TYPES_H_
  7. typedef unsigned char uint8_t;
  8. typedef signed char sint8_t;
  9. typedef signed char int8_t;
  10. typedef unsigned short uint16_t;
  11. typedef signed short sint16_t;
  12. typedef signed short int16_t;
  13. typedef unsigned long uint32_t;
  14. typedef signed long sint32_t;
  15. typedef signed long int32_t;
  16. typedef signed long long sint64_t;
  17. typedef signed long long int64_t;
  18. typedef unsigned long long uint64_t;
  19. typedef unsigned long long u_int64_t;
  20. typedef float real32_t;
  21. typedef double real64_t;
  22. typedef unsigned char uint8;
  23. typedef unsigned char u8;
  24. typedef signed char sint8;
  25. typedef signed char int8;
  26. typedef signed char s8;
  27. typedef unsigned short uint16;
  28. typedef unsigned short u16;
  29. typedef signed short sint16;
  30. typedef signed short s16;
  31. typedef unsigned int uint32;
  32. typedef unsigned int u_int;
  33. typedef unsigned int u32;
  34. typedef signed int sint32;
  35. typedef signed int s32;
  36. typedef int int32;
  37. typedef signed long long sint64;
  38. typedef unsigned long long uint64;
  39. typedef unsigned long long u64;
  40. typedef float real32;
  41. typedef double real64;
  42. #define __le16 u16
  43. //typedef unsigned int size_t;
  44. #if !defined(__size_t)
  45. #define __size_t 1
  46. typedef unsigned int size_t; /* others (e.g. <stdio.h>) also define */
  47. /* the unsigned integral type of the result of the sizeof operator. */
  48. #endif
  49. #define __packed __attribute__((packed))
  50. #define LOCAL static
  51. #ifndef NULL
  52. #define NULL (void *)0
  53. #endif /* NULL */
  54. /* probably should not put STATUS here */
  55. typedef enum {
  56. OK = 0,
  57. FAIL,
  58. PENDING,
  59. BUSY,
  60. CANCEL,
  61. } STATUS;
  62. #define BIT(nr) (1UL << (nr))
  63. #define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
  64. #define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
  65. #define DMEM_ATTR __attribute__((section(".bss")))
  66. #define SHMEM_ATTR
  67. #ifdef ICACHE_FLASH
  68. #define ICACHE_FLASH_ATTR __attribute__((section(".irom0.text")))
  69. #define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
  70. #else
  71. #define ICACHE_FLASH_ATTR
  72. #endif /* ICACHE_FLASH */
  73. #define TEXT_SECTION_ATTR __attribute__((section(".text")))
  74. #define RAM_CONST_ATTR __attribute__((section(".text")))
  75. #ifndef __cplusplus
  76. typedef unsigned char bool;
  77. #define BOOL bool
  78. #define true (1)
  79. #define false (0)
  80. #define TRUE true
  81. #define FALSE false
  82. #endif /* !__cplusplus */
  83. #endif /* _C_TYPES_H_ */