Forum Discussion
Altera_Forum
Honored Contributor
10 years agoPof file format:
bytes 0 to 3: "POF\0"
bytes 4 to 7: unknown
bytes 8 to 11: number of 'packets'.
Each 'packet' starts with a header:
bytes 0 and 1: packet type
bytes 2 to 5: packet length
bytes 6 onwards: data Packet type 0x11 has a 12 byte header and then the raw data for the entire EPCQ. Packet type 0x1a contains the string "mPage_0 00000000 0226A5F8;" the last number seems to be the data size in bits. Don't know what packet 0x23 contains. The last packet is a always type 8 and contains a crc of the file upto, but excluding, the crc data. The crc is CRC-CCITT - and can be calculated by: static uint32_t
pof_calc_crc(const uint8_t *dp, const uint8_t *end)
{
uint32_t crc;
uint32_t t;
crc = 0xffff;
while (dp < end) {
crc ^= *dp++;
t = (crc ^ crc << 4) & 0xff;
crc = crc >> 8 ^ t << 8 ^ t << 3 ^ t >> 4;
}
return crc ^ 0xffff;
}
Remember to bit-reverse the data as you write it to the epcq.