horus_demod compiles without warning, but not tested and debugged yet
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 13 Apr 2018 23:03:46 +0000 (23:03 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 13 Apr 2018 23:03:46 +0000 (23:03 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3481 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/CMakeLists.txt
codec2-dev/src/horus_api.c
codec2-dev/src/horus_demod.c

index 2cb6fc798e55676936b119d6c9725e0257cb7c6a..bd3dcd931c6c2fbb95183d52b2a305597901e283 100644 (file)
@@ -379,6 +379,10 @@ target_link_libraries(drs232 ${CMAKE_REQUIRED_LIBRARIES})
 add_executable(drs232_ldpc drs232_ldpc.c mpdecode_core.c)
 target_link_libraries(drs232_ldpc ${CMAKE_REQUIRED_LIBRARIES})
 
+add_definitions(-DHORUS_L2_RX -DINTERLEAVER -DSCRAMBLER)
+add_executable(horus_demod horus_demod.c horus_api.c horus_l2.c fsk.c kiss_fft.c)
+target_link_libraries(horus_demod ${CMAKE_REQUIRED_LIBRARIES})
+
 install(TARGETS codec2 EXPORT codec2-config
     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
     ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
index d6f2851f0a60575c70aa48338fc75b5de18c624b..037eac2be6db5ad5de7f2461a4a03442cc5fc331 100644 (file)
@@ -152,7 +152,7 @@ int horus_find_uw(struct horus *hstates) {
         
         corr = 0;
         for(j=0; j<hstates->uw_len; j++) {
-            corr += hstates->rx_bits[i+j]*hstates->uw[j];
+            corr += rx_bits_mapped[i+j]*hstates->uw[j];
         }
 
         /* peak pick maximum */
@@ -208,7 +208,7 @@ int extract_horus_rtty(struct horus *hstates, char ascii_out[], int uw_loc) {
 
         if (!endpacket && (char_dec == 42)) {
             endpacket = 1;
-            rx_crc = horus_l2_gen_crc16(ascii_out, nout);
+            rx_crc = horus_l2_gen_crc16((uint8_t*)ascii_out, nout);
             ptx_crc = pout + 2; /* start of tx CRC */
         }
 
@@ -284,7 +284,8 @@ int horus_rx(struct horus *hstates, char ascii_out[], short demod_in[]) {
     int i, j, uw_loc, valid_packet;
     
     assert(hstates != NULL);
-
+    valid_packet = 0;
+    
     /* shift buffer of bits to make room for new bits */
 
     int Nbits = hstates->fsk->Nbits;
@@ -345,12 +346,15 @@ int horus_get_max_demod_in(struct horus *hstates) {
 }
 
 int horus_get_max_ascii_out_len(struct horus *hstates) {
+    assert(hstates != NULL);
     if (hstates->mode == HORUS_MODE_RTTY) {
         return hstates->max_packet_len/10;     /* 7 bit ASCII, plus 3 sync bits */
     }
     if (hstates->mode == HORUS_MODE_BINARY) {
         return HORUS_BINARY_NUM_PAYLOAD_BYTES;
     }
+    assert(0); /* should never get here */
+    return 0;
 }
 
 void horus_get_modem_stats(struct horus *hstates, int *sync, float *snr_est) {
index 65216d421d928b009dd009ca4783b451b0b69865..9fe95d96e9998042e706d3dc82ebce95ffe059dc 100644 (file)
@@ -49,7 +49,8 @@ int main(int argc, char *argv[]) {
 
     stats_loop = 0;
     stats_rate = 8;
-    
+    mode = -1;
+
     int o = 0;
     int opt_idx = 0;
     while ( o != -1 ) {
@@ -64,14 +65,13 @@ int main(int argc, char *argv[]) {
         
         switch(o) {
             case 'm':
-                mode = -1;
                 if ((strcmp(optarg, "RTTY") == 0) || (strcmp(optarg, "rtty") == 0)) {
                     mode = HORUS_MODE_RTTY;
                 }
                 if ((strcmp(optarg, "BINARY") == 0) || (strcmp(optarg, "binary") == 0)) {
                     mode = HORUS_MODE_BINARY;
                 }
-                if (mode = -1) {
+                if (mode == -1) {
                     fprintf(stderr, "use --mode RTTY or --mode binary\n");
                     exit(1);
                 }