
153
Chapter 2 Applications Programming
The method minimizes the latency in starting a Freeze mode interrupt handler
since their commencement is never disabled –– unless by another Freeze mode han-
dler. The latency in starting a second stage handler is not reduced. Further restrictions
may have to be applied to first stage handlers to disallow access to resources which
must be atomically manipulated within critical code sections –– such as linked–list
data structures.
2.5.8
Signal Processing Without a HIF Operating System
A signal processing technique is recommended for dealing with complex C lev-
el interrupt handlers. The previous sections have described in detail how signal pro-
cessing can be performed. AMD and other tool providers supply the necessary sup-
port code which has been well tested and is known to be reliable. However, some de-
velopers may select an operating system which does not support the HIF services re-
quired by the previous example code. Additionally, many embedded system are de-
pendant on simple
home–made
boot–up code, which provides few support services.
A commercial operating system will implement its own interrupt processing
services. It is likely these services will be somewhat based on the signal processing
code described in this book. However, the provided services should be used in prefer-
ence to the HIF services. In fact, the chosen operating system may not provide any
support for HIF services.
When building simple boot–up and run–time support code for a small
embedded system, it is best to provide the necessary HIF services required for signal
processing. If the boot–up code is based on AMD’s OS–boot product, then all HIF
services will be provided. If OS–boot is not used, it is important that limited HIF
support be included in the developed code. Only the
signal
,
settrap, sysalloc
and
sigret
–type subset of HIF services are required. A trap handler for HIF trap number
69 should be installed, and the code required to process the HIF service request
installed. Very little code is required and example code can be taken from OS–boot.
2.5.9
An Example Am29200 Interrupt Handler
The following example makes use of the code presented in the previous sections
of this chapter. The Programmable I/O (PIO) port of an Am29200 microcontroller is
configured such that PIO signal–pin PIO0 is an output, and PIO signal–pin PIO15 an
input. The system hardware ensures that the two pins are wired together. A two stage
interrupt handler is assigned to processing interrupts generated by a rising edge on
pin PIO15. By first clearing pin PIO0 and then setting it to one, an interrupt will be
generated.
First, a number of include files must be accessed to declare external data and
procedure type information. Newer versions of file signal.h contain the
extern
declarations listed below. Hence, only when using an older signal.h file need the
extern
statement be explicitly included.