CSL API Module Introduction
2.1 CSL API Module Introduction
OPEN and CLOSE Functions
MK Macros
2-2
There are certain methods used across different modules that are worth men-
tioning at the global level.
Peripherals that have multiple channels, ports, etc. must be managed as
resources in a shared environment. The CSL APIs allow for this by way of
Open and Close API functions. For example, a piece of application code can
open a DMA channel for exclusive use. This precludes any other part of the
program from opening the same DMA channel. If the resource is no longer
needed, it can be freed up by closing it. The methodology used is the handle
concept. You obtain a peripheral handle by calling the Open function for that
peripheral. This handle is then used in all subsequent API calls for that periph-
eral. This of course only applies to peripheral devices that have multiple chan-
nels or ports such as the DMA, McBSP, and timer. Other peripherals such as
the EMIF need no such resource management and do not have handle based
API calls.
Another method that many of the API modules share is the idea of the MK mac-
ro that stands for make . Inevitably when configuring peripherals, you will have
to set some registers to some values. It can be painstaking work to calculate
bit-field values and then shift-merge them all together to form a register value.
To make this easier, the API modules define MK macros. These macros take
individual right-justified field values as arguments and form the merged value.
In addition, symbolic constants are provided that may be used for the field val-
ues. To illustrate, consider a hypothetical register named REG that is part of
a peripheral named PER. This register has 5 fields, F0, F1, F2, F3, and F4. The
MK macro will look like this:
PER_MK_REG(f0,f1,f2,f3,f4)
Additionally, there will be field value constants similar to the following:
PER_REG_F0_VAL0
PER_REG_F0_VAL1
PER_REG_F1_VAL0
...
PER_REG_F4_VAL3
This macro may be used several ways. You can use it without the symbolic
constants like this:
Need help?
Do you have a question about the TMS320C6000 and is the answer not in the manual?
Questions and answers