xref: /nrf52832-nimble/rt-thread/components/libc/compilers/newlib/libc.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
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 
13 #include <stdio.h>
14 #include <stdint.h>
15 #include <string.h>
16 #include <sys/time.h>
17 
18 #ifndef _EXFUN
19 #define _EXFUN(name, proto)		name proto
20 #endif
21 
22 #define MILLISECOND_PER_SECOND  1000UL
23 #define MICROSECOND_PER_SECOND  1000000UL
24 #define NANOSECOND_PER_SECOND   1000000000UL
25 
26 #define MILLISECOND_PER_TICK    (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND)
27 #define MICROSECOND_PER_TICK    (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND)
28 #define NANOSECOND_PER_TICK     (NANOSECOND_PER_SECOND  / RT_TICK_PER_SECOND)
29 
30 int libc_system_init(void);
31 int libc_stdio_set_console(const char* device_name, int mode);
32 int libc_stdio_get_console(void);
33 
34 /* some time related function */
35 int libc_set_time(const struct timespec *time);
36 int libc_get_time(struct timespec *time);
37 int libc_time_to_tick(const struct timespec *time);
38 
39 #endif
40