1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef __ESP_NEWLIB_H__
16 #define __ESP_NEWLIB_H__
17 
18 #include <sys/reent.h>
19 
20 /*
21  * Initialize newlib time functions
22  */
23 void esp_newlib_time_init(void);
24 
25 /**
26  * Replacement for newlib's _REENT_INIT_PTR and __sinit.
27  *
28  * Called from startup code and FreeRTOS, not intended to be called from
29  * application code.
30  */
31 void esp_reent_init(struct _reent* r);
32 
33 /**
34  * Clean up some of lazily allocated buffers in REENT structures.
35  */
36 void esp_reent_cleanup(void);
37 
38 /**
39  * Function which sets up newlib in ROM for use with ESP-IDF
40  *
41  * Includes defining the syscall table, setting up any common locks, etc.
42  *
43  * Called from the startup code, not intended to be called from application
44  * code.
45  */
46 void esp_newlib_init(void);
47 
48 void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_newlib_init() in newer code")));
49 
50 /**
51  * Update current microsecond time from RTC
52  */
53 void esp_set_time_from_rtc(void);
54 
55 /*
56  * Sync counters RTC and FRC. Update boot_time.
57  */
58 void esp_sync_counters_rtc_and_frc(void);
59 
60 /**
61  * Initialize newlib static locks
62  */
63 void esp_newlib_locks_init(void);
64 
65 #endif //__ESP_NEWLIB_H__
66