aboutsummaryrefslogtreecommitdiffstats
path: root/src/amps/frame.h
blob: c8195cb4c3667beb3b224702473ad19cbcb16a7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
enum amps_ie {
	AMPS_IE_010111,
	AMPS_IE_1,
	AMPS_IE_11,
	AMPS_IE_1111,
	AMPS_IE_ACT,
	AMPS_IE_AUTH,
	AMPS_IE_AUTHBS,
	AMPS_IE_AUTHR,
	AMPS_IE_AUTHU,
	AMPS_IE_Acked_Data,
	AMPS_IE_Async_Data,
	AMPS_IE_BIS,
	AMPS_IE_BSCAP,
	AMPS_IE_BSPC,
	AMPS_IE_CHAN,
	AMPS_IE_CHANPOS,
	AMPS_IE_CHARACTER_1,
	AMPS_IE_CHARACTER_2,
	AMPS_IE_CHARACTER_3,
	AMPS_IE_CMAC,
	AMPS_IE_CMAX_1,
	AMPS_IE_COUNT,
	AMPS_IE_CPA,
	AMPS_IE_CPN_RL,
	AMPS_IE_CRC,
	AMPS_IE_CRI_E11,
	AMPS_IE_CRI_E12,
	AMPS_IE_CRI_E13,
	AMPS_IE_CRI_E14,
	AMPS_IE_CRI_E21,
	AMPS_IE_CRI_E22,
	AMPS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UREG,
	AMPS_IE_PVI,
	AMPS_IE_RAND1_A,
	AMPS_IE_RAND1_B,
	AMPS_IE_RANDBS,
	AMPS_IE_RANDC,
	AMPS_IE_RANDSSD_1,
	AMPS_IE_RANDSSD_2,
	AMPS_IE_RANDSSD_3,
	AMPS_IE_RANDU,
	AMPS_IE_RCF,
	AMPS_IE_REGH,
	AMPS_IE_REGID,
	AMPS_IE_REGINCR,
	AMPS_IE_REGR,
	AMPS_IE_RLP,
	AMPS_IE_RL_W,
	AMPS_IE_RSVD,
	AMPS_IE_S,
	AMPS_IE_SAP,
	AMPS_IE_SBI,
	AMPS_IE_SCC,
	AMPS_IE_SCM,
	AMPS_IE_SDCC1,
	AMPS_IE_SDCC2,
	AMPS_IE_SI,
	AMPS_IE_SID1,
	AMPS_IE_SIGNAL,
	AMPS_IE_Service_Code,
	AMPS_IE_T,
	AMPS_IE_T1T2,
	AMPS_IE_TA,
	AMPS_IE_TCI1,
	AMPS_IE_TCI21,
	AMPS_IE_TCI22,
	AMPS_IE_TCI23,
	AMPS_IE_TCI24,
	AMPS_IE_TCI31,
	AMPS_IE_TCI32,
	AMPS_IE_TCI33,
	AMPS_IE_TCI34,
	AMPS_IE_TCI41,
	AMPS_IE_TCI42,
	AMPS_IE_TCI43,
	AMPS_IE_TCI44,
	AMPS_IE_TCI5,
	AMPS_IE_VMAC,
	AMPS_IE_WFOM,
	AMPS_IE_NUM
};

typedef struct amps_frame {
	enum amps_ie	ie[AMPS_IE_NUM];
} frame_t;

void init_frame(void);
uint64_t amps_encode_word1_system(uint8_t dcc, uint16_t sid1, uint8_t ep, uint8_t auth, uint8_t pci, uint8_t nawc);
uint64_t amps_encode_word2_system(uint8_t dcc, uint8_t s, uint8_t e, uint8_t regh, uint8_t regr, uint8_t dtx, uint8_t n_1, uint8_t rcf, uint8_t cpa, uint8_t cmax_1, uint8_t end);
uint64_t amps_encode_registration_id(uint8_t dcc, uint32_t regid, uint8_t end);
uint64_t amps_encode_registration_increment(uint8_t dcc, uint16_t regincr, uint8_t end);
uint64_t amps_encode_location_area(uint8_t dcc, uint8_t pureg, uint8_t pdreg, uint8_t lreg, uint16_t locaid, uint8_t end);
uint64_t amps_encode_new_access_channel_set(uint8_t dcc, uint16_t newacc, uint8_t end);
uint64_t amps_encode_overload_control(uint8_t dcc, uint8_t *olc, uint8_t end);
uint64_t amps_encode_access_type(uint8_t dcc, uint8_t bis, uint8_t pci_home, uint8_t pci_roam, uint8_t bspc, uint8_t bscap, uint8_t end);
uint64_t amps_encode_access_attempt(uint8_t dcc, uint8_t maxbusy_pgr, uint8_t maxsztr_pgr, uint8_t maxbusy_other, uint8_t maxsztr_other, uint8_t end);
const char *amps_encode_frame_focc(amps_t *amps);
const char *amps_encode_frame_fvc(amps_t *amps);
int amps_decode_frame(amps_t *amps, const char *bits, int count, double level, double quality, int negative);