PRIVILEGED_FUNCTION(c语言代码中)关键字解释
背景
-
软件内核:FreeRTOS V9.0.0 文件路径:src/task.c:574
现象
涉及PRIVILEGED_FUNCTION的代码片段:
/* * Called after a Task_t structure has been allocated either statically or * dynamically to fill in the structures members. */ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, TCB_t *pxNewTCB, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
解释
PRIVILEGED_FUNCTION是一个宏,在预编译期间,会被编译器替代。从PRIVILEGED_FUNCTION的字面意思是特权函数,猜测在c语言中的功能是为了将函数prvInitialiseNewTask暴露出来,供其它区域调用。
