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_mpc5500_check(modelName, irqnumbers)
function [allowed errorid errorstr] = getBlockInfo_HwInterrupt_multilink_mpc5500_check(modelName, irqnumbers)
%GETBLOCKINFO_HWINTERRUPT Check interrupt numbers for Interrupt block.

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

errorid ='MULTILINK:HWInterrupt';
errorstr = '';
allowed  = true;

try
    targetInfo = getTgtPrefInfo(modelName);
catch igException %#ok<NASGU>
    %ignore all errors!
    targetInfo = '';
end
if (isempty(targetInfo))
    return;
end

%irqnumbers = str2num(get_param(blockhandle,'irqnumbers')); %#ok
device = targetInfo.chipInfo.deviceID;
switch(lower(device))
    case 'mpc5554', [allowed errorstr] = checkinrange(irqnumbers,1:308, [147:148,150:151,154,175,194:201,282], 'MPC5554: Interrupt numbers must be in range(1:308) excluding reserved interrupts.');
    case 'mpc5533', [allowed errorstr] = checkinrange(irqnumbers,1:209, 194:201, 'MPC5533: Interrupt numbers must be in range[1:209] excluding [194:201].');
    case 'mpc5534', [allowed errorstr] = checkinrange(irqnumbers,1:209, 194:201, 'MPC5534: Interrupt numbers must be in range[1:209] excluding [194:201].');
    case 'mpc5553', [allowed errorstr] = checkinrange(irqnumbers,1:209, [147:148,150:151,154,175,197:201], 'MPC5553: Interrupt numbers must be in range(1:209) excluding reserved interrupts.');
    case 'mpc5565', [allowed errorstr] = checkinrange(irqnumbers,1:511, [], 'MPC5565: Interrupt numbers must be in range(1:511)');
    case 'mpc5566', [allowed errorstr] = checkinrange(irqnumbers,1:511, [], 'MPC5566: Interrupt numbers must be in range(1:511)');
    case 'mpc5567', [allowed errorstr] = checkinrange(irqnumbers,1:511, [], 'MPC5567: Interrupt numbers must be in range(1:511)');
    otherwise,      
        [allowed errorstr] = checkinrange(irqnumbers,1:511, [], 'Interrupt numbers must be in range(1:511)');
        if (allowed)
            if isempty(targetInfo.chipInfo.codegenhookpoint) || (~strcmpi(targetInfo.chipInfo.codegenhookpoint,'mpc5500'))
                allowed = false;
                errorstr = 'This interrupt block is allowed only for MPC5500 family. Please check the Target Preference.';
            end
        end
        
end

%%
function [allowed errorstr] = checkinrange(irqnumbers, allowedrange, excludedrange, errorstr)
inrange = ismember(irqnumbers, allowedrange);
if (~all(inrange))
    allowed = false;
    return;
end
if (~isempty(excludedrange))
    exrange = ismember(irqnumbers, excludedrange);
    if (any(exrange))
        allowed = false;
        return;
    end
end
allowed = true;
%[EOF] getBlockInfo_HwInterrupt_multilink_mpc5500_check

Contact us