Texas Instruments TMS320C6000 Reference Manual page 18

Chip support library api
Hide thumbs Also See for TMS320C6000:
Table of Contents

Advertisement

CSL API Module Introduction
Initializing the Registers of a Peripheral
Function Inlining
2-4
A couple rules apply to these macros:
Only writeable register fields are arguments, no read-only fields
The register field arguments are specified least-significant first
If a field is not implemented for a particular device, use the
PER_REG_FIELD_NA value
Related to the MK macros is a pair of functions and a structure definition that
many of the API modules implement. The two functions are PER_ConfigA()
and PER_ConfigB() and the structure is PER_CONFIG where PER is the pe-
ripheral module name such as DMA. These functions along with the structure
give you two ways of initializing the registers of a peripheral. Using method A,
you initialize a configuration structure with the appropriate register values.
Then you pass the address of this structure to the ConfigA function that in turn
initializes the peripheral registers with the values in the structure. The other
method (method B) does not use the configuration structure; instead, you pass
the register values as individual arguments to the ConfigB function. The two
methods may be used interchangeably. Using either of the two methods, you
still have to come up with the register values. This is where the MK (make)
macros help: you can use the macros inside of the structure initializer or you
can use them in place of the arguments when calling the ConfigB function.
Consider this hypothetical example:
PER_CONFIG MyConfig = {
reg0 val ,
reg1 val,
};
PER_ConfigA(&MyConfig);
Or for method B:
PER_ConfigB( reg0 val , reg1 val ,
Another topic that is global to the API modules is function inlining. It turns out
that a high percentage of the API functions are very short, setting a single reg-
ister bit for example. For these small functions, it does not make sense to al-
ways incur the overhead of a C function call. So, the API declares them as stat-
ic inline when the user enables inlining. You can actually reduce code size by
);

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C6000 and is the answer not in the manual?

Questions and answers

Table of Contents