|
发表于 2015-11-21 23:48:00
|
显示全部楼层
本帖最后由 zsmbj 于 2015-11-22 00:08 编辑
不知你看的是那个版本。根据configUSE_PORT_OPTIMISED_TASK_SELECTION的定义,Freertos有2种方法。在V8.2.3里边:
- #if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 0 )
- /* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 0 then task selection is
- performed in a generic way that is not optimised to any particular
- microcontroller architecture. */
- #define taskSELECT_HIGHEST_PRIORITY_TASK() \
- { \
- /* Find the highest priority queue that contains ready tasks. */ \
- while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) ) \
- { \
- configASSERT( uxTopReadyPriority ); \
- --uxTopReadyPriority; \
- } \
- \
- /* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
- the same priority get an equal share of the processor time. */ \
- listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) ); \
- } /* taskSELECT_HIGHEST_PRIORITY_TASK */
- #else /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
- /* If configUSE_PORT_OPTIMISED_TASK_SELECTION is 1 then task selection is
- performed in a way that is tailored to the particular microcontroller
- architecture being used. */
- #define taskSELECT_HIGHEST_PRIORITY_TASK() \
- { \
- UBaseType_t uxTopPriority; \
- \
- /* Find the highest priority queue that contains ready tasks. */ \
- portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
- configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
- listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
- } /* taskSELECT_HIGHEST_PRIORITY_TASK() */
- #endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
复制代码 |
|