Skip to main content
Open topic with navigation CAPL Functions » MOST » OnMostReg

OnMostReg

Valid for: CANoe DE

Function Syntax

OnMostReg();

Description

OnMostReg() is called in response to read or write requests to registers of a MOST network interface chip. The following functions are available for evaluating the event:
  • long mostRegChip()
    • Returns the identifier of the chip whose registers are transported with this event (see mostReadReg)
  • long mostRegOffset()
    • Returns the start address of the register.
  • long mostRegDataLen()
    • Returns the number of bytes transported with this event (maximum of 16).
  • void mostRegGetData(byte buffer[], long buffersize)
    • The register values may be copied to a byte buffer with the function mostRegGetData(). It must be assured that the buffer has the specified size (buffersize). A maximum of 16 bytes are transported with the MostReg event.
  • long mostRegGetByteAbs(long chip, long adr)
  • long mostRegGetWordAbs(long chip, long adr)
    • Returns the contents of the register ‘adr’ in the chip ‘chip’. If the MostReg event does not contain this register kMostParameterOutOfRange = -9 is returned.
For further information on this event see Supplemental Information on Event Procedures for MOST Controller Events.

Parameters

Return Values

Example

OnMostReg()
{
  byte regData[16];
  long i, offset;
  // get register contents
  mostRegGetData(regData, 16);
  // get offset
  offset = mostRegOffset();
  // output register contents to Write Window
  write("OnMostReg() called for chip %d on channel %d", mostRegChip(), mostEventChannel());
  write("Map   Value");
  for(i = 0; i < mostRegDataLen(); i++)
  {
    write("%04X   %02X", offset + i, regData[i]);
  }
}
Output in the Write Window
OnMostReg() called for chip 1 on channel 1
Map   Value
0080  E2
0081  42
0082  16
...
mostReadRegmostWriteReg