From: drowe67 Date: Fri, 8 Jan 2016 19:26:09 +0000 (+0000) Subject: changed file extension X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=dd4e35c16b55a13f6899460949ce7c826a5882e6;p=freetel-svn-tracking.git changed file extension git-svn-id: https://svn.code.sf.net/p/freetel/code@2616 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2-dev/src/horus_l2.c b/codec2-dev/src/horus_l2.c index a5513dfb..bbdbf8ea 100644 --- a/codec2-dev/src/horus_l2.c +++ b/codec2-dev/src/horus_l2.c @@ -9,29 +9,10 @@ data and parity bits, pre-pends a Unique Word for modem sync. Caller is responsible for providing storage for output packet. - [X] work out number of golay codewords rqd - [X] function to return storgage rqd for output packet - [X] code (not table based) based golay encoder - [X] #define switchable debug levels [ ] code based interleaver - [X] unit test to run with/without errors - [X] test at BER = 0.01 - [X] switchable with defines - [X] conditional defines so just encoder on the target - [ ] Octave code - [ ] new protocol decoder - [ ] test file based - [ ] test real time - [ ] version of ths module to work with Octave - [ ] e.g. mex file, or stdin/stdout - - Notes to Mark: - [X] what are the word lengths of ints and longs on the uC? - [X] alternate legacy RTTY/new protocol - [ ] does it run fast enough on target? - [ ] test real time decode of both - - 1/ To test on a PC: + [ ] test correction of 1,2 & 3 error patterms + + 1/ Unit test on a PC: $ gcc horus_l2.c -o horus_l2 -Wall -DHORUS_L2_UNITTEST $ ./horus_l2 @@ -53,17 +34,17 @@ By default the RX side is #ifdef-ed out, leaving the minimal amount of code for tx. - 3/ Generate some tx_bits for testing with fsk_horus: + 3/ Generate some tx_bits as input for testing with fsk_horus: $ gcc horus_l2.c -o horus_l2 -Wall -DGEN_TX_BITS $ ./horus_l2 $ more ../octave/horus_tx_bits_binary.txt - 4/ Testing interleaver: + 4/ Unit testing interleaver: $ gcc horus_l2.c -o horus_l2 -Wall -DINTERLEAVER -DTEST_INTERLEAVER - 5/ Use as decoder with fsk_horus.m and fsk_horus_stream.m: + 5/ Compile for use as decoder called by fsk_horus.m and fsk_horus_stream.m: $ gcc horus_l2.c -o horus_l2 -Wall -DDEC_RX_BITS -DHORUS_L2_RX @@ -527,12 +508,12 @@ void interleave(unsigned char *inout, int nbytes) ibyte = i/8; ishift = i%8; ibit = (inout[ibyte] >> ishift) & 0x1; - //printf("i: %02d ibyte: %d ishift: %d ibit: %d\n", i, ibyte, ishift, ibit); + printf("i: %02d ibyte: %d ishift: %d ibit: %d\n", i, ibyte, ishift, ibit); jbyte = j/8; jshift = j%8; jbit = (inout[jbyte] >> jshift) & 0x1; - //printf("j: %02d jbyte: %d jshift: %d jbit: %d\n", j, jbyte, jshift, jbit); + printf("j: %02d jbyte: %d jshift: %d jbit: %d\n", j, jbyte, jshift, jbit); /* write jbit to ibit position */ @@ -546,6 +527,12 @@ void interleave(unsigned char *inout, int nbytes) inout[jbyte] &= ~mask; // clear jbit inout[jbyte] |= ibit << jshift; } + + #ifdef DEBUG0 + printf("\nInterleaver Out:\n"); + for (i=0; i>b) & 0x1; } return nerr; @@ -657,11 +679,12 @@ int test_sending_bytes(int nbytes, float ber, int burst) { /* unit test designed to run on a PC */ int main(void) { - printf("test 0: 22 bytes of payload data BER: 0.00 errors.: %d\n", test_sending_bytes(22, 0.00, 0)); - printf("test 0: 22 bytes of payload data BER: 0.01 errors.: %d\n", test_sending_bytes(22, 0.01, 0)); - printf("test 0: 22 bytes of payload data BER: 0.05 errors.: %d\n", test_sending_bytes(22, 0.05, 0)); - printf("test 0: 22 bytes of payload data BER: 0.10 errors.: %d\n", test_sending_bytes(22, 0.10, 0)); - printf("test 0: 22 bytes of payload data 8 bit burst error: %d\n", test_sending_bytes(22, 0.50, 1)); + printf("test 0: BER: 0.00 ...........: %d\n", test_sending_bytes(22, 0.00, 0)); + printf("test 1: BER: 0.01 ...........: %d\n", test_sending_bytes(22, 0.01, 0)); + printf("test 2: BER: 0.05 ...........: %d\n", test_sending_bytes(22, 0.05, 0)); + printf("test 3: BER: 0.10 ...........: %d\n", test_sending_bytes(22, 0.10, 0)); + //printf("test 4: 8 bit burst error....: %d\n", test_sending_bytes(22, 0.00, 1)); + //printf("test 5: 1 error every 12 bits: %d\n", test_sending_bytes(22, 0.00, 2)); return 0; } #endif @@ -736,7 +759,7 @@ int main(void) { #define READ_FILE /* overwrite tx[] above, that's OK */ #ifdef READ_FILE - FILE *f = fopen("../octave/horus_rx_bits_binary.txt","rb"); + FILE *f = fopen("../octave/horus_rx_bits_binary.bin","rb"); assert(f != NULL); ret = fread(rx, sizeof(char), num_tx_data_bytes, f); assert(ret == num_tx_data_bytes);