FreeRTOSConfig.h
1 2 #ifndef FREERTOS_CONFIG_H 3 #define FREERTOS_CONFIG_H 4 5 #ifdef __cplusplus 6 extern "C" { 7 #endif 8 #include <assert.h> 9 /* Ensure definitions are only used by the compiler, and not by the assembler. */ 10 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 11 #include <stdint.h> 12 extern uint32_t SystemCoreClock; 13 #endif 14 #define configENABLE_FPU 1 15 #define configENABLE_MPU 0 16 17 #define configUSE_PREEMPTION 1 18 #define configSUPPORT_STATIC_ALLOCATION 1 19 #define configSUPPORT_DYNAMIC_ALLOCATION 1 20 #define configUSE_IDLE_HOOK 0 21 #define configUSE_TICK_HOOK 0 22 #define configCPU_CLOCK_HZ ( SystemCoreClock ) 23 #define configTICK_RATE_HZ ((TickType_t)1000) 24 #define configMAX_PRIORITIES ( 32 ) 25 #define configMINIMAL_STACK_SIZE ((uint16_t)128) 26 #define configTOTAL_HEAP_SIZE ((size_t)1024*256) 27 #define configMAX_TASK_NAME_LEN ( 16 ) 28 #define configUSE_TRACE_FACILITY 1 29 #define configUSE_16_BIT_TICKS 0 30 #define configUSE_MUTEXES 1 31 #define configQUEUE_REGISTRY_SIZE 8 32 #define configUSE_RECURSIVE_MUTEXES 1 33 #define configUSE_COUNTING_SEMAPHORES 1 34 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0 35 #define configUSE_TICKLESS_IDLE 1 36 37 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t 38 39 40 /* Co-routine definitions. */ 41 #define configUSE_CO_ROUTINES 0 42 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) 43 44 /* Software timer definitions. */ 45 #define configUSE_TIMERS 1 46 #define configTIMER_TASK_PRIORITY ( 2 ) 47 #define configTIMER_QUEUE_LENGTH 10 48 #define configTIMER_TASK_STACK_DEPTH 256 49 50 /* Set the following definitions to 1 to include the API function, or zero 51 to exclude the API function. */ 52 #define INCLUDE_vTaskPrioritySet 1 53 #define INCLUDE_uxTaskPriorityGet 1 54 #define INCLUDE_vTaskDelete 1 55 #define INCLUDE_vTaskCleanUpResources 0 56 #define INCLUDE_vTaskSuspend 1 57 #define INCLUDE_vTaskDelayUntil 1 58 #define INCLUDE_vTaskDelay 1 59 #define INCLUDE_xTaskGetSchedulerState 1 60 #define INCLUDE_xTimerPendFunctionCall 1 61 #define INCLUDE_xQueueGetMutexHolder 1 62 #define INCLUDE_uxTaskGetStackHighWaterMark 1 63 #define INCLUDE_eTaskGetState 1 64 65 /* 66 * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used 67 * by the application thus the correct define need to be enabled below 68 */ 69 #define USE_FreeRTOS_HEAP_4 70 71 /* Cortex-M specific definitions. */ 72 #ifdef __NVIC_PRIO_BITS 73 /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ 74 #define configPRIO_BITS __NVIC_PRIO_BITS 75 #else 76 #define configPRIO_BITS 4 77 #endif 78 79 /* The lowest interrupt priority that can be used in a call to a "set priority" 80 function. */ 81 #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 82 83 /* The highest interrupt priority that can be used by any interrupt service 84 routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL 85 INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER 86 PRIORITY THAN THIS! (higher priorities are lower numeric values. */ 87 #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 88 89 /* Interrupt priorities used by the kernel port layer itself. These are generic 90 to all Cortex-M ports, and do not rely on any particular library functions. */ 91 #define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 92 /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! 93 See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ 94 #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) 95 96 /* Normal assert() semantics without relying on the provision of an assert.h 97 header file. */ 98 99 #define configASSERT(x) assert(x) 100 101 /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS 102 standard names. */ 103 #define vPortSVCHandler SVC_Handler 104 #define xPortPendSVHandler PendSV_Handler 105 106 /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, 107 to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ 108 109 #define xPortSysTickHandler SysTick_Handler 110 111 /* CLI output buffer size*/ 112 #define configCOMMAND_INT_MAX_OUTPUT_SIZE 1024 113 114 #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) 115 void PreSleepProcessing(uint32_t *ulExpectedIdleTime); 116 void PostSleepProcessing(uint32_t *ulExpectedIdleTime); 117 #endif /* defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) */ 118 119 /* The configPRE_SLEEP_PROCESSING() and configPOST_SLEEP_PROCESSING() macros 120 allow the application writer to add additional code before and after the MCU is 121 placed into the low power state respectively. */ 122 #if configUSE_TICKLESS_IDLE == 1 123 #define configPRE_SLEEP_PROCESSING PreSleepProcessing 124 #define configPOST_SLEEP_PROCESSING PostSleepProcessing 125 #endif /* configUSE_TICKLESS_IDLE == 1 */ 126 127 #ifdef BUILD_DEBUG 128 #define configCHECK_FOR_STACK_OVERFLOW 2 129 #define configUSE_MALLOC_FAILED_HOOK 1 130 #endif 131 132 #define pdTICKS_TO_MS( xTicks ) ( ( uint32_t ) ( ( ( uint64_t ) ( xTicks ) * ( uint32_t ) 1000U ) / ( uint32_t ) configTICK_RATE_HZ ) ) 133 134 #define pdMS_TO_TICKS( xTimeInMs ) ( ( uint32_t ) ( ( ( uint64_t ) ( xTimeInMs ) * ( uint32_t ) configTICK_RATE_HZ ) / ( uint32_t ) 1000U ) ) 135 #ifdef __cplusplus 136 } 137 #endif 138 139 #include <stdlib.h> 140 141 #define pvPortMalloc malloc 142 #define vPortFree free 143 144 void xTaskSetTickCount(uint32_t xCurrentTickCount); 145 146 #endif /* FREERTOS_CONFIG_H */