%% $RCSfile: sdspwindow.tlc,v $ %% $Revision: 1.13 $ $Date: 2000/06/15 20:37:51 $ %% %% Abstract: Target file for the S-Function sdspwindow.c %% Used for the Window Block %% %% Copyright 1995-2000 The MathWorks, Inc. %% %implements "sdspwindow" "C" %% Function: Start ============================================================= %% Abstract: %% %% %function Start(block, system) Output /* DSP Blockset Window (%) - % */ %assign outMode = SFcnParamSettings.OutputMode %if (outMode == "GenerateOnly") %assign nChans = 1 %else %assign nChans = SFcnParamSettings.NumChannels %endif %assign N = LibDataOutputPortWidth(0) / nChans %assign genPortIdx = (outMode == "GenerateOnly") ? 0 : 1 %% %foreach idx = N %if (outMode == "ApplyOnly") %assign sample = LibBlockDWork(Samples,"","",idx) % = %; %else %if LibBlockOutputSignalIsInBlockIO(genPortIdx) %assign sample = LibBlockOutputSignal(genPortIdx,"","",idx) % = %; %endif %endif %endforeach %endfunction %% Function: Outputs =========================================================== %% Abstract: %% %% %function Outputs(block, system) Output /* DSP Blockset Window (%) - % */ %assign outMode = SFcnParamSettings.OutputMode %% %if outMode != "ApplyOnly" /* Data is persistent on Generate port */ %endif %% %if outMode != "GenerateOnly" && !LibIsEqual(TID, "constant") %% outMode must be "ApplyOnly" or "ApplyAndGenerate" %assign nChannels = SFcnParamSettings.NumChannels %assign samplesPerChannel = LibDataInputPortWidth(0) / nChannels %% %if nChannels > 1 %% /* Apply window to % channels */ { %if outMode == "ApplyOnly" real_T *window = %; %else %% outMode must be "ApplyAndGenerate" at this point: real_T *window = %; %endif int_T iw = 0; %% %if LibBlockInputSignalBufferDstPort(0) == 0 /* In-place window computation: */ %assign rollVars = ["y0"] %else %assign rollVars = ["U", "y0"] %endif %% %roll idx = RollRegions, lcv = RollThreshold, block, "Roller", rollVars %assign reSigIdx = "%%" %assign imSigIdx = "%%" %if LibBlockInputSignalBufferDstPort(0) != 0 %% %% Not sharing buffers: %% %if LibBlockOutputSignalIsComplex(0) %% Yi = Ui * W % = ... % * window[iw]; %endif %% Yr = Ur * W % = ... % * window[iw++]; %else %% %% Sharing buffers: %% %if LibBlockOutputSignalIsComplex(0) %% Yi *= w % *= window[iw]; %endif %% Yr *= w % *= window[iw++]; %endif %% if (iw == %) iw = 0; %endroll } %% %% %else %% Single Channel %% %if LibBlockInputSignalBufferDstPort(0) == 0 /* In-place window computation: */ %if outMode == "ApplyOnly" %assign rollVars = ["y0", "DWork"] %else %assign rollVars = ["y0", "y1"] %endif %else %if outMode == "ApplyOnly" %assign rollVars = ["U", "y", "DWork"] %else %assign rollVars = ["U", "y0", "y1"] %endif %endif %% %roll idx = RollRegions, lcv = RollThreshold, block, "Roller", rollVars %assign reSigIdx = "%%" %assign imSigIdx = "%%" %% The sample comes from either the DWork or the Generate port: %if (outMode == "ApplyOnly") %assign sample = LibBlockDWork(Samples,"",lcv,idx) %else %% outMode must be "ApplyAndGenerate" at this point: %assign sample = LibBlockOutputSignal(1,"",lcv,idx) %endif %% %if LibBlockInputSignalBufferDstPort(0) != 0 %% %% Not sharing buffers: %% %% Yr = Ur * w % = ... % * %; %% %if LibBlockOutputSignalIsComplex(0) %% Yi = Ui * w % = ... % * %; %endif %else %% %% Sharing buffers: %% %% Yr *= w % *= %; %% %if LibBlockOutputSignalIsComplex(0) %% Yi *= w % *= %; %endif %endif %endroll %% %endif %else /* Data is preset on the Apply port */ %endif %endfunction %% Outputs %% EOF: sdspwindow.tlc