kernel.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * This file is only used for doxygen document generation.
  3. */
  4. /**
  5. * @defgroup group_Kernel RT-Thread Kernel API
  6. *
  7. * The Kernel APIs are the core APIs of RT-Thread, which supports the following
  8. * features:
  9. * - Multi-thread management
  10. * - Synchronization mechanisms
  11. * - Inter-thread communication
  12. * - Memory management
  13. * - Asynchronous timer
  14. */
  15. /**
  16. * @addtogroup group_Kernel
  17. * @{
  18. */
  19. /**
  20. * @defgroup group_Thread Thread Management
  21. * @brief the thread management
  22. *
  23. * RT-Thread operating system supports multitask systems, which are based on thread
  24. * scheduling.
  25. * - The scheduling is a full preemptive priority-based scheduling algorithm.
  26. * - 8/32/256 priority levels are supported, in which 0 is the highest and 7/31/255 the lowest.
  27. * The 7/31/255th priority is used for idle thread.
  28. * - Threads running at same priority level are supported. The shared time-slice
  29. * round-robin scheduling is used for this case.
  30. * - The time of scheduler to choose the next highest ready thread is determinant.
  31. * - There are four status in thread management
  32. * -# Initialization
  33. * -# Running/Ready
  34. * -# Blocked
  35. * -# Closed
  36. * - The number of threads in the system is unlimited, only related with RAM.
  37. */
  38. /**
  39. * @defgroup group_Clock Clock and Timer Management
  40. * @brief clock and system timer management
  41. *
  42. * RT-Thread uses clock tick to implement shared time-slice scheduling.
  43. *
  44. * The timing sensitivity of thread is implemented by timers. The timer can be set as
  45. * one-shot or periodic timeout.
  46. */
  47. /**
  48. * @defgroup group_KernelObject Kernel Object Management
  49. * @brief kernel object management
  50. *
  51. * The Kernel object system can access and manage all of the kernel objects.
  52. *
  53. * Kernel objects include most of the facilities in the kernel:
  54. * - thread
  55. * - semaphore and mutex
  56. * - event/fast event, mailbox, messagequeue
  57. * - memory pool
  58. * - timer
  59. * @image html Kernel_Object.png "Figure 2: Kernel Object"
  60. * @image rtf Kernel_Object.png "Figure 2: Kernel Object"
  61. *
  62. * Kernel objects can be static objects, whose memory is allocated in compiling.
  63. * It can be dynamic objects as well, whose memory is allocated from system heaps
  64. * in runtime.
  65. */
  66. /**
  67. * @defgroup group_IPC Inter-Thread Communication
  68. * @brief inter-thread communication
  69. *
  70. * RT-Thread operating system supports the traditional semaphore and mutex.
  71. * - Mutex objects use inherited priority to prevent priority reversion.
  72. * - The semaphore release action is safe for interrupt service routine.
  73. *
  74. * Moreover, the blocked queue for thread to obtain semaphore or mutex can be sorted
  75. * by priority or FIFO. There are two flags to indicate this mechanism.
  76. * - RT_IPC_FLAG_FIFO
  77. * when the resource is available, thread pended on this resource at first would get
  78. * the resource.
  79. * - RT_IPC_FLAG_PRIO
  80. * when the resource is available, thread pended on this resource who had the most high
  81. * priority would get the resource.
  82. *
  83. * RT-Thread operating systems supports event/fast event, mail box and message queue.
  84. * - The event mechanism is used to awake a thread by setting one or more corresponding
  85. * bit of a binary number when an event ocurs.
  86. * - The fast event supports event thread queue. Once a one bit event occurs, the corresponding
  87. * blocked thread can be found out timing accurately, then will be waked up.
  88. * - In mailbox, the mail length is fixed to 4 byte, which is more effective than message queue.
  89. * - The send action for communication facilities is also safe for interrupt service routine.
  90. */
  91. /**
  92. * @defgroup group_Signal Signal
  93. * @brief signal is used for thread kill etc.
  94. *
  95. * A signal (also known as a soft interrupt signal), from a software perspective,
  96. * is a simulation of interrupt mechanism. When it comes to its principle,
  97. * thread receiving a signal is similar to processor receiving an interrupt request.
  98. */
  99. /**
  100. * @defgroup group_MM Memory Management
  101. * @brief memory management for memory pool and heap memory
  102. *
  103. * RT-Thread operating system supports two types memory management:
  104. * - Static memory pool management
  105. * - Dynamic memory heap management.
  106. *
  107. * The time to allocate a memory block from the memory pool is determinant. When
  108. * the memory pool is empty, the allocated thread can be blocked (or immediately return,
  109. * or waiting for sometime to return, which are determined by a timeout parameter).
  110. * When other thread releases memory blocks to this memory pool, the blocked thread is
  111. * wake up.
  112. *
  113. * There are two methods in dynamic memory heap management, one is used for small memory,
  114. * such as less than 1MB. Another is a SLAB like memory management, which is suitable
  115. * for large memory system. All of them has no real-time character.
  116. */
  117. /**
  118. * @defgroup group_Device Device System
  119. * @brief device I/O subsystem
  120. *
  121. * The Device System is designed as simple and minimum layer to help communication between
  122. * applications and drivers.
  123. *
  124. * The Device System provide five interfaces to driver:
  125. * - open, open a device
  126. * - close, close a device
  127. * - read, read some data from a device
  128. * - write, write some data to a device
  129. * - control, send some control command to a device
  130. */
  131. /**
  132. * @defgroup group_Hook Runtime Trace and Record
  133. * @brief the hook function set in runtime
  134. *
  135. * In order to trace and record RT-Thread activity in runtime, a hook mechanism
  136. * is introduced.
  137. *
  138. * The hooks are a series of routines, which are invoked in some special checkpoints.
  139. * The hook routines include:
  140. * - object hook, invoked at object created, deleted, taken and put etc.
  141. * - scheduler hook, invoked at thread switch and idle thread loop.
  142. * - memory hook, invoked when allocate or free memory block.
  143. * - timer hook, invoked when timer is timeout.
  144. */
  145. /**
  146. * @defgroup group_KernelService Other useful kernel service
  147. * @brief other useful service in the kernel
  148. */
  149. /**
  150. * @defgroup group_Error Error Code
  151. * @brief error code
  152. *
  153. * The error code is defined to identify which kind of error occurs. When some
  154. * bad things happen, the current thread's errno will be set.
  155. */
  156. /**@}*/