Comtrol eCos User Manual

Page 289

Advertising
background image

Chapter 9. HAL Interfaces

HAL_INTERRUPT_CONFIGURE( vector, level, up )

HAL_INTERRUPT_SET_LEVEL( vector, level )

These macros exert control over any prioritized interrupt controller that is present. If no priority controller exists,
then these macros should be empty.

Note: These macros may not be reentrant, so care should be taken to prevent them being called while interrupts
are enabled. This means that they can be safely used in initialization code before interrupts are enabled, and in
ISRs. In DSRs, ASRs and thread code, however, interrupts must be disabled before these macros are called.
Here is an example for use in a DSR where the interrupt source is unmasked after data processing:

...

HAL_DISABLE_INTERRUPTS(old);

HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_ETH);

HAL_RESTORE_INTERRUPTS(old);

...

HAL_INTERRUPT_MASK()

causes the interrupt associated with the given vector to be blocked.

HAL_INTERRUPT_UNMASK()

causes the interrupt associated with the given vector to be unblocked.

HAL_INTERRUPT_ACKNOWLEDGE()

acknowledges the current interrupt from the given vector. This is usually exe-

cuted from the ISR for this vector when it is prepared to allow further interrupts. Most interrupt controllers need
some form of acknowledge action before the next interrupt is allowed through. Executing this macro may cause
another interrupt to be delivered. Whether this interrupts the current code depends on the state of the CPU interrupt
mask.

HAL_INTERRUPT_CONFIGURE()

provides control over how an interrupt signal is detected. The arguments are:

vector

The interrupt vector to be configured.

level

Set to

true

if the interrupt is detected by level, and

false

if it is edge triggered.

up

If the interrupt is set to level detect, then if this is

true

it is detected by a high signal level, and if

false

by a

low signal level. If the interrupt is set to edge triggered, then if this is

true

it is triggered by a rising edge and

if

false

by a falling edge.

HAL_INTERRUPT_SET_LEVEL()

provides control over the hardware priority of the interrupt. The arguments are:

vector

The interrupt whose level is to be set.

level

The priority level to which the interrupt is to set. In some architectures the masking of an interrupt

is achieved by changing its priority level. Hence this function,

HAL_INTERRUPT_MASK()

and

HAL_INTERRUPT_UNMASK()

may interfere with each other.

185

Advertising