ARM Technical Support Knowledge Articles

HANDLING UNUSED INTERRUPTS

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

We would like to account for all interrupts in a C167 system - i.e. all unused interrupts would go to a common interrupt routine for logging or error handling. How do we do this? We see how to assign individual interrupt routines to the "table", but not how to load the same vector/function for multiple interrupt sources.

ANSWER

There is no easy way (in C) to assign a single interrupt routine to multiple traps or vectors. However, you can easily implement several interrupt routines that invoke a general purpose unused interrupt handler.

For example, the following code shows you how to trap and "handle" the serial transmit and receive interrupts. Note that these interrupts use the same register bank. This may be undesirable.

/*----------------------------------------------*/

void unused_IRQ_handler (
  unsigned int trap_number)
{
/*** Bad IRQ Handler Code Goes Here ***/

while (1)  /*** delay forever ***/
  {
  }
}


void serial_TX_irq (void) interrupt S0TINT = 42
                          using UNUSED_IRQ_REGBANK
{
unused_IRQ_handler (42);
}


void serial_RX_irq (void) interrupt S0RINT = 43
                          using UNUSED_IRQ_REGBANK
{
unused_IRQ_handler (43);
}

/*----------------------------------------------*/

Note that in this example, the interrupt functions pass the trap number to the bad IRQ handler. This may or may not be useful depending on your application.

SEE ALSO

Article last edited on: 2004-05-17 16:47:21

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential