aboutsummaryrefslogtreecommitdiffstats
path: root/src/rlc.h
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-08 15:14:05 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-12-16 19:36:09 +0100
commit4abc686d76b1d74ba07939f5e586842c68c37e25 (patch)
treea73951c8ca663a7878d24f0369faae7ff9953553 /src/rlc.h
parent392a5453361d639abe3eb50ec5ea7ace1595af04 (diff)
edge: Add unified decoder methods for GPRS/EGPRS
This commit adds new RLC block decoder functions that support both GPRS and EGPRS. The code path is selected based on the value of the GprsCodingScheme cs object. - rlc_parse_ul_data_header parses the header of an RLC data block including the E and FBI/TI flags (currently supported CS-1 - CS-4, MCS-1 - MCS-4). - rlc_copy_to_aligned_buffer copies an RLC data unit to a byte aligned buffer and returns the unit's length. - rlc_get_data_aligned is a convenience wrapper around rlc_copy_to_aligned_buffer that avoids copying if the data unit is already byte aligned. Sponsored-by: On-Waves ehf
Diffstat (limited to 'src/rlc.h')
-rw-r--r--src/rlc.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/rlc.h b/src/rlc.h
index 89af2197..bafe6a88 100644
--- a/src/rlc.h
+++ b/src/rlc.h
@@ -19,6 +19,8 @@
*/
#pragma once
+#include "gprs_coding_scheme.h"
+
#include <osmocom/core/endian.h>
#include <stdint.h>
@@ -53,6 +55,28 @@ static inline uint16_t mod_sns_half()
return (RLC_MAX_SNS / 2) - 1;
}
+struct gprs_rlc_ul_data_block_info {
+ unsigned int data_len; /* EGPRS: N2, GPRS: N2-2, N-2 */
+ unsigned int bsn;
+ unsigned int ti;
+ unsigned int e;
+ unsigned int cv;
+ unsigned int pi;
+ unsigned int spb;
+};
+
+struct gprs_rlc_ul_header_egprs {
+ GprsCodingScheme cs;
+ unsigned int r;
+ unsigned int si;
+ unsigned int tfi;
+ unsigned int cps;
+ unsigned int rsb;
+ unsigned int num_data_blocks;
+ unsigned int data_offs_bits[2];
+ struct gprs_rlc_ul_data_block_info block_info[2];
+};
+
struct gprs_rlc_data {
uint8_t *prepare(size_t block_data_length);
void put_data(const uint8_t *data, size_t len);
@@ -219,6 +243,28 @@ struct rlc_li_field {
m:1,
li:6;
} __attribute__ ((packed));
+
+struct rlc_li_field_egprs {
+ uint8_t e:1,
+ li:7;
+} __attribute__ ((packed));
+
+struct gprs_rlc_ul_header_egprs_3 {
+ uint8_t r:1,
+ si:1,
+ cv:4,
+ tfi_a:2;
+ uint8_t tfi_b:3,
+ bsn1_a:5;
+ uint8_t bsn1_b:6,
+ cps_a:2;
+ uint8_t cps_b:2,
+ spb:2,
+ rsb:1,
+ pi:1,
+ spare:1,
+ dummy:1;
+} __attribute__ ((packed));
#else
# error "Only little endian headers are supported yet. TODO: add missing structs"
#endif