ESP8266_RTOS_SDK  v1.4.0
c_types.h
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2015 <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 
25 #ifndef _C_TYPES_H_
26 #define _C_TYPES_H_
27 
28 #include <stdint.h>
29 #include <stdbool.h>
30 #include <stddef.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef uint8_t u8_t;
37 typedef int8_t s8_t;
38 typedef uint16_t u16_t;
39 typedef int16_t s16_t;
40 typedef uint32_t u32_t;
41 typedef int32_t s32_t;
42 
43 typedef uint8_t uint8;
44 typedef uint8_t u8;
45 typedef int8_t sint8;
46 typedef int8_t int8;
47 typedef int8_t s8;
48 typedef uint16_t uint16;
49 typedef uint16_t u16;
50 typedef int16_t sint16;
51 typedef int16_t s16;
52 typedef uint32_t uint32;
53 typedef uint32_t u_int;
54 typedef uint32_t u32;
55 typedef int32_t sint32;
56 typedef int32_t s32;
57 typedef int32_t int32;
58 typedef int64_t sint64;
59 typedef uint64_t uint64;
60 typedef uint64_t u64;
61 typedef float real32;
62 typedef double real64;
63 
64 #define __le16 u16
65 
66 #define LOCAL static
67 
68 #ifndef NULL
69 #define NULL (void *)0
70 #endif /* NULL */
71 
72 /* probably should not put STATUS here */
73 typedef enum {
74  OK = 0,
75  FAIL,
76  PENDING,
77  BUSY,
78  CANCEL,
79 } STATUS;
80 
81 #define BIT(nr) (1UL << (nr))
82 
83 #define REG_WRITE(_r, _v) (*(volatile uint32 *)(_r)) = (_v)
84 #define REG_READ(_r) (*(volatile uint32 *)(_r))
85 
86 #define REG_SET_BIT(_r, _b) (*(volatile uint32 *)(_r) |= (_b))
87 #define REG_CLR_BIT(_r, _b) (*(volatile uint32 *)(_r) &= ~(_b))
88 
89 #define __packed __attribute__((packed))
90 #define STORE_ATTR __attribute__((aligned(4)))
91 
92 #define SHMEM_ATTR
93 #define ICACHE_FLASH_ATTR
94 
95 #define DMEM_ATTR __attribute__((section(".bss")))
96 #define IRAM_ATTR __attribute__((section(".text")))
97 #define ICACHE_RODATA_ATTR __attribute__((section(".irom.text")))
98 
99 #ifndef __cplusplus
100 #define BOOL bool
101 #define TRUE true
102 #define FALSE false
103 #endif /* !__cplusplus */
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* _C_TYPES_H_ */