Further additions to tidemod to differentiate between ro and rw tags and check crc validity.

This commit is contained in:
d18c7db 2009-07-22 11:39:39 +00:00
commit 0c2ed92d87
3 changed files with 98 additions and 23 deletions

11
common/crc16.c Normal file
View file

@ -0,0 +1,11 @@
unsigned short update_crc16( WORD crc, BYTE c ) {
WORD i, v, tcrc = 0;
v = (crc ^ c) & 0xff;
for (i = 0; i < 8; i++) {
tcrc = ( (tcrc ^ v) & 1 ) ? ( tcrc >> 1 ) ^ 0x8408 : tcrc >> 1;
v >>= 1;
}
return (crc >> 8) ^ tcrc;
}