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

Which function calls are permitted in an ISR which brings the system out of tickless sleep?

Posted by smith84 on October 30, 2013

This might be a bit obscure and I might be jumping at shadows here.

I am running FreeRTOS 7.4.0 on an EFM32LGxxx (Cortex-M3 core). The OS ticks are implemented using the on-chip RTC and the system has my own tickless sleep mode implementation.

I have an ISR which is active during the tickless sleep, and this has a call to xTimerStartFromISR(). I am passing a valid memory address in for the second parameter - this seems to be essential to make sure that xQueueSendToBackFromISR() is called instead of xQueueSendToBack().

When entering tickless sleep, just before the call to portSUPPRESSTICKSAND_SLEEP() I see that vTaskSuspendAll() is called, and xTaskResumeAll() is called afterwards (from tasks.c). Looking at the documentation for vTaskSuspendAll(): "API functions that have the potential to cause a context switch (for example, vTaskDelayUntil(), xQueueSend(), etc.) must not be called while the scheduler is suspended."

Based on this, is it safe to call the xQueueSendToBackFromISR() / xTimerStartFromISR() functions? I gather that they will not cause a context switch, but I am just hoping to clarify this to make sure there are no problems!


Which function calls are permitted in an ISR which brings the system out of tickless sleep?

Posted by richardbarry on October 30, 2013

this seems to be essential

Yes - you have to pass in a valid value in the pointer.

Based on this, is it safe to call the xQueueSendToBackFromISR() / xTimerStartFromISR() functions?

I think this is fine. When the scheduler is suspended you cannot call a function from non-interrupt code that can cause the calling task to block. The reason being that a context switch cannot occur when the scheduler is suspended, so the task cannot block, and the program logic is therefore messed up. In your case you are calling the function from an ISR, so you don't have the scenario just described - you cannot block in an ISR anyway.

Regards.


Which function calls are permitted in an ISR which brings the system out of tickless sleep?

Posted by smith84 on October 31, 2013

Great, thanks very much for your quick answer Richard!


[ 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