mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Get rid of occsional fails during ETS programming (#200)
- happens just with large applications - occured mainly on SAMD platform - new crc16ccitt algorithm without additional buffer - reorder groupObjTable in memory for less fragmentation Co-authored-by: Waldemar Porscha <waldemar.porscha@sap.com>
This commit is contained in:
parent
e12a074e07
commit
d43703f7bd
@ -23,9 +23,9 @@ BauSystemBDevice::BauSystemBDevice(Platform& platform) :
|
||||
_transLayer.groupAddressTable(_addrTable);
|
||||
|
||||
_memory.addSaveRestore(&_deviceObj);
|
||||
_memory.addSaveRestore(&_groupObjTable); // changed order for better memory management
|
||||
_memory.addSaveRestore(&_addrTable);
|
||||
_memory.addSaveRestore(&_assocTable);
|
||||
_memory.addSaveRestore(&_groupObjTable);
|
||||
#ifdef USE_DATASECURE
|
||||
_memory.addSaveRestore(&_secIfObj);
|
||||
#endif
|
||||
|
@ -124,21 +124,19 @@ uint64_t sixBytesToUInt64(uint8_t* data)
|
||||
|
||||
uint16_t crc16Ccitt(uint8_t* input, uint16_t length)
|
||||
{
|
||||
uint32_t polynom = 0x1021;
|
||||
uint8_t padded[length+2];
|
||||
uint32_t polynom = 0x1021;
|
||||
|
||||
memcpy(padded, input, length);
|
||||
memset(padded+length, 0x00, 2);
|
||||
|
||||
uint32_t result = 0xffff;
|
||||
for (uint32_t i = 0; i < 8 * (uint32_t)sizeof(padded); i++) {
|
||||
result <<= 1;
|
||||
uint32_t nextBit = (padded[i / 8] >> (7 - (i % 8))) & 0x1;
|
||||
result |= nextBit;
|
||||
if ((result & 0x10000) != 0)
|
||||
result ^= polynom;
|
||||
}
|
||||
return result & 0xffff;
|
||||
uint32_t result = 0xffff;
|
||||
for (uint32_t i = 0; i < 8 * ((uint32_t)length + 2); i++)
|
||||
{
|
||||
result <<= 1;
|
||||
uint32_t nextBit;
|
||||
nextBit = ((i / 8) < length) ? ((input[i / 8] >> (7 - (i % 8))) & 0x1) : 0;
|
||||
result |= nextBit;
|
||||
if ((result & 0x10000) != 0)
|
||||
result ^= polynom;
|
||||
}
|
||||
return result & 0xffff;
|
||||
}
|
||||
|
||||
uint16_t crc16Dnp(uint8_t* input, uint16_t length)
|
||||
|
Loading…
Reference in New Issue
Block a user