Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 1 | /* 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 | |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 22 | #include <osmocom/core/utils.h> |
| 23 | |
Max | bea2edb | 2019-03-06 17:04:59 +0100 | [diff] [blame] | 24 | enum 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 | }; |
Max | 51754b6 | 2019-03-13 17:14:13 +0100 | [diff] [blame] | 32 | |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 33 | extern const struct value_string mcs_names[]; |
| 34 | const char *mcs_name(enum CodingScheme val); |
Max | 902e3e5 | 2019-03-25 16:38:53 +0100 | [diff] [blame] | 35 | enum CodingScheme get_retx_mcs(enum CodingScheme initial_mcs, enum CodingScheme commanded_mcs, bool resegment_bit); |
Max | 136ebcc | 2019-03-05 14:59:03 +0100 | [diff] [blame] | 36 | |
Max | 8a8e0fb | 2019-03-25 16:32:50 +0100 | [diff] [blame] | 37 | bool mcs_is_gprs(enum CodingScheme cs); |
| 38 | bool mcs_is_edge(enum CodingScheme cs); |
| 39 | bool mcs_is_edge_gmsk(enum CodingScheme cs); |
| 40 | |
Max | 898dddb | 2019-03-12 15:50:57 +0100 | [diff] [blame] | 41 | uint8_t mcs_chan_code(enum CodingScheme cs); |
| 42 | |
Max | 51754b6 | 2019-03-13 17:14:13 +0100 | [diff] [blame] | 43 | enum 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 | |
| 53 | enum HeaderType headerTypeData(enum CodingScheme mcs); |
| 54 | |
| 55 | uint8_t num_data_blocks(enum HeaderType ht); |
| 56 | uint8_t num_data_header_bits_UL(enum HeaderType ht); |
| 57 | uint8_t num_data_header_bits_DL(enum HeaderType ht); |
| 58 | uint8_t num_data_block_header_bits(enum HeaderType ht); |
Max | a4de02d | 2019-03-13 16:35:09 +0100 | [diff] [blame] | 59 | |
| 60 | enum mcs_kind { |
| 61 | GPRS, |
| 62 | EGPRS_GMSK, |
| 63 | EGPRS, |
| 64 | }; |
| 65 | |
| 66 | const char *mode_name(enum mcs_kind val); |