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


Enter critical section from ISR for Cortex-A9

Posted by wonger on August 18, 2016

I'm using FreeRTOS on a Zynq 7000. The ARM_CA9 port.c has vPortEnterCritical() function which states this is not the interrupt safe version of the enter critical function and it asserts if called from an interrupt. But I do not see an ISR safe version of this. I have a critical section I want to enter, from a task and from an ISR. How would I do this? The complete function is below for reference.

Thank you for any help.

void vPortEnterCritical( void )
    /* Mask interrupts up to the max syscall interrupt priority. */

    /* Now interrupts are disabled ulCriticalNesting can be accessed
	directly.  Increment ulCriticalNesting to keep a count of how many times
    portENTER_CRITICAL() has been called. */

    /* This is not the interrupt safe version of the enter critical function so
	assert() if it is being called from an interrupt context.  Only API
	functions that end in "FromISR" can be used in an interrupt.  Only assert if
    the critical nesting count is 1 to protect against recursive calls if the
	assert function also uses a critical section. */
    if( ulCriticalNesting == 1 )
    	configASSERT( ulPortInterruptNesting == 0 );

Enter critical section from ISR for Cortex-A9

Posted by wonger on August 18, 2016

Upon further research, I think calling vPortEnterCritical() from the task is enough. It ensures the ISR won't run when the task is in the critical section. When the ISR is running, the task is not running and can not run until the ISR is done.

I was just a couple more google searches from unveiling this new information. Sorry for the post, but would appreciate confirmation of this finding though. Thanks.

Enter critical section from ISR for Cortex-A9

Posted by rtel on August 18, 2016

That is correct.

For future reference http://www.freertos.org/taskENTERCRITICALFROMISRtaskEXITCRITICALFROM_ISR.html

[ 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