blob: 24db86de414cdfbbeddf78cf6b6670901192281f [file] [log] [blame]
Maxbea2edb2019-03-06 17:04:59 +01001/* coding_scheme.h
2 *
3 * Copyright (C) 2015-2019 by sysmocom s.f.m.c. GmbH
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#pragma once
21
Max136ebcc2019-03-05 14:59:03 +010022#include <osmocom/core/utils.h>
23
Maxbea2edb2019-03-06 17:04:59 +010024enum CodingScheme {
25 UNKNOWN,
26 /* GPRS Coding Schemes: */
27 CS1, CS2, CS3, CS4,
28 /* EDGE/EGPRS Modulation and Coding Schemes: */
29 MCS1, MCS2, MCS3, MCS4, MCS5, MCS6, MCS7, MCS8, MCS9,
30 NUM_SCHEMES
31};
Max51754b62019-03-13 17:14:13 +010032
Max136ebcc2019-03-05 14:59:03 +010033extern const struct value_string mcs_names[];
34const char *mcs_name(enum CodingScheme val);
Max902e3e52019-03-25 16:38:53 +010035enum CodingScheme get_retx_mcs(enum CodingScheme initial_mcs, enum CodingScheme commanded_mcs, bool resegment_bit);
Max136ebcc2019-03-05 14:59:03 +010036
Max8a8e0fb2019-03-25 16:32:50 +010037bool mcs_is_gprs(enum CodingScheme cs);
38bool mcs_is_edge(enum CodingScheme cs);
39bool mcs_is_edge_gmsk(enum CodingScheme cs);
40
Max898dddb2019-03-12 15:50:57 +010041uint8_t mcs_chan_code(enum CodingScheme cs);
42
Max51754b62019-03-13 17:14:13 +010043enum HeaderType {
44 HEADER_INVALID,
45 HEADER_GPRS_CONTROL,
46 HEADER_GPRS_DATA,
47 HEADER_EGPRS_DATA_TYPE_1,
48 HEADER_EGPRS_DATA_TYPE_2,
49 HEADER_EGPRS_DATA_TYPE_3,
50 NUM_HEADER_TYPES
51};
52
53enum HeaderType headerTypeData(enum CodingScheme mcs);
54
55uint8_t num_data_blocks(enum HeaderType ht);
56uint8_t num_data_header_bits_UL(enum HeaderType ht);
57uint8_t num_data_header_bits_DL(enum HeaderType ht);
58uint8_t num_data_block_header_bits(enum HeaderType ht);
Maxa4de02d2019-03-13 16:35:09 +010059
60enum mcs_kind {
61 GPRS,
62 EGPRS_GMSK,
63 EGPRS,
64};
65
66const char *mode_name(enum mcs_kind val);