blob: efd5615b86f25709ac9092a82564c253c02fb617 [file] [log] [blame]
piotrfaacc722014-07-20 23:48:32 +02001//TODO: this file shouldn't be part of the GSM Receiver
2#ifndef __GSMSTACK_CCH_H__
3#define __GSMSTACK_CCH_H__ 1
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9//#include "gsmstack.h"
10
11/*
12 * decode_cch
13 *
14 * Decode a "common" control channel. Most control channels use
15 * the same burst, interleave, Viterbi and parity configuration.
16 * The documentation for the control channels defines SACCH first
17 * and then just keeps referring to that.
18 *
19 * The current (investigated) list is as follows:
20 *
21 * BCCH Norm
22 * BCCH Ext
23 * PCH
24 * AGCH
25 * CBCH (SDCCH/4)
26 * CBCH (SDCCH/8)
27 * SDCCH/4
28 * SACCH/C4
29 * SDCCH/8
30 * SACCH/C8
31 *
32 * We provide two functions, one for where all four bursts are
33 * contiguous, and one where they aren't.
34 */
35
36#define DATA_BLOCK_SIZE 184
37#define PARITY_SIZE 40
38#define FLUSH_BITS_SIZE 4
39#define PARITY_OUTPUT_SIZE (DATA_BLOCK_SIZE + PARITY_SIZE + FLUSH_BITS_SIZE)
40
41#define CONV_INPUT_SIZE PARITY_OUTPUT_SIZE
42#define CONV_SIZE (2 * CONV_INPUT_SIZE)
43
44#define BLOCKS 4
45#define iBLOCK_SIZE (CONV_SIZE / BLOCKS)
46#define eBLOCK_SIZE (iBLOCK_SIZE + 2)
47
48int conv_decode(unsigned char *output, unsigned char *data);
49int parity_check(unsigned char *d);
50//unsigned char *decode_cch(GS_CTX *ctx, unsigned char *burst, unsigned int *len);
51//unsigned char *decode_facch(GS_CTX *ctx, unsigned char *burst, unsigned int *len, int offset);
52//unsigned char *decode_cch(GS_CTX *ctx, unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned int *len);
53//unsigned char *decode_cch(GS_CTX *ctx, unsigned char *, unsigned int *);
54
55#ifdef __cplusplus
56}
57#endif
58
59#endif