diff options
author | tvoid <tvoid@lesaige.com> | 2008-04-11 09:08:00 -0600 |
---|---|---|
committer | tvoid <tvoid@lesaige.com> | 2008-04-11 09:08:00 -0600 |
commit | 67272251547bc999e581eb0d1fcd90b5cb14d469 (patch) | |
tree | 2f31580521e57ab08e69d06f2f678b54d6161d87 /gsm-tvoid | |
parent | 26645da7613da2c50675f2059c70811354a334a3 (diff) | |
parent | 21aadd29384bfa45639940fc904592b8a7a5a073 (diff) |
Merge commit 'origin/HEAD'
Conflicts:
gsm-tvoid/src/lib/gsm.i
gsm-tvoid/src/lib/gsm_burst.cc
gsm-tvoid/src/lib/gsm_burst.h
gsm-tvoid/src/lib/gsm_burst_cf.cc
gsm-tvoid/src/lib/gsm_burst_ff.cc
gsm-tvoid/src/lib/gsm_burst_ff.h
gsm-tvoid/src/python/gsm_scan.py
Diffstat (limited to 'gsm-tvoid')
-rwxr-xr-x | gsm-tvoid/src/lib/gsm.i | 1 | ||||
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst.cc | 47 | ||||
-rwxr-xr-x | gsm-tvoid/src/lib/gsm_burst.h | 2 | ||||
-rw-r--r-- | gsm-tvoid/src/lib/gsmstack.c | 15 | ||||
-rw-r--r-- | gsm-tvoid/src/lib/gsmstack.h | 2 | ||||
-rw-r--r-- | gsm-tvoid/src/lib/sch.c | 8 | ||||
-rwxr-xr-x | gsm-tvoid/src/python/gsm_scan.py | 2 |
7 files changed, 34 insertions, 43 deletions
diff --git a/gsm-tvoid/src/lib/gsm.i b/gsm-tvoid/src/lib/gsm.i index 30981f2..106e378 100755 --- a/gsm-tvoid/src/lib/gsm.i +++ b/gsm-tvoid/src/lib/gsm.i @@ -87,7 +87,6 @@ public: //Methods void full_reset(void); - protected: gsm_burst(gr_feval_ll *); }; diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index eb44bb4..14950c6 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -173,10 +173,11 @@ void gsm_burst::print_bits(const float *data,int length) assert(length >= 0); for (int i=0; i < length; i++) - data[i] < 0 ? fprintf(stdout,"+") : fprintf(stdout,"."); + data[i] < 0 ? fprintf(stderr,"+") : fprintf(stderr,"."); } +#if 0 void gsm_burst::soft2hardbit(char *dst, const float *data, int len) { for (int i=0; i < len; i++) @@ -187,6 +188,7 @@ void gsm_burst::soft2hardbit(char *dst, const float *data, int len) dst[i] = 1; } } +#endif void gsm_burst::print_burst(void) { @@ -220,7 +222,7 @@ void gsm_burst::print_burst(void) print_bits(d_burst_buffer + d_burst_start,USEFUL_BITS); } - fprintf(stdout," "); + fprintf(stderr," "); } @@ -230,22 +232,13 @@ void gsm_burst::print_burst(void) * Pass information to GSM stack. GSM stack will try to extract * information (fn, layer 2 messages, ...) */ - - char buf[156]; - /* In hardbits include the 3 trial bits */ - /* FIXME: access burst has 8 trail bits? what is d_burst_start - * set to? make sure we start at the right position here. - */ - soft2hardbit(buf, d_burst_buffer + d_burst_start - 3, 156); - /* GS_process will differentially decode the data and then - * extract SCH infos (and later bcch infos). - */ - GS_process(&d_gs_ctx, d_ts, d_burst_type, buf); + diff_decode_burst(); + GS_process(&d_gs_ctx, d_ts, d_burst_type, d_decoded_burst); } if (print) { - fprintf(stdout,"%d/%d/%+d/%lu/%lu ", + fprintf(stderr,"%d/%d/%+d/%lu/%lu ", d_sync_state, d_ts, d_burst_start - MAX_CORR_DIST, @@ -254,38 +247,38 @@ void gsm_burst::print_burst(void) switch (d_burst_type) { case FCCH: - fprintf(stdout,"[FCCH] foff:%g cnt:%lu",d_freq_offset,d_fcch_count); + fprintf(stderr,"[FCCH] foff:%g cnt:%lu",d_freq_offset,d_fcch_count); break; case PARTIAL_SCH: bursts_since_sch = d_burst_count - d_last_sch; - fprintf(stdout,"[P-SCH] cor:%.2f last:%d cnt: %lu", + fprintf(stderr,"[P-SCH] cor:%.2f last:%d cnt: %lu", d_corr_max,bursts_since_sch,d_sch_count); break; case SCH: bursts_since_sch = d_burst_count - d_last_sch; - fprintf(stdout,"[SCH] cor:%.2f last:%d cnt: %lu", + fprintf(stderr,"[SCH] cor:%.2f last:%d cnt: %lu", d_corr_max,bursts_since_sch,d_sch_count); break; case DUMMY: - fprintf(stdout,"[DUMMY] cor:%.2f",d_corr_max); + fprintf(stderr,"[DUMMY] cor:%.2f",d_corr_max); break; case ACCESS: - fprintf(stdout,"[ACCESS]"); //We don't detect this yet + fprintf(stderr,"[ACCESS]"); //We don't detect this yet break; case NORMAL: - fprintf(stdout,"[NORM] clr:%d cor:%.2f",d_color_code,d_corr_max); + fprintf(stderr,"[NORM] clr:%d cor:%.2f",d_color_code,d_corr_max); break; case UNKNOWN: - fprintf(stdout,"[?]"); + fprintf(stderr,"[?]"); break; default: - fprintf(stdout,"[oops! default]"); + fprintf(stderr,"[oops! default]"); break; } - fprintf(stdout,"\n"); + fprintf(stderr,"\n"); //print the correlation pattern for visual inspection @@ -304,10 +297,10 @@ void gsm_burst::print_burst(void) for (int i = 0; i < pat_indent; i++) fprintf(stderr," "); - fprintf(stdout," "); //extra space for skipped bit + fprintf(stderr," "); //extra space for skipped bit print_bits(d_corr_pattern+1,d_corr_pat_size-1); //skip first bit (diff encoding) - fprintf(stdout,"\t\toffset:%d, max: %.2f \n",d_corr_maxpos,d_corr_max); + fprintf(stderr,"\t\toffset:%d, max: %.2f \n",d_corr_maxpos,d_corr_max); } } @@ -323,10 +316,10 @@ void gsm_burst::print_burst(void) //Print State related messages if ( d_print_options & PRINT_STATE ) { if ( (SYNCHRONIZED == d_sync_state) && (SYNCHRONIZED != d_last_sync_state) ) { - fprintf(stdout,"====== SYNC GAINED (FOff: %g Corr: %.2f, Color: %d ) ======\n",d_freq_offset,d_corr_max,d_color_code); + fprintf(stderr,"====== SYNC GAINED (FOff: %g Corr: %.2f, Color: %d ) ======\n",d_freq_offset,d_corr_max,d_color_code); } else if ( (SYNCHRONIZED != d_sync_state) && (SYNCHRONIZED == d_last_sync_state) ) { - fprintf(stdout,"====== SYNC LOST (%ld) ======\n",d_sync_loss_count); + fprintf(stderr,"====== SYNC LOST (%ld) ======\n",d_sync_loss_count); } } diff --git a/gsm-tvoid/src/lib/gsm_burst.h b/gsm-tvoid/src/lib/gsm_burst.h index 2e482d0..48fafac 100755 --- a/gsm-tvoid/src/lib/gsm_burst.h +++ b/gsm-tvoid/src/lib/gsm_burst.h @@ -145,7 +145,7 @@ protected: void print_bits(const float *data,int length); void print_hex(const unsigned char *data,int length); - void soft2hardbit(char *dst, const float *data, int len); //need this? +// void soft2hardbit(char *dst, const float *data, int len); //need this? void print_burst(void); void diff_encode(const float *in,float *out,int length,float lastbit = 1.0); diff --git a/gsm-tvoid/src/lib/gsmstack.c b/gsm-tvoid/src/lib/gsmstack.c index a38ffcb..22fa170 100644 --- a/gsm-tvoid/src/lib/gsmstack.c +++ b/gsm-tvoid/src/lib/gsmstack.c @@ -14,6 +14,7 @@ static void out_gsmdecode(char type, int arfcn, int ts, int fn, char *data, int len); +#if 0 static void diff_decode(char *dst, char *src, int len) { @@ -33,6 +34,7 @@ diff_decode(char *dst, char *src, int len) dst++; } } +#endif /* * Initialize a new GSMSTACK context. @@ -49,26 +51,23 @@ GS_new(GS_CTX *ctx) } /* - * 156 bit + * 142 bit */ int -GS_process(GS_CTX *ctx, int ts, int type, char *src) +GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src) { int fn; int bsic; int ret; - char buf[156]; unsigned char *data; int len; if (ts != 0) return; - diff_decode(buf, src, 156); - if (type == SCH) { - ret = decode_sch(buf, &fn, &bsic); + ret = decode_sch(src, &fn, &bsic); if (ret != 0) return 0; if ((ctx->bsic > 0) && (bsic != ctx->bsic)) @@ -94,8 +93,8 @@ GS_process(GS_CTX *ctx, int ts, int type, char *src) */ /* Copy content data into new array */ //DEBUGF("burst count %d\n", ctx->burst_count); - memcpy(ctx->burst + (116 * ctx->burst_count), buf + 3, 58); - memcpy(ctx->burst + (116 * ctx->burst_count) + 58, buf + 3 + 58 + 26, 58); + memcpy(ctx->burst + (116 * ctx->burst_count), src, 58); + memcpy(ctx->burst + (116 * ctx->burst_count) + 58, src + 58 + 26, 58); ctx->burst_count++; /* Return if not enough bursts for a full gsm message */ if (ctx->burst_count < 4) diff --git a/gsm-tvoid/src/lib/gsmstack.h b/gsm-tvoid/src/lib/gsmstack.h index fa858ba..d79a40f 100644 --- a/gsm-tvoid/src/lib/gsmstack.h +++ b/gsm-tvoid/src/lib/gsmstack.h @@ -22,7 +22,7 @@ typedef struct } GS_CTX; int GS_new(GS_CTX *ctx); -int GS_process(GS_CTX *ctx, int ts, int type, char *data); +int GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src); #ifdef __cplusplus } diff --git a/gsm-tvoid/src/lib/sch.c b/gsm-tvoid/src/lib/sch.c index c01d7bb..d311371 100644 --- a/gsm-tvoid/src/lib/sch.c +++ b/gsm-tvoid/src/lib/sch.c @@ -243,10 +243,10 @@ int decode_sch(const unsigned char *buf, int *fn_o, int *bsic_o) { unsigned char data[CONV_SIZE], decoded_data[PARITY_OUTPUT_SIZE]; // extract encoded data from synchronization burst - /* buf + 3, 39 bit */ - /* buf + 3 + 39 + 64 = 106, 39 */ - memcpy(data, buf + SB_EDATA_OS_1, SB_EDATA_LEN_1); - memcpy(data + SB_EDATA_LEN_1, buf + SB_EDATA_OS_2, SB_EDATA_LEN_2); + /* buf, 39 bit */ + /* buf + 39 + 64 = 103, 39 */ + memcpy(data, buf, SB_EDATA_LEN_1); + memcpy(data + SB_EDATA_LEN_1, buf + SB_EDATA_LEN_1 + N_SYNC_BITS, SB_EDATA_LEN_2); // Viterbi decode if(errors = conv_decode(data, decoded_data)) { diff --git a/gsm-tvoid/src/python/gsm_scan.py b/gsm-tvoid/src/python/gsm_scan.py index b98bf43..6d25fd3 100755 --- a/gsm-tvoid/src/python/gsm_scan.py +++ b/gsm-tvoid/src/python/gsm_scan.py @@ -429,7 +429,6 @@ class app_flow_graph(stdgui.gui_flow_graph): popts |= gsm.PRINT_GSM_DECODE #TODO: should warn if PRINT_GSM_DECODE is combined with other flags (will corrupt output for gsmdecode) - self.burst.d_print_options = popts @@ -586,6 +585,7 @@ class app_flow_graph(stdgui.gui_flow_graph): def on_idle(self, event): #We can't update this while in the tune functions since they can be invoked by callbaks and the GUI croaks... + #FIXME: This is icky. self._set_status_msg(self.status_msg) #print "Idle.\n"; |