commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r3661 - gnuradio/branches/developers/jcorgan/pager/gr-


From: jcorgan
Subject: [Commit-gnuradio] r3661 - gnuradio/branches/developers/jcorgan/pager/gr-pager/src
Date: Tue, 26 Sep 2006 22:57:45 -0600 (MDT)

Author: jcorgan
Date: 2006-09-26 22:57:44 -0600 (Tue, 26 Sep 2006)
New Revision: 3661

Modified:
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.h
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc
   gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h
Log:
Work in progress.  Now decoding capcodes.


Modified: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.cc
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.cc 
2006-09-27 04:10:26 UTC (rev 3660)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.cc 
2006-09-27 04:57:44 UTC (rev 3661)
@@ -66,6 +66,18 @@
    indices of the page address field and page vector fields.
 */
 
+void pager_flex_parse::parse_capcode(gr_int32 aw1, gr_int32 aw2)
+{
+    d_laddr = (aw1 < 0x008001L) ||
+              (aw1 > 0x1E0000L) ||
+             (aw1 > 0x1E7FFEL);        
+    
+    if (d_laddr)
+        d_capcode = aw1+((aw2^0x001FFFFF)<<15)+0x1F9000;  // Don't ask
+    else
+        d_capcode = aw1-0x8000;
+}
+
 void pager_flex_parse::parse_data()
 {
     // Block information word is the first data word in frame
@@ -77,30 +89,45 @@
 
     // Vector start index is bits 15-10
     // Address start address is bits 9-8, plus one for offset
-    int vector_offset = (biw >> 10) & 0x3f;
-    int address_offset = ((biw >> 8) & 0x03) + 1;
+    int voffset = (biw >> 10) & 0x3f;
+    int aoffset = ((biw >> 8) & 0x03) + 1;
     
-    printf("BIW=%08X A=%i V=%i\n", biw, address_offset, vector_offset);
+//  printf("BIW=%08X A=%i V=%i\n", biw, aoffset, voffset);
 
     // Iterate through pages and dispatch to appropriate handler
-    for (int index = address_offset; index < vector_offset; index++) {
-       // Vector information word is sequential @ vector_offet
-       int vector_index = vector_offset + index - address_offset;
+    for (int i = aoffset; i < voffset; i++) {
+       int j = voffset+i-aoffset;              // Start of vector field for 
address @ i
 
-       // CAPCODE is @ index and maybe also index+1 if long address
-       gr_int32 address_word = d_datawords[index];
-       bool long_address = (address_word < 0x008001L) ||
-                           (address_word > 0x1E0000L) ||
-                           (address_word > 0x1E7FFEL); 
+       if (d_datawords[i] == 0x00000000 ||
+           d_datawords[i] == 0x001FFFFF)
+           continue;                           // Idle codewords, invalid 
address
 
-       gr_int32 vector_word = d_datawords[vector_index];
-       int vector_type = (vector_word >> 4) & 0x00000007L;
+       parse_capcode(d_datawords[i], d_datawords[i+1]);
+        if (d_laddr)
+           i++;
+                           
+        if (d_capcode < 0)                     // Invalid address, skip
+          continue;        
 
-       printf("%i: AW=0x%08X (%s) VW=0x%08X TYPE=%i (%s)\n", index, 
address_word,
-           long_address ? "L" : "S", vector_word, vector_type, 
page_types[vector_type]);
+        // Parse vector information word for address @ offset 'i'
+       gr_int32 viw = d_datawords[j];
+       int vtype = (viw >> 4) & 0x00000007;
+       int mw1 = (viw >> 7) & 0x00000007F;
+       int len = (viw >> 14) & 0x0000007F;
 
-       if (long_address)
-           index++;
+       if (is_numeric_page(vtype))
+            len &= 0x07;
+        int mw2 = mw1+len;
+           
+       if (mw1 == 0 && mw2 == 0)
+           continue;                           // Invalid VIW
 
+       if (is_tone_page(vtype))
+           mw1 = mw2 = 0;
+
+       if (mw1 > 87 || mw2 > 87)
+           continue;                           // Invalid offsets
+
+       printf("%09i: %s\n", d_capcode, page_types[vtype]);
     }
 }

Modified: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.h
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.h  
2006-09-27 04:10:26 UTC (rev 3660)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_parse.h  
2006-09-27 04:57:44 UTC (rev 3661)
@@ -41,10 +41,15 @@
     friend pager_flex_parse_sptr pager_make_flex_parse();
     pager_flex_parse();
 
-    int d_count;             // Count of received codewords
-    gr_int32 d_datawords[88]; // 11 blocks of 8 32-bit words
-    void parse_data();       // Handle a frame's worth of data
-    
+    int d_count;                         // Count of received codewords
+    gr_int32 d_datawords[88];             // 11 blocks of 8 32-bit words
+
+    int d_capcode;                       // Current page destination address
+    int d_laddr;                         // Current page has long address
+
+    void parse_data();                   // Handle a frame's worth of data
+    void parse_capcode(gr_int32 aw1, gr_int32 aw2);     
+
 public:
     int work(int noutput_items,
         gr_vector_const_void_star &input_items, 

Modified: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc  
2006-09-27 04:10:26 UTC (rev 3660)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc  
2006-09-27 04:57:44 UTC (rev 3661)
@@ -141,7 +141,7 @@
     d_end = d_index;
     d_center = index_avg(d_start, d_end); // Center of goodness
     d_count = 0;
-    printf("SYNC1=%08X ", flex_modes[d_mode].sync);
+//  printf("SYNC1=%08X ", flex_modes[d_mode].sync);
 }
 
 void pager_flex_sync::enter_sync2()
@@ -188,9 +188,9 @@
        
     // Bits 10-0 are BCH 'parity' bits, ignored
 
-    printf("FIW=0x%08X CYC=%i FRM=%i UNK1=0x%02X UNK2=0x%02X\n", 
-           fiw, cycle, frame, unknown1, unknown2);
-    fflush(stdout);
+//  printf("FIW=0x%08X CYC=%i FRM=%i UNK1=0x%02X UNK2=0x%02X\n", 
+//         fiw, cycle, frame, unknown1, unknown2);
+//  fflush(stdout);
 }
 
 int pager_flex_sync::output_symbol(unsigned char sym)

Modified: 
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h 
2006-09-27 04:10:26 UTC (rev 3660)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pageri_flex_modes.h 
2006-09-27 04:57:44 UTC (rev 3661)
@@ -41,10 +41,33 @@
 
 extern const flex_mode_t flex_modes[];
 extern const int num_flex_modes;
+int find_flex_mode(gr_int32 sync_code);
 
+typedef enum {
+    FLEX_SECURE,
+    FLEX_UNKNOWN,
+    FLEX_TONE,
+    FLEX_STANDARD_NUMERIC,
+    FLEX_SPECIAL_NUMERIC,
+    FLEX_ALPHANUMERIC,
+    FLEX_BINARY,
+    FLEX_NUMBERED_NUMERIC,
+    NUM_FLEX_PAGE_TYPES
+}
+page_type_t;
+
 extern const char *page_types[];
-extern const int num_page_types;
 
-int find_flex_mode(gr_int32 sync_code);
+inline bool is_numeric_page(int vtype)
+{
+    return (vtype == FLEX_STANDARD_NUMERIC ||
+            vtype == FLEX_SPECIAL_NUMERIC ||
+            vtype == FLEX_NUMBERED_NUMERIC);
+}
 
+inline bool is_tone_page(int vtype)
+{
+    return (vtype == FLEX_TONE);
+}
+
 #endif // INCLUDED_PAGERI_FLEX_MODES_H





reply via email to

[Prev in Thread] Current Thread [Next in Thread]