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

    function [transports, mexfiles, interfaces] = ccsTarget_extmode_registration(cs)

%   Copyright 2008-2010 The MathWorks, Inc.


sysTargetFile = get_param(cs, 'SystemTargetFile');
showTfExtMode = isequal(sysTargetFile, linkfoundation.util.getSTFName('ert')) || ...
    isequal(sysTargetFile, linkfoundation.util.getSTFName('grt')) || ...
    (isequal(sysTargetFile, 'ert.tlc') && codertarget.target.isCoderTarget(cs));
c2000ChipSelected = local_HWDeviceTypeEq(cs.getProp('ProdHWDeviceType'), 'TI C2000');
c6000ChipSelected = local_HWDeviceTypeEq(cs.getProp('ProdHWDeviceType'), 'TI C6000');
if (showTfExtMode && c2000ChipSelected)
    transports = { 'CAN', 'serial', 'serialNoAck', 'tcpip'};
    mexfiles = { 'TIC2000ExternalModeOpen', 'ext_serial_win32_comm',  'ext_serial_win32_comm_no_acks', 'ext_comm'};
    interfaces = { 'Level2 - Open', 'Level1', 'Level1', 'Level1' };
    %Change the SetExtModeCAN.m in matlab\toolbox\target\supportpackages\tic2000\+codertarget\+registry
    % if order of the file is changed
    %Amit%
%     transports = { 'serial',  'CAN' };
%      mexfiles = {  'ext_serial_win32_comm', 'TIC2000ExternalModeOpen'};
%      interfaces = { 'Level1', 'Level2 - Open' };

elseif (showTfExtMode && c6000ChipSelected)
    transports = {'tcpip'}; % Index 0 in the template makefiles
    mexfiles = {'ext_comm'}; % MEX-File for 'tcpip'
    interfaces = {'Level1'};
else
    transports = {'tcpip'}; 
    mexfiles = {'ext_comm'}; 
    interfaces = {'Level1'};
end

%--------------------------------------------------------------------------
%Using local function in absence of code generation API.
%Replace when code generation API is available
function result = local_HWDeviceType(type)

tr = RTW.TargetRegistry.getInstance;
dev = tr.getHardwareConfigs(type);
result = [dev.VendorName '->' dev.TypeName];

%--------------------------------------------------------------------------
function result = local_HWDeviceTypeEq(type1,type2)

dev1 = local_HWDeviceType(type1);
dev2 = local_HWDeviceType(type2);
result = strcmp(dev1, dev2);