The FEC code always sends a multiple of four bytes, padding by two
bytes for even inputs and one byte for odd. But the preparation step
was using the wrong value for the length, so the output was getting
mangled.
Signed-off-by: Keith Packard <keithp@keithp.com>
extra[i++] = (uint8_t) crc;
/* Append FEC -- 1 byte if odd, two bytes if even */
- num_fec = 2 - (i & 1);
+ num_fec = 2 - (len & 1);
while (num_fec--)
extra[i++] = AO_FEC_TRELLIS_TERMINATOR;
return i;