gusucode.com > target工具箱matlab源码程序 > target/foundation/utils/tf_constructProcRegFileNames.m

    function [procRegPath, pitFileName] = tf_constructProcRegFileNames(tag)
%CONSTRUCTPROCREGFILENAMES constructs and returns the name of Processor
% Index Table (PIT) file for targets.

%   Copyright 2008-2009 The MathWorks, Inc.

procRegPath = {};
pitFileName = {};
% for now, only processor extensions can register custom processors
extensions = {'processor'}; 
for i=1:length(extensions)
    [procRegPath, pitFileName] = findExtensions (tag, procRegPath, ...
        pitFileName, extensions{i});
end


% -------------------------------------------------------------------------
function [procRegPathList, pitFileNameList] = findExtensions (tag, ...
    procRegPathList, pitFileNameList, extension)

path = fullfile(matlabroot, 'toolbox', 'target', 'extensions', extension);
pitFileName = 'procidxtable.mat';
dirList = dir(path);
for i=1:length(dirList)
    if dirList(i).isdir
        procRegPath = fullfile(path, dirList(i).name, 'registry');
        if exist(fullfile(procRegPath, pitFileName), 'file')
            reg = get_tag_for_dir(procRegPath);
            if ismember(tag,reg)
                procRegPathList{end+1} = procRegPath; %#ok<AGROW>
                pitFileNameList{end+1} = pitFileName; %#ok<AGROW>
            end
        end
    end
end

% -------------------------------------------------------------------------
function tags = get_tag_for_dir(dir)

if any(strfind(dir, 'tic6000'))
    tags = {'ccslinktgtpref','ccslinktgtpref_ccsv4','ccslinktgtpref_ccsv5'};
else
    tags = {};
end