/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. * History:
  26. * ================================================================
  27. * 2010-10-2 Jiao JinXing <jiaojinxing1987@gmail.com> created
  28. *
  29. */
  30. #include "ftk_typedef.h"
  31. #include <rtthread.h>
  32. size_t ftk_get_relative_time(void)
  33. {
  34. rt_tick_t tick = rt_tick_get();
  35. return tick/RT_TICK_PER_SECOND*1000;
  36. }
  37. static int ftk_deinited = 0;
  38. static void ftk_cleanup(void)
  39. {
  40. extern void ftk_deinit(void);
  41. if (ftk_deinited == 0)
  42. {
  43. ftk_deinited = 1;
  44. ftk_deinit();
  45. }
  46. }
  47. int ftk_platform_init(int argc, char** argv)
  48. {
  49. void ftk_rtthread_select_init(void);
  50. ftk_rtthread_select_init();
  51. return RET_OK;
  52. }
  53. void ftk_platform_deinit(void)
  54. {
  55. void ftk_rtthread_select_deinit(void);
  56. ftk_deinited = 1;
  57. ftk_rtthread_select_deinit();
  58. }