on key '2'
{
// Example from AUTOSAR_PRS_E2EProtocol.pdf
//
// E2E Protocol Specification
// AUTOSAR FO R20-11
// Table 6.28: E2E Profile 2 example protect result
long result;
dword calculatedCRC;
byte seq;
dword dataLength;
long res;
byte data[8] = {
// CRC| Payload
0x1B ,0x01,0x00,0x00,0x00,0x00,0x00,0x00
};
byte dataIDs[16] = { 0x01, 0x02, 0x03, 0x04,0x05, 0x06, 0x07, 0x08,0x09, 0x0a, 0x0b, 0x0c,0x0d, 0x0e, 0x0f, 0x10 }; dataLength = elcount(data);
seq = data[1] & 0x0F;
res = Crc_CalculateCRC8H2F( data , dataLength, 1 , dataLength-1, 0xFF, 1, calculatedCRC );
res = Crc_CalculateCRC8H2F( dataIDs, 16 , seq, 1, calculatedCRC, 0, calculatedCRC );
write( "calculatedCRC=0x%X (expect0x1B)", calculatedCRC );
}