2021-12-14 19:01:19 +08:00
|
|
|
/*
|
2024-06-26 15:40:32 +02:00
|
|
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
2021-12-14 19:01:19 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2024-09-26 13:13:20 +07:00
|
|
|
/* TODO IDF-11226 rename this file to esp_libc.h */
|
2022-07-04 11:53:42 +02:00
|
|
|
#pragma once
|
2016-10-25 22:12:07 +08:00
|
|
|
|
2016-10-25 22:16:08 +08:00
|
|
|
#include <sys/reent.h>
|
|
|
|
|
2022-07-04 11:53:42 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-10-25 22:16:08 +08:00
|
|
|
/**
|
2024-09-26 13:13:20 +07:00
|
|
|
* Function which sets up newlib in ROM for use with ESP-IDF
|
2016-10-25 22:16:08 +08:00
|
|
|
*
|
2024-09-26 13:13:20 +07:00
|
|
|
* Includes defining the syscall table, setting up any common locks, etc.
|
|
|
|
*
|
|
|
|
* Called from the startup code, not intended to be called from application
|
|
|
|
* code.
|
2016-10-25 22:16:08 +08:00
|
|
|
*/
|
2024-09-26 13:13:20 +07:00
|
|
|
void esp_libc_init(void);
|
|
|
|
|
|
|
|
void esp_setup_syscall_table(void) __attribute__((deprecated("Please call esp_libc_init() in newer code")));
|
2016-10-25 22:16:08 +08:00
|
|
|
|
2023-08-09 12:11:54 +04:00
|
|
|
/**
|
|
|
|
* Postponed _GLOBAL_REENT stdio FPs initialization.
|
|
|
|
*
|
|
|
|
* Can not be a part of esp_reent_init() because stdio device may not initialized yet.
|
|
|
|
*
|
|
|
|
* Called from startup code and FreeRTOS, not intended to be called from
|
|
|
|
* application code.
|
|
|
|
*
|
|
|
|
*/
|
2024-09-26 13:13:20 +07:00
|
|
|
#if CONFIG_VFS_SUPPORT_IO
|
|
|
|
void esp_libc_init_global_stdio(const char *stdio_dev);
|
|
|
|
#else
|
|
|
|
void esp_libc_init_global_stdio(void);
|
|
|
|
#endif
|
2023-08-09 12:11:54 +04:00
|
|
|
|
2024-09-26 13:13:20 +07:00
|
|
|
void esp_libc_time_init(void);
|
2019-04-15 21:07:38 +08:00
|
|
|
|
2024-09-26 13:13:20 +07:00
|
|
|
#if CONFIG_LIBC_NEWLIB
|
2016-10-25 22:12:07 +08:00
|
|
|
/**
|
2024-09-26 13:13:20 +07:00
|
|
|
* Replacement for newlib's _REENT_INIT_PTR and __sinit.
|
2016-10-25 22:12:07 +08:00
|
|
|
*
|
2024-09-26 13:13:20 +07:00
|
|
|
* Called from startup code and FreeRTOS, not intended to be called from
|
|
|
|
* application code.
|
2016-10-25 22:12:07 +08:00
|
|
|
*/
|
2024-09-26 13:13:20 +07:00
|
|
|
void esp_reent_init(struct _reent* r);
|
|
|
|
#endif
|
2020-12-30 09:31:16 +08:00
|
|
|
|
2024-09-26 13:13:20 +07:00
|
|
|
/**
|
|
|
|
* Clean up some of lazily allocated buffers in REENT structures.
|
|
|
|
*/
|
|
|
|
void esp_reent_cleanup(void);
|
2016-10-25 22:12:07 +08:00
|
|
|
|
2016-11-02 17:17:28 +08:00
|
|
|
/**
|
2017-08-29 11:48:18 +08:00
|
|
|
* Update current microsecond time from RTC
|
2016-11-02 17:17:28 +08:00
|
|
|
*/
|
2019-07-16 16:33:30 +07:00
|
|
|
void esp_set_time_from_rtc(void);
|
2016-10-25 22:12:07 +08:00
|
|
|
|
2018-06-04 12:39:18 +05:00
|
|
|
/*
|
2021-12-14 19:01:19 +08:00
|
|
|
* Sync timekeeping timers, RTC and high-resolution timer. Update boot_time.
|
2018-06-04 12:39:18 +05:00
|
|
|
*/
|
2021-12-14 19:01:19 +08:00
|
|
|
void esp_sync_timekeeping_timers(void);
|
|
|
|
|
|
|
|
/* Kept for backward compatibility */
|
|
|
|
#define esp_sync_counters_rtc_and_frc esp_sync_timekeeping_timers
|
2018-06-04 12:39:18 +05:00
|
|
|
|
2020-06-10 18:03:32 +00:00
|
|
|
/**
|
2024-09-26 13:13:20 +07:00
|
|
|
* Initialize libc static locks
|
2020-06-10 18:03:32 +00:00
|
|
|
*/
|
2024-09-26 13:13:20 +07:00
|
|
|
void esp_libc_locks_init(void);
|
|
|
|
|
|
|
|
/* TODO IDF-11226 */
|
|
|
|
void esp_newlib_time_init(void) __attribute__((deprecated("Please use esp_libc_time_init instead")));
|
|
|
|
void esp_newlib_init(void) __attribute__((deprecated("Please use esp_libc_init instead")));
|
|
|
|
void esp_newlib_locks_init(void) __attribute__((deprecated("Please use esp_libc_locks_init instead")));
|
2020-06-10 18:03:32 +00:00
|
|
|
|
2022-07-04 11:53:42 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|