1 /* Copyright (C) 2013, 2014 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_scic.c
13 * C-MEX S-function block for configuring RPP Serial Communication.
20 * <matlabroot>/bin/mex sfunction_scic.c
26 Name: Serial Configure
27 Category: Communication
36 - { name: "Baud rate", type: "uint32" }
38 # Description and Help is in Markdown mark-up
41 This block configures the baud rate of the Serial Communication
42 Interface (SCI). Only one block of this type per model is alloved.
48 RPP API functions used:
58 #define S_FUNCTION_NAME sfunction_scic
62 static void mdlInitializeSizes(SimStruct *S)
65 * Configure parameters: 1
68 if (!rppSetNumParams(S, 1)) {
73 * Configure input ports: 0
75 if (!ssSetNumInputPorts(S, 0)) {
80 * Configure output ports: 0
82 if (!ssSetNumOutputPorts(S, 0)) {
86 /* Set standard options for this block */
87 rppSetStandardOptions(S);
91 #ifdef MATLAB_MEX_FILE
92 #define MDL_CHECK_PARAMETERS
93 static void mdlCheckParameters(SimStruct *S)
95 /* Check the parameter 1 (top baud rate is arbitrary) */
96 if (!rppValidParamRange(S, 0, 0, 1000000)) {
103 #ifdef MATLAB_MEX_FILE
104 #define MDL_SET_WORK_WIDTHS
105 static void mdlSetWorkWidths(SimStruct *S)
107 /* Set number of run-time parameters */
108 if (!ssSetNumRunTimeParams(S, 1)) {
112 /* Register the run-time parameter 1 */
113 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT32);
118 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
119 #define UNUSED_MDLOUTPUTS
120 #define UNUSED_MDLTERMINATE