|
60 | 60 | #define tmrNO_DELAY ( ( TickType_t ) 0U )
|
61 | 61 | #define tmrMAX_TIME_BEFORE_OVERFLOW ( ( TickType_t ) -1 )
|
62 | 62 |
|
63 |
| -/* The name assigned to the timer service task. This can be overridden by |
64 |
| - * defining trmTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */ |
| 63 | +/* The name assigned to the timer service task. This can be overridden by |
| 64 | + * defining configTIMER_SERVICE_TASK_NAME in FreeRTOSConfig.h. */ |
65 | 65 | #ifndef configTIMER_SERVICE_TASK_NAME
|
66 | 66 | #define configTIMER_SERVICE_TASK_NAME "Tmr Svc"
|
67 | 67 | #endif
|
68 | 68 |
|
| 69 | + #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) |
| 70 | + |
| 71 | +/* The core affinity assigned to the timer service task on SMP systems. |
| 72 | + * This can be overridden by defining configTIMER_SERVICE_TASK_CORE_AFFINITY in FreeRTOSConfig.h. */ |
| 73 | + #ifndef configTIMER_SERVICE_TASK_CORE_AFFINITY |
| 74 | + #define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY |
| 75 | + #endif |
| 76 | + #endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */ |
| 77 | + |
69 | 78 | /* Bit definitions used in the ucStatus member of a timer structure. */
|
70 | 79 | #define tmrSTATUS_IS_ACTIVE ( 0x01U )
|
71 | 80 | #define tmrSTATUS_IS_STATICALLY_ALLOCATED ( 0x02U )
|
|
245 | 254 |
|
246 | 255 | if( xTimerQueue != NULL )
|
247 | 256 | {
|
248 |
| - #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) |
| 257 | + #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) |
249 | 258 | {
|
250 |
| - StaticTask_t * pxTimerTaskTCBBuffer = NULL; |
251 |
| - StackType_t * pxTimerTaskStackBuffer = NULL; |
252 |
| - uint32_t ulTimerTaskStackSize; |
253 |
| - |
254 |
| - vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize ); |
255 |
| - xTimerTaskHandle = xTaskCreateStatic( prvTimerTask, |
| 259 | + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) |
| 260 | + { |
| 261 | + StaticTask_t * pxTimerTaskTCBBuffer = NULL; |
| 262 | + StackType_t * pxTimerTaskStackBuffer = NULL; |
| 263 | + uint32_t ulTimerTaskStackSize; |
| 264 | + |
| 265 | + vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize ); |
| 266 | + xTimerTaskHandle = xTaskCreateStaticAffinitySet( prvTimerTask, |
| 267 | + configTIMER_SERVICE_TASK_NAME, |
| 268 | + ulTimerTaskStackSize, |
| 269 | + NULL, |
| 270 | + ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, |
| 271 | + pxTimerTaskStackBuffer, |
| 272 | + pxTimerTaskTCBBuffer, |
| 273 | + configTIMER_SERVICE_TASK_CORE_AFFINITY ); |
| 274 | + |
| 275 | + if( xTimerTaskHandle != NULL ) |
| 276 | + { |
| 277 | + xReturn = pdPASS; |
| 278 | + } |
| 279 | + } |
| 280 | + #else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ |
| 281 | + { |
| 282 | + xReturn = xTaskCreateAffinitySet( prvTimerTask, |
256 | 283 | configTIMER_SERVICE_TASK_NAME,
|
257 |
| - ulTimerTaskStackSize, |
| 284 | + configTIMER_TASK_STACK_DEPTH, |
258 | 285 | NULL,
|
259 | 286 | ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
|
260 |
| - pxTimerTaskStackBuffer, |
261 |
| - pxTimerTaskTCBBuffer ); |
262 |
| - |
263 |
| - if( xTimerTaskHandle != NULL ) |
264 |
| - { |
265 |
| - xReturn = pdPASS; |
| 287 | + configTIMER_SERVICE_TASK_CORE_AFFINITY, |
| 288 | + &xTimerTaskHandle ); |
266 | 289 | }
|
| 290 | + #endif /* configSUPPORT_STATIC_ALLOCATION */ |
267 | 291 | }
|
268 |
| - #else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ |
| 292 | + #else /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */ |
269 | 293 | {
|
270 |
| - xReturn = xTaskCreate( prvTimerTask, |
271 |
| - configTIMER_SERVICE_TASK_NAME, |
272 |
| - configTIMER_TASK_STACK_DEPTH, |
273 |
| - NULL, |
274 |
| - ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, |
275 |
| - &xTimerTaskHandle ); |
| 294 | + #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) |
| 295 | + { |
| 296 | + StaticTask_t * pxTimerTaskTCBBuffer = NULL; |
| 297 | + StackType_t * pxTimerTaskStackBuffer = NULL; |
| 298 | + uint32_t ulTimerTaskStackSize; |
| 299 | + |
| 300 | + vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize ); |
| 301 | + xTimerTaskHandle = xTaskCreateStatic( prvTimerTask, |
| 302 | + configTIMER_SERVICE_TASK_NAME, |
| 303 | + ulTimerTaskStackSize, |
| 304 | + NULL, |
| 305 | + ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, |
| 306 | + pxTimerTaskStackBuffer, |
| 307 | + pxTimerTaskTCBBuffer ); |
| 308 | + |
| 309 | + if( xTimerTaskHandle != NULL ) |
| 310 | + { |
| 311 | + xReturn = pdPASS; |
| 312 | + } |
| 313 | + } |
| 314 | + #else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */ |
| 315 | + { |
| 316 | + xReturn = xTaskCreate( prvTimerTask, |
| 317 | + configTIMER_SERVICE_TASK_NAME, |
| 318 | + configTIMER_TASK_STACK_DEPTH, |
| 319 | + NULL, |
| 320 | + ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, |
| 321 | + &xTimerTaskHandle ); |
| 322 | + } |
| 323 | + #endif /* configSUPPORT_STATIC_ALLOCATION */ |
276 | 324 | }
|
277 |
| - #endif /* configSUPPORT_STATIC_ALLOCATION */ |
| 325 | + #endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */ |
278 | 326 | }
|
279 | 327 | else
|
280 | 328 | {
|
|
0 commit comments