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


vCoRoutineSchedule to xCoRoutineSchedule

Posted by sashiono on September 12, 2007
proposed change/addition to vCoRoutineSchedule to xCoRoutineSchedule

instead of returning void I would like to return the true if a co-routine is ready to be scheduled, otherwise false if all the co-routines are blocked.

something like this

signed portBASE_TYPE xCoRoutineSchedule( void )
/* See if any co-routines readied by events need moving to the ready lists. */

/* See if any delayed co-routines have timed out. */

/* Find the highest priority queue that contains ready co-routines. */
while( listLIST_IS_EMPTY( &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) ) )
if( uxTopCoRoutineReadyPriority == 0 )
/* No more co-routines to check. */
return pdFALSE;

/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the co-routines
of thesame priority get an equal share of the processor time. */
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentCoRoutine, &( pxReadyCoRoutineLists[ uxTopCoRoutineReadyPriority ] ) );

/* Call the co-routine. */
( pxCurrentCoRoutine->pxCoRoutineFunction )( pxCurrentCoRoutine, pxCurrentCoRoutine->uxIndex );

return pdTRUE;

The reason this would be useful is for power reduction for example, the IdleHook can look something like this now.

void vApplicationIdleHook( void )
if(xCoRoutineSchedule() == pdFALSE)
//Idle the CPU
PCON = 0x1;//IDle Mode

I haven't tested this yet, but I think it should work fine.

RE: vCoRoutineSchedule to xCoRoutineSchedule

Posted by sashiono on September 21, 2007
i have been running this mod for a while now and it works well.

RE: vCoRoutineSchedule to xCoRoutineSchedule

Posted by sashiono on November 18, 2007
any input into including this mod into the next release? I find it quite useful for power reduction.

RE: vCoRoutineSchedule to xCoRoutineSchedule

Posted by Richard on November 18, 2007
Thanks for your suggestion. I would be grateful if you could add this to the Feature Request tracker under SourceForce. That way I will not forget it :o) http://sourceforge.net/tracker/?atid=659636&group_id=111543&func=browse


RE: vCoRoutineSchedule to xCoRoutineSchedule

Posted by sashiono on November 21, 2007
I didn't know if you actually took requests posted in the Feature Request tracker. I posted up the suggestion.

Btw, Keep up the good work. FreeRTOS is getting better every day.

[ 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