Archio Peripheral Register Structures - Freescale Semiconductor DSP56800E User Manual

Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

Core System Infrastructure
2.3

ArchIO Peripheral Register Structures

The global symbol ArchIO provides a C interface (structure type) to all peripheral and core
registers mapped in data memory. All registers are accessed via this structure so there is no need
to know and specify the concrete addresses of the registers to write or read. This mechanism
increases code readability and portability and simplifies access to registers. The ArchIO is
declared in the C header file arch.h.
The ArchIO is of type arch_sIO, which is the structure type composed from another structures,
one for each peripheral module.
There are two possible approaches how to define and use the ArchIO structure:
define ArchIO as the direct (numeric) address of memory-mapped peripheral registers casted to the
proper structure type.
define ArchIO as the extern variable while defining its address by a directive in linker command
file.
The second approach is used in the DSP56800E_Quick_Start tool implementation by default.
Example 2-1. Using the ArchIO structure
UWord16 RegValue;
RegValue = ArchIO.TimerD.Channel0.HoldReg;
ArchIO.TimerD.Channel0.CompareReg1 = 0x8000;
The Code Example 2-1 reads the timer/counter D0 Hold Register (HOLD) and writes to the
timer/counter D0 Compare Register 1 (CMP1).
Example 2-2. Using the ArchIO structure
UWord16 RegValue;
RegValue = periphMemRead(&ArchIO.TimerD.Channel0.HoldReg);
periphMemWrite(0x8000, &ArchIO.TimerD.Channel0.CompareReg1);
Code Example 2-2 shows the same operation using the periphMemRead and periphMemWrite
macros described later in Section 2.4.2:
2-6
Targeting 56F8xxx Platform
FREESCALE SEMICONDUCTOR

Advertisement

Table of Contents
loading

Table of Contents