Interrupt Support for NIOS
Posted by Robert Klem
on August 3, 2010
I am attempting to get a simple interrupt to work. The FreeRTOS Reference Manual gives a great example of how to set configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY in a system where 0 is the lowest priority interrupt. However, there is a footnote about how care must be taken due to the fact that some processors use 0 as the lowest priority and others use 0 as the highest priority. Unfortunately I fall into the "other" category where there is no example. I could not find any parameter that would indicate if 0 was high or low priority, so I am now confused on how this all works.
Is there someone who can explain 1) how freeRTOS determines if 0 is high or low priority, and 2) how the configKERNEL_INTERRUPT_PRIORITY and configMAX_SYSCALL_INTERRUPT_PRIORITY should be set having one group of interrupts be maskable and another set be unmaskable for 0 being high priority (like the example in the reference manual for 0 being low)?
RE: Interrupt Support for NIOS
Posted by Richard Damon
on August 3, 2010
It has been awhile since I have done work on Nios, but perhaps I can give some general help. FreeRTOS does not derermine if 0 is high or low priority, and most of the kernel doesn't really care. The port files MAY need to know how the hardware/software treats the priorities if the port wishes to allow nesting of interrupts (if this is supported by the processor). A basic requirement for the port is that interrupts that interact with FreeRTOS (through FromISR functions) should not nest, and that these interrupts should not occur inside of critical sections. This is set with the configMAX_SYSCALL_INTERRUPT_PRIORITY, and interrupts with a priority of this or "lower" can interact with FreeRTOS and those of priority "above" this do not, and may be nested. If a port does not support nesting, then these parameters are pretty much meaningless. One reason for a port not to support nesting is if the basic hardware doesn't support it, or doesn't support it well. Looking at the portmacro.h file for Nios, it doesn't use these macros so I suspect the Nios Processor doesn't support nesting (or at least not in a way easy to work with FreeRTOS).
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.