1 /* Copyright (C) 2013 Czech Technical University in Prague
4 * - Carlos Jenkins <carlos@jenkins.co.cr>
6 * This document contains proprietary information belonging to Czech
7 * Technical University in Prague. Passing on and copying of this
8 * document, and communication of its contents is not permitted
9 * without prior written authorization.
11 * File : sfunction_sdrw.c
13 * C-MEX S-function block for RPP SD-RAM log write.
20 * <matlabroot>/bin/mex sfunction_sdrw.c
24 #define S_FUNCTION_NAME sfunction_sdrw
28 static void mdlInitializeSizes(SimStruct *S)
31 * Configure parameters: 2
33 * - Printf format [setting].
35 if(!rppSetNumParams(S, 2)) {
40 * Configure input ports: 1
43 if(!ssSetNumInputPorts(S, 1)) {
46 rppAddInputPort(S, 0, SS_DOUBLE);
49 * Configure output ports: 1
52 if(!ssSetNumOutputPorts(S, 1)) {
55 rppAddOutputPort(S, 0, SS_BOOLEAN);
57 /* Set standard options for this block */
58 rppSetStandardOptions(S);
62 #ifdef MATLAB_MEX_FILE
63 #define MDL_CHECK_PARAMETERS
64 static void mdlCheckParameters(SimStruct *S)
66 /* Check the parameter 1 */
67 if(!rppValidParamRange(S, 0, 0, 255)) {
74 #ifdef MATLAB_MEX_FILE
75 #define MDL_SET_WORK_WIDTHS
76 static void mdlSetWorkWidths(SimStruct *S)
78 /* Set number of run-time parameters */
79 if(!ssSetNumRunTimeParams(S, 1)) {
83 /* Register the run-time parameter 1 */
84 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT8);
89 #ifdef MATLAB_MEX_FILE
91 static void mdlRTW(SimStruct* S)
93 /* Register parameter 2 as a parameter setting */
94 static char_T str[128];
95 mxGetString(ssGetSFcnParam(S, 1), (char*)&str, sizeof(str)); /* Get string */
96 if(!ssWriteRTWParamSettings(S, 1,
97 SSWRITE_VALUE_QSTR, "PrintfFormat", (const char_T*)&str)) {
98 /* An error ocurred */
105 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
106 #define UNUSED_MDLOUTPUTS
107 #define UNUSED_MDLTERMINATE