1 /*
2  * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <sys/reent.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /*
16  * Initialize newlib time functions
17  */
18 void esp_newlib_time_init(void);
19 
20 /**
21  * Replacement for newlib's _REENT_INIT_PTR and __sinit.
22  *
23  * Called from startup code and FreeRTOS, not intended to be called from
24  * application code.
25  */
26 void esp_reent_init(struct _reent* r);
27 
28 /**
29  * Clean up some of lazily allocated buffers in REENT structures.
30  */
31 void esp_reent_cleanup(void);
32 
33 /**
34  * Function which sets up newlib in ROM for use with ESP-IDF
35  *
36  * Includes defining the syscall table, setting up any common locks, etc.
37  *
38  * Called from the startup code, not intended to be called from application
39  * code.
40  */
41 void esp_newlib_init(void);
42 
43 void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_newlib_init() in newer code")));
44 
45 /**
46  * Update current microsecond time from RTC
47  */
48 void esp_set_time_from_rtc(void);
49 
50 /*
51  * Sync timekeeping timers, RTC and high-resolution timer. Update boot_time.
52  */
53 void esp_sync_timekeeping_timers(void);
54 
55 /* Kept for backward compatibility */
56 #define esp_sync_counters_rtc_and_frc esp_sync_timekeeping_timers
57 
58 /**
59  * Initialize newlib static locks
60  */
61 void esp_newlib_locks_init(void);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66