-------------------------------------------------------------------------------
Notes and information for developers porting code to the C-Demon environment
-------------------------------------------------------------------------------

How to attach an interrupt handler
==================================

Interrupt handlers are attached to individual interrupt source bit
vectors, or attached directly to the IRQ and FIQ processor vectors. If
the processor vectors are used then care needs to be taken to ensure
that *ALL* of the enabled interrupt sources are properly taken care
of. The uC/OS ARM600 port provides an example IRQ handler in the file
"kern600.s".

Normally however the user will use the interrupt source bit vector
tables. These are tables that C-Demon will indirect via, to reach
individual handler functions for a particular source.

The "SWI_InstallHandler" code provides the mechanism for attaching
routines to vectors. It uses magic numbers to identify the different
vectors. Aswell as the vector number, the routine expects to be given
a pointer to the new handler, and also a private argument word for the
handler. At the moment not all of the vectors use the private argument
word (e.g. the IRQ and FIQ vectors).

How interrupt handlers are called
=================================

Interrupt handlers attached to the IRQ and FIQ vector tables are
entered as if they were directly attached to the corresponding ARM
hardware vector. This means that the processor state is preserved from
the instance of the interrupt.

The C-Demon system interrupt handlers (attached to the lo-level IRQ
and FIQ vectors) deal with decoding the interrupt status and source
information into a vector table slot number.

How to support ctrl-C if you have claimed the interrupt vector
==============================================================

The "BP_StopInt" entry point is designed to be called in the interrupt
mode, with the relevant ARM interrupt disabled, and with a small stack
frame defined. This routine should be called when the target is
executing (i.e. *NOT* under C-Demon control) and a communication is
noticed on the RDP debug channel. NOTE: The interrupt handler should
*NOT* process the interrupt, so that the C-Demon foreground started by
the "BP_StopInt" code can process the complete RDP message, and the
system can pretend that the breakpoint occurred in the user thread,
rather than in the interrupt handler.

-------------------------------------------------------------------------------
