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