git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1892 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
e53a1a3208
commit
314ba53ca7
|
@ -21,8 +21,11 @@
|
|||
* @page article_interrupts How to write interrupt handlers
|
||||
* Since version 1.1.0 ChibiOS/RT offers a cross-platform method for writing
|
||||
* interrupt handlers. Port-related and compiler-related details are
|
||||
* encapsulated within standard system macros.<br>
|
||||
* An interrupt handler assumes the following general form:
|
||||
* encapsulated within standard system macros.
|
||||
*
|
||||
* <h2>Writing Regular Interrupt handlers</h2>
|
||||
* A Regular Interrupts handler (see @ref interrupt_classes) must be written
|
||||
* using the following general form:
|
||||
* @code
|
||||
CH_IRQ_HANDLER(myIRQ) {
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
@ -38,12 +41,26 @@ CH_IRQ_HANDLER(myIRQ) {
|
|||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
* @endcode
|
||||
* Note that only interrupt handlers that have to invoke system @ref I-Class
|
||||
* APIs must be written in this form, handlers unrelated to the OS activity can
|
||||
* omit the macros.
|
||||
* Another note about the handler name "myIRQ", in some ports it must be a
|
||||
*
|
||||
* <h2>Writing Fast Interrupt handlers</h2>
|
||||
* In those architectures (@ref ARM7 and @ref ARMCMx) supporting Fast
|
||||
* Interrupts (see @ref interrupt_classes) handlers must be written
|
||||
* using the following general form:
|
||||
* @code
|
||||
CH_FAST_IRQ_HANDLER(myIRQ) {
|
||||
|
||||
// Fast IRQ handling code, preemptable if the architecture supports it.
|
||||
// The invocation of any API is forbidden here because fast interrupt
|
||||
// handlers can preempt the kernel even within its critical zones in
|
||||
// order to minimize latency.
|
||||
}
|
||||
* @endcode
|
||||
*
|
||||
* <h2>Handlers naming</h2>
|
||||
* A note about the handler name "myIRQ", in some ports it must be a
|
||||
* vector number rather than a function name, it could also be a name from
|
||||
* within a predefined set, see the notes about the various ports.
|
||||
*
|
||||
* <h2>Important Notes</h2>
|
||||
* - There is an important application note about ARM7 interrupt handlers,
|
||||
* please read about it in the ARM7 port section: @ref ARM7_IH
|
||||
|
|
|
@ -154,12 +154,20 @@
|
|||
#define CH_IRQ_EPILOGUE() PORT_IRQ_EPILOGUE()
|
||||
|
||||
/**
|
||||
* @brief Standard IRQ handler declaration.
|
||||
* @brief Standard normal IRQ handler declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
|
||||
|
||||
/**
|
||||
* @brief Standard fast IRQ handler declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
* @note Not all architectures support fast interrupts.
|
||||
*/
|
||||
#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -146,6 +146,15 @@ struct context {
|
|||
*/
|
||||
#define PORT_IRQ_HANDLER(id) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Fast IRQ handler function declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
* @note Not all architectures support fast interrupts, in this case this
|
||||
* macro must be omitted.
|
||||
*/
|
||||
#define PORT_FAST_IRQ_HANDLER(id) void id(void)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -222,6 +222,14 @@ struct context {
|
|||
*/
|
||||
#define PORT_IRQ_HANDLER(id) __attribute__((naked)) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Fast IRQ handler function declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define PORT_FAST_IRQ_HANDLER(id) \
|
||||
__attribute__((interrupt("FIQ"))) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Port-related initialization code.
|
||||
* @note This function is empty in this port.
|
||||
|
|
|
@ -157,7 +157,16 @@ struct intctx {
|
|||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define PORT_IRQ_HANDLER(id) void id(void)
|
||||
#define PORT_IRQ_HANDLER(id) \
|
||||
__attribute__((interrupt("IRQ"))) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Fast IRQ handler function declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define PORT_FAST_IRQ_HANDLER(id) \
|
||||
__attribute__((interrupt("IRQ"))) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Port-related initialization code.
|
||||
|
|
|
@ -130,7 +130,16 @@ struct intctx {
|
|||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define PORT_IRQ_HANDLER(id) void id(void)
|
||||
#define PORT_IRQ_HANDLER(id) \
|
||||
__attribute__((interrupt("IRQ"))) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Fast IRQ handler function declaration.
|
||||
* @note @p id can be a function name or a vector number depending on the
|
||||
* port implementation.
|
||||
*/
|
||||
#define PORT_FAST_IRQ_HANDLER(id) \
|
||||
__attribute__((interrupt("IRQ"))) void id(void)
|
||||
|
||||
/**
|
||||
* @brief Port-related initialization code.
|
||||
|
|
|
@ -67,13 +67,16 @@
|
|||
constants in different address spaces (AVR) because it is assumed that a
|
||||
pointer to a ROMCONST variable is compatible with a normal pointer.
|
||||
- NEW: AT91SAM7 HAL support for the DGBU UART peripheral, as SD3.
|
||||
- NEW: Introduced a new macro CH_FAST_IRQ_HANDLER() for the declaration of
|
||||
fast interrupt handlers on those architectures that support them.
|
||||
- OPT: Internal optimization in the serial driver, it now is a bit smaller
|
||||
and uses less RAM (all architectures).
|
||||
- CHANGE: Modified the STM32 FatFs demo, now it spawns a command shell or
|
||||
the serial port SD2, type "help" for the available commands. More commands
|
||||
can be easily added.
|
||||
- Various documentation fixes, added an article covering debugging under
|
||||
ChibiOS/RT.
|
||||
ChibiOS/RT, updated the article about interrupt handlers to cover also
|
||||
fast interrupt sources.
|
||||
|
||||
*** 1.5.5 ***
|
||||
- FIX: Removed some "dead" code in the old ARMv7-M files (there are new
|
||||
|
|
Loading…
Reference in New Issue