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