aqhome: make some parameters const.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
GWEN_LIST_FUNCTIONS(AQH_FLASHRECORD, AQH_FlashRecord)
|
GWEN_LIST_FUNCTIONS(AQH_FLASHRECORD, AQH_FlashRecord)
|
||||||
|
|
||||||
|
|
||||||
AQH_HEXFILERECORD *_sampleAdjacentHexfileRecords(AQH_FLASHRECORD *fr, AQH_HEXFILERECORD *hrStart);
|
const AQH_HEXFILERECORD *_sampleAdjacentHexfileRecords(AQH_FLASHRECORD *fr, const AQH_HEXFILERECORD *hrStart);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -124,10 +124,10 @@ void AQH_FlashRecord_CopyAndSetData(AQH_FLASHRECORD *fr, uint32_t dataLength, co
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(AQH_HEXFILERECORD_LIST *hexFileRecordList)
|
AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(const AQH_HEXFILERECORD_LIST *hexFileRecordList)
|
||||||
{
|
{
|
||||||
AQH_FLASHRECORD_LIST *flashRecordList;
|
AQH_FLASHRECORD_LIST *flashRecordList;
|
||||||
AQH_HEXFILERECORD *hr;
|
const AQH_HEXFILERECORD *hr;
|
||||||
uint32_t currentOffset=0;
|
uint32_t currentOffset=0;
|
||||||
|
|
||||||
flashRecordList=AQH_FlashRecord_List_new();
|
flashRecordList=AQH_FlashRecord_List_new();
|
||||||
@@ -154,7 +154,18 @@ AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(AQH_HEXFILERECORD_LIST
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ptr=AQH_HexfileRecord_GetDataPointer(hr);
|
ptr=AQH_HexfileRecord_GetDataPointer(hr);
|
||||||
currentOffset=((ptr[0]<<8)+ptr[1])<<4;
|
currentOffset=((ptr[1]<<8)+ptr[0])<<4;
|
||||||
|
}
|
||||||
|
else if (t==AQH_HEXFILERECORD_TYPE_EXTLINEARADDR) {
|
||||||
|
const uint8_t *ptr;
|
||||||
|
|
||||||
|
if (AQH_HexfileRecord_GetByteCount(hr)<2) {
|
||||||
|
DBG_ERROR(AQH_LOGDOMAIN, "Invalid EXTLINEARADDR record (04) in file (too few data bytes)");
|
||||||
|
AQH_FlashRecord_List_free(flashRecordList);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ptr=AQH_HexfileRecord_GetDataPointer(hr);
|
||||||
|
currentOffset=((ptr[1]<<8)+ptr[0])<<16;
|
||||||
}
|
}
|
||||||
else if (t==AQH_HEXFILERECORD_TYPE_EOF) {
|
else if (t==AQH_HEXFILERECORD_TYPE_EOF) {
|
||||||
break;
|
break;
|
||||||
@@ -173,10 +184,10 @@ AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(AQH_HEXFILERECORD_LIST
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQH_HEXFILERECORD *_sampleAdjacentHexfileRecords(AQH_FLASHRECORD *fr, AQH_HEXFILERECORD *hrStart)
|
const AQH_HEXFILERECORD *_sampleAdjacentHexfileRecords(AQH_FLASHRECORD *fr, const AQH_HEXFILERECORD *hrStart)
|
||||||
{
|
{
|
||||||
AQH_HEXFILERECORD *hrNext;
|
const AQH_HEXFILERECORD *hrNext;
|
||||||
AQH_HEXFILERECORD *hr;
|
const AQH_HEXFILERECORD *hr;
|
||||||
uint32_t len=0;
|
uint32_t len=0;
|
||||||
|
|
||||||
hrNext=AQH_HexfileRecord_List_FindNonAdjacentDataRecord(hrStart);
|
hrNext=AQH_HexfileRecord_List_FindNonAdjacentDataRecord(hrStart);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ GWEN_LIST_FUNCTION_LIB_DEFS(AQH_FLASHRECORD, AQH_FlashRecord, AQHOME_API)
|
|||||||
|
|
||||||
|
|
||||||
AQHOME_API AQH_FLASHRECORD *AQH_FlashRecord_new();
|
AQHOME_API AQH_FLASHRECORD *AQH_FlashRecord_new();
|
||||||
AQHOME_API AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(AQH_HEXFILERECORD_LIST *hexFileRecordList);
|
AQHOME_API AQH_FLASHRECORD_LIST *AQH_FlashRecord_fromHexfileRecords(const AQH_HEXFILERECORD_LIST *hexFileRecordList);
|
||||||
|
|
||||||
AQHOME_API void AQH_FlashRecord_free(AQH_FLASHRECORD *fr);
|
AQHOME_API void AQH_FlashRecord_free(AQH_FLASHRECORD *fr);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
static const char *_readRecord(AQH_HEXFILERECORD *hr, const char *s);
|
static const char *_readRecord(AQH_HEXFILERECORD *hr, const char *s);
|
||||||
static void _writeRecord(AQH_HEXFILERECORD *hr, GWEN_BUFFER *buffer);
|
static void _writeRecord(AQH_HEXFILERECORD *hr, GWEN_BUFFER *buffer);
|
||||||
static int _sumValuesForChecksum(const AQH_HEXFILERECORD *hr);
|
static int _sumValuesForChecksum(const AQH_HEXFILERECORD *hr);
|
||||||
static int _readWord(const char *s);
|
static int _readWord(const char *s); /* big endian */
|
||||||
static int _readByte(const char *s);
|
static int _readByte(const char *s);
|
||||||
static int _readNibble(const char *s);
|
static int _readNibble(const char *s);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
#include <gwenhywfar/buffer.h>
|
#include <gwenhywfar/buffer.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reader and writer for INTEL HEX files (see https://en.wikipedia.org/wiki/Intel_HEX).
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
typedef struct AQH_HEXFILE AQH_HEXFILE;
|
typedef struct AQH_HEXFILE AQH_HEXFILE;
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ void AQH_HexfileRecord_SetData(AQH_HEXFILERECORD *hr, const uint8_t *ptr, uint8_
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQH_HEXFILERECORD *AQH_HexfileRecord_List_FindNonAdjacentDataRecord(AQH_HEXFILERECORD *hr)
|
const AQH_HEXFILERECORD *AQH_HexfileRecord_List_FindNonAdjacentDataRecord(const AQH_HEXFILERECORD *hr)
|
||||||
{
|
{
|
||||||
uint16_t expectedAddr;
|
uint16_t expectedAddr;
|
||||||
int cnt=0;
|
int cnt=0;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ AQHOME_API void AQH_HexfileRecord_SetData(AQH_HEXFILERECORD *hr, const uint8_t *
|
|||||||
* @return next non-contiguous or non-data record (NULL if none)
|
* @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)
|
* @param hr record to start with (i.e. whose successor are checked for continuity)
|
||||||
*/
|
*/
|
||||||
AQHOME_API AQH_HEXFILERECORD *AQH_HexfileRecord_List_FindNonAdjacentDataRecord(AQH_HEXFILERECORD *hr);
|
AQHOME_API const AQH_HEXFILERECORD *AQH_HexfileRecord_List_FindNonAdjacentDataRecord(const AQH_HEXFILERECORD *hr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user