6
AVR350
1472D-AVR-01/08
9.7 validate_packet.c
if not timed out then
if no uart framing or overrun errors then
if first character in buffer is SOH then
if second character in buffer is the next packet number
then
if second character in buffer plus the third character in
buffer = 0xff
then
compute CRC on packet data
if CRC ok
then
increment packet number
packet = good
else
packet = bad
else
bad packet number checksum
else
duplicate packet number
else
if first character in buffer is EOT then
end of transmission
else
at least 1 byte had a framing or overrun error, packet is bad
else
timed-out without receiving all characters, packet is bad