diff gsm-fw/L1/cust0/l1_cust.c @ 528:1affe428bf72

getting closer to compiling l1_cust.c
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 15 Jul 2014 16:54:52 +0000
parents b92febec14aa
children 9c91a1f670bd
line wrap: on
line diff
--- a/gsm-fw/L1/cust0/l1_cust.c	Mon Jul 14 21:21:07 2014 +0000
+++ b/gsm-fw/L1/cust0/l1_cust.c	Tue Jul 15 16:54:52 2014 +0000
@@ -4,24 +4,26 @@
  */
 
 #include <string.h>
-#include "../../include/config.h"
+#include "config.h"
+#include "sys_types.h"
 
-#include "../include/l1_confg.h"
-#include "../include/l1_const.h"
-#include "../../bsp/ulpd.h"
+#include "../../riviera/rv/general.h"
 #include "../../nucleus/nucleus.h"
 #include "../../nucleus/tm_defs.h"
-#include "../include/l1_types.h"
-#include "../include/l1_time.h"
-#include "../include/l1_trace.h"
-#include "../../include/sys_types.h"
-#include "../include/l1_macro.h"
+#include "../../gpf/inc/cust_os.h"
+
+#include "l1_confg.h"
+#include "l1_const.h"
+#include "../../bsp/ulpd.h"
+#include "l1_types.h"
+#include "l1_time.h"
+#include "l1_trace.h"
+#include "l1_macro.h"
 #include "../../serial/serialswitch.h"
 #include "../../bsp/abb+spi/abb.h"
 
-#if(OP_L1_STANDALONE == 0)
-  #include "buzzer/buzzer.h"       // for BZ_KeyBeep_OFF function
-  #include "sim/sim.h"
+#if CONFIG_GSM
+  #include "../../bsp/sim.h"
 #endif
 
 #if TESTMODE
@@ -58,54 +60,54 @@
 
 
 #if (RF_FAM == 61)
- #include "drp_drive.h"
+  #include "drp_drive.h"
   #include "tpudrv61.h"
   #include "l1_rf61.h"
-  #include "l1_rf61.c"
+  //#include "l1_rf61.c"
 #endif
 
 
 #if (RF_FAM == 60 )
-#include "drp_drive.h"
+  #include "drp_drive.h"
   #include "tpudrv60.h"
   #include "l1_rf60.h"
-  #include "l1_rf60.c"
+  //#include "l1_rf60.c"
   //#include "rf60.h"
 #endif
 
 #if (RF_FAM == 43)
   #include "tpudrv43.h"
   #include "l1_rf43.h"
-  #include "l1_rf43.c"
+  //#include "l1_rf43.c"
 #endif
 
 #if (RF_FAM == 35)
   #include "tpudrv35.h"
   #include "l1_rf35.h"
-  #include "l1_rf35.c"
+  //#include "l1_rf35.c"
 #endif
 
 #if (RF_FAM == 12)
   #include "tpudrv12.h"
   #include "l1_rf12.h"
-  #include "l1_rf12.c"
+  //#include "l1_rf12.c"
 #endif
 
 #if (RF_FAM == 10)
   #include "tpudrv10.h"
   #include "l1_rf10.h"
-  #include "l1_rf10.c"
+  //#include "l1_rf10.c"
 #endif
 
 #if (RF_FAM == 8)
   #include "tpudrv8.h"
   #include "l1_rf8.h"
-  #include "l1_rf8.c"
+  //#include "l1_rf8.c"
 #endif
 
 #if (RF_FAM == 2)
   #include "l1_rf2.h"
-  #include "l1_rf2.c"
+  //#include "l1_rf2.c"
 #endif
 
 #if (DRP_FW_EXT == 1)
@@ -113,6 +115,18 @@
 #include "l1_ver.h"
 #endif
 
+/*
+ * FreeCalypso change: l1_rf12.c is now a separate compilation unit,
+ * so we need to extern the data objects defined therein.
+ */
+extern T_RF rf;
+extern T_RF_BAND rf_band[GSM_BANDS];
+extern const T_RF_BAND rf_850, rf_900, rf_1800, rf_1900;
+extern UWORD16 abb[ABB_TABLE_SIZE];
+extern UWORD16 AGC_TABLE[AGC_TABLE_SIZE];
+extern T_ADC adc;
+extern T_ADCCAL adc_cal;
+extern T_TEMP temperature[TEMP_TABLE_SIZE];
 
 // Nucleus functions
 extern INT                TMD_Timer_State;
@@ -123,29 +137,26 @@
 extern TC_HCB            *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
 extern TC_PROTECT         TCD_System_Protect;
 
-#if (L2_L3_SIMUL == 0)
-  #define FFS_WORKAROUND 0
+#define FFS_WORKAROUND 0
+
+#if 1 // (FFS_WORKAROUND == 1)
+  #include "../../services/ffs/ffs.h"
 #else
-  #define FFS_WORKAROUND 0
-#endif
-  #if (FFS_WORKAROUND == 1)
-    #include "ffs/ffs.h"
-  #else
 /*    typedef signed int int32;
     typedef signed char effs_t;*/
     typedef signed int  filesize_t;
     effs_t ffs_fwrite(const char *name, void *addr, filesize_t size);
-#if (DRP_FW_EXT == 0)        
+  #if (DRP_FW_EXT == 0)        
     effs_t ffs_fread(const char *name, void *addr, filesize_t size);
   #endif
-  #endif
+#endif
 
 // Import band configuration from Flash module (need to replace by an access function)
 //extern UWORD8       std;
 extern T_L1_CONFIG  l1_config;
 extern T_L1S_GLOBAL l1s;
 
-#if(OP_L1_STANDALONE == 0)
+#if 0 //(OP_L1_STANDALONE == 0)
   extern SYS_BOOL cama_sleep_status(void);
 #endif
 
@@ -174,7 +185,6 @@
 #if (RF_FAM == 61)
 #include "drp_api.h"
 
-
 extern T_DRP_SW_DATA  drp_sw_data_init;
 extern T_DRP_SW_DATA  drp_sw_data_calib;
 extern  T_DRP_SW_DATA  drp_sw_data_calib_saved;
@@ -316,6 +326,8 @@
 
 #if (L2_L3_SIMUL == 0)
     // Forbid deep sleep if the light is on
+/* FreeCalypso change: this LT_Status() function is defunct */
+#if 0
     if(LT_Status())
     {
        //cut ARMIO and UWIRE clocks in big sleep
@@ -323,17 +335,22 @@
        l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
        return(FRAME_STOP);  // BIG sleep
     }
+#endif
 
   #if (OP_L1_STANDALONE == 0)
     // Forbid deep sleep if the camera is working
+/* FreeCalypso change: no camera */
+#if 0
     if(!cama_sleep_status())
     {
       l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_CAMERA;
       return(FRAME_STOP);  // BIG sleep
     }
+#endif
 
 // Forbid deep sleep if the SIM and UARTs not ready
-#if (REQUIRED_FOR_ESAMPLE_LOCOSTO)
+// FC note: this call to SIM_SleepStatus() *is* present in the Leonardo object
+#if CONFIG_GSM //(REQUIRED_FOR_ESAMPLE_LOCOSTO)
     // Forbid deep sleep if the SIM and UARTs not ready
     if(SIM_SleepStatus())
 #endif
@@ -349,7 +366,7 @@
   #if (OP_L1_STANDALONE == 0)
     }
 // Forbid deep sleep if the SIM and UARTs not ready
-#if (REQUIRED_FOR_ESAMPLE_LOCOSTO)
+#if CONFIG_GSM //(REQUIRED_FOR_ESAMPLE_LOCOSTO)
     else l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_SIM;
 #endif
   #endif
@@ -773,7 +790,7 @@
     #endif
   #endif
 
-  #if (ANLG_FAM == 1)
+  #if (ANALOG == 1)
     l1_config.params.debug1           = C_DEBUG1;            // Enable f_tx delay of 400000 cyc DEBUG
     l1_config.params.afcctladd        = abb[ABB_AFCCTLADD];  // Value at reset
     l1_config.params.vbuctrl          = abb[ABB_VBUCTRL];    // Uplink gain amp 0dB, Sidetone gain to mute
@@ -787,7 +804,7 @@
     l1_config.params.vbctrl           = abb[ABB_VBCTRL];     // VULSWITCH=0, VDLAUX=1, VDLEAR=1
     l1_config.params.apcdel1          = abb[ABB_APCDEL1];    // value at reset
   #endif
-  #if (ANLG_FAM == 2)
+  #if (ANALOG == 2)
     l1_config.params.debug1           = C_DEBUG1;            // Enable f_tx delay of 400000 cyc DEBUG
     l1_config.params.afcctladd        = abb[ABB_AFCCTLADD];  // Value at reset
     l1_config.params.vbuctrl          = abb[ABB_VBUCTRL];    // Uplink gain amp 0dB, Sidetone gain to mute
@@ -804,7 +821,7 @@
     l1_config.params.apcdel1          = abb[ABB_APCDEL1];    // value at reset
     l1_config.params.apcdel2          = abb[ABB_APCDEL2];    // value at reset
   #endif
-  #if (ANLG_FAM == 3)
+  #if (ANALOG == 3)
     l1_config.params.debug1           = C_DEBUG1;               // Enable f_tx delay of 400000 cyc DEBUG
     l1_config.params.afcctladd        = abb[ABB_AFCCTLADD];     // Value at reset
     l1_config.params.vbuctrl          = abb[ABB_VBUCTRL];       // Uplink gain amp 0dB, Sidetone gain to mute
@@ -833,7 +850,7 @@
     l1_config.params.apcdel1   =  drp_wrapper[DRP_WRAPPER_APCDEL1];
     l1_config.params.apcdel2   =  drp_wrapper[DRP_WRAPPER_APCDEL2];
   #endif
-  #if (ANLG_FAM == 11)
+  #if (ANALOG == 11)
     l1_config.params.vulgain		= abb[ABB_VULGAIN];
     l1_config.params.vdlgain		= abb[ABB_VDLGAIN];
     l1_config.params.sidetone           = abb[ABB_SIDETONE];
@@ -896,7 +913,6 @@
 /*-------------------------------------------------------*/
 /*---------------------------------------------*/
 
-  UWORD8  band_number;
   #if (CODE_VERSION == SIMULATION)
     UWORD16 Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
   #else
@@ -904,6 +920,7 @@
   #endif
     {
 //      WORD32 i =0 ;  //omaps00090550
+	UWORD8  band_number;
 
       for (band_number=0;band_number<RF_RX_CAL_CHAN_SIZE;band_number++)
       {
@@ -1097,7 +1114,7 @@
   index_up   = rf_band[band].tx.levels[txpwr_ramp_up].ramp_index;
   index_down = rf_band[band].tx.levels[txpwr_ramp_down].ramp_index;
 
-  #if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3))
+  #if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
     for (j=0; j<16; j++)
     {
       a_ramp[j]=((rf_band[band].tx.ramp_tables[index_down].ramp_down[j])<<11) |
@@ -1124,7 +1141,7 @@
 /* Functionality :                                       */
 /*-------------------------------------------------------*/
 
-#if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3) || (RF_FAM == 61))
 UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq
                           #if (REL99 && FF_PRF)
                             , UWORD8 number_uplink_timeslot
@@ -1322,7 +1339,8 @@
   l1_initialize(&cfg);
   
   //add below line for CSR 174476
- trace_info.current_config->l1_dyn_trace = 0;  //disable L1 trace after L1 init
+  //FC note: not present in Leonardo binary object, will take closer look later
+  trace_info.current_config->l1_dyn_trace = 0;  //disable L1 trace after L1 init
 
   get_cal_from_nvmem((UWORD8 *)&rf, sizeof(rf), RF_ID);
   get_cal_from_nvmem((UWORD8 *)&adc_cal, sizeof(adc_cal), ADC_ID);
@@ -1520,86 +1538,3 @@
 #endif
 }
 #endif
- //added for L1 standalone DRP calibration- this will overwrite the previous data
-#if (OP_L1_STANDALONE == 1)
-#pragma DATA_SECTION(drp_l1_standalone_calib_data, ".drp_l1_standalone_calib_data");
-T_DRP_SW_DATA drp_l1_standalone_calib_data;
-#pragma DATA_SECTION(valid_dro_standalone_calib_data_flag , ".valid_dro_standalone_calib_data_flag");
-UWORD32 valid_dro_standalone_calib_data_flag;
-//const T_DRP_SW_DATA drp_sw_data_init = { (UINT16) sizeof(T_DRP_CALIB), } -this needs to be filled by CCS
-//added for L1 standalone DRP calibration- ends
-#endif
-// for DRP Calibration
-/*-------------------------------------------------------*/
-/* Cust_init_params_drp()                                */
-/*-------------------------------------------------------*/
-/* Parameters : none                                     */
-/* Return     : none                                     */
-/* Functionality : Intialization of DRP calibration.     */
-/*-------------------------------------------------------*/
-#if (L1_DRP == 1)
-  void Cust_init_params_drp(void)
-  {
-#if (DRP_FW_EXT==1)
-    l1s.boot_result=drp_sw_data_calib_upload_from_ffs(&drp_sw_data_calib);
-    drp_copy_sw_data_to_drpsrm(&drp_sw_data_calib);
-#else // DRP_FW_EXT==0
-  volatile UINT16 indx, strsize;
-  volatile UINT8  *ptrsrc, *ptrdst;
-
-#if (OP_L1_STANDALONE == 0)
-  if(drp_sw_data_calib.length != drp_sw_data_init.length)
-  {
-#endif
-
-    // For the 1st time FFS might have garbage, if so use the above as check to ensure
-    //and copy from the .drp_sw_data_init structure.
-
-    // Copy drp_sw_data_init into drp_sw_data_calib
-    strsize = sizeof(T_DRP_SW_DATA);
-    ptrsrc = (UINT8 *)(&drp_sw_data_init);
-    ptrdst = (UINT8 *)(&drp_sw_data_calib);
-
-    for(indx=0;indx < strsize;indx++)
-      *ptrdst++ = *ptrsrc++;
-
-#if (OP_L1_STANDALONE == 0)
-  }
-#endif
-
-  drp_copy_sw_data_to_drpsrm(&drp_sw_data_calib);
-
-//added for L1 standalone DRP calibration- this will overwrite the previous data
-#if (OP_L1_STANDALONE == 1)
-  if(valid_dro_standalone_calib_data_flag == 0xDEADBEAF ) //indicates down the data via CCS
-  drp_copy_sw_data_to_drpsrm(&drp_l1_standalone_calib_data);
-#endif
-//added for L1 standalone DRP calibration- ends
-#endif // DRP_FW_EXT
-  }
-#endif
-
-
-#if (DRP_FW_EXT==1)
-void l1_get_boot_result_and_version(T_L1_BOOT_VERSION_CODE * p_version)
-{
-  if(! p_version)
-  {  
-    return;
-  }   
-  p_version->dsp_code_version  = l1s_dsp_com.dsp_ndb_ptr->d_version_number1;
-  p_version->dsp_patch_version = l1s_dsp_com.dsp_ndb_ptr->d_version_number2;
-  p_version->mcu_tcs_program_release = PROGRAM_RELEASE_VERSION;
-  p_version->mcu_tcs_internal        = INTERNAL_VERSION;
-  p_version->mcu_tcs_official        = OFFICIAL_VERSION;
-
-  p_version->drp_maj_ver = drp_ref_sw_ver;
-  p_version->drp_min_ver = drp_ref_sw_tag;
- 
-  p_version->boot_result = l1s.boot_result;
-}
-#endif /* DRP_FW_EXT */
-
-
-
-