⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ccsdsp.m

📁 这是一个关于MATLAB的函数
💻 M
字号:
function cc = ccsdsp(varargin)
%CCSDSP create a link to the Texas Instruments Code Composer(tm) IDE.
%   CC = CCSDSP('PropertyName',PropertyValue,...) returns an object
%   which is used to communicate with a DSP target processor.  This 
%   handle can be used to access memory and control the execution of 
%   the target DSP processor.  All communication is handled by the 
%   Code Composer Studio(tm) IDE application.  The resulting object
%   CC refers to a single DSP processor.  Thus, multiprocessor system
%   will require a separate handle to refer to different processors.
%   
%   All passed parameters are interpreted as object property 
%   definitions.  Each property definition consists of a property 
%   name followed by the desired property value.  Althougth any CC
%   object property can be defined during this initialization, there
%   are several important properties that MUST be provided during the
%   initial call.  Therefore, these must be properly delinated when
%   the object is created.  After the object is built, these values can 
%   be retreived with GET, but never modified. 
%
%   'boardnum' - The index of the desired DSP board.  The resulting
%   object CC refers to a DSP processor on this board.  Use the
%   CCSBOARDINFO utility to determine the number for the desired
%   DSP board.  If the user's Code Composer is defined to support 
%   only a singled board, this property definion can be skipped. 
%   If the property is not passed by the user, the object will
%   default to boardnum 0 (zero-based).  
%
%   'procnum' - The index of the desired DSP processor on the DSP board 
%   selected with the 'boardnum' property.   Use the CCSBOARDINFO 
%   utility to determine the number for the desired DSP processor.  
%   If the user's Code Composer is defined to support only a singled 
%   processor on the board, this property definion can be skipped.  
%   If the property is not passed by the user, the object will default 
%   to procnum 0 (zero-based).  
%
%   Example: 
%   >target = ccsdsp('boardnum',1,'procnum',0); will return a handle
%   a handle to the first DSP processor on the second DSP board.
%
%   CCSDSP without any passed arguments will construct the object with the 
%   default property values.
%
%   See also CCSBOARDINFO, RTDX, GET, SET.

%   Copyright 2001-2002 The MathWorks, Inc.
%   $Revision: 1.40 $ $Date: 2002/06/14 12:47:48 $


% Construct the actual object instance    
cc = ccs.ccsdsp;
cc = initialize_object(cc, nargin, varargin);
% h = initialize_activex(h);

% Constructor
try 
    ccsmexswitchyard([0,cc.boardnum,cc.procnum,0,0]);
catch
   if strfind(lasterr,'CCSDSP:Class not registered'),
       error('Proper installation of Code Composer Studio(tm) is required');
   end
   error(lasterr);
end
cc.rtdx    = rtdx([cc.boardnum,cc.procnum]);
% cc.typedef = typedef([cc.boardnum,cc.procnum]);

cc.cd(pwd);
cc.apiversion = ccsmexswitchyard([37,cc.boardnum,cc.procnum,0,0]);
cc.ccsappexe = ccsmexswitchyard([63,cc.boardnum,cc.procnum,0,0]);

ccinfo = info(cc);
cc.subfamily = ccinfo.subfamily;

% Warning for any API version > 1.0
if (cc.apiversion(1) > 1) | ( (cc.apiversion(1) == 1) & (cc.apiversion(2) > 2))
    warning(': This version of the "Developer''s Kit for TI DSP" predates your version of Code Composer Studio(tm) IDE.');
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function cc = initialize_object(cc, nargs, args)
%
% Defaults
cc.boardnum = 0;    % Important info for MEX-file
cc.procnum  = 0;    % Important info for MEX-file
cc.timeout = 10.0;  % Default = 10 seconds
cc.page = 0;
cc.eventwaitms = 20;  % Default = 20 msec

% Process constructors input arguments if any
if nargs <= 1
    return;      % Use defualts
else
    
    if(mod(nargs,2)~=0)
        error(['CCSDSP constructor requires property and value ', ...
                'arguments to be specified in pairs.']);
    end
    
    % Get property / value pairs from argument list
    for i = 1:2:nargs
        
        prop = lower(args{i});
        val  = args{i+1};
        
        % Argument checking
        switch prop
            
        case 'boardnum'
            if ~isnumeric(val), error('Property ''boardnum'' must be numeric.'); end
            if val<0, error('''boardnum'' must be a positive integer.'); end
            cc.boardnum = double(val);
            
        case 'procnum'
            if ~isnumeric(val), error('Property ''procnum'' must be numeric.'); end
            if val<0, error('''procnum'' must be a positive integer.'); end
            cc.procnum = double(val);
            
        case 'timeout'
            if ~isnumeric(val), error('Property ''timeout'' must be numeric.'); end
            if val<0, error('''timeout'' must be a positive integer.'); end
            cc.timeout = double(val);
            
        case 'eventwaitms'
            if ~isnumeric(val), error('Property ''timeout'' must be numeric.'); end
            if val<0, error('''eventwaitms'' must be a positive integer.'); end
            cc.eventwaitms = double(val);
            
        case 'page'
            if ~isnumeric(val), error('Property ''page'' must be numeric.'); end
            if val<0, error('''page'' must be a positive integer.'); end
            cc.page = double(val);
            
        case 'ccsappexe'
            if ~char(val), error('Property ''ccsappexe'' must be a char array.'); end
            if exist(val,'file') ~= 2, error(['Executable: ''' val '''provided for Code Composer does not exist']); end
            cc.ccsappexe = val;   

        otherwise
            error('Unknown property specified for CCSDSP object.')
        end
    end
end

% [EOF] ccsdsp.m

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -