diff options
| author | Piotr Krysik <perper@o2.pl> | 2009-06-13 17:28:03 +0200 | 
|---|---|---|
| committer | Piotr Krysik <perper@o2.pl> | 2009-06-13 17:28:03 +0200 | 
| commit | d406d48293c998567d628d950c66da1ca8ded39c (patch) | |
| tree | 6069ed5d899d8f328931795a8d560d15c66198d1 /src/lib | |
| parent | 8d22cd691b045295fd2de22e37868346ab0b0c45 (diff) | |
cch decoding now works! but I have to remove it in the future :)
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/Assert.h | 2 | ||||
| -rw-r--r-- | src/lib/decoder/gsmstack.c | 24 | ||||
| -rw-r--r-- | src/lib/decoder/gsmstack.h | 2 | ||||
| -rw-r--r-- | src/lib/decoder/sch.h | 4 | ||||
| -rw-r--r-- | src/lib/gsm_constants.h | 5 | ||||
| -rw-r--r-- | src/lib/gsm_receiver_cf.cc | 23 | ||||
| -rw-r--r-- | src/lib/gsm_receiver_cf.h | 9 | ||||
| -rw-r--r-- | src/lib/gsm_receiver_config.h | 3 | 
8 files changed, 43 insertions, 29 deletions
| diff --git a/src/lib/Assert.h b/src/lib/Assert.h index dd222b0..acfb3f7 100644 --- a/src/lib/Assert.h +++ b/src/lib/Assert.h @@ -26,7 +26,7 @@  #include "stdio.h"  #include <iostream> -// #define NDEBUG +#define NDEBUG  /**@name Macros for standard messages. */  //@{ diff --git a/src/lib/decoder/gsmstack.c b/src/lib/decoder/gsmstack.c index cf94939..ceda6c5 100644 --- a/src/lib/decoder/gsmstack.c +++ b/src/lib/decoder/gsmstack.c @@ -104,9 +104,9 @@ GS_new(GS_CTX *ctx)   * 142 bit   */  int -GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src) +GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src, int fn)  { -	int fn; +// 	int fn;  	int bsic;  	int ret;  	unsigned char *data; @@ -132,9 +132,9 @@ GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src)  	}  #endif -	if (ts == 0) { +/*	if (ts == 0) {  		if (type == SCH) { -			ret = decode_sch(src, &fn, &bsic); +//			ret = decode_sch(src, &fn, &bsic);  			if (ret != 0)  				return 0;  			if ((ctx->bsic > 0) && (bsic != ctx->bsic)) @@ -143,17 +143,17 @@ GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src)  			ctx->fn = fn;  			ctx->bsic = bsic;  			/* Reset message concatenator */ -			ts_ctx->burst_count = 0; -			return 0; -		} +//			ts_ctx->burst_count = 0; +//			return 0; +//		}  		/* If we did not get Frame Number yet then return */ -		if (ctx->fn < 0) -			return 0; - -		ctx->fn++; -	} +//		if (ctx->fn < 0) +//			return 0; +//		ctx->fn++; +//	} +        ctx->fn = fn;  	if (type == NORMAL) {  		/* Interested in these frame numbers (cch)   		 * 2-5, 12-15, 22-25, 23-35, 42-45 diff --git a/src/lib/decoder/gsmstack.h b/src/lib/decoder/gsmstack.h index fb88334..7295b08 100644 --- a/src/lib/decoder/gsmstack.h +++ b/src/lib/decoder/gsmstack.h @@ -34,7 +34,7 @@ typedef struct  } GS_CTX;  int GS_new(GS_CTX *ctx); -int GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src); +int GS_process(GS_CTX *ctx, int ts, int type, const unsigned char *src, int fn);  #ifdef __cplusplus  } diff --git a/src/lib/decoder/sch.h b/src/lib/decoder/sch.h index 199d739..4d47eb5 100644 --- a/src/lib/decoder/sch.h +++ b/src/lib/decoder/sch.h @@ -1,6 +1,6 @@ -#ifndef __GSMSTACK_H__ -#define __GSMSTACK_H__ 1 +#ifndef __SCH_H__ +#define __SCH_H__ 1  #ifdef __cplusplus  extern "C" diff --git a/src/lib/gsm_constants.h b/src/lib/gsm_constants.h index 6eecbb1..3f7ef04 100644 --- a/src/lib/gsm_constants.h +++ b/src/lib/gsm_constants.h @@ -33,6 +33,9 @@  #define CHAN_IMP_RESP_LENGTH  5 +typedef enum {empty, fcch_burst, sch_burst, normal_burst, rach_burst, dummy} burst_type; +typedef enum {unknown, multiframe_26, multiframe_51} multiframe_type; +  static const unsigned char SYNC_BITS[] = {    1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0,    0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, @@ -45,9 +48,11 @@ const unsigned SCH_FRAMES[] = {1, 11, 21, 31, 41};  const unsigned BCCH_FRAMES[] = {2, 3, 4, 5};          //!!the receiver shouldn't care about logical                                                        //!!channels so this will be removed from this header +const unsigned TEST_CCH_FRAMES[] = {2, 3, 4, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49};  const unsigned TRAFFIC_CHANNEL_F[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};  const unsigned TEST51[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}; +  #define TSC0  0  #define TSC1  1  #define TSC2  2 diff --git a/src/lib/gsm_receiver_cf.cc b/src/lib/gsm_receiver_cf.cc index 8f99209..7f91fa8 100644 --- a/src/lib/gsm_receiver_cf.cc +++ b/src/lib/gsm_receiver_cf.cc @@ -39,24 +39,28 @@  #define TRAIN_SEARCH_RANGE 40  //TODO: this shouldn't be here - remove it when gsm receiver's interface will be ready -void gsm_receiver_cf::process_normal_burst(burst_counter burst_nr, unsigned char * pakiet) +void gsm_receiver_cf::process_normal_burst(burst_counter burst_nr, const unsigned char * burst_binary)  {    if (burst_nr.get_timeslot_nr() == 0) { -    printf("burst = [ "); -    for (int i = 0; i < BURST_SIZE ; i++) { -      printf(" %d", pakiet[i]); -    } -    printf("];\n"); +//     printf("burst = [ "); +//     for (int i = 0; i < BURST_SIZE ; i++) { +//       printf(" %d", burst_binary[i]); +//     } +//     printf("];\n");  //     std::cout  << " t2: " << burst_nr.get_t2() << "\n"; +    GS_process(&d_gs_ctx, TIMESLOT0, 6, &burst_binary[3], burst_nr.get_frame_nr());    }  }  //TODO: this shouldn't be here also - the same reason  void gsm_receiver_cf::configure_receiver()  {    d_channel_conf.set_multiframe_type(TSC0, multiframe_51); +   +  d_channel_conf.set_burst_types(TSC0, TEST_CCH_FRAMES, sizeof(TEST_CCH_FRAMES) / sizeof(unsigned), normal_burst);    d_channel_conf.set_burst_types(TSC0, FCCH_FRAMES, sizeof(FCCH_FRAMES) / sizeof(unsigned), fcch_burst); -  d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_26); -  d_channel_conf.set_burst_types(TIMESLOT6, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), normal_burst); +   +//   d_channel_conf.set_multiframe_type(TIMESLOT6, multiframe_26); +//   d_channel_conf.set_burst_types(TIMESLOT6, TRAFFIC_CHANNEL_F, sizeof(TRAFFIC_CHANNEL_F) / sizeof(unsigned), normal_burst);  } @@ -98,6 +102,9 @@ gsm_receiver_cf::gsm_receiver_cf(gr_feval_dd *tuner, int osr)    for (i = 0; i < TRAIN_SEQ_NUM; i++) {      gmsk_mapper(train_seq[i], N_TRAIN_BITS, d_norm_training_seq[i], gr_complex(1.0, 0.0));    } +   +  /* Initialize GSM Stack */ +  GS_new(&d_gs_ctx); //TODO: remove it! it'a not right place for a decoder  }  /* diff --git a/src/lib/gsm_receiver_cf.h b/src/lib/gsm_receiver_cf.h index e48feb6..af13618 100644 --- a/src/lib/gsm_receiver_cf.h +++ b/src/lib/gsm_receiver_cf.h @@ -29,6 +29,8 @@  #include <gsm_constants.h>  #include <gsm_receiver_config.h> +#include <gsmstack.h> //TODO: remember to remove this line in the future! +  class gsm_receiver_cf;  typedef boost::shared_ptr<gsm_receiver_cf> gsm_receiver_cf_sptr; @@ -93,6 +95,9 @@ class gsm_receiver_cf : public gr_block      burst_counter d_burst_nr; ///< frame number and timeslot number      channel_configuration d_channel_conf; ///< mapping of burst_counter to burst_type      //@} +     +    // GSM Stack +    GS_CTX d_gs_ctx;//TODO: remove it! it'a not right place for a decoder      friend gsm_receiver_cf_sptr gsm_make_receiver_cf(gr_feval_dd *tuner, int osr);      gsm_receiver_cf(gr_feval_dd *tuner, int osr); @@ -204,9 +209,9 @@ class gsm_receiver_cf : public gr_block      /**       *       * @param burst_nr -     * @param pakiet +     * @param burst_binary       */ -    void process_normal_burst(burst_counter burst_nr, unsigned char * pakiet); +    void process_normal_burst(burst_counter burst_nr, const unsigned char * burst_binary);      /**       * diff --git a/src/lib/gsm_receiver_config.h b/src/lib/gsm_receiver_config.h index ebeedf7..25a3efc 100644 --- a/src/lib/gsm_receiver_config.h +++ b/src/lib/gsm_receiver_config.h @@ -33,9 +33,6 @@  #include <stdint.h>  #include <gsm_constants.h> -typedef enum {empty, fcch_burst, sch_burst, normal_burst, rach_burst, dummy} burst_type; -typedef enum {unknown, multiframe_26, multiframe_51} multiframe_type; -  class multiframe_configuration  {    private: | 
