summaryrefslogtreecommitdiff
path: root/gsm-tvoid/src/lib/cch.c
diff options
context:
space:
mode:
authortvoid <tvoid@lesaige.com>2008-04-25 13:53:28 -0600
committertvoid <tvoid@lesaige.com>2008-04-25 13:53:28 -0600
commit3f97e0be9f90c505f34afa8371c25a0ffa3e97c1 (patch)
treeed3d0d003578308b37f1012621dfa16429ee7c3a /gsm-tvoid/src/lib/cch.c
parente4e5a96c7b587439129d9ed35dc15017344cd250 (diff)
parent5c781454444452d2eb02081c10ab4fdb4f8ac7f9 (diff)
Merge commit 'origin/HEAD' into 20080415
Conflicts: gsm-tvoid/src/lib/Makefile.am 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_cf.h gsm-tvoid/src/python/gsm_scan.py
Diffstat (limited to 'gsm-tvoid/src/lib/cch.c')
-rw-r--r--gsm-tvoid/src/lib/cch.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gsm-tvoid/src/lib/cch.c b/gsm-tvoid/src/lib/cch.c
index 8907a09..17ee4ee 100644
--- a/gsm-tvoid/src/lib/cch.c
+++ b/gsm-tvoid/src/lib/cch.c
@@ -11,7 +11,7 @@
#include <math.h>
#include "burst_types.h"
#include "cch.h"
-//#include "fire_crc.h"
+#include "fire_crc.h"
/*
* GSM SACCH -- Slow Associated Control Channel
@@ -385,6 +385,7 @@ static unsigned char *decode_sacch(GS_CTX *ctx, unsigned char *burst, unsigned i
int errors, len, data_size;
unsigned char conv_data[CONV_SIZE], iBLOCK[BLOCKS][iBLOCK_SIZE],
hl, hn, decoded_data[PARITY_OUTPUT_SIZE];
+ FC_CTX fc_ctx;
data_size = sizeof ctx->msg;
if(datalen)
@@ -410,22 +411,18 @@ static unsigned char *decode_sacch(GS_CTX *ctx, unsigned char *burst, unsigned i
// If parity check error detected try to fix it.
if (parity_check(decoded_data))
{
- return NULL;
- /* FIXME: impelment fire crc in C */
-#if 0
- fire_crc crc(40, 184);
- // fprintf(stderr, "error: sacch: parity error (%d)\n", errors);
+ FC_init(&fc_ctx, 40, 184);
unsigned char crc_result[224];
- if (crc.check_crc(decoded_data, crc_result) == 0)
+ if (FC_check_crc(&fc_ctx, decoded_data, crc_result) == 0)
{
errors = -1;
DEBUGF("error: sacch: parity error (%d)\n", errors);
return NULL;
} else {
+ DEBUGF("Successfully corrected parity bits!\n");
memcpy(decoded_data, crc_result, sizeof crc_result);
errors = 0;
}
-#endif
}
if((len = compress_bits(ctx->msg, data_size, decoded_data,
personal git repositories of Harald Welte. Your mileage may vary