summaryrefslogtreecommitdiffstats
path: root/src/target/firmware/board/compal/rf_tables.c
blob: f115f29a7bca298e8c9c77d258f2ebdcde98be14 (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
/*
 * This code was written by Mychaela Falconia <falcon@freecalypso.org>
 * who refuses to claim copyright on it and has released it as public domain
 * instead. NO rights reserved, all rights relinquished.
 *
 * Tweaked (coding style changes) by Vadim Yanitskiy <axilirator@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <stdint.h>
#include <rf/txcal.h>
#include <rf/vcxocal.h>

/*
 * The following AFC initial DAC value and AFC slope settings are unchanged
 * from the old OsmocomBB code in which they were hard-coded in layer1/afc.c.
 * This AFC slope setting corresponds very closely to the original Leonardo
 * Psi values which are used by Motorola's official fw at least on the C139,
 * hence I have good reason to believe that they are indeed correct for the
 * Mot C1xx hardware target family.
 */
int16_t afc_initial_dac_value = -700;
int16_t afc_slope = 287;

/*
 * The following Tx levels tables are the ones compiled into Compal's
 * firmwares; more specifically, they were originally extracted out
 * of the one special Mot C11x fw version for which we got the linker
 * map file with symbols and subsequently confirmed to be unchanged in
 * Mot C139 and SE J100 firmwares.  In normal operation the APC DAC values
 * in these levels tables are replaced with the ones read from the per-unit
 * and per-band factory calibration records.
 *
 * It should be noted that these compiled-in numbers are approximately
 * correct for the C11x/12x/155/156 family (SKY77324 RF PA) but are totally
 * wrong for the newer C139/140 (SKY77325) and SE J100 (SKY77328) hardware;
 * it appears that Compal never bothered with changing these compiled-in
 * numbers in their fw for the newer designs because the expectation is
 * that these compiled-in numbers are just dummy placeholders to be
 * overridden by per-unit calibration.
 */
struct txcal_tx_level rf_tx_levels_850[RF_TX_LEVELS_TABLE_SIZE] = {
	{ 560,  0,  0 }, /* 0 */
	{ 560,  0,  0 }, /* 1 */
	{ 560,  0,  0 }, /* 2 */
	{ 560,  0,  0 }, /* 3 */
	{ 560,  0,  0 }, /* 4 */
	{ 638,  0,  0 }, /* 5 */
	{ 554,  1,  0 }, /* 6 */
	{ 467,  2,  0 }, /* 7 */
	{ 395,  3,  0 }, /* 8 */
	{ 337,  4,  0 }, /* 9 */
	{ 290,  5,  0 }, /* 10 */
	{ 253,  6,  0 }, /* 11 */
	{ 224,  7,  0 }, /* 12 */
	{ 201,  8,  0 }, /* 13 */
	{ 183,  9,  0 }, /* 14 */
	{ 168, 10,  0 }, /* 15 */
	{ 157, 11,  0 }, /* 16 */
	{ 148, 12,  0 }, /* 17 */
	{ 141, 13,  0 }, /* 18 */
	{ 136, 14,  0 }, /* 19 */
	{  46, 14,  0 }, /* 20 */
	{  46, 14,  0 }, /* 21 */
	{  46, 14,  0 }, /* 22 */
	{  46, 14,  0 }, /* 23 */
	{  46, 14,  0 }, /* 24 */
	{  46, 14,  0 }, /* 25 */
	{  46, 14,  0 }, /* 26 */
	{  46, 14,  0 }, /* 27 */
	{  46, 14,  0 }, /* 28 */
	{  46, 14,  0 }, /* 29 */
	{  46, 14,  0 }, /* 30 */
	{  46, 14,  0 }, /* 31 */
};

struct txcal_tx_level rf_tx_levels_900[RF_TX_LEVELS_TABLE_SIZE] = {
	{ 550,  0,  0 }, /* 0 */
	{ 550,  0,  0 }, /* 1 */
	{ 550,  0,  0 }, /* 2 */
	{ 550,  0,  0 }, /* 3 */
	{ 550,  0,  0 }, /* 4 */
	{ 550,  0,  0 }, /* 5 */
	{ 476,  1,  0 }, /* 6 */
	{ 402,  2,  0 }, /* 7 */
	{ 338,  3,  0 }, /* 8 */
	{ 294,  4,  0 }, /* 9 */
	{ 260,  5,  0 }, /* 10 */
	{ 226,  6,  0 }, /* 11 */
	{ 204,  7,  0 }, /* 12 */
	{ 186,  8,  0 }, /* 13 */
	{ 172,  9,  0 }, /* 14 */
	{ 161, 10,  0 }, /* 15 */
	{ 153, 11,  0 }, /* 16 */
	{ 146, 12,  0 }, /* 17 */
	{ 141, 13,  0 }, /* 18 */
	{ 137, 14,  0 }, /* 19 */
	{  43, 14,  0 }, /* 20 */
	{  43, 14,  0 }, /* 21 */
	{  43, 14,  0 }, /* 22 */
	{  43, 14,  0 }, /* 23 */
	{  43, 14,  0 }, /* 24 */
	{  43, 14,  0 }, /* 25 */
	{  43, 14,  0 }, /* 26 */
	{  43, 14,  0 }, /* 27 */
	{  43, 14,  0 }, /* 28 */
	{  43, 14,  0 }, /* 29 */
	{  43, 14,  0 }, /* 30 */
	{  43, 14,  0 }, /* 31 */
};

struct txcal_tx_level rf_tx_levels_1800[RF_TX_LEVELS_TABLE_SIZE] = {
	{ 480,  0,  0 }, /* 0 */
	{ 416,  1,  0 }, /* 1 */
	{ 352,  2,  0 }, /* 2 */
	{ 308,  3,  0 }, /* 3 */
	{ 266,  4,  0 }, /* 4 */
	{ 242,  5,  0 }, /* 5 */
	{ 218,  6,  0 }, /* 6 */
	{ 200,  7,  0 }, /* 7 */
	{ 186,  8,  0 }, /* 8 */
	{ 175,  9,  0 }, /* 9 */
	{ 167, 10,  0 }, /* 10 */
	{ 160, 11,  0 }, /* 11 */
	{ 156, 12,  0 }, /* 12 */
	{ 152, 13,  0 }, /* 13 */
	{ 145, 14,  0 }, /* 14 */
	{ 142, 15,  0 }, /* 15 */
	{  61, 15,  0 }, /* 16 */
	{  61, 15,  0 }, /* 17 */
	{  61, 15,  0 }, /* 18 */
	{  61, 15,  0 }, /* 19 */
	{  61, 15,  0 }, /* 20 */
	{  61, 15,  0 }, /* 21 */
	{  61, 15,  0 }, /* 22 */
	{  61, 15,  0 }, /* 23 */
	{  61, 15,  0 }, /* 24 */
	{  61, 15,  0 }, /* 25 */
	{  61, 15,  0 }, /* 26 */
	{  61, 15,  0 }, /* 27 */
	{  61, 15,  0 }, /* 28 */
	{ 750,  0,  0 }, /* 29 */
	{ 750,  0,  0 }, /* 30 */
	{ 750,  0,  0 }, /* 31 */
};

struct txcal_tx_level rf_tx_levels_1900[RF_TX_LEVELS_TABLE_SIZE] = {
	{ 520,  0,  0 }, /* 0 */
	{ 465,  1,  0 }, /* 1 */
	{ 390,  2,  0 }, /* 2 */
	{ 330,  3,  0 }, /* 3 */
	{ 285,  4,  0 }, /* 4 */
	{ 250,  5,  0 }, /* 5 */
	{ 225,  6,  0 }, /* 6 */
	{ 205,  7,  0 }, /* 7 */
	{ 190,  8,  0 }, /* 8 */
	{ 177,  9,  0 }, /* 9 */
	{ 168, 10,  0 }, /* 10 */
	{ 161, 11,  0 }, /* 11 */
	{ 155, 12,  0 }, /* 12 */
	{ 150, 13,  0 }, /* 13 */
	{ 147, 14,  0 }, /* 14 */
	{ 143, 15,  0 }, /* 15 */
	{  62, 15,  0 }, /* 16 */
	{  62, 15,  0 }, /* 17 */
	{  62, 15,  0 }, /* 18 */
	{  62, 15,  0 }, /* 19 */
	{  62, 15,  0 }, /* 20 */
	{  62, 15,  0 }, /* 21 */
	{  62, 15,  0 }, /* 22 */
	{  62, 15,  0 }, /* 23 */
	{  62, 15,  0 }, /* 24 */
	{  62, 15,  0 }, /* 25 */
	{  62, 15,  0 }, /* 26 */
	{  62, 15,  0 }, /* 27 */
	{  62, 15,  0 }, /* 28 */
	{ 915,  0,  0 }, /* 29 */
	{ 915,  0,  0 }, /* 30 */
	{ 915,  0,  0 }, /* 31 */
};