function resp = regread(id,regname,represent,timeout)
%REGREAD Return the data value in the specified processor register.
% R = REGREAD(ID, REGNAME, REPRESENT, TIMEOUT) reads the data value in the
% register of the processor and returns it. REGNAME is the name of the
% source register. This register is read from the processor referenced by
% the ID object.
% The REPRESENT parameter specifies the interpretation of the register's
% data format. The following REPRESENT type options are supported by this
% '2scomp' - (default) 2's complement signed integer.
% 'binary' - Unsigned binary integer.
% 'ieee' - IEEE floating point (32- and 64-bit registers, only).
% For convenience, the return value R is converted to the MATLAB 'double'
% type regardless of the data representation to simplify direct
% manipulation in MATLAB.
% The TIMEOUT parameter defines how long to wait (in seconds) for the read
% to complete. If this period is exceeded, the routine returns immediately
% with a timeout error.
% R = REGREAD(ID,REGNAME, REPRESENT) Same as above, except the timeout
% value defaults to the value specified by the id object. Use
% GET(id, 'timeout') to examine the default supplied by the object.
% R = REGREAD(ID,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 processor. For
% example, the following lists some of the registers available in the
% MPC5554 processor:
% 'acc' - Accumulator A registers.
% 'sprg0' .. 'sprg7' - SPR registers.
% See also GHSMULTI/REGWRITE, GHSMULTI/READ, DEC2HEX.
% Copyright 2012 The MathWorks, Inc.