annotate chipsetsw/layer1/tpu_drivers/source0/tpudrv12.notes @ 296:1ddbcdc0c1d5

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