RTX_Config.c 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /*
  2. * Copyright (c) 2013-2016 ARM Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the License); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  14. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * -----------------------------------------------------------------------------
  19. *
  20. * $Revision: V5.0.0
  21. *
  22. * Project: CMSIS-RTOS RTX
  23. * Title: RTX Configuration
  24. *
  25. * -----------------------------------------------------------------------------
  26. */
  27. //-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
  28. // <h>Thread Configuration
  29. // =======================
  30. // <e>Static Resources
  31. // <i> Enables static resources allocation.
  32. #define OS_THREAD_STATIC 0
  33. // <o>Number of user Threads (total) <1-1000>
  34. // <i> Defines maximum number of user threads that can be active at the same time.
  35. #define OS_THREAD_NUM 1
  36. // <o>Number of user Threads with user-provided Stack size <0-1000>
  37. // <i> Defines maximum number of user threads with user-provided stack size.
  38. // <i> Default: 0
  39. #define OS_THREAD_USER_STACK_NUM 0
  40. // </e>
  41. // <o>Default Thread Stack size [bytes] <96-1073741824:8>
  42. // <i> Defines stack size for threads with zero stack size specified.
  43. // <i> Default: 200
  44. #define OS_STACK_SIZE 200
  45. // <o>Idle Thread Stack size [bytes] <72-1073741824:8>
  46. // <i> Defines stack size for Idle thread.
  47. // <i> Default: 200
  48. #define OS_IDLE_THREAD_STACK_SIZE 200
  49. // <q>Stack overrun checking
  50. // <i> Enable stack overrun checks at thread switch.
  51. // <i> Enabling this option increases slightly the execution time of a thread switch.
  52. #define OS_STACK_CHECK 1
  53. // <q>Stack usage watermark
  54. // <i> Initialize thread stack with watermark pattern for analyzing stack usage.
  55. // <i> Enabling this option increases significantly the execution time of thread creation.
  56. #define OS_STACK_WATERMARK 0
  57. // <o>Processor mode for Thread execution
  58. // <0=> Unprivileged mode
  59. // <1=> Privileged mode
  60. // <i> Default: Privileged mode
  61. #define OS_PRIVILEGE_MODE 1
  62. // </h>
  63. // <h>Timer Configuration
  64. // ======================
  65. // <e>Static Resources
  66. // <i> Enables static resources allocation.
  67. #define OS_TIMER_STATIC 0
  68. // <o>Number of user Timers <1-1000>
  69. // <i> Defines maximum number of user timers that can be active at the same time.
  70. #define OS_TIMER_NUM 1
  71. // </e>
  72. // <o>Timer Thread Priority
  73. // <8=> Low
  74. // <16=> Below Normal <24=> Normal <32=> Above Normal
  75. // <40=> High
  76. // <48=> Realtime
  77. // <i> Defines priority for timer thread
  78. // <i> Default: High
  79. #define OS_TIMER_THREAD_PRIO 40
  80. // <o>Timer Thread Stack size [bytes] <0-1073741824:8>
  81. // <i> Defines stack size for Timer thread.
  82. // <i> May be set to 0 when timers are not used.
  83. // <i> Default: 200
  84. #define OS_TIMER_THREAD_STACK_SIZE 200
  85. // <o>Timer Callback Queue entries <0-256>
  86. // <i> Number of concurrent active timer callback functions.
  87. // <i> May be set to 0 when timers are not used.
  88. // <i> Default: 4
  89. #define OS_TIMER_CB_QUEUE 4
  90. // </h>
  91. // <h>Event Flags Configuration
  92. // ============================
  93. // <e>Static Resources
  94. // <i> Enables static resources allocation.
  95. #define OS_EVFLAGS_STATIC 0
  96. // <o>Number of Event Flags objects <1-1000>
  97. // <i> Defines maximum number of objects that can be active at the same time.
  98. #define OS_EVFLAGS_NUM 1
  99. // </e>
  100. // </h>
  101. // <h>Mutex Configuration
  102. // ======================
  103. // <e>Static Resources
  104. // <i> Enables static resources allocation.
  105. #define OS_MUTEX_STATIC 0
  106. // <o>Number of Mutex objects <1-1000>
  107. // <i> Defines maximum number of objects that can be active at the same time.
  108. #define OS_MUTEX_NUM 1
  109. // </e>
  110. // </h>
  111. // <h>Semaphore Configuration
  112. // ==========================
  113. // <e>Static Resources
  114. // <i> Enables static resources allocation.
  115. #define OS_SEMAPHORE_STATIC 0
  116. // <o>Number of Semaphore objects <1-1000>
  117. // <i> Defines maximum number of objects that can be active at the same time.
  118. #define OS_SEMAPHORE_NUM 1
  119. // </e>
  120. // </h>
  121. // <h>Memory Pool Configuration
  122. // ============================
  123. // <e>Static Resources
  124. // <i> Enables static resources allocation.
  125. #define OS_MEMPOOL_STATIC 0
  126. // <o>Number of Memory Pool objects <1-1000>
  127. // <i> Defines maximum number of objects that can be active at the same time.
  128. #define OS_MEMPOOL_NUM 1
  129. // </e>
  130. // </h>
  131. // <h>Message Queue Configuration
  132. // ==============================
  133. // <e>Static Resources
  134. // <i> Enables static resources allocation.
  135. #define OS_MSGQUEUE_STATIC 0
  136. // <o>Number of Message Queue objects <1-1000>
  137. // <i> Defines maximum number of objects that can be active at the same time.
  138. #define OS_MSGQUEUE_NUM 1
  139. // </e>
  140. // </h>
  141. // <h>System Configuration
  142. // =======================
  143. // <e>Dynamic Resources
  144. // <i> Enables dynamic resources allocation
  145. #define OS_DYNAMIC 0
  146. // <o>Memory size [bytes] for Control Blocks <0-1073741824:4>
  147. // <i> Defines the combined memory size for control blocks.
  148. // <i> Excluding objects with static resources.
  149. // <i> Default: 0
  150. #define OS_DYNAMIC_MEM_CB_SIZE 0
  151. // <o>Memory size [bytes] for Data Storage <0-1073741824:4>
  152. // <i> Defines the combined memory size for data storage (Memory Pool and Message Queue).
  153. // <i> Default: 0
  154. #define OS_DYNAMIC_MEM_DATA_SIZE 0
  155. // <o>Memory size [bytes] for Stack <0-1073741824:8>
  156. // <i> Defines the combined memory size for stack (Thread).
  157. // <i> Excluding threads with static resources and default stack size.
  158. // <i> Default: 0
  159. #define OS_DYNAMIC_MEM_STACK_SIZE 0
  160. // </e>
  161. // <o>Dynamic Memory size [bytes] <0-1073741824:8>
  162. // <i> Defines the combined dynamic memory size (excluding static and dynamic resources).
  163. // <i> Default: 4096
  164. #define OS_DYNAMIC_MEM_SIZE 4096
  165. // <e>Round-Robin Thread switching
  166. // <i> Enables Round-Robin Thread switching.
  167. #define OS_ROBIN_ENABLE 1
  168. // <o>Round-Robin Timeout [ms] <1-1000>
  169. // <i> Defines how long a thread will execute before a thread switch.
  170. // <i> Default: 5
  171. #define OS_ROBIN_TIMEOUT 5
  172. // </e>
  173. // <o>ISR FIFO Queue
  174. // <4=> 4 entries <8=> 8 entries <12=> 12 entries <16=> 16 entries
  175. // <24=> 24 entries <32=> 32 entries <48=> 48 entries <64=> 64 entries
  176. // <96=> 96 entries <128=> 128 entries <196=> 196 entries <256=> 256 entries
  177. // <i> RTOS Functions called from ISR store requests to this buffer.
  178. // <i> Default: 16 entries
  179. #define OS_ISR_FIFO_QUEUE 16
  180. // </h>
  181. // Number of Threads which use standard C/C++ library libspace
  182. // (when static thread resource allocation is not used).
  183. #if (OS_THREAD_STATIC == 0)
  184. #define OS_THREAD_LIBSPACE_NUM 4
  185. #else
  186. #define OS_THREAD_LIBSPACE_NUM OS_THREAD_NUM
  187. #endif
  188. //------------- <<< end of configuration section >>> ---------------------------
  189. #include "rtx_os.h"
  190. // OS Idle Thread
  191. void *os_IdleThread (void *argument) {
  192. (void)argument;
  193. for (;;) {}
  194. }
  195. // OS Error Callback function
  196. uint32_t os_Error (uint32_t code, void *object_id) {
  197. (void)object_id;
  198. switch (code) {
  199. case os_ErrorStackUnderflow:
  200. // Stack underflow detected for thread (thread_id=object_id)
  201. break;
  202. case os_ErrorISRQueueOverflow:
  203. // ISR Queue overflow detected when inserting object (object_id)
  204. break;
  205. case os_ErrorTimerQueueOverflow:
  206. // User Timer Callback Queue overflow detected for timer (timer_id=object_id)
  207. break;
  208. case os_ErrorClibSpace:
  209. // Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
  210. break;
  211. case os_ErrorClibMutex:
  212. // Standard C/C++ library mutex initialization failed
  213. break;
  214. default:
  215. break;
  216. }
  217. for (;;) {}
  218. //return 0U;
  219. }
  220. #include "rtx_config.h"