1 /* Copyright (C) 2013, 2014 Czech Technical University in Prague
4 * - Carlos Jenkins <carlos@jenkins.co.cr>
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation
8 * files (the "Software"), to deal in the Software without
9 * restriction, including without limitation the rights to use,
10 * copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
27 * File : sfunction_scic.c
29 * C-MEX S-function block for configuring RPP Serial Communication.
36 * <matlabroot>/bin/mex sfunction_scic.c
42 Name: Serial Configure
43 Category: Communication
52 - { name: "Baud rate", type: "uint32" }
54 # Description and Help is in Markdown mark-up
57 This block configures the baud rate of the Serial Communication
58 Interface (SCI). Only one block of this type per model is alloved.
64 RPP API functions used:
74 #define S_FUNCTION_NAME sfunction_scic
78 static void mdlInitializeSizes(SimStruct *S)
81 * Configure parameters: 1
84 if (!rppSetNumParams(S, 1)) {
89 * Configure input ports: 0
91 if (!ssSetNumInputPorts(S, 0)) {
96 * Configure output ports: 0
98 if (!ssSetNumOutputPorts(S, 0)) {
102 /* Set standard options for this block */
103 rppSetStandardOptions(S);
107 #ifdef MATLAB_MEX_FILE
108 #define MDL_CHECK_PARAMETERS
109 static void mdlCheckParameters(SimStruct *S)
111 /* Check the parameter 1 (top baud rate is arbitrary) */
112 if (!rppValidParamRange(S, 0, 0, 1000000)) {
119 #ifdef MATLAB_MEX_FILE
120 #define MDL_SET_WORK_WIDTHS
121 static void mdlSetWorkWidths(SimStruct *S)
123 /* Set number of run-time parameters */
124 if (!ssSetNumRunTimeParams(S, 1)) {
128 /* Register the run-time parameter 1 */
129 ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT32);
134 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
135 #define UNUSED_MDLOUTPUTS
136 #define UNUSED_MDLTERMINATE