From 21aadd29384bfa45639940fc904592b8a7a5a073 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 21 Feb 2008 02:55:05 +0000 Subject: tvoid's suggested cleanup. --- gsm-tvoid/src/lib/gsm_burst.cc | 15 ++++----------- gsm-tvoid/src/lib/gsmstack.c | 15 +++++++-------- gsm-tvoid/src/lib/gsmstack.h | 2 +- gsm-tvoid/src/lib/sch.c | 8 ++++---- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/gsm-tvoid/src/lib/gsm_burst.cc b/gsm-tvoid/src/lib/gsm_burst.cc index 67d0886..b862d69 100755 --- a/gsm-tvoid/src/lib/gsm_burst.cc +++ b/gsm-tvoid/src/lib/gsm_burst.cc @@ -174,6 +174,7 @@ void gsm_burst::print_bits(const float *data,int length) } +#if 0 void gsm_burst::soft2hardbit(char *dst, const float *data, int len) { for (int i=0; i < len; i++) @@ -184,6 +185,7 @@ void gsm_burst::soft2hardbit(char *dst, const float *data, int len) dst[i] = 1; } } +#endif void gsm_burst::print_burst(void) { @@ -227,17 +229,8 @@ 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) { 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)) { -- cgit v1.2.3