extra stuff out of tx only build
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 30 Dec 2015 23:43:42 +0000 (23:43 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 30 Dec 2015 23:43:42 +0000 (23:43 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2587 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/src/horus_l2.c

index 6f551b72886198f14be70f8caf2ec44dd1593312..e50a1ecfaeea6c3a59ab0b3f348015716e359cb4 100644 (file)
   [X] function to return storgage rqd for output packet
   [X] code (not table based) based golay encoder
   [X] #define switchable debug levels
-  [ ] unit test to check if working on payload
   [ ] code based interleaver
-  [ ] unit test to run with/without errors
+  [X] unit test to run with/without errors
       [X] test at BER = 0.01
-      [ ] switchable with defines
-  [ ] conditional defines so just encoder on the target
-  [ ] Octave code
+      [X] switchable with defines
+  [X] conditional defines so just encoder on the target
+  [ ] Octave code      
       [ ] new protocol decoder
       [ ] test file based
       [ ] test real time
@@ -519,6 +518,36 @@ int main(void) {
 }
 #endif
 
+#ifdef GEN_TX_BITS
+/* generate a file of tx_bits to modulate using fsk_horus.m for modem simulations */
+
+int main(void) {
+    int nbytes = 22;
+    unsigned char input_payload[nbytes];
+    int num_tx_data_bytes = horus_l2_get_num_tx_data_bytes(sizeof(input_payload));
+    unsigned char tx[num_tx_data_bytes];
+    int i;
+
+    for(i=0; i<nbytes; i++)
+        input_payload[i] = i;
+
+    horus_l2_encode_tx_packet(tx, input_payload, sizeof(input_payload));
+    
+    FILE *f = fopen("../octave/horus_tx_bits_binary.txt","wt");
+    assert(f != NULL);
+    int b, tx_bit;
+    for(i=0; i<num_tx_data_bytes; i++) {
+        for(b=0; b<8; b++) {
+            tx_bit = (tx[i] >> (7-b)) & 0x1; /* msb first */
+            fprintf(f,"%d ", tx_bit);
+        }
+    }
+    fclose(f);
+
+    return 0;
+}
+#endif
+
 /*---------------------------------------------------------------------------*\
 
                                    GOLAY FUNCTIONS
@@ -595,6 +624,7 @@ int main(void) {
  * a[] = auxiliary array to generate correctable error patterns
  */
 
+#ifdef HORUS_L2_RX
 static int inited =  0;
 
 #ifdef RUN_TIME_TABLES
@@ -624,6 +654,7 @@ static int arr2int(int a[], int r)
    return(result);
 }
 #endif
+#endif
 
 #ifdef HORUS_L2_RX
 void nextcomb(int n, int r, int a[])