]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/blob - rpp/blocks/sfunction_scic.c
Add documentation templates to all blocks
[pes-rpp/rpp-simulink.git] / rpp / blocks / sfunction_scic.c
1 /* Copyright (C) 2013, 2014 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Carlos Jenkins <carlos@jenkins.co.cr>
5  *
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.
10  *
11  * File : sfunction_scic.c
12  * Abstract:
13  *     C-MEX S-function block for configuring RPP Serial Communication.
14  *
15  * References:
16  *     header.c
17  *     trailer.c
18  *
19  * Compile with:
20  *     <matlabroot>/bin/mex sfunction_scic.c
21  */
22
23 /*
24 %YAML 1.2
25 ---
26 Name: xxx
27
28 Mnemonic: XXX
29
30 Inputs:
31
32 Outputs:
33
34 Parameters:
35
36 # Description is in Markdown mark-up
37 Description: >
38
39   This block ...
40
41 Status:
42   Tested:
43   Untested:
44   Not working:
45
46 RPP API functions used:
47
48 Relevant demos:
49 ...
50 */
51
52 #define S_FUNCTION_NAME sfunction_scic
53 #include "header.c"
54
55
56 static void mdlInitializeSizes(SimStruct *S)
57 {
58     /*
59      * Configure parameters: 1
60      *  - Baud rate.
61      */
62     if (!rppSetNumParams(S, 1)) {
63         return;
64     }
65
66     /*
67      * Configure input ports: 0
68      */
69     if (!ssSetNumInputPorts(S, 0)) {
70         return;
71     }
72
73     /*
74      * Configure output ports: 0
75      */
76     if (!ssSetNumOutputPorts(S, 0)) {
77         return;
78     }
79
80     /* Set standard options for this block */
81     rppSetStandardOptions(S);
82 }
83
84
85 #ifdef MATLAB_MEX_FILE
86 #define MDL_CHECK_PARAMETERS
87 static void mdlCheckParameters(SimStruct *S)
88 {
89     /* Check the parameter 1 (top baud rate is arbitrary) */
90     if (!rppValidParamRange(S, 0, 0, 1000000)) {
91         return;
92     }
93 }
94 #endif
95
96
97 #ifdef MATLAB_MEX_FILE
98 #define MDL_SET_WORK_WIDTHS
99 static void mdlSetWorkWidths(SimStruct *S)
100 {
101     /* Set number of run-time parameters */
102     if (!ssSetNumRunTimeParams(S, 1)) {
103         return;
104     }
105
106     /* Register the run-time parameter 1 */
107     ssRegDlgParamAsRunTimeParam(S, 0, 0, "p1", SS_UINT32);
108 }
109 #endif
110
111
112 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
113 #define UNUSED_MDLOUTPUTS
114 #define UNUSED_MDLTERMINATE
115 #include "trailer.c"