FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2006 Threads] How to know the task xTaskHandle?Posted by Nobody/Anonymous on November 22, 2006 Hi. I wanto to suspend a task with vTaskSuspend and then call vTaskResumeFromISR.
My question is: -my task calls some function and in that function there is a call to vTaskSuspend. But how can I now the xTaskHandle of that task in order to suspend it?
Best regards, Matias
RE: How to know the task xTaskHandle?Posted by Nobody/Anonymous on November 22, 2006 The task handle is returned as a parameter to the task create function.
Look at the file FreeRTOS\Demo\Common\Minimal\dynamic.c which contains an example. Search this file for the variable xContinousIncrementHandle, you will see it is of type xTaskHandle.
xContinousIncrementHandle is passed into xTaskCreate by reference. Following the call to xTaskCreate it contains the task handle.
It is then later used in a call to TaskSuspend().
RE: How to know the task xTaskHandle?Posted by Nobody/Anonymous on November 22, 2006 Ok, but there is no way to get xTaskHandle from within the current task? Let's say some function that returns the current task xTaskHandle?
RE: How to know the task xTaskHandle?Posted by Nobody/Anonymous on November 22, 2006 In FreeRTOSConfig.h enter: #define INCLUDE_xTaskGetCurrentTaskHandle 1
Then call: xTaskHandle xTaskGetCurrentTaskHandle( void );
from your function.
Why do you need this? If you want to suspend yourself you can just pass in NULL as the parameter.
RE: How to know the task xTaskHandle?Posted by Nobody/Anonymous on November 22, 2006 I want to suspend a task with vTaskSuspend, and call vTaskResumeFromISR to resume it from an interrupt. To call vTaskSuspend and vTaskResumeFromISR I think I need to know the xTaskHandle. If I am wrong please explain...
Here is what I want do do:
static xTaskHandle xHandle;
void DoSomething (void) { // Get resource semaphore with xSemaphoreTake // I must get the xHandle from current task here...
// Use the xHandle to suspend the created task. vTaskSuspend( xHandle ); // Release resource semaphore with xSemaphoreGive }
void vAnExampleISR( void ) { portBASE_TYPE xYieldRequired;
// Resume the suspended task. xYieldRequired = xTaskResumeFromISR( xHandle );
if( xYieldRequired == pdTRUE ) { portYIELD_FROM_ISR(); } }
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|