FreeRTOSConfig.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.
  3. All rights reserved
  4. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
  5. ***************************************************************************
  6. * *
  7. * FreeRTOS provides completely free yet professionally developed, *
  8. * robust, strictly quality controlled, supported, and cross *
  9. * platform software that has become a de facto standard. *
  10. * *
  11. * Help yourself get started quickly and support the FreeRTOS *
  12. * project by purchasing a FreeRTOS tutorial book, reference *
  13. * manual, or both from: http://www.FreeRTOS.org/Documentation *
  14. * *
  15. * Thank you! *
  16. * *
  17. ***************************************************************************
  18. This file is part of the FreeRTOS distribution.
  19. FreeRTOS is free software; you can redistribute it and/or modify it under
  20. the terms of the GNU General Public License (version 2) as published by the
  21. Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
  22. >>! NOTE: The modification to the GPL is included to allow you to !<<
  23. >>! distribute a combined work that includes FreeRTOS without being !<<
  24. >>! obliged to provide the source code for proprietary components !<<
  25. >>! outside of the FreeRTOS kernel. !<<
  26. FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
  27. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  28. FOR A PARTICULAR PURPOSE. Full license text is available from the following
  29. link: http://www.freertos.org/a00114.html
  30. 1 tab == 4 spaces!
  31. ***************************************************************************
  32. * *
  33. * Having a problem? Start by reading the FAQ "My application does *
  34. * not run, what could be wrong?" *
  35. * *
  36. * http://www.FreeRTOS.org/FAQHelp.html *
  37. * *
  38. ***************************************************************************
  39. http://www.FreeRTOS.org - Documentation, books, training, latest versions,
  40. license and Real Time Engineers Ltd. contact details.
  41. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  42. including FreeRTOS+Trace - an indispensable productivity tool, a DOS
  43. compatible FAT file system, and our tiny thread aware UDP/IP stack.
  44. http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
  45. Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
  46. licenses offer ticketed support, indemnification and middleware.
  47. http://www.SafeRTOS.com - High Integrity Systems also provide a safety
  48. engineered and independently SIL3 certified version for use in safety and
  49. mission critical applications that require provable dependability.
  50. 1 tab == 4 spaces!
  51. */
  52. #ifndef FREERTOS_CONFIG_H
  53. #define FREERTOS_CONFIG_H
  54. #ifdef SOFTDEVICE_PRESENT
  55. #include "nrf_soc.h"
  56. #endif
  57. /*-----------------------------------------------------------
  58. * Possible configurations for system timer
  59. */
  60. #define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */
  61. #define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */
  62. /*-----------------------------------------------------------
  63. * Application specific definitions.
  64. *
  65. * These definitions should be adjusted for your particular hardware and
  66. * application requirements.
  67. *
  68. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
  69. * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
  70. *
  71. * See http://www.freertos.org/a00110.html.
  72. *----------------------------------------------------------*/
  73. #define configTICK_SOURCE FREERTOS_USE_RTC
  74. #define configUSE_PREEMPTION 1
  75. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
  76. #define configUSE_TICKLESS_IDLE 0
  77. #define configCPU_CLOCK_HZ ( SystemCoreClock )
  78. #define configTICK_RATE_HZ 1000
  79. #define configMAX_PRIORITIES ( 3 )
  80. #define configMINIMAL_STACK_SIZE ( 60 )
  81. #define configTOTAL_HEAP_SIZE ( 4096 )
  82. #define configMAX_TASK_NAME_LEN ( 4 )
  83. #define configUSE_16_BIT_TICKS 0
  84. #define configIDLE_SHOULD_YIELD 1
  85. #define configUSE_MUTEXES 1
  86. #define configUSE_RECURSIVE_MUTEXES 1
  87. #define configUSE_COUNTING_SEMAPHORES 1
  88. #define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
  89. #define configQUEUE_REGISTRY_SIZE 2
  90. #define configUSE_QUEUE_SETS 0
  91. #define configUSE_TIME_SLICING 0
  92. #define configUSE_NEWLIB_REENTRANT 0
  93. #define configENABLE_BACKWARD_COMPATIBILITY 1
  94. /* Hook function related definitions. */
  95. #define configUSE_IDLE_HOOK 0
  96. #define configUSE_TICK_HOOK 0
  97. #define configCHECK_FOR_STACK_OVERFLOW 0
  98. #define configUSE_MALLOC_FAILED_HOOK 0
  99. /* Run time and task stats gathering related definitions. */
  100. #define configGENERATE_RUN_TIME_STATS 0
  101. #define configUSE_TRACE_FACILITY 0
  102. #define configUSE_STATS_FORMATTING_FUNCTIONS 0
  103. /* Co-routine definitions. */
  104. #define configUSE_CO_ROUTINES 0
  105. #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
  106. /* Software timer definitions. */
  107. #define configUSE_TIMERS 0
  108. #define configTIMER_TASK_PRIORITY ( 2 )
  109. #define configTIMER_QUEUE_LENGTH 32
  110. #define configTIMER_TASK_STACK_DEPTH ( 80 )
  111. /* Tickless Idle configuration. */
  112. #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
  113. /* Tickless idle/low power functionality. */
  114. /* Define to trap errors during development. */
  115. #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
  116. #define configASSERT( x ) ASSERT(x)
  117. #endif
  118. /* FreeRTOS MPU specific definitions. */
  119. #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1
  120. /* Optional functions - most linkers will remove unused functions anyway. */
  121. #define INCLUDE_vTaskPrioritySet 1
  122. #define INCLUDE_uxTaskPriorityGet 1
  123. #define INCLUDE_vTaskDelete 1
  124. #define INCLUDE_vTaskSuspend 1
  125. #define INCLUDE_xResumeFromISR 1
  126. #define INCLUDE_vTaskDelayUntil 1
  127. #define INCLUDE_vTaskDelay 1
  128. #define INCLUDE_xTaskGetSchedulerState 1
  129. #define INCLUDE_xTaskGetCurrentTaskHandle 1
  130. #define INCLUDE_uxTaskGetStackHighWaterMark 1
  131. #define INCLUDE_xTaskGetIdleTaskHandle 1
  132. #define INCLUDE_xTimerGetTimerDaemonTaskHandle 1
  133. #define INCLUDE_pcTaskGetTaskName 1
  134. #define INCLUDE_eTaskGetState 1
  135. #define INCLUDE_xEventGroupSetBitFromISR 1
  136. #define INCLUDE_xTimerPendFunctionCall 1
  137. /* The lowest interrupt priority that can be used in a call to a "set priority"
  138. function. */
  139. #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf
  140. /* The highest interrupt priority that can be used by any interrupt service
  141. routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
  142. INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
  143. PRIORITY THAN THIS! (higher priorities are lower numeric values. */
  144. #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1
  145. /* Interrupt priorities used by the kernel port layer itself. These are generic
  146. to all Cortex-M ports, and do not rely on any particular library functions. */
  147. #define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY
  148. /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
  149. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
  150. #define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
  151. /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
  152. standard names - or at least those used in the unmodified vector table. */
  153. #define vPortSVCHandler SVC_Handler
  154. #define xPortPendSVHandler PendSV_Handler
  155. /*-----------------------------------------------------------
  156. * Settings that are generated automatically
  157. * basing on the settings above
  158. */
  159. #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
  160. // do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically
  161. // to CPU clock source
  162. #define xPortSysTickHandler SysTick_Handler
  163. #elif (configTICK_SOURCE == FREERTOS_USE_RTC)
  164. #define configSYSTICK_CLOCK_HZ ( 32768UL )
  165. #define xPortSysTickHandler RTC1_IRQHandler
  166. #else
  167. #error Unsupported configTICK_SOURCE value
  168. #endif
  169. /* Code below should be only used by the compiler, and not the assembler. */
  170. #if !(defined(__ASSEMBLY__) || defined(__ASSEMBLER__))
  171. #include "nrf.h"
  172. #include "nrf_assert.h"
  173. /* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */
  174. /* Cortex-M specific definitions. */
  175. #ifdef __NVIC_PRIO_BITS
  176. /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
  177. #define configPRIO_BITS __NVIC_PRIO_BITS
  178. #else
  179. #error "This port requires __NVIC_PRIO_BITS to be defined"
  180. #endif
  181. /* Access to current system core clock is required only if we are ticking the system by systimer */
  182. #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK)
  183. #include <stdint.h>
  184. extern uint32_t SystemCoreClock;
  185. #endif
  186. #endif /* !assembler */
  187. #endif /* FREERTOS_CONFIG_H */