CRC functions should be split out into separate functions rather than inlined here.  You can keep them in this file if you want.

Have you also looked in pios_crc.c to see if the crc16 and crc8 implemented there are actually the right ones for your purposes?