libc.h 1.1 KB
Newer Older
B
bernard 已提交
1
/*
2
 * Copyright (c) 2006-2018, RT-Thread Development Team
B
bernard 已提交
3
 *
4
 * SPDX-License-Identifier: Apache-2.0
B
bernard 已提交
5 6 7 8 9
 *
 * Change Logs:
 * Date           Author       Notes
 * 2017/10/15     bernard      the first version
 */
M
Ming, Bai 已提交
10 11 12
#ifndef __RTT_LIBC_H__
#define __RTT_LIBC_H__

B
Bernard Xiong 已提交
13 14 15
#include <stdio.h>
#include <stdint.h>
#include <string.h>
M
Ming, Bai 已提交
16 17
#include <sys/time.h>

B
Bernard Xiong 已提交
18 19 20 21
#ifndef _EXFUN
#define _EXFUN(name, proto)		name proto
#endif

22 23 24
#define MILLISECOND_PER_SECOND  1000UL
#define MICROSECOND_PER_SECOND  1000000UL
#define NANOSECOND_PER_SECOND   1000000000UL
M
Ming, Bai 已提交
25

26 27 28
#define MILLISECOND_PER_TICK    (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND)
#define MICROSECOND_PER_TICK    (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND)
#define NANOSECOND_PER_TICK     (NANOSECOND_PER_SECOND  / RT_TICK_PER_SECOND)
M
Ming, Bai 已提交
29

30 31 32 33 34 35
#ifdef __cplusplus
extern "C" {
#endif
    int libc_system_init(void);
    int libc_stdio_set_console(const char* device_name, int mode);
    int libc_stdio_get_console(void);
M
Ming, Bai 已提交
36

37 38 39 40 41 42 43
    /* some time related function */
    int libc_set_time(const struct timespec* time);
    int libc_get_time(struct timespec* time);
    int libc_time_to_tick(const struct timespec* time);
#ifdef __cplusplus
}
#endif
M
Ming, Bai 已提交
44 45

#endif