/**************************************************************************** * This file is part of the project AqHome. * AqHome (c) by 2023 Martin Preuss, all rights reserved. * * The license for this file can be found in the file COPYING which you * should have received along with this file. ****************************************************************************/ #ifndef AQH_HEXFILERECORD_H #define AQH_HEXFILERECORD_H #include #include #define AQH_HEXFILERECORD_TYPE_DATA 0x00 #define AQH_HEXFILERECORD_TYPE_EOF 0x01 #define AQH_HEXFILERECORD_TYPE_EXTSEG 0x02 #define AQH_HEXFILERECORD_TYPE_STARTSEGADDR 0x03 #define AQH_HEXFILERECORD_TYPE_EXTLINEARADDR 0x04 #define AQH_HEXFILERECORD_TYPE_STARTLINEARADDR 0x05 typedef struct AQH_HEXFILERECORD AQH_HEXFILERECORD; GWEN_LIST_FUNCTION_LIB_DEFS(AQH_HEXFILERECORD, AQH_HexfileRecord, AQHOME_API) AQHOME_API AQH_HEXFILERECORD *AQH_HexfileRecord_new(); AQHOME_API void AQH_HexfileRecord_free(AQH_HEXFILERECORD *hr); AQHOME_API uint8_t AQH_HexfileRecord_GetByteCount(const AQH_HEXFILERECORD *hr); AQHOME_API void AQH_HexfileRecord_SetByteCount(AQH_HEXFILERECORD *hr, uint8_t b); AQHOME_API uint16_t AQH_HexfileRecord_GetAddress(const AQH_HEXFILERECORD *hr); AQHOME_API void AQH_HexfileRecord_SetAddress(AQH_HEXFILERECORD *hr, uint16_t a); AQHOME_API uint8_t AQH_HexfileRecord_GetRecordType(const AQH_HEXFILERECORD *hr); AQHOME_API void AQH_HexfileRecord_SetRecordType(AQH_HEXFILERECORD *hr, uint8_t t); AQHOME_API const uint8_t *AQH_HexfileRecord_GetDataPointer(const AQH_HEXFILERECORD *hr); AQHOME_API void AQH_HexfileRecord_SetDataPointer(AQH_HEXFILERECORD *hr, uint8_t *ptr); AQHOME_API void AQH_HexfileRecord_SetData(AQH_HEXFILERECORD *hr, const uint8_t *ptr, uint8_t len); /** * Find the first record whose address is non-contiguous with the given record. * This can be used to reduce the number of data records. * This function stops at the next record whose address is non-continuous or whose type is not 00. * * @return next non-contiguous or non-data record (NULL if none) * @param hr record to start with (i.e. whose successor are checked for continuity) */ AQHOME_API const AQH_HEXFILERECORD *AQH_HexfileRecord_List_FindNonAdjacentDataRecord(const AQH_HEXFILERECORD *hr); #endif