libc.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2017/10/15 bernard the first version
  9. */
  10. #ifndef __RTT_LIBC_H__
  11. #define __RTT_LIBC_H__
  12. #include <stdio.h>
  13. #include <stdint.h>
  14. #include <string.h>
  15. #include <sys/time.h>
  16. #ifndef _EXFUN
  17. #define _EXFUN(name, proto) name proto
  18. #endif
  19. #define MILLISECOND_PER_SECOND 1000UL
  20. #define MICROSECOND_PER_SECOND 1000000UL
  21. #define NANOSECOND_PER_SECOND 1000000000UL
  22. #define MILLISECOND_PER_TICK (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND)
  23. #define MICROSECOND_PER_TICK (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND)
  24. #define NANOSECOND_PER_TICK (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND)
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. int libc_system_init(void);
  29. int libc_stdio_set_console(const char* device_name, int mode);
  30. int libc_stdio_get_console(void);
  31. /* some time related function */
  32. int libc_set_time(const struct timespec* time);
  33. int libc_get_time(struct timespec* time);
  34. int libc_time_to_tick(const struct timespec* time);
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif