changeset 415:b3d65ae5f02c

tpudrv10.c: magic2 tables added
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Jan 2018 00:03:02 +0000
parents cbc25978be5a
children 5ca341a26dda
files src/cs/layer1/tpu_drivers/source0/tpudrv10.c
diffstat 1 files changed, 61 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/layer1/tpu_drivers/source0/tpudrv10.c	Fri Jan 19 23:18:23 2018 +0000
+++ b/src/cs/layer1/tpu_drivers/source0/tpudrv10.c	Sat Jan 20 00:03:02 2018 +0000
@@ -65,6 +65,7 @@
 static UWORD8  rf_index;	/* index into rf_path[] */
 static UWORD16 rf_chip_band;	/* from tpudrv12.obj, not in tpudrv61.c */
 static UWORD8  rfband;		/* ditto */
+static UWORD8  magic2_byte;
 
 // Internal function prototypes
 void l1dmacro_rx_down (WORD32 t);
@@ -161,6 +162,11 @@
   UWORD16 magic;
 };
 
+struct magic2_s {
+  UWORD16 limit;
+  UWORD8  magic;
+};
+
 struct rf_path_s {
   UWORD16 rf_chip_band;
   UWORD8  rx_up;
@@ -168,8 +174,9 @@
   UWORD8  tx_up;
   UWORD8  tx_down;
   UWORD8  tx_up_rev;
-  struct  synth_s *synth;
-  struct  magic1_s *magic1;
+  const struct synth_s  *synth;
+  const struct magic1_s *tx_magic1;
+  const struct magic2_s *rx_magic2;
 };
 
 static const struct synth_s synth_900[] =
@@ -197,6 +204,13 @@
   {1023, 0x0820},
 };
 
+static const struct magic2_s magic2_rx900[] =
+{
+  {0x4B00, 7},
+  {0x4E20, 7},
+  {0xFFFF, 7},
+};
+
 static const struct synth_s synth_1800[] =
 {
   {511, 885, 1710, -1, 1805, 1}, // dcs  512 - 885
@@ -216,6 +230,13 @@
   {885, 0x082D},
 };
 
+static const struct magic2_s magic2_rx1800[] =
+{
+  {0x24B8, 0},
+  {0x2710, 0},
+  {0xFFFF, 0},
+};
+
 static const struct synth_s synth_1900[] =
 {
   {511, 810, 1850, -1, 1930, 1}, // pcs  512 - 810;
@@ -231,6 +252,13 @@
   {810, 0x0861},
 };
 
+static const struct magic2_s magic2_rx1900[] =
+{
+  {0x26DE, 0},
+  {0x2710, 0},
+  {0xFFFF, 0},
+};
+
 static const struct synth_s synth_850[] =
 {
   {127, 251, 824, 1, 869, 4}, // gsm850
@@ -241,25 +269,41 @@
   {251, 0x0924},
 };
 
-struct rf_path_s rf_path[] = {    //same index used as for band_config[] - 1
+static const struct magic2_s magic2_rx850[] =
+{
+  {0x4B00, 7},
+  {0x4E20, 7},
+  {0xFFFF, 7},
+};
+
+static const struct magic2_s magic2_tx[] =
+{
+  {0x1A90, 6},
+  {0x1CED, 7},
+  {0x1D4C, 7},
+  {0xFFFF, 7},
+};
+
+static const struct rf_path_s rf_path[] = {
+    //same index used as for band_config[] - 1
   /* EGSM */
   { BAND_SELECT_GSM, RU_900,  RD_900,  TU_900,  TD_900,  TU_REV_900,
-    (struct synth_s *)synth_900,  (struct magic1_s *)magic1_900},
+    synth_900,  magic1_900,  magic2_rx900},
   /* DCS */
   { BAND_SELECT_DCS, RU_1800, RD_1800, TU_1800, TD_1800, TU_REV_1800,
-    (struct synth_s *)synth_1800, (struct magic1_s *)magic1_1800},
+    synth_1800, magic1_1800, magic2_rx1800},
   /* PCS */
   { BAND_SELECT_PCS, RU_1900, RD_1900, TU_1900, TD_1900, TU_REV_1900,
-    (struct synth_s *)synth_1900, (struct magic1_s *)magic1_1900},
+    synth_1900, magic1_1900, magic2_rx1900},
   /* GSM850 */
   { BAND_SELECT_850, RU_850,  RD_850,  TU_850,  TD_850,  TU_REV_850,
-    (struct synth_s *)synth_850,  (struct magic1_s *)magic1_850},
+    synth_850,  magic1_850,  magic2_rx850},
   /* PCS in dual-us */
   { BAND_SELECT_PCS, RU_1900, RD_1900, TU_1900, TD_1900, TU_REV_1900,
-    (struct synth_s *)synth_1900, (struct magic1_s *)magic1_1900},
+    synth_1900, magic1_1900, magic2_rx1900},
   /* non-E GSM */
   { BAND_SELECT_GSM, RU_900,  RD_900,  TU_900,  TD_900,  TU_REV_900,
-    (struct synth_s *)synth_900,  (struct magic1_s *)magic1_900},
+    synth_900,  magic1_900,  magic2_rx900},
 };
 
 /*
@@ -275,6 +319,7 @@
   UWORD32 farfcn;	/* sp+0x1C, in 200 kHz units */
   struct synth_s  *s;
   struct magic1_s *m1;
+  struct magic2_s *m2;
   UWORD32 magic1;	/* sp+0x24 */
   UWORD16 sp4;
   UWORD32 sp0x14, sp0x18, sp0x20;
@@ -283,7 +328,7 @@
   while(s->limit < arfcn)
     s++;
 
-  m1 = rf_path[rf_index].magic1;
+  m1 = rf_path[rf_index].tx_magic1;
   while(m1->limit < arfcn)
     m1++;
   magic1 = m1->magic;
@@ -294,14 +339,20 @@
     sp4 = farfcn * s->dl_mult;
     sp0x18 = sp4 << 21;
     sp0x14 = sp0x20 * farfcn;
+    m2 = rf_path[rf_index].rx_magic2;
   } else {
     sp0x20 = 0x2762F;
     farfcn = 5*s->ul_farfcn0 + (arfcn - s->arfcn0);
     sp4 = magic1 * s->ul_sign + farfcn;
     sp0x18 = sp4 << 21;
     sp0x14 = sp0x20 * (magic1 * s->ul_sign + farfcn);
+    m2 = magic2_tx;
   }
 
+  while(m2->limit < sp4)
+    m2++;
+  magic2_byte = (m2->magic & 7) << 5;
+
   rf_chip_band = s->rf_chip_band;
 
   // Convert the ARFCN to the channel frequency (times 5 to avoid the decimal value)