Highlights from
Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

image thumbnail

Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

by

 

Embedded Coder integration for creating models that run directly in Green Hills MULTI IDE

getBlockInfo_HwInterrupt_multilink_v850(linkPjtGenInfo, schedPjtGenInfo)
function [linkPjtGenInfo, schedPjtGenInfo] = getBlockInfo_HwInterrupt_multilink_v850(linkPjtGenInfo, schedPjtGenInfo)
%GETBLOCKINFO_HWINTERRUPT_MULTILINK_V850 Get information about a 'Hardware Interrupt' block.

%   $Revision: 1.1.6.1 $ $Date: 2012/04/02 21:40:14 $
%   Copyright 2007-2010 The MathWorks, Inc.

%----------------------------------------------------------
% Look for HW Interrupt blocks in the model
%----------------------------------------------------------
hwInterruptBlocks = linkfoundation.util.FindSystem(linkPjtGenInfo.modelName,'V850 Interrupt Block');

%----------------------------------------------------------
% Check for error conditions
%----------------------------------------------------------
numHwIntBlks = length(hwInterruptBlocks);
if numHwIntBlks==0
    % No HW Interrupt block present in the model
    return;
elseif numHwIntBlks> 1
    % Only 1 HW Interrupt is allowed in the model
    linkPjtGenInfo.error = 1;
    linkPjtGenInfo.errormsg = 'Only one Hardware Interrupt block is allowed in the model';
    return
end

%----------------------------------------------------------
% Update 'schedPjtGenInfo' if a HW Interrupt block is present
%----------------------------------------------------------
% linkPjtGenInfo.numInterrupts  - Number of interrupts in the model
% linkPjtGenInfo.interrupts     - List of interrupt numbers
% linkPjtGenInfo.priority       - List of interrupt priorities
% linkPjtGenInfo.isrpreempt     - List of interrupt preempts
% linkPjtGenInfo.pienumbers     - ???
%----------------------------------------------------------

if ~isempty(hwInterruptBlocks)

    % Get information specified by user
    irqnum = get_param (hwInterruptBlocks, 'irqnumbers');
    interruptNumbers = eval(cell2mat(irqnum));
    
    pienum = get_param (hwInterruptBlocks, 'pienumbers');
    pieNumbers = eval(cell2mat(pienum));
    
    priort = get_param(hwInterruptBlocks,'irqpriorities');
    irqPriority = eval(cell2mat(priort)); 
    
    preemp = get_param(hwInterruptBlocks,'irqpreempts');
    irqPreempt = eval(cell2mat(preemp));
    
    for i=1:length(interruptNumbers)
%         if (schedPjtGenInfo.hasBaseRate && interruptNumbers(i)==1 && pieNumbers(i)==7)
%             linkPjtGenInfo.error = 1;
%             linkPjtGenInfo.errormsg = ['CPU interrupt 1, PIE interrupt 7 is not available for use ' ...
%                 'within the Hardware Interrupt block since it has been already used for ' ...
%                 'clocking the base rate of the model'];
%             return;
%         end
         
        % 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 PIE numbers - given by user
        linkPjtGenInfo.pienumbers{linkPjtGenInfo.numInterrupts} = pieNumbers(i);

        % Assign the interrupt priority - given by user
        linkPjtGenInfo.priority{linkPjtGenInfo.numInterrupts}   = irqPriority(i);
        
        % Assign the interrupt preempt - given by user
        if length(irqPreempt)>1
            linkPjtGenInfo.isrpreempt{linkPjtGenInfo.numInterrupts} = irqPreempt(i);
        else
            linkPjtGenInfo.isrpreempt{linkPjtGenInfo.numInterrupts} = irqPreempt(1);
        end        
    end
    
end

%[EOF] getBlockInfo_HwInterrupt_multilink_V850.m

Contact us