RTX_Conf_CM.c 5.9 KB

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