
Using the Device Driver Library
MOTOROLA
MMC2001DDRM/D
26
Reference Manual
standard type definitions for all modules. The file cfg\plibdefs.hcontains module
register addresses and preprocessor macro definitions which are user-modifiable.
NOTE:
Only files contained in the cfg subdirectory are user-modifiable; changing other
header files may adversely affect library operation.
3.2 Library Macros
The device driver library API definitions are C language preprocessor macros. This
was done in order to efficiently implement selective in-line code generation and API
parameter checking. The convention for naming addressable API functions is to
append an underscore-lowercase F (_f) to the API name. For example, the UART
initialization API is called UART_A_Init, which corresponds to a macro. The
addressable function corresponding to this API definition is called UART_A_Init_f.
This is useful to know when attempting to load API function addresses into a table
or passing an API function pointer as a parameter. However, in most cases using
the standard API definition is appropriate.
User-configurable preprocessor macros are concerned with runtime parameter
checking. Parameter checking code is enabled at application compile time by
setting the <module>_PARAM_CHECKING flag (defined initially in plibdefs.h) to a
non-zero value, where <module> is the name of the peripheral device in question.
Refer to the following example:
NOTE:
The PARAM_CHECKING flag may be used selectively, thereby activating
parameter checking in only certain API invocations.
NOTE:
Parameter checking by default is enabled in the file cfg\plibdefs.h.
#undef ISPI_A_PARAM_CHECKING
#define ISPI_A_PARAM_CHECKING 1
/* Turn on ISPI param checking */
/* Perform parameter checking on initialization */
if (ISPI_A_Init(ISPIPtr, ISPI_BAUD_RATE_4, TRUE, HIGH,
TOTEMPOLE, TRUE, FALSE, FALSE) != DD_ERR_NONE)
...
#undef ISPI_A_PARAM_CHECKING
#define ISPI_A_PARAM_CHECKING 0
/* Turn off ISPI param checking */
/* No parameter checking on enable */
if (ISPI_A_Enable(ISPIPtr, ISPI_A_CLOCK_COUNT_16) != DD_ERR_NONE)
...
Some modules support a shorthand for API functions which may have many
parameters, providing defaults for most of the arguments. These default macros
generally have the same name as the documented API function, except that all
characters in the macro name are uppercase and _DEFAULT is appended to the
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.