[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3605 - gnuradio/branches/developers/jcorgan/pager/gr-
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3605 - gnuradio/branches/developers/jcorgan/pager/gr-pager/src |
Date: |
Thu, 21 Sep 2006 20:06:19 -0600 (MDT) |
Author: jcorgan
Date: 2006-09-21 20:06:19 -0600 (Thu, 21 Sep 2006)
New Revision: 3605
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.h
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
Log:
Work in progress
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-21 23:59:21 UTC (rev 3604)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.cc
2006-09-22 02:06:19 UTC (rev 3605)
@@ -34,15 +34,15 @@
}
// FLEX sync block takes input from sliced baseband stream [0-3] at specified
-// channel rate. Symbol timing is establish based on receiving one of the
+// channel rate. Symbol timing is established based on receiving one of the
// defined FLEX protocol synchronization words. The block outputs one FLEX
frame
-// worth of symbols [0-3] at either 1600 or 3200 bps as indicated by the type
-// of frame syncronized
+// worth of bits on each output phase for the data portion of the frame.
Unused phases
+// get all zeros, which are considered idle code words.
pager_flex_sync::pager_flex_sync(int rate) :
gr_block ("flex_sync",
gr_make_io_signature (1, 1, sizeof(unsigned char)),
- gr_make_io_signature (1, 1, sizeof(unsigned char))),
+ gr_make_io_signature (4, 4, sizeof(unsigned char))),
d_sync(rate/1600) // Maximum samples per baud
{
d_rate = rate;
@@ -119,6 +119,12 @@
d_baudrate = 1600;
d_levels = 2;
d_spb = d_rate/d_baudrate;
+ d_bit_a = 0;
+ d_bit_b = 0;
+ d_bit_c = 0;
+ d_bit_d = 0;
+ d_hibit = false;
+ fflush(stdout);
}
void pager_flex_sync::enter_syncing()
@@ -149,7 +155,7 @@
d_center = d_center/2;
d_index = d_index/2-d_spb/2; // We're here at the center of a 1600
baud bit
d_count = -1; // So this hack gets us in the right
place for 3200
- }
+ } // I suspect this isn't quite right :(
}
void pager_flex_sync::enter_data()
@@ -170,6 +176,9 @@
void print_fiw(gr_int32 fiw)
{
+ // Bits 31-28 are frame number related, but unknown function
+ int unknown2 = reverse_bits8((fiw >> 24) & 0xF0);
+
// Cycle is bits 27-24, reversed
int cycle = reverse_bits8((fiw >> 20) & 0xF0);
@@ -179,21 +188,66 @@
// Bits 16-11 are some sort of marker
int unknown1 = (fiw >> 11) & 0x3F;
- // Bits 31-28 are frame number related, but unknown function
- int unknown2 = reverse_bits8((fiw >> 24) & 0xF0);
-
+ // 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);
}
+int pager_flex_sync::output_symbol(unsigned char sym)
+{
+ // Here is where we output a 1 or 0 on each phase according
+ // to current FLEX mode and symbol value
+ int bits = 0;
+
+ if (d_baudrate == 1600) {
+ d_bit_a = (sym < 2);
+ if (d_levels == 4)
+ d_bit_b = (sym == 0) || (sym == 3);
+
+ *d_phase_a++ = d_bit_a;
+ *d_phase_b++ = d_bit_b;
+ *d_phase_c++ = d_bit_c;
+ *d_phase_d++ = d_bit_d;
+ printf("%i%i%i%i\n", d_bit_a, d_bit_b, d_bit_c, d_bit_d);
+ bits++;
+ }
+ else {
+ if (!d_hibit) {
+ d_bit_a = (sym < 2);
+ if (d_levels == 4)
+ d_bit_b = (sym == 0) || (sym == 3);
+ d_hibit = true;
+ }
+ else {
+ d_bit_c = (sym < 2);
+ if (d_levels == 4)
+ d_bit_d = (sym == 0) || (sym == 3);
+ d_hibit = true;
+
+ *d_phase_a++ = d_bit_a;
+ *d_phase_b++ = d_bit_b;
+ *d_phase_c++ = d_bit_c;
+ *d_phase_d++ = d_bit_d;
+ printf("%i%i%i%i\n", d_bit_a, d_bit_b, d_bit_c, d_bit_d);
+ bits++;
+ }
+ }
+
+ return bits;
+}
+
int pager_flex_sync::general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const unsigned char *in = (const unsigned char *)input_items[0];
- unsigned char *out = (unsigned char *)output_items[0];
+ d_phase_a = (unsigned char *)output_items[0];
+ d_phase_b = (unsigned char *)output_items[1];
+ d_phase_c = (unsigned char *)output_items[2];
+ d_phase_d = (unsigned char *)output_items[3];
int i = 0, j = 0;
int ninputs = ninput_items[0];
@@ -234,6 +288,7 @@
case ST_DATA:
if (d_index == d_center) {
+ j += output_symbol(sym);
// Skip 1760 ms = 2816 bits @ 1600 bps, 5632 bits @ 3200 bps
if (++d_count == d_baudrate*1760/1000)
enter_idle();
@@ -250,14 +305,3 @@
return j;
}
-void pager_flex_sync::output_symbol(unsigned char *out, unsigned char sym)
-{
- if (d_levels == 2) {
- *out = (sym > 1) ? 3 : 0; // 2 levels
- putchar((sym > 1) ? 0x31 : 0x30);
- }
- else {
- *out = sym; // 4 levels
- putchar(sym+0x30);
- }
-}
Modified:
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.h
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.h
2006-09-21 23:59:21 UTC (rev 3604)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_sync.h
2006-09-22 02:06:19 UTC (rev 3605)
@@ -51,7 +51,7 @@
int index_avg(int start, int end);
bool test_sync(unsigned char sym);
- void output_symbol(unsigned char *out, unsigned char sym);
+ int output_symbol(unsigned char sym);
// Simple state machine
enum state_t { ST_IDLE, ST_SYNCING, ST_SYNC1, ST_SYNC2, ST_DATA };
@@ -68,9 +68,20 @@
int d_baudrate; // Current decoding baud rate
int d_levels; // Current decoding levels
int d_spb; // Current samples per baud
+ bool d_hibit; // Alternating bit indicator for 3200 bps
gr_int32 d_fiw; // Frame information word
+ unsigned char d_bit_a;
+ unsigned char d_bit_b;
+ unsigned char d_bit_c;
+ unsigned char d_bit_d;
+
+ unsigned char *d_phase_a;
+ unsigned char *d_phase_b;
+ unsigned char *d_phase_c;
+ unsigned char *d_phase_d;
+
gr_int64_vector d_sync; // Trial synchronizers
public:
Modified: gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
===================================================================
--- gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
2006-09-21 23:59:21 UTC (rev 3604)
+++ gnuradio/branches/developers/jcorgan/pager/gr-pager/src/usrp_flex.py
2006-09-22 02:06:19 UTC (rev 3605)
@@ -115,13 +115,19 @@
FLEX = pager.flex_demod(self, 32000)
- SINK = gr.file_sink(1, options.filename)
+ SINKA = gr.file_sink(1, options.filename+'A')
+ SINKB = gr.file_sink(1, options.filename+'B')
+ SINKC = gr.file_sink(1, options.filename+'C')
+ SINKD = gr.file_sink(1, options.filename+'D')
self.connect(USRP, CHAN)
self.connect(CHAN, RFSQL)
self.connect(RFSQL, AGC)
self.connect(AGC, FLEX)
- self.connect(FLEX, SINK)
+ self.connect((FLEX, 0), SINKA)
+ self.connect((FLEX, 1), SINKB)
+ self.connect((FLEX, 2), SINKC)
+ self.connect((FLEX, 3), SINKD)
def main():
parser = OptionParser(option_class=eng_option)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3605 - gnuradio/branches/developers/jcorgan/pager/gr-pager/src,
jcorgan <=