Logo Search packages:      
Sourcecode: s51dude version File versions

int New_IHexRecord ( int  type,
uint16_t  address,
uint8_t  data[],
int  dataLen,
IHexRecord ihexRecord 

Sets all of the record fields of an Intel HEX record structure.

type The Intel HEX record type (integer value of 0 through 5).
address The 16-bit address of the data.
data The 8-bit array of data.
dataLen The size of the 8-bit data array.
ihexRecord A pointer to the target Intel HEX record structure where these fields will be set.
IHEX_OK on success, otherwise one of the IHEX_ERROR_ error codes.
Return values:
IHEX_OK on success.
IHEX_ERROR_INVALID_ARGUMENTS if ihexRecord does not point to a valid IHexRecord structure, or if the length of the 8-bit data array is out of range (less than zero or greater than the maximum data length allowed by record specifications, see IHexRecord.data).

Definition at line 16 of file ihex.c.

References _IHexRecord::address, _IHexRecord::checksum, _IHexRecord::data, _IHexRecord::dataLen, IHEX_ERROR_INVALID_ARGUMENTS, IHEX_OK, and _IHexRecord::type.

      /* Data length size check, assertion of ihexRecord */
      if (dataLen < 0 || dataLen > IHEX_MAX_DATA_LEN/2 || ihexRecord == NULL)
      ihexRecord->type = type;
      ihexRecord->address = address;
      memcpy(ihexRecord->data, data, dataLen);
      ihexRecord->dataLen = dataLen;
      ihexRecord->checksum = Checksum_IHexRecord(*ihexRecord);
      return IHEX_OK;         

Generated by  Doxygen 1.6.0   Back to index