blob: b74f9e4013fa8282968ccbb4168a53c05d543f71 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gprs_rlc.h */
2
Tom Tsou9a5bbf32016-07-14 15:13:45 -07003#pragma once
4
5#include <stdint.h>
6
Neels Hofmeyr87e45502017-06-20 00:17:59 +02007/*! Structure for CPS coding and puncturing scheme (TS 04.60 10.4.8a) */
Tom Tsou9a5bbf32016-07-14 15:13:45 -07008struct egprs_cps {
9 uint8_t bits;
10 uint8_t mcs;
11 uint8_t p[2];
12};
13
Neels Hofmeyr87e45502017-06-20 00:17:59 +020014/*! CPS puncturing table selection (TS 04.60 10.4.8a) */
Tom Tsou9a5bbf32016-07-14 15:13:45 -070015enum egprs_cps_punc {
16 EGPRS_CPS_P1,
17 EGPRS_CPS_P2,
18 EGPRS_CPS_P3,
19 EGPRS_CPS_NONE = -1,
20};
21
Neels Hofmeyr87e45502017-06-20 00:17:59 +020022/*! EGPRS header types (TS 04.60 10.0a.2) */
Tom Tsou9a5bbf32016-07-14 15:13:45 -070023enum egprs_hdr_type {
24 EGPRS_HDR_TYPE1,
25 EGPRS_HDR_TYPE2,
26 EGPRS_HDR_TYPE3,
27};
28
Harald Welte35b26322017-07-31 19:36:52 +020029enum osmo_gprs_cs {
30 OSMO_GPRS_CS_NONE,
31 OSMO_GPRS_CS1,
32 OSMO_GPRS_CS2,
33 OSMO_GPRS_CS3,
34 OSMO_GPRS_CS4,
35 OSMO_GPRS_MCS1,
36 OSMO_GPRS_MCS2,
37 OSMO_GPRS_MCS3,
38 OSMO_GPRS_MCS4,
39 OSMO_GPRS_MCS5,
40 OSMO_GPRS_MCS6,
41 OSMO_GPRS_MCS7,
42 OSMO_GPRS_MCS8,
43 OSMO_GPRS_MCS9,
44 _NUM_OSMO_GPRS_CS
45};
46
Tom Tsou9a5bbf32016-07-14 15:13:45 -070047int egprs_get_cps(struct egprs_cps *cps, uint8_t type, uint8_t bits);
Harald Welte35b26322017-07-31 19:36:52 +020048
49int osmo_gprs_ul_block_size_bits(enum osmo_gprs_cs cs);
50int osmo_gprs_dl_block_size_bits(enum osmo_gprs_cs cs);
51int osmo_gprs_ul_block_size_bytes(enum osmo_gprs_cs cs);
52int osmo_gprs_dl_block_size_bytes(enum osmo_gprs_cs cs);
53enum osmo_gprs_cs osmo_gprs_ul_cs_by_block_bytes(uint8_t block_size);
54enum osmo_gprs_cs osmo_gprs_dl_cs_by_block_bytes(uint8_t block_size);