RTX_Conf_CM.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*----------------------------------------------------------------------------
  2. * RL-ARM - RTX
  3. *----------------------------------------------------------------------------
  4. * Name: RTX_CONFIG.C
  5. * Purpose: Configuration of RTX Kernel for Cortex-M
  6. * Rev.: V4.20
  7. *----------------------------------------------------------------------------
  8. * This code is part of the RealView Run-Time Library.
  9. * Copyright (c) 2004-2011 KEIL - An ARM Company. All rights reserved.
  10. *---------------------------------------------------------------------------*/
  11. #include <RTL.h>
  12. /*----------------------------------------------------------------------------
  13. * RTX User configuration part BEGIN
  14. *---------------------------------------------------------------------------*/
  15. //-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
  16. //
  17. // <h>Task Configuration
  18. // =====================
  19. //
  20. // <o>Number of concurrent running tasks <0-250>
  21. // <i> Define max. number of tasks that will run at the same time.
  22. // <i> Default: 6
  23. #ifndef OS_TASKCNT
  24. #define OS_TASKCNT 8
  25. #endif
  26. // <o>Number of tasks with user-provided stack <0-250>
  27. // <i> Define the number of tasks that will use a bigger stack.
  28. // <i> The memory space for the stack is provided by the user.
  29. // <i> Default: 0
  30. #ifndef OS_PRIVCNT
  31. #define OS_PRIVCNT 0
  32. #endif
  33. // <o>Task stack size [bytes] <20-4096:8><#/4>
  34. // <i> Set the stack size for tasks which is assigned by the system.
  35. // <i> Default: 200
  36. #ifndef OS_STKSIZE
  37. #define OS_STKSIZE 50
  38. #endif
  39. // <q>Check for the stack overflow
  40. // ===============================
  41. // <i> Include the stack checking code for a stack overflow.
  42. // <i> Note that additional code reduces the Kernel performance.
  43. #ifndef OS_STKCHECK
  44. #define OS_STKCHECK 1
  45. #endif
  46. // <q>Run in privileged mode
  47. // =========================
  48. // <i> Run all Tasks in privileged mode.
  49. // <i> Default: Unprivileged
  50. #ifndef OS_RUNPRIV
  51. #define OS_RUNPRIV 0
  52. #endif
  53. // </h>
  54. // <h>SysTick Timer Configuration
  55. // =============================
  56. // <o>Timer clock value [Hz] <1-1000000000>
  57. // <i> Set the timer clock value for selected timer.
  58. // <i> Default: 6000000 (6MHz)
  59. #ifndef OS_CLOCK
  60. #define OS_CLOCK 24000000
  61. #endif
  62. // <o>Timer tick value [us] <1-1000000>
  63. // <i> Set the timer tick value for selected timer.
  64. // <i> Default: 10000 (10ms)
  65. #ifndef OS_TICK
  66. #define OS_TICK 10000
  67. #endif
  68. // </h>
  69. // <h>System Configuration
  70. // =======================
  71. // <e>Round-Robin Task switching
  72. // =============================
  73. // <i> Enable Round-Robin Task switching.
  74. #ifndef OS_ROBIN
  75. #define OS_ROBIN 1
  76. #endif
  77. // <o>Round-Robin Timeout [ticks] <1-1000>
  78. // <i> Define how long a task will execute before a task switch.
  79. // <i> Default: 5
  80. #ifndef OS_ROBINTOUT
  81. #define OS_ROBINTOUT 5
  82. #endif
  83. // </e>
  84. // <o>Number of user timers <0-250>
  85. // <i> Define max. number of user timers that will run at the same time.
  86. // <i> Default: 0 (User timers disabled)
  87. #ifndef OS_TIMERCNT
  88. #define OS_TIMERCNT 0
  89. #endif
  90. // <o>ISR FIFO Queue size<4=> 4 entries <8=> 8 entries
  91. // <12=> 12 entries <16=> 16 entries
  92. // <24=> 24 entries <32=> 32 entries
  93. // <48=> 48 entries <64=> 64 entries
  94. // <96=> 96 entries
  95. // <i> ISR functions store requests to this buffer,
  96. // <i> when they are called from the iterrupt handler.
  97. // <i> Default: 16 entries
  98. #ifndef OS_FIFOSZ
  99. #define OS_FIFOSZ 16
  100. #endif
  101. // </h>
  102. //------------- <<< end of configuration section >>> -----------------------
  103. // Standard library system mutexes
  104. // ===============================
  105. // Define max. number system mutexes that are used to protect
  106. // the arm standard runtime library. For microlib they are not used.
  107. #ifndef OS_MUTEXCNT
  108. #define OS_MUTEXCNT 8
  109. #endif
  110. /*----------------------------------------------------------------------------
  111. * RTX User configuration part END
  112. *---------------------------------------------------------------------------*/
  113. #define OS_TRV ((U32)(((double)OS_CLOCK*(double)OS_TICK)/1E6)-1)
  114. /*----------------------------------------------------------------------------
  115. * Global Functions
  116. *---------------------------------------------------------------------------*/
  117. /*--------------------------- os_idle_demon ---------------------------------*/
  118. __task void os_idle_demon (void) {
  119. /* The idle demon is a system task, running when no other task is ready */
  120. /* to run. The 'os_xxx' function calls are not allowed from this task. */
  121. for (;;) {
  122. /* HERE: include optional user code to be executed when no task runs.*/
  123. }
  124. }
  125. /*--------------------------- os_tmr_call -----------------------------------*/
  126. void os_tmr_call (U16 info) {
  127. /* This function is called when the user timer has expired. Parameter */
  128. /* 'info' holds the value, defined when the timer was created. */
  129. /* HERE: include optional user code to be executed on timeout. */
  130. }
  131. /*--------------------------- os_error --------------------------------------*/
  132. void os_error (U32 err_code) {
  133. /* This function is called when a runtime error is detected. Parameter */
  134. /* 'err_code' holds the runtime error code (defined in RTL.H). */
  135. /* HERE: include optional code to be executed on runtime error. */
  136. for (;;);
  137. }
  138. /*----------------------------------------------------------------------------
  139. * RTX Configuration Functions
  140. *---------------------------------------------------------------------------*/
  141. #include <RTX_lib.c>
  142. /*----------------------------------------------------------------------------
  143. * end of file
  144. *---------------------------------------------------------------------------*/