Example 30. General Purpose CRC Check Routine

/**************************************************************/ /* General purpose CRC check routine. Given the address of a */ /* linker-generated CRC_TABLE data structure, verify the CRC */ /* of all object components that are designated with the */ /* corresponding LCF crc_table() operator. */ /**************************************************************/ #include <crc_tbl.h> /*********************************************************/ /* MY_CHECK_CRC() - returns 1 if CRCs match, 0 otherwise */ /*********************************************************/ unsigned int my_check_CRC(CRC_TABLE *tp) { int i; for (i = 0; i < tp-> num_recs; i++) { CRC_RECORD crc_rec = tp->recs[i]; /**************************************************/ /* COMPUTE CRC OF DATA STARTING AT crc_rec.addr */ /* FOR crc_rec.size UNITS. USE */ /* crc_rec.crc_alg_ID to select algorithm. */ /* COMPARE COMPUTED VALUE TO crc_rec.crc_value. */ /**************************************************/ } if all CRCs match, return 1; else return 0; }