%selectfile NULL_FILE
%if EXISTS("_ACCELLIB_") == 0
%assign _ACCELLIB_ = 1
%if (MaxStackSize != rtInf) || (MaxStackVariableSize != rtInf)
%assign errTxt = "Simulink Accelerator Error: MaxStackSize and/or " ...
"MaxStackVariableSize TLC variables cannot be used."
%exit %<errTxt>
%endif
%function SLibSetupFCSubsystemPtrs() void
%openfile fcnbuffer
%foreach childIdx = NumChildSFunctions
%assign thisBlock = ChildSFunctionList[childIdx]
%with thisBlock
%if NumSFcnSysOutputCalls > 0
%assign sfuncName = ParamSettings.FunctionName
/* %<TypeLevel> Block: '%<Name>' (%<sfuncName>) */
childS = %<RTMGetIdxed("SFunction", childIdx)>;
callSysFcns = ssGetCallSystemOutputFcnList(childS);
%assign pZeroWidth = LibBlockOutputSignalWidth(0)
%assign portEl = -1
%foreach fcnCallIdx = NumSFcnSysOutputCallDsts
%if portEl == SFcnSystemOutputCall[fcnCallIdx].OutputElement
%continue
%else
%assign portEl = SFcnSystemOutputCall[fcnCallIdx].OutputElement
%endif
%with SFcnSystemOutputCall[fcnCallIdx]
%if STRING(BlockToCall) != "unconnected"
%assign sysIdx = BlockToCall[0]
%assign blkIdx = BlockToCall[1]
%assign ssBlock = ::CompiledModel.System[sysIdx].Block[blkIdx]
%assign tidVal = ParamSettings.SampleTimesToSet[0][1]
%assign fcnCallFNI = LibGetFcnCallFNI(ssBlock, FcnPortElement, tidVal)
%if fcnCallFNI != ""
callSysFcns[%<3*pZeroWidth> + %<OutputElement>] = (SysOutputFcn) ...
%<fcnCallFNI>;
%else
callSysFcns[%<3*pZeroWidth> + %<OutputElement>] = ...
(SysOutputFcn) %<SLibGetNullDefinitionFromTfl()>;
%endif
%else
/* Unconnected function-call */
callSysFcns[%<3*pZeroWidth> + %<OutputElement>] = ...
(SysOutputFcn) %<SLibGetNullDefinitionFromTfl()>;
%endif
%endwith
%endforeach
%undef sysIdx, blkIdx, ssIdx
%endif
%endwith
%endforeach
%closefile fcnbuffer
%if !WHITE_SPACE(fcnbuffer)
%openfile rtnbuffer
/* register function-calls */
{
SimStruct *childS;
SysOutputFcn *callSysFcns;
%<fcnbuffer>/
}
%closefile rtnbuffer
%return rtnbuffer
%else
%return ""
%endif
%endfunction
%function SLibCallBlockInSimulink(system,block,functionToCall) void
%assign slSysIdx = System[block.BlockIdx[0]].SL_SystemIdx
%assign slBlkIdx = block.SL_BlockIdx
%assign callstr = "ssCallAccelRunBlock(%<RTMGetModelSS()>, %<slSysIdx>, " + /
"%<slBlkIdx>, %<functionToCall>);"
%return callstr
%endfunction
%function SLibCallMdlRefSystemInitializeInSimulink(system,block) void
%assign slSysIdx = System[block.BlockIdx[0]].SL_SystemIdx
%assign slBlkIdx = block.SL_BlockIdx
%assign callstr = "slmrAccelRunBlockSystemInitialize(%<RTMGetModelSS()>, %<slSysIdx>, " + /
"%<slBlkIdx>);"
%return callstr
%endfunction
%function SLibCallMdlRefSystemResetInSimulink(system,block) void
%assign slSysIdx = System[block.BlockIdx[0]].SL_SystemIdx
%assign slBlkIdx = block.SL_BlockIdx
%assign callstr = "slmrAccelRunBlockSystemReset(%<RTMGetModelSS()>, %<slSysIdx>, " + /
"%<slBlkIdx>);"
%return callstr
%endfunction
%function SLibCallSFcnSetDimsInSimulink(system,block,oIdx,rIdx) void
%assign slSysIdx = System[block.BlockIdx[0]].SL_SystemIdx
%assign slBlkIdx = block.SL_BlockIdx
%assign callstr = "ssCallAccelSetDims(%<RTMGetModelSS()>, %<slSysIdx>, " + /
"%<slBlkIdx>, %<oIdx>, %<rIdx>);"
%return callstr
%endfunction
%function SLibCopyCacheForIISInSimulink(system,fromCache) void
%assign callstr = "ssCallAccelCopyCacheForIIS(%<RTMGetModelSS()>, %<system>, " + /
"(void *)%<fromCache>);"
%return callstr
%endfunction
%function SLibCallModelBlockFcnCallInputInSimulink(block, portIdx, tid, functionToCall) void
%assign slSysIdx = System[block.BlockIdx[0]].SL_SystemIdx
%assign slBlkIdx = block.SL_BlockIdx
%assign accFunction = GetAcceleratorStringForFunction(functionToCall)
%assign callstr = "ssCallAccelModelBlockFcnCallInput(%<RTMGetModelSS()>, %<slSysIdx>, " + /
"%<slBlkIdx>, %<portIdx>, %<tid>, %<accFunction>);"
%return callstr
%endfunction
%function LibGetAccelDisclaimer() Output
%assign rtwLicensed = FEVAL("get_param", 0, "RTWLicensed")
%if rtwLicensed == "off"
#if 0
This file is not available for use in any application other than as a
MATLAB(R) MEX file for use with the Simulink(R) product.
If you do not have the Simulink Coder licensed, this file contains
encrypted block names, etc. If you purchase the Simulink Coder,
this file will contain full block descriptions and improved variable
names.
#endif
%else
/*
* This file is not available for use in any application other than as a
* MATLAB(R) MEX file for use with the Simulink(R) product.
*/
%endif
%endfunction
%function LibReportDiagnosticForAccel() Output
void rt_ssGetBlockPath(SimStruct* S, int_T sysIdx, int_T blkIdx, char_T **path) { _ssGetBlockPath(S, sysIdx, blkIdx, path); }
void rt_ssSet_slErrMsg(SimStruct* S, void* diag) { if(!_ssIsErrorStatusAslErrMsg(S)) {_ssSet_slErrMsg(S, diag);} else {_ssDiscardDiagnostic(S, diag);}}
void rt_ssReportDiagnosticAsWarning(SimStruct* S, void* diag) { _ssReportDiagnosticAsWarning(S, diag); }
%endfunction
%endif