PageRenderTime 29ms CodeModel.GetById 17ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/src/os/rt-thread/ftk_rtthread.c

http://ftk.googlecode.com/
C | 73 lines | 29 code | 15 blank | 29 comment | 2 complexity | fd5b050d83802b1934c42d67e5d7d87e MD5 | raw file
 1/*
 2 * File: ftk_rtthread.c
 3 * Author:  Jiao JinXing <jiaojinxing1987@gmail.com>
 4 * Brief:   RT-Thread specific functions.
 5 *
 6 * Copyright (c) 2009 - 2010  Jiao JinXing <jiaojinxing1987@gmail.com>
 7 *
 8 * Licensed under the Academic Free License version 2.1
 9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 */
24
25/*
26 * History:
27 * ================================================================
28 * 2010-10-2 Jiao JinXing <jiaojinxing1987@gmail.com> created
29 *
30 */
31
32#include "ftk_typedef.h"
33#include <rtthread.h>
34
35size_t ftk_get_relative_time(void)
36{
37	rt_tick_t tick = rt_tick_get();
38
39	return tick/RT_TICK_PER_SECOND*1000;
40}
41
42static int ftk_deinited = 0;
43
44static void ftk_cleanup(void)
45{
46    extern void ftk_deinit(void);
47
48    if (ftk_deinited == 0)
49    {
50        ftk_deinited = 1;
51
52        ftk_deinit();
53    }
54}
55
56int  ftk_platform_init(int argc, char** argv)
57{
58	void ftk_rtthread_select_init(void);
59
60	ftk_rtthread_select_init();
61
62    return RET_OK;
63}
64
65void ftk_platform_deinit(void)
66{
67	void ftk_rtthread_select_deinit(void);
68
69    ftk_deinited = 1;
70
71	ftk_rtthread_select_deinit();
72}
73