Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists