libc.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * File : libc.h
  3. * Brief : gcc libc header file
  4. *
  5. * This file is part of RT-Thread RTOS
  6. * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. *
  22. * Change Logs:
  23. * Date Author Notes
  24. * 2017/10/15 bernard the first version
  25. */
  26. #ifndef __RTT_LIBC_H__
  27. #define __RTT_LIBC_H__
  28. #include <stdio.h>
  29. #include <stdint.h>
  30. #include <string.h>
  31. #include <sys/time.h>
  32. #ifndef _EXFUN
  33. #define _EXFUN(name, proto) name proto
  34. #endif
  35. #define MILLISECOND_PER_SECOND 1000UL
  36. #define MICROSECOND_PER_SECOND 1000000UL
  37. #define NANOSECOND_PER_SECOND 1000000000UL
  38. #define MILLISECOND_PER_TICK (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND)
  39. #define MICROSECOND_PER_TICK (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND)
  40. #define NANOSECOND_PER_TICK (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND)
  41. int libc_system_init(void);
  42. int libc_stdio_set_console(const char* device_name, int mode);
  43. int libc_stdio_get_console(void);
  44. /* some time related function */
  45. int libc_set_time(const struct timespec *time);
  46. int libc_get_time(struct timespec *time);
  47. int libc_time_to_tick(const struct timespec *time);
  48. #endif