Highlights from
Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

image thumbnail

Embedded Coder Support Package for Green Hills MULTI IDE (R2012b)

by

 

Embedded Coder integration for creating models that run directly in Green Hills MULTI IDE

write(id,address,data,timeout)
function write(id,address,data,timeout)
%WRITE Puts a block of data values into processor memory.
%  WRITE(id,ADDRESS,DATA,TIMEOUT) writes a block of DATA values into the 
%  memory space of the processor referenced by the id object.  The write 
%  begins from the memory location defined by the ADDRESS parameter.  The 
%  WRITE method can accept DATA as a scalar, vector, matrix or 
%  multi-dimensional array.  DATA is written in column-major order.
%
%  ADDRESS is a decimal or hexadecimal representation of a memory address in
%  the target processor.  In all cases, the full address consist of two 
%  parts: the offset and the memory page.  Many processors have only a 
%  single memory page, in which case the page portion of the full address 
%  should always be 0.  The page value can be explicitly defined using a 
%  numeric vector representation of the address.  Alternatively, the id 
%  object has a default page value that is applied if the page value is not 
%  explicitly incorporated into the passed address parameter.  In
%  processors with only a single page, by setting the id object page value
%  to zero it is possible to specify all addresses using the abbreviated 
%  (implied page) format.  The address parameter can be specified in two 
%  ways, first as a numerical value which is a decimal representation of 
%  the processor address.  Alternatively, a string is interpreted as a 
%  hexadecimal representation of the address offset.  (See HEX2DEC, which is
%  used for the conversion to a decimal value).  When the address is defined
%  by a string, the page is always derived from the id object.  Thus, there
%  is no method of explicitly defining the page when the address parameter 
%  is passed as a hexadecimal string.
%
%  Examples of the address parameter:
%     '1F'  Hex, Offset is decimal 31, with the page taken from id.page.
%       10  Decimal, Offset is decimal 10, with the page taken from id.page.
%   [18,1]  Decimal with page, Offset is decimal 18, with page equal to 1.
%
%  DATA is a scalar, vector, or array of values to write to processor
%  memory. The WRITE routine supports the following numeric data types:
%
%     double  IEEE Double-precision floating point
%     single  IEEE Single-precision floating point
%      uint8  8-bit unsigned binary integer
%     uint16  16-bit unsigned binary integer
%     uint32  32-bit unsigned binary integer
%       int8  8-bit signed 2's complement integer
%      int16  16-bit signed 2's complement integer
%      int32  32-bit signed 2's complement integer
%
%  The TIMEOUT parameter defines how long to wait (in seconds) for  
%  completion of write.  If this period is exceeded, the routine returns 
%  immediately with a timeout error.  In general the action (write) still 
%  occurs, but the timeout value  gave insufficient time to verify the 
%  completion of the action.
%
%  WRITE(id,ADDRESS,DATA) 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.
%  
%  This routine does not coerce data type alignment.  Certain combinations
%  of ADDRESS and DATA are difficult for the processor to use.  To ensure 
%  seamless operation, best practice is to use the ADDRESS method to extract
%  address values that are compatible with the alignment requirements of the
%  processor.
%
%  Examples
%   1. Write array of 100 16-bit integers and at location of target symbol 
%      'data'. 
%      write(id,address(id,'data'),int16([1:100]));
%   2. Write a single-precision IEEE floating point value (32-bits) at 
%      address 0xFF00.
%      write(id,'FF00',single(23.5));
%   3. Write a 2-D array of integers in row-major (C-style) format at 
%      address 65280.
%      mlarr = int32([1:10; 101:110])
%      write(id,65280,mlarr');
%
%  See also GHSMULTI/READ, GHSMULTI/ADDRESS, HEX2DEC, INT32.

%   Copyright 2012 The MathWorks, Inc.

Contact us