treewide: remove FSF address
[osmocom-bb.git] / src / target / firmware / board / se_j100 / tx_ramps.c
blob387febb9a7e993a1e549e143faf11b2d2d5fe7ee
1 /*
2 * This code was written by Mychaela Falconia <falcon@freecalypso.org>
3 * who refuses to claim copyright on it and has released it as public domain
4 * instead. NO rights reserved, all rights relinquished.
6 * Tweaked (coding style changes) by Vadim Yanitskiy <axilirator@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
20 #include <stdint.h>
21 #include <rf/txcal.h>
24 * The APC offset value used by SE J100 official fw is different from the
25 * Mot C1xx value, and this different APC offset value must be used by any
26 * aftermarket fw on this target in order for the Tx levels from Compal's
27 * factory records to apply correctly. This correct value has been determined
28 * by breaking into a running SE J100 fw with tfc139, running fc-loadtool
29 * with all ABB register state still intact from the interrupted official fw,
30 * and reading the APCOFF register with the abbr command.
32 uint8_t apc_offset = 52;
35 * The following tables of Tx ramp templates have been extracted from
36 * SE J100 fw version R1C004 (R1C004-se.bin in the j100-flashimg-r1.zip
37 * FTP release); Compal's modified versions of TI's rf_XXX structures
38 * begin at address 0x5E898 in this J100 fw version.
40 * Please note that these SE J100 Tx ramp templates are different from
41 * both C11x/12x/155/156 (SKY77324) and C139/140 (SKY77325) versions.
43 struct txcal_ramp_def rf_tx_ramps_850[RF_TX_RAMP_SIZE] = {
44 { /* profile 0 */
45 /* ramp-up */
46 { 1, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0, 0},
47 /* ramp-down */
48 { 15, 31, 31, 20, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
50 { /* profile 1 */
51 /* ramp-up */
52 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
53 /* ramp-down */
54 { 20, 31, 31, 15, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
56 { /* profile 2 */
57 /* ramp-up */
58 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
59 /* ramp-down */
60 { 25, 31, 31, 10, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
62 { /* profile 3 */
63 /* ramp-up */
64 { 1, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0, 0},
65 /* ramp-down */
66 { 29, 31, 31, 31, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
68 { /* profile 4 */
69 /* ramp-up */
70 { 1, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0, 0},
71 /* ramp-down */
72 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
74 { /* profile 5 */
75 /* ramp-up */
76 { 1, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0, 0},
77 /* ramp-down */
78 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
80 { /* profile 6 */
81 /* ramp-up */
82 { 1, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0, 0},
83 /* ramp-down */
84 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
86 { /* profile 7 */
87 /* ramp-up */
88 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
89 /* ramp-down */
90 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
92 { /* profile 8 */
93 /* ramp-up */
94 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
95 /* ramp-down */
96 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
98 { /* profile 9 */
99 /* ramp-up */
100 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
101 /* ramp-down */
102 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
104 { /* profile 10 */
105 /* ramp-up */
106 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
107 /* ramp-down */
108 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
110 { /* profile 11 */
111 /* ramp-up */
112 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
113 /* ramp-down */
114 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
116 { /* profile 12 */
117 /* ramp-up */
118 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
119 /* ramp-down */
120 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
122 { /* profile 13 */
123 /* ramp-up */
124 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
125 /* ramp-down */
126 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
128 { /* profile 14 */
129 /* ramp-up */
130 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
131 /* ramp-down */
132 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
134 { /* profile 15 */
135 /* ramp-up */
136 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
137 /* ramp-down */
138 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
142 struct txcal_ramp_def rf_tx_ramps_900[RF_TX_RAMP_SIZE] = {
143 { /* profile 0 */
144 /* ramp-up */
145 { 1, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0, 0},
146 /* ramp-down */
147 { 25, 25, 31, 16, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
149 { /* profile 1 */
150 /* ramp-up */
151 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
152 /* ramp-down */
153 { 27, 31, 31, 8, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
155 { /* profile 2 */
156 /* ramp-up */
157 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
158 /* ramp-down */
159 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
161 { /* profile 3 */
162 /* ramp-up */
163 { 1, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0, 0},
164 /* ramp-down */
165 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
167 { /* profile 4 */
168 /* ramp-up */
169 { 1, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0, 0},
170 /* ramp-down */
171 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
173 { /* profile 5 */
174 /* ramp-up */
175 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
176 /* ramp-down */
177 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
179 { /* profile 6 */
180 /* ramp-up */
181 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
182 /* ramp-down */
183 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
185 { /* profile 7 */
186 /* ramp-up */
187 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
188 /* ramp-down */
189 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
191 { /* profile 8 */
192 /* ramp-up */
193 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
194 /* ramp-down */
195 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
197 { /* profile 9 */
198 /* ramp-up */
199 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
200 /* ramp-down */
201 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
203 { /* profile 10 */
204 /* ramp-up */
205 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
206 /* ramp-down */
207 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
209 { /* profile 11 */
210 /* ramp-up */
211 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
212 /* ramp-down */
213 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
215 { /* profile 12 */
216 /* ramp-up */
217 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
218 /* ramp-down */
219 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
221 { /* profile 13 */
222 /* ramp-up */
223 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
224 /* ramp-down */
225 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
227 { /* profile 14 */
228 /* ramp-up */
229 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
230 /* ramp-down */
231 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
233 { /* profile 15 */
234 /* ramp-up */
235 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
236 /* ramp-down */
237 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
241 struct txcal_ramp_def rf_tx_ramps_1800[RF_TX_RAMP_SIZE] = {
242 { /* profile 0 */
243 /* ramp-up */
244 { 1, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0, 0},
245 /* ramp-down */
246 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
248 { /* profile 1 */
249 /* ramp-up */
250 { 1, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0, 0},
251 /* ramp-down */
252 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
254 { /* profile 2 */
255 /* ramp-up */
256 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
257 /* ramp-down */
258 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
260 { /* profile 3 */
261 /* ramp-up */
262 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 31, 31, 4, 0, 0},
263 /* ramp-down */
264 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
266 { /* profile 4 */
267 /* ramp-up */
268 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 30, 31, 31, 31, 4, 0, 0},
269 /* ramp-down */
270 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
272 { /* profile 5 */
273 /* ramp-up */
274 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
275 /* ramp-down */
276 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
278 { /* profile 6 */
279 /* ramp-up */
280 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
281 /* ramp-down */
282 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
284 { /* profile 7 */
285 /* ramp-up */
286 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
287 /* ramp-down */
288 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
290 { /* profile 8 */
291 /* ramp-up */
292 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
293 /* ramp-down */
294 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
296 { /* profile 9 */
297 /* ramp-up */
298 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
299 /* ramp-down */
300 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
302 { /* profile 10 */
303 /* ramp-up */
304 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
305 /* ramp-down */
306 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
308 { /* profile 11 */
309 /* ramp-up */
310 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
311 /* ramp-down */
312 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
314 { /* profile 12 */
315 /* ramp-up */
316 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0},
317 /* ramp-down */
318 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
320 { /* profile 13 */
321 /* ramp-up */
322 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0},
323 /* ramp-down */
324 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
326 { /* profile 14 */
327 /* ramp-up */
328 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0},
329 /* ramp-down */
330 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
332 { /* profile 15 */
333 /* ramp-up */
334 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0},
335 /* ramp-down */
336 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
340 struct txcal_ramp_def rf_tx_ramps_1900[RF_TX_RAMP_SIZE] = {
341 { /* profile 0 */
342 /* ramp-up */
343 { 1, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0, 0},
344 /* ramp-down */
345 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
347 { /* profile 1 */
348 /* ramp-up */
349 { 1, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0, 0},
350 /* ramp-down */
351 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
353 { /* profile 2 */
354 /* ramp-up */
355 { 1, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0, 0},
356 /* ramp-down */
357 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
359 { /* profile 3 */
360 /* ramp-up */
361 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
362 /* ramp-down */
363 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
365 { /* profile 4 */
366 /* ramp-up */
367 { 1, 0, 0, 0, 0, 0, 0, 0, 14, 31, 31, 31, 20, 0, 0, 0},
368 /* ramp-down */
369 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
371 { /* profile 5 */
372 /* ramp-up */
373 { 1, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0, 0},
374 /* ramp-down */
375 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
377 { /* profile 6 */
378 /* ramp-up */
379 { 1, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 31, 0, 0, 0},
380 /* ramp-down */
381 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
383 { /* profile 7 */
384 /* ramp-up */
385 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
386 /* ramp-down */
387 { 31, 31, 31, 4, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
389 { /* profile 8 */
390 /* ramp-up */
391 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 29, 31, 31, 31, 5, 0, 0},
392 /* ramp-down */
393 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
395 { /* profile 9 */
396 /* ramp-up */
397 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
398 /* ramp-down */
399 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
401 { /* profile 10 */
402 /* ramp-up */
403 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 24, 31, 31, 31, 10, 0, 0},
404 /* ramp-down */
405 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
407 { /* profile 11 */
408 /* ramp-up */
409 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 19, 31, 31, 31, 15, 0, 0},
410 /* ramp-down */
411 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
413 { /* profile 12 */
414 /* ramp-up */
415 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0},
416 /* ramp-down */
417 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
419 { /* profile 13 */
420 /* ramp-up */
421 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 31, 31, 31, 25, 0, 0},
422 /* ramp-down */
423 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
425 { /* profile 14 */
426 /* ramp-up */
427 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 0, 0},
428 /* ramp-down */
429 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
431 { /* profile 15 */
432 /* ramp-up */
433 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 31, 31, 0, 0},
434 /* ramp-down */
435 { 31, 31, 31, 31, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},