Quality RTOS & Embedded Software

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


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 ]    [ Privacy ]    [ Sitemap ]    [ ]


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner