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

    function [linkPjtGenInfo, schedPjtGenInfo, targetPjtGenInfo] = getBlockInfo_HwInterrupt_Targets_C6000(linkPjtGenInfo, schedPjtGenInfo, targetPjtGenInfo)
%GETBLOCKINFO_HWINTERRUPT Get information about a Hardware Interrupt block.

%   Copyright 2008-2010 The MathWorks, Inc.

%----------------------------------------------------------
% Look for HW Interrupt blocks in the model
%----------------------------------------------------------
hwInterruptBlocks = linkfoundation.util.FindSystem(linkPjtGenInfo.modelName,'DSP/BIOS Hardware Interrupt');
    
%----------------------------------------------------------
% Check for error conditions
%----------------------------------------------------------
numHwIntBlks = length(hwInterruptBlocks);
if numHwIntBlks==0
    return;
elseif numHwIntBlks> 1
    % Only 1 HW Interrupt is allowed in the model
    linkPjtGenInfo.error = 1;
    linkPjtGenInfo.errormsg = ...
        'Only one DSP/BIOS Hardware Interrupt block is allowed in the model';
    return;
end

%----------------------------------------------------------
% Update 'schedPjtGenInfo' if a DSP/BIOS HW Interrupt block is present
%----------------------------------------------------------
% linkPjtGenInfo.numInterrupts  - Number of interrupts in the model
% linkPjtGenInfo.interrupts     - List of interrupt numbers -> user-specified
% linkPjtGenInfo.priority       - List of interrupt priorities -> user-specified
% linkPjtGenInfo.isrpreempt     - List of interrupt preempts -> user-specified
%----------------------------------------------------------

if ~isempty(hwInterruptBlocks)
    
    % Get information specified by user
    irqnum = get_param (hwInterruptBlocks, 'irqnumbers');
    interruptNumbers = eval(cell2mat(irqnum));
    
    priort = get_param(hwInterruptBlocks,'irqpriorities');
    irqPriority = eval(cell2mat(priort)); 
    
    preemp = get_param(hwInterruptBlocks,'irqpreempts');
    irqPreempt = eval(cell2mat(preemp));
    
    for i=1:length(interruptNumbers)
        % Increment number of interrupts by 1
        linkPjtGenInfo.numInterrupts = linkPjtGenInfo.numInterrupts + 1;
        
        % Assign the interrupt number - given by user
        linkPjtGenInfo.interrupts{linkPjtGenInfo.numInterrupts} = interruptNumbers(i);
        
        % Assign the interrupt priority - given by user
        linkPjtGenInfo.priority{linkPjtGenInfo.numInterrupts} = irqPriority(i);
        
        % Assign the interrupt preempt - given by user
        linkPjtGenInfo.isrpreempt{linkPjtGenInfo.numInterrupts} = irqPreempt(i);
    end
end
  
%[EOF] getBlockInfo_HwInterrupt_ccslink_C6000.m