rtm.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. /*
  2. * File : rtm.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2012, 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_MEMHEAP
  102. /*
  103. * memory heap interface symbol
  104. */
  105. RTM_EXPORT(rt_memheap_init);
  106. RTM_EXPORT(rt_memheap_detach);
  107. RTM_EXPORT(rt_memheap_alloc);
  108. RTM_EXPORT(rt_memheap_free);
  109. #endif
  110. #ifdef RT_USING_MEMPOOL
  111. /*
  112. * memory pool interface symbol
  113. */
  114. RTM_EXPORT(rt_mp_init);
  115. RTM_EXPORT(rt_mp_detach);
  116. RTM_EXPORT(rt_mp_create);
  117. RTM_EXPORT(rt_mp_delete);
  118. RTM_EXPORT(rt_mp_alloc);
  119. RTM_EXPORT(rt_mp_free);
  120. #endif
  121. #ifdef RT_USING_HEAP
  122. /*
  123. * heap memory interface symbol
  124. */
  125. RTM_EXPORT(rt_malloc);
  126. RTM_EXPORT(rt_free);
  127. RTM_EXPORT(rt_realloc);
  128. RTM_EXPORT(rt_calloc);
  129. #endif
  130. /*
  131. * clock & timer interface symbol
  132. */
  133. RTM_EXPORT(rt_tick_get);
  134. RTM_EXPORT(rt_tick_from_millisecond);
  135. RTM_EXPORT(rt_system_timer_init);
  136. RTM_EXPORT(rt_system_timer_thread_init);
  137. RTM_EXPORT(rt_timer_init);
  138. RTM_EXPORT(rt_timer_detach);
  139. RTM_EXPORT(rt_timer_create);
  140. RTM_EXPORT(rt_timer_delete);
  141. RTM_EXPORT(rt_timer_start);
  142. RTM_EXPORT(rt_timer_stop);
  143. RTM_EXPORT(rt_timer_control);
  144. /*
  145. * kservice interface symbol
  146. */
  147. RTM_EXPORT(rt_memcpy);
  148. RTM_EXPORT(rt_memcmp);
  149. RTM_EXPORT(rt_memset);
  150. RTM_EXPORT(rt_kprintf);
  151. RTM_EXPORT(rt_sprintf);
  152. RTM_EXPORT(rt_strstr);
  153. RTM_EXPORT(rt_snprintf);
  154. /*
  155. * misc interface symbol
  156. */
  157. extern int __aeabi_idiv;
  158. extern int __aeabi_ddiv;
  159. extern int __aeabi_dmul;
  160. extern int __aeabi_i2d;
  161. extern int __aeabi_uidiv;
  162. extern int __aeabi_uidivmod;
  163. extern int __aeabi_idivmod;
  164. extern int __aeabi_d2iz;
  165. RTM_EXPORT(__aeabi_ddiv);
  166. RTM_EXPORT(__aeabi_dmul);
  167. RTM_EXPORT(__aeabi_i2d);
  168. RTM_EXPORT(__aeabi_uidiv);
  169. RTM_EXPORT(__aeabi_idiv);
  170. RTM_EXPORT(__aeabi_idivmod);
  171. RTM_EXPORT(__aeabi_uidivmod);
  172. RTM_EXPORT(__aeabi_d2iz);
  173. RTM_EXPORT(strcmp);
  174. RTM_EXPORT(strcpy);
  175. RTM_EXPORT(strlen);
  176. RTM_EXPORT(rand);
  177. RTM_EXPORT(memset);
  178. RTM_EXPORT(memcpy);
  179. #if defined(RT_USING_NEWLIB) && defined(RT_USING_PTHREADS)
  180. #include <unistd.h>
  181. RTM_EXPORT(printf);
  182. RTM_EXPORT(snprintf);
  183. RTM_EXPORT(access);
  184. RTM_EXPORT(__assert_func);
  185. #include <time.h>
  186. RTM_EXPORT(localtime);
  187. RTM_EXPORT(time);
  188. #include <math.h>
  189. RTM_EXPORT(sin);
  190. RTM_EXPORT(cos);
  191. #endif
  192. #ifdef RT_USING_DFS
  193. #include <dfs_posix.h>
  194. RTM_EXPORT(open);
  195. RTM_EXPORT(close);
  196. RTM_EXPORT(read);
  197. RTM_EXPORT(write);
  198. RTM_EXPORT(stat);
  199. #endif
  200. #ifdef RT_USING_RTGUI
  201. /* FIX ME , should be removed from here */
  202. #include <rtgui/dc.h>
  203. #include <rtgui/rtgui_server.h>
  204. #include <rtgui/rtgui_system.h>
  205. #include <rtgui/widgets/view.h>
  206. #include <rtgui/widgets/workbench.h>
  207. #include <rtgui/widgets/widget.h>
  208. #include <rtgui/widgets/button.h>
  209. #include <rtgui/widgets/label.h>
  210. #include <rtgui/widgets/list_view.h>
  211. #include <rtgui/widgets/listctrl.h>
  212. #include <rtgui/widgets/filelist_view.h>
  213. RTM_EXPORT(rtgui_label_create);
  214. RTM_EXPORT(rtgui_view_show);
  215. RTM_EXPORT(rtgui_view_create);
  216. RTM_EXPORT(rtgui_view_destroy);
  217. RTM_EXPORT(rtgui_view_event_handler);
  218. RTM_EXPORT(rtgui_dc_draw_text);
  219. RTM_EXPORT(rtgui_dc_begin_drawing);
  220. RTM_EXPORT(rtgui_dc_end_drawing);
  221. RTM_EXPORT(rtgui_workbench_event_loop);
  222. RTM_EXPORT(rtgui_workbench_event_handler);
  223. RTM_EXPORT(rtgui_workbench_add_view);
  224. RTM_EXPORT(rtgui_workbench_create);
  225. RTM_EXPORT(rtgui_workbench_destroy);
  226. RTM_EXPORT(rtgui_workbench_close);
  227. RTM_EXPORT(rtgui_timer_start);
  228. RTM_EXPORT(rtgui_timer_create);
  229. RTM_EXPORT(rtgui_timer_destory);
  230. RTM_EXPORT(rtgui_timer_stop);
  231. RTM_EXPORT(rtgui_thread_register);
  232. RTM_EXPORT(rtgui_thread_deregister);
  233. RTM_EXPORT(rtgui_widget_focus);
  234. RTM_EXPORT(rtgui_widget_set_event_handler);
  235. RTM_EXPORT(rtgui_widget_rect_to_device);
  236. RTM_EXPORT(rtgui_widget_update);
  237. RTM_EXPORT(rtgui_widget_get_rect);
  238. RTM_EXPORT(rtgui_widget_set_rect);
  239. RTM_EXPORT(rtgui_widget_get_toplevel);
  240. RTM_EXPORT(rtgui_panel_register);
  241. RTM_EXPORT(rtgui_panel_set_default_focused);
  242. RTM_EXPORT(rtgui_button_create);
  243. RTM_EXPORT(rtgui_button_destroy);
  244. RTM_EXPORT(rtgui_button_set_onbutton);
  245. RTM_EXPORT(rtgui_container_add_child);
  246. RTM_EXPORT(rtgui_filelist_view_create);
  247. RTM_EXPORT(rtgui_filelist_view_get_fullpath);
  248. RTM_EXPORT(rtgui_list_view_create);
  249. RTM_EXPORT(rtgui_list_view_destroy);
  250. RTM_EXPORT(rtgui_listctrl_set_onitem);
  251. RTM_EXPORT(rtgui_image_create_from_mem);
  252. RTM_EXPORT(rtgui_listctrl_create);
  253. RTM_EXPORT(rtgui_listctrl_set_items);
  254. #endif
  255. #endif