blob: 96e9ab786050184fb93a82e12bb9dd80324b25c0 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_04_60.h
2 * General Packet Radio Service (GPRS).
Tom Tsou9394dbd2016-07-07 17:06:12 -07003 * Radio Link Control / Medium Access Control (RLC/MAC) protocol
4 * 3GPP TS 04.60 version 8.27.0 Release 1999
5 */
6
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02007#pragma once
8
Tom Tsou9394dbd2016-07-07 17:06:12 -07009#include <stdint.h>
10
11#if OSMO_IS_LITTLE_ENDIAN == 1
12/* TS 04.60 10.3a.4.1.1 */
13struct gprs_rlc_ul_header_egprs_1 {
14 uint8_t r:1,
15 si:1,
16 cv:4,
17 tfi_hi:2;
18 uint8_t tfi_lo:3,
19 bsn1_hi:5;
20 uint8_t bsn1_lo:6,
21 bsn2_hi:2;
22 uint8_t bsn2_lo:8;
23 uint8_t cps:5,
24 rsb:1,
25 pi:1,
26 spare_hi:1;
27 uint8_t spare_lo:6,
28 dummy:2;
29} __attribute__ ((packed));
30
31/* TS 04.60 10.3a.4.2.1 */
32struct gprs_rlc_ul_header_egprs_2 {
33 uint8_t r:1,
34 si:1,
35 cv:4,
36 tfi_hi:2;
37 uint8_t tfi_lo:3,
38 bsn1_hi:5;
39 uint8_t bsn1_lo:6,
40 cps_hi:2;
41 uint8_t cps_lo:1,
42 rsb:1,
43 pi:1,
44 spare_hi:5;
45 uint8_t spare_lo:5,
46 dummy:3;
47} __attribute__ ((packed));
48
49/* TS 04.60 10.3a.4.3.1 */
50struct gprs_rlc_ul_header_egprs_3 {
51 uint8_t r:1,
52 si:1,
53 cv:4,
54 tfi_hi:2;
55 uint8_t tfi_lo:3,
56 bsn1_hi:5;
57 uint8_t bsn1_lo:6,
58 cps_hi:2;
59 uint8_t cps_lo:2,
60 spb:2,
61 rsb:1,
62 pi:1,
63 spare:1,
64 dummy:1;
65} __attribute__ ((packed));
66
67struct gprs_rlc_dl_header_egprs_1 {
68 uint8_t usf:3,
69 es_p:2,
70 rrbp:2,
71 tfi_hi:1;
72 uint8_t tfi_lo:4,
73 pr:2,
74 bsn1_hi:2;
75 uint8_t bsn1_mid:8;
76 uint8_t bsn1_lo:1,
77 bsn2_hi:7;
78 uint8_t bsn2_lo:3,
79 cps:5;
80} __attribute__ ((packed));
81
82struct gprs_rlc_dl_header_egprs_2 {
83 uint8_t usf:3,
84 es_p:2,
85 rrbp:2,
86 tfi_hi:1;
87 uint8_t tfi_lo:4,
88 pr:2,
89 bsn1_hi:2;
90 uint8_t bsn1_mid:8;
91 uint8_t bsn1_lo:1,
92 cps:3,
93 dummy:4;
94} __attribute__ ((packed));
95
96struct gprs_rlc_dl_header_egprs_3 {
97 uint8_t usf:3,
98 es_p:2,
99 rrbp:2,
100 tfi_hi:1;
101 uint8_t tfi_lo:4,
102 pr:2,
103 bsn1_hi:2;
104 uint8_t bsn1_mid:8;
105 uint8_t bsn1_lo:1,
106 cps:4,
107 spb:2,
108 dummy:1;
109} __attribute__ ((packed));
110#else
111/* TS 04.60 10.3a.4.1.1 */
112struct gprs_rlc_ul_header_egprs_1 {
113 uint8_t tfi_hi:2,
114 cv:4,
115 si:1,
116 r:1;
117 uint8_t bsn1_hi:5,
118 tfi_lo:3;
119 uint8_t bsn2_hi:2,
120 bsn1_lo:6;
121 uint8_t bsn2_lo:8;
122 uint8_t spare_hi:1,
123 pi:1,
124 rsb:1,
125 cps:5;
126 uint8_t dummy:2,
127 spare_lo:6;
128} __attribute__ ((packed));
129
130/* TS 04.60 10.3a.4.2.1 */
131struct gprs_rlc_ul_header_egprs_2 {
132 uint8_t tfi_hi:2,
133 cv:4,
134 si:1,
135 r:1;
136 uint8_t bsn1_hi:5,
137 tfi_lo:3;
138 uint8_t cps_hi:2,
139 bsn1_lo:6;
140 uint8_t spare_hi:5,
141 pi:1,
142 rsb:1,
143 cps_lo:1;
144 uint8_t dummy:3,
145 spare_lo:5;
146} __attribute__ ((packed));
147
148/* TS 04.60 10.3a.4.3.1 */
149struct gprs_rlc_ul_header_egprs_3 {
150 uint8_t tfi_hi:2,
151 cv:4,
152 si:1,
153 r:1;
154 uint8_t bsn1_hi:5,
155 tfi_lo:3;
156 uint8_t cps_hi:2,
157 bsn1_lo:6;
158 uint8_t dummy:1,
159 spare:1,
160 pi:1,
161 rsb:1,
162 spb:2,
163 cps_lo:2;
164} __attribute__ ((packed));
165
166struct gprs_rlc_dl_header_egprs_1 {
167 uint8_t tfi_hi:1,
168 rrbp:2,
169 es_p:2,
170 usf:3;
171 uint8_t bsn1_hi:2,
172 pr:2,
173 tfi_lo:4;
174 uint8_t bsn1_mid:8;
175 uint8_t bsn2_hi:7,
176 bsn1_lo:1;
177 uint8_t cps:5,
178 bsn2_lo:3;
179} __attribute__ ((packed));
180
181struct gprs_rlc_dl_header_egprs_2 {
182 uint8_t tfi_hi:1,
183 rrbp:2,
184 es_p:2,
185 usf:3;
186 uint8_t bsn1_hi:2,
187 pr:2,
188 tfi_lo:4;
189 uint8_t bsn1_mid:8;
190 uint8_t dummy:4,
191 cps:3,
192 bsn1_lo:1;
193} __attribute__ ((packed));
194
195struct gprs_rlc_dl_header_egprs_3 {
196 uint8_t tfi_hi:1,
197 rrbp:2,
198 es_p:2,
199 usf:3;
200 uint8_t bsn1_hi:2,
201 pr:2,
202 tfi_lo:4;
203 uint8_t bsn1_mid:8;
204 uint8_t dummy:1,
205 spb:2,
206 cps:4,
207 bsn1_lo:1;
208} __attribute__ ((packed));
209#endif