rtm.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /*
  2. * File : rtm.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2010-04-12 yi.qiu first version
  13. */
  14. #include <rtthread.h>
  15. #include <assert.h>
  16. #include <stdlib.h>
  17. #include <string.h>
  18. #include <stdio.h>
  19. /* some buildin kernel symbol */
  20. #ifdef RT_USING_MODULE
  21. #include <rtm.h>
  22. RTM_EXPORT(rt_object_get_information);
  23. /*
  24. * thread interface symbol
  25. */
  26. RTM_EXPORT(rt_thread_init);
  27. RTM_EXPORT(rt_thread_detach);
  28. RTM_EXPORT(rt_thread_create);
  29. RTM_EXPORT(rt_thread_self);
  30. RTM_EXPORT(rt_thread_find);
  31. RTM_EXPORT(rt_thread_startup);
  32. RTM_EXPORT(rt_thread_delete);
  33. RTM_EXPORT(rt_thread_yield);
  34. RTM_EXPORT(rt_thread_delay);
  35. RTM_EXPORT(rt_thread_control);
  36. RTM_EXPORT(rt_thread_suspend);
  37. RTM_EXPORT(rt_thread_resume);
  38. RTM_EXPORT(rt_thread_timeout);
  39. #ifdef RT_USING_SEMAPHORE
  40. /*
  41. * semaphore interface symbol
  42. */
  43. RTM_EXPORT(rt_sem_init);
  44. RTM_EXPORT(rt_sem_detach);
  45. RTM_EXPORT(rt_sem_create);
  46. RTM_EXPORT(rt_sem_delete);
  47. RTM_EXPORT(rt_sem_take);
  48. RTM_EXPORT(rt_sem_trytake);
  49. RTM_EXPORT(rt_sem_release);
  50. RTM_EXPORT(rt_sem_control);
  51. #endif
  52. #ifdef RT_USING_MUTEX
  53. /*
  54. * mutex interface symbol
  55. */
  56. RTM_EXPORT(rt_mutex_init);
  57. RTM_EXPORT(rt_mutex_detach);
  58. RTM_EXPORT(rt_mutex_create);
  59. RTM_EXPORT(rt_mutex_delete);
  60. RTM_EXPORT(rt_mutex_take);
  61. RTM_EXPORT(rt_mutex_release);
  62. RTM_EXPORT(rt_mutex_control);
  63. #endif
  64. #ifdef RT_USING_EVENT
  65. /*
  66. * event interface symbol
  67. */
  68. RTM_EXPORT(rt_event_init);
  69. RTM_EXPORT(rt_event_detach);
  70. RTM_EXPORT(rt_event_create);
  71. RTM_EXPORT(rt_event_delete);
  72. RTM_EXPORT(rt_event_send);
  73. RTM_EXPORT(rt_event_recv);
  74. RTM_EXPORT(rt_event_control);
  75. #endif
  76. #ifdef RT_USING_MAILBOX
  77. /*
  78. * mailbox interface symbol
  79. */
  80. RTM_EXPORT(rt_mb_init);
  81. RTM_EXPORT(rt_mb_detach);
  82. RTM_EXPORT(rt_mb_create);
  83. RTM_EXPORT(rt_mb_delete);
  84. RTM_EXPORT(rt_mb_send);
  85. RTM_EXPORT(rt_mb_recv);
  86. RTM_EXPORT(rt_mb_control);
  87. #endif
  88. #ifdef RT_USING_MESSAGEQUEUE
  89. /*
  90. * message queue interface symbol
  91. */
  92. RTM_EXPORT(rt_mq_init);
  93. RTM_EXPORT(rt_mq_detach);
  94. RTM_EXPORT(rt_mq_create);
  95. RTM_EXPORT(rt_mq_delete);
  96. RTM_EXPORT(rt_mq_send);
  97. RTM_EXPORT(rt_mq_urgent);
  98. RTM_EXPORT(rt_mq_recv);
  99. RTM_EXPORT(rt_mq_control);
  100. #endif
  101. #ifdef RT_USING_MEMPOOL
  102. /*
  103. * memory pool interface symbol
  104. */
  105. RTM_EXPORT(rt_mp_init);
  106. RTM_EXPORT(rt_mp_detach);
  107. RTM_EXPORT(rt_mp_create);
  108. RTM_EXPORT(rt_mp_delete);
  109. RTM_EXPORT(rt_mp_alloc);
  110. RTM_EXPORT(rt_mp_free);
  111. #endif
  112. #ifdef RT_USING_HEAP
  113. /*
  114. * heap memory interface symbol
  115. */
  116. RTM_EXPORT(rt_malloc);
  117. RTM_EXPORT(rt_free);
  118. RTM_EXPORT(rt_realloc);
  119. RTM_EXPORT(rt_calloc);
  120. #endif
  121. /*
  122. * clock & timer interface symbol
  123. */
  124. RTM_EXPORT(rt_tick_get);
  125. RTM_EXPORT(rt_tick_from_millisecond);
  126. RTM_EXPORT(rt_system_timer_init);
  127. RTM_EXPORT(rt_system_timer_thread_init);
  128. RTM_EXPORT(rt_timer_init);
  129. RTM_EXPORT(rt_timer_detach);
  130. RTM_EXPORT(rt_timer_create);
  131. RTM_EXPORT(rt_timer_delete);
  132. RTM_EXPORT(rt_timer_start);
  133. RTM_EXPORT(rt_timer_stop);
  134. RTM_EXPORT(rt_timer_control);
  135. /*
  136. * kservice interface symbol
  137. */
  138. RTM_EXPORT(rt_memcpy);
  139. RTM_EXPORT(rt_memcmp);
  140. RTM_EXPORT(rt_memset);
  141. RTM_EXPORT(rt_kprintf);
  142. RTM_EXPORT(rt_sprintf);
  143. RTM_EXPORT(rt_strstr);
  144. RTM_EXPORT(rt_snprintf);
  145. /*
  146. * misc interface symbol
  147. */
  148. extern int __aeabi_idiv;
  149. extern int __aeabi_ddiv;
  150. extern int __aeabi_dmul;
  151. extern int __aeabi_i2d;
  152. extern int __aeabi_uidiv;
  153. extern int __aeabi_uidivmod;
  154. extern int __aeabi_idivmod;
  155. extern int __aeabi_d2iz;
  156. RTM_EXPORT(__aeabi_ddiv);
  157. RTM_EXPORT(__aeabi_dmul);
  158. RTM_EXPORT(__aeabi_i2d);
  159. RTM_EXPORT(__aeabi_uidiv);
  160. RTM_EXPORT(__aeabi_idiv);
  161. RTM_EXPORT(__aeabi_idivmod);
  162. RTM_EXPORT(__aeabi_uidivmod);
  163. RTM_EXPORT(__aeabi_d2iz);
  164. RTM_EXPORT(strcmp);
  165. RTM_EXPORT(strcpy);
  166. RTM_EXPORT(strlen);
  167. RTM_EXPORT(rand);
  168. RTM_EXPORT(memset);
  169. RTM_EXPORT(memcpy);
  170. #if defined(RT_USING_NEWLIB) && defined(RT_USING_PTHREADS)
  171. #include <unistd.h>
  172. RTM_EXPORT(printf);
  173. RTM_EXPORT(snprintf);
  174. RTM_EXPORT(access);
  175. RTM_EXPORT(__assert_func);
  176. #include <time.h>
  177. RTM_EXPORT(localtime);
  178. RTM_EXPORT(time);
  179. #include <math.h>
  180. RTM_EXPORT(sin);
  181. RTM_EXPORT(cos);
  182. #endif
  183. #ifdef RT_USING_DFS
  184. #include <dfs_posix.h>
  185. RTM_EXPORT(open);
  186. RTM_EXPORT(close);
  187. RTM_EXPORT(read);
  188. RTM_EXPORT(write);
  189. RTM_EXPORT(stat);
  190. #endif
  191. #ifdef RT_USING_RTGUI
  192. /* FIX ME , should be removed from here */
  193. #include <rtgui/dc.h>
  194. #include <rtgui/rtgui_server.h>
  195. #include <rtgui/rtgui_system.h>
  196. #include <rtgui/widgets/view.h>
  197. #include <rtgui/widgets/workbench.h>
  198. #include <rtgui/widgets/widget.h>
  199. #include <rtgui/widgets/button.h>
  200. #include <rtgui/widgets/label.h>
  201. #include <rtgui/widgets/list_view.h>
  202. #include <rtgui/widgets/listctrl.h>
  203. #include <rtgui/widgets/filelist_view.h>
  204. RTM_EXPORT(rtgui_label_create);
  205. RTM_EXPORT(rtgui_view_show);
  206. RTM_EXPORT(rtgui_view_create);
  207. RTM_EXPORT(rtgui_view_destroy);
  208. RTM_EXPORT(rtgui_view_event_handler);
  209. RTM_EXPORT(rtgui_dc_draw_text);
  210. RTM_EXPORT(rtgui_dc_begin_drawing);
  211. RTM_EXPORT(rtgui_dc_end_drawing);
  212. RTM_EXPORT(rtgui_workbench_event_loop);
  213. RTM_EXPORT(rtgui_workbench_event_handler);
  214. RTM_EXPORT(rtgui_workbench_add_view);
  215. RTM_EXPORT(rtgui_workbench_create);
  216. RTM_EXPORT(rtgui_workbench_destroy);
  217. RTM_EXPORT(rtgui_workbench_close);
  218. RTM_EXPORT(rtgui_timer_start);
  219. RTM_EXPORT(rtgui_timer_create);
  220. RTM_EXPORT(rtgui_timer_destory);
  221. RTM_EXPORT(rtgui_timer_stop);
  222. RTM_EXPORT(rtgui_thread_register);
  223. RTM_EXPORT(rtgui_thread_deregister);
  224. RTM_EXPORT(rtgui_widget_focus);
  225. RTM_EXPORT(rtgui_widget_set_event_handler);
  226. RTM_EXPORT(rtgui_widget_rect_to_device);
  227. RTM_EXPORT(rtgui_widget_update);
  228. RTM_EXPORT(rtgui_widget_get_rect);
  229. RTM_EXPORT(rtgui_widget_set_rect);
  230. RTM_EXPORT(rtgui_widget_get_toplevel);
  231. RTM_EXPORT(rtgui_panel_register);
  232. RTM_EXPORT(rtgui_panel_set_default_focused);
  233. RTM_EXPORT(rtgui_button_create);
  234. RTM_EXPORT(rtgui_button_destroy);
  235. RTM_EXPORT(rtgui_button_set_onbutton);
  236. RTM_EXPORT(rtgui_container_add_child);
  237. RTM_EXPORT(rtgui_filelist_view_create);
  238. RTM_EXPORT(rtgui_filelist_view_get_fullpath);
  239. RTM_EXPORT(rtgui_list_view_create);
  240. RTM_EXPORT(rtgui_list_view_destroy);
  241. RTM_EXPORT(rtgui_listctrl_set_onitem);
  242. RTM_EXPORT(rtgui_image_create_from_mem);
  243. RTM_EXPORT(rtgui_listctrl_create);
  244. RTM_EXPORT(rtgui_listctrl_set_items);
  245. #endif
  246. #endif