Chapter 4. HAL Interfaces

Table of Contents
Base Definitions
Architecture Characterization
Interrupt Handling
Clocks and Timers
HAL I/O
Cache Control
Linker Scripts
Diagnostic Support
SMP Support

This section describes the main HAL interfaces.

Base Definitions

These are definitions that characterize the properties of the base architecture that are used to compile the portable parts of the kernel. They are concerned with such things a portable type definitions, endianness, and labeling.

These definitions are supplied by the cyg/hal/basetype.h header file which is supplied by the architecture HAL. It is included automatically by cyg/infra/cyg_type.h.

Byte order

CYG_BYTEORDER

This defines the byte order of the target and must be set to either CYG_LSBFIRST or CYG_MSBFIRST.

Label Translation

CYG_LABEL_NAME(name)

This is a wrapper used in some C and C++ files which use labels defined in assembly code or the linker script. It need only be defined if the default implementation in cyg/infra/cyg_type.h, which passes the name argument unaltered, is inadequate. It should be paired with CYG_LABEL_DEFN().

CYG_LABEL_DEFN(name)

This is a wrapper used in assembler sources and linker scripts which define labels. It need only be defined if the default implementation in cyg/infra/cyg_type.h, which passes the name argument unaltered, is inadequate. The most usual alternative definition of this macro prepends an underscore to the label name.

Base types

	cyg_halint8
	cyg_halint16
	cyg_halint32
	cyg_halint64
	cyg_halcount8
	cyg_halcount16
	cyg_halcount32
	cyg_halcount64
	cyg_halbool

These macros define the C base types that should be used to define variables of the given size. They only need to be defined if the default types specified in cyg/infra/cyg_type.h cannot be used. Note that these are only the base types, they will be composed with signed and unsigned to form full type specifications.

Atomic types

	cyg_halatomic CYG_ATOMIC

These types are guaranteed to be read or written in a single uninterruptible operation. It is architecture defined what size this type is, but it will be at least a byte.