forked from haraldwolff/avr-fw-modules
26 lines
312 B
C
26 lines
312 B
C
|
#include <hwo/chksum.h>
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
|
||
|
void chksum(avrChksum* chksum,void* block,uint8_t len)
|
||
|
{
|
||
|
uint8_t p;
|
||
|
uint8_t *b = (uint8_t*)block;
|
||
|
|
||
|
if (chksum == NULL)
|
||
|
return;
|
||
|
|
||
|
chksum->combined = 0x00;
|
||
|
|
||
|
for (p=0;p<len;p++)
|
||
|
{
|
||
|
chksum->sum8 += b[p];
|
||
|
chksum->xor8 ^= b[p];
|
||
|
};
|
||
|
};
|
||
|
|
||
|
|
||
|
|