gusucode.com > target工具箱matlab源码程序 > target/extensions/processor/shared/ti/mdlinfo/getBlockInfo_CPUTimer.m

    function [linkPjtGenInfo, schedPjtGenInfo, targetInfo] = getBlockInfo_CPUTimer(linkPjtGenInfo, schedPjtGenInfo, targetInfo)
%GETBLOCKINFO_CPUTIMER Get information about a CPU Timer block.

%   Copyright 2007-2011 The MathWorks, Inc.

%----------------------------------------------------------
% Look for CPU Timer blocks in the model
%----------------------------------------------------------
timerBlock = linkfoundation.util.FindSystem(linkPjtGenInfo.modelName,'CPU Timer');

%----------------------------------------------------------
% Update 'schedPjtGenInfo' if a CPU Timer block is present
%----------------------------------------------------------
% linkPjtGenInfo.numTimers      - (Increment) Number of interrupts in the model
% linkPjtGenInfo.timers         - (Add to   ) List of interrupt numbers -> user-specified
% linkPjtGenInfo.timerperiod    - (Add to   ) List of interrupt priorities -> user-specified
%----------------------------------------------------------

for i=1:length(timerBlock)
    
    % Increment the number of timers by 1
    linkPjtGenInfo.numTimers = linkPjtGenInfo.numTimers + 1;
    
    % Get the timer number specified by the user
    timerno = get_param (timerBlock(i), 'timerno');
    for j=1:linkPjtGenInfo.numTimers-1
        if linkPjtGenInfo.timers{j} == str2num(timerno{1}) %#ok<ST2NM>
            linkPjtGenInfo.error = 1;
            DAStudio.error('TARGETSHARED:codegen:IRInfoMultipleCPUTimers', timerno{1});
        end
    end
    
    linkPjtGenInfo.timers{i} = str2num(timerno{1}); %#ok<ST2NM>
    period = get_param (timerBlock(i), 'period');
    linkPjtGenInfo.timerperiod{i} = str2num(period{1}); %#ok<ST2NM>
end

%[EOF] getBlockInfo_CPUTimer.m