Digital Signal Processing Reference
In-Depth Information
6
Named Registers
The C syntax is extended by Embedded C to include a storage-class specifier for
named registers . It can be used to identify a variable with a machine register.
A variable declared this way has external linkage and static storage. The names
of the registers must be reserved identifiers, so they are outside the name space
of existing programs. A reserved identifier either starts with two underscores or
with one underscore and a capital. For each supported register only one variable
can be associated with this register in every scope. The size of the type of the
variable should be big enough to contain the full machine register. Otherwise the
part contained in the variable is implementation defined.
The following is an example of a named register declaration, where SP is a
intrinsic name of the compiler referring to the stack pointer.
register _SP volatile void * stack_pointer;
stack pointer is an object stored in register SP and is a pointer to volatile
void.
7
Hardware I/O Addressing
The Embedded-C report also contains a section on supporting I/O hardware by
a compiler. Apart from standardizing an interface to such I/O hardware, it is an
elaborate description on how such support could be engineered. The goal of this
part of the Embedded-C report is to facilitate the separate development of support
in a compiler and the device driver itself.
Specialized I/O hardware is often connected to a processor through memory
mapped I/O, that is they are accessed through a reserved part of the memory
space. Other processors however have dedicated instructions to communicate with
specialized I/O hardware. The programmer of a device driver would prefer to write
his driver so that it is portable across all platforms, independent of the way this
hardware is accessed by the processor. This part of the Embedded-C report aims to
facilitate this through a standardized set of functions to access such devices. It also
describes the way such an interface can be supported by a compiler.
Figure 13 lists all functions that should be supported by a compiler. Central in
this interface are the ioreg -designators. Basically these are identifiers, one for each
register in the I/O device. These identifiers can correspond to an object in the device
driver, but they are more often used for token concatenation inside macros. Below
some examples are given.
The engineering of I/O hardware support consists of intrinsic compiler support
to access I/O registers from the processor through for example memory mapped I/O
or dedicated instructions. Next to that the compiler offers an include file iohw.h
mapping the standardized functions to this intrinsic compiler support. For each
combination of I/O device and processor architecture an include file is written
 
Search WWH ::




Custom Search