]> rtime.felk.cvut.cz Git - jenkicar/rpp-simulink.git/blob - rpp/blocks/sfunction_fraysbc.c
doc: Change YAML field Status to simple string
[jenkicar/rpp-simulink.git] / rpp / blocks / sfunction_fraysbc.c
1 /* Copyright (C) 2013, 2014 Czech Technical University in Prague
2  *
3  * Authors:
4  *     - Michal Horn <hornimch@fel.cvut.cz>
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_fraysbc.c
12  * Abstract:
13  *     C-MEX S-function block for RPP FlexRay static buffer configuration.
14  *
15  * References:
16  *     header.c
17  *     trailer.c
18  *
19  * Compile with:
20  *     <matlabroot>/bin/mex sfunction_fraysbc.c
21  */
22
23 /*
24 %YAML 1.2
25 ---
26 Name: FlexRay static buffer configuration
27 Category: FlexRay
28 Header: rpp/fr.h
29 Mnemonic: FRC
30
31 Inputs:
32
33 Outputs:
34
35 Parameters:
36
37 # Description and Help is in Markdown mark-up
38 Description: &desc |
39
40   This block ...
41
42 Help: *desc
43
44 Status: Beta
45
46 RPP API functions used:
47
48 Relevant demos:
49 ...
50 */
51
52 #define S_FUNCTION_NAME sfunction_fraysbc
53 #include "header.c"
54 #include <stdio.h>
55
56 #define channel_IDX                                             0
57 #define cycleCounterFiltering_IDX               1
58 #define isTx_IDX                                                2
59 #define maxPayload_IDX                                  3
60 #define msgBufferInterrupt_IDX                  4
61 #define payloadPreambleIndicatorTr_IDX  5
62 #define singleTransmit_IDX                              6
63 #define slotId_IDX                                              7
64
65
66 static void mdlInitializeSizes(SimStruct *S)
67 {
68     /*
69      * Configure parameters: 25
70          * channel (0 - A, 1 - B, 2 - AB)
71          * cycleCounterFiltering
72          * isTx
73          * maxPayload
74          * msgBufferInterrupt
75          * payloadPreambleIndicatorTr
76          * singleTransmit
77          * slotId
78      */
79     if (!rppSetNumParams(S, 8)) {
80         return;
81     }
82
83     /*
84      * Configure input ports: 0
85      */
86     if (!ssSetNumInputPorts(S, 0)) {
87         return;
88     }
89
90     /*
91      * Configure output ports: 0
92      */
93     if (!ssSetNumOutputPorts(S, 0)) {
94         return;
95     }
96
97     /* Set standard options for this block */
98     rppSetStandardOptions(S);
99 }
100
101
102 #ifdef MATLAB_MEX_FILE
103 #define MDL_CHECK_PARAMETERS
104 static void mdlCheckParameters(SimStruct *S)
105 {
106
107 }
108 #endif
109
110
111 #ifdef MATLAB_MEX_FILE
112 #define MDL_SET_WORK_WIDTHS
113 static void mdlSetWorkWidths(SimStruct *S)
114 {
115     /* Set number of run-time parameters */
116     if (!ssSetNumRunTimeParams(S, 8)) {
117         return;
118     }
119
120     /* Register the run-time parameter 1 */
121         ssRegDlgParamAsRunTimeParam(S, channel_IDX, channel_IDX, "channel", SS_UINT8);
122         ssRegDlgParamAsRunTimeParam(S, cycleCounterFiltering_IDX, cycleCounterFiltering_IDX, "cycleCounterFiltering", SS_UINT8);
123         ssRegDlgParamAsRunTimeParam(S, isTx_IDX, isTx_IDX, "isTx", SS_BOOLEAN);
124         ssRegDlgParamAsRunTimeParam(S, maxPayload_IDX, maxPayload_IDX, "maxPayload", SS_UINT8);
125         ssRegDlgParamAsRunTimeParam(S, msgBufferInterrupt_IDX, msgBufferInterrupt_IDX, "msgBufferInterrupt", SS_BOOLEAN);
126         ssRegDlgParamAsRunTimeParam(S, payloadPreambleIndicatorTr_IDX, payloadPreambleIndicatorTr_IDX, "payloadPreambleIndicatorTr", SS_BOOLEAN);
127         ssRegDlgParamAsRunTimeParam(S, singleTransmit_IDX, singleTransmit_IDX, "singleTransmit", SS_BOOLEAN);
128         ssRegDlgParamAsRunTimeParam(S, slotId_IDX, slotId_IDX, "slotId", SS_UINT32);
129 }
130 #endif
131
132
133 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
134 #define UNUSED_MDLOUTPUTS
135 #define UNUSED_MDLTERMINATE
136 #include "trailer.c"