Advertisement
KiviE

FreeRTOSConfig.h

Aug 26th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 10.10 KB | None | 0 0
  1. /*
  2.  *  FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
  3.  *
  4.  *  FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT
  5.  *  http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
  6.  *
  7.  ***************************************************************************
  8.  *                                                                       *
  9.  *    FreeRTOS tutorial books are available in pdf and paperback.        *
  10.  *    Complete, revised, and edited pdf reference manuals are also       *
  11.  *    available.                                                         *
  12.  *                                                                       *
  13.  *    Purchasing FreeRTOS documentation will not only help you, by       *
  14.  *    ensuring you get running as quickly as possible and with an        *
  15.  *    in-depth knowledge of how to use FreeRTOS, it will also help       *
  16.  *    the FreeRTOS project to continue with its mission of providing     *
  17.  *    professional grade, cross platform, de facto standard solutions    *
  18.  *    for microcontrollers - completely free of charge!                  *
  19.  *                                                                       *
  20.  *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
  21.  *                                                                       *
  22.  *    Thank you for using FreeRTOS, and thank you for your support!      *
  23.  *                                                                       *
  24.  ***************************************************************************
  25.  *
  26.  *
  27.  *  This file is part of the FreeRTOS distribution.
  28.  *
  29.  *  FreeRTOS is free software; you can redistribute it and/or modify it under
  30.  *  the terms of the GNU General Public License (version 2) as published by the
  31.  *  Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
  32.  *
  33.  *  >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
  34.  *  distribute a combined work that includes FreeRTOS without being obliged to
  35.  *  provide the source code for proprietary components outside of the FreeRTOS
  36.  *  kernel.
  37.  *
  38.  *  FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
  39.  *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  40.  *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  41.  *  details. You should have received a copy of the GNU General Public License
  42.  *  and the FreeRTOS license exception along with FreeRTOS; if not it can be
  43.  *  viewed here: http://www.freertos.org/a00114.html and also obtained by
  44.  *  writing to Real Time Engineers Ltd., contact details for whom are available
  45.  *  on the FreeRTOS WEB site.
  46.  *
  47.  *  1 tab == 4 spaces!
  48.  *
  49.  ***************************************************************************
  50.  *                                                                       *
  51.  *    Having a problem?  Start by reading the FAQ "My application does   *
  52.  *    not run, what could be wrong?"                                     *
  53.  *                                                                       *
  54.  *    http://www.FreeRTOS.org/FAQHelp.html                               *
  55.  *                                                                       *
  56.  ***************************************************************************
  57.  *
  58.  *
  59.  *  http://www.FreeRTOS.org - Documentation, books, training, latest versions,
  60.  *  license and Real Time Engineers Ltd. contact details.
  61.  *
  62.  *  http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  63.  *  including FreeRTOS+Trace - an indispensable productivity tool, and our new
  64.  *  fully thread aware and reentrant UDP/IP stack.
  65.  *
  66.  *  http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
  67.  *  Integrity Systems, who sell the code with commercial support,
  68.  *  indemnification and middleware, under the OpenRTOS brand.
  69.  *
  70.  *  http://www.SafeRTOS.com - High Integrity Systems also provide a safety
  71.  *  engineered and independently SIL3 certified version for use in safety and
  72.  *  mission critical applications that require provable dependability.
  73.  */
  74.  
  75. #ifndef FREERTOS_CONFIG_H
  76. #define FREERTOS_CONFIG_H
  77.  
  78. #include "em_assert.h"
  79.  
  80. #ifdef __cplusplus
  81. extern "C" {
  82. #endif
  83.  
  84. /********************** Configuration of FreeRTOS ****************************/
  85.  
  86. /* Implement FreeRTOS configASSERT as emlib assert */
  87. #define configASSERT( x )       EFM_ASSERT( x )
  88.  
  89. /* Modes of operations of operation system*/
  90. #define configUSE_PREEMPTION       ( 1 )
  91.  
  92. /* Energy saving modes */
  93. #define configUSE_TICKLESS_IDLE    ( 1 )
  94. /* Available options when configUSE_TICKLESS_IDLE set to 1
  95.  * or configUSE_SLEEP_MODE_IN_IDLE set to 1 :
  96.  * 1 - EM1, 2 - EM2, 3 - EM3, timer in EM3 is not very accurate*/
  97. #define configSLEEP_MODE           ( 2 )
  98. /* Definition used only if configUSE_TICKLESS_IDLE == 0 */
  99. #define configUSE_SLEEP_MODE_IN_IDLE       ( 1 )
  100.  
  101.  
  102. /* EM1 use systick as system clock*/
  103. /* EM2 use crystal 32768Hz and RTC Component as system clock
  104.  * We use 2 times divider of this clock to reduce energy consumption
  105.  * You can also in this mode choose crystal oscillator to get more precision in
  106.  * time measurement or RC oscillator for more energy reduction.*/
  107. /* EM3 use 2kHz RC and BURTC Component as system clock*/
  108. #if ( ( configSLEEP_MODE == 2 ) && ( configUSE_TICKLESS_IDLE == 1 || configUSE_SLEEP_MODE_IN_IDLE == 1 ) )
  109. /* Choose source of clock for RTC (system tick)
  110.  * if configCRYSTAL_IN_EM2 set to 1 then Crystal oscillator is used,
  111.  * when 0 RC oscillator */
  112. #define configCRYSTAL_IN_EM2    ( 1 )
  113. #endif
  114. #if (  (configSLEEP_MODE == 2 ) && ( configUSE_TICKLESS_IDLE == 1 || configUSE_SLEEP_MODE_IN_IDLE == 1 ) )
  115. /* When we use EM2 or EM3 System clock has got low frequency,
  116.  * so we reduce Tick rate to 100 Hz and 40 Hz, which give more clock cycles between ticks*/
  117. #define configTICK_RATE_HZ    ( 1024 )
  118. #elif (  ( configSLEEP_MODE == 3 ) && ( configUSE_TICKLESS_IDLE == 1 || configUSE_SLEEP_MODE_IN_IDLE == 1 ) )
  119. #define configTICK_RATE_HZ    ( 1024 )
  120. #else
  121. #define configTICK_RATE_HZ    ( 1000 )
  122. #endif
  123.  
  124. /* Definition used by Keil to replace default system clock source when we use EM2 or EM3 mode. */
  125. #if ( ( configSLEEP_MODE == 2 || configSLEEP_MODE == 3 ) && ( configUSE_TICKLESS_IDLE == 1 || configUSE_SLEEP_MODE_IN_IDLE == 1 ) )
  126. #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION ( 1 )
  127. #endif
  128.  
  129. /* Main functions*/
  130. #define configMAX_PRIORITIES                      ( 3 )
  131. #define configMINIMAL_STACK_SIZE                  (( unsigned short ) 300)
  132. #define configTOTAL_HEAP_SIZE                     (( size_t )(40000))
  133. #define configMAX_TASK_NAME_LEN                   ( 10 )
  134. #define configUSE_TRACE_FACILITY                  ( 0 )
  135. #define configUSE_16_BIT_TICKS                    ( 0 )
  136. #define configIDLE_SHOULD_YIELD                   ( 0 )
  137. #define configUSE_MUTEXES                         ( 1 )
  138. #define configUSE_RECURSIVE_MUTEXES               ( 0 )
  139. #define configUSE_COUNTING_SEMAPHORES             ( 0 )
  140. #define configUSE_ALTERNATIVE_API                 ( 0 )/* Deprecated! */
  141. #define configQUEUE_REGISTRY_SIZE                 ( 10 )
  142. #define configUSE_QUEUE_SETS                      ( 0 )
  143.  
  144. /* Hook function related definitions. */
  145. #define configUSE_TICK_HOOK                       ( 0 )
  146. #define configCHECK_FOR_STACK_OVERFLOW            ( 0 )
  147. #define configUSE_MALLOC_FAILED_HOOK              ( 0 )
  148.  
  149. /* Run time stats gathering related definitions. */
  150. #define configGENERATE_RUN_TIME_STATS             ( 0 )
  151.  
  152. /* Co-routine related definitions. */
  153. #define configUSE_CO_ROUTINES                     ( 0 )
  154. #define configMAX_CO_ROUTINE_PRIORITIES           ( 1 )
  155.  
  156. /* Software timer related definitions. */
  157. #define configUSE_TIMERS                          ( 1 )
  158. #define configTIMER_TASK_PRIORITY                 ( configMAX_PRIORITIES - 1 ) /* Highest priority */
  159. #define configTIMER_QUEUE_LENGTH                  ( 10 )
  160. #define configTIMER_TASK_STACK_DEPTH              ( configMINIMAL_STACK_SIZE )
  161.  
  162. /* Interrupt nesting behaviour configuration. */
  163. #define configKERNEL_INTERRUPT_PRIORITY           ( 255 )
  164. #define configMAX_SYSCALL_INTERRUPT_PRIORITY      ( 191 ) /* equivalent to 0xa0, or priority 5. */
  165.  
  166. /* Optional functions - most linkers will remove unused functions anyway. */
  167. #define INCLUDE_vTaskPrioritySet                  ( 1 )
  168. #define INCLUDE_uxTaskPriorityGet                 ( 1 )
  169. #define INCLUDE_vTaskDelete                       ( 1 )
  170. #define INCLUDE_vTaskSuspend                      ( 1 )
  171. #define INCLUDE_xResumeFromISR                    ( 1 )
  172. #define INCLUDE_vTaskDelayUntil                   ( 1 )
  173. #define INCLUDE_vTaskDelay                        ( 1 )
  174. #define INCLUDE_xTaskGetSchedulerState            ( 1 )
  175. #define INCLUDE_xTaskGetCurrentTaskHandle         ( 1 )
  176. #define INCLUDE_uxTaskGetStackHighWaterMark       ( 0 )
  177. #define INCLUDE_xTaskGetIdleTaskHandle            ( 0 )
  178. #define INCLUDE_xTimerGetTimerDaemonTaskHandle    ( 0 )
  179. #define INCLUDE_pcTaskGetTaskName                 ( 1 )
  180. #define INCLUDE_eTaskGetState                     ( 0 )
  181.  
  182. /* Default value of CPU clock (RC)*/
  183. #define configCPU_CLOCK_HZ                        (( unsigned long ) 48000000)
  184.  
  185.  
  186. /* Defines used in energy modes */
  187. #if ( ( configSLEEP_MODE == 2 )  && ( ( configUSE_SLEEP_MODE_IN_IDLE == 1 ) || ( configUSE_TICKLESS_IDLE == 1 ) ) )
  188.     #define configCLOCK_DIVIDER       2
  189.     #define configSYSTICK_CLOCK_HZ    ( 32768 / configCLOCK_DIVIDER )
  190. #endif
  191.  
  192. #if ( ( configSLEEP_MODE == 3 )  && ( ( configUSE_SLEEP_MODE_IN_IDLE == 1 ) || ( configUSE_TICKLESS_IDLE == 1 ) ) )
  193.        #define configSYSTICK_CLOCK_HZ    ( 1024 )
  194. #endif
  195.  
  196. #if ( ( configUSE_TICKLESS_IDLE == 0 ) && ( configUSE_SLEEP_MODE_IN_IDLE == 1 ) )
  197. #define configUSE_IDLE_HOOK  ( 1 )
  198. #else
  199. #define configUSE_IDLE_HOOK  ( 0 )
  200. #endif
  201.  
  202. /*-----------------------------------------------------------*/
  203.  
  204.  
  205. /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
  206.  * standard names. */
  207. #define vPortSVCHandler        SVC_Handler
  208. #define xPortPendSVHandler     PendSV_Handler
  209. #define xPortSysTickHandler    SysTick_Handler
  210.  
  211.  
  212. #ifdef __cplusplus
  213. }
  214. #endif
  215. #endif /* FREERTOS_CONFIG_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement