blob: 5e3e9dbe90c14da023ae1176f00ec892b54dceca [file] [log] [blame]
Piotr Krysika6268a52017-08-23 16:02:19 +02001/*
2 * (C) 2013 by Andreas Eversberg <jolly@eversberg.eu>
3 * (C) 2015 by Alexander Chemeris <Alexander.Chemeris@fairwaves.co>
4 * (C) 2016 by Tom Tsou <tom.tsou@ettus.com>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
Piotr Krysik70c25a12017-01-03 08:01:23 +010023#pragma once
24
25#include <stdint.h>
26#include <osmocom/core/bits.h>
27
28#define GSM0503_GPRS_BURSTS_NBITS (116 * 4)
29#define GSM0503_EGPRS_BURSTS_NBITS (348 * 4)
30#define NUM_BYTES(N) ((N + 8 - 1) / 8)
31
32
33
34int gsm0503_xcch_encode(ubit_t *bursts, uint8_t *l2_data);
35int gsm0503_xcch_decode(uint8_t *l2_data, sbit_t *bursts,
36 int *n_errors, int *n_bits_total);
37
38int gsm0503_pdtch_encode(ubit_t *bursts, uint8_t *l2_data, uint8_t l2_len);
39int gsm0503_pdtch_decode(uint8_t *l2_data, sbit_t *bursts, uint8_t *usf_p,
40 int *n_errors, int *n_bits_total);
41
42int gsm0503_tch_fr_encode(ubit_t *bursts, uint8_t *tch_data, int len,
43 int net_order);
44int gsm0503_tch_fr_decode(uint8_t *tch_data, sbit_t *bursts, int net_order,
45 int efr, int *n_errors, int *n_bits_total);
46
47int gsm0503_tch_hr_encode(ubit_t *bursts, uint8_t *tch_data, int len);
48int gsm0503_tch_hr_decode(uint8_t *tch_data, sbit_t *bursts, int odd,
49 int *n_errors, int *n_bits_total);
50
51int gsm0503_tch_afs_encode(ubit_t *bursts, uint8_t *tch_data, int len,
52 int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft,
53 uint8_t cmr);
54int gsm0503_tch_afs_decode(uint8_t *tch_data, sbit_t *bursts,
55 int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft,
56 uint8_t *cmr, int *n_errors, int *n_bits_total);
57
58int gsm0503_tch_ahs_encode(ubit_t *bursts, uint8_t *tch_data, int len,
59 int codec_mode_req, uint8_t *codec, int codecs, uint8_t ft, uint8_t cmr);
60int gsm0503_tch_ahs_decode(uint8_t *tch_data, sbit_t *bursts, int odd,
61 int codec_mode_req, uint8_t *codec, int codecs, uint8_t *ft,
62 uint8_t *cmr, int *n_errors, int *n_bits_total);
63
64int gsm0503_rach_encode(ubit_t *burst, uint8_t *ra, uint8_t bsic);
65int gsm0503_rach_decode(uint8_t *ra, sbit_t *burst, uint8_t bsic);
66
67int gsm0503_sch_encode(ubit_t *burst, uint8_t *sb_info);
68int gsm0503_sch_decode(uint8_t *sb_info, sbit_t *burst);