comparison chipsetsw/layer1/tpu_drivers/source0/tpudrv12.notes @ 288:595cdc5ff4e5

tpudrv12 differences analyzed and documented
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 15 Mar 2017 07:26:03 +0000
parents
children
comparison
equal deleted inserted replaced
287:c24807d0dc36 288:595cdc5ff4e5
1 The reconstruction of tpudrv12.c was done back in 2014, before many of the
2 later lessons were learned and before the current reconstruction approach has
3 been adopted. Therefore, a new audit is needed to check if the logic of the
4 reconstructed version truly matches that of the original or not. This notes
5 file will serve to record our analysis of the differences.
6
7 Diff at the profile and section level: no diff in the set of exported or
8 referenced symbols, but the synth_900, synth_1800, synth_1900 and synth_850
9 global data objects have been changed from initialized writable data to const.
10 The resulting diff at the object level is that these objects have left .bss,
11 the object now has a .const section with these objects, and .cinit now only
12 fills rf_path[], which is still initialized writable data.
13
14 .bss section: aside from the synth_* move described above, the only .bss diff
15 is that the original object had a static variable named rf_data, described
16 below.
17
18 calc_a_b(): the original and our reconstruction match exactly up to the point
19 where the "n" absolute frequency is computed. Then it needs to be offset as
20 required by Rita hardware. The original code does it in a more convoluted
21 manner involving a local variable named a; our code is much simpler and
22 shorter, but produces exactly the same result.
23
24 Convert_l1_radio_freq(): the original code expression was a little different,
25 but the logic is exactly the same.
26
27 rf_init() and all subsequent functions that use the TSP_TO_RF() macro: wherever
28 we use this macro in our reconstruction, the original code does something very
29 weird: it first writes the 16-bit value we pass to the macro into a static var
30 named rf_data, then when it writes the upper byte to the TPU, the TPU word is
31 computed directly, but when it writes the lower byte to the TPU, it reads it
32 back from the rf_data var. Our diffs are due to the elimination of this
33 weirdness.
34
35 rf_init_light(): empty function, trivial match.
36
37 arfcn_to_rf_index(): perfect match.
38
39 rf_program(): logic verified to match, the diffs are the TSP_TO_RF() oddity
40 and reversed order of if-else clauses.
41
42 l1dmacro_agc(): having no idea what the original C code looked like, I made
43 a literal translation from disassembly to C. But the recompilation of the
44 resulting C code produces quite different assembly. But the logic has been
45 verified to match.
46
47 l1dmacro_rx_synth(): perfect match.
48
49 l1dmacro_tx_synth(): perfect match.
50
51 l1dmacro_rx_up(): logic manually verified match, same issues with literal
52 translation from disasm to C and TSP_TO_RF().
53
54 l1dmacro_rx_down(): logic verified to match, TSP_TO_RF() appears to be the
55 only source of diffs, perfect match otherwise.
56
57 l1dmacro_tx_up(): same as above.
58
59 l1dmacro_tx_down(): same story.
60
61 l1dmacro_rx_nb() through l1dmacro_reset_hw(): perfect match.
62
63 l1dmacro_RF_sleep(): logic verified to match, TSP_TO_RF() appears to be the
64 only source of diffs, perfect match otherwise.
65
66 l1dmacro_RF_wakeup(): TSP_TO_RF() diffs, same diff in compiler behaviour as in
67 l1dmacro_rx_up() where the new code reads TP_Ptr every time but the old code
68 doesn't, and I also unrolled a loop in one place in my original reconstruction.
69 Logic compared to match.
70
71 l1dmacro_init_hw(): perfect match.
72
73 l1dmacro_init_hw_light(): ditto.