Select one of the symbols to view example projects that use it.
 
Outline
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stddef.h>
#include <sys/param.h>
#include "esp_rom_caps.h"
#include "esp_rom_sys.h"
#include "rom/ets_sys.h"
#include "sdkconfig.h"
_cvt(unsigned long long, char *, long, const char *)
#define is_digit
ets_vprintf(void (*)(char), const char *, va_list)
esp_rom_vprintf(const char *, va_list)
Files
ESP-IDF
components
app_trace
app_update
bootloader_support
bt
cmock
console
cxx
driver
efuse
esp_adc
esp_app_format
esp_bootloader_format
esp_coex
esp_common
esp_driver_ana_cmpr
esp_driver_cam
esp_driver_dac
esp_driver_gpio
esp_driver_gptimer
esp_driver_i2c
esp_driver_i2s
esp_driver_jpeg
esp_driver_ledc
esp_driver_mcpwm
esp_driver_parlio
esp_driver_pcnt
esp_driver_rmt
esp_driver_sdio
esp_driver_sdm
esp_driver_sdmmc
esp_driver_sdspi
esp_driver_spi
esp_driver_tsens
esp_driver_uart
esp_driver_usb_serial_jtag
esp_eth
esp_event
esp_gdbstub
esp_hid
esp_http_client
esp_http_server
esp_https_ota
esp_https_server
esp_hw_support
esp_lcd
esp_local_ctrl
esp_mm
esp_netif
esp_partition
esp_phy
esp_pm
esp_psram
esp_ringbuf
esp_rom
esp32
include
patches
esp_security
esp_system
esp_timer
esp_vfs_console
esp_wifi
esp-tls
espcoredump
hal
heap
http_parser
ieee802154
log
mqtt
newlib
nvs_flash
nvs_sec_provider
openthread
perfmon
protobuf-c
protocomm
pthread
rt
sdmmc
soc
spi_flash
spiffs
tcp_transport
ulp
unity
vfs
wear_levelling
wifi_provisioning
wpa_supplicant
xtensa
examples
lwIP
FreeRTOS
cJSON
mbedTLS
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_rom/patches/esp_rom_print.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include <stdint.h> #include <stdbool.h> #include <stdarg.h> #include <stddef.h> #include <sys/param.h> #include "esp_rom_caps.h" #include "esp_rom_sys.h" #include "rom/ets_sys.h" #include "sdkconfig.h"9 includes #if !ESP_ROM_HAS_VPRINTF_FUNC static int _cvt(unsigned long long val, char *buf, long radix, const char *digits) { #ifdef SUPPORT_LITTLE_RADIX char temp[64]; #else char temp[32]; #endif char *cp = temp; int length = 0; if (val == 0) { /* Special case */ *cp++ = '0'; }{...} else { while (val) { *cp++ = digits[val % radix]; val /= radix; }{...} }{...} while (cp != temp) { *buf++ = *--cp; length++; }{...} *buf = '\0'; return (length); }{ ... } #define is_digit(c) ((c >= '0') && (c <= '9')) static int ets_vprintf(void (*putc)(char c), const char *fmt, va_list ap) { #ifdef BINARY_SUPPORT char buf[sizeof(long long)*8]; #else char buf[32]; #endif char c, sign, *cp=buf; int left_prec, right_prec, zero_fill, pad, pad_on_right, islong, islonglong; long long val = 0; int res = 0, length = 0; // %[flags][left_prec][.right_prec][sub_type]type while ((c = *fmt++) != '\0') { if (c == '%') { c = *fmt++; left_prec = right_prec = pad_on_right = islong = islonglong = 0; if (c == '-') { c = *fmt++; pad_on_right++; }{...} if (c == '0') { zero_fill = true; c = *fmt++; }{...} else { zero_fill = false; }{...} while (is_digit(c)) { left_prec = (left_prec * 10) + (c - '0'); c = *fmt++; }{...} if (c == '.') { c = *fmt++; zero_fill = false; while (is_digit(c)) { right_prec = (right_prec * 10) + (c - '0'); c = *fmt++; }{...} }{...} sign = '\0'; if (c == 'l') { c = *fmt++; islong = 1; if (c == 'l') { c = *fmt++; islonglong = 1; islong = 0; }{...} }{...} switch (c) { case 'p': islong = 1; /* fall through */... case 'd': case 'D': case 'x': case 'X': case 'u': case 'U': #ifdef BINARY_SUPPORT... case 'b': case 'B':/* ... */ #endif if (islonglong) { val = va_arg(ap, long long); }{...} else if (islong) { val = (long long)va_arg(ap, long); }{...} else { val = (long long)va_arg(ap, int); }{...} if ((c == 'd') || (c == 'D')) { if (val < 0) { sign = '-'; val = -val; }{...} }{...} else { if (islonglong) { ; }{...} else if (islong) { val &= ((long long)1 << (sizeof(long) * 8)) - 1; }{...} else { val &= ((long long)1 << (sizeof(int) * 8)) - 1; }{...} }{...} break; default: break;... }{...} switch (c) { case 'p': (*putc)('0'); (*putc)('x'); zero_fill = true; left_prec = sizeof(unsigned long)*2; /* fall through */... case 'd': case 'D': case 'u': case 'U': case 'x': case 'X': switch (c) { case 'd': case 'D': case 'u': case 'U': length = _cvt(val, buf, 10, "0123456789"); break;... case 'p': case 'x': length = _cvt(val, buf, 16, "0123456789abcdef"); break;... case 'X': length = _cvt(val, buf, 16, "0123456789ABCDEF"); break;... }{...} cp = buf; break;... case 's': case 'S': cp = va_arg(ap, char *); if (cp == NULL) { cp = (char *)"<null>"; }{...} length = 0; while (cp[length] != '\0') length++; if (right_prec) { length = MIN(right_prec, length); right_prec = 0; }{...} break;... case 'c': case 'C': c = va_arg(ap, int /*char*/); (*putc)(c); res++; continue; #ifdef BINARY_SUPPORT... case 'b': case 'B': length = left_prec; if (left_prec == 0) { if (islonglong) length = sizeof(long long)*8; else if (islong) length = sizeof(long)*8; else length = sizeof(int)*8; }{...} for (i = 0; i < length-1; i++) { buf[i] = ((val & ((long long)1<<i)) ? '1' : '.'); }{...} cp = buf; break;/* ... */ #endif case '%': (*putc)('%'); break;... default: (*putc)('%'); (*putc)(c); res += 2;... }{...} pad = left_prec - length; right_prec = right_prec - length; if (right_prec > 0) { pad -= right_prec; }{...} if (sign != '\0') { pad--; }{...} if (zero_fill) { c = '0'; if (sign != '\0') { (*putc)(sign); res++; sign = '\0'; }{...} }{...} else { c = ' '; }{...} if (!pad_on_right) { while (pad-- > 0) { (*putc)(c); res++; }{...} }{...} if (sign != '\0') { (*putc)(sign); res++; }{...} while (right_prec-- > 0) { (*putc)('0'); res++; }{...} while (length-- > 0) { c = *cp++; (*putc)(c); res++; }{...} if (pad_on_right) { while (pad-- > 0) { (*putc)(' '); res++; }{...} }{...} }{...} else { (*putc)(c); res++; }{...} }{...} return (res); }{ ... } #endif/* ... */ // !ESP_ROM_HAS_VPRINTF_FUNC #if CONFIG_IDF_TARGET_LINUX // esp_rom_printf is already available from ROM. At the moment we only need this for LINUX. int esp_rom_printf(const char *fmt, ...) { va_list list; va_start(list, fmt); int result = ets_vprintf(esp_rom_output_to_channels, fmt, list); va_end(list); return result; }{...} /* ... */#endif // CONFIG_IDF_TARGET_LINUX int esp_rom_vprintf(const char *fmt, va_list ap) { return ets_vprintf(esp_rom_output_to_channels, fmt, ap); }{ ... }
Details
Show:
from
Types: Columns: