bian 发表于 2018-12-15 13:59:30

prvIdleTask定义在哪

在看FreeRTOS, vTaskStartScheduler源码的时候有个疑问prvIdleTask这个任务定义到底在哪。


根据查找就说:portTASK_FUNCTION就是prvIdleTask。。怎么实现的啊,请指教一下


* -----------------------------------------------------------
* The Idle task.
* ----------------------------------------------------------
*
* The portTASK_FUNCTION() macro is used to allow port/compiler specific
* language extensions.The equivalent prototype for this function is:
*
* void prvIdleTask( void *pvParameters );
*
*/
static portTASK_FUNCTION( prvIdleTask, pvParameters )
{
      /* Stop warnings. */
      ( void ) pvParameters;

      /** THIS IS THE RTOS IDLE TASK - WHICH IS CREATED AUTOMATICALLY WHEN THE
      SCHEDULER IS STARTED. **/

      /* In case a task that has a secure context deletes itself, in which case
      the idle task is responsible for deleting the task's secure context, if
      any. */
      portTASK_CALLS_SECURE_FUNCTIONS();

      for( ;; )
      {
                /* See if any tasks have deleted themselves - if so then the idle task
                is responsible for freeing the deleted task's TCB and stack. */
                prvCheckTasksWaitingTermination();

                #if ( configUSE_PREEMPTION == 0 )





bian 发表于 2018-12-15 14:35:46

顶一下,怎么没人来看看呢

byccc 发表于 2018-12-15 14:48:28

本帖最后由 byccc 于 2018-12-15 14:49 编辑

/* Task function macros as described on the FreeRTOS.org WEB site.These are
not necessary for to use this port.They are defined so the common demo files
(which build with all the ports) will build. */

#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )

bian 发表于 2018-12-15 15:03:27

还是没看出来怎么联系起来 的

byccc 发表于 2018-12-15 15:12:31

bian 发表于 2018-12-15 15:03
还是没看出来怎么联系起来 的

你太菜了,这就是个简单的宏定义呀

bian 发表于 2018-12-15 16:29:26

:L   
portTASK_FUNCTION   和prvIdleTask 的联系啊

3stones 发表于 2022-8-23 11:21:47

宏定义:#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )


static portTASK_FUNCTION( prvIdleTask, pvParameters )
{...
}
宏定义应该会替换成:
staticvoid prvIdleTask( void *pvParameters )
{...
}
页: [1]
查看完整版本: prvIdleTask定义在哪