rtm.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. /*
  23. * thread interface symbol
  24. */
  25. RTM_EXPORT(rt_thread_init)
  26. RTM_EXPORT(rt_thread_detach)
  27. RTM_EXPORT(rt_thread_create)
  28. RTM_EXPORT(rt_thread_self)
  29. RTM_EXPORT(rt_thread_find)
  30. RTM_EXPORT(rt_thread_startup)
  31. RTM_EXPORT(rt_thread_delete)
  32. RTM_EXPORT(rt_thread_yield)
  33. RTM_EXPORT(rt_thread_delay)
  34. RTM_EXPORT(rt_thread_control)
  35. RTM_EXPORT(rt_thread_suspend)
  36. RTM_EXPORT(rt_thread_resume)
  37. RTM_EXPORT(rt_thread_timeout)
  38. #ifdef RT_USING_SEMAPHORE
  39. /*
  40. * semaphore interface symbol
  41. */
  42. RTM_EXPORT(rt_sem_init)
  43. RTM_EXPORT(rt_sem_detach)
  44. RTM_EXPORT(rt_sem_create)
  45. RTM_EXPORT(rt_sem_delete)
  46. RTM_EXPORT(rt_sem_take)
  47. RTM_EXPORT(rt_sem_trytake)
  48. RTM_EXPORT(rt_sem_release)
  49. RTM_EXPORT(rt_sem_control)
  50. #endif
  51. #ifdef RT_USING_MUTEX
  52. /*
  53. * mutex interface symbol
  54. */
  55. RTM_EXPORT(rt_mutex_init)
  56. RTM_EXPORT(rt_mutex_detach)
  57. RTM_EXPORT(rt_mutex_create)
  58. RTM_EXPORT(rt_mutex_delete)
  59. RTM_EXPORT(rt_mutex_take)
  60. RTM_EXPORT(rt_mutex_release)
  61. RTM_EXPORT(rt_mutex_control)
  62. #endif
  63. #ifdef RT_USING_EVENT
  64. /*
  65. * event interface symbol
  66. */
  67. RTM_EXPORT(rt_event_init)
  68. RTM_EXPORT(rt_event_detach)
  69. RTM_EXPORT(rt_event_create)
  70. RTM_EXPORT(rt_event_delete)
  71. RTM_EXPORT(rt_event_send)
  72. RTM_EXPORT(rt_event_recv)
  73. RTM_EXPORT(rt_event_control)
  74. #endif
  75. #ifdef RT_USING_MAILBOX
  76. /*
  77. * mailbox interface symbol
  78. */
  79. RTM_EXPORT(rt_mb_init)
  80. RTM_EXPORT(rt_mb_detach)
  81. RTM_EXPORT(rt_mb_create)
  82. RTM_EXPORT(rt_mb_delete)
  83. RTM_EXPORT(rt_mb_send)
  84. RTM_EXPORT(rt_mb_recv)
  85. RTM_EXPORT(rt_mb_control)
  86. #endif
  87. #ifdef RT_USING_MESSAGEQUEUE
  88. /*
  89. * message queue interface symbol
  90. */
  91. RTM_EXPORT(rt_mq_init)
  92. RTM_EXPORT(rt_mq_detach)
  93. RTM_EXPORT(rt_mq_create)
  94. RTM_EXPORT(rt_mq_delete)
  95. RTM_EXPORT(rt_mq_send)
  96. RTM_EXPORT(rt_mq_urgent)
  97. RTM_EXPORT(rt_mq_recv)
  98. RTM_EXPORT(rt_mq_control)
  99. #endif
  100. #ifdef RT_USING_MEMPOOL
  101. /*
  102. * memory pool interface symbol
  103. */
  104. RTM_EXPORT(rt_mp_init)
  105. RTM_EXPORT(rt_mp_detach)
  106. RTM_EXPORT(rt_mp_create)
  107. RTM_EXPORT(rt_mp_delete)
  108. RTM_EXPORT(rt_mp_alloc)
  109. RTM_EXPORT(rt_mp_free)
  110. #endif
  111. #ifdef RT_USING_HEAP
  112. /*
  113. * heap memory interface symbol
  114. */
  115. RTM_EXPORT(rt_malloc)
  116. RTM_EXPORT(rt_free)
  117. RTM_EXPORT(rt_realloc)
  118. RTM_EXPORT(rt_calloc)
  119. #endif
  120. /*
  121. * clock & timer interface symbol
  122. */
  123. RTM_EXPORT(rt_tick_get)
  124. RTM_EXPORT(rt_tick_from_millisecond)
  125. RTM_EXPORT(rt_system_timer_init)
  126. RTM_EXPORT(rt_system_timer_thread_init)
  127. RTM_EXPORT(rt_timer_init)
  128. RTM_EXPORT(rt_timer_detach)
  129. RTM_EXPORT(rt_timer_create)
  130. RTM_EXPORT(rt_timer_delete)
  131. RTM_EXPORT(rt_timer_start)
  132. RTM_EXPORT(rt_timer_stop)
  133. RTM_EXPORT(rt_timer_control)
  134. /*
  135. * kservice interface symbol
  136. */
  137. RTM_EXPORT(rt_memcpy)
  138. RTM_EXPORT(rt_memset)
  139. RTM_EXPORT(rt_kprintf)
  140. RTM_EXPORT(rt_sprintf)
  141. /*
  142. * misc interface symbol
  143. */
  144. extern int __aeabi_idiv;
  145. extern int __aeabi_ddiv;
  146. extern int __aeabi_dmul;
  147. extern int __aeabi_i2d;
  148. extern int __aeabi_uidiv;
  149. extern int __aeabi_uidivmod;
  150. extern int __aeabi_d2iz;
  151. RTM_EXPORT(__aeabi_ddiv)
  152. RTM_EXPORT(__aeabi_dmul)
  153. RTM_EXPORT(__aeabi_i2d)
  154. RTM_EXPORT(__aeabi_uidiv)
  155. RTM_EXPORT(__aeabi_idiv)
  156. RTM_EXPORT(__aeabi_uidivmod)
  157. RTM_EXPORT(__aeabi_d2iz)
  158. RTM_EXPORT(strcmp)
  159. RTM_EXPORT(strlen)
  160. RTM_EXPORT(rand)
  161. RTM_EXPORT(memset)
  162. RTM_EXPORT(memcpy)
  163. #ifdef RT_USING_NEWLIB
  164. #include <unistd.h>
  165. RTM_EXPORT(snprintf)
  166. RTM_EXPORT(access)
  167. RTM_EXPORT(__assert_func)
  168. #include <time.h>
  169. RTM_EXPORT(localtime)
  170. RTM_EXPORT(time)
  171. #endif
  172. #ifdef RT_USING_RTGUI
  173. /* FIX ME , should be removed from here */
  174. #include <rtgui/dc.h>
  175. #include <rtgui/rtgui_system.h>
  176. #include <rtgui/widgets/view.h>
  177. #include <rtgui/widgets/workbench.h>
  178. #include <rtgui/widgets/widget.h>
  179. RTM_EXPORT(rtgui_view_show)
  180. RTM_EXPORT(rtgui_view_create)
  181. RTM_EXPORT(rtgui_view_destroy)
  182. RTM_EXPORT(rtgui_view_event_handler)
  183. RTM_EXPORT(rtgui_dc_draw_text)
  184. RTM_EXPORT(rtgui_dc_begin_drawing)
  185. RTM_EXPORT(rtgui_dc_end_drawing)
  186. RTM_EXPORT(rtgui_workbench_event_loop)
  187. RTM_EXPORT(rtgui_workbench_event_handler)
  188. RTM_EXPORT(rtgui_workbench_add_view)
  189. RTM_EXPORT(rtgui_workbench_create)
  190. RTM_EXPORT(rtgui_workbench_destroy)
  191. RTM_EXPORT(rtgui_workbench_close)
  192. RTM_EXPORT(rtgui_timer_start)
  193. RTM_EXPORT(rtgui_timer_create)
  194. RTM_EXPORT(rtgui_timer_stop)
  195. RTM_EXPORT(rtgui_widget_focus)
  196. RTM_EXPORT(rtgui_widget_set_event_handler)
  197. RTM_EXPORT(rtgui_thread_register)
  198. RTM_EXPORT(rtgui_thread_deregister)
  199. #endif
  200. #endif