%% sdspmax2_argscache.tlc %% %% TLC code generation file for DSP Blockset Maximum block (sdspmax2) %% %% Copyright (c) 1995-2000 The MathWorks, Inc. %% $Revision: 1.4 $ $Date: 2000/05/09 18:55:39 $ %% %% Abstract: %% Manages the argument cache prototype, generation, and instantiation %% used to hold all arguments required by max computational functions. %if EXISTS("_SDSPMAX2_ARGSCACHE_") == 0 %assign _SDSPMAX2_ARGSCACHE_ = 1 %% Function: generateArgCacheInstanceEntries ==================================================== %% Abstract: %% %function generateArgCacheInstanceEntries(block) Output %assign nSampsStr = STRING(nSamps) %assign nChansStr = STRING(nChans) %assign nElemStr = STRING(nSamps*nChans) %switch FcnType %case 1 %% Val & Idx %assign outvalStr = LibBlockOutputSignalAddr(0, "", "", 0) %assign outidxStr = LibBlockOutputSignalAddr(1, "", "", 0) %break %case 2 %% Val %case 4 %% Running %assign outvalStr = LibBlockOutputSignalAddr(0, "", "", 0) %assign outidxStr = "NULL" %break %case 3 %% Idx %assign outvalStr = "NULL" %assign outidxStr = LibBlockOutputSignalAddr(0, "", "", 0) %break %endswitch %assign indataStr = LibBlockInputSignalAddr(0, "", "", 0) %if IsRunning && InCplx %assign magSqStr = LibBlockDWorkAddr(magSq,"","",0) %else %assign magSqStr = "NULL" %endif %% %assign magSqStr = (IsRunning && InCplx) ? LibBlockDWorkAddr(magSq,"","",0) : "NULL" %assign str = "\n" \ + nSampsStr + ", /* # samples */\n" \ + nChansStr + ", /* # channels */\n" \ + nElemStr + ", /* # samps * # chans */\n" \ + outvalStr + ", /* output value port */\n" \ + outidxStr + ", /* output index port */\n" \ + indataStr + ", /* input data port */\n" \ + magSqStr + " /* mag squared cache */\n" %return str %endfunction %% generateArgCacheInstanceEntries %% Function: getMaxArgsStructName =============================================== %% Abstract: %% Returns name of max function argument cache structure. %% Ex: TMWDSP_MaxArgs %% %% %function getMaxArgsStructName(block) void %% This name depends upon what controls the %% variations in the arg cache, if any. We %% simply need a unique struct name for each %% unique arg cache structure. %% %return "TMWDSP_MaxArgs" %endfunction %% getMaxArgsStructName %% Function: DefineMaxFcnArgCacheProto ========================================== %% Abstract: %% Declare the structure definition prototype for %% the function argument cache, and render into %% the model.h file. %% %function DefineMaxFcnArgCacheProto(block) void %assign structName = getMaxArgsStructName(block) %if JustCreatedCompiledModelRecord(structName) %openfile buffer typedef struct { int_T nSamps; /* # of rows */ int_T nChans; /* # of channels/cols */ int_T nElements; /* # rows * # channels */ void *outValPtr; /* Pointer to output value port */ void *outIdxPtr; /* Pointer to output index port */ void *inDataPtr; /* Pointer to input data port */ void *magSq; /* State for mag sq values (cplx running stats) */ } %; %closefile buffer % %endif %endfunction %% DefineMaxFcnArgCacheProto %% Function: GetMaxFcnArgCacheInstanceName ========================================== %% Abstract: %function GetMaxFcnArgCacheInstanceName(block) void %return "maxArgs_%" %endfunction %% GetMaxFcnArgCacheInstanceName %% Function: LocalInstantiateMaxFcnArgCache ========================================== %% Abstract: %% Instantiate the structure definition for the %% function argument cache, and render into the %% model.c file where the structure will be used. %% Needed when RTW vectors are not global or supporting GRT_MALLOC multi-instance %% capability. %% %function LocalInstantiateMaxFcnArgCache(block) void %% Ex: %% static const TMWDSP_MaxArgs args = {1,2}; %% Create arg cache declaration %% Ex: TMWDSP_MaxArgs args = { %% (data goes here) %% }; %% %% NOTE: Do not instantiate argument cache if block %% instance will be inlined. %% %if !InlineMaxInstance(block) %assign decl = "const % %" %assign decl = decl + " = {" + generateArgCacheInstanceEntries(block) + "};\n\n" %return decl %endif %endfunction %% LocalInstantiateMaxFcnArgCache %% Function: GlobalInstantiateMaxFcnArgCache ========================================== %% Abstract: %% Instantiate the structure definition for the %% function argument cache, and render into the %% model.c file. %% %function GlobalInstantiateMaxFcnArgCache(block) void %% Ex: %% static const TMWDSP_MaxArgs args = {1,2}; %% Create arg cache declaration %% Ex: TMWDSP_MaxArgs args = { %% (data goes here) %% }; %% %% NOTE: Do not instantiate argument cache if block %% instance will be inlined. %% %if !InlineMaxInstance(block) %assign decl = "static const % %" %assign decl = decl + " = {" + generateArgCacheInstanceEntries(block) + "};\n\n" % %endif %endfunction %% GlobalInstantiateMaxFcnArgCache %% Function: GenerateMaxFcnArgCache ========================================== %% Abstract: %% %function GenerateMaxFcnArgCache(block) void % %endfunction %% GenerateMaxFcnArgCache %endif %% _SDSPMAX2_ARGSCACHE_ %% [EOF] sdspmax2_argscache.tlc