blob: aac4bba155e1c3447c232c566b7550ddf37f33e3 [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);
35
Max8a8e0fb2019-03-25 16:32:50 +010036bool mcs_is_gprs(enum CodingScheme cs);
37bool mcs_is_edge(enum CodingScheme cs);
38bool mcs_is_edge_gmsk(enum CodingScheme cs);
39
Max898dddb2019-03-12 15:50:57 +010040uint8_t mcs_chan_code(enum CodingScheme cs);
41
Max51754b62019-03-13 17:14:13 +010042enum HeaderType {
43 HEADER_INVALID,
44 HEADER_GPRS_CONTROL,
45 HEADER_GPRS_DATA,
46 HEADER_EGPRS_DATA_TYPE_1,
47 HEADER_EGPRS_DATA_TYPE_2,
48 HEADER_EGPRS_DATA_TYPE_3,
49 NUM_HEADER_TYPES
50};
51
52enum HeaderType headerTypeData(enum CodingScheme mcs);
53
54uint8_t num_data_blocks(enum HeaderType ht);
55uint8_t num_data_header_bits_UL(enum HeaderType ht);
56uint8_t num_data_header_bits_DL(enum HeaderType ht);
57uint8_t num_data_block_header_bits(enum HeaderType ht);
Maxa4de02d2019-03-13 16:35:09 +010058
59enum mcs_kind {
60 GPRS,
61 EGPRS_GMSK,
62 EGPRS,
63};
64
65const char *mode_name(enum mcs_kind val);