Vector numbers, Interrupt state control – Comtrol eCos User Manual

Page 287

Advertising
background image

Chapter 9. HAL Interfaces

Vector numbers

CYGNUM_HAL_VECTOR_XXXX

CYGNUM_HAL_VSR_MIN

CYGNUM_HAL_VSR_MAX

CYGNUM_HAL_VSR_COUNT

CYGNUM_HAL_INTERRUPT_XXXX

CYGNUM_HAL_ISR_MIN

CYGNUM_HAL_ISR_MAX

CYGNUM_HAL_ISR_COUNT

CYGNUM_HAL_EXCEPTION_XXXX

CYGNUM_HAL_EXCEPTION_MIN

CYGNUM_HAL_EXCEPTION_MAX

CYGNUM_HAL_EXCEPTION_COUNT

All possible VSR, interrupt and exception vectors are specified here, together with maximum and minimum values
for range checking. While the VSR and exception numbers will be defined in this file, the interrupt numbers will
normally be defined in the variant or platform HAL file that is included by this header.

There are two ranges of numbers, those for the vector service routines and those for the interrupt service routines.
The relationship between these two ranges is undefined, and no equivalence should be assumed if vectors from the
two ranges coincide.

The VSR vectors correspond to the set of exception vectors that can be delivered by the CPU architecture, many
of these will be internal exception traps. The ISR vectors correspond to the set of external interrupts that can be
delivered and are usually determined by extra decoding of the interrupt controller by the interrupt VSR.

Where a CPU supports synchronous exceptions, the range of such exceptions allowed are defined by

CYGNUM_HAL_EXCEPTION_MIN

and

CYGNUM_HAL_EXCEPTION_MAX

.

The

CYGNUM_HAL_EXCEPTION_XXXX

definitions are standard names used by target independent code to test for the presence of particular exceptions in
the architecture. The actual exception numbers will normally correspond to the VSR exception range. In future
other exceptions generated by the system software (such as stack overflow) may be added.

CYGNUM_HAL_ISR_COUNT

,

CYGNUM_HAL_VSR_COUNT

and

CYGNUM_HAL_EXCEPTION_COUNT

define the number of

ISRs, VSRs and EXCEPTIONs respectively for the purposes of defining arrays etc. There might be a transla-
tion from the supplied vector numbers into array offsets. Hence

CYGNUM_HAL_XXX_COUNT

may not simply be

CYGNUM_HAL_XXX_MAX

-

CYGNUM_HAL_XXX_MIN

or

CYGNUM_HAL_XXX_MAX

+1.

Interrupt state control

CYG_INTERRUPT_STATE

HAL_DISABLE_INTERRUPTS( old )

HAL_RESTORE_INTERRUPTS( old )

HAL_ENABLE_INTERRUPTS()

HAL_QUERY_INTERRUPTS( state )

These macros provide control over the state of the CPUs interrupt mask mechanism. They should normally manip-
ulate a CPU status register to enable and disable interrupt delivery. They should not access an interrupt controller.

CYG_INTERRUPT_STATE

is a data type that should be used to store the interrupt state returned by

HAL_DISABLE_INTERRUPTS()

and

HAL_QUERY_INTERRUPTS()

and passed to

HAL_RESTORE_INTERRUPTS()

.

183

Advertising