📄 regread.m
字号:
function resp = regread(cc,regname,represent,timeout)
%REGREAD Returns the data value in the specified DSP register.
% R = REGREAD(CC, REGNAME, REPRESENT, TIMEOUT) reads the data value
% in the register of the DSP processor and returns it.
% REGNAME is the name of the source register. This register
% is read from the DSP processor referenced by the CC object.
% The REPRESENT parameter defines the interpretation of the
% register's data format. For convenience, the return value R is
% converted to the MATLAB 'double' type regardless of the data
% representation to simplify direct manipulation in MATLAB
%
% REPRESENT - Representation of data in source register
% '2scomp' - (default) 2's complement signed integer
% 'binary' - Unsigned binary integer
% 'ieee' - IEEE floating point (32 and 64 bit registers, only)
%
% TIMEOUT defines an upper limit (in seconds) on the time this method
% will wait for completion of the read. If this period is exceeded, this
% method will immediately return with a timeout error.
%
% R = REGREAD(CC,REGNAME, REPRESENT) Same as above, except the timeout
% value defaults to the value provided by the CC object. Use
% CC.GET('timeout') to examine the default supplied by the object.
%
% R = REGREAD(CC,REGNAME) Same as above, except the data type defaults to
% '2scomp' and this routine returns a signed integer interpretation of the
% value stored in REGNAME.
%
% The supported values for REGNAME will depend on the DSP processr. For
% example, the following registers are available on the TMS320C6xxx
% family of processors:
% 'A0' .. 'An' - Accumulator A registers
% 'B0' .. 'Bn' - Accumulator B registers
% 'PC','ISTP',IFR,'IER','IRP','NRP','AMR','CSR' - Other 32 bit registers
% 'A1:A0' .. 'B15:B14 ' - 64 bit Register pairs
%
% Note, memory-mapped registers can only be accesssed with direct memory
% reads. For the TMS320C5xxx family, this means the only register that is
% available using this method is the 'PC' register.
%
% See also REGWRITE, READ, DEC2HEX.
% Copyright 2001-2002 The MathWorks, Inc.
% $Revision: 1.19 $ $Date: 2002/06/12 15:30:33 $
error(nargchk(2,4,nargin));
if ~ishandle(cc),
error('First Parameter must be a CCSDSP Handle.');
end
% Parse timeout
if( nargin >= 4) & (~isempty(timeout)),
if ~isnumeric(timeout) | length(timeout) ~= 1,
error('TIMEOUT parameter must be a single numeric value.');
end
dtimeout = double(timeout);
else
dtimeout = double(get(cc,'timeout'));
end
if( dtimeout < 0)
error(['Negative TIMEOUT value "' num2str(dtimeout) '" not permitted.']);
end
if cc.subfamily==84, % C54x Family
if strcmpi(regname,'PC')
if nargin == 2, resp=ccsmexswitchyard([25 cc.boardnum cc.procnum dtimeout cc.eventwaitms],regname);
elseif nargin >=3, resp=ccsmexswitchyard([25 cc.boardnum cc.procnum dtimeout cc.eventwaitms],regname,represent);
end
else
if nargin == 2, resp = mmregread(cc,regname,'2scomp',cc.timeout);
elseif nargin >=3, resp = mmregread(cc,regname,represent,dtimeout);
end
end
else % other processors
if nargin == 2, resp=ccsmexswitchyard([25 cc.boardnum cc.procnum dtimeout cc.eventwaitms],regname);
elseif nargin >=3, resp=ccsmexswitchyard([25 cc.boardnum cc.procnum dtimeout cc.eventwaitms],regname,represent);
end
end
% [EOF] regread.m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -