changeset 79:3928363c521f

tpudrv12.h: support for multiple targets
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 02 Oct 2016 05:37:13 +0000
parents dce31be2b474
children d6e59be562fd
files src/cs/layer1/tpu_drivers/source0/tpudrv12.h
diffstat 1 files changed, 148 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/layer1/tpu_drivers/source0/tpudrv12.h	Sun Oct 02 04:43:59 2016 +0000
+++ b/src/cs/layer1/tpu_drivers/source0/tpudrv12.h	Sun Oct 02 05:37:13 2016 +0000
@@ -15,6 +15,7 @@
 #define MAIN_VCO_ACCESS_WA  0                     // 1 => ENABLE the Main VCO buffer
 
 #include "rf.cfg"
+#include "fc-target.cfg"
 
 //--- RITA PG declaration
 
@@ -220,82 +221,87 @@
 
 
 // RF signals connected to TSPACT  [0..7]
-//#define RESET_RF      BIT_0  // act0
-#define RF_SER_ON     BIT_0    // act0 
+
+#ifdef CONFIG_TARGET_PIRELLI
+#define	RF_RESET_LINE	BIT_5
+#else
+#define	RF_RESET_LINE	BIT_0
+#endif
+
+#define RF_SER_ON     RF_RESET_LINE
 #define RF_SER_OFF    0      
 
+#define TEST_TX_ON    0
+#define TEST_RX_ON    0
 
-#if (FEM_TEST==1)
-  //for test 
-  #define TEST_TX_ON    BIT_2 // act2
-  #define TEST_RX_ON    BIT_3 // act3
+#if defined(CONFIG_TARGET_LEONARDO) || defined(CONFIG_TARGET_ESAMPLE)
 
-  //3-band config (D-sample)
-  #define FEM_1     BIT_1     // act1
-  #define FEM_2     0         //BIT_2  // act2
-  #define FEM_3     0         //BIT_3  // act3
-#elif (BOARD == 42 || BOARD == 43 || BOARD == 35 || (BOARD == 41 && (RF_PA == 0 || RF_PA == 1 || RF_PA == 2 || RF_PA == 4))) // ESample, P2, Leonardo 
-    #define TEST_TX_ON    0
-    #define TEST_RX_ON    0
-      // 4-band config (E-sample, P2, Leonardo)
-    #define FEM_7         BIT_2     // act2
-    #define FEM_8         BIT_1     // act1
-    #define FEM_9         BIT_4     // act4
+  // 4-band config (E-sample, P2, Leonardo)
+  #define FEM_7         BIT_2     // act2
+  #define FEM_8         BIT_1     // act1
+  #define FEM_9         BIT_4     // act4
 
-      #if (RF_PA == 0)     // LCPA for ES, P2 and Leo
-          #define PA_HI_BAND    BIT_3     // act3
-          #define PA_LO_BAND    0
-          #define PA_OFF        0
-  #elif (RF_PA == 1) // RF3146 for ES and Leonardo
-    #define PA_HI_BAND    BIT_3   // act3
-    #define PA_LO_BAND    0
-    #define PA_OFF        0
-  #elif (RF_PA == 2) // RF3133 for P2 and Leonardo
-    #define PA_HI_BAND    BIT_3   // act3
-          #define PA_LO_BAND    0
-          #define PA_OFF        0
-  #elif (RF_PA == 4) // AWT6108 for Leonardo
-    #define PA_HI_BAND    BIT_3   // act3
-          #define PA_LO_BAND    0
-          #define PA_OFF        0
-  #else
-    #error "RF_PA not correctly defined"
-  #endif
+  #define PA_HI_BAND    BIT_3   // act3
+  #define PA_LO_BAND    0
+  #define PA_OFF        0
 
-#else // DSample + EVARITA
-    #if (RF_PA != 3) // Hitachi for EVARITA
-      #error
-      #endif
-
-    //#define TEST_RX_ON    0
-    //#define TEST_TX_ON    BIT_3   // act3
-    #define TEST_TX_ON    0
-    #define TEST_RX_ON    BIT_3     // act3
+  #define FEM_PINS (FEM_7 | FEM_8 | FEM_9)
 
-    //3-band config (D-sample)
-    #define FEM_1         BIT_1     // act1
-    #define FEM_2         BIT_2     // act2
-    #define FEM_3         BIT_3     // act3
-#endif
+  #define FEM_OFF    ( FEM_PINS ^ 0 )
 
-#if (BOARD == 42 || BOARD == 43 || BOARD == 35 || (BOARD == 41 && (RF_PA == 0 || RF_PA == 1 || RF_PA == 2 || RF_PA == 4))) // ESample, P2, Leonardo 
-
-    #define FEM_PINS (FEM_7 | FEM_8 | FEM_9)
-
-    #define FEM_OFF    ( FEM_PINS ^ 0 )
-
-    #define FEM_SLEEP  ( 0 )  
+  #define FEM_SLEEP  ( 0 )  
 
   // This configuration is always inverted.
 
-    // 4-band config
-    // RX_UP/DOWN and TX_UP/DOWN
+  // RX_UP/DOWN and TX_UP/DOWN
+  #define RU_900     ( PA_OFF     | FEM_PINS ^ 0     )
+  #define RD_900     ( PA_OFF     | FEM_PINS ^ 0     )
+  #define TU_900     ( PA_LO_BAND | FEM_PINS ^ FEM_7 )
+  #define TD_900     ( PA_OFF     | FEM_PINS ^ 0     )
+
+  #define RU_850     ( PA_OFF     | FEM_PINS ^ FEM_9 )
+  #define RD_850     ( PA_OFF     | FEM_PINS ^ 0     )
+  #define TU_850     ( PA_LO_BAND | FEM_PINS ^ FEM_7 )
+  #define TD_850     ( PA_OFF     | FEM_PINS ^ 0     )
+
+  #define RU_1800    ( PA_OFF     | FEM_PINS ^ 0     )
+  #define RD_1800    ( PA_OFF     | FEM_PINS ^ 0     )
+  #define TU_1800    ( PA_HI_BAND | FEM_PINS ^ FEM_8 )
+  #define TD_1800    ( PA_OFF     | FEM_PINS ^ 0     )
+
+  #define RU_1900    ( PA_OFF     | FEM_PINS ^ 0     )
+  #define RD_1900    ( PA_OFF     | FEM_PINS ^ 0     )
+  #define TU_1900    ( PA_HI_BAND | FEM_PINS ^ FEM_8 )
+  #define TD_1900    ( PA_OFF     | FEM_PINS ^ 0     )
+
+#elif defined(CONFIG_TARGET_GTAMODEM) || defined(CONFIG_TARGET_FCDEV3B)
+
+  // Openmoko's triband configuration is a bastardized version
+  // of TI's quadband one from Leonardo/E-Sample
+
+  #define FEM_7         BIT_2     // act2
+  #define FEM_8         BIT_1     // act1
+  #define FEM_9         BIT_4     // act4
+
+  #define PA_HI_BAND    BIT_3   // act3
+  #define PA_LO_BAND    0
+  #define PA_OFF        0
+
+  #define FEM_PINS (FEM_7 | FEM_8 | FEM_9)
+
+  #define FEM_OFF    ( FEM_PINS ^ 0 )
+
+  #define FEM_SLEEP  ( 0 )  
+
+  // This configuration is always inverted.
+
+  // RX_UP/DOWN and TX_UP/DOWN
   #define RU_900     ( PA_OFF     | FEM_PINS ^ 0     )
   #define RD_900     ( PA_OFF     | FEM_PINS ^ 0     )
   #define TU_900     ( PA_LO_BAND | FEM_PINS ^ FEM_9 )
   #define TD_900     ( PA_OFF     | FEM_PINS ^ 0     )
 
-  #define RU_850     ( PA_LO_BAND | FEM_PINS ^ 0  )
+  #define RU_850     ( PA_OFF     | FEM_PINS ^ 0     )
   #define RD_850     ( PA_OFF     | FEM_PINS ^ 0     )
   #define TU_850     ( PA_LO_BAND | FEM_PINS ^ FEM_9 )
   #define TD_850     ( PA_OFF     | FEM_PINS ^ 0     )
@@ -305,43 +311,101 @@
   #define TU_1800    ( PA_HI_BAND | FEM_PINS ^ FEM_7 )
   #define TD_1800    ( PA_OFF     | FEM_PINS ^ 0     )
 
-  #define RU_1900    ( PA_LO_BAND | FEM_PINS ^ FEM_8     )
+  #define RU_1900    ( PA_OFF     | FEM_PINS ^ FEM_8 )
   #define RD_1900    ( PA_OFF     | FEM_PINS ^ 0     )
   #define TU_1900    ( PA_HI_BAND | FEM_PINS ^ FEM_7 )
   #define TD_1900    ( PA_OFF     | FEM_PINS ^ 0     )
 
-#else  // end BOARD = 43
-       // start RF HW interfacing with EVARITA
+#elif defined(CONFIG_TARGET_PIRELLI)
+
+  #define ANTSW_RX_PCS	BIT_4
+  #define ANTSW_TX_HIGH	BIT_10
+  #define ANTSW_TX_LOW	BIT_11
 
-  #define FEM_OFF    (FEM_1 | FEM_2)
-  #define FEM_SLEEP  (0)             // To avoid leakage during Deep-Seep
+  #define PA_HI_BAND    BIT_3   // act3
+  #define PA_LO_BAND    0
+  #define PA_OFF        0
+
+  #define PA_ENABLE	BIT_0
+
+  // Pirelli uses a non-inverting buffer
+
+  #define FEM_OFF    ( 0 )
+
+  #define FEM_SLEEP  ( 0 )  
 
-  // 3-band config
-  // RX_UP/DOWN and TX_UP/DOWN
-  #define RU_900     ( FEM_1 | FEM_2 )
-  #define RD_900     ( FEM_1 | FEM_2 )
-  #define TU_900     ( FEM_1         )
-  #define TD_900     ( FEM_1 | FEM_2 )
+  // RX_UP/DOWN and TX_UP/DOWN (triband)
+  #define RU_900     ( PA_OFF     | 0             )
+  #define RD_900     ( PA_OFF     | 0             )
+  #define TU_900     ( PA_LO_BAND | ANTSW_TX_LOW  )
+  #define TD_900     ( PA_OFF     | 0             )
+
+  #define RU_850     ( PA_OFF     | 0             )
+  #define RD_850     ( PA_OFF     | 0             )
+  #define TU_850     ( PA_LO_BAND | ANTSW_TX_LOW  )
+  #define TD_850     ( PA_OFF     | 0             )
+
+  #define RU_1800    ( PA_OFF     | 0             )
+  #define RD_1800    ( PA_OFF     | 0             )
+  #define TU_1800    ( PA_HI_BAND | ANTSW_TX_HIGH )
+  #define TD_1800    ( PA_OFF     | 0             )
+
+  #define RU_1900    ( PA_OFF     | ANTSW_RX_PCS  )
+  #define RD_1900    ( PA_OFF     | 0             )
+  #define TU_1900    ( PA_HI_BAND | ANTSW_TX_HIGH )
+  #define TD_1900    ( PA_OFF     | 0             )
+
+#elif defined(CONFIG_TARGET_COMPAL)
 
-  #define RU_850     ( FEM_1 | FEM_2 )
-  #define RD_850     ( FEM_1 | FEM_2 )
-  #define TU_850     ( FEM_1         )
-  #define TD_850     ( FEM_1 | FEM_2 )
+  #define PA_HI_BAND    BIT_8   // act8
+  #define PA_LO_BAND    0
+  #define PA_OFF        0
+
+  #define PA_ENABLE	BIT_1
+
+  // FEM control signals are active low
+  #define FEM_PINS (BIT_6 | BIT_2)
+
+  #define FEM_OFF    ( FEM_PINS ^ 0 )
+
+  #define FEM_SLEEP  ( 0 )  
+
+  #define FEM_TX_HIGH	BIT_6
+  #if USE_TSPACT2_FOR_TXLOW
+    #define FEM_TX_LOW	BIT_2
+  #else
+    #define FEM_TX_LOW	BIT_6
+  #endif
 
-  #define RU_1800    ( FEM_1 | FEM_2 )
-  #define RD_1800    ( FEM_1 | FEM_2 )
-  #define TU_1800    (         FEM_2 )
-  #define TD_1800    ( FEM_1 | FEM_2 )
+  // RX_UP/DOWN and TX_UP/DOWN
+  #define RU_900     ( PA_OFF     | FEM_PINS ^ 0           )
+  #define RD_900     ( PA_OFF     | FEM_PINS ^ 0           )
+  #define TU_900     ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW  )
+  #define TD_900     ( PA_OFF     | FEM_PINS ^ 0           )
+
+  #define RU_850     ( PA_OFF     | FEM_PINS ^ 0           )
+  #define RD_850     ( PA_OFF     | FEM_PINS ^ 0           )
+  #define TU_850     ( PA_LO_BAND | FEM_PINS ^ FEM_TX_LOW  )
+  #define TD_850     ( PA_OFF     | FEM_PINS ^ 0           )
 
-  #define RU_1900    ( FEM_1 | FEM_2 )
-  #define RD_1900    ( FEM_1 | FEM_2 )
-  #define TU_1900    ( FEM_2)
-  #define TD_1900    ( FEM_1 | FEM_2 )
+  #define RU_1800    ( PA_OFF     | FEM_PINS ^ 0           )
+  #define RD_1800    ( PA_OFF     | FEM_PINS ^ 0           )
+  #define TU_1800    ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH )
+  #define TD_1800    ( PA_OFF     | FEM_PINS ^ 0           )
 
-#endif  // BOARD != 43
+  #define RU_1900    ( PA_OFF     | FEM_PINS ^ 0           )
+  #define RD_1900    ( PA_OFF     | FEM_PINS ^ 0           )
+  #define TU_1900    ( PA_HI_BAND | FEM_PINS ^ FEM_TX_HIGH )
+  #define TD_1900    ( PA_OFF     | FEM_PINS ^ 0           )
+
+#endif  // FreeCalypso target selection
 
 #define TC1_DEVICE_ABB     TC1_DEVICE0  // TSPEN0
+#ifdef CONFIG_TARGET_PIRELLI
+#define TC1_DEVICE_RF      TC1_DEVICE1  // TSPEN1
+#else
 #define TC1_DEVICE_RF      TC1_DEVICE2  // TSPEN2
+#endif
 
 
 //--- TIMINGS ----------------------------------------------------------