Macro Expansion Process - Freescale Semiconductor DSP56800E User Manual

Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

There can be even longer commands. These commands incorporate some higher functionality
than only a simple access to the peripheral registers. An example can be the commands, which
perform the mathematical calculations for data scaling to fit the results into the desired data range,
like recounting of the PWM duty cycle in percentage of the actual value to be written to the PWM
Value register.
Example 5-1. Implementation details
Figure 5-1 is intended to illustrate the macro expansion process. The corresponding items are
highlighted by the same color through this macro expansion example.
ioctl command general syntax:
Real example:
Implementation:
Common include file - periph.h
#define ioctl( id, cmd,
On-chip driver include file - pwm.h
#define
PWM_A
#define ioctlPWM_SET_MODULO( pPwmBase, param) \
Generated assembly code:
FREESCALE SEMICONDUCTOR
ioctl( module_ID, cmd_name,
ioctl( PWM_A, PWM_SET_MODULO,
pParams
(&ArchIO.PwmA)
(*(pPwmBase)->CounterModuloReg) =
move.w
Figure 5-1. Macro Expansion Process
Targeting 56F8xxx Platform
cmd_spec_param
) ioctl##cmd( id,
pParams
//i.e. PWMA base& = module_ID = 0xf140
Base& + displacement calculated
by C preprocessor
#12543, X:0xf140
);
0x30ff
);
)
param
5-3

Advertisement

Table of Contents
loading

Table of Contents