Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
esp_common.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2019 Gunar Schorcht
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
20
#ifndef ESP_COMMON_H
21
#define ESP_COMMON_H
22
23
#ifndef DOXYGEN
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
29
#include "
log.h
"
30
#include "
esp_common_log.h
"
31
#include "
macros/xtstr.h
"
32
33
#define asm __asm__
34
35
#if !defined(ICACHE_FLASH)
36
#ifndef ICACHE_RAM_ATTR
37
38
#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text")))
39
#endif
40
#else
/* ICACHE_FLASH */
41
#ifndef ICACHE_RAM_ATTR
42
#define ICACHE_RAM_ATTR
43
#endif
44
#endif
/* ICACHE_FLASH */
45
46
#ifndef RTC_BSS_ATTR
47
#define RTC_BSS_ATTR __attribute__((section(".rtc.bss")))
48
#endif
49
50
#ifndef RTC_DATA_ATTR
51
#define RTC_DATA_ATTR __attribute__((section(".rtc.data")))
52
#endif
53
55
#define NOT_YET_IMPLEMENTED() LOG_INFO("%s not yet implemented\n", __func__)
56
57
#define NOT_SUPPORTED() LOG_INFO("%s not supported\n", __func__)
58
59
#if ENABLE_DEBUG
60
68
#define CHECK_PARAM_RET(cond,err) if (!(cond)) \
69
{ \
70
DEBUG("%s parameter condition (" #cond ") " \
71
"not fulfilled\n", __func__); \
72
return err; \
73
}
74
82
#define CHECK_PARAM(cond) if (!(cond)) \
83
{ \
84
DEBUG("%s parameter condition (" #cond ") " \
85
"not fulfilled\n", __func__); \
86
return; \
87
}
88
89
#else
/* ENABLE_DEBUG */
90
91
#define CHECK_PARAM_RET(cond,err) if (!(cond)) return err;
92
#define CHECK_PARAM(cond) if (!(cond)) return;
93
94
#endif
/* ENABLE_DEBUG */
95
97
#ifndef MIN
98
#define MIN(a,b) ((a) < (b) ? (a) : (b))
99
#endif
100
102
#ifndef MAX
103
#define MAX(a,b) ((a) > (b) ? (a) : (b))
104
#endif
105
110
#ifdef MCU_ESP32
111
#define system_get_cpu_freq ets_get_cpu_frequency
112
#define system_update_cpu_freq ets_update_cpu_frequency
113
#endif
/* MCU_ESP32 */
114
119
#ifndef USEC_PER_MSEC
120
#define USEC_PER_MSEC 1000UL
121
#endif
122
123
#ifndef MSEC_PER_SEC
124
#define MSEC_PER_SEC 1000UL
125
#endif
126
127
#ifdef __cplusplus
128
}
129
#endif
130
131
#endif
/* DOXYGEN */
132
133
#endif
/* ESP_COMMON_H */
xtstr.h
Macro to return string representation of x.
esp_common_log.h
Common log macros for ESP SoCs.
log.h
System logging header.
Generated on Tue Nov 24 2020 19:46:50 by
1.8.17