Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

file list.c vListRemove

Posted by Nobody/Anonymous on February 20, 2006
Hello,

I]in the file list.c in xListRemove, is there a mistake at the end :
void vListRemove( xListItem *pxItemToRemove )
{
xList * pxList;

pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;

/* The list item knows which list it is in. Obtain the list from the list
item. */
pxList = ( xList * ) pxItemToRemove->pvContainer;

/* Make sure the index is left pointing to a valid item. */
if( pxList->pxIndex == pxItemToRemove )
{
pxList->pxIndex = pxItemToRemove->pxPrevious;
}

pxItemToRemove->pvContainer = NULL;
( pxList->uxNumberOfItems )--;
}

Shouldn't it be :
( pxList->uxNumberOfItems )--;
pxItemToRemove->pvContainer = NULL;


II]I'm trying to use the vTaskDelayUntil :
I have 3 tasks
- task 1 : priority 1 and it is resuming task 2
- task 2 : priority 2 and it is itself suspending
- task 3 : using vTaskDelayUntil like in FreeRTOS example

and it is scheduling like this
task 3 wake up + sleeping
task 2
task 1
task 2
task 1
task 2
task 3 wake up by timer + sleeping
task 1
task 1
....
task 3 wake up by timer + sleeping
task IDLE ....

I don't understand why it is 'killing" the other task : the value of uxNumberOfItems for the
pxReadyTasksLists[2] & [3] became 0 ????


chris

RE: file list.c vListRemove

Posted by Nobody/Anonymous on February 20, 2006

> Shouldn't it be :
> ( pxList->uxNumberOfItems )--;
> pxItemToRemove->pvContainer = NULL;


Looks like you have just swapped the last two lines around, or have I missed something? I don't think it makes any difference which way around the lines are unless you have spotted something otherwise.


> II]I'm trying to use the vTaskDelayUntil :
> I have 3 tasks
> - task 1 : priority 1 and it is resuming task 2
> - task 2 : priority 2 and it is itself suspending
> - task 3 : using vTaskDelayUntil like in FreeRTOS example
>
> and it is scheduling like this
> task 3 wake up + sleeping
> task 2
> task 1
> task 2
> task 1
> task 2
> task 3 wake up by timer + sleeping
> task 1
> task 1
> ....
> task 3 wake up by timer + sleeping
> task IDLE ....
>
> I don't understand why it is 'killing" the other task : the value of uxNumberOfItems
> for the
> pxReadyTasksLists[2] & [3] became 0 ????

You don't say what priority task 3 is, but don't think this matters. Your question is what happens to task 2 when task 1 runs twice in a row?

pxReadyTasksLists[2] and [3] will only contain data when the tasks are in the ready state, so it might be ok that there is nothing in them.

Can you provide an outline of the structure of your tasks?

RE: file list.c vListRemove

Posted by Nobody/Anonymous on February 20, 2006
for the first question, you're right I mistake with pointers.
For the second : task 3 is priority 3 and task 1 is my low priority task in which there is always something to do
static void task1( void *pvParameters )
{
( void ) pvParameters;
for( ;; )
{
//there is always something : polling + TaskResume(Task2) so pxReadyTasksLists[1].uxNumberOfItems must be always 1

}
}

static void task2( void *pvParameters )
{
( void ) pvParameters;
for( ;; )
{
//code + TaskSuspend(NULL)

}
}


static void task3( void *pvParameters )
{
portTickType xDelayPeriod = 100;
portTickType xLastWakeTime;

( void ) pvParameters;

xLastWakeTime = xTaskGetTickCount();

for( ;; )
{
vTaskDelayUntil( &xLastWakeTime, xDelayPeriod );
//code
}
}

I understand pxReadyTasksLists[2].uxNumberOfItems can be 0 because I'm suspending it but for the task1 it must be always 1 but in my case this task is not working anymore as I wrote before.

chris

RE: file list.c vListRemove

Posted by Nobody/Anonymous on April 17, 2006
Hey all,

I might have encountered the same problem, related to vListRemove. It seems to me that the problem is related to vTaskResumeAll who remove ready task from EventList without checking if it's actually listed in any EventList. This is the case with vTaskDelay or vTaskDelayUntil.

I posted this problem today (17/04/06)
Still seeking solution.

Ami.

RE: file list.c vListRemove

Posted by Nobody/Anonymous on April 17, 2006
See: https://sourceforge.net/forum/message.php?msg_id=3690124


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS