diff options
author | Keith Packard <keithp@keithp.com> | 2012-06-27 17:17:44 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-06-27 17:17:44 -0700 |
commit | 84f9a525c64491afa9b7a565e3c10a4cee106e14 (patch) | |
tree | 33f5fc926fbe26f9f90f7475d1bb1d590d9edf07 /src/test/ao_fec_test.c | |
parent | b0b7f5da2d29716959c6793d744e47a3d435c247 (diff) |
altos: Clean up radio CRC handling
Make the FEC code just set the CRC_OK bit like the cc1111 radio does;
eliminates a bunch of weird conventions across the FEC API.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/test/ao_fec_test.c')
-rw-r--r-- | src/test/ao_fec_test.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/test/ao_fec_test.c b/src/test/ao_fec_test.c index 8ce532c8..671fcafc 100644 --- a/src/test/ao_fec_test.c +++ b/src/test/ao_fec_test.c @@ -268,18 +268,17 @@ int ao_real_packet(void) { uint8_t decode[64]; - uint8_t decode_len; - int ok = 0; + int ok; - decode_len = ao_fec_decode(real_packet, 576, decode, 34, NULL); + ok = ao_fec_decode(real_packet, 576, decode, 34, NULL); - if (decode[32] == 0 && decode[33] == 0) { + if (ok && decode[33] == AO_FEC_DECODE_CRC_OK) { printf ("match\n"); - ao_fec_dump_bytes(decode, decode_len, "Decode"); - ok = 1; + ao_fec_dump_bytes(decode, 34, "Decode"); } else { printf ("actual packet crc error\n"); + ok = 0; } return ok; } @@ -302,7 +301,7 @@ main(int argc, char **argv) int receive_len, receive_errors; uint8_t decode[DECODE_LEN(sizeof(original))]; - int decode_len; + int decode_ok; int errors = 0; int error; @@ -327,17 +326,17 @@ main(int argc, char **argv) receive_len = transmit_len; /* Decode it */ - decode_len = ao_fec_decode(receive, receive_len, decode, original_len + 2, NULL); + decode_ok = ao_fec_decode(receive, receive_len, decode, original_len + 2, NULL); /* Check to see if we received the right data */ error = 0; - if (decode_len < original_len + 2) { - printf ("len mis-match\n"); + if (!decode_ok) { + printf ("decode failed\n"); error++; } - if (decode[original_len] != 0 || decode[original_len+1] != 0) { + if (decode[original_len +1] != AO_FEC_DECODE_CRC_OK) { printf ("crc mis-match\n"); error++; } |