diff options
author | Josh Allen <axlecrusher@gmail.com> | 2017-02-12 10:57:57 -0500 |
---|---|---|
committer | Josh Allen <axlecrusher@gmail.com> | 2017-02-12 10:57:57 -0500 |
commit | ac556ccbb2ecd419773b3ad941f7aea78a191381 (patch) | |
tree | ef7abf8dcb54e36b630d56957b409d93248406bb /tools/ootx_decode/ootx_decode.c | |
parent | b79a1766aaf207943772b2565f674853e2be8314 (diff) | |
download | libsurvive-ac556ccbb2ecd419773b3ad941f7aea78a191381.tar.gz libsurvive-ac556ccbb2ecd419773b3ad941f7aea78a191381.tar.bz2 |
clean up code. move some of the debugging code out into the test harness
Diffstat (limited to 'tools/ootx_decode/ootx_decode.c')
-rw-r--r-- | tools/ootx_decode/ootx_decode.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/ootx_decode/ootx_decode.c b/tools/ootx_decode/ootx_decode.c index 0c4a81a..0abde2d 100644 --- a/tools/ootx_decode/ootx_decode.c +++ b/tools/ootx_decode/ootx_decode.c @@ -30,11 +30,38 @@ void my_test2(ootx_packet* packet) { // printf("%d %s 0x%X\n", packet->length, packet->data, packet->crc32); } + +void print_crc32(uint32_t crc) { +// uint8_t* p = (uint32_t*)&crc; +// uint8_t i = 0; + + printf("%X\n", crc); +} + +void write_to_file(uint8_t *d, uint16_t length){ + FILE *fp = fopen("binary.data","w"); + fwrite(d, length, 1, fp); + fclose(fp); +} + +void bad_crc(ootx_packet* packet) { + printf("CRC mismatch\n"); +/* + printf("r:"); + print_crc32(op.crc32); + + printf("c:"); + print_crc32(crc); +// write_to_file(op.data,op.length); +*/ +} + ootx_decoder_context ctx[2]; void hello_world_test() { // ootx_init_buffer(); ootx_packet_clbk = my_test; + ootx_bad_crc_clbk = bad_crc; char* line = NULL; size_t line_len = 0; |