Motorola DSP Developer's Kit | ![]() ![]() |
MATLAB MEX-Files
Before continuing, we recommend you read at least the "Creating C Language MEX Files" section under "External Interfaces" in the MATLAB online Help.
Required Definitions
Define the following macros in your MEX-file:
MEX_FUNC_NAME
The name should match the name of the MEX-file source (including case sensitivity), omitting the .cpp
extension. The functions supplied in the Motorola DSP Toolbox (<matlab>/toolbox/motdsp/motdsp/56300
and <matlab>/toolbox/motdsp/56600
) are all prefixed with mot563_
or mot566_
.
MAX_INPUT_ARGS
MIN_INPUT_ARGS
MAX_OUTPUT_ARGS
MIN_OUTPUT_ARGS
The four MAX*/MIN* macros are used to validate the call of the function from the MATLAB environment. The two optional DSP device type and simulator command file arguments must be included in the value of MAX_INPUT_ARGS.
An example using all of the macros mentioned might be
// Name of DSP MEX function #define MEX_FUNC_NAME "mot563_max" /* Specify the expected number of function call arguments. Maximum number of possible input args includes fixed and optional args. Note: There are always 2 optional input arguments by default: 1. Loading a particular dsp type (in the 56300/600 family) from the Matlab command line. 2. Running command files ('xxx.cmd') from the Matlab command line. */ /* Maximum number of input args suggests there are 2 possible fixed input arguments */ #define MAX_INPUT_ARGS 4 /* Minimum number of input args, i.e. the minimum number of fixed input arguments. */ #define MIN_INPUT_ARGS 1 /* Maximum number of output args, including fixed and optional */ #define MAX_OUTPUT_ARGS 2 /* Minimum number of output args, i.e. the number of fixed arguments only - generally always 1.*/ #define MIN_OUTPUT_ARGS 1
All other macros defined in the templates are implementation examples only and are not required to be present.
![]() | What You Provide | Declaring Input and Output Objects | ![]() |