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

what is the function that returns an element of a list

Posted by juhc on July 23, 2015

Hi,

What is the function that returns an element of a list without removing it in FreeRTOS? I need to know the first task that was added in the list pxReadyTasksLists[configMAX_PRIORITIES-1].

Thanks in advance


what is the function that returns an element of a list

Posted by rtel on July 23, 2015

The list functions are not part of the published API. I can probably tell you how to do what you want to do, but it is not clear what it is you want to do. Can you elaborate? When you say the "first task added in the list" do you mean the task that is at the front of the list, assuming tasks that were added after it are behind it in the list?


what is the function that returns an element of a list

Posted by juhc on July 23, 2015

Yes, it is the task in the front of the list. I want to know which task the scheduler will choose to execute at the next tick interrupt.

It's the task that has the highest priority, so if I'm not wrong, it's the task in the front of the ready list that contains the highest priority.


what is the function that returns an element of a list

Posted by davedoors on July 23, 2015

You cant know which task the scheduler will choose to execute at the next tick interrupt until the tick interrupt executes because you cant predict if a task will unblock. Even when the tick interrupt executes you cant predict it because other interrupts might nest with the tick interrupt and unblock other tasks.


what is the function that returns an element of a list

Posted by rtel on July 23, 2015

As already said, you can't tell which task will be selected in advance of it actually being selected, then you need to know which list to look in.

Which list to look in depends on the highest priority ready state task, which if you are using a port that supports port optimised task selection is determined by calling portGETHIGHESTPRIORITY() (that will use a count leading zero type instruction).

Once you know which list to look in you call listGETOWNEROFNEXTENTRY() to obtain the next TCB.

Look at the definition of taskSELECTHIGHESTPRIORITY_TASK() near the top of FreeRTOS/source/tasks.c to see how the macros are used.

Regards.


what is the function that returns an element of a list

Posted by juhc on July 27, 2015

Thank you for your answer. This is exactly what I wanted.


[ 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