1 /* Copyright (C) 2014 Czech Technical University in Prague
4 * - Michal Horn <hornimch@fel.cvut.cz>
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_fraytransmit.c
13 * C-MEX S-function block for RPP FlexRay TX buffer configuration and message transmittion.
20 * <matlabroot>/bin/mex -I<matlabroot>/toolbox/shared/can/src/scanutil -I<matlabroot>/toolbox/rtw/targets/common/can/datatypes sfunction_cantransmit.c <matlabroot>/toolbox/rtw/targets/common/can/datatypes/sfun_can_util.c <matlabroot>/toolbox/rtw/targets/common/can/datatypes/can_msg.c
26 Name: Configure TX buffer
32 - { name: "Send", type: "uint8 vector" }
35 - { name: "ErrFlag", type: "bool" }
38 - { name: "channel", type: "uint8" }
39 - { name: "cycleCounterFiltering", type: "uint8" }
40 - { name: "maxPayload", type: "uint8" }
41 - { name: "msgBufferInterrupt", type: "bool" }
42 - { name: "payloadPreambleIndicatorTr", type: "bool" }
43 - { name: "singleTransmit", type: "bool" }
44 - { name: "slotId", type: "uint32" }
46 # Description and Help is in Markdown mark-up
59 RPP API functions used:
65 #define S_FUNCTION_NAME sfunction_fraytransmit
71 cycleCounterFiltering_IDX = 1,
73 msgBufferInterrupt_IDX = 3,
74 payloadPreambleIndicatorTr_IDX = 4,
75 singleTransmit_IDX = 5,
80 static void mdlInitializeSizes(SimStruct *S)
82 if (!rppSetNumParams(S, PARAM_COUNT)) {
87 * Configure input ports: 1
89 if (!ssSetNumInputPorts(S, 1)) {
92 rppAddInputVectorPort(S, 0, SS_UINT8, 2*(int_T)mxGetPr(ssGetSFcnParam(S, 2))[0]);
95 * Configure output ports: 1
98 if (!ssSetNumOutputPorts(S, 1)) {
101 rppAddOutputPort(S, 0, SS_BOOLEAN);
103 /* Set standard options for this block */
104 rppSetStandardOptions(S);
108 #ifdef MATLAB_MEX_FILE
109 #define MDL_CHECK_PARAMETERS
110 static void mdlCheckParameters(SimStruct *S)
117 #ifdef MATLAB_MEX_FILE
118 #define MDL_SET_WORK_WIDTHS
119 static void mdlSetWorkWidths(SimStruct *S)
121 /* Set number of run-time parameters */
122 if (!ssSetNumRunTimeParams(S, PARAM_COUNT)) {
126 /* Register the run-time parameter 1 */
127 ssRegDlgParamAsRunTimeParam(S, channel_IDX, channel_IDX, "channel", SS_UINT8);
128 ssRegDlgParamAsRunTimeParam(S, cycleCounterFiltering_IDX, cycleCounterFiltering_IDX, "cycleCounterFiltering", SS_UINT8);
129 ssRegDlgParamAsRunTimeParam(S, maxPayload_IDX, maxPayload_IDX, "maxPayload", SS_UINT8);
130 ssRegDlgParamAsRunTimeParam(S, msgBufferInterrupt_IDX, msgBufferInterrupt_IDX, "msgBufferInterrupt", SS_BOOLEAN);
131 ssRegDlgParamAsRunTimeParam(S, payloadPreambleIndicatorTr_IDX, payloadPreambleIndicatorTr_IDX, "payloadPreambleIndicatorTr", SS_BOOLEAN);
132 ssRegDlgParamAsRunTimeParam(S, singleTransmit_IDX, singleTransmit_IDX, "singleTransmit", SS_BOOLEAN);
133 ssRegDlgParamAsRunTimeParam(S, slotId_IDX, slotId_IDX, "slotId", SS_UINT32);
138 #define COMMON_MDLINITIALIZESAMPLETIMES_INHERIT
139 #define UNUSED_MDLOUTPUTS
140 #define UNUSED_MDLTERMINATE