esp_newlib.h 1.7 KB

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