changeset 517:eafadfee35b2

gsm-fw/L1/cust?: imported Leonardo, LoCosto and MV100 versions
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 10 Jul 2014 03:43:04 +0000
parents 78495749970a
children ffbb71ee664c
files gsm-fw/L1/cust0/ind_os.h gsm-fw/L1/cust0/mv100/L1tm_cust_add.h gsm-fw/L1/cust0/mv100/ind_os.c gsm-fw/L1/cust0/mv100/ind_os.h gsm-fw/L1/cust0/mv100/l1_cst.mak gsm-fw/L1/cust0/mv100/l1_cust.c gsm-fw/L1/cust0/mv100/l1_cust.c_traceversion gsm-fw/L1/cust0/mv100/l1_rf10.c gsm-fw/L1/cust0/mv100/l1_rf10.h gsm-fw/L1/cust0/mv100/l1_rf12.c gsm-fw/L1/cust0/mv100/l1_rf12.h gsm-fw/L1/cust1/ind_os.c gsm-fw/L1/cust1/ind_os.h gsm-fw/L1/cust1/l1_cust.c gsm-fw/L1/cust1/l1_rf61.c gsm-fw/L1/cust1/l1_rf61.h
diffstat 16 files changed, 12295 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/ind_os.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,19 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename ind_os.h
+ *        Version  1.2
+ *        Date     05/25/00
+ * 
+ ************* Revision Controle System Header *************/
+
+
+
+#define OS_OK   0
+        
+typedef SYS_WORD16  T_OS_RETURN;
+
+// Prototype for independant os commands
+extern T_OS_RETURN  ind_os_sleep (SYS_UWORD32 millisecs);
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/L1tm_cust_add.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,181 @@
+#ifndef _DEF_BMI_L1TMCUSTADD_H_
+#define _DEF_BMI_L1TMCUSTADD_H_
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ * L1TM_CUST_ADD.h
+ *
+ *        Filename %M%
+ *        Version  %I%
+ *        Date     %G%
+ *
+ * $History: Mmidict.c
+
+ 	01/08/02 			huangxl creat.	
+ * $end
+ ************* Revision Controle System Header *************/
+
+#define EQ  ==
+#define NEQ !=
+#define AND &&
+#define OR  ||
+#define XOR(A,B) ((!(A) AND (B)) OR ((A) AND !(B)))
+
+#define GPIO_OUT 0xFFFE4802 
+#define ALLOC_MEMORY mfwAlloc
+#define FREE_MEMORY  mfwFree
+
+
+#ifndef FALSE
+  #define FALSE 0
+#endif
+
+#ifndef TRUE
+  #define TRUE 1
+#endif
+
+#ifndef NULL
+  #define NULL 0
+#endif
+
+ enum CUSTOM_INDEX
+{
+	OFF				= 0,
+	ON				= 1
+};
+
+enum CMD 
+{
+	READ_SIM_PHB_CMD			= 17,
+	WRITE_SIM_PHB_CMD			= 18,
+	READ_SIM_SMS_CMD			= 19,
+	READ_NEW_SMS_CMD			= 21,
+	SEND_SMS_CMD					=22	,
+	SAVE_SEND_SMS					=23,
+	WRITE_NVM_PHB_CMD			= 24
+		
+};
+
+enum PC_CMD_RET
+{
+	CMD_RET_OK						=0,
+	CMD_COMPLETE_OK					=1,
+	SIM_NOT_REDAY					=-1,
+	NO_SIM_PHB						=-2,
+	FWRITE_FAIL						=-3,
+	CMD_BUSY						=-4,
+	FREAD_FAIL						=-5,
+	WRITE_SIM_PHB_FAIL				=-6,
+	READ_SIM_PHB_FAIL				=-7,
+	ALLOC_MEM_FAIL				=-8,
+	NO_SIM_SMS					=-9
+};
+
+#define MAXNAMELEN 21
+#define MAXNUMLEN 21
+#define MAXOFFNUMLEN 21
+#define MAXHOMNUMLEN 21
+#define MAXEMAILLEN 25
+#define MAXGROUPLEN 10
+#define MAXPRILEN 8
+#define	MAXSIMPHBNUM	20
+
+typedef struct TSPhbData
+{
+	char Name[21];
+	char Number[21];
+}SPhbData;
+
+typedef struct TPhbData
+{
+	SPhbData	phbdata[20];
+}PhbData;
+
+typedef struct TPCCMDSTATUS
+{
+	unsigned char	isPcCmdRun;//when pc cmd is complete,it is 1;when running is 0,default is 1
+	unsigned char	SimPhbNum;//how many phb num in sim
+	unsigned char	NvmPhbNum;//how many phb num in nvm
+	unsigned char	nSimSmsFile;//how many sms file created
+	unsigned char	isdelsmsok;//
+	unsigned char	nNewsms;//how many new sms 
+	unsigned char	iscmdreterr;//
+	unsigned char	nsimphbmax;//how many sms file created
+	unsigned char	nsimsmsmax;//how many sms file created
+	unsigned char	isPcConect;//conect:1	no dataline in:0
+}PCCMDSTATUS;
+
+typedef struct	TSMS_MEM_INFO
+{
+  unsigned char mem;
+  unsigned char used;
+  unsigned char total;
+  unsigned char dummy;
+} SMS_MEM_INFO;
+
+#define MAX_LEN             21
+
+typedef struct
+{
+	char		date[18];
+        char 	Number[41];
+        char	info[502];
+  	char    sc_addr[MAX_LEN];     /* service centre address     */
+        char	type;
+        char	ton;
+        char	npi;
+        char	index;
+}TPhoneSmsItem;
+
+extern int write_imei(unsigned char *imei);
+extern int write_SerialNumber(unsigned char *value);
+extern int read_SerialNumber(char *table);
+extern unsigned short checksim();
+extern unsigned short  checknetavail();
+extern unsigned char ctrlcd(unsigned short value);
+extern unsigned char ctrled(unsigned short value);
+extern unsigned char ctrbacklight(unsigned short value);
+extern unsigned char ctrvibrator(unsigned short value);
+extern unsigned char ctrbuzzer(unsigned short value);
+extern int key_simulation(unsigned char size,unsigned char *keycode);
+extern int read_rtc(char *table);
+
+extern unsigned short  get_sim_status(void);
+extern unsigned short  get_net_status(void);
+
+extern void kbd_test (unsigned char key);
+
+extern void StartVibrator(void);
+extern void StopVibrator(void);
+extern void StartTone(void);
+extern void StopTone(void);
+
+
+extern void LED_ON(void);
+extern void LED_OFF(void);
+extern void Backlight_ON(void);
+extern void Backlight_OFF(void);
+
+
+extern signed char flash_write();
+
+extern int read_sim_phb(void);
+extern int write_sim_phb(void);
+extern unsigned char IsPcCmdExcuteEnd(char *value); 
+extern int write_sim_phb_cb(void);
+extern void tell_simphb_num(unsigned short value);
+extern int read_sim_sms(void);
+extern void Get_sms_info(const char *info,void *adr, void * t,void *scaddr,int errStatus);
+
+extern int del_sim_sms(unsigned short value);
+extern int read_new_sms(void);
+extern int change_sim_sms(unsigned short  value);
+extern int send_sms(void);
+extern int send_sms_cb(void);
+extern void tell_nvmphb_num(unsigned short  value);
+
+
+extern PCCMDSTATUS	PcCmdStatus;
+extern unsigned char command;
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/ind_os.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,158 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software 
+ * IND_OS.C
+ *
+ *        Filename ind_os.c
+ *        Version  1.1
+ *        Date     04/26/00
+ *
+ ************* Revision Controle System Header *************/
+
+
+// Nucleus include files.
+#include "nucleus.h"
+#include "tc_defs.h"
+#include "sys_types.h"
+#include "ind_os.h"
+
+#include "l1_confg.h"
+// Layer1 and debug include files.
+#include "l1_types.h"
+#include "l1_const.h"
+
+#if (L1_GTT == 1)
+  #include "l1gtt_const.h"
+  #include "l1gtt_defty.h"
+#endif
+
+#if ((ANALOG == 1) || (ANALOG == 2))
+  #include "spi_drv.h"
+#endif
+
+#if TESTMODE
+  #include "l1tm_defty.h"
+#endif
+
+#include "l1audio_const.h"
+#include "l1audio_cust.h"
+#include "l1audio_defty.h"
+#include "l1_defty.h"
+#include "l1_msgty.h"
+#include "l1_varex.h"
+
+#if (CHIPSET == 2 || CHIPSET == 3 || CHIPSET == 4 || CHIPSET == 5 || CHIPSET == 6 || CHIPSET == 7 || CHIPSET == 8 || CHIPSET == 10 || CHIPSET == 11 || CHIPSET == 12)
+  #include "ulpd.h"
+#endif
+
+extern UWORD32    TCD_Priority_Groups;
+extern TC_HCB     *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
+extern VOID       *TCD_Current_Thread;
+extern TC_HCB     *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
+extern INT        TMD_Timer_State;
+extern UWORD32    TMD_Timer;               // for big sleep 
+extern TC_PROTECT TCD_System_Protect;
+
+ 
+ /*-------------------------------------------------------*/
+ /* int ind_os_sleep()                                    */
+ /*-------------------------------------------------------*/ 
+ /* Parameters : none                                     */
+ /* Return     :                                          */     
+ /* Functionality : Suspend the thread an interval        */
+ /*                 of millisecs.                         */
+ /* Limitation :                                          */
+ /*-------------------------------------------------------*/
+
+ T_OS_RETURN  ind_os_sleep (SYS_UWORD32 millisecs)
+{
+  NU_Sleep ((SYS_UWORD32) millisecs);
+  return OS_OK;
+}
+
+
+ /*-------------------------------------------------------*/
+ /* int OS_get_inactivity_ticks()                          */
+ /*-------------------------------------------------------*/ 
+ /* Parameters : none                                     */
+ /* Return     : Number of ticks of inactivity            */
+ /*              0 means immediate activity planned       */
+ /*              -1 means no activity planned             */     
+ /* Functionality : Evaluates the OS activity planned     */
+ /*                 by looking at ready tasks, activated  */
+ /*                HISR and the elapsed time of the timers*/
+ /* Limitation : Must be protected from H/W interrupts    */
+ /*-------------------------------------------------------*/
+ int OS_get_inactivity_ticks(void)
+ {
+   int i;
+
+   // Returns immediate activity if a task is ready
+   if (TCD_Priority_Groups) 
+	return 0;
+	
+   //for all HISR priorities
+   for (i = 0; i < TC_HISR_PRIORITIES ; i++)
+   {	
+     // if no hisr of priority "i" ==> go to next priority
+     if (TCD_Active_HISR_Heads[i] == 0) 	
+       continue;
+	  			
+     // the first hisr is NOT the current one (frame hisr) so it may be
+     // with other priority ==> abort
+     if (TCD_Active_HISR_Heads[i] != TCD_Current_Thread) 
+       return 0;
+	  
+     // the last hisr is NOT the current one (frame hisr) so there is
+     // at least another hisr with same priority ==> abort
+     if (TCD_Active_HISR_Tails[i] != TCD_Current_Thread)
+       return 0;
+	  
+     // the first and last hisrs are the current one (frame hisr) but 
+     // there are several occurences of it ! ==> abort          
+     if (  (TCD_Active_HISR_Heads[i]->tc_activation_count != 1)) 
+       return 0;
+   }
+
+   // Returns remaining ticks number if any timer is active
+   if (TMD_Timer_State == TM_ACTIVE) 	// any active timer ?
+   {
+     if (TMD_Timer <= MIN_SLEEP_TIME) 
+        return(0);
+     else 	
+   	return TMD_Timer;
+   }
+	
+   // Returns not activity if no timer active
+   if (TMD_Timer_State == TM_NOT_ACTIVE) 
+   	return -1;
+   else				
+   // otherwise, returns immediate activity if a timer is expired (TM_EXPIRED)
+        return(0);
+ }
+
+ /*-------------------------------------------------------*/
+ /* int OS_system_protect()                               */
+ /*-------------------------------------------------------*/ 
+ /* Parameters : none                                     */
+ /* Return     : The Thread Control Block of the thread   */
+ /*              which already owns the protection or     */
+ /*              0 if no protection                       */
+ /* Functionality : Checks whether the system structures  */
+ /*                 are already protected or not          */
+ /*-------------------------------------------------------*/
+ void OS_system_protect (void)
+ {  
+   NU_Protect((NU_PROTECT*) &TCD_System_Protect);  
+ }
+
+ /*-------------------------------------------------------*/
+ /* int OS_system_Unprotect()                             */
+ /*-------------------------------------------------------*/ 
+ /* Parameters : none                                     */
+ /* Return     :                                          */
+ /* Functionality : unprotect the system structures       */
+ /*-------------------------------------------------------*/
+ void OS_system_Unprotect (void)
+ {  
+   NU_Unprotect();  
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/ind_os.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,19 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename ind_os.h
+ *        Version  1.2
+ *        Date     05/25/00
+ * 
+ ************* Revision Controle System Header *************/
+
+
+
+#define OS_OK   0
+        
+typedef SYS_WORD16  T_OS_RETURN;
+
+// Prototype for independant os commands
+extern T_OS_RETURN  ind_os_sleep (SYS_UWORD32 millisecs);
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_cst.mak	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,64 @@
+#
+# Makefile used to build the Layer1 customizable library 
+#
+#
+
+include ../layer1_env.mak
+
+L1DBG = -g         # L1 debug option or not
+
+TMCUSTCODE	  = ../tm_cust0
+AUDIOCUSTCODE = ../audio_cust0
+
+L1_CST_EXT_OBJ = $(OBJ)/ind_os.obj $(OBJ)/l1tm_cust.obj $(OBJ)/l1tm_tpu$(RF).obj
+
+L1_CST_INT_OBJ = $(OBJ)/l1audio_cust.obj $(OBJ)/l1_cust.obj
+
+EXT_LIB = $(L1_CST_EXT_LIB)
+
+INT_LIB = $(L1_CST_INT_LIB)
+
+all: all_dir $(EXT_LIB) $(INT_LIB)
+
+all_dir:
+	-mkdir ..$(SLASH)obj
+	-mkdir ..$(SLASH)lib
+
+$(EXT_LIB): $(L1_CST_EXT_OBJ)
+	-$(REMOVE) $(subst /,$(SLASH),$(EXT_LIB))
+	ar470 r $(EXT_LIB) $(L1_CST_EXT_OBJ)
+
+$(INT_LIB): $(L1_CST_INT_OBJ)
+	-$(REMOVE) $(subst /,$(SLASH),$(INT_LIB))
+	ar470 r $(INT_LIB) $(L1_CST_INT_OBJ)
+
+clean:
+	-$(REMOVE) $(subst /,$(SLASH),$(L1_CST_EXT_OBJ))
+	-$(REMOVE) $(subst /,$(SLASH),$(L1_CST_INT_OBJ))
+	-$(REMOVE) $(subst /,$(SLASH),$(EXT_LIB))
+	-$(REMOVE) $(subst /,$(SLASH),$(INT_LIB))
+
+#
+# Sources files
+#
+
+$(OBJ)/ind_os.obj: ind_os.c $(L1INC) $(TMINC) $(AUDIOINC)
+		$(CL470) $(L1FLAGS16) $(L1DBG) $(CDEFS_TI) -I$(IL1) -I$(IL2) -I$(IL3) \
+		      -I$(INC_TM) -I$(IN1) -i$(ICOM) -i$(INC_AUDIO) -I$(INC_GTT) -i$(INC_TM) $(INCDRV) ind_os.c                
+
+$(OBJ)/l1audio_cust.obj: $(AUDIOCUSTCODE)/l1audio_cust.c $(L1INC) $(AUDIOINC) $(TMINC)
+		$(CL470) $(L1FLAGS16_NO_OPT_WA) $(L1DBG) $(CDEFS_TI) -I$(IL1) -I$(IL2) -I$(IL3) \
+       -I$(IN1) -i$(ICOM) -i$(INC_AUDIO) -i$(INC_TM) -I$(INC_GTT) $(INCDRV) $(INCAUDIOENTITY) $(AUDIOCUSTCODE)/l1audio_cust.c
+
+$(OBJ)/l1tm_cust.obj: $(TMCUSTCODE)/l1tm_cust.c $(L1INC) $(TMINC) $(AUDIOINC)
+		$(CL470) $(L1FLAGS16) $(L1DBG) $(CDEFS_TI) -I$(IL1) -I$(IL2) -I$(IL3) -I$(IL7) \
+	      -I$(INC_TM) -I$(IN1) -i$(ICOM) -i$(INC_TM) -i$(INC_AUDIO) -I$(INC_GTT) $(INCDRV) $(TMCUSTCODE)/l1tm_cust.c
+
+$(OBJ)/l1tm_tpu$(RF).obj: $(TMCUSTCODE)/l1tm_tpu$(RF).c $(L1INC) $(TMINC)
+		$(CL470) $(L1FLAGS16) $(L1DBG) $(CDEFS_TI) -I$(IL1) -I$(IL2) -I$(IL3) -I$(IL7) \
+	      -I$(INC_TM) -I$(IN1) -i$(ICOM) -i$(INC_TM) -i$(INC_AUDIO) -I$(INC_GTT) $(INCDRV) $(TMCUSTCODE)/l1tm_tpu$(RF).c
+
+$(OBJ)/l1_cust.obj: l1_cust.c $(L1INC) $(TMINC)
+		$(CL470) $(L1FLAGS16) $(L1DBG) $(CDEFS_TI) -I$(IL1) -I$(IL2) -I$(IL3) \
+	      -I$(IL7) -I$(IN1) -i$(ICOM) -i$(INC_TM) -i$(INC_AUDIO) -I$(INC_GTT) $(INCDRV) $(INCAUDIOENTITY) l1_cust.c
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_cust.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,1187 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software 
+ * L1_CUST.C
+ *
+ *        Filename l1_cust.c
+ *        Version  3.66
+ *        Date     03/21/03
+ *
+ ************* Revision Controle System Header *************/
+
+//#define  GLOBAL
+
+
+#include "string.h"
+
+#include "l1_confg.h"
+#include "l1_const.h"
+#include "ulpd.h"
+#include "tm_defs.h"       
+#include "l1_types.h"
+#include "l1_time.h"
+#include "l1_trace.h"
+#include "sys_types.h"
+#include "sim.h"
+#include "buzzer.h"
+#include "serialswitch.h"
+
+#if TESTMODE
+  #include "l1tm_defty.h"
+#endif
+
+#if (AUDIO_TASK == 1)
+  #include "l1audio_const.h"
+  #include "l1audio_cust.h"
+  #include "l1audio_defty.h"
+#endif
+
+  #if (L1_GTT == 1)
+    #include "l1gtt_const.h"
+    #include "l1gtt_defty.h"
+  #endif
+#include "l1_defty.h"
+#include "l1_msgty.h"
+#include "l1_tabs.h"
+#include "l1_varex.h"
+
+#if (VCXO_ALGO == 1)
+  #include "l1_ctl.h"
+#endif
+
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+  #include "spi_drv.h"
+#endif
+
+#if (RF==35)
+  #include "tpudrv35.h"
+  #include "l1_rf35.h"
+  #include "l1_rf35.c"
+#endif
+
+#if (RF==12)
+  #include "tpudrv12.h"
+  #include "l1_rf12.h"
+  #include "l1_rf12.c"
+#endif
+
+#if (RF==10)
+  #include "tpudrv10.h"
+  #include "l1_rf10.h"
+  #include "l1_rf10.c"
+#endif
+
+#if (RF==8)
+  #include "tpudrv8.h"
+  #include "l1_rf8.h"
+  #include "l1_rf8.c"
+#endif
+
+#if (RF==2)
+  #include "l1_rf2.h"
+  #include "l1_rf2.c"
+#endif
+
+// Nucleus functions
+extern INT                TMD_Timer_State;
+extern UWORD32            TMD_Timer;               // for big sleep 
+extern UWORD32            TCD_Priority_Groups;
+extern VOID              *TCD_Current_Thread;
+extern TC_HCB            *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
+extern TC_HCB            *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
+extern TC_PROTECT         TCD_System_Protect;
+
+#if (L2_L3_SIMUL == 0)
+  #define FFS_WORKAROUND 1
+#else
+  #define FFS_WORKAROUND 0
+#endif
+#if (FFS_WORKAROUND == 1)
+  #include "ffs.h"
+#else
+  typedef signed   int   int32;
+  typedef signed char effs_t;
+  typedef int32  filesize_t;
+  effs_t ffs_fwrite(const char *name, void *addr, filesize_t size);
+  effs_t ffs_fread(const char *name, void *addr, filesize_t size);  
+#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 (CODE_VERSION != SIMULATION)
+  // Import serial switch configuration
+  extern char ser_cfg_info[2];
+#endif
+
+void   get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+UWORD8 save_cal_in_nvmem  (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+void config_rf_rw_band(char type, UWORD8 read);
+void config_rf_read(char type);
+void config_rf_write(char type);
+
+//TISH20040421 Sean modified for watchdog implemention
+BOOL watchdog_applied(void)
+{
+	return TRUE;
+}
+//Sean modified end
+
+enum {
+  RF_ID        = 0,
+  ADC_ID       = 1
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the location of rf-struct      */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+
+const static T_BAND_CONFIG band_config[] =
+{ /*ffs name, default addr, max carrier, min tx pwr */
+  {"",(T_RF_BAND *) 0,0,0},//undefined
+  {"900", (T_RF_BAND *)&rf_900,  174, 19 },//EGSM
+  {"1800",(T_RF_BAND *)&rf_1800, 374, 15 },//DCS
+  {"1900",(T_RF_BAND *)&rf_1900, 299, 15 },//PCS
+  {"850", (T_RF_BAND *)&rf_850,  124, 19 },//GSM850
+#if (RF == 10)
+  {"1900_us",(T_RF_BAND *)&rf_1900, 299, 15 },//usdual 1900 rf tables are the same as 3band 1900 rf tables at the moment
+#endif
+  {"900", (T_RF_BAND *)&rf_900,  124, 19 } //GSM, this should be last entry
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the indices into band_config   */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+const T_STD_CONFIG std_config[] =
+{
+ /* band1 index,  band2 index, txpwr turning point, first arfcn*/
+  {           0,          0,     0, 0   }, // std = 0 not used
+  { BAND_GSM900,  BAND_NONE,     0, 1   }, // std = 1 GSM
+  { BAND_EGSM900, BAND_NONE,     0, 1   }, // std = 2 EGSM
+  { BAND_PCS1900, BAND_NONE,    21, 512 }, // std = 3 PCS
+  { BAND_DCS1800, BAND_NONE,    28, 512 }, // std = 4 DCS
+  { BAND_GSM900,  BAND_DCS1800, 28, 1   }, // std = 5 DUAL
+  { BAND_EGSM900, BAND_DCS1800, 28, 1   }, // std = 6 DUALEXT
+  { BAND_GSM850,  BAND_NONE,     0, 128 }, // std = 7 850
+#if (RF == 10)
+  { BAND_GSM850,  BAND_PCS1900_US, 21, 1   }  // std = 8 850/1900
+#else
+  { BAND_GSM850,  BAND_PCS1900, 21, 1   }  // std = 8 850/1900
+#endif
+};
+
+/*-------------------------------------------------------*/
+/* Prototypes of external functions used in this file.   */
+/*-------------------------------------------------------*/
+void l1_initialize(T_MMI_L1_CONFIG *mmi_l1_config);
+WORD16 Convert_l1_radio_freq  (UWORD16 radio_freq);
+
+/*-------------------------------------------------------*/
+/* Cust_recover_Os()                                      */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description: adjust OS from sleep duration            */
+/* ------------                                          */
+/* This function fix the :                               */
+/* - system clock                                        */
+/* - Nucleus timers                                      */
+/* - xxxxxx (customer dependant)                         */
+/*-------------------------------------------------------*/
+ 
+UWORD8 Cust_recover_Os(void)
+{
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {    
+    UWORD32 current_system_clock;
+
+    /***************************************************/
+    // Fix System clock and Nucleus Timers if any....  */
+    /***************************************************/
+    // Fix System clock ....
+    current_system_clock  = NU_Retrieve_Clock();
+    current_system_clock += l1s.pw_mgr.sleep_duration;
+    NU_Set_Clock(current_system_clock);
+
+    // Fix Nucleus timer (if needed) ....
+    if (TMD_Timer_State == TM_ACTIVE)
+    {
+      TMD_Timer -= l1s.pw_mgr.sleep_duration;
+      if (!TMD_Timer) TMD_Timer_State = TM_EXPIRED;
+    }
+
+    /***************************************************/
+    // Cust dependant part                        ...  */
+    /***************************************************/
+    //.............
+    //.............
+    //..............
+    return(TRUE);
+
+  }
+#endif
+}
+
+
+
+/*-------------------------------------------------------*/
+/* Cust_check_system()                                    */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description:                                          */
+/* ------------                                          */
+/* GSM 1.5 :                                             */
+/* - authorize UWIRE clock to be stopped                 */
+/*   and write value in l1s.pw_mgr.modules_status.       */
+/* - authorize ARMIO clock to be stopped if the light is */
+/*   off and write value in l1s.pw_mgr.modules_status.   */
+/* - check if SIM clock have been stopped                */
+/*   before allowing DEEP SLEEP.                         */
+/* - check if UARTs are ready to enter deep sleep        */
+/* - choose the sleep mode                               */
+/*                                                       */
+/* Return:                                               */
+/* -------                                               */
+/* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP                */     
+/*-------------------------------------------------------*/
+UWORD8 Cust_check_system(void)
+{
+  extern UWORD8 why_big_sleep;
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {   
+
+#if (L2_L3_SIMUL == 0)
+    // Forbid deep sleep if the light is on 
+    if(LT_Status())
+    {
+      //cut ARMIO and UWIRE clocks in big sleep
+      l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+      why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
+    // Forbid deep sleep if the SIM and UARTs not ready 
+    if(SIM_SleepStatus())
+    {
+#endif
+      if(SER_UartSleepStatus()) 
+      {
+        return(CLOCK_STOP);   // DEEP sleep
+      }
+      else why_big_sleep = BIG_SLEEP_DUE_TO_UART;
+#if (L2_L3_SIMUL == 0)
+   }
+   else why_big_sleep = BIG_SLEEP_DUE_TO_SIM;
+#endif
+        // cut ARMIO and UWIRE clocks in big sleep
+        l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+        return(FRAME_STOP);  // BIG sleep
+  }
+#else // Simulation part
+  return(CLOCK_STOP);   // DEEP sleep
+#endif
+}
+
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configuration, tables etc. */
+/*                from FFS files.                        */
+/*-------------------------------------------------------*/
+const static T_CONFIG_FILE config_files_common[] =
+{
+  #if (CODE_VERSION != SIMULATION)
+
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+    "f/gsm/rf/afcdac",             &rf.afc.eeprom_afc, sizeof(rf.afc.eeprom_afc),
+    "F/gsm/rf/stdmap",             &rf.radio_band_support, sizeof(rf.radio_band_support),
+#if (VCXO_ALGO == 1)
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32) + 4 * sizeof(WORD16),
+#else
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32),
+#endif
+
+    "R/gsm/rf/rx/agcglobals",      &rf.rx.agc, 5 * sizeof(UWORD16),
+    "R/gsm/rf/rx/il2agc",          &rf.rx.agc.il2agc_pwr[0], 3 * sizeof(rf.rx.agc.il2agc_pwr),
+    "R/gsm/rf/rx/agcwords",        &AGC_TABLE, sizeof(AGC_TABLE),
+
+    "s/sys/adccal",                &adc_cal, sizeof(adc_cal),
+
+    "S/sys/abb",                   &abb, sizeof(abb),
+    "S/sys/uartswitch",            &ser_cfg_info, sizeof(ser_cfg_info),
+
+  #endif
+    NULL,                          0, 0 // terminator
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configurations for         */ 
+/*                each band from FFS files. These files  */
+/*                are defined for one band, and and used */
+/*                for all bands.                         */
+/*-------------------------------------------------------*/
+const static T_CONFIG_FILE config_files_band[] =
+{
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+      
+    // generic for all bands
+    // band[0] is used as template for all bands. 
+    "t/gsm/rf/tx/ramps",     &rf_band[0].tx.ramp_tables,    sizeof(rf_band[0].tx.ramp_tables),
+    "t/gsm/rf/tx/levels",    &rf_band[0].tx.levels,         sizeof(rf_band[0].tx.levels),
+    "t/gsm/rf/tx/calchan",   &rf_band[0].tx.chan_cal_table, sizeof(rf_band[0].tx.chan_cal_table),
+    "T/gsm/rf/tx/caltemp",   &rf_band[0].tx.temp,           sizeof(rf_band[0].tx.temp),
+
+    "r/gsm/rf/rx/calchan",   &rf_band[0].rx.agc_bands,      sizeof(rf_band[0].rx.agc_bands),
+    "R/gsm/rf/rx/caltemp",   &rf_band[0].rx.temp,           sizeof(rf_band[0].rx.temp),
+    "r/gsm/rf/rx/agcparams", &rf_band[0].rx.rx_cal_params,  sizeof(rf_band[0].rx.rx_cal_params),
+    NULL,                          0,                   0 // terminator
+};
+
+void config_ffs_read(char type)
+{
+  config_rf_read(type);
+  config_rf_rw_band(type, 1);
+}
+
+void config_ffs_write(char type)
+{
+  config_rf_write(type);
+  config_rf_rw_band(type, 0);
+}
+
+void config_rf_read(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fread(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_write(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fwrite(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_rw_band(char type, UWORD8 read)
+{
+    const T_CONFIG_FILE *f1 = config_files_band;
+    UWORD8 i;
+    WORD32 offset;
+    char name[64];
+    char *p;
+    UWORD8 std = l1_config.std.id;
+    
+#if FFS_WORKAROUND == 1
+    struct stat_s stat;
+    UWORD16 time;
+#endif        
+    for (i=0; i< GSM_BANDS; i++)
+    { 
+      if(std_config[std].band[i] !=0 )
+      {
+        f1 = &config_files_band[0];
+        while (f1->name != NULL)
+        {
+          offset = (WORD32) f1->addr - (WORD32) &rf_band[0]; //offset in bytes
+          p = ((char *) &rf_band[i]) + offset;
+          if (type == '*' || type == f1->name[0]) 
+          {
+            strcpy(name, &f1->name[1]);
+            strcat(name, ".");
+            strcat(name, band_config[std_config[std].band[i]].name);
+
+            if (read == 1)
+              ffs_fread(name, p, f1->size);
+            else //write == 0
+            {  
+              ffs_fwrite(name, p, f1->size);  
+
+              // wait until ffs write has finished 
+#if FFS_WORKAROUND == 1
+              stat.inode = 0;
+              time = 0;
+
+              do {
+                rvf_delay(10);  // in milliseconds
+                time += 10;
+                ffs_stat(name, &stat);
+              } while (stat.inode == 0 && time < 500);
+#endif
+            }  
+          }
+          f1++;
+        }
+      }
+    }
+}
+
+/*-------------------------------------------------------*/
+/* Cust_init_std()                                       */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init Standard variable configuration  */
+/*-------------------------------------------------------*/
+void Cust_init_std(void)
+{
+  UWORD8 std = l1_config.std.id;
+  UWORD8 band1, band2;
+  T_RF_BAND *pt1, *pt2;
+  
+  band1 = std_config[std].band[0];
+  band2 = std_config[std].band[1];
+  
+  //get these from std 
+  pt1 = band_config[band1].addr;
+  pt2 = band_config[band2].addr;
+
+  // copy rf-struct from default flash to ram
+  memcpy(&rf_band[0], pt1, sizeof(T_RF_BAND));
+
+  if(std_config[std].band[1] != BAND_NONE )
+    memcpy(&rf_band[1], pt2, sizeof(T_RF_BAND));
+
+  // Read all RF and system configuration from FFS *before* we copy any of
+  // the rf structure variables to other places, like L1.
+
+  config_ffs_read('*');
+
+  l1_config.std.first_radio_freq       = std_config[std].first_arfcn;
+
+  if(band2!=0)
+    l1_config.std.first_radio_freq_band2 = band_config[band1].max_carrier + 1;
+  else  
+    l1_config.std.first_radio_freq_band2 = 0; //band1 carrier + 1 else 0
+    
+  // if band2 is not used it is initialised with zeros
+  l1_config.std.nbmax_carrier          = band_config[band1].max_carrier;
+  if(band2!=0)
+     l1_config.std.nbmax_carrier      += band_config[band2].max_carrier;
+    
+  l1_config.std.max_txpwr_band1        = band_config[band1].max_txpwr;
+  l1_config.std.max_txpwr_band2        = band_config[band2].max_txpwr;
+  l1_config.std.txpwr_turning_point    = std_config[std].txpwr_tp;
+  l1_config.std.cal_freq1_band1        = 0;
+  l1_config.std.cal_freq1_band2        = 0;
+    
+  l1_config.std.g_magic_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band1  = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band1             = rf_band[MULTI_BAND1].swap_iq;
+
+  l1_config.std.g_magic_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band2  = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band2             = rf_band[MULTI_BAND2].swap_iq;
+
+  l1_config.std.radio_freq_index_offset   = l1_config.std.first_radio_freq-1;
+
+  // init variable indicating which radio bands are supported by the chosen RF
+  l1_config.std.radio_band_support = rf.radio_band_support;
+}
+
+
+/*-------------------------------------------------------*/
+/* Cust_init_params()                                    */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init RF dependent paramters (AGC, TX) */
+/*-------------------------------------------------------*/
+void Cust_init_params(void)
+{
+
+#if (CODE_VERSION==SIMULATION)
+  extern UWORD16  simu_RX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+  extern UWORD16  simu_TX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+
+  l1_config.params.rx_synth_setup_time   = simu_RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = simu_TX_SYNTH_SETUP_TIME;
+#else
+  l1_config.params.rx_synth_setup_time   = RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = TX_SYNTH_SETUP_TIME;
+#endif
+
+
+  // Convert SYNTH_SETUP_TIME into SPLIT.
+  // We have kept a margin of 20qbit (EPSILON_MEAS) to cover offset change and Scenario closing time + margin.
+  l1_config.params.rx_synth_load_split   = 1L + (l1_config.params.rx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_synth_load_split   = 1L + (l1_config.params.tx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+
+  l1_config.params.rx_synth_start_time   = TPU_CLOCK_RANGE + PROVISION_TIME - l1_config.params.rx_synth_setup_time;
+  l1_config.params.tx_synth_start_time   = TPU_CLOCK_RANGE - l1_config.params.tx_synth_setup_time;
+
+  l1_config.params.rx_change_synchro_time = l1_config.params.rx_synth_start_time - EPSILON_SYNC;
+  l1_config.params.rx_change_offset_time  = l1_config.params.rx_synth_start_time - EPSILON_OFFS;
+
+  l1_config.params.tx_change_offset_time = TIME_OFFSET_TX - 
+                                           TA_MAX - 
+                                           l1_config.params.tx_synth_setup_time - 
+                                           EPSILON_OFFS;
+
+  // TX duration = ramp up time + burst duration (data + tail bits) 
+  l1_config.params.tx_nb_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + NB_BURST_DURATION_UL;
+  l1_config.params.tx_ra_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + RA_BURST_DURATION;
+
+  l1_config.params.tx_nb_load_split = 1L + (l1_config.params.tx_nb_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_ra_load_split = 1L + (l1_config.params.tx_ra_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+
+  // time for the end of RX and TX TPU scenarios
+  l1_config.params.rx_tpu_scenario_ending = RX_TPU_SCENARIO_ENDING;
+  l1_config.params.tx_tpu_scenario_ending = TX_TPU_SCENARIO_ENDING; 
+
+  // FB26 anchoring time is computed backward to leave only 6 qbit margin between
+  // FB26 window and next activity (RX time tracking).
+  // This margin is used as follow:
+  //    Serving offset restore: 1 qbit (SERV_OFFS_REST_LOAD)
+  //    Tpu Sleep:              2 qbit (TPU_SLEEP_LOAD)
+  //                          ---------
+  //                     Total: 3 qbit
+   
+  l1_config.params.fb26_anchoring_time = (l1_config.params.rx_synth_start_time - 
+                                          #if (CODE_VERSION == SIMULATION)
+                                          // simulator: end of scenario not included in window (no serialization)
+                                            1 -
+                                          #else
+                                          // RF dependent end of RX TPU scenario
+                                            l1_config.params.rx_tpu_scenario_ending -
+                                          #endif
+                                          EPSILON_SYNC -               
+                                          TPU_SLEEP_LOAD -
+                                          SERV_OFFS_REST_LOAD -   
+                                          FB26_ACQUIS_DURATION -  
+                                          PROVISION_TIME +        
+                                          TPU_CLOCK_RANGE) % TPU_CLOCK_RANGE;
+
+  l1_config.params.fb26_change_offset_time  = l1_config.params.fb26_anchoring_time +
+                                              PROVISION_TIME - 
+                                              l1_config.params.rx_synth_setup_time -
+                                              EPSILON_OFFS;
+
+  l1_config.params.guard_bits         = rf.tx.guard_bits;
+
+  l1_config.params.prg_tx_gsm         = rf.tx.prg_tx;
+  l1_config.params.prg_tx_dcs         = rf.tx.prg_tx; //delay for dual band not implemented yet
+
+  l1_config.params.low_agc_noise_thr  = rf.rx.agc.low_agc_noise_thr;
+  l1_config.params.high_agc_sat_thr   = rf.rx.agc.high_agc_sat_thr;
+  l1_config.params.low_agc            = rf.rx.agc.low_agc;
+  l1_config.params.high_agc           = rf.rx.agc.high_agc;
+  l1_config.params.il_min             = IL_MIN;
+
+  l1_config.params.fixed_txpwr        = FIXED_TXPWR;
+  l1_config.params.eeprom_afc         = rf.afc.eeprom_afc;
+  l1_config.params.setup_afc_and_rf   = SETUP_AFC_AND_RF;
+
+  l1_config.params.psi_sta_inv        = rf.afc.psi_sta_inv;
+  l1_config.params.psi_st             = rf.afc.psi_st;
+  l1_config.params.psi_st_32          = rf.afc.psi_st_32;
+  l1_config.params.psi_st_inv         = rf.afc.psi_st_inv;
+
+#if (CODE_VERSION == SIMULATION)
+  #if (VCXO_ALGO == 1)
+    l1_config.params.afc_algo           = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+  #endif
+#else
+  #if (VCXO_ALGO == 1)
+    l1_config.params.afc_dac_center       = rf.afc.dac_center;      // VCXO - assuming DAC linearity
+    l1_config.params.afc_dac_min          = rf.afc.dac_min;         // VCXO - assuming DAC linearity
+    l1_config.params.afc_dac_max          = rf.afc.dac_max;         // VCXO - assuming DAC linearity
+    l1_config.params.afc_snr_thr          = rf.afc.snr_thr;         // VCXO - SNR threshold
+    l1_config.params.afc_algo             = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+    l1_config.params.afc_win_avg_size_M   = C_WIN_AVG_SIZE_M;       // VCXO - Average psi values with this value
+    l1_config.params.rgap_algo            = ALGO_AFC_RXGAP;         // VCXO - Choosing Reception Gap algorithm
+    l1_config.params.rgap_bad_snr_count_B = C_RGAP_BAD_SNR_COUNT_B; // VCXO - Prediction SNR count
+  #endif
+  #endif
+
+  #if DCO_ALGO
+    #if (RF == 10)
+      // Enable DCO algorithm for direct conversion RFs
+      l1_config.params.dco_enabled = TRUE;
+    #else
+      l1_config.params.dco_enabled = FALSE;
+    #endif
+  #endif
+
+  #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.vbur             = abb[ABB_VBUR];		  // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];		  // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];		  // value at reset
+    l1_config.params.apcoff           = abb[ABB_APCOFF];	  // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];	  // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];	  // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];  // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];	  // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];		  // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    l1_config.params.apcdel           = abb[ABB_APCDEL];	  // value at reset
+  #endif
+  #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.vbur             = abb[ABB_VBUR];		  // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];		  // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];		  // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];    // value at reset    
+    l1_config.params.apcoff           = abb[ABB_APCOFF];	  // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];	  // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];	  // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];  // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];	  // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];		  // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    l1_config.params.vbcr2            = abb[ABB_VBCR2];      // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    l1_config.params.apcdel           = abb[ABB_APCDEL];	  // value at reset
+    l1_config.params.apcdel2          = abb[ABB_APCDEL2];    // value at reset    
+  #endif													 
+  #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.vbur             = abb[ABB_VBUR];          // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];          // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];         // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];       // value at reset    
+    l1_config.params.apcoff           = abb[ABB_APCOFF];        // X2 Slope 128 and APCSWP disabled
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];       // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];       // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];    // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];        // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];          // VULSWITCH=0
+    l1_config.params.vbcr2            = abb[ABB_VBCR2];         // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    l1_config.params.apcdel           = abb[ABB_APCDEL];        // value at reset
+    l1_config.params.apcdel2          = abb[ABB_APCDEL2];       // value at reset    
+    l1_config.params.vbpop            = abb[ABB_VBPOP];         // HSOAUTO enabled
+    l1_config.params.vau_delay_init   = abb[ABB_VAUDINITD];     // 2 TDMA Frames between VDL "ON" and VDLHSO "ON"
+    l1_config.params.vaud_cfg         = abb[ABB_VAUDCR];        // value at reset
+    l1_config.params.vauo_onoff       = abb[ABB_VAUOCR];        // speech on AUX and EAR
+    l1_config.params.vaus_vol         = abb[ABB_VAUSCR];        // value at reset
+    l1_config.params.vaud_pll         = abb[ABB_VAUDPLL];       // value at reset
+  #endif
+  
+  // global variable for access to deep sleep time
+  l1_config.params.sleep_time = 0;
+}
+
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_from_IL()                                */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : returns agc value                     */
+/*-------------------------------------------------------*/
+WORD8 Cust_get_agc_from_IL(UWORD16 radio_freq, UWORD16 agc_index, UWORD8 table_id)
+{
+// radio_freq currently not used
+// this parameter is passed in order to allow band dependent tables for specific RFs
+// (e.g. dual band RF with separate AGC H/W blocks for GSM and DCS)
+
+  if (agc_index > 120)
+    agc_index = 120;    // Clip agc_index
+
+  switch (table_id)
+  {
+    case MAX_ID:  return(rf.rx.agc.il2agc_max[agc_index]);
+    case AV_ID:   return(rf.rx.agc.il2agc_av[agc_index]);
+    case PWR_ID:  return(rf.rx.agc.il2agc_pwr[agc_index]);
+  }
+}
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_band                                     */
+/*-------------------------------------------------------*/
+/* Parameters : radio_freq                               */
+/* Return     : band number                              */
+/* Functionality :  Computes the band for RF calibration */
+/*-------------------------------------------------------*/
+/*---------------------------------------------*/
+
+
+  #if (CODE_VERSION == SIMULATION)
+    UWORD16 Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #else
+    UWORD16 inline Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #endif
+    {
+      WORD32 i ;
+
+      for (i=0;i<RF_RX_CAL_CHAN_SIZE;i++)
+      {
+        if (arfcn <= rf_band[gsm_band].rx.agc_bands[i].upper_bound)
+          return(i);
+      }
+      // Should never happen!
+      return(0);
+    }  
+
+/*-------------------------------------------------------*/
+/* Cust_is_band_high                                     */
+/*-------------------------------------------------------*/
+/* Parameters :  arfcn                                   */
+/* Return     :  0 if low band                           */
+/*               1 if high band                          */
+/* Functionality : Generic function which return 1 if    */
+/*                 arfcn is in the high band             */
+/*-------------------------------------------------------*/
+
+UWORD8 Cust_is_band_high(UWORD16 radio_freq)
+{
+  UWORD16 max_carrier;
+  UWORD8  std = l1_config.std.id;
+
+  max_carrier = band_config[std_config[std].band[0]].max_carrier;
+  
+  return(((radio_freq >= l1_config.std.first_radio_freq) && 
+          (radio_freq < (l1_config.std.first_radio_freq + max_carrier))) ? MULTI_BAND1 : MULTI_BAND2);
+}          
+    
+/*-------------------------------------------------------*/
+/* l1ctl_encode_delta2()                                 */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+WORD8 l1ctl_encode_delta2(UWORD16 radio_freq)
+{  
+  WORD8    delta2_freq;
+  UWORD16  i;
+  UWORD16  arfcn;
+  UWORD8   band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+  
+  i = Cust_get_agc_band(arfcn,band); //
+  delta2_freq = rf_band[band].rx.agc_bands[i].agc_calib;
+
+  //temperature compensation
+  for (i=0;i<RF_RX_CAL_TEMP_SIZE;i++)
+  {
+    if ((WORD16)adc.converted[ADC_RFTEMP] <= rf_band[band].rx.temp[i].temperature)
+    {
+      delta2_freq += rf_band[band].rx.temp[i].agc_calib;
+      break;
+    }
+  }
+
+  return(delta2_freq);
+}
+
+/************************************/
+/* TX Management                    */
+/************************************/
+/*-------------------------------------------------------*/
+/* Cust_get_ramp_tab                                     */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+
+void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq)
+{
+  UWORD16 index_up, index_down,j, arfcn;
+  UWORD8 band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+
+  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 ((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) |
+                ((rf_band[band].tx.ramp_tables[index_up].ramp_up[j])  << 6) |
+                  0x14;
+    }
+  #endif 
+}
+
+/*-------------------------------------------------------*/
+/* get_pwr_data                                          */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq)
+{  
+
+  UWORD16 i,j;
+  UWORD16 arfcn;
+  UWORD8 band;
+
+#if(ORDER2_TX_TEMP_CAL==1)
+        WORD16 pwr_data;
+#else
+        UWORD16  pwr_data;
+#endif
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+   
+  i = rf_band[band].tx.levels[txpwr].chan_cal_index;
+  j=0;
+  // get uncalibrated apc
+  pwr_data = rf_band[band].tx.levels[txpwr].apc;
+
+  while (arfcn > rf_band[band].tx.chan_cal_table[i][j].arfcn_limit)
+    j++;
+
+  // channel calibrate apc  
+  pwr_data = ((UWORD32) (pwr_data * rf_band[band].tx.chan_cal_table[i][j].chan_cal))/128; 
+
+  // temperature compensate apc
+  {
+    T_TX_TEMP_CAL *pt;
+
+    pt = rf_band[band].tx.temp;
+    while ((WORD16)adc.converted[ADC_RFTEMP] > pt->temperature)
+	    pt++;
+#if(ORDER2_TX_TEMP_CAL==1)
+                pwr_data += (txpwr*(pt->a*txpwr + pt->b) + pt->c) / 64;      //delta apc = ax^2+bx+c
+                if(pwr_data < 0) pwr_data = 0;
+#else
+    pwr_data += pt->apc_calib;
+#endif
+  }
+  return(pwr_data);
+}
+#endif
+/*-------------------------------------------------------*/
+/* Cust_Init_Layer1                                      */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :  Load and boot the DSP                */
+/* Initialize shared memory and L1 data structures       */
+/*-------------------------------------------------------*/
+
+void Cust_Init_Layer1(void)
+{
+  T_MMI_L1_CONFIG cfg;
+  
+  // Get the current band configuration from the flash
+  #if (OP_WCP==1)
+    extern unsigned char ffs_GetBand();
+    cfg.std = ffs_GetBand();
+  #else // NO OP_WCP
+    //  cfg.std = std;
+    cfg.std = STD;
+  #endif // OP_WCP
+
+  cfg.tx_pwr_code = 1;
+
+  // sleep management configuration
+  cfg.pwr_mngt = 0;
+  cfg.pwr_mngt_mode_authorized = NO_SLEEP; //Sleep mode
+  cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
+
+
+
+  #if (CODE_VERSION != SIMULATION)
+    cfg.dwnld = DWNLD; //external define from makefile
+  #endif
+
+  l1_initialize(&cfg);
+
+  get_cal_from_nvmem((UWORD8 *)&rf, sizeof(rf), RF_ID);
+  get_cal_from_nvmem((UWORD8 *)&adc_cal, sizeof(adc_cal), ADC_ID);
+
+}
+
+
+/*****************************************************************************************/
+/***************************     TESTMODE functions     **********************************/
+/*****************************************************************************************/
+
+
+
+  /*------------------------------------------------------*/
+  /* madc_hex_2_physical                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Function to convert MAD hexadecimal  */ 
+  /*                 values into physical values          */
+  /*------------------------------------------------------*/
+
+void madc_hex_2_physical (UWORD16 *adc_hex, T_ADC *adc_phy)  
+{
+ WORD16 i; 
+ UWORD16 y;
+ WORD16 Smin = 0, Smax = TEMP_TABLE_SIZE-1;
+ WORD16 index = (TEMP_TABLE_SIZE-1)/2;       /* y is the adc code after compensation of ADC slope error introduced by VREF error */
+
+  //store raw ADC values
+  memcpy(&adc.raw[0], adc_hex, sizeof(adc.raw));   
+
+  // Convert Vbat [mV] : direct equation with slope and offset compensation 
+  for (i = ADC_VBAT; i<ADC_RFTEMP; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+
+  /*Convert RF Temperature [Celsius]: binsearch into a table*/ 
+  y = ((UWORD32)(adc_cal.a[ADC_RFTEMP] * adc.raw[ADC_RFTEMP]))>>8;       /* rf.tempcal is the calibration of VREF*/
+  while((Smax-Smin) > 1 )
+  {
+    if(y < temperature[index].adc)
+      Smax=index;
+    else 
+      Smin=index;
+       
+    index = (Smax+Smin)/2;
+  }
+  adc.converted[ADC_RFTEMP] = temperature[index].temp;
+   
+  for (i = ADC_RFTEMP+1; i<ADC_INDEX_END; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+   
+  //store converted ADC values
+  memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
+}
+
+
+  /*------------------------------------------------------*/
+  /*  get_cal_from_nvmem                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated parameter to         */ 
+  /*                 calibration structure in RAM         */
+  /*------------------------------------------------------*/
+
+void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+ 
+}
+
+  /*------------------------------------------------------*/
+  /*  save_cal_from_nvmem                                 */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated structure from RAM   */ 
+  /*                 into NV memory                       */
+  /*------------------------------------------------------*/
+
+UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+  #if (OP_WCP == 1)
+    //  FFS backup implementation an Avenger 2
+    // Request MPU-S to backup the FFS 
+    // after full calibration of device
+    extern void ffs_backup(void);
+    ffs_backup();
+  #endif
+  return (0);
+}
+
+#if (TRACE_TYPE == 4)
+
+/*------------------------------------------------------*/
+/*  l1_cst_l1_parameters                                */
+/*------------------------------------------------------*/
+/* Parameters :  s: pointer on configuration string     */
+/* Return     :  nothing: global var are set            */
+/* Functionality : Set global L1 vars for dynamic trace */ 
+/*                 and configuration                    */
+/*                                                      */
+/*   This function is called when a CST message is sent */
+/*   from the Condat Panel.                             */
+/*------------------------------------------------------*/
+void l1_cst_l1_parameters(char *s)
+{
+  /* 
+    a sample command string can be: 
+    L1_PARAMS=<1,2,3,4,5> or
+    L1_PARAMS=<1,23,3E32,4,5>
+    with n parameters (here: 5 params); n>=1
+    parameters are decoded as hexadecimal unsigned integers (UWORD16)
+  */
+
+  UWORD8  uNParams = 0;  /* Number of parameters */
+  UWORD32 aParam[10];    /* Parameters array */
+  UWORD8  uIndex = 0;
+  
+  /* ***  retrieve all parameters *** */
+  while (s[uIndex] != '<') uIndex++;
+  uIndex++;
+  aParam[0] = 0;
+  
+  /* uIndex points on 1st parameter */
+ 
+  while (s[uIndex] != '>')
+  {
+    if (s[uIndex] == ',') 
+    {
+      uNParams++;
+      aParam[uNParams] = 0;
+    }
+    else
+    {
+      /* uIndex points on a parameter char */
+      UWORD8 uChar = s[uIndex];
+      aParam[uNParams] = aParam[uNParams] << 4; /* shift 4 bits left */
+      if ((uChar>='0') && (uChar<='9'))
+        aParam[uNParams] += (uChar - '0');        /* retrieve value */
+      else if ((uChar>='A') && (uChar<='F'))
+        aParam[uNParams] += (10 + uChar - 'A');        /* retrieve value */
+      else if ((uChar>='a') && (uChar<='f'))
+        aParam[uNParams] += (10 + uChar - 'a');        /* retrieve value */
+    }
+    
+    uIndex++; /* go to next char */
+  }
+
+  /* increment number of params */  
+  uNParams++;
+
+  /* *** handle parameters *** */
+  /*
+    1st param: command type
+    2nd param: argument for command type
+  */
+  switch (aParam[0])
+  {
+    case 0: /* Trace setting */ 
+      /* The 2nd parameter contains the trace bitmap*/
+      if (uNParams >=2)
+        trace_info.current_config->l1_dyn_trace = aParam[1];
+      else 
+        trace_info.current_config->l1_dyn_trace = 0; /* error case: disable all trace */
+      Trace_dyn_trace_change();
+      break;
+    default: /* ignore it */
+      break;
+  } // switch
+}
+
+#endif
+
+#if ((CHIPSET == 2) || (CHIPSET == 3) || (CHIPSET == 4) || \
+     (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
+     (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || \
+     (CHIPSET == 11) || (CHIPSET == 12))    
+/*-------------------------------------------------------*/
+/* power_down_config() : temporary implementation !!!    */
+/*-------------------------------------------------------*/
+/* Parameters : sleep_mode (NO, SMALL, BIG, DEEP or ALL) */
+/*              clocks to be cut in BIG sleep            */
+/* Return     :                                          */
+/* Functionality : set the l1s variables 				 */
+/* l1s.pw_mgr.mode_authorized and l1s.pw_mgr.clocks      */
+/* according to the desired mode.	                     */
+/*-------------------------------------------------------*/
+void power_down_config(UWORD8 sleep_mode, UWORD16 clocks)
+{ 
+#if (OP_L1_STANDALONE == 1)
+  if(sleep_mode != NO_SLEEP)
+#endif
+  {
+    l1_config.pwr_mngt = PWR_MNGT;
+    l1s.pw_mgr.mode_authorized = sleep_mode;
+    l1s.pw_mgr.clocks = clocks;
+  }
+  
+#if (OP_L1_STANDALONE == 0)
+  l1s.pw_mgr.enough_gaug = FALSE;
+#endif
+}
+#endif
+
+/* glowing,2004-06-16, import from M188 */
+void layer1_em_get_rxlevqual(WORD32 *l1_rxlev_scell,WORD32 *l1_rxlev_dedic_sub,
+	WORD32 *l1_rxqual_dedic,WORD32 *l1_rxqual_dedic_sub)
+{
+/*
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.acc));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.nbr_meas));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.acc_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_full));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub));
+*/
+	if(l1a_l1s_com.Scell_info.meas.nbr_meas != 0){
+	*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(l1a_l1s_com.Scell_info.meas.nbr_meas);
+	}else{
+	*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(4);
+	}
+//	xmzhou_trace_string_value("l1_rxlev_scell",(UINT32)(*l1_rxlev_scell));
+
+	if(l1a_l1s_com.Smeas_dedic.nbr_meas_sub !=0){
+	*l1_rxlev_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub);
+	}else{
+	*l1_rxlev_dedic_sub=0;
+	}
+//	xmzhou_trace_string_value("l1_rxlev_dedic_sub",(UINT32)(*l1_rxlev_dedic_sub));
+
+	if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full !=0){
+	*l1_rxqual_dedic=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_full)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full);
+	}else{
+	*l1_rxqual_dedic=0;
+	}
+//	xmzhou_trace_string_value("l1_rxqual_dedic",(UINT32)(*l1_rxqual_dedic));
+
+	if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub){
+	*l1_rxqual_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub);
+	}else{
+	*l1_rxqual_dedic_sub=0;
+	}
+//	xmzhou_trace_string_value("l1_rxqual_dedic_sub",(UINT32)(*l1_rxqual_dedic_sub));
+}
+
+void layer1_em_get_mode(WORD32 *l1_mode)
+{
+	*l1_mode=l1a_l1s_com.mode;
+}
+
+/*glowing,2004-06-16, end of import */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_cust.c_traceversion	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,1179 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software 
+ * L1_CUST.C
+ *
+ *        Filename l1_cust.c
+ *        Version  3.66
+ *        Date     03/21/03
+ *
+ ************* Revision Controle System Header *************/
+
+//#define  GLOBAL
+
+#include "string.h"
+
+#include "l1_confg.h"
+#include "l1_const.h"
+#include "ulpd.h"
+#include "tm_defs.h"       
+#include "l1_types.h"
+#include "l1_time.h"
+#include "l1_trace.h"
+#include "sys_types.h"
+#include "sim.h"
+#include "buzzer.h"
+#include "serialswitch.h"
+
+#if TESTMODE
+  #include "l1tm_defty.h"
+#endif
+
+#if (AUDIO_TASK == 1)
+  #include "l1audio_const.h"
+  #include "l1audio_cust.h"
+  #include "l1audio_defty.h"
+#endif
+
+  #if (L1_GTT == 1)
+    #include "l1gtt_const.h"
+    #include "l1gtt_defty.h"
+  #endif
+#include "l1_defty.h"
+#include "l1_msgty.h"
+#include "l1_tabs.h"
+#include "l1_varex.h"
+
+#if (VCXO_ALGO == 1)
+  #include "l1_ctl.h"
+#endif
+
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+  #include "spi_drv.h"
+#endif
+
+#if (RF==35)
+  #include "tpudrv35.h"
+  #include "l1_rf35.h"
+  #include "l1_rf35.c"
+#endif
+
+#if (RF==12)
+  #include "tpudrv12.h"
+  #include "l1_rf12.h"
+  #include "l1_rf12.c"
+#endif
+
+#if (RF==10)
+  #include "tpudrv10.h"
+  #include "l1_rf10.h"
+  #include "l1_rf10.c"
+#endif
+
+#if (RF==8)
+  #include "tpudrv8.h"
+  #include "l1_rf8.h"
+  #include "l1_rf8.c"
+#endif
+
+#if (RF==2)
+  #include "l1_rf2.h"
+  #include "l1_rf2.c"
+#endif
+
+// Nucleus functions
+extern INT                TMD_Timer_State;
+extern UWORD32            TMD_Timer;               // for big sleep 
+extern UWORD32            TCD_Priority_Groups;
+extern VOID              *TCD_Current_Thread;
+extern TC_HCB            *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
+extern TC_HCB            *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
+extern TC_PROTECT         TCD_System_Protect;
+
+#if (L2_L3_SIMUL == 0)
+  #define FFS_WORKAROUND 1
+#else
+  #define FFS_WORKAROUND 0
+#endif
+#if (FFS_WORKAROUND == 1)
+  #include "ffs.h"
+#else
+  typedef signed   int   int32;
+  typedef signed char effs_t;
+  typedef int32  filesize_t;
+  effs_t ffs_fwrite(const char *name, void *addr, filesize_t size);
+  effs_t ffs_fread(const char *name, void *addr, filesize_t size);  
+#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 (CODE_VERSION != SIMULATION)
+  // Import serial switch configuration
+  extern char ser_cfg_info[2];
+#endif
+
+void   get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+UWORD8 save_cal_in_nvmem  (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+void config_rf_rw_band(char type, UWORD8 read);
+void config_rf_read(char type);
+void config_rf_write(char type);
+
+enum {
+  RF_ID        = 0,
+  ADC_ID       = 1
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the location of rf-struct      */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+
+const static T_BAND_CONFIG band_config[] =
+{ /*ffs name, default addr, max carrier, min tx pwr */
+  {"",(T_RF_BAND *) 0,0,0},//undefined
+  {"900", (T_RF_BAND *)&rf_900,  174, 19 },//EGSM
+  {"1800",(T_RF_BAND *)&rf_1800, 374, 15 },//DCS
+  {"1900",(T_RF_BAND *)&rf_1900, 299, 15 },//PCS
+  {"850", (T_RF_BAND *)&rf_850,  124, 19 },//GSM850
+#if (RF == 10)
+  {"1900_us",(T_RF_BAND *)&rf_1900, 299, 15 },//usdual 1900 rf tables are the same as 3band 1900 rf tables at the moment
+#endif
+  {"900", (T_RF_BAND *)&rf_900,  124, 19 } //GSM, this should be last entry
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the indices into band_config   */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+const T_STD_CONFIG std_config[] =
+{
+ /* band1 index,  band2 index, txpwr turning point, first arfcn*/
+  {           0,          0,     0, 0   }, // std = 0 not used
+  { BAND_GSM900,  BAND_NONE,     0, 1   }, // std = 1 GSM
+  { BAND_EGSM900, BAND_NONE,     0, 1   }, // std = 2 EGSM
+  { BAND_PCS1900, BAND_NONE,    21, 512 }, // std = 3 PCS
+  { BAND_DCS1800, BAND_NONE,    28, 512 }, // std = 4 DCS
+  { BAND_GSM900,  BAND_DCS1800, 28, 1   }, // std = 5 DUAL
+  { BAND_EGSM900, BAND_DCS1800, 28, 1   }, // std = 6 DUALEXT
+  { BAND_GSM850,  BAND_NONE,     0, 128 }, // std = 7 850
+#if (RF == 10)
+  { BAND_GSM850,  BAND_PCS1900_US, 21, 1   }  // std = 8 850/1900
+#else
+  { BAND_GSM850,  BAND_PCS1900, 21, 1   }  // std = 8 850/1900
+#endif
+};
+
+/*-------------------------------------------------------*/
+/* Prototypes of external functions used in this file.   */
+/*-------------------------------------------------------*/
+void l1_initialize(T_MMI_L1_CONFIG *mmi_l1_config);
+WORD16 Convert_l1_radio_freq  (UWORD16 radio_freq);
+
+/*-------------------------------------------------------*/
+/* Cust_recover_Os()                                      */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description: adjust OS from sleep duration            */
+/* ------------                                          */
+/* This function fix the :                               */
+/* - system clock                                        */
+/* - Nucleus timers                                      */
+/* - xxxxxx (customer dependant)                         */
+/*-------------------------------------------------------*/
+ 
+UWORD8 Cust_recover_Os(void)
+{
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {    
+    UWORD32 current_system_clock;
+
+    /***************************************************/
+    // Fix System clock and Nucleus Timers if any....  */
+    /***************************************************/
+    // Fix System clock ....
+    current_system_clock  = NU_Retrieve_Clock();
+    current_system_clock += l1s.pw_mgr.sleep_duration;
+    NU_Set_Clock(current_system_clock);
+
+    // Fix Nucleus timer (if needed) ....
+    if (TMD_Timer_State == TM_ACTIVE)
+    {
+      TMD_Timer -= l1s.pw_mgr.sleep_duration;
+      if (!TMD_Timer) TMD_Timer_State = TM_EXPIRED;
+    }
+
+    /***************************************************/
+    // Cust dependant part                        ...  */
+    /***************************************************/
+    //.............
+    //.............
+    //..............
+    return(TRUE);
+
+  }
+#endif
+}
+
+
+
+/*-------------------------------------------------------*/
+/* Cust_check_system()                                    */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description:                                          */
+/* ------------                                          */
+/* GSM 1.5 :                                             */
+/* - authorize UWIRE clock to be stopped                 */
+/*   and write value in l1s.pw_mgr.modules_status.       */
+/* - authorize ARMIO clock to be stopped if the light is */
+/*   off and write value in l1s.pw_mgr.modules_status.   */
+/* - check if SIM clock have been stopped                */
+/*   before allowing DEEP SLEEP.                         */
+/* - check if UARTs are ready to enter deep sleep        */
+/* - choose the sleep mode                               */
+/*                                                       */
+/* Return:                                               */
+/* -------                                               */
+/* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP                */     
+/*-------------------------------------------------------*/
+UWORD8 Cust_check_system(void)
+{
+  extern UWORD8 why_big_sleep;
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {   
+
+#if (L2_L3_SIMUL == 0)
+    // Forbid deep sleep if the light is on 
+    if(LT_Status())
+    {
+      //cut ARMIO and UWIRE clocks in big sleep
+      l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+      why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
+    // Forbid deep sleep if the SIM and UARTs not ready 
+    if(SIM_SleepStatus())
+    {
+#endif
+      if(SER_UartSleepStatus()) 
+      {
+        return(CLOCK_STOP);   // DEEP sleep
+      }
+      else why_big_sleep = BIG_SLEEP_DUE_TO_UART;
+#if (L2_L3_SIMUL == 0)
+   }
+   else why_big_sleep = BIG_SLEEP_DUE_TO_SIM;
+#endif
+        // cut ARMIO and UWIRE clocks in big sleep
+        l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+        return(FRAME_STOP);  // BIG sleep
+  }
+#else // Simulation part
+  return(CLOCK_STOP);   // DEEP sleep
+#endif
+}
+
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configuration, tables etc. */
+/*                from FFS files.                        */
+/*-------------------------------------------------------*/
+const static T_CONFIG_FILE config_files_common[] =
+{
+  #if (CODE_VERSION != SIMULATION)
+
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+    "f/gsm/rf/afcdac",             &rf.afc.eeprom_afc, sizeof(rf.afc.eeprom_afc),
+    "F/gsm/rf/stdmap",             &rf.radio_band_support, sizeof(rf.radio_band_support),
+#if (VCXO_ALGO == 1)
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32) + 4 * sizeof(WORD16),
+#else
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32),
+#endif
+
+    "R/gsm/rf/rx/agcglobals",      &rf.rx.agc, 5 * sizeof(UWORD16),
+    "R/gsm/rf/rx/il2agc",          &rf.rx.agc.il2agc_pwr[0], 3 * sizeof(rf.rx.agc.il2agc_pwr),
+    "R/gsm/rf/rx/agcwords",        &AGC_TABLE, sizeof(AGC_TABLE),
+
+    "s/sys/adccal",                &adc_cal, sizeof(adc_cal),
+
+    "S/sys/abb",                   &abb, sizeof(abb),
+    "S/sys/uartswitch",            &ser_cfg_info, sizeof(ser_cfg_info),
+
+  #endif
+    NULL,                          0, 0 // terminator
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configurations for         */ 
+/*                each band from FFS files. These files  */
+/*                are defined for one band, and and used */
+/*                for all bands.                         */
+/*-------------------------------------------------------*/
+const static T_CONFIG_FILE config_files_band[] =
+{
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+      
+    // generic for all bands
+    // band[0] is used as template for all bands. 
+    "t/gsm/rf/tx/ramps",     &rf_band[0].tx.ramp_tables,    sizeof(rf_band[0].tx.ramp_tables),
+    "t/gsm/rf/tx/levels",    &rf_band[0].tx.levels,         sizeof(rf_band[0].tx.levels),
+    "t/gsm/rf/tx/calchan",   &rf_band[0].tx.chan_cal_table, sizeof(rf_band[0].tx.chan_cal_table),
+    "T/gsm/rf/tx/caltemp",   &rf_band[0].tx.temp,           sizeof(rf_band[0].tx.temp),
+
+    "r/gsm/rf/rx/calchan",   &rf_band[0].rx.agc_bands,      sizeof(rf_band[0].rx.agc_bands),
+    "R/gsm/rf/rx/caltemp",   &rf_band[0].rx.temp,           sizeof(rf_band[0].rx.temp),
+    "r/gsm/rf/rx/agcparams", &rf_band[0].rx.rx_cal_params,  sizeof(rf_band[0].rx.rx_cal_params),
+    NULL,                          0,                   0 // terminator
+};
+
+void config_ffs_read(char type)
+{
+  config_rf_read(type);
+  config_rf_rw_band(type, 1);
+}
+
+void config_ffs_write(char type)
+{
+  config_rf_write(type);
+  config_rf_rw_band(type, 0);
+}
+
+void config_rf_read(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fread(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_write(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fwrite(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_rw_band(char type, UWORD8 read)
+{
+    const T_CONFIG_FILE *f1 = config_files_band;
+    UWORD8 i;
+    WORD32 offset;
+    char name[64];
+    char *p;
+    UWORD8 std = l1_config.std.id;
+    
+#if FFS_WORKAROUND == 1
+    struct stat_s stat;
+    UWORD16 time;
+#endif        
+    for (i=0; i< GSM_BANDS; i++)
+    { 
+      if(std_config[std].band[i] !=0 )
+      {
+        f1 = &config_files_band[0];
+        while (f1->name != NULL)
+        {
+          offset = (WORD32) f1->addr - (WORD32) &rf_band[0]; //offset in bytes
+          p = ((char *) &rf_band[i]) + offset;
+          if (type == '*' || type == f1->name[0]) 
+          {
+            strcpy(name, &f1->name[1]);
+            strcat(name, ".");
+            strcat(name, band_config[std_config[std].band[i]].name);
+
+            if (read == 1)
+              ffs_fread(name, p, f1->size);
+            else //write == 0
+            {  
+              ffs_fwrite(name, p, f1->size);  
+
+              // wait until ffs write has finished 
+#if FFS_WORKAROUND == 1
+              stat.inode = 0;
+              time = 0;
+
+              do {
+                rvf_delay(10);  // in milliseconds
+                time += 10;
+                ffs_stat(name, &stat);
+              } while (stat.inode == 0 && time < 500);
+#endif
+            }  
+          }
+          f1++;
+        }
+      }
+    }
+}
+
+/*-------------------------------------------------------*/
+/* Cust_init_std()                                       */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init Standard variable configuration  */
+/*-------------------------------------------------------*/
+void Cust_init_std(void)
+{
+  UWORD8 std = l1_config.std.id;
+  UWORD8 band1, band2;
+  T_RF_BAND *pt1, *pt2;
+  
+  band1 = std_config[std].band[0];
+  band2 = std_config[std].band[1];
+  
+  //get these from std 
+  pt1 = band_config[band1].addr;
+  pt2 = band_config[band2].addr;
+
+  // copy rf-struct from default flash to ram
+  memcpy(&rf_band[0], pt1, sizeof(T_RF_BAND));
+
+  if(std_config[std].band[1] != BAND_NONE )
+    memcpy(&rf_band[1], pt2, sizeof(T_RF_BAND));
+
+  // Read all RF and system configuration from FFS *before* we copy any of
+  // the rf structure variables to other places, like L1.
+
+  config_ffs_read('*');
+
+  l1_config.std.first_radio_freq       = std_config[std].first_arfcn;
+
+  if(band2!=0)
+    l1_config.std.first_radio_freq_band2 = band_config[band1].max_carrier + 1;
+  else  
+    l1_config.std.first_radio_freq_band2 = 0; //band1 carrier + 1 else 0
+    
+  // if band2 is not used it is initialised with zeros
+  l1_config.std.nbmax_carrier          = band_config[band1].max_carrier;
+  if(band2!=0)
+     l1_config.std.nbmax_carrier      += band_config[band2].max_carrier;
+    
+  l1_config.std.max_txpwr_band1        = band_config[band1].max_txpwr;
+  l1_config.std.max_txpwr_band2        = band_config[band2].max_txpwr;
+  l1_config.std.txpwr_turning_point    = std_config[std].txpwr_tp;
+  l1_config.std.cal_freq1_band1        = 0;
+  l1_config.std.cal_freq1_band2        = 0;
+    
+  l1_config.std.g_magic_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band1  = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band1             = rf_band[MULTI_BAND1].swap_iq;
+
+  l1_config.std.g_magic_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band2  = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band2             = rf_band[MULTI_BAND2].swap_iq;
+
+  l1_config.std.radio_freq_index_offset   = l1_config.std.first_radio_freq-1;
+
+  // init variable indicating which radio bands are supported by the chosen RF
+  l1_config.std.radio_band_support = rf.radio_band_support;
+}
+
+
+/*-------------------------------------------------------*/
+/* Cust_init_params()                                    */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init RF dependent paramters (AGC, TX) */
+/*-------------------------------------------------------*/
+void Cust_init_params(void)
+{
+
+#if (CODE_VERSION==SIMULATION)
+  extern UWORD16  simu_RX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+  extern UWORD16  simu_TX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+
+  l1_config.params.rx_synth_setup_time   = simu_RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = simu_TX_SYNTH_SETUP_TIME;
+#else
+  l1_config.params.rx_synth_setup_time   = RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = TX_SYNTH_SETUP_TIME;
+#endif
+
+
+  // Convert SYNTH_SETUP_TIME into SPLIT.
+  // We have kept a margin of 20qbit (EPSILON_MEAS) to cover offset change and Scenario closing time + margin.
+  l1_config.params.rx_synth_load_split   = 1L + (l1_config.params.rx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_synth_load_split   = 1L + (l1_config.params.tx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+
+  l1_config.params.rx_synth_start_time   = TPU_CLOCK_RANGE + PROVISION_TIME - l1_config.params.rx_synth_setup_time;
+  l1_config.params.tx_synth_start_time   = TPU_CLOCK_RANGE - l1_config.params.tx_synth_setup_time;
+
+  l1_config.params.rx_change_synchro_time = l1_config.params.rx_synth_start_time - EPSILON_SYNC;
+  l1_config.params.rx_change_offset_time  = l1_config.params.rx_synth_start_time - EPSILON_OFFS;
+
+  l1_config.params.tx_change_offset_time = TIME_OFFSET_TX - 
+                                           TA_MAX - 
+                                           l1_config.params.tx_synth_setup_time - 
+                                           EPSILON_OFFS;
+
+  // TX duration = ramp up time + burst duration (data + tail bits) 
+  l1_config.params.tx_nb_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + NB_BURST_DURATION_UL;
+  l1_config.params.tx_ra_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + RA_BURST_DURATION;
+
+  l1_config.params.tx_nb_load_split = 1L + (l1_config.params.tx_nb_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_ra_load_split = 1L + (l1_config.params.tx_ra_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+
+  // time for the end of RX and TX TPU scenarios
+  l1_config.params.rx_tpu_scenario_ending = RX_TPU_SCENARIO_ENDING;
+  l1_config.params.tx_tpu_scenario_ending = TX_TPU_SCENARIO_ENDING; 
+
+  // FB26 anchoring time is computed backward to leave only 6 qbit margin between
+  // FB26 window and next activity (RX time tracking).
+  // This margin is used as follow:
+  //    Serving offset restore: 1 qbit (SERV_OFFS_REST_LOAD)
+  //    Tpu Sleep:              2 qbit (TPU_SLEEP_LOAD)
+  //                          ---------
+  //                     Total: 3 qbit
+   
+  l1_config.params.fb26_anchoring_time = (l1_config.params.rx_synth_start_time - 
+                                          #if (CODE_VERSION == SIMULATION)
+                                          // simulator: end of scenario not included in window (no serialization)
+                                            1 -
+                                          #else
+                                          // RF dependent end of RX TPU scenario
+                                            l1_config.params.rx_tpu_scenario_ending -
+                                          #endif
+                                          EPSILON_SYNC -               
+                                          TPU_SLEEP_LOAD -
+                                          SERV_OFFS_REST_LOAD -   
+                                          FB26_ACQUIS_DURATION -  
+                                          PROVISION_TIME +        
+                                          TPU_CLOCK_RANGE) % TPU_CLOCK_RANGE;
+
+  l1_config.params.fb26_change_offset_time  = l1_config.params.fb26_anchoring_time +
+                                              PROVISION_TIME - 
+                                              l1_config.params.rx_synth_setup_time -
+                                              EPSILON_OFFS;
+
+  l1_config.params.guard_bits         = rf.tx.guard_bits;
+
+  l1_config.params.prg_tx_gsm         = rf.tx.prg_tx;
+  l1_config.params.prg_tx_dcs         = rf.tx.prg_tx; //delay for dual band not implemented yet
+
+  l1_config.params.low_agc_noise_thr  = rf.rx.agc.low_agc_noise_thr;
+  l1_config.params.high_agc_sat_thr   = rf.rx.agc.high_agc_sat_thr;
+  l1_config.params.low_agc            = rf.rx.agc.low_agc;
+  l1_config.params.high_agc           = rf.rx.agc.high_agc;
+  l1_config.params.il_min             = IL_MIN;
+
+  l1_config.params.fixed_txpwr        = FIXED_TXPWR;
+  l1_config.params.eeprom_afc         = rf.afc.eeprom_afc;
+  l1_config.params.setup_afc_and_rf   = SETUP_AFC_AND_RF;
+
+  l1_config.params.psi_sta_inv        = rf.afc.psi_sta_inv;
+  l1_config.params.psi_st             = rf.afc.psi_st;
+  l1_config.params.psi_st_32          = rf.afc.psi_st_32;
+  l1_config.params.psi_st_inv         = rf.afc.psi_st_inv;
+
+#if (CODE_VERSION == SIMULATION)
+  #if (VCXO_ALGO == 1)
+    l1_config.params.afc_algo           = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+  #endif
+#else
+  #if (VCXO_ALGO == 1)
+    l1_config.params.afc_dac_center       = rf.afc.dac_center;      // VCXO - assuming DAC linearity
+    l1_config.params.afc_dac_min          = rf.afc.dac_min;         // VCXO - assuming DAC linearity
+    l1_config.params.afc_dac_max          = rf.afc.dac_max;         // VCXO - assuming DAC linearity
+    l1_config.params.afc_snr_thr          = rf.afc.snr_thr;         // VCXO - SNR threshold
+    l1_config.params.afc_algo             = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+    l1_config.params.afc_win_avg_size_M   = C_WIN_AVG_SIZE_M;       // VCXO - Average psi values with this value
+    l1_config.params.rgap_algo            = ALGO_AFC_RXGAP;         // VCXO - Choosing Reception Gap algorithm
+    l1_config.params.rgap_bad_snr_count_B = C_RGAP_BAD_SNR_COUNT_B; // VCXO - Prediction SNR count
+  #endif
+  #endif
+
+  #if DCO_ALGO
+    #if (RF == 10)
+      // Enable DCO algorithm for direct conversion RFs
+      l1_config.params.dco_enabled = TRUE;
+    #else
+      l1_config.params.dco_enabled = FALSE;
+    #endif
+  #endif
+
+  #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.vbur             = abb[ABB_VBUR];		  // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];		  // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];		  // value at reset
+    l1_config.params.apcoff           = abb[ABB_APCOFF];	  // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];	  // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];	  // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];  // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];	  // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];		  // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    l1_config.params.apcdel           = abb[ABB_APCDEL];	  // value at reset
+  #endif
+  #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.vbur             = abb[ABB_VBUR];		  // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];		  // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];		  // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];    // value at reset    
+    l1_config.params.apcoff           = abb[ABB_APCOFF];	  // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];	  // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];	  // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];  // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];	  // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];		  // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    l1_config.params.vbcr2            = abb[ABB_VBCR2];      // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    l1_config.params.apcdel           = abb[ABB_APCDEL];	  // value at reset
+    l1_config.params.apcdel2          = abb[ABB_APCDEL2];    // value at reset    
+  #endif													 
+  #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.vbur             = abb[ABB_VBUR];          // Uplink gain amp 0dB, Sidetone gain to mute
+    l1_config.params.vbdr             = abb[ABB_VBDR];          // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctl            = abb[ABB_BBCTL];         // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];       // value at reset    
+    l1_config.params.apcoff           = abb[ABB_APCOFF];        // X2 Slope 128 and APCSWP disabled
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];       // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];       // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];    // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];        // value at reset
+    l1_config.params.vbcr             = abb[ABB_VBCR];          // VULSWITCH=0
+    l1_config.params.vbcr2            = abb[ABB_VBCR2];         // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    l1_config.params.apcdel           = abb[ABB_APCDEL];        // value at reset
+    l1_config.params.apcdel2          = abb[ABB_APCDEL2];       // value at reset    
+    l1_config.params.vbpop            = abb[ABB_VBPOP];         // HSOAUTO enabled
+    l1_config.params.vau_delay_init   = abb[ABB_VAUDINITD];     // 2 TDMA Frames between VDL "ON" and VDLHSO "ON"
+    l1_config.params.vaud_cfg         = abb[ABB_VAUDCR];        // value at reset
+    l1_config.params.vauo_onoff       = abb[ABB_VAUOCR];        // speech on AUX and EAR
+    l1_config.params.vaus_vol         = abb[ABB_VAUSCR];        // value at reset
+    l1_config.params.vaud_pll         = abb[ABB_VAUDPLL];       // value at reset
+  #endif
+  
+  // global variable for access to deep sleep time
+  l1_config.params.sleep_time = 0;
+}
+
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_from_IL()                                */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : returns agc value                     */
+/*-------------------------------------------------------*/
+WORD8 Cust_get_agc_from_IL(UWORD16 radio_freq, UWORD16 agc_index, UWORD8 table_id)
+{
+// radio_freq currently not used
+// this parameter is passed in order to allow band dependent tables for specific RFs
+// (e.g. dual band RF with separate AGC H/W blocks for GSM and DCS)
+
+  if (agc_index > 120)
+    agc_index = 120;    // Clip agc_index
+
+  switch (table_id)
+  {
+    case MAX_ID:  return(rf.rx.agc.il2agc_max[agc_index]);
+    case AV_ID:   return(rf.rx.agc.il2agc_av[agc_index]);
+    case PWR_ID:  return(rf.rx.agc.il2agc_pwr[agc_index]);
+  }
+}
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_band                                     */
+/*-------------------------------------------------------*/
+/* Parameters : radio_freq                               */
+/* Return     : band number                              */
+/* Functionality :  Computes the band for RF calibration */
+/*-------------------------------------------------------*/
+/*---------------------------------------------*/
+
+
+  #if (CODE_VERSION == SIMULATION)
+    UWORD16 Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #else
+    UWORD16 inline Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #endif
+    {
+      WORD32 i ;
+
+      for (i=0;i<RF_RX_CAL_CHAN_SIZE;i++)
+      {
+        if (arfcn <= rf_band[gsm_band].rx.agc_bands[i].upper_bound)
+          return(i);
+      }
+      // Should never happen!
+      return(0);
+    }  
+
+/*-------------------------------------------------------*/
+/* Cust_is_band_high                                     */
+/*-------------------------------------------------------*/
+/* Parameters :  arfcn                                   */
+/* Return     :  0 if low band                           */
+/*               1 if high band                          */
+/* Functionality : Generic function which return 1 if    */
+/*                 arfcn is in the high band             */
+/*-------------------------------------------------------*/
+
+UWORD8 Cust_is_band_high(UWORD16 radio_freq)
+{
+  UWORD16 max_carrier;
+  UWORD8  std = l1_config.std.id;
+
+  max_carrier = band_config[std_config[std].band[0]].max_carrier;
+  
+  return(((radio_freq >= l1_config.std.first_radio_freq) && 
+          (radio_freq < (l1_config.std.first_radio_freq + max_carrier))) ? MULTI_BAND1 : MULTI_BAND2);
+}          
+    
+/*-------------------------------------------------------*/
+/* l1ctl_encode_delta2()                                 */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+WORD8 l1ctl_encode_delta2(UWORD16 radio_freq)
+{  
+  WORD8    delta2_freq;
+  UWORD16  i;
+  UWORD16  arfcn;
+  UWORD8   band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+  
+  i = Cust_get_agc_band(arfcn,band); //
+  delta2_freq = rf_band[band].rx.agc_bands[i].agc_calib;
+
+  //temperature compensation
+  for (i=0;i<RF_RX_CAL_TEMP_SIZE;i++)
+  {
+    if ((WORD16)adc.converted[ADC_RFTEMP] <= rf_band[band].rx.temp[i].temperature)
+    {
+      delta2_freq += rf_band[band].rx.temp[i].agc_calib;
+      break;
+    }
+  }
+
+  return(delta2_freq);
+}
+
+/************************************/
+/* TX Management                    */
+/************************************/
+/*-------------------------------------------------------*/
+/* Cust_get_ramp_tab                                     */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+
+void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq)
+{
+  UWORD16 index_up, index_down,j, arfcn;
+  UWORD8 band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+
+  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 ((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) |
+                ((rf_band[band].tx.ramp_tables[index_up].ramp_up[j])  << 6) |
+                  0x14;
+    }
+  #endif 
+}
+
+/*-------------------------------------------------------*/
+/* get_pwr_data                                          */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq)
+{  
+
+  UWORD16 i,j;
+  UWORD16 arfcn;
+  UWORD8 band;
+
+#if(ORDER2_TX_TEMP_CAL==1)
+        WORD16 pwr_data;
+#else
+        UWORD16  pwr_data;
+#endif
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+   
+  i = rf_band[band].tx.levels[txpwr].chan_cal_index;
+  j=0;
+  // get uncalibrated apc
+  pwr_data = rf_band[band].tx.levels[txpwr].apc;
+
+  while (arfcn > rf_band[band].tx.chan_cal_table[i][j].arfcn_limit)
+    j++;
+
+  // channel calibrate apc  
+  pwr_data = ((UWORD32) (pwr_data * rf_band[band].tx.chan_cal_table[i][j].chan_cal))/128; 
+
+  // temperature compensate apc
+  {
+    T_TX_TEMP_CAL *pt;
+
+    pt = rf_band[band].tx.temp;
+    while ((WORD16)adc.converted[ADC_RFTEMP] > pt->temperature)
+	    pt++;
+#if(ORDER2_TX_TEMP_CAL==1)
+                pwr_data += (txpwr*(pt->a*txpwr + pt->b) + pt->c) / 64;      //delta apc = ax^2+bx+c
+                if(pwr_data < 0) pwr_data = 0;
+#else
+    pwr_data += pt->apc_calib;
+#endif
+  }
+  return(pwr_data);
+}
+#endif
+/*-------------------------------------------------------*/
+/* Cust_Init_Layer1                                      */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :  Load and boot the DSP                */
+/* Initialize shared memory and L1 data structures       */
+/*-------------------------------------------------------*/
+
+void Cust_Init_Layer1(void)
+{
+  T_MMI_L1_CONFIG cfg;
+  
+  // Get the current band configuration from the flash
+  #if (OP_WCP==1)
+    extern unsigned char ffs_GetBand();
+    cfg.std = ffs_GetBand();
+  #else // NO OP_WCP
+    //  cfg.std = std;
+    cfg.std = STD;
+  #endif // OP_WCP
+
+  cfg.tx_pwr_code = 1;
+
+  // sleep management configuration
+  cfg.pwr_mngt = 0;
+  cfg.pwr_mngt_mode_authorized = NO_SLEEP; //Sleep mode
+  cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
+
+
+
+  #if (CODE_VERSION != SIMULATION)
+    cfg.dwnld = DWNLD; //external define from makefile
+  #endif
+
+  l1_initialize(&cfg);
+
+  get_cal_from_nvmem((UWORD8 *)&rf, sizeof(rf), RF_ID);
+  get_cal_from_nvmem((UWORD8 *)&adc_cal, sizeof(adc_cal), ADC_ID);
+
+}
+
+
+/*****************************************************************************************/
+/***************************     TESTMODE functions     **********************************/
+/*****************************************************************************************/
+
+
+
+  /*------------------------------------------------------*/
+  /* madc_hex_2_physical                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Function to convert MAD hexadecimal  */ 
+  /*                 values into physical values          */
+  /*------------------------------------------------------*/
+
+void madc_hex_2_physical (UWORD16 *adc_hex, T_ADC *adc_phy)  
+{
+ WORD16 i; 
+ UWORD16 y;
+ WORD16 Smin = 0, Smax = TEMP_TABLE_SIZE-1;
+ WORD16 index = (TEMP_TABLE_SIZE-1)/2;       /* y is the adc code after compensation of ADC slope error introduced by VREF error */
+
+  //store raw ADC values
+  memcpy(&adc.raw[0], adc_hex, sizeof(adc.raw));   
+
+  // Convert Vbat [mV] : direct equation with slope and offset compensation 
+  for (i = ADC_VBAT; i<ADC_RFTEMP; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+
+  /*Convert RF Temperature [Celsius]: binsearch into a table*/ 
+  y = ((UWORD32)(adc_cal.a[ADC_RFTEMP] * adc.raw[ADC_RFTEMP]))>>8;       /* rf.tempcal is the calibration of VREF*/
+  while((Smax-Smin) > 1 )
+  {
+    if(y < temperature[index].adc)
+      Smax=index;
+    else 
+      Smin=index;
+       
+    index = (Smax+Smin)/2;
+  }
+  adc.converted[ADC_RFTEMP] = temperature[index].temp;
+   
+  for (i = ADC_RFTEMP+1; i<ADC_INDEX_END; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+   
+  //store converted ADC values
+  memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
+}
+
+
+  /*------------------------------------------------------*/
+  /*  get_cal_from_nvmem                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated parameter to         */ 
+  /*                 calibration structure in RAM         */
+  /*------------------------------------------------------*/
+
+void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+ 
+}
+
+  /*------------------------------------------------------*/
+  /*  save_cal_from_nvmem                                 */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated structure from RAM   */ 
+  /*                 into NV memory                       */
+  /*------------------------------------------------------*/
+
+UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+  #if (OP_WCP == 1)
+    //  FFS backup implementation an Avenger 2
+    // Request MPU-S to backup the FFS 
+    // after full calibration of device
+    extern void ffs_backup(void);
+    ffs_backup();
+  #endif
+  return (0);
+}
+
+#if (TRACE_TYPE == 4)
+
+/*------------------------------------------------------*/
+/*  l1_cst_l1_parameters                                */
+/*------------------------------------------------------*/
+/* Parameters :  s: pointer on configuration string     */
+/* Return     :  nothing: global var are set            */
+/* Functionality : Set global L1 vars for dynamic trace */ 
+/*                 and configuration                    */
+/*                                                      */
+/*   This function is called when a CST message is sent */
+/*   from the Condat Panel.                             */
+/*------------------------------------------------------*/
+void l1_cst_l1_parameters(char *s)
+{
+  /* 
+    a sample command string can be: 
+    L1_PARAMS=<1,2,3,4,5> or
+    L1_PARAMS=<1,23,3E32,4,5>
+    with n parameters (here: 5 params); n>=1
+    parameters are decoded as hexadecimal unsigned integers (UWORD16)
+  */
+
+  UWORD8  uNParams = 0;  /* Number of parameters */
+  UWORD32 aParam[10];    /* Parameters array */
+  UWORD8  uIndex = 0;
+  
+  /* ***  retrieve all parameters *** */
+  while (s[uIndex] != '<') uIndex++;
+  uIndex++;
+  aParam[0] = 0;
+  
+  /* uIndex points on 1st parameter */
+ 
+  while (s[uIndex] != '>')
+  {
+    if (s[uIndex] == ',') 
+    {
+      uNParams++;
+      aParam[uNParams] = 0;
+    }
+    else
+    {
+      /* uIndex points on a parameter char */
+      UWORD8 uChar = s[uIndex];
+      aParam[uNParams] = aParam[uNParams] << 4; /* shift 4 bits left */
+      if ((uChar>='0') && (uChar<='9'))
+        aParam[uNParams] += (uChar - '0');        /* retrieve value */
+      else if ((uChar>='A') && (uChar<='F'))
+        aParam[uNParams] += (10 + uChar - 'A');        /* retrieve value */
+      else if ((uChar>='a') && (uChar<='f'))
+        aParam[uNParams] += (10 + uChar - 'a');        /* retrieve value */
+    }
+    
+    uIndex++; /* go to next char */
+  }
+
+  /* increment number of params */  
+  uNParams++;
+
+  /* *** handle parameters *** */
+  /*
+    1st param: command type
+    2nd param: argument for command type
+  */
+  switch (aParam[0])
+  {
+    case 0: /* Trace setting */ 
+      /* The 2nd parameter contains the trace bitmap*/
+      if (uNParams >=2)
+        trace_info.current_config->l1_dyn_trace = aParam[1];
+      else 
+        trace_info.current_config->l1_dyn_trace = 0; /* error case: disable all trace */
+      Trace_dyn_trace_change();
+      break;
+    default: /* ignore it */
+      break;
+  } // switch
+}
+
+#endif
+
+#if ((CHIPSET == 2) || (CHIPSET == 3) || (CHIPSET == 4) || \
+     (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
+     (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || \
+     (CHIPSET == 11) || (CHIPSET == 12))    
+/*-------------------------------------------------------*/
+/* power_down_config() : temporary implementation !!!    */
+/*-------------------------------------------------------*/
+/* Parameters : sleep_mode (NO, SMALL, BIG, DEEP or ALL) */
+/*              clocks to be cut in BIG sleep            */
+/* Return     :                                          */
+/* Functionality : set the l1s variables 				 */
+/* l1s.pw_mgr.mode_authorized and l1s.pw_mgr.clocks      */
+/* according to the desired mode.	                     */
+/*-------------------------------------------------------*/
+void power_down_config(UWORD8 sleep_mode, UWORD16 clocks)
+{ 
+#if (OP_L1_STANDALONE == 1)
+  if(sleep_mode != NO_SLEEP)
+#endif
+  {
+    l1_config.pwr_mngt = PWR_MNGT;
+    l1s.pw_mgr.mode_authorized = sleep_mode;
+    l1s.pw_mgr.clocks = clocks;
+  }
+  
+#if (OP_L1_STANDALONE == 0)
+  l1s.pw_mgr.enough_gaug = FALSE;
+#endif
+}
+#endif
+
+/* glowing,2004-06-16, import from M188 */
+void layer1_em_get_rxlevqual(WORD32 *l1_rxlev_scell,WORD32 *l1_rxlev_dedic_sub,
+	WORD32 *l1_rxqual_dedic,WORD32 *l1_rxqual_dedic_sub)
+{
+/*
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.acc));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Scell_info.meas.nbr_meas));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.acc_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_full));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub));
+	xmzhou_trace_string_value("values***********",(UINT32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub));
+*/
+	if(l1a_l1s_com.Scell_info.meas.nbr_meas != 0){
+	*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(l1a_l1s_com.Scell_info.meas.nbr_meas);
+	}else{
+	*l1_rxlev_scell=(WORD32)(l1a_l1s_com.Scell_info.meas.acc)/(WORD32)(4);
+	}
+//	xmzhou_trace_string_value("l1_rxlev_scell",(UINT32)(*l1_rxlev_scell));
+
+	if(l1a_l1s_com.Smeas_dedic.nbr_meas_sub !=0){
+	*l1_rxlev_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.nbr_meas_sub);
+	}else{
+	*l1_rxlev_dedic_sub=0;
+	}
+//	xmzhou_trace_string_value("l1_rxlev_dedic_sub",(UINT32)(*l1_rxlev_dedic_sub));
+
+	if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full !=0){
+	*l1_rxqual_dedic=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_full)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_full);
+	}else{
+	*l1_rxqual_dedic=0;
+	}
+//	xmzhou_trace_string_value("l1_rxqual_dedic",(UINT32)(*l1_rxqual_dedic));
+
+	if(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub){
+	*l1_rxqual_dedic_sub=(WORD32)(l1a_l1s_com.Smeas_dedic.qual_acc_sub)/(WORD32)(l1a_l1s_com.Smeas_dedic.qual_nbr_meas_sub);
+	}else{
+	*l1_rxqual_dedic_sub=0;
+	}
+//	xmzhou_trace_string_value("l1_rxqual_dedic_sub",(UINT32)(*l1_rxqual_dedic_sub));
+}
+
+void layer1_em_get_mode(WORD32 *l1_mode)
+{
+	*l1_mode=l1a_l1s_com.mode;
+}
+
+/*glowing,2004-06-16, end of import */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_rf10.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,1722 @@
+T_RF rf =
+{
+  RF_PASCAL_20, //RF revision
+  RF_HW_BAND_SUPPORT, // radio_band_support E-GSM/DCS
+
+  { //RX structure
+    { //AGC structure
+      140,  // low_agc_noise_thr;   
+      110,  // high_agc_sat_thr;
+        6,  // low_agc;
+       34,  // high_agc;
+      //IL2AGC tables
+      {  // below is: il2agc_pwr[121];
+        //           il2agc_max[121];
+        //           il2agc_av[121];
+        // il2agc_pwr
+        // Note this is shared between PCN and EGSM.
+
+  6,          /*  EGSM_MAX  IL=0 */  
+	6,          /*  EGSM_MAX  IL=-1 */
+	6,          /*  EGSM_MAX  IL=-2 */
+	6,          /*  EGSM_MAX  IL=-3 */
+	6,          /*  EGSM_MAX  IL=-4 */
+	6,          /*  EGSM_MAX  IL=-5 */
+	6,          /*  EGSM_MAX  IL=-6 */
+	6,          /*  EGSM_MAX  IL=-7 */
+	6,          /*  EGSM_MAX  IL=-8 */
+	6,          /*  EGSM_MAX  IL=-9 */
+	6,          /*  EGSM_MAX  IL=-10 */  
+	6,          /*  EGSM_MAX  IL=-11 */
+	6,          /*  EGSM_MAX  IL=-12 */
+	6,          /*  EGSM_MAX  IL=-13 */
+	6,          /*  EGSM_MAX  IL=-14 */
+	6,          /*  EGSM_MAX  IL=-15 */
+	6,          /*  EGSM_MAX  IL=-16 */
+	6,          /*  EGSM_MAX  IL=-17 */
+	6,          /*  EGSM_MAX  IL=-18 */
+	6,          /*  EGSM_MAX  IL=-19 */
+	6,          /*  EGSM_MAX  IL=-20 */  
+	6,          /*  EGSM_MAX  IL=-21 */
+	6,          /*  EGSM_MAX  IL=-22 */
+	6,          /*  EGSM_MAX  IL=-23 */
+	6,          /*  EGSM_MAX  IL=-24 */
+	6,          /*  EGSM_MAX  IL=-25 */
+	6,          /*  EGSM_MAX  IL=-26 */
+	6,          /*  EGSM_MAX  IL=-27 */
+	6,          /*  EGSM_MAX  IL=-28 */
+	6,          /*  EGSM_MAX  IL=-29 */
+	6,          /*  EGSM_MAX  IL=-30 */  
+	6,          /*  EGSM_MAX  IL=-31 */
+	6,          /*  EGSM_MAX  IL=-32 */
+	6,          /*  EGSM_MAX  IL=-33 */
+	6,          /*  EGSM_MAX  IL=-34 */
+	6,          /*  EGSM_MAX  IL=-35 */
+	6,          /*  EGSM_MAX  IL=-36 */
+	6,          /*  EGSM_MAX  IL=-37 */
+	6,          /*  EGSM_MAX  IL=-38 */
+	6,          /*  EGSM_MAX  IL=-39 */
+	6,          /*  EGSM_MAX  IL=-40 */
+	6,          /*  EGSM_MAX  IL=-41 */
+	6,          /*  EGSM_MAX  IL=-42 */
+	6,          /*  EGSM_MAX  IL=-43 */
+	6,          /*  EGSM_MAX  IL=-44 */
+	6,          /*  EGSM_MAX  IL=-45 */
+	6,          /*  EGSM_MAX  IL=-46 */
+	6,          /*  EGSM_MAX  IL=-47 */
+	8,          /*  EGSM_MAX  IL=-48 */
+	8,          /*  EGSM_MAX  IL=-49 */
+	10,          /*  EGSM_MAX  IL=-50 */
+	10,          /*  EGSM_MAX  IL=-51 */
+	12,          /*  EGSM_MAX  IL=-52 */
+	12,          /*  EGSM_MAX  IL=-53 */
+	14,          /*  EGSM_MAX  IL=-54 */
+	14,          /*  EGSM_MAX  IL=-55 */
+	16,          /*  EGSM_MAX  IL=-56 */
+	16,          /*  EGSM_MAX  IL=-57 */
+	18,          /*  EGSM_MAX  IL=-58 */
+	18,          /*  EGSM_MAX  IL=-59 */
+	20,          /*  EGSM_MAX  IL=-60 */
+	20,          /*  EGSM_MAX  IL=-61 */
+	22,          /*  EGSM_MAX  IL=-62 */
+	22,          /*  EGSM_MAX  IL=-63 */
+	24,          /*  EGSM_MAX  IL=-64 */
+	24,          /*  EGSM_MAX  IL=-65 */
+	26,          /*  EGSM_MAX  IL=-66 */
+	26,          /*  EGSM_MAX  IL=-67 */
+	28,          /*  EGSM_MAX  IL=-68 */
+	28,          /*  EGSM_MAX  IL=-69 */
+	30,          /*  EGSM_MAX  IL=-70 */
+	30,          /*  EGSM_MAX  IL=-71 */
+	32,          /*  EGSM_MAX  IL=-72 */
+	32,          /*  EGSM_MAX  IL=-73 */
+	34,          /*  EGSM_MAX  IL=-74 */
+	34,          /*  EGSM_MAX  IL=-75 */
+	36,          /*  EGSM_MAX  IL=-76 */
+	36,          /*  EGSM_MAX  IL=-77 */
+	38,          /*  EGSM_MAX  IL=-78 */
+	38,          /*  EGSM_MAX  IL=-79 */
+	40,          /*  EGSM_MAX  IL=-80 */
+	40,          /*  EGSM_MAX  IL=-81 */
+	42,          /*  EGSM_MAX  IL=-82 */
+	42,          /*  EGSM_MAX  IL=-83 */
+	44,          /*  EGSM_MAX  IL=-84 */
+	44,          /*  EGSM_MAX  IL=-85 */
+	46,          /*  EGSM_MAX  IL=-86 */
+	46,          /*  EGSM_MAX  IL=-87 */
+	48,          /*  EGSM_MAX  IL=-88 */
+	48,          /*  EGSM_MAX  IL=-89 */
+	50,          /*  EGSM_MAX  IL=-90 */
+	50,          /*  EGSM_MAX  IL=-91 */
+	50,          /*  EGSM_MAX  IL=-92 */
+	50,          /*  EGSM_MAX  IL=-93 */
+	50,          /*  EGSM_MAX  IL=-94 */
+	50,          /*  EGSM_MAX  IL=-95 */
+	50,          /*  EGSM_MAX  IL=-96 */
+	50,          /*  EGSM_MAX  IL=-97 */
+	50,          /*  EGSM_MAX  IL=-98 */
+	50,          /*  EGSM_MAX  IL=-99 */
+	50,          /*  EGSM_MAX  IL=-100 */
+	50,          /*  EGSM_MAX  IL=-101 */
+	50,          /*  EGSM_MAX  IL=-102 */
+	50,          /*  EGSM_MAX  IL=-103 */
+	50,          /*  EGSM_MAX  IL=-104 */
+	50,          /*  EGSM_MAX  IL=-105 */
+	50,          /*  EGSM_MAX  IL=-106 */
+	50,          /*  EGSM_MAX  IL=-107 */
+	50,          /*  EGSM_MAX  IL=-108 */
+	50,          /*  EGSM_MAX  IL=-109 */
+	50,          /*  EGSM_MAX  IL=-110 */
+	50,          /*  EGSM_MAX  IL=-111 */
+	50,          /*  EGSM_MAX  IL=-112 */
+	50,          /*  EGSM_MAX  IL=-113 */
+	50,          /*  EGSM_MAX  IL=-114 */
+	50,          /*  EGSM_MAX  IL=-115 */
+	50,          /*  EGSM_MAX  IL=-116 */
+	50,          /*  EGSM_MAX  IL=-117 */
+	50,          /*  EGSM_MAX  IL=-118 */
+	50,          /*  EGSM_MAX  IL=-119 */
+	50           /*  EGSM_MAX  IL=-120 */
+      },
+  { // il2agc_max
+        // Note this is shared between PCN and EGSM.
+	6,          /*  EGSM_MAX  IL=0 */  
+	6,          /*  EGSM_MAX  IL=-1 */
+	6,          /*  EGSM_MAX  IL=-2 */
+	6,          /*  EGSM_MAX  IL=-3 */
+	6,          /*  EGSM_MAX  IL=-4 */
+	6,          /*  EGSM_MAX  IL=-5 */
+	6,          /*  EGSM_MAX  IL=-6 */
+	6,          /*  EGSM_MAX  IL=-7 */
+	6,          /*  EGSM_MAX  IL=-8 */
+	6,          /*  EGSM_MAX  IL=-9 */
+	6,          /*  EGSM_MAX  IL=-10 */  
+	6,          /*  EGSM_MAX  IL=-11 */
+	6,          /*  EGSM_MAX  IL=-12 */
+	6,          /*  EGSM_MAX  IL=-13 */
+	6,          /*  EGSM_MAX  IL=-14 */
+	6,          /*  EGSM_MAX  IL=-15 */
+	6,          /*  EGSM_MAX  IL=-16 */
+	6,          /*  EGSM_MAX  IL=-17 */
+	6,          /*  EGSM_MAX  IL=-18 */
+	6,          /*  EGSM_MAX  IL=-19 */
+	6,          /*  EGSM_MAX  IL=-20 */  
+	6,          /*  EGSM_MAX  IL=-21 */
+	6,          /*  EGSM_MAX  IL=-22 */
+	6,          /*  EGSM_MAX  IL=-23 */
+	6,          /*  EGSM_MAX  IL=-24 */
+	6,          /*  EGSM_MAX  IL=-25 */
+	6,          /*  EGSM_MAX  IL=-26 */
+	6,          /*  EGSM_MAX  IL=-27 */
+	6,          /*  EGSM_MAX  IL=-28 */
+	6,          /*  EGSM_MAX  IL=-29 */
+	6,          /*  EGSM_MAX  IL=-30 */  
+	6,          /*  EGSM_MAX  IL=-31 */
+	6,          /*  EGSM_MAX  IL=-32 */
+	6,          /*  EGSM_MAX  IL=-33 */
+	6,          /*  EGSM_MAX  IL=-34 */
+	6,          /*  EGSM_MAX  IL=-35 */
+	6,          /*  EGSM_MAX  IL=-36 */
+	6,          /*  EGSM_MAX  IL=-37 */
+	6,          /*  EGSM_MAX  IL=-38 */
+	6,          /*  EGSM_MAX  IL=-39 */
+	6,          /*  EGSM_MAX  IL=-40 */
+	6,          /*  EGSM_MAX  IL=-41 */
+	6,          /*  EGSM_MAX  IL=-42 */
+	6,          /*  EGSM_MAX  IL=-43 */
+	6,          /*  EGSM_MAX  IL=-44 */
+	6,          /*  EGSM_MAX  IL=-45 */
+	6,          /*  EGSM_MAX  IL=-46 */
+	6,          /*  EGSM_MAX  IL=-47 */
+	8,          /*  EGSM_MAX  IL=-48 */
+	8,          /*  EGSM_MAX  IL=-49 */
+	10,          /*  EGSM_MAX  IL=-50 */
+	10,          /*  EGSM_MAX  IL=-51 */
+	12,          /*  EGSM_MAX  IL=-52 */
+	12,          /*  EGSM_MAX  IL=-53 */
+	14,          /*  EGSM_MAX  IL=-54 */
+	14,          /*  EGSM_MAX  IL=-55 */
+	16,          /*  EGSM_MAX  IL=-56 */
+	16,          /*  EGSM_MAX  IL=-57 */
+	18,          /*  EGSM_MAX  IL=-58 */
+	18,          /*  EGSM_MAX  IL=-59 */
+	20,          /*  EGSM_MAX  IL=-60 */
+	20,          /*  EGSM_MAX  IL=-61 */
+	22,          /*  EGSM_MAX  IL=-62 */
+	22,          /*  EGSM_MAX  IL=-63 */
+	24,          /*  EGSM_MAX  IL=-64 */
+	24,          /*  EGSM_MAX  IL=-65 */
+	26,          /*  EGSM_MAX  IL=-66 */
+	26,          /*  EGSM_MAX  IL=-67 */
+	28,          /*  EGSM_MAX  IL=-68 */
+	28,          /*  EGSM_MAX  IL=-69 */
+	30,          /*  EGSM_MAX  IL=-70 */
+	30,          /*  EGSM_MAX  IL=-71 */
+	32,          /*  EGSM_MAX  IL=-72 */
+	32,          /*  EGSM_MAX  IL=-73 */
+	34,          /*  EGSM_MAX  IL=-74 */
+	34,          /*  EGSM_MAX  IL=-75 */
+	36,          /*  EGSM_MAX  IL=-76 */
+	36,          /*  EGSM_MAX  IL=-77 */
+	38,          /*  EGSM_MAX  IL=-78 */
+	38,          /*  EGSM_MAX  IL=-79 */
+	40,          /*  EGSM_MAX  IL=-80 */
+	40,          /*  EGSM_MAX  IL=-81 */
+	42,          /*  EGSM_MAX  IL=-82 */
+	42,          /*  EGSM_MAX  IL=-83 */
+	44,          /*  EGSM_MAX  IL=-84 */
+	44,          /*  EGSM_MAX  IL=-85 */
+	46,          /*  EGSM_MAX  IL=-86 */
+	46,          /*  EGSM_MAX  IL=-87 */
+	48,          /*  EGSM_MAX  IL=-88 */
+	48,          /*  EGSM_MAX  IL=-89 */
+	50,          /*  EGSM_MAX  IL=-90 */
+	50,          /*  EGSM_MAX  IL=-91 */
+	50,          /*  EGSM_MAX  IL=-92 */
+	50,          /*  EGSM_MAX  IL=-93 */
+	50,          /*  EGSM_MAX  IL=-94 */
+	50,          /*  EGSM_MAX  IL=-95 */
+	50,          /*  EGSM_MAX  IL=-96 */
+	50,          /*  EGSM_MAX  IL=-97 */
+	50,          /*  EGSM_MAX  IL=-98 */
+	50,          /*  EGSM_MAX  IL=-99 */
+	50,          /*  EGSM_MAX  IL=-100 */
+	50,          /*  EGSM_MAX  IL=-101 */
+	50,          /*  EGSM_MAX  IL=-102 */
+	50,          /*  EGSM_MAX  IL=-103 */
+	50,          /*  EGSM_MAX  IL=-104 */
+	50,          /*  EGSM_MAX  IL=-105 */
+	50,          /*  EGSM_MAX  IL=-106 */
+	50,          /*  EGSM_MAX  IL=-107 */
+	50,          /*  EGSM_MAX  IL=-108 */
+	50,          /*  EGSM_MAX  IL=-109 */
+	50,          /*  EGSM_MAX  IL=-110 */
+	50,          /*  EGSM_MAX  IL=-111 */
+	50,          /*  EGSM_MAX  IL=-112 */
+	50,          /*  EGSM_MAX  IL=-113 */
+	50,          /*  EGSM_MAX  IL=-114 */
+	50,          /*  EGSM_MAX  IL=-115 */
+	50,          /*  EGSM_MAX  IL=-116 */
+	50,          /*  EGSM_MAX  IL=-117 */
+	50,          /*  EGSM_MAX  IL=-118 */
+	50,          /*  EGSM_MAX  IL=-119 */
+	50           /*  EGSM_MAX  IL=-120 */
+      },
+       { // il2agc_av
+        // Note this is shared between PCN and EGSM.
+	6,          /*  EGSM_AV  IL=0 */  
+	6,          /*  EGSM_AV  IL=-1 */
+	6,          /*  EGSM_AV  IL=-2 */
+	6,          /*  EGSM_AV  IL=-3 */
+	6,          /*  EGSM_AV  IL=-4 */
+	6,          /*  EGSM_AV  IL=-5 */
+	6,          /*  EGSM_AV  IL=-6 */
+	6,          /*  EGSM_AV  IL=-7 */
+	6,          /*  EGSM_AV  IL=-8 */
+	6,          /*  EGSM_AV  IL=-9 */
+	6,          /*  EGSM_AV  IL=-10 */  
+	6,          /*  EGSM_AV  IL=-11 */
+	6,          /*  EGSM_AV  IL=-12 */
+	6,          /*  EGSM_AV  IL=-13 */
+	6,          /*  EGSM_AV  IL=-14 */
+	6,          /*  EGSM_AV  IL=-15 */
+	6,          /*  EGSM_AV  IL=-16 */
+	6,          /*  EGSM_AV  IL=-17 */
+	6,          /*  EGSM_AV  IL=-18 */
+	6,          /*  EGSM_AV  IL=-19 */
+	6,          /*  EGSM_AV  IL=-20 */  
+	6,          /*  EGSM_AV  IL=-21 */
+	6,          /*  EGSM_AV  IL=-22 */
+	6,          /*  EGSM_AV  IL=-23 */
+	6,          /*  EGSM_AV  IL=-24 */
+	6,          /*  EGSM_AV  IL=-25 */
+	6,          /*  EGSM_AV  IL=-26 */
+	6,          /*  EGSM_AV  IL=-27 */
+	6,          /*  EGSM_AV  IL=-28 */
+	6,          /*  EGSM_AV  IL=-29 */
+	6,          /*  EGSM_AV  IL=-30 */  
+	6,          /*  EGSM_AV  IL=-31 */
+	6,          /*  EGSM_AV  IL=-32 */
+	6,          /*  EGSM_AV  IL=-33 */
+	6,          /*  EGSM_AV  IL=-34 */
+	6,          /*  EGSM_AV  IL=-35 */
+	6,          /*  EGSM_AV  IL=-36 */
+	6,          /*  EGSM_AV  IL=-37 */
+	6,          /*  EGSM_AV  IL=-38 */
+	6,          /*  EGSM_AV  IL=-39 */
+	6,          /*  EGSM_AV  IL=-40 */
+	6,          /*  EGSM_AV  IL=-41 */
+	6,          /*  EGSM_AV  IL=-42 */
+	6,          /*  EGSM_AV  IL=-43 */
+	6,          /*  EGSM_AV  IL=-44 */
+	6,          /*  EGSM_AV  IL=-45 */
+	6,          /*  EGSM_AV  IL=-46 */
+	6,          /*  EGSM_AV  IL=-47 */
+	8,          /*  EGSM_AV  IL=-48 */
+	8,          /*  EGSM_AV  IL=-49 */
+	10,          /*  EGSM_AV  IL=-50 */
+	10,          /*  EGSM_AV  IL=-51 */
+	12,          /*  EGSM_AV  IL=-52 */
+	12,          /*  EGSM_AV  IL=-53 */
+	14,          /*  EGSM_AV  IL=-54 */
+	14,          /*  EGSM_AV  IL=-55 */
+	16,          /*  EGSM_AV  IL=-56 */
+	16,          /*  EGSM_AV  IL=-57 */
+	18,          /*  EGSM_AV  IL=-58 */
+	18,          /*  EGSM_AV  IL=-59 */
+	20,          /*  EGSM_AV  IL=-60 */
+	20,          /*  EGSM_AV  IL=-61 */
+	22,          /*  EGSM_AV  IL=-62 */
+	22,          /*  EGSM_AV  IL=-63 */
+	24,          /*  EGSM_AV  IL=-64 */
+	24,          /*  EGSM_AV  IL=-65 */
+	26,          /*  EGSM_AV  IL=-66 */
+	26,          /*  EGSM_AV  IL=-67 */
+	28,          /*  EGSM_AV  IL=-68 */
+	28,          /*  EGSM_AV  IL=-69 */
+	30,          /*  EGSM_AV  IL=-70 */
+	30,          /*  EGSM_AV  IL=-71 */
+	32,          /*  EGSM_AV  IL=-72 */
+	32,          /*  EGSM_AV  IL=-73 */
+	34,          /*  EGSM_AV  IL=-74 */
+	34,          /*  EGSM_AV  IL=-75 */
+	36,          /*  EGSM_AV  IL=-76 */
+	36,          /*  EGSM_AV  IL=-77 */
+	38,          /*  EGSM_AV  IL=-78 */
+	38,          /*  EGSM_AV  IL=-79 */
+	40,          /*  EGSM_AV  IL=-80 */
+	40,          /*  EGSM_AV  IL=-81 */
+	42,          /*  EGSM_AV  IL=-82 */
+	42,          /*  EGSM_AV  IL=-83 */
+	44,          /*  EGSM_AV  IL=-84 */
+	44,          /*  EGSM_AV  IL=-85 */
+	46,          /*  EGSM_AV  IL=-86 */
+	46,          /*  EGSM_AV  IL=-87 */
+	48,          /*  EGSM_AV  IL=-88 */
+	48,          /*  EGSM_AV  IL=-89 */
+	50,          /*  EGSM_AV  IL=-90 */
+	50,          /*  EGSM_AV  IL=-91 */
+	50,          /*  EGSM_AV  IL=-92 */
+	50,          /*  EGSM_AV  IL=-93 */
+	50,          /*  EGSM_AV  IL=-94 */
+	50,          /*  EGSM_AV  IL=-95 */
+	50,          /*  EGSM_AV  IL=-96 */
+	50,          /*  EGSM_AV  IL=-97 */
+	50,          /*  EGSM_AV  IL=-98 */
+	50,          /*  EGSM_AV  IL=-99 */
+	50,          /*  EGSM_AV  IL=-100 */
+	50,          /*  EGSM_AV  IL=-101 */
+	50,          /*  EGSM_AV  IL=-102 */
+	50,          /*  EGSM_AV  IL=-103 */
+	50,          /*  EGSM_AV  IL=-104 */
+	50,          /*  EGSM_AV  IL=-105 */
+	50,          /*  EGSM_AV  IL=-106 */
+	50,          /*  EGSM_AV  IL=-107 */
+	50,          /*  EGSM_AV  IL=-108 */
+	50,          /*  EGSM_AV  IL=-109 */
+	50,          /*  EGSM_AV  IL=-110 */
+	50,          /*  EGSM_AV  IL=-111 */
+	50,          /*  EGSM_AV  IL=-112 */
+	50,          /*  EGSM_AV  IL=-113 */
+	50,          /*  EGSM_AV  IL=-114 */
+	50,          /*  EGSM_AV  IL=-115 */
+	50,          /*  EGSM_AV  IL=-116 */
+	50,          /*  EGSM_AV  IL=-117 */
+	50,          /*  EGSM_AV  IL=-118 */
+	50,          /*  EGSM_AV  IL=-119 */
+	50           /*  EGSM_AV  IL=-120 */    
+      }  
+    },
+  }, 
+  {
+    {0, 0},     // ramp up and down delays
+    GUARD_BITS, // number of guard bits needed for ramp up
+    PRG_TX      // propagation delay PRG_TX
+  },
+  { //AFC parameters
+    EEPROM_AFC,
+    C_Psi_sta_inv,     // (1/C_Psi_sta)        
+    C_Psi_st,          // C_Psi_sta * 0.8 F0.16
+    C_Psi_st_32,       // F0.32                    
+    C_Psi_st_inv       // (1/C_Psi_st)
+
+    #if (VCXO_ALGO == 1)
+     ,C_AFC_DAC_CENTER,      // VCXO startup parameter - best guess
+      C_AFC_DAC_MIN,         // VCXO startup parameter - 15ppm
+      C_AFC_DAC_MAX,         // VCXO startup parameter + 15ppm
+      C_AFC_SNR_THR         // snr - Default threshold value
+    #endif
+  }
+};         
+
+T_RF_BAND rf_band[GSM_BANDS]; //uninitialised rf struct for bands
+
+const T_RF_BAND rf_900 = 
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+        193,      //g_magic
+         40,      //lna_gain_max * 2   
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib 
+      {  10,  1},     // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  1},     // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},     // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},     // etc.
+      {  90,  1},     // 
+      { 112,  1},     // 
+      { 124,  2},     //
+      { 991,  3},    // 
+      {1009,  2},    // 
+      {1023,  1},    // 
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },  
+  { //TX structure
+    {// gsm900 T_LEVEL_TX
+      { 510, 0, 0  }, // 0 
+      { 510, 0, 0  }, // 1 
+      { 510, 0, 0  }, // 2 
+      { 510, 0, 0  }, // 3 
+      { 510, 0, 0  }, // 4 
+      { 510, 0, 0  }, // 5 
+      { 449, 1, 0  }, // 6 
+      { 361, 2, 0  }, // 7 
+      { 291, 3, 0  }, // 8 
+      { 236, 4, 0  }, // 9 
+      { 192, 5, 0  }, // 10 
+      { 157, 6, 0  }, // 11 
+      { 130, 7, 0  }, // 12 
+      { 107, 8, 0  }, // 13 
+      { 86, 9, 0  }, // 14 
+      { 71, 10, 0  }, // 15 
+      { 61, 11, 0  }, // 16 
+      { 52, 12, 0  }, // 17 
+      { 47, 13, 0  }, // 18 
+      { 43, 14, 0  }, // 19 
+      { 43, 14, 0  }, // 20 
+      { 43, 14, 0  }, // 21 
+      { 43, 14, 0  }, // 22 
+      { 43, 14, 0  }, // 23 
+      { 43, 14, 0  }, // 24 
+      { 43, 14, 0  }, // 25 
+      { 43, 14, 0  }, // 26 
+      { 43, 14, 0  }, // 27 
+      { 43, 14, 0  }, // 28 
+      { 43, 14, 0  }, // 29 
+      { 43, 14, 0  }, // 30 
+      { 43, 14, 0  }, // 31 
+    },
+    {// Channel Calibration Talbles
+      {// arfcn, tx_chan_cal
+        {   27, 126 }, // Calibration Table 0
+        {   47, 128 },
+        {   66, 129 },
+        {   85, 129 },
+        {  104, 133 },
+        {  124, 133 },
+        {  994, 125 },
+        { 1023, 125 }
+        },
+      {// arfcn, tx_chan_cal
+        {   27, 128 }, // Calibration Table 1
+        {   47, 128 },
+        {   66, 128 },
+        {   85, 128 },
+        {  104, 128 },
+        {  124, 128 },
+        {  994, 128 },
+        { 1023, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {   27, 128 }, // Calibration Table 2
+        {   47, 128 },
+        {   66, 128 },
+        {   85, 128 },
+        {  104, 128 },
+        {  124, 128 },  
+        {  994, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   27, 128 }, // Calibration Table 3
+        {   47, 128 },
+        {   66, 128 },
+        {   85, 128 },
+        {  104, 128 },
+        {  124, 128 },
+        {  994, 128 },
+        { 1023, 128 }
+      } 
+    }, 
+    { // GSM Power Ramp Values
+      {  
+        {// Ramp-Up      #0 profile - Power Level 5
+         0,0,0,0,0,0,0,0,0,10,31,31,31,15,10,0
+        },
+        {// Ramp-Down    #0 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #1 profile - Power Level 6
+         0,0,0,0,0,0,0,0,0,10,31,31,31,15,10,0
+        },
+        {// Ramp-Down    #1 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #2 profile - Power Level 7
+          0,0,0,0,0,0,0,0,0,6,19,31,31,31,10,0
+        },
+        {// Ramp-Down    #2 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #3 profile - Power Level 8
+            0,0,0,0,0,0,0,0,0,6,19,31,31,31,10,0
+        },
+        {// Ramp-Down    #3 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #4 profile - Power Level 9
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+        },
+        {// Ramp-Down    #4 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #5 profile - Power Level 10
+           0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+        },
+        {// Ramp-Down    #5 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #6 profile - Power Level 11
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+        },
+        {// Ramp-Down    #6 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #7 profile - Power Level 12
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #7 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #8 profile - Power Level 13
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #8 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #9 profile - Power Level 14
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #9 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #10 profile - Power Level 15
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #10 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #11 profile - Power Level 16
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #11 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #12 profile - Power Level 17
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #12 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #13 profile - Power Level 18
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #13 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #14 profile - Power Level 19
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #14 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #15 profile - Power Level 19
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #15 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        }
+      }   
+    },
+    { //TX temperature compensation
+#if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0, 0, 0 },
+      {  +9,  0, 0, 0 },
+      { +39,  0, 0, 0 },
+      { +59,  0, 0, 0 },
+      { 127,  0, 0, 0 }
+#else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+#endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_GSM,
+}; 
+
+const T_RF_BAND rf_1800 = 
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      188,      //g_magic
+       40,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- DCS band --*/
+     /*--------------*/
+      {548,  0},     // 
+      {622,  1},     // 
+      {680,  0},     // 
+      {745,  0},     // 
+      {812,  0},     // 
+      {860,  0},     // 
+      {885,  2},     // 
+      { 991,  0},     // 
+      { 992,  0},     // 
+      {1023,  0},     // 
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// dcs1800 T_LEVEL_TX
+      { 463, 0, 0  }, // 0 
+      { 376, 1, 0  }, // 1 
+      { 309, 2, 0  }, // 2 
+      { 255, 3, 0  }, // 3 
+      { 211, 4, 0  }, // 4 
+      { 176, 5, 0  }, // 5 
+      { 146, 6, 0  }, // 6 
+      { 122, 7, 0  }, // 7 
+      { 99, 8, 0  }, // 8 
+      { 83, 9, 0  }, // 9 
+      { 70, 10, 0  }, // 10 
+      { 58, 11, 0  }, // 11 
+      { 47, 12, 0  }, // 12 
+      { 38, 13, 0  }, // 13 
+      { 32, 14, 0  }, // 14 
+      { 26, 15, 0  }, // 15 
+      { 26, 15, 0  }, // 16 
+      { 26, 15, 0  }, // 17 
+      { 26, 15, 0  }, // 18 
+      { 26, 15, 0  }, // 19 
+      { 26, 15, 0  }, // 20 
+      { 26, 15, 0  }, // 21 
+      { 26, 15, 0  }, // 22 
+      { 26, 15, 0  }, // 23 
+      { 26, 15, 0  }, // 24 
+      { 26, 15, 0  }, // 25 
+      { 26, 15, 0  }, // 26 
+      { 26, 15, 0  }, // 27 
+      { 26, 15, 0  }, // 28 
+      { 463, 0, 0  }, // 29 
+      { 463, 0, 0  }, // 30 
+      { 463, 0, 0  }, // 31 
+    },
+    {// Channel Calibration Talbles
+      {// arfcn, tx_chan_cal
+        {  553, 128 }, // Calibration Table 0
+        {  594, 128 },
+        {  636, 128 },
+        {  677, 128 },
+        {  720, 128 },
+        {  760, 128 },
+        {  802, 127 },
+        {  885, 127 }
+      },
+      {
+        {  553, 128 }, // Calibration Table 1
+        {  594, 128 },
+        {  636, 128 },
+        {  677, 128 },
+        {  720, 128 },
+        {  760, 128 },
+        {  802, 128 },
+        {  885, 128 }
+      },  
+      {// arfcn, tx_chan_cal
+        {  553, 128 }, // Calibration Table 2
+        {  594, 128 },
+        {  636, 128 },
+        {  677, 128 },
+        {  720, 128 },
+        {  760, 128 },
+        {  802, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  553, 128 }, // Calibration Table 3
+        {  594, 128 },
+        {  636, 128 },
+        {  677, 128 },
+        {  720, 128 },
+        {  760, 128 },
+        {  802, 128 },
+        {  885, 128 }
+      } 
+    }, 
+    { // DCS Power Ramp Values
+      {  
+        {// Ramp-Up      #0 profile - Power Level 0
+          0,0,0,0,0,0,0,0,0,5,20,31,31,31,10,0
+        },
+        {// Ramp-Down    #0 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #1 profile - Power Level 1
+          0,0,0,0,0,0,0,0,0,5,20,31,31,31,10,0
+        },
+        {// Ramp-Down    #1 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #2 profile - Power Level 2
+          0,0,0,0,0,0,0,0,0,5,20,31,31,31,10,0
+        },
+        {// Ramp-Down    #2 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #3 profile - Power Level 3
+          0,0,0,0,0,0,0,0,0,5,20,31,31,31,10,0
+        },
+        {// Ramp-Down    #3 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #4 profile - Power Level 4
+          0,0,0,0,0,0,0,0,0,5,20,31,31,31,10,0
+        },
+        {// Ramp-Down    #4 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #5 profile - Power Level 5
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #5 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #6 profile - Power Level 6
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #6 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #7 profile - Power Level 7
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #7 profile
+         0 ,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #8 profile - Power Level 8
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #8 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #9 profile - Power Level 9
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #9 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #10 profile - Power Level 10
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #10 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #11 profile - Power Level 11
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #11 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #12 profile - Power Level 12
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #12 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #13 profile - Power Level 13
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #13 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #14 profile - Power Level 14
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #14 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #15 profile - Power Level 15
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+        },
+        {// Ramp-Down    #15 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+    },
+    { //TX temperature compensation
+#if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0, 0, 0 },
+      {  +9,  0, 0, 0 },
+      { +39,  0, 0, 0 },
+      { +59,  0, 0, 0 },
+      { 127,  0, 0, 0 }
+#else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+#endif
+    },
+  },  
+  //IQ swap
+  SWAP_IQ_DCS
+};        
+
+//copy from gsm900
+const T_RF_BAND rf_850 = 
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+        181,      //g_magic
+         40,      //lna_gain_max * 2   
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib 
+      {  10,  0},     // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  0},     // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},     // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},     // etc.
+      {  90,  0},     // 
+      { 112,  0},     // 
+      { 124,  0},     //
+      { 991,  0},    // 
+      { 992,  0},    // 
+      {1023,  0},    // 
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },  
+  { //TX structure
+    {// gsm850 T_LEVEL_TX
+      { 510, 0, 0  }, // 0 
+      { 510, 0, 0  }, // 1 
+      { 510, 0, 0  }, // 2 
+      { 510, 0, 0  }, // 3 
+      { 510, 0, 0  }, // 4 
+      { 510, 0, 0  }, // 5 
+      { 449, 1, 0  }, // 6 
+      { 361, 2, 0  }, // 7 
+      { 291, 3, 0  }, // 8 
+      { 236, 4, 0  }, // 9 
+      { 192, 5, 0  }, // 10 
+      { 157, 6, 0  }, // 11 
+      { 130, 7, 0  }, // 12 
+      { 107, 8, 0  }, // 13 
+      { 86, 9, 0  }, // 14 
+      { 71, 10, 0  }, // 15 
+      { 61, 11, 0  }, // 16 
+      { 52, 12, 0  }, // 17 
+      { 47, 13, 0  }, // 18 
+      { 43, 14, 0  }, // 19 
+      { 43, 14, 0  }, // 20 
+      { 43, 14, 0  }, // 21 
+      { 43, 14, 0  }, // 22 
+      { 43, 14, 0  }, // 23 
+      { 43, 14, 0  }, // 24 
+      { 43, 14, 0  }, // 25 
+      { 43, 14, 0  }, // 26 
+      { 43, 14, 0  }, // 27 
+      { 43, 14, 0  }, // 28 
+      { 43, 14, 0  }, // 29 
+      { 43, 14, 0  }, // 30 
+      { 43, 14, 0  }, // 31 
+    },
+    {// Channel Calibration Talbles
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 0
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 2
+        {   80, 128 },
+        {  124, 128 },  
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 3
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      } 
+    }, 
+    { //Ramp profiles    850
+      {
+        {// Ramp-Up      #0 profile - Power Level 5
+          0,0,0,0,0,0,0,0,0,10,31,31,31,15,10,0
+	},
+	{ //Ramp-Down #0 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #1 profile - Power Level 6
+         0,0,0,0,0,0,0,0,0,10,31,31,31,15,10,0
+	},
+	{ //Ramp-Down #1 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #2 profile - Power Level 7
+          0,0,0,0,0,0,0,0,0,6,19,31,31,31,10,0
+	},
+	{ //Ramp-Down #2 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #3 profile - Power Level 8
+            0,0,0,0,0,0,0,0,0,6,19,31,31,31,10,0
+	},
+	{ //Ramp-Down #3 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #4 profile - Power Level 9
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+	},
+	{ //Ramp-Down #4 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #5 profile - Power Level 10
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+	},
+	{ //Ramp-Down #5 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #6 profile - Power Level 11
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+	},
+	{ //Ramp-Down #6 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #7 profile - Power Level 12
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+ 	{ //Ramp-Down #7 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #8 profile - Power Level 13
+           0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #8 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #9 profile - Power Level 14
+           0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #9 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #10 profile - Power Level 15
+           0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #10 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #11 profile - Power Level 16
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #11 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #12 profile - Power Level 17
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #12 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #13 profile - Power Level 18
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #13 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #14 profile - Power Level 19
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	},
+	{ //Ramp-Down #14 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #15 profile - Power Level 19
+          0,0,0,0,0,0,0,0,0,0,25,31,31,31,10,0
+	      },
+        {// Ramp-Down    #15 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        }
+      }   
+      },
+      { //TX temperature compensation
+#if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0, 0, 0 },
+      {  +9,  0, 0, 0 },
+      { +39,  0, 0, 0 },
+      { +59,  0, 0, 0 },
+      { 127,  0, 0, 0 }
+#else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+#endif
+      },
+    },
+  //IQ swap
+  SWAP_IQ_GSM850,
+}; 
+
+//copy from dcs1800
+const T_RF_BAND rf_1900 = 
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      186,      //g_magic
+       40,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- PCS band --*/
+     /*--------------*/
+      { 548,  1},     // 
+      { 622,  1},     // 
+      { 680,  0},     // 
+      { 745,  0},     // 
+      { 812,  3},     // 
+      { 860,  0},     // 
+      { 885,  2},     // 
+      { 991,  0},     // 
+      { 992,  0},     // 
+      {1023,  0},     // 
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// pcs1900 T_LEVEL_TX
+      { 460, 0, 0  }, // 0 
+      { 373, 1, 0  }, // 1 
+      { 307, 2, 0  }, // 2 
+      { 253, 3, 0  }, // 3 
+      { 209, 4, 0  }, // 4 
+      { 175, 5, 0  }, // 5 
+      { 145, 6, 0  }, // 6 
+      { 122, 7, 0  }, // 7 
+      { 99, 8, 0  }, // 8 
+      { 83, 9, 0  }, // 9 
+      { 70, 10, 0  }, // 10 
+      { 58, 11, 0  }, // 11 
+      { 47, 12, 0  }, // 12 
+      { 38, 13, 0  }, // 13 
+      { 32, 14, 0  }, // 14 
+      { 25, 15, 0  }, // 15 
+      { 25, 15, 0  }, // 16 
+      { 25, 15, 0  }, // 17 
+      { 25, 15, 0  }, // 18 
+      { 25, 15, 0  }, // 19 
+      { 25, 15, 0  }, // 20 
+      { 25, 15, 0  }, // 21 
+      { 25, 15, 0  }, // 22 
+      { 25, 15, 0  }, // 23 
+      { 25, 15, 0  }, // 24 
+      { 25, 15, 0  }, // 25 
+      { 25, 15, 0  }, // 26 
+      { 25, 15, 0  }, // 27 
+      { 25, 15, 0  }, // 28 
+      { 460, 0, 0  }, // 29 
+      { 460, 0, 0  }, // 30 
+      { 460, 0, 0  }, // 31 
+    },
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {  549, 127 }, // Calibration Table 0
+        {  586, 127 },
+        {  623, 127 },
+        {  697, 128 },
+        {  726, 129 },
+        {  754, 128 },
+        {  782, 129 },
+        {  810, 131 }
+      },
+      {
+        {  549, 128 }, // Calibration Table 1
+        {  586, 128 },
+        {  623, 128 },
+        {  697, 128 },
+        {  726, 128 },
+        {  754, 128 },
+        {  782, 128 },
+        {  810, 128 }
+      },  
+      {// arfcn, tx_chan_cal
+        {  549, 128 }, // Calibration Table 2
+        {  586, 128 },
+        {  623, 128 },
+        {  697, 128 },
+        {  726, 128 },
+        {  754, 128 },
+        {  782, 128 },
+        {  810, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  549, 128 }, // Calibration Table 3
+        {  586, 128 },
+        {  623, 128 },
+        {  697, 128 },
+        {  726, 128 },
+        {  754, 128 },
+        {  782, 128 },
+        {  810, 128 }
+      } 
+    }, 
+    { // PCS1900 Power Ramp Values 
+      {  
+        {// Ramp-Up      #0 profile - Power Level 0
+          0,0,0,0,0,0,0,0,0,9,16,31,31,31,10,0
+        },
+        {// Ramp-Down    #0 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #1 profile - Power Level 1
+          0,0,0,0,0,0,0,0,0,10,15,31,31,31,10,0
+        },
+        {// Ramp-Down    #1 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #2 profile - Power Level 2
+          0,0,0,0,0,0,0,0,0,10,15,31,31,31,10,0
+        },
+        {// Ramp-Down    #2 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #3 profile - Power Level 3
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #3 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #4 profile - Power Level 4
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #4 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #5 profile - Power Level 5
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #5 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #6 profile - Power Level 6
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #6 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #7 profile - Power Level 7
+          0 ,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #7 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #8 profile - Power Level 8
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #8 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #9 profile - Power Level 9
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #9 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #10 profile - Power Level 10
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #10 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #11 profile - Power Level 11
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #11 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #12 profile - Power Level 12
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #12 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #13 profile - Power Level 13
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #13 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #14 profile - Power Level 14
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #14 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+      {  
+        {// Ramp-Up      #15 profile - Power Level 15
+          0,0,0,0,0,0,0,0,0,17,18,29,24,30,10,0
+        },
+        {// Ramp-Down    #15 profile
+          0,10,25,31,31,22,9,0,0,0,0,0,0,0,0,0
+        },
+      },
+    },
+    { //TX temperature compensation
+#if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0, 0, 0 },
+      {  +9,  0, 0, 0 },
+      { +39,  0, 0, 0 },
+      { +59,  0, 0, 0 },
+      { 127,  0, 0, 0 }
+#else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+#endif
+    },
+  },  
+  //IQ swap
+  SWAP_IQ_PCS
+};         
+
+/*------------------------------------------*/
+/* ABB Initialization words
+/*------------------------------------------*/
+#if (ANALOG == 1)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,  // Value at reset              
+    C_VBUR,       // Uplink gain amp 0dB, Sidetone gain to mute
+    C_VBDR,       // Downlink gain amp 0dB, Volume control 0 dB
+    C_BBCTL,      // value at reset
+    C_APCOFF,     // value at reset
+    C_BULIOFF,    // value at reset
+    C_BULQOFF,    // value at reset
+    C_DAI_ON_OFF, // value at reset
+    C_AUXDAC,     // value at reset
+    C_VBCR,       // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    C_APCDEL      // value at reset
+};       
+#elif (ANALOG == 2)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,
+    C_VBUR,
+    C_VBDR,
+    C_BBCTL,
+    C_BULGCAL,
+    C_APCOFF,
+    C_BULIOFF,
+    C_BULQOFF,
+    C_DAI_ON_OFF,
+    C_AUXDAC,
+    C_VBCR,
+    C_VBCR2,
+    C_APCDEL,
+    C_APCDEL2
+  };
+       
+#elif (ANALOG == 3)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,
+    C_VBUR,
+    C_VBDR,
+    C_BBCTL,
+    C_BULGCAL,
+    C_APCOFF,
+    C_BULIOFF,
+    C_BULQOFF,
+    C_DAI_ON_OFF,
+    C_AUXDAC,
+    C_VBCR,
+    C_VBCR2,
+    C_APCDEL,
+    C_APCDEL2,
+    C_VBPOP,  
+    C_VAUDINITD,
+    C_VAUDCR,
+    C_VAUOCR,
+    C_VAUSCR,
+    C_VAUDPLL
+  };
+
+#endif
+/*------------------------------------------*/
+/*             Gain table                   */
+/*  specified in the TRF6053 spec           */
+/*     2 dB steps - LNA always ON 			*/		  
+/*------------------------------------------*/
+UWORD16 AGC_TABLE[AGC_TABLE_SIZE] =
+{
+  0x00,  //6dB
+  0x01,  //8dB
+  0x02,  //10dB
+  0x03,  //12dB
+  0x04,  //14
+  0x05,  //16
+  0x06,  //18
+  0x07,  //20
+  0x08,  //22
+  0x09,  //24
+  0x0a,  //26
+  0x0b,  //28
+  0x0c,  //30
+  0x0d,  //32
+  0x0e,  //34
+  0x0f,  //36
+  0x10,  //38
+  0x11,  //40
+  0x12,  //42
+  0x13,  //44
+  0x14,  //46
+  0x15,  //48
+  0x16,  //50
+  0x17,  //52
+  0x18,  //54
+  0x19,  //56
+  0x1a   //58
+};
+
+// structure for ADC conversion (4 Internal channel + 5 Ext channels max.)
+T_ADC adc;
+
+// MADC calibration structure
+T_ADCCAL adc_cal=
+{ // a: 0,..,8
+  // b, 0,..,8
+  // cal_a = 4*1750 is the Typical value 1.75 V ref voltage , divide by 4
+  7000, 8750, 7000, 7000, 7000, 7000, 7000, 256, 7000,
+     0,    0,    0,    0,    0,    0,   0,    0,    0
+};
+
+
+// table which converts ADC value into RF temperature
+T_TEMP temperature[TEMP_TABLE_SIZE] =
+{
+7, -35,
+7, -34,
+8, -33,
+8, -32,
+9, -31,
+9, -30,
+10, -29,
+11, -28,
+11, -27,
+12, -26,
+13, -25,
+14, -24,
+14, -23,
+15, -22,
+16, -21,
+17, -20,
+18, -19,
+19, -18,
+21, -17,
+22, -16,
+23, -15,
+24, -14,
+26, -13,
+27, -12,
+29, -11,
+30, -10,
+32, -9,
+34, -8,
+36, -7,
+37, -6,
+39, -5,
+41, -4,
+44, -3,
+46, -2,
+48, -1,
+51, 0,
+53, 1, 
+56, 2, 
+59, 3,
+61, 4,
+64, 5, 
+68, 6,
+71, 7,
+74, 8, 
+78, 9,
+81, 10,
+85, 11,
+89, 12,
+93, 13,
+97, 14,
+101, 15,
+105, 16,
+110, 17, 
+115, 18,
+119, 19, 
+124, 20,
+130, 21, 
+135, 22, 
+140, 23, 
+146, 24,
+152, 25,
+158, 26,
+164, 27,
+170, 28, 
+176, 29,
+183, 30,
+190, 31, 
+197, 32, 
+204, 33, 
+211, 34,
+219, 35,
+226, 36,
+234, 37,
+242, 38,
+250, 39,
+259, 40, 
+267, 41,
+276, 42, 
+285, 43,
+294, 44,
+303, 45,
+312, 46, 
+322, 47,
+331, 48, 
+341, 49, 
+351, 50,
+361, 51,
+371, 52,
+382, 53, 
+392, 54,
+403, 55, 
+413, 56, 
+424, 57,
+435, 58,
+446, 59, 
+458, 60, 
+469, 61,
+480, 62, 
+492, 63,
+503, 64, 
+515, 65, 
+527, 66, 
+539, 67, 
+550, 68,
+562, 69,
+574, 70,
+586, 71,
+598, 72,
+611, 73, 
+623, 74, 
+635, 75, 
+647, 76, 
+659, 77,
+671, 78, 
+683, 79,
+696, 80,
+708, 81,
+720, 82, 
+732, 83, 
+744, 84, 
+756, 85, 
+768, 86, 
+780, 87,
+792, 88, 
+804, 89,
+816, 90,
+827, 91,
+839, 92, 
+851, 93,
+862, 94,
+873, 95 
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_rf10.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,558 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename l1_rf10.h
+ *        Version  1.18
+ *        Date     01/21/03
+ * 
+ ************* Revision Controle System Header *************/
+
+ // is this defined somewhere else?
+ //#define RF_HW_BAND_EGSM
+ //#define RF_HW_BAND_DCS
+ #define RF_HW_BAND_PCS 0x4
+#define RF_HW_BAND_DUAL_US  0x80
+#define RF_HW_BAND_DUAL_EXT 0x20
+
+ #define RF_HW_BAND_SUPPORT (RF_HW_BAND_DUAL_EXT | RF_HW_BAND_PCS)  // radio_band_support E-GSM/DCS + PCS
+/************************************/
+/* SYNTHESIZER setup time...        */
+/************************************/
+#define RX_SYNTH_SETUP_TIME (PROVISION_TIME - TRF_R1)//RX Synthesizer setup time in qbit.
+#define TX_SYNTH_SETUP_TIME (- TRF_T1)               //TX Synthesizer setup time in qbit.
+
+/************************************/
+/* time for TPU scenario ending...  */
+/************************************/
+#define RX_TPU_SCENARIO_ENDING  0                     // execution time of BDLENA down
+                                                      // contained in serialization time
+#define TX_TPU_SCENARIO_ENDING  DLT_1B - SL_SU_DELAY2 + 1 // execution time of BULON down
+                                                          // minus serialization time + 1 TPU_MOVE
+
+/******************************************************/
+/* TXPWR configuration...                             */
+/* Fixed TXPWR value when GSM management is disabled. */
+/******************************************************/
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+//  #define FIXED_TXPWR       0x3f12  // TXPWR=10, value=252
+//#define FIXED_TXPWR       0x1952  
+  #define FIXED_TXPWR       0x1d12  // TXPWR=15
+#endif
+
+
+/************************************/
+/* ANALOG delay (in qbits)          */
+/************************************/
+#define  DL_DELAY_RF      1   // time spent in the Downlink global RF chain by the modulated signal 
+#define  UL_DELAY_1RF     5   // time spent in the first  uplink RF block
+#define  UL_DELAY_2RF     0   // time spent in the second uplink RF block
+#if (ANALOG == 1)
+  #define  UL_ABB_DELAY   6   // modulator input to output delay
+#endif
+#if ((ANALOG == 2) || (ANALOG == 3))
+  #define  UL_ABB_DELAY   3   // modulator input to output delay
+#endif
+
+/************************************/
+/* TX Propagation delay...          */
+/************************************/
+#if (ANALOG == 1)
+  #define  PRG_TX       (DL_DELAY_RF + UL_DELAY_2RF + (GUARD_BITS*4) + UL_DELAY_1RF + UL_ABB_DELAY)   // = 40
+#endif
+#if (ANALOG == 2) || (ANALOG == 3)
+  #define  PRG_TX       (DL_DELAY_RF + UL_DELAY_2RF + (GUARD_BITS*4) + UL_DELAY_1RF + UL_ABB_DELAY + 2)   // = 42
+#endif
+
+/************************************/
+/* Initial value for APC DELAY      */
+/************************************/
+#if (ANALOG == 1)
+//#define APCDEL_DOWN     (32 - GUARD_BITS*4)          // minimum value: 2
+  #define APCDEL_DOWN      2                           // minimum value: 2
+  #define APCDEL_UP       (6+5)                        // minimum value: 6
+#endif
+#if (ANALOG == 2) || (ANALOG == 3)
+//#define APCDEL_DOWN     (32 - GUARD_BITS*4)          // minimum value: 2
+  #define APCDEL_DOWN     (2+0)                        // minimum value: 2
+  #define APCDEL_UP       (6+8)                        // minimum value: 6
+#endif
+
+#define GUARD_BITS 8
+
+/************************************/
+/* Initial value for AFC...         */
+/************************************/
+#define  EEPROM_AFC    ((150)*8)      // F13.3 required!!!!! (default : -952*8, initial deviation of -2400 forced)
+
+#define  SETUP_AFC_AND_RF   6  // AFC converges in 2 frames
+                               // Clara (RF=10) LDO wakeup requires 3 frames
+
+/************************************/
+/* Baseband registers               */
+/************************************/
+#if (ANALOG == 1)
+  // Omega registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0000          // Enable f_tx delay of 400000 cyc DEBUG 
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x418e | TRUE   // Uplink gain amp 0dB, Sidetone gain to mute
+  #define  C_VBDR            0x098c | TRUE   // Downlink gain amp 0dB, Volume control 0 dB
+  #define  C_APCOFF          0x1016 | (0x3c << 6) | TRUE   // value at reset-Changed from 0x0016- CR 27.12
+  #define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          0x0018 | TRUE   // value at reset
+  #define  C_VBCR            0x02d0 | TRUE   // VULSWITCH=1, VDLAUX=1, VDLEAR=1 
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004) 
+  #define  C_BBCTL           0x604c | TRUE   // OUTLEV1=OUTLEV1=SELVMID1=SELVMID0=1 for B-sample 'modified'
+#endif
+#if (ANALOG ==2)
+  // IOTA registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0001          // Enable f_tx delay of 400000 cyc DEBUG 
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x418e | TRUE   // No uplink mute, Side tone mute, PGA_UL 0dB
+  #define  C_VBDR            0x098c | TRUE   // PGA_DL 0dB, Volume 0dB
+  #define  C_APCOFF          0x1016 | (0x28 << 6) | TRUE  // value at reset-Changed from 3c to 28 CR 17.11.02// x2 slope 128
+  #define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          0x0018 | TRUE   // value at reset
+  #define  C_VBCR            0x02d0 | TRUE   // VULSWITCH=1, VDLAUX=1, VDLEAR=1 
+  #define  C_VBCR2           0x0016 | TRUE   // MICBIASEL=0, VDLHSO=0, MICAUX=0
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004)  
+  #define  C_APCDEL2         0x0034  
+  #define  C_BBCTL           0xb04c | TRUE   // External RX I/Q DC offset calibration, Output common mode=1.35V
+                                             // Monoslot, Vpp=8/15*Vref                                             
+  #define  C_BULGCAL         0x001c | TRUE   // IAG=0 dB, QAG=0 dB
+#endif
+
+#if (ANALOG == 3)
+  // SYREN registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0001          // Enable f_tx delay of 400000 cyc DEBUG 
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x1E6<<6 | VBUCTRL | TRUE   //  Side tone mute, PGA_UL 0dB
+  #define  C_VBDR            0x026<<6 | VBDCTRL | TRUE   // PGA_DL 0dB, Volume 0dB
+  #define  C_APCOFF          0x1016 | (0x3c << 6) | TRUE   // x2 slope 128, APCSWP = 0
+  #define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          (0x00<<6) | 0x18 | TRUE   // value at reset
+  #define  C_VBCR            (0x108<<6) | 0x10 | TRUE   // VULSWITCH=1 AUXI 28,2 dB
+  #define  C_VBCR2           (0x01<<6) | 0x16 | TRUE   // HSMIC on, SPKG gain @ 2,5dB
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004)  
+  #define  C_APCDEL2         0x0034  
+  #define  C_BBCTL           0xB04c | TRUE   // External autocalibration, Output common mode=1.35V
+                                             // Monoslot, Vpp=8/15*Vref                                             
+  #define  C_BULGCAL         0x001c | TRUE   // IAG=0 dB, QAG=0 dB
+
+  #define  C_VBPOP           (0x4)<<6 | 0x14 | TRUE     // HSOAUTO enabled only
+  #define  C_VAUDINITD       2                          // vaud_init_delay init 2 frames
+  #define  C_VAUDCR          (0x0)<<6   | 0x1e | TRUE   // Init to zero
+  #define  C_VAUOCR          (0x155)<<6 | VAUOCTRL | TRUE   // Sppech on all outputs
+  #define  C_VAUSCR          (0x0)<<6   | 0x20 | TRUE   // Init to zero
+  #define  C_VAUDPLL         (0x0)<<6   | 0x24 | TRUE   // Init to zero
+
+#endif
+
+
+/************************************/
+/* Automatic frequency compensation */
+/************************************/
+/********************* C_Psi_sta definition *****************************/
+/* C_Psi_sta = (2*pi*Fr)        / (N * Fb)                              */
+/*      (1)  = (2*pi*V*ppm*0.9) / (N*V*Fb)                              */
+/*           regarding Vega V/N   = 2.4/4096                            */
+/*           regarding VCO  ppm/V = 16 / 1   (average slope of the VCO) */
+/*      (1)  = (2*pi*2.4*16*0.9) / (4096*1*270.83)                      */
+/*           = 0.000195748                                              */
+/* C_Psi_sta_inv = 1/C_Psi_sta = 5108                                   */
+/************************************************************************/
+#define  C_Psi_sta_inv    4174L    // (1/C_Psi_sta)                   
+#define  C_Psi_st         13L        // C_Psi_sta * 0.8 F0.16          
+#define  C_Psi_st_32      823216L  // F0.32                          
+#define  C_Psi_st_inv     5217L   // (1/C_Psi_st)                   
+
+#if (VCXO_ALGO == 1)
+  // Linearity parameters
+  #define  C_AFC_DAC_CENTER     ((111)*8)
+  #define  C_AFC_DAC_MIN        ((-1196)*8)
+  #define  C_AFC_DAC_MAX        ((1419)*8)
+
+  #define  C_AFC_SNR_THR        2560     //  1/0.4    * 2**10
+#endif
+
+typedef struct
+{
+  WORD16  eeprom_afc;
+  UWORD32 psi_sta_inv;
+  UWORD32 psi_st;
+  UWORD32 psi_st_32;
+  UWORD32 psi_st_inv;
+
+  #if (VCXO_ALGO == 1)
+    // VCXO adjustment parameters
+    // Parameters used when assuming linearity
+    WORD16  dac_center;
+    WORD16  dac_min;
+    WORD16  dac_max;
+    WORD16  snr_thr;
+  #endif
+}
+T_AFC_PARAMS;
+
+/************************************/
+/* Swap IQ definitions...           */
+/************************************/
+/* 0=No Swap, 1=Swap RX only, 2=Swap TX only, 3=Swap RX and TX */
+#define  SWAP_IQ_GSM  0
+#define  SWAP_IQ_DCS  2  // was 2 for sara version 1
+#define  SWAP_IQ_PCS    2   
+#define  SWAP_IQ_GSM850 0   //TBD
+
+/************************************/
+/************************************/
+// typedef
+/************************************/
+/************************************/
+
+/*************************************************************/
+/* Define structure for apc of TX Power                 ******/
+/*************************************************************/
+typedef struct 
+{ // pcm-file "rf/tx/level.gsm|dcs"
+  UWORD16 apc;            // 0..31
+  UWORD8  ramp_index;     // 0..RF_TX_RAMP_SIZE
+  UWORD8  chan_cal_index; // 0..RF_TX_CHAN_CAL_TABLE_SIZE
+} 
+T_TX_LEVEL;
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+/* Define structure for sub-band definition of TX Power ******/ 
+typedef struct 
+   {
+   UWORD16  upper_bound;    //highest physical arfcn of the sub-band 
+   WORD16    agc_calib;      // AGC  for each TXPWR
+   }T_RF_AGC_BAND;
+
+/************************************/
+/*       Ramp definitions           */
+/************************************/
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+  typedef struct
+  {
+    UWORD8  ramp_up     [16];  // Ramp-up profile
+    UWORD8  ramp_down   [16];  // Ramp-down profile
+  }
+  T_TX_RAMP;
+#endif
+
+
+// RF structure definition
+//========================
+
+enum RfRevision {
+    RF_IGNORE      = 0x0000,
+    RF_SL2         = 0x1000,
+    RF_GAIA_20X    = 0x2000,
+    RF_GAIA_20A    = 0x2001,
+    RF_GAIA_20B    = 0x2002,
+    RF_ATLAS_20B   = 0x2020,
+    RF_PASCAL_20   = 0x2030
+};
+
+// Number of bands supported
+#define GSM_BANDS 2
+
+#define MULTI_BAND1     0
+#define MULTI_BAND2     1
+// RF table sizes
+#define RF_RX_CAL_CHAN_SIZE 10 // number of AGC sub-bands
+#define RF_RX_CAL_TEMP_SIZE 11 // number of temperature ranges
+
+#define RF_TX_CHAN_CAL_TABLE_SIZE  4 // channel calibration table size 
+#define RF_TX_NUM_SUB_BANDS        8 // number of sub-bands in channel calibration table
+#define RF_TX_LEVELS_TABLE_SIZE   32 // level table size  
+#define RF_TX_RAMP_SIZE           16 // number of ramp definitions
+#define RF_TX_CAL_TEMP_SIZE        5 // number of temperature ranges
+
+#define AGC_TABLE_SIZE      27
+
+#define TEMP_TABLE_SIZE    131 // number of elements in ADC->temp conversion table
+
+
+// RX parameters and tables
+//-------------------------
+
+// AGC parameters and tables
+typedef struct
+{
+  UWORD16 low_agc_noise_thr;
+  UWORD16 high_agc_sat_thr;
+  UWORD16 low_agc;
+  UWORD16 high_agc;
+  UWORD8  il2agc_pwr[121];
+  UWORD8  il2agc_max[121];
+  UWORD8  il2agc_av[121];
+}
+T_AGC;
+
+// Calibration parameters
+typedef struct
+{
+  UWORD16 g_magic;
+  UWORD16 lna_att;
+  UWORD16 lna_switch_thr_low;
+  UWORD16 lna_switch_thr_high;
+}
+T_RX_CAL_PARAMS;   
+
+// RX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  WORD16 agc_calib;
+}
+T_RX_TEMP_COMP;
+
+// RF RX structure
+typedef struct
+{
+  T_AGC              agc;
+}
+T_RF_RX; //common
+
+// RF RX structure
+typedef struct
+{
+  T_RX_CAL_PARAMS rx_cal_params;
+  T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+  T_RX_TEMP_COMP  temp[RF_RX_CAL_TEMP_SIZE];
+}
+T_RF_RX_BAND;
+
+
+// TX parameters and tables
+//-------------------------
+
+// TX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  #if (ORDER2_TX_TEMP_CAL==1)
+    WORD16 a;
+    WORD16 b;
+    WORD16 c;
+  #else
+    WORD16 apc_calib;          //WORD16 c
+  #endif
+}
+T_TX_TEMP_CAL;
+
+
+// Ramp up and ramp down delay
+typedef struct
+{
+  UWORD16 up;
+  UWORD16 down;
+}
+T_RAMP_DELAY;
+
+typedef struct 
+{
+  UWORD16 arfcn_limit;
+  WORD16  chan_cal;
+} 
+T_TX_CHAN_CAL; 
+
+// RF TX structure
+typedef struct
+{
+  T_RAMP_DELAY   ramp_delay;
+  UWORD8         guard_bits;  // number of guard bits needed for ramp up
+  UWORD8         prg_tx;
+}
+T_RF_TX; //common
+  
+// RF TX structure
+typedef struct
+{
+  T_TX_LEVEL           levels[RF_TX_LEVELS_TABLE_SIZE];
+  T_TX_CHAN_CAL        chan_cal_table[RF_TX_CHAN_CAL_TABLE_SIZE][RF_TX_NUM_SUB_BANDS];
+  T_TX_RAMP            ramp_tables[RF_TX_RAMP_SIZE];
+  T_TX_TEMP_CAL        temp[RF_TX_CAL_TEMP_SIZE];
+}
+T_RF_TX_BAND;
+
+// band structure 
+typedef struct
+{
+  T_RF_RX_BAND  rx;
+  T_RF_TX_BAND  tx;
+  UWORD8        swap_iq;
+}
+T_RF_BAND;  
+  
+// RF structure 
+typedef struct
+{
+  // common for all bands
+  UWORD16      rf_revision;
+  UWORD16      radio_band_support;
+  T_RF_RX      rx;
+  T_RF_TX      tx;
+  T_AFC_PARAMS afc;
+}
+T_RF;
+
+/************************************/
+/*       MADC definitions           */
+/************************************/
+// Omega: 5 external channels if touch screen not used, 3 otherwise
+enum ADC_INDEX {
+   ADC_VBAT,
+   ADC_VCHARG,
+   ADC_ICHARG,
+   ADC_VBACKUP,
+   ADC_BATTYP,
+   ADC_BATTEMP,
+   ADC_ADC3,     // name of this ??
+   ADC_RFTEMP,
+   ADC_ADC4,
+   ADC_INDEX_END // ADC_INDEX_END must be the end of the enums
+};
+
+typedef struct
+{
+     WORD16 converted[ADC_INDEX_END]; // converted
+    UWORD16 raw[ADC_INDEX_END];       // raw from ADC
+}
+T_ADC;
+
+/************************************/
+/*       MADC calibration           */
+/************************************/
+typedef struct
+{
+   UWORD16 a[ADC_INDEX_END];
+   WORD16 b[ADC_INDEX_END];
+}
+T_ADCCAL;
+
+// Conversion table: ADC value -> temperature
+typedef struct 
+{
+    UWORD16 adc;  // ADC reading is 10 bits
+    WORD16  temp; // temp is in approx. range -30..+80
+}
+T_TEMP;
+
+typedef struct
+{
+    char *name;
+    void *addr;
+    int  size;
+}
+T_CONFIG_FILE;
+
+typedef struct
+{
+  char      *name;         // name of ffs file suffix
+  T_RF_BAND *addr;         // address to default flash structure
+  UWORD16   max_carrier;  // max carrier 
+  UWORD16   max_txpwr;    // max tx power
+}
+T_BAND_CONFIG;
+
+typedef struct
+{
+  UWORD8  band[GSM_BANDS]; // index to band address
+  UWORD8  txpwr_tp; // tx power turning point  
+  UWORD16 first_arfcn;  // first index
+}
+T_STD_CONFIG;
+
+enum GSMBAND_DEF 
+{
+  BAND_NONE,
+  BAND_EGSM900,
+  BAND_DCS1800,
+  BAND_PCS1900,
+  BAND_GSM850,
+  BAND_PCS1900_US,
+  // put new bands here
+  BAND_GSM900  //last entry
+};
+
+/************************************/
+/* ABB (Omega) Initialization       */
+/************************************/
+
+#if ((ANALOG == 1) || (ANALOG == 2))
+  #define ABB_TABLE_SIZE 16
+#elif (ANALOG == 3)
+  #define ABB_TABLE_SIZE 22
+#endif
+
+// Note that this translation is probably not needed at all. But until L1 is
+// (maybe) changed to simply initialize the ABB from a table of words, we
+// use this to make things more easy-readable.
+#if (ANALOG == 1)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_APCDEL
+  };
+#elif (ANALOG == 2)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_BULGCAL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_VBCR2,
+    ABB_APCDEL,
+    ABB_APCDEL2
+  };
+#elif (ANALOG == 3)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_BULGCAL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_VBCR2,
+    ABB_APCDEL,
+    ABB_APCDEL2,
+    ABB_VBPOP,
+    ABB_VAUDINITD,
+    ABB_VAUDCR,
+    ABB_VAUOCR,
+    ABB_VAUSCR,
+    ABB_VAUDPLL
+  };
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_rf12.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,2109 @@
+#if (OP_L1_STANDALONE == 1)
+  // Define the correct enumeration of PA. Consult tpudrv12.h for the enumeration.
+  #if ((BOARD == 40) || (BOARD == 41) || (BOARD == 45)) // EvaRita + D-sample or EvaConso
+    #define PA 3
+  #else
+    #define PA 0
+  #endif
+#else  
+#include "rf.cfg"
+//#define PA 3 // Hitachi
+#endif
+
+T_RF rf =
+{
+  RF_RITA_10,           //RF revision
+  RF_HW_BAND_SUPPORT,   // radio_band_support E-GSM/DCS + PCS
+
+  { //RX structure
+    { //AGC structure
+      140,  // low_agc_noise_thr;
+      110,  // high_agc_sat_thr;
+        6,  // low_agc;
+       34,  // high_agc;
+      //IL2AGC tables
+      {  // below is: il2agc_pwr[121];
+        //           il2agc_max[121];
+        //           il2agc_av[121];
+        // il2agc_pwr
+        // Note this is shared between PCN and EGSM.
+    14,          /*  EGSM_MAX  IL=0 */
+    14,          /*  EGSM_MAX  IL=-1 */
+    14,          /*  EGSM_MAX  IL=-2 */
+    14,          /*  EGSM_MAX  IL=-3 */
+    14,          /*  EGSM_MAX  IL=-4 */
+    14,          /*  EGSM_MAX  IL=-5 */
+    14,          /*  EGSM_MAX  IL=-6 */
+    14,          /*  EGSM_MAX  IL=-7 */
+    14,          /*  EGSM_MAX  IL=-8 */
+    14,          /*  EGSM_MAX  IL=-9 */
+    14,          /*  EGSM_MAX  IL=-10 */
+    14,          /*  EGSM_MAX  IL=-11 */
+    14,          /*  EGSM_MAX  IL=-12 */
+    14,          /*  EGSM_MAX  IL=-13 */
+    14,          /*  EGSM_MAX  IL=-14 */
+    14,          /*  EGSM_MAX  IL=-15 */
+    14,          /*  EGSM_MAX  IL=-16 */
+    14,          /*  EGSM_MAX  IL=-17 */
+    14,          /*  EGSM_MAX  IL=-18 */
+    14,          /*  EGSM_MAX  IL=-19 */
+    14,          /*  EGSM_MAX  IL=-20 */
+    14,          /*  EGSM_MAX  IL=-21 */
+    14,          /*  EGSM_MAX  IL=-22 */
+    14,          /*  EGSM_MAX  IL=-23 */
+    14,          /*  EGSM_MAX  IL=-24 */
+    14,          /*  EGSM_MAX  IL=-25 */
+    14,          /*  EGSM_MAX  IL=-26 */
+    14,          /*  EGSM_MAX  IL=-27 */
+    14,          /*  EGSM_MAX  IL=-28 */
+    14,          /*  EGSM_MAX  IL=-29 */
+    14,          /*  EGSM_MAX  IL=-30 */
+    14,          /*  EGSM_MAX  IL=-31 */
+    14,          /*  EGSM_MAX  IL=-32 */
+    14,          /*  EGSM_MAX  IL=-33 */
+    14,          /*  EGSM_MAX  IL=-34 */
+    14,          /*  EGSM_MAX  IL=-35 */
+    14,          /*  EGSM_MAX  IL=-36 */
+    14,          /*  EGSM_MAX  IL=-37 */
+    14,          /*  EGSM_MAX  IL=-38 */
+    14,          /*  EGSM_MAX  IL=-39 */
+    14,          /*  EGSM_MAX  IL=-40 */
+    14,          /*  EGSM_MAX  IL=-41 */
+    14,          /*  EGSM_MAX  IL=-42 */
+    14,          /*  EGSM_MAX  IL=-43 */
+    14,          /*  EGSM_MAX  IL=-44 */
+    14,          /*  EGSM_MAX  IL=-45 */
+    14,          /*  EGSM_MAX  IL=-46 */
+    14,          /*  EGSM_MAX  IL=-47 */
+    14,          /*  EGSM_MAX  IL=-48 */
+    14,          /*  EGSM_MAX  IL=-49 */
+    14,          /*  EGSM_MAX  IL=-50 */
+    14,          /*  EGSM_MAX  IL=-51 */
+    14,          /*  EGSM_MAX  IL=-52 */
+    14,          /*  EGSM_MAX  IL=-53 */
+    14,          /*  EGSM_MAX  IL=-54 */
+    16,          /*  EGSM_MAX  IL=-55 */
+    16,          /*  EGSM_MAX  IL=-56 */
+    18,          /*  EGSM_MAX  IL=-57 */
+    18,          /*  EGSM_MAX  IL=-58 */
+    20,          /*  EGSM_MAX  IL=-59 */
+    20,          /*  EGSM_MAX  IL=-60 */
+    22,          /*  EGSM_MAX  IL=-61 */
+    22,          /*  EGSM_MAX  IL=-62 */
+    24,          /*  EGSM_MAX  IL=-63 */
+    24,          /*  EGSM_MAX  IL=-64 */
+    26,          /*  EGSM_MAX  IL=-65 */
+    26,          /*  EGSM_MAX  IL=-66 */
+    28,          /*  EGSM_MAX  IL=-67 */
+    28,          /*  EGSM_MAX  IL=-68 */
+    30,          /*  EGSM_MAX  IL=-69 */
+    30,          /*  EGSM_MAX  IL=-70 */
+    32,          /*  EGSM_MAX  IL=-71 */
+    32,          /*  EGSM_MAX  IL=-72 */
+    34,          /*  EGSM_MAX  IL=-73 */
+    34,          /*  EGSM_MAX  IL=-74 */
+    36,          /*  EGSM_MAX  IL=-75 */
+    36,          /*  EGSM_MAX  IL=-76 */
+    38,          /*  EGSM_MAX  IL=-77 */
+    38,          /*  EGSM_MAX  IL=-78 */
+    40,          /*  EGSM_MAX  IL=-79 */
+    40,          /*  EGSM_MAX  IL=-80 */
+    40,          /*  EGSM_MAX  IL=-81 */
+    40,          /*  EGSM_MAX  IL=-82 */
+    40,          /*  EGSM_MAX  IL=-83 */
+    40,          /*  EGSM_MAX  IL=-84 */
+    40,          /*  EGSM_MAX  IL=-85 */
+    40,          /*  EGSM_MAX  IL=-86 */
+    40,          /*  EGSM_MAX  IL=-87 */
+    40,          /*  EGSM_MAX  IL=-88 */
+    40,          /*  EGSM_MAX  IL=-89 */
+    40,          /*  EGSM_MAX  IL=-90 */
+    40,          /*  EGSM_MAX  IL=-91 */
+    40,          /*  EGSM_MAX  IL=-92 */
+    40,          /*  EGSM_MAX  IL=-93 */
+    40,          /*  EGSM_MAX  IL=-94 */
+    40,          /*  EGSM_MAX  IL=-95 */
+    40,          /*  EGSM_MAX  IL=-96 */
+    40,          /*  EGSM_MAX  IL=-97 */
+    40,          /*  EGSM_MAX  IL=-98 */
+    40,          /*  EGSM_MAX  IL=-99 */
+    40,          /*  EGSM_MAX  IL=-100 */
+    40,          /*  EGSM_MAX  IL=-101 */
+    40,          /*  EGSM_MAX  IL=-102 */
+    40,          /*  EGSM_MAX  IL=-103 */
+    40,          /*  EGSM_MAX  IL=-104 */
+    40,          /*  EGSM_MAX  IL=-105 */
+    40,          /*  EGSM_MAX  IL=-106 */
+    40,          /*  EGSM_MAX  IL=-107 */
+    40,          /*  EGSM_MAX  IL=-108 */
+    40,          /*  EGSM_MAX  IL=-109 */
+    40,          /*  EGSM_MAX  IL=-110 */
+    40,          /*  EGSM_MAX  IL=-111 */
+    40,          /*  EGSM_MAX  IL=-112 */
+    40,          /*  EGSM_MAX  IL=-113 */
+    40,          /*  EGSM_MAX  IL=-114 */
+    40,          /*  EGSM_MAX  IL=-115 */
+    40,          /*  EGSM_MAX  IL=-116 */
+    40,          /*  EGSM_MAX  IL=-117 */
+    40,          /*  EGSM_MAX  IL=-118 */
+    40,          /*  EGSM_MAX  IL=-119 */
+    40           /*  EGSM_MAX  IL=-120 */
+      },
+      { // il2agc_max
+        // Note this is shared between PCN and EGSM.
+    14,          /*  EGSM_MAX  IL=0 */
+    14,          /*  EGSM_MAX  IL=-1 */
+    14,          /*  EGSM_MAX  IL=-2 */
+    14,          /*  EGSM_MAX  IL=-3 */
+    14,          /*  EGSM_MAX  IL=-4 */
+    14,          /*  EGSM_MAX  IL=-5 */
+    14,          /*  EGSM_MAX  IL=-6 */
+    14,          /*  EGSM_MAX  IL=-7 */
+    14,          /*  EGSM_MAX  IL=-8 */
+    14,          /*  EGSM_MAX  IL=-9 */
+    14,          /*  EGSM_MAX  IL=-10 */
+    14,          /*  EGSM_MAX  IL=-11 */
+    14,          /*  EGSM_MAX  IL=-12 */
+    14,          /*  EGSM_MAX  IL=-13 */
+    14,          /*  EGSM_MAX  IL=-14 */
+    14,          /*  EGSM_MAX  IL=-15 */
+    14,          /*  EGSM_MAX  IL=-16 */
+    14,          /*  EGSM_MAX  IL=-17 */
+    14,          /*  EGSM_MAX  IL=-18 */
+    14,          /*  EGSM_MAX  IL=-19 */
+    14,          /*  EGSM_MAX  IL=-20 */
+    14,          /*  EGSM_MAX  IL=-21 */
+    14,          /*  EGSM_MAX  IL=-22 */
+    14,          /*  EGSM_MAX  IL=-23 */
+    14,          /*  EGSM_MAX  IL=-24 */
+    14,          /*  EGSM_MAX  IL=-25 */
+    14,          /*  EGSM_MAX  IL=-26 */
+    14,          /*  EGSM_MAX  IL=-27 */
+    14,          /*  EGSM_MAX  IL=-28 */
+    14,          /*  EGSM_MAX  IL=-29 */
+    14,          /*  EGSM_MAX  IL=-30 */
+    14,          /*  EGSM_MAX  IL=-31 */
+    14,          /*  EGSM_MAX  IL=-32 */
+    14,          /*  EGSM_MAX  IL=-33 */
+    14,          /*  EGSM_MAX  IL=-34 */
+    14,          /*  EGSM_MAX  IL=-35 */
+    14,          /*  EGSM_MAX  IL=-36 */
+    14,          /*  EGSM_MAX  IL=-37 */
+    14,          /*  EGSM_MAX  IL=-38 */
+    14,          /*  EGSM_MAX  IL=-39 */
+    14,          /*  EGSM_MAX  IL=-40 */
+    14,          /*  EGSM_MAX  IL=-41 */
+    14,          /*  EGSM_MAX  IL=-42 */
+    14,          /*  EGSM_MAX  IL=-43 */
+    14,          /*  EGSM_MAX  IL=-44 */
+    14,          /*  EGSM_MAX  IL=-45 */
+    14,          /*  EGSM_MAX  IL=-46 */
+    14,          /*  EGSM_MAX  IL=-47 */
+    14,          /*  EGSM_MAX  IL=-48 */
+    14,          /*  EGSM_MAX  IL=-49 */
+    14,          /*  EGSM_MAX  IL=-50 */
+    14,          /*  EGSM_MAX  IL=-51 */
+    14,          /*  EGSM_MAX  IL=-52 */
+    14,          /*  EGSM_MAX  IL=-53 */
+    14,          /*  EGSM_MAX  IL=-54 */
+    16,          /*  EGSM_MAX  IL=-55 */
+    16,          /*  EGSM_MAX  IL=-56 */
+    18,          /*  EGSM_MAX  IL=-57 */
+    18,          /*  EGSM_MAX  IL=-58 */
+    20,          /*  EGSM_MAX  IL=-59 */
+    20,          /*  EGSM_MAX  IL=-60 */
+    22,          /*  EGSM_MAX  IL=-61 */
+    22,          /*  EGSM_MAX  IL=-62 */
+    24,          /*  EGSM_MAX  IL=-63 */
+    24,          /*  EGSM_MAX  IL=-64 */
+    26,          /*  EGSM_MAX  IL=-65 */
+    26,          /*  EGSM_MAX  IL=-66 */
+    28,          /*  EGSM_MAX  IL=-67 */
+    28,          /*  EGSM_MAX  IL=-68 */
+    30,          /*  EGSM_MAX  IL=-69 */
+    30,          /*  EGSM_MAX  IL=-70 */
+    32,          /*  EGSM_MAX  IL=-71 */
+    32,          /*  EGSM_MAX  IL=-72 */
+    34,          /*  EGSM_MAX  IL=-73 */
+    34,          /*  EGSM_MAX  IL=-74 */
+    36,          /*  EGSM_MAX  IL=-75 */
+    36,          /*  EGSM_MAX  IL=-76 */
+    38,          /*  EGSM_MAX  IL=-77 */
+    38,          /*  EGSM_MAX  IL=-78 */
+    40,          /*  EGSM_MAX  IL=-79 */
+    40,          /*  EGSM_MAX  IL=-80 */
+    40,          /*  EGSM_MAX  IL=-81 */
+    40,          /*  EGSM_MAX  IL=-82 */
+    40,          /*  EGSM_MAX  IL=-83 */
+    40,          /*  EGSM_MAX  IL=-84 */
+    40,          /*  EGSM_MAX  IL=-85 */
+    40,          /*  EGSM_MAX  IL=-86 */
+    40,          /*  EGSM_MAX  IL=-87 */
+    40,          /*  EGSM_MAX  IL=-88 */
+    40,          /*  EGSM_MAX  IL=-89 */
+    40,          /*  EGSM_MAX  IL=-90 */
+    40,          /*  EGSM_MAX  IL=-91 */
+    40,          /*  EGSM_MAX  IL=-92 */
+    40,          /*  EGSM_MAX  IL=-93 */
+    40,          /*  EGSM_MAX  IL=-94 */
+    40,          /*  EGSM_MAX  IL=-95 */
+    40,          /*  EGSM_MAX  IL=-96 */
+    40,          /*  EGSM_MAX  IL=-97 */
+    40,          /*  EGSM_MAX  IL=-98 */
+    40,          /*  EGSM_MAX  IL=-99 */
+    40,          /*  EGSM_MAX  IL=-100 */
+    40,          /*  EGSM_MAX  IL=-101 */
+    40,          /*  EGSM_MAX  IL=-102 */
+    40,          /*  EGSM_MAX  IL=-103 */
+    40,          /*  EGSM_MAX  IL=-104 */
+    40,          /*  EGSM_MAX  IL=-105 */
+    40,          /*  EGSM_MAX  IL=-106 */
+    40,          /*  EGSM_MAX  IL=-107 */
+    40,          /*  EGSM_MAX  IL=-108 */
+    40,          /*  EGSM_MAX  IL=-109 */
+    40,          /*  EGSM_MAX  IL=-110 */
+    40,          /*  EGSM_MAX  IL=-111 */
+    40,          /*  EGSM_MAX  IL=-112 */
+    40,          /*  EGSM_MAX  IL=-113 */
+    40,          /*  EGSM_MAX  IL=-114 */
+    40,          /*  EGSM_MAX  IL=-115 */
+    40,          /*  EGSM_MAX  IL=-116 */
+    40,          /*  EGSM_MAX  IL=-117 */
+    40,          /*  EGSM_MAX  IL=-118 */
+    40,          /*  EGSM_MAX  IL=-119 */
+    40           /*  EGSM_MAX  IL=-120 */
+        },
+        { // il2agc_av
+          // Note this is shared between PCN and EGSM.
+    14,          /*  EGSM_MAX  IL=0 */
+    14,          /*  EGSM_MAX  IL=-1 */
+    14,          /*  EGSM_MAX  IL=-2 */
+    14,          /*  EGSM_MAX  IL=-3 */
+    14,          /*  EGSM_MAX  IL=-4 */
+    14,          /*  EGSM_MAX  IL=-5 */
+    14,          /*  EGSM_MAX  IL=-6 */
+    14,          /*  EGSM_MAX  IL=-7 */
+    14,          /*  EGSM_MAX  IL=-8 */
+    14,          /*  EGSM_MAX  IL=-9 */
+    14,          /*  EGSM_MAX  IL=-10 */
+    14,          /*  EGSM_MAX  IL=-11 */
+    14,          /*  EGSM_MAX  IL=-12 */
+    14,          /*  EGSM_MAX  IL=-13 */
+    14,          /*  EGSM_MAX  IL=-14 */
+    14,          /*  EGSM_MAX  IL=-15 */
+    14,          /*  EGSM_MAX  IL=-16 */
+    14,          /*  EGSM_MAX  IL=-17 */
+    14,          /*  EGSM_MAX  IL=-18 */
+    14,          /*  EGSM_MAX  IL=-19 */
+    14,          /*  EGSM_MAX  IL=-20 */
+    14,          /*  EGSM_MAX  IL=-21 */
+    14,          /*  EGSM_MAX  IL=-22 */
+    14,          /*  EGSM_MAX  IL=-23 */
+    14,          /*  EGSM_MAX  IL=-24 */
+    14,          /*  EGSM_MAX  IL=-25 */
+    14,          /*  EGSM_MAX  IL=-26 */
+    14,          /*  EGSM_MAX  IL=-27 */
+    14,          /*  EGSM_MAX  IL=-28 */
+    14,          /*  EGSM_MAX  IL=-29 */
+    14,          /*  EGSM_MAX  IL=-30 */
+    14,          /*  EGSM_MAX  IL=-31 */
+    14,          /*  EGSM_MAX  IL=-32 */
+    14,          /*  EGSM_MAX  IL=-33 */
+    14,          /*  EGSM_MAX  IL=-34 */
+    14,          /*  EGSM_MAX  IL=-35 */
+    14,          /*  EGSM_MAX  IL=-36 */
+    14,          /*  EGSM_MAX  IL=-37 */
+    14,          /*  EGSM_MAX  IL=-38 */
+    14,          /*  EGSM_MAX  IL=-39 */
+    14,          /*  EGSM_MAX  IL=-40 */
+    14,          /*  EGSM_MAX  IL=-41 */
+    14,          /*  EGSM_MAX  IL=-42 */
+    14,          /*  EGSM_MAX  IL=-43 */
+    14,          /*  EGSM_MAX  IL=-44 */
+    14,          /*  EGSM_MAX  IL=-45 */
+    14,          /*  EGSM_MAX  IL=-46 */
+    14,          /*  EGSM_MAX  IL=-47 */
+    14,          /*  EGSM_MAX  IL=-48 */
+    14,          /*  EGSM_MAX  IL=-49 */
+    14,          /*  EGSM_MAX  IL=-50 */
+    14,          /*  EGSM_MAX  IL=-51 */
+    14,          /*  EGSM_MAX  IL=-52 */
+    14,          /*  EGSM_MAX  IL=-53 */
+    14,          /*  EGSM_MAX  IL=-54 */
+    16,          /*  EGSM_MAX  IL=-55 */
+    16,          /*  EGSM_MAX  IL=-56 */
+    18,          /*  EGSM_MAX  IL=-57 */
+    18,          /*  EGSM_MAX  IL=-58 */
+    20,          /*  EGSM_MAX  IL=-59 */
+    20,          /*  EGSM_MAX  IL=-60 */
+    22,          /*  EGSM_MAX  IL=-61 */
+    22,          /*  EGSM_MAX  IL=-62 */
+    24,          /*  EGSM_MAX  IL=-63 */
+    24,          /*  EGSM_MAX  IL=-64 */
+    26,          /*  EGSM_MAX  IL=-65 */
+    26,          /*  EGSM_MAX  IL=-66 */
+    28,          /*  EGSM_MAX  IL=-67 */
+    28,          /*  EGSM_MAX  IL=-68 */
+    30,          /*  EGSM_MAX  IL=-69 */
+    30,          /*  EGSM_MAX  IL=-70 */
+    32,          /*  EGSM_MAX  IL=-71 */
+    32,          /*  EGSM_MAX  IL=-72 */
+    34,          /*  EGSM_MAX  IL=-73 */
+    34,          /*  EGSM_MAX  IL=-74 */
+    36,          /*  EGSM_MAX  IL=-75 */
+    36,          /*  EGSM_MAX  IL=-76 */
+    38,          /*  EGSM_MAX  IL=-77 */
+    38,          /*  EGSM_MAX  IL=-78 */
+    40,          /*  EGSM_MAX  IL=-79 */
+    40,          /*  EGSM_MAX  IL=-80 */
+    40,          /*  EGSM_MAX  IL=-81 */
+    40,          /*  EGSM_MAX  IL=-82 */
+    40,          /*  EGSM_MAX  IL=-83 */
+    40,          /*  EGSM_MAX  IL=-84 */
+    40,          /*  EGSM_MAX  IL=-85 */
+    40,          /*  EGSM_MAX  IL=-86 */
+    40,          /*  EGSM_MAX  IL=-87 */
+    40,          /*  EGSM_MAX  IL=-88 */
+    40,          /*  EGSM_MAX  IL=-89 */
+    40,          /*  EGSM_MAX  IL=-90 */
+    40,          /*  EGSM_MAX  IL=-91 */
+    40,          /*  EGSM_MAX  IL=-92 */
+    40,          /*  EGSM_MAX  IL=-93 */
+    40,          /*  EGSM_MAX  IL=-94 */
+    40,          /*  EGSM_MAX  IL=-95 */
+    40,          /*  EGSM_MAX  IL=-96 */
+    40,          /*  EGSM_MAX  IL=-97 */
+    40,          /*  EGSM_MAX  IL=-98 */
+    40,          /*  EGSM_MAX  IL=-99 */
+    40,          /*  EGSM_MAX  IL=-100 */
+    40,          /*  EGSM_MAX  IL=-101 */
+    40,          /*  EGSM_MAX  IL=-102 */
+    40,          /*  EGSM_MAX  IL=-103 */
+    40,          /*  EGSM_MAX  IL=-104 */
+    40,          /*  EGSM_MAX  IL=-105 */
+    40,          /*  EGSM_MAX  IL=-106 */
+    40,          /*  EGSM_MAX  IL=-107 */
+    40,          /*  EGSM_MAX  IL=-108 */
+    40,          /*  EGSM_MAX  IL=-109 */
+    40,          /*  EGSM_MAX  IL=-110 */
+    40,          /*  EGSM_MAX  IL=-111 */
+    40,          /*  EGSM_MAX  IL=-112 */
+    40,          /*  EGSM_MAX  IL=-113 */
+    40,          /*  EGSM_MAX  IL=-114 */
+    40,          /*  EGSM_MAX  IL=-115 */
+    40,          /*  EGSM_MAX  IL=-116 */
+    40,          /*  EGSM_MAX  IL=-117 */
+    40,          /*  EGSM_MAX  IL=-118 */
+    40,          /*  EGSM_MAX  IL=-119 */
+    40           /*  EGSM_MAX  IL=-120 */
+      }
+    },
+  },
+  {
+    {0, 0},     // ramp up and down delays
+    GUARD_BITS, // number of guard bits needed for ramp up
+    PRG_TX      // propagation delay PRG_TX
+  },
+  { //AFC parameters
+    EEPROM_AFC,
+    C_Psi_sta_inv,     // (1/C_Psi_sta)
+    C_Psi_st,          // C_Psi_sta * 0.8 F0.16
+    C_Psi_st_32,       // F0.32
+    C_Psi_st_inv       // (1/C_Psi_st)
+
+#if (VCXO_ALGO==1)
+     ,C_AFC_DAC_CENTER,      // VCXO startup parameter - best guess
+      C_AFC_DAC_MIN,         // VCXO startup parameter - 15ppm
+      C_AFC_DAC_MAX,         // VCXO startup parameter + 15ppm
+      C_AFC_SNR_THR         // snr - Default threshold value
+#endif
+  }
+};
+
+T_RF_BAND rf_band[GSM_BANDS]; //uninitialised rf struct for bands
+
+const T_RF_BAND rf_900 =
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+        193,      //g_magic
+         40,      //lna_gain_max * 2
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib
+      {  10,  0},    // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  0},    // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},    // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},    // etc.
+      {  90,  0},    //
+      { 112,  0},    //
+      { 124,  0},    //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// gsm900 T_LEVEL_TX
+#if (PA == 3)  // Hitachi
+    {550,  0, 0}, // 0
+    {550,  0, 0}, // 1
+    {550,  0, 0}, // 2
+    {550,  0, 0}, // 3
+    {550,  0, 0}, // 4
+    {560,  0, 0}, // 5 Highest power
+    {510,  1, 0}, // 6
+    {460,  2, 0}, // 7
+    {400,  3, 1}, // 8
+    {325,  4, 1}, // 9
+    {280,  5, 1}, // 10
+    {230,  6, 1}, // 11
+    {195,  7, 1}, // 12
+    {175,  8, 2}, // 13
+    {158,  9, 2},  // 14
+    {140, 10, 2}, // 15
+    {130, 11, 2}, // 16
+    {120, 12, 3}, // 17
+    {115, 13, 3}, // 18
+    {110, 14, 3}, // 19 Lowest power
+    { 43, 14, 0}, // 20
+    { 43, 14, 0}, // 21
+    { 43, 14, 0}, // 22
+    { 43, 14, 0}, // 23
+    { 43, 14, 0}, // 24
+    { 43, 14, 0}, // 25
+    { 43, 14, 0}, // 26
+    { 43, 14, 0}, // 27
+    { 43, 14, 0}, // 28
+    { 43, 14, 0}, // 29
+    { 43, 14, 0}, // 30
+    { 43, 14, 0}, // 31
+#else
+      { 673, 0, 0  }, // 0
+      { 673, 0, 0  }, // 1
+      { 673, 0, 0  }, // 2
+      { 673, 0, 0  }, // 3
+      { 673, 0, 0  }, // 4
+      { 673, 0, 0  }, // 5 Highest power
+      { 478, 1, 0  }, // 6
+      { 389, 2, 0  }, // 7
+      { 318, 3, 0  }, // 8
+      { 260, 4, 0  }, // 9
+      { 217, 5, 0  }, // 10
+      { 180, 6, 0  }, // 11
+      { 151, 7, 0  }, // 12
+      { 128, 8, 0  }, // 13
+      { 109, 9, 0  }, // 14
+      { 94, 10, 0  }, // 15
+      { 86, 11, 0  }, // 16
+      { 78, 12, 0  }, // 17
+      { 72, 13, 0  }, // 18
+      { 67, 14, 0  }, // 19 Lowest power
+      { 67, 14, 0  }, // 20
+      { 67, 14, 0  }, // 21
+      { 67, 14, 0  }, // 22
+      { 67, 14, 0  }, // 23
+      { 67, 14, 0  }, // 24
+      { 67, 14, 0  }, // 25
+      { 67, 14, 0  }, // 26
+      { 67, 14, 0  }, // 27
+      { 67, 14, 0  }, // 28
+      { 67, 14, 0  }, // 29
+      { 67, 14, 0  }, // 30
+      { 67, 14, 0  }, // 31
+#endif
+    },
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+#if (PA == 3)  // Hitachi
+        {   21, 128 }, // Calibration Table 0
+        {   41, 128 },
+        {   62, 128 },
+        {   82, 128 },
+        {  103, 128 },
+        {  124, 129 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+#else
+        {   40, 128 }, // Calibration Table 0
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+#endif
+      {// arfcn, tx_chan_cal
+        {   21, 128 }, // Calibration Table 1
+        {   41, 128 },
+        {   62, 128 },
+        {   82, 128 },
+        {  103, 128 },
+        {  124, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   21, 128 }, // Calibration Table 2
+        {   41, 128 },
+        {   62, 128 },
+        {   82, 128 },
+        {  103, 128 },
+        {  124, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   21, 128 }, // Calibration Table 3
+        {   41, 128 },
+        {   62, 128 },
+        {   82, 128 },
+        {  103, 128 },
+        {  124, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      }
+    },
+    { // GSM Power Ramp Values
+#if (PA == 3)  // Hitachi
+     {
+      {// Ramp-Up      #0 profile - Power Level 5
+        0,0,6,0,11,7,1,0,0,11,0,26,23,22,16,5 
+      },
+      {// Ramp-Down    #0 profile
+        0,5,7,16,26,24,30,6,0,14,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 6
+        0,4,8,0,0,0,25,0,0,0,0,17,30,19,25,0
+      },
+      {// Ramp-Down    #1 profile
+        0,7,19,24,28,25,23,2,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 7
+        0,4,8,0,0,0,25,0,0,0,0,17,30,19,25,0
+      },
+      {// Ramp-Down    #2 profile
+        0,7,19,24,28,25,23,2,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 8
+        5,9,11,3,0,4,16,0,1,0,0,7,18,24,12,18
+      },
+      {// Ramp-Down    #3 profile
+        0,9,16,23,23,21,18,9,3,2,0,0,0,2,1,1
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 9
+        5,0,18,17,0,8,0,0,0,3,0,14,21,21,15,6
+      },
+      {// Ramp-Down    #4 profile
+        0,8,12,31,24,20,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 10
+        5,10,11,20,0,7,0,0,14,0,0,0,15,17,22,7
+      },
+      {// Ramp-Down    #5 profile
+        0,7,17,24,27,20,18,11,4,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 11
+        0,11,1,8,30,0,0,0,0,28,0,1,14,14,12,9
+      },
+      {// Ramp-Down    #6 profile
+        0,7,16,19,27,26,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 12
+        0,0,12,0,2,0,21,26,0,0,0,24,9,3,20,11
+      },
+      {// Ramp-Down    #7 profile
+        0,6,17,21,28,23,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 13
+        5,0,0,26,31,16,0,0,0,0,0,0,0,31,13,6
+      },
+      {// Ramp-Down    #8 profile
+        0,15,14,20,22,24,19,9,2,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 14
+        5,10,9,0,4,3,10,10,23,2,7,13,4,12,11,5
+      },
+      {// Ramp-Down    #9 profile
+        0,4,19,28,24,20,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 15
+        5,0,10,9,4,4,12,13,14,15,19,13,7,2,1,0
+      },
+      {// Ramp-Down    #10 profile
+        0,3,18,29,25,20,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 16
+        5,10,9,6,14,7,13,11,13,10,15,5,4,2,4,0
+      },
+      {// Ramp-Down    #11 profile
+        0,0,13,24,31,27,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 17
+        5,10,9,11,15,6,13,9,19,31,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #12 profile
+        0,0,4,31,31,29,19,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 18
+        5,10,9,9,6,27,31,31,0,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #13 profile
+        0,0,4,31,29,25,25,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 19
+        5,10,20,31,31,31,0,0,0,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #14 profile
+        0,0,2,27,31,30,24,7,4,2,1,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 19
+        5,10,20,31,31,31,0,0,0,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #15 profile
+        0,0,2,27,31,30,24,7,4,2,1,0,0,0,0,0
+      },
+     },
+    },
+#else
+{ { 0,0,0,17,0,0,0,0,0,11,31,31,31,7,0,0  },        // Ramp-Up       #0 profile - Power Level 5
+{   0,18,31,31,31,17,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,6,17,0,0,0,0,30,31,25,9,10,0  },        // Ramp-Up       #0 profile - Power Level 6
+{   0,19,23,26,31,15,0,14,0,0,0,0,0,0,0,0  }, },    // Ramp-Down  #0 profile
+{ { 0,0,0,0,25,0,0,0,0,10,31,31,31,0,0,0  },        // Ramp-Up        #0 profile - Power Level 7
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down     # profile
+{ { 0,0,0,0,10,17,0,0,0,7,31,31,31,1,0,0  },        // Ramp-Up       #0 profile - Power Level 8
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,0,28,0,0,0,0,7,31,31,31,0,0,0  },         // Ramp-Up       #0 profile - Power Level 9
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,0,11,0,31,0,0,0,12,31,31,12,0,0  },      // Ramp-Up       #0 profile - Power Level 10
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,31,0,0,18,0,0,9,23,30,17,0,0,0  },         // Ramp-Up       #0 profile - Power Level 11
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },       // Ramp-Down   #0 profile
+{ { 0,0,31,0,0,0,19,0,0,0,19,31,23,5,0,0  },         // Ramp-Up      #0 profile - Power Level 12
+{   0,31,31,31,21,14,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down    #0 profile
+{ { 0,0,0,0,0,0,31,25,0,0,14,9,31,18,0,0  },        // Ramp-Up       #0 profile - Power Level 13
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 0,0,4,31,0,0,0,0,31,31,0,22,9,0,0,0  },         // Ramp-Up        #0 profile - Power Level 14
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 0,0,0,0,31,5,0,11,31,31,0,19,0,0,0,0  },        // Ramp-Up      #0 profile - Power Level 15
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 0,0,0,0,0,0,0,31,31,31,31,4,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 16
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,0,4,31,31,31,31,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 17
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,0,31,31,31,31,4,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 18
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,4,31,31,31,31,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 19
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  } } },    // Ramp-Down    #0 profile
+#endif
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_GSM,
+};
+
+const T_RF_BAND rf_1800 =
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      188,      //g_magic
+       40,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- DCS band --*/
+     /*--------------*/
+      { 548,  0},     //
+      { 622,  0},     //
+      { 680,  0},     //
+      { 745,  0},     //
+      { 812,  0},     //
+      { 860,  0},     //
+      { 885,  0},     //
+      { 991,  0},     //
+      { 992,  0},     //
+      {1023,  0},     //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// dcs1800 T_LEVEL_TX
+#if (PA == 3)  // Hitachi
+    {720, 0, 0}, // 0 Highest power
+    {637, 1, 0}, // 1
+    {570, 2, 0}, // 2
+    {470, 3, 1}, // 3
+    {390, 4, 1}, // 4
+    {328, 5, 1}, // 5
+    {277, 6, 1}, // 6
+    {238, 7, 1}, // 7
+    {205, 8, 2}, // 8
+    {178, 9, 2}, // 9
+    {158, 10, 2}, // 10
+    {140, 11, 2}, // 11
+    {133, 12, 2}, // 12
+    {125, 13, 3}, // 13
+    {118, 14, 3}, // 14
+    {114, 15, 3}, // 15 Lowest power
+    {61, 15, 0}, // 16
+    {61, 15, 0}, // 17
+    {61, 15, 0}, // 18
+    {61, 15, 0}, // 19
+    {61, 15, 0}, // 20
+    {61, 15, 0}, // 21
+    {61, 15, 0}, // 22
+    {61, 15, 0}, // 23    {61, 15, 0}, // 24
+    {61, 15, 0}, // 25
+    {61, 15, 0}, // 26
+    {61, 15, 0}, // 27
+    {61, 15, 0}, // 28
+    {750, 0, 0}, // 29 Highest power
+    {750, 0, 0}, // 30 Highest power
+    {750, 0, 0}, // 31 Highest power
+#else
+      { 918, 0, 0  }, // 0 Highest power
+      { 616, 1, 0  }, // 1
+      { 500, 2, 0  }, // 2
+      { 411, 3, 0  }, // 3
+      { 339, 4, 0  }, // 4
+      { 280, 5, 0  }, // 5
+      { 231, 6, 0  }, // 6
+      { 194, 7, 0  }, // 7
+      { 165, 8, 0  }, // 8
+      { 143, 9, 0  }, // 9
+      { 122, 10, 0  }, // 10
+      { 109, 11, 0  }, // 11
+      { 96, 12, 0  }, // 12
+      { 85, 13, 0  }, // 13
+      { 80, 14, 0  }, // 14
+      { 75, 15, 0  }, // 15 Lowest power
+      { 75, 15, 0  }, // 16
+      { 75, 15, 0  }, // 17
+      { 75, 15, 0  }, // 18
+      { 75, 15, 0  }, // 19
+      { 75, 15, 0  }, // 20
+      { 75, 15, 0  }, // 21
+      { 75, 15, 0  }, // 22
+      { 75, 15, 0  }, // 23
+      { 75, 15, 0  }, // 24
+      { 75, 15, 0  }, // 25
+      { 75, 15, 0  }, // 26
+      { 75, 15, 0  }, // 27
+      { 75, 15, 0  }, // 28
+      { 754, 0, 0  }, // 29
+      { 754, 0, 0  }, // 30
+      { 754, 0, 0  }, // 31
+#endif
+    },
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {  554, 126 }, // Calibration Table 0
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 134 },
+        {  870, 134 },
+        {  885, 136 }
+      },
+      {
+        {  554, 128 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 2
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 3
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      }
+    },
+     { // DCS Power Ramp Values
+#if (PA == 3)  // Hitachi
+      {
+      {// Ramp-Up      #0 profile - Power Level 0
+        0,0,0,10,16,0,0,0,6,0,0,0,19,31,31,15
+      },
+      {// Ramp-Down    #0 profile
+        6,13,28,26,22,19,6,2,6,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 1
+        0,0,0,0,12,2,0,12,0,0,0,11,24,24,31,12
+      },
+      {// Ramp-Down    #1 profile
+        6,16,23,28,22,19,6,2,6,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 2
+        0,0,0,6,0,8,0,15,0,2,0,10,22,27,16,22
+      },
+      {// Ramp-Down    #2 profile
+        4,7,26,29,31,23,2,0,6,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 3
+        0,0,0,18,0,0,0,16,0,0,0,10,29,31,22,2
+      },
+      {// Ramp-Down    #3 profile
+        8,12,19,20,23,20,14,6,4,2,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 4
+        0,0,0,16,0,3,2,1,23,0,0,8,23,31,19,2
+      },
+      {// Ramp-Down    #4 profile
+        0,3,19,24,31,12,20,15,4,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 5
+        0,0,0,21,0,0,0,1,31,0,0,0,17,30,20,8
+      },
+      {// Ramp-Down    #5 profile
+        3,14,26,31,20,17,6,11,0,0,0,0,0,0,0,0,
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 6
+        0,0,0,15,0,0,11,2,24,6,9,0,19,31,10,1
+      },
+      {// Ramp-Down    #6 profile
+        5,20,31,23,6,17,26,0,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 7
+        0,0,0,15,0,0,11,2,18,0,22,0,7,0,31,22
+      },
+      {// Ramp-Down    #7 profile
+        0,5,20,31,23,6,17,26,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 8
+        1,0,0,14,0,11,0,29,0,0,9,14,13,6,27,4
+      },
+      {// Ramp-Down    #8 profile
+        2,19,27,25,31,16,8,0,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 9
+        0,0,0,22,0,0,20,20,7,11,0,15,5,0,28,0
+      },
+      {// Ramp-Down    #9 profile
+        0,2,23,31,31,31,0,0,10,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 10
+        0,0,0,22,0,0,20,20,7,11,0,15,5,0,28,0
+      },
+      {// Ramp-Down    #10 profile
+        0,0,25,31,31,31,0,0,10,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 11
+       0,0,22,0,0,20,20,7,11,0,15,5,0,28,0,0
+      },
+      {// Ramp-Down    #11 profile
+       0,0,20,31,31,31,5,0,10,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 12
+        0,0,0,4,31,31,4,11,0,11,2,17,6,11,0,0
+      },
+      {// Ramp-Down    #12 profile
+        0,0,27,30,31,31,9,0,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 13
+        0,4,31,31,4,11,0,11,2,17,6,11,0,0,0,0
+      },
+      {// Ramp-Down    #13 profile
+        0,0,0,27,30,31,31,9,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 14
+        0,0,0,0,31,31,31,19,16,0,0,0,0,0,0,0
+
+      },
+      {// Ramp-Down    #14 profile
+        0,0,2,31,31,31,31,2,0,0,0,0,0,0,0,0
+
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 15
+        0,0,0,0,31,31,31,19,16,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #15 profile
+        0,0,2,31,31,31,31,2,0,0,0,0,0,0,0,0
+      },
+     },
+    },
+#else
+{ { 0,0,0,19,0,0,0,0,0,8,31,31,31,8,0,0  },           // Ramp-Up       #0 profile - Power Level 0
+{   12,19,23,24,28,15,0,0,7,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,19,0,0,0,4,0,0,8,31,31,31,4,0,0  },           // Ramp-Up       #0 profile - Power Level 1
+{   0,11,27,30,29,31,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,26,0,0,0,0,0,22,23,26,21,10,0,0  },        // Ramp-Up       #0 profile - Power Level 2
+{   0,31,27,28,24,18,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,0,27,0,0,0,0,0,19,30,31,21,0,0  },         // Ramp-Up       #0 profile - Power Level 3
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },       // Ramp-Down   #0 profile
+{ { 0,0,0,30,0,0,0,0,0,13,31,30,24,0,0,0  },        // Ramp-Up       #0 profile - Power Level 4
+{   0,18,30,31,31,18,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,6,31,0,0,0,0,6,31,30,24,0,0,0  },         // Ramp-Up       #0 profile - Power Level 5
+{   0,13,30,31,31,23,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 31,0,0,0,7,0,0,11,0,0,26,30,23,0,0,0  },       // Ramp-Up       #0 profile - Power Level 6
+{   0,13,30,31,31,23,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,31,0,0,0,0,22,0,0,0,21,30,24,0,0,0  },        // Ramp-Up       #0 profile - Power Level 7
+{   0,13,30,31,31,23,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,9,31,31,0,0,0,26,31,0,0,0  },        // Ramp-Up       #0 profile - Power Level 8
+{   0,14,31,31,31,21,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,8,31,31,0,0,0,0,27,31,0,0,0  },        // Ramp-Up       #0 profile - Power Level 9
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,5,31,0,0,0,28,14,0,0,0,28,22,0,0,0  },        // Ramp-Up       #0 profile - Power Level 10
+{   0,15,31,31,29,22,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,0,16,27,31,31,23,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 11
+{   0,0,15,31,31,27,24,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,16,27,31,31,23,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 12
+{   0,0,14,31,31,27,25,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,16,31,25,31,25,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 13
+{   0,0,17,30,31,25,25,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,31,31,31,31,4,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 14
+{   0,0,18,31,22,30,27,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,31,31,31,31,4,0,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 15
+{   0,0,23,31,31,31,12,0,0,0,0,0,0,0,0,0  }, }, },     // Ramp-Down   #0 profile
+#endif
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_DCS
+};
+
+//copy from gsm900
+const T_RF_BAND rf_850 =
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+#if ((BOARD == 40) || (BOARD == 41) || (BOARD == 45)) // EvaRita + D-sample or EvaConso
+        193,      //g_magic
+#else
+        181,      //g_magic
+#endif
+         40,      //lna_gain_max * 2
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib
+      {  10,  0},    // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  0},    // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},    // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},    // etc.
+      {  90,  0},    //
+      { 112,  0},    //
+      { 124,  0},    //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// gsm850 T_LEVEL_TX
+#if (PA == 3)  // Hitachi
+      {560, 0, 0}, // 0
+      {560, 0, 0}, // 1
+      {560, 0, 0}, // 2
+      {560, 0, 0}, // 3
+      {560, 0, 0}, // 4
+      {560, 0, 0}, // 5 Highest power
+      {437, 1, 0}, // 6
+      {355, 2, 0}, // 7
+      {291, 3, 0}, // 8
+      {237, 4, 0}, // 9
+      {194, 5, 0}, // 10
+      {160, 6, 0}, // 11
+      {132, 7, 0}, // 12
+      {110, 8, 0}, // 13
+      {92, 9, 0}, // 14
+      {77, 10, 0}, // 15
+      {67, 11, 0}, // 16
+      {59, 12, 0}, // 17
+      {52, 13, 0}, // 18
+      {46, 14, 0}, // 19 Lowest power
+      {46, 14, 0}, // 20
+      {46, 14, 0}, // 21
+      {46, 14, 0}, // 22
+      {46, 14, 0}, // 23
+      {46, 14, 0}, // 24
+      {46, 14, 0}, // 25
+      {46, 14, 0}, // 26
+      {46, 14, 0}, // 27
+      {46, 14, 0}, // 28
+      {46, 14, 0}, // 29
+      {46, 14, 0}, // 30
+      {46, 14, 0}, // 31
+#else
+      { 616,  0,  0 }, // 0
+      { 616,  0,  0 }, // 1
+      { 616,  0,  0 }, // 2
+      { 616,  0,  0 }, // 3
+      { 616,  0,  0 }, // 4
+      { 616,  0,  0 }, // 5 Highest pwr
+      { 453,  1,  0 }, // 6
+      { 371,  2,  0 }, // 7
+      { 309,  3,  0 }, // 8
+      { 256,  3,  0 }, // 9
+      { 216,  5,  0 }, // 10
+      { 182,  6,  0 }, // 11
+      { 155,  7,  0 }, // 12
+      { 134,  8,  0 }, // 13
+      { 116,  9,  0 }, // 14
+      { 103, 10,  0 }, // 15
+      { 89, 11,  0 }, // 16
+      { 87, 12,  0 }, // 17
+      { 80, 13,  0 }, // 18
+      { 75, 14,  0 }, // 19  lowest pwr
+      { 75, 14,  0 }, // 20
+      { 75, 14,  0 }, // 21
+      { 75, 14,  0 }, // 22
+      { 75, 14,  0 }, // 23
+      { 75, 14,  0 }, // 24
+      { 75, 14,  0 }, // 25
+      { 75, 14,  0 }, // 26
+      { 75, 14,  0 }, // 27
+      { 75, 14,  0 }, // 28
+      { 75, 14,  0 }, // 29
+      { 75, 14,  0 }, // 30
+      { 75, 14,  0 }  // 31
+#endif
+    },
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 0
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {  554, 130 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 129 },
+        {  774, 131 },
+        {  808, 132 },
+        {  851, 134 },
+        {  870, 138 },
+        { 885, 140 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 2
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 3
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      }
+    },
+    { // gsm850 Power Ramp Values
+#if (PA == 3)  // Hitachi
+      {
+        {// Ramp-Up      #0 profile - Power Level 5
+          8,0,0,0,0,0,6,0,
+          0,6,18,29,23,21,17,0
+        },
+        {// Ramp-Down    #0 profile
+          0,12,19,31,31,18,17,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #1 profile - Power Level 6
+          0,0,3,3,1,4,0,3,
+          6,5,15,31,31,9,12,5
+        },
+        {// Ramp-Down    #1 profile
+          9,23,25,31,25,15,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #2 profile - Power Level 7
+          1,1,4,0,4,2,5,2,
+          4,2,12,19,31,18,15,8
+        },
+        {// Ramp-Down    #2 profile
+          9,30,31,31,16,11,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #3 profile - Power Level 8
+          2,1,3,2,4,5,4,4,
+          5,10,11,5,15,20,22,15
+        },
+        {// Ramp-Down    #3 profile
+          8,12,16,31,31,9,7,6,
+          3,3,2,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #4 profile - Power Level 9
+          0,4,3,1,0,4,0,2,
+          10,13,0,0,31,31,26,3
+        },
+        {// Ramp-Down    #4 profile
+          8,9,28,31,31,7,5,2,
+          7,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #5 profile - Power Level 10
+          0,0,0,5,0,3,4,6,
+          18,11,1,0,31,31,15,3
+        },
+        {// Ramp-Down    #5 profile
+          7,11,31,31,31,17,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #6 profile - Power Level 11
+          0,0,7,4,3,5,1,6,
+          2,17,5,1,15,27,25,10
+        },
+        {// Ramp-Down    #6 profile
+          6,14,27,31,29,7,4,3,
+          7,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #7 profile - Power Level 12
+          0,2,5,9,1,4,5,6,
+          9,14,8,1,31,19,10,4
+        },
+        {// Ramp-Down    #7 profile
+          9,5,31,31,31,5,5,6,
+          0,3,2,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #8 profile - Power Level 13
+          0,0,0,12,4,9,9,13,
+          11,10,9,3,18,12,11,7
+        },
+        {// Ramp-Down    #8 profile
+          8,9,28,31,27,8,5,4,
+          8,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #9 profile - Power Level 14
+          0,0,0,6,11,11,10,8,
+          7,5,5,5,19,29,12,0
+        },
+        {// Ramp-Down    #9 profile
+          8,18,31,31,31,9,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #10 profile - Power Level 15
+          0,0,0,0,0,0,9,31,
+          31,31,12,5,2,0,3,4
+        },
+        {// Ramp-Down    #10 profile
+          4,18,31,31,31,13,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #11 profile - Power Level 16
+          0,0,0,0,0,0,27,31,
+          31,31,3,0,1,2,0,2
+        },
+        {// Ramp-Down    #11 profile
+          3,9,30,31,31,24,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #12 profile - Power Level 17
+          0,0,0,0,0,5,31,31,
+          30,31,0,0,0,0,0,0
+        },
+        {// Ramp-Down    #12 profile
+          6,8,31,31,19,20,12,1,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #13 profile - Power Level 18
+          0,0,0,0,18,17,31,31,
+          17,14,0,0,0,0,0,0
+        },
+        {// Ramp-Down    #13 profile
+          3,7,29,31,31,27,0,0,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #14 profile - Power Level 19
+          0,0,0,9,12,15,30,31,          17,14,0,0,0,0,0,0
+        },
+        {// Ramp-Down    #14 profile
+          0,0,7,20,26,31,31,13,
+          0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #15 profile - Power Level 19
+          0,0,0,9,12,15,30,31,
+          17,14,0,0,0,0,0,0
+        },
+        {// Ramp-Down    #15 profile
+          0,0,7,20,26,31,31,13,
+          0,0,0,0,0,0,0,0
+        },
+      },
+    },
+#else
+{ { 0,0,0,25,0,0,7,0,0,18,31,31,16,0,0,0  },        // Ramp-Up       #0 profile - Power Level 5
+{   10,14,21,22,31,20,0,0,0,10,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,29,0,0,2,0,0,31,31,31,4,0,0  },        // Ramp-Up       #0 profile - Power Level 6
+{   0,9,31,31,31,26,0,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down  #0 profile
+{ { 0,0,0,0,0,0,31,6,0,0,29,31,31,0,0,0  },        // Ramp-Up        #0 profile - Power Level 7
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down     # profile
+{ { 0,0,0,10,0,25,0,0,0,11,31,31,20,0,0,0  },        // Ramp-Up       #0 profile - Power Level 8
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,0,0,0,0,22,0,0,13,31,31,31  },         // Ramp-Up       #0 profile - Power Level 9
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,31,0,0,0,0,0,0,25,0,23,25,24,0,0,0  },      // Ramp-Up       #0 profile - Power Level 10
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,30,0,0,0,0,0,0,31,0,16,31,20,0,0  },         // Ramp-Up       #0 profile - Power Level 11
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },       // Ramp-Down   #0 profile
+{ { 0,0,0,31,0,0,30,0,0,0,15,31,10,11,0,0  },         // Ramp-Up      #0 profile - Power Level 12
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down    #0 profile
+{ { 0,0,31,0,0,13,0,31,0,0,13,18,22,0,0,0  },        // Ramp-Up       #0 profile - Power Level 13
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 0,0,0,31,0,0,0,0,11,31,31,0,24,0,0,0  },         // Ramp-Up        #0 profile - Power Level 14
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 15,0,0,0,0,0,0,20,31,31,31,0,0,0,0,0  },        // Ramp-Up      #0 profile - Power Level 15
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down     #0 profile
+{ { 0,0,0,0,0,4,31,31,31,31,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 16
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,4,31,31,31,31,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 17
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,17,31,31,31,18,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 18
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },    // Ramp-Down    #0 profile
+{ { 0,0,0,0,31,31,31,31,4,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 19
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  } } },    // Ramp-Down    #0 profile
+#endif
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_GSM850,
+};
+
+//copy from dcs1800
+const T_RF_BAND rf_1900 =
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      188,      //g_magic
+       40,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- PCS band --*/
+     /*--------------*/
+      { 548,  0},     //
+      { 622,  0},     //
+      { 680,  0},     //
+      { 745,  0},     //
+      { 812,  0},     //
+      { 860,  0},     //
+      { 885,  0},     //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// pcs1900 T_LEVEL_TX
+#if (PA == 3)  // Hitachi
+      {915, 0, 0}, // 0 Highest power
+      {715, 1, 0}, // 1
+      {570, 2, 0}, // 2
+      {465, 3, 0}, // 3
+      {390, 4, 0}, // 4
+      {320, 5, 0}, // 5
+      {265, 6, 0}, // 6
+      {220, 7, 0}, // 7
+      {183, 8, 0}, // 8
+      {155, 9, 0}, // 9
+      {129, 10, 0}, // 10
+      {111, 11, 0}, // 11
+      {93, 12, 0}, // 12
+      {80, 13, 0}, // 13
+      {72, 14, 0}, // 14
+      {62, 15, 0}, // 15 Lowest power
+      {62, 15, 0}, // 16
+      {62, 15, 0}, // 17
+      {62, 15, 0}, // 18
+      {62, 15, 0}, // 19
+      {62, 15, 0}, // 20
+      {62, 15, 0}, // 21
+      {62, 15, 0}, // 22
+      {62, 15, 0}, // 23
+      {62, 15, 0}, // 24
+      {62, 15, 0}, // 25
+      {62, 15, 0}, // 26
+      {62, 15, 0}, // 27
+      {62, 15, 0}, // 28
+      {915, 0, 0}, // 29 Highest power
+      {915, 0, 0}, // 30 Highest power
+      {915, 0, 0}, // 31 Highest power
+#else
+      { 949, 0, 0  }, // 0 Highest power
+      { 615, 1, 0  }, // 1
+      { 499, 2, 0  }, // 2
+      { 404, 3, 0  }, // 3
+      { 328, 4, 0  }, // 4
+      { 270, 5, 0  }, // 5
+      { 224, 6, 0  }, // 6
+      { 187, 7, 0  }, // 7
+      { 158, 8, 0  }, // 8
+      { 137, 9, 0  }, // 9
+      { 119, 10, 0  }, // 10
+      { 105, 11, 0  }, // 11
+      { 92, 12, 0  }, // 12
+      { 81, 13, 0  }, // 13
+      { 75, 14, 0  }, // 14
+      { 70, 15, 0  }, // 15 Lowest power
+      { 70, 15, 0  }, // 16
+      { 70, 15, 0  }, // 17
+      { 70, 15, 0  }, // 18
+      { 70, 15, 0  }, // 19
+      { 70, 15, 0  }, // 20
+      { 70, 15, 0  }, // 21
+      { 70, 15, 0  }, // 22
+      { 70, 15, 0  }, // 23
+      { 70, 15, 0  }, // 24
+      { 70, 15, 0  }, // 25
+      { 70, 15, 0  }, // 26
+      { 70, 15, 0  }, // 27
+      { 70, 15, 0  }, // 28
+      { 754, 0, 0  }, // 29 Highest power
+      { 754, 0, 0  }, // 30 Highest power
+      { 754, 0, 0  }, // 31 Highest power
+#endif
+    },
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 0
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {
+        {  554, 128 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 2
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 3
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      }
+    },
+    { // PCS Power Ramp Values
+#if (PA == 3)  // Hitachi
+     {
+	    {// Ramp-Up      #0 profile - Power Level 0
+          0,0,0,0,6,2,0,1,
+          5,4,12,31,31,25,10,1
+      },
+      {// Ramp-Down    #0 profile
+        8,11,18,31,31,17,12,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 1
+        0,0,0,0,7,6,1,3,
+        4,0,2,15,31,31,24,4
+      },
+      {// Ramp-Down    #1 profile
+        8,25,31,19,19,20,6,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 2
+        0,0,0,0,8,6,0,2,
+        4,6,3,17,31,31,18,2
+      },
+      {// Ramp-Down    #2 profile
+        4,10,31,29,31,23,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 3
+        0,0,0,0,3,4,10,4,
+        2,0,2,13,31,31,26,2
+      },
+      {// Ramp-Down    #3 profile
+        6,24,22,20,27,20,9,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 4
+        0,0,0,8,0,6,7,9,
+        2,0,7,7,31,31,19,1
+      },
+      {// Ramp-Down    #4 profile
+        3,14,28,31,31,12,9,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 5
+        0,0,0,1,12,0,4,4,
+        4,9,6,12,31,27,17,1
+      },
+      {// Ramp-Down    #5 profile
+        3,18,31,31,11,26,4,4,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 6
+        0,0,0,3,8,7,2,7,
+        1,4,22,5,29,26,12,2
+      },
+      {// Ramp-Down    #6 profile
+        4,20,21,31,31,21,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 7
+        0,0,0,4,8,2,7,7,
+        5,7,6,6,31,31,14,0
+      },
+      {// Ramp-Down    #7 profile
+        3,13,31,31,31,19,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 8
+        0,0,0,6,2,8,3,5,
+        16,3,9,25,6,31,14,0
+      },
+      {// Ramp-Down    #8 profile
+        5,13,29,31,31,19,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 9
+        0,0,0,7,2,0,8,12,
+        17,3,31,9,3,27,8,1
+      },
+      {// Ramp-Down    #9 profile
+        1,17,22,31,31,26,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 10
+        0,0,0,6,2,3,6,8,
+        12,31,14,18,15,11,2,0
+      },
+      {// Ramp-Down    #10 profile
+        3,8,27,21,31,31,7,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 11
+        0,0,0,3,3,4,2,28,
+        12,31,31,7,3,3,1,0
+      },
+      {// Ramp-Down    #11 profile
+        3,12,26,20,31,31,5,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 12
+        0,0,0,1,4,9,31,30,
+        26,20,7,0,0,0,0,0
+      },
+      {// Ramp-Down    #12 profile
+        2,4,29,31,31,31,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 13
+        0,0,0,0,8,30,28,31,
+        16,11,4,0,0,0,0,0
+      },
+      {// Ramp-Down    #13 profile
+        2,4,31,31,31,29,0,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 14
+        0,0,0,6,26,28,30,25,
+        13,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #14 profile
+        0,6,18,31,31,31,11,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 15
+        0,0,24,22,21,20,21,14,
+        6,0,0,0,0,0,0,0
+      },
+      {// Ramp-Down    #15 profile
+        0,0,22,31,24,30,21,0,
+        0,0,0,0,0,0,0,0
+      },
+     },
+    },
+#else
+{ { 0,0,13,0,0,0,5,0,0,13,24,31,31,11,0,0  },           // Ramp-Up       #0 profile - Power Level 0
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,21,0,0,0,0,0,11,30,31,25,10,0,0  },           // Ramp-Up       #0 profile - Power Level 1
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,0,6,20,0,0,0,0,31,31,30,10,0,0  },        // Ramp-Up       #0 profile - Power Level 2
+{   0,31,27,28,24,18,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,30,0,0,0,0,0,0,16,30,31,21,0,0  },         // Ramp-Up       #0 profile - Power Level 3
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },       // Ramp-Down   #0 profile
+{ { 0,0,0,0,31,0,0,0,0,12,31,30,24,0,0,0  },        // Ramp-Up       #0 profile - Power Level 4
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,31,0,0,0,0,0,0,31,31,31,4,0,0  },         // Ramp-Up       #0 profile - Power Level 5
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },      // Ramp-Down   #0 profile
+{ { 0,0,0,6,31,0,0,0,0,0,25,31,31,4,0,0  },       // Ramp-Up       #0 profile - Power Level 6
+{   0,31,31,31,31,4,0,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,19,31,0,0,0,0,12,31,31,4,0,0  },        // Ramp-Up       #0 profile - Power Level 7
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,20,31,0,0,0,0,0,11,31,31,4,0,0  },        // Ramp-Up       #0 profile - Power Level 8
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,21,31,0,0,0,0,0,14,31,31,0,0,0  },        // Ramp-Up       #0 profile - Power Level 9
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,27,31,0,0,0,16,18,0,31,5,0,0  },        // Ramp-Up       #0 profile - Power Level 10
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,31,0,0,0,31,31,0,31,4,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 11
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,0,16,27,31,31,23,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 12
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,16,31,25,31,25,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 13
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,31,31,31,31,4,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 14
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, },     // Ramp-Down   #0 profile
+{ { 0,0,0,0,31,31,31,31,4,0,0,0,0,0,0,0  },        // Ramp-Up       #0 profile - Power Level 15
+{   0,0,31,31,31,31,4,0,0,0,0,0,0,0,0,0  }, }, },     // Ramp-Down   #0 profile
+#endif
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+    #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_PCS
+};
+
+/*------------------------------------------*/
+/* ABB Initialization words
+/*------------------------------------------*/
+#if (ANALOG == 1)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,  // Value at reset
+    C_VBUR,       // Uplink gain amp 0dB, Sidetone gain to mute
+    C_VBDR,       // Downlink gain amp 0dB, Volume control 0 dB
+    C_BBCTL,      // value at reset
+    C_APCOFF,     // value at reset
+    C_BULIOFF,    // value at reset
+    C_BULQOFF,    // value at reset
+    C_DAI_ON_OFF, // value at reset
+    C_AUXDAC,     // value at reset
+    C_VBCR,       // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    C_APCDEL      // value at reset
+};
+#elif (ANALOG == 2)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,
+    C_VBUR,
+    C_VBDR,
+    C_BBCTL,
+    C_BULGCAL,
+    C_APCOFF,
+    C_BULIOFF,
+    C_BULQOFF,
+    C_DAI_ON_OFF,
+    C_AUXDAC,
+    C_VBCR,
+    C_VBCR2,
+    C_APCDEL,
+    C_APCDEL2
+  };
+
+#elif (ANALOG == 3)
+  UWORD16 abb[ABB_TABLE_SIZE] =
+  {
+    C_AFCCTLADD,
+    C_VBUR,
+    C_VBDR,
+    C_BBCTL,
+    C_BULGCAL,
+    C_APCOFF,
+    C_BULIOFF,
+    C_BULQOFF,
+    C_DAI_ON_OFF,
+    C_AUXDAC,
+    C_VBCR,
+    C_VBCR2,
+    C_APCDEL,
+    C_APCDEL2,
+    C_VBPOP,
+    C_VAUDINITD,
+    C_VAUDCR,
+    C_VAUOCR,
+    C_VAUSCR,
+    C_VAUDPLL
+  };
+
+#endif
+
+/*------------------------------------------*/
+/*             Gain table                   */
+/*  specified in the TRF6053 spec           */
+/*     2 dB steps - LNA always ON       */
+/*------------------------------------------*/
+UWORD16 AGC_TABLE[AGC_TABLE_SIZE] =
+{
+  0x00,  //reserved
+  0x01,  //reserved
+  0x02,  //reserved
+  0x03,  //reserved
+  0x04,  //reserved
+  0x05,  //reserved
+  0x06,  //14 dB
+  0x07,  //16
+  0x08,  //18
+  0x09,  //20
+  0x0a,  //22
+  0x0b,  //24
+  0x0c,  //26
+  0x0d,  //28
+  0x0e,  //30
+  0x0f,  //32
+  0x10,  //34
+  0x11,  //36
+  0x12,  //38
+  0x13,  //40
+  /*
+  0x14,  //reserved
+  0x15,  //reserved
+  0x16,  //reserved
+  0x17,  //reserved
+  0x18,  //reserved
+  0x19,  //reserved
+  0x1a,  //reserved
+  0x1b,  //reserved
+  0x1c,  //reserved
+  0x1d,  //reserved
+  0x1e,  //reserved
+  0x1f,  //reserved
+  */
+};
+
+// structure for ADC conversion (4 Internal channel + 5 Ext channels max.)
+T_ADC adc;
+
+// MADC calibration structure
+T_ADCCAL adc_cal=
+{ // a: 0,..,8
+  // b, 0,..,8
+  // cal_a = 4*1750 is the Typical value 1.75 V ref voltage , divide by 4
+  7000, 8750, 7000, 7000, 7000, 7000, 7000, 256, 7000,
+     0,    0,    0,    0,    0,    0,   0,    0,    0
+};
+
+#if (BOARD == 41)
+// table which converts ADC value into RF temperature
+T_TEMP temperature[TEMP_TABLE_SIZE] =
+{
+// Temperature compensation for EVARITA - S.Glock, J.Demay 04/23/2003
+  582, -40,
+  640, -10,
+  698, 25,
+  756, 60,
+  815, 90
+};
+#else
+// table which converts ADC value into RF temperature
+T_TEMP temperature[TEMP_TABLE_SIZE] =
+{
+  7, -35,
+  7, -34,
+  8, -33,
+  8, -32,
+  9, -31,
+  9, -30,
+  10, -29,
+  11, -28,
+  11, -27,
+  12, -26,
+  13, -25,
+  14, -24,
+  14, -23,
+  15, -22,
+  16, -21,
+  17, -20,
+  18, -19,
+  19, -18,
+  21, -17,
+  22, -16,
+  23, -15,
+  24, -14,
+  26, -13,
+  27, -12,
+  29, -11,
+  30, -10,
+  32, -9,
+  34, -8,
+  36, -7,
+  37, -6,
+  39, -5,
+  41, -4,
+  44, -3,
+  46, -2,
+  48, -1,
+  51, 0,
+  53, 1,
+  56, 2,
+  59, 3,
+  61, 4,
+  64, 5,
+  68, 6,
+  71, 7,
+  74, 8,
+  78, 9,
+  81, 10,
+  85, 11,
+  89, 12,
+  93, 13,
+  97, 14,
+  101, 15,
+  105, 16,
+  110, 17,
+  115, 18,
+  119, 19,
+  124, 20,
+  130, 21,
+  135, 22,
+  140, 23,
+  146, 24,
+  152, 25,
+  158, 26,
+  164, 27,
+  170, 28,
+  176, 29,
+  183, 30,
+  190, 31,
+  197, 32,
+  204, 33,
+  211, 34,
+  219, 35,
+  226, 36,
+  234, 37,
+  242, 38,
+  250, 39,
+  259, 40,
+  267, 41,
+  276, 42,
+  285, 43,
+  294, 44,
+  303, 45,
+  312, 46,
+  322, 47,
+  331, 48,
+  341, 49,
+  351, 50,
+  361, 51,
+  371, 52,
+  382, 53,
+  392, 54,
+  403, 55,
+  413, 56,
+  424, 57,
+  435, 58,
+  446, 59,
+  458, 60,
+  469, 61,
+  480, 62,
+  492, 63,
+  503, 64,
+  515, 65,
+  527, 66,
+  539, 67,
+  550, 68,
+  562, 69,
+  574, 70,
+  586, 71,
+  598, 72,
+  611, 73,
+  623, 74,
+  635, 75,
+  647, 76,
+  659, 77,
+  671, 78,
+  683, 79,
+  696, 80,
+  708, 81,
+  720, 82,
+  732, 83,
+  744, 84,
+  756, 85,
+  768, 86,
+  780, 87,
+  792, 88,
+  804, 89,
+  816, 90,
+  827, 91,
+  839, 92,
+  851, 93,
+  862, 94,
+  873, 95
+};
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust0/mv100/l1_rf12.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,605 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename l1_rf12.h
+ *        Version  1.9
+ *        Date     03/21/03
+ *
+ ************* Revision Controle System Header *************/
+
+#if (OP_L1_STANDALONE == 1)
+  // Define the correct enumeration of PA. Consult tpudrv12.h for the enumeration.
+  #if ((BOARD == 40) || (BOARD == 41) || (BOARD == 45)) // EvaRita + D-sample or EvaConso
+    #define PA 3
+  #else
+    #define PA 0
+  #endif
+#else
+#include "rf.cfg"
+//#define PA 3
+#endif
+
+#ifndef PA
+  #error PA not defined.
+#endif
+
+#define RF_RITA_10 0x2030 // Check with TIDK
+
+//#define RF_HW_BAND_EGSM
+//#define RF_HW_BAND_DCS
+#define RF_HW_BAND_PCS 0x4
+#define RF_HW_BAND_DUAL_US  0x80
+#define RF_HW_BAND_DUAL_EXT 0x20
+
+//#define RF_HW_BAND_SUPPORT (0x0020 | RF_HW_BAND_PCS)  // radio_band_support E-GSM/DCS + PCS
+// radio_band_support E-GSM/DCS + GSM850/PCS
+#define RF_HW_BAND_SUPPORT (RF_HW_BAND_DUAL_EXT | RF_HW_BAND_DUAL_US)
+
+/************************************/
+/* SYNTHESIZER setup time...        */
+/************************************/
+#define RX_SYNTH_SETUP_TIME (PROVISION_TIME - TRF_R1)//RX Synthesizer setup time in qbit.
+#define TX_SYNTH_SETUP_TIME (- TRF_T1)               //TX Synthesizer setup time in qbit.
+
+/************************************/
+/* time for TPU scenario ending...  */
+/************************************/
+//
+// The following values are used to take into account any TPU activity AFTER
+// BDLON (or BDLENA) down (for RX) and BULON down (for TX)
+// - If there are no TPU commands after BDLON (or BDLENA) down and BULON down,
+//   these defines must be ZERO
+// - If there IS some TPU command after BDLON (or BDLENA) and BULON down,
+//   these defines must be equal to the time difference (in qbits) between
+//   the BDLON (or BDLENA) or BULON time and the last TPU command on
+//   the TPU scenario
+#define RX_TPU_SCENARIO_ENDING  0   // execution time of AFTER BDLENA down
+#define TX_TPU_SCENARIO_ENDING  0   // execution time of AFTER BULON down
+
+ 
+/******************************************************/
+/* TXPWR configuration...                             */
+/* Fixed TXPWR value when GSM management is disabled. */
+/******************************************************/
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+//  #define FIXED_TXPWR       0x3f12  // TXPWR=10, value=252
+//#define FIXED_TXPWR       0x1952
+  #define FIXED_TXPWR       0x1d12  // TXPWR=15
+#endif
+
+
+/************************************/
+/* ANALOG delay (in qbits)          */
+/************************************/
+#define  DL_DELAY_RF      1   // time spent in the Downlink global RF chain by the modulated signal
+#if (PA == 3)  // Hitachi
+#define  UL_DELAY_1RF     5   // time spent in the first  uplink RF block
+#else
+#define  UL_DELAY_1RF     7   // time spent in the first  uplink RF block
+#endif
+#define  UL_DELAY_2RF     0   // time spent in the second uplink RF block
+#if (ANALOG == 1)
+  #define  UL_ABB_DELAY   6   // modulator input to output delay
+#endif
+#if ((ANALOG == 2) || (ANALOG == 3))
+  #define  UL_ABB_DELAY   3   // modulator input to output delay
+#endif
+
+/************************************/
+/* TX Propagation delay...          */
+/************************************/
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+  #define  PRG_TX       (DL_DELAY_RF + UL_DELAY_2RF + (GUARD_BITS*4) + UL_DELAY_1RF + UL_ABB_DELAY)   // = 40
+#endif
+
+/************************************/
+/* Initial value for APC DELAY      */
+/************************************/
+#if (ANALOG == 1)
+//#define APCDEL_DOWN     (32 - GUARD_BITS*4)          // minimum value: 2
+  #define APCDEL_DOWN      2                           // minimum value: 2
+  #define APCDEL_UP       (6+5)                        // minimum value: 6
+#endif
+#if (ANALOG == 2) || (ANALOG == 3)
+//#define APCDEL_DOWN     (32 - GUARD_BITS*4)          // minimum value: 2
+  #define APCDEL_DOWN     (2+0)                        // minimum value: 2
+#if (PA == 3)  // Hitachi
+#define APCDEL_UP       (6+1)                        // minimum value: 6
+#else
+  #define APCDEL_UP       (6+3+1)                        // minimum value: 6
+#endif
+                               // REMOVE // Jerome Modif for ARF7: (6+3) instead of (6+8)
+#endif
+
+#define GUARD_BITS 7
+
+/************************************/
+/* Initial value for AFC...         */
+/************************************/
+#define  EEPROM_AFC    ((150)*8)      // F13.3 required!!!!! (default : -952*8, initial deviation of -2400 forced)
+
+#define  SETUP_AFC_AND_RF     6       // AFC converges in 2 frames and RF BAND GAP stable after 4 frames
+                               // Rita (RF=12) LDO wakeup requires 6 frames
+
+/************************************/
+/* Baseband registers               */
+/************************************/
+#if (ANALOG == 1)  // Omega registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0000          // Enable f_tx delay of 400000 cyc DEBUG
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x418e | TRUE   // Uplink gain amp 0dB, Sidetone gain to mute
+  #define  C_VBDR            0x098c | TRUE   // Downlink gain amp 0dB, Volume control 0 dB
+  // RITA does not need an APCOFFSET because the PACTRL is internal:
+  // REMOVE //#define  C_APCOFF          0x1016 | (0x3c << 6) | TRUE   // value at reset-Changed from 0x0016- CR 27.12
+#if (PA == 3)  // Hitachi
+  #define  C_APCOFF          0x1016 | (0x0 << 6) | TRUE
+#else
+  #define  C_APCOFF          0x1016 | (0x30 << 6) | TRUE
+#endif
+  #define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          0x0018 | TRUE   // value at reset
+  #define  C_VBCR            0x02d0 | TRUE   // VULSWITCH=1, VDLAUX=1, VDLEAR=1
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004)
+  #define  C_BBCTL           0x604c | TRUE   // OUTLEV1=OUTLEV1=SELVMID1=SELVMID0=1 for B-sample 'modified'
+#endif
+#if (ANALOG ==2)
+  // IOTA registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0001          // Enable f_tx delay of 400000 cyc DEBUG
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x418e | TRUE   // No uplink mute, Side tone mute, PGA_UL 0dB
+  #define  C_VBDR            0x098c | TRUE   // PGA_DL 0dB, Volume 0dB
+  // RITA does not need an APCOFFSET because the PACTRL is internal:
+  // REMOVE //#define  C_APCOFF          0x1016 | (0x3c << 6) | TRUE   // x2 slope 128
+#if (PA == 3)  // Hitachi
+  #define  C_APCOFF          0x1016 | (0x0 << 6) | TRUE   // x2 slope 128
+#else
+  #define  C_APCOFF          0x1016 | (0x30 << 6) | TRUE   // x2 slope 128
+#endif
+  #define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          0x0018 | TRUE   // value at reset
+  #define  C_VBCR            0x02d0 | TRUE   // VULSWITCH=1, VDLAUX=1, VDLEAR=1
+  #define  C_VBCR2           0x0016 | TRUE   // MICBIASEL=0, VDLHSO=0, MICAUX=0
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004)
+  #define  C_APCDEL2         0x0034
+  #define  C_BBCTL           0xB04c | TRUE   // Extenal DL calibration, Output common mode=1.35V
+                                             // Monoslot, Vpp=8/15*Vref
+  #define  C_BULGCAL         0x001c | TRUE   // IAG=0 dB, QAG=0 dB
+#endif
+
+#if (ANALOG == 3)
+  // SYREN registers values will be programmed at 1st DSP communication interrupt
+  #define  C_DEBUG1          0x0001          // Enable f_tx delay of 400000 cyc DEBUG
+  #define  C_AFCCTLADD       0x002a | TRUE   // Value at reset
+  #define  C_VBUR            0x1E6<<6 | VBUCTRL | TRUE   //  Side tone mute, PGA_UL 0dB
+  #define  C_VBDR            0x026<<6 | VBDCTRL | TRUE   // PGA_DL 0dB, Volume 0dB
+#if (PA == 3)  // Hitachi
+  #define  C_APCOFF          0x1016 | (0x0 << 6) | TRUE   // x2 slope 128
+#else
+  #define  C_APCOFF          0x1016 | (0x30 << 6) | TRUE   // x2 slope 128
+#endif
+#define  C_BULIOFF         0x3fc4 | TRUE   // value at reset
+  #define  C_BULQOFF         0x3fc6 | TRUE   // value at reset
+  #define  C_DAI_ON_OFF      0x0000          // value at reset
+  #define  C_AUXDAC          (0x00<<6) | 0x18 | TRUE   // value at reset
+  #define  C_VBCR            (0x108<<6) | 0x10 | TRUE   // VULSWITCH=1 AUXI 28,2 dB
+  #define  C_VBCR2           (0x01<<6) | 0x16 | TRUE   // HSMIC on, SPKG gain @ 2,5dB
+  // BULRUDEL will be initialized on rach only ....
+  #define  C_APCDEL          (((APCDEL_DOWN-2)<<11) | ((APCDEL_UP-6)<<6) | 0x0004)
+  #define  C_APCDEL2         0x0034
+  #define  C_BBCTL           0xB04c | TRUE   // Internal autocalibration, Output common mode=1.35V
+                                             // Monoslot, Vpp=8/15*Vref
+  #define  C_BULGCAL         0x001c | TRUE   // IAG=0 dB, QAG=0 dB
+
+  #define  C_VBPOP           (0x4)<<6 | 0x14 | TRUE     // HSOAUTO enabled only
+  #define  C_VAUDINITD       2                          // vaud_init_delay init 2 frames
+  #define  C_VAUDCR          (0x0)<<6   | 0x1e | TRUE   // Init to zero
+  #define  C_VAUOCR          (0x155)<<6 | VAUOCTRL | TRUE   // Speech on all outputs
+  #define  C_VAUSCR          (0x0)<<6   | 0x20 | TRUE   // Init to zero
+  #define  C_VAUDPLL         (0x0)<<6   | 0x24 | TRUE   // Init to zero
+
+#endif
+
+
+/************************************/
+/* Automatic frequency compensation */
+/************************************/
+/********************* C_Psi_sta definition *****************************/
+/* C_Psi_sta = (2*pi*Fr)        / (N * Fb)                              */
+/*      (1)  = (2*pi*V*ppm*0.9) / (N*V*Fb)                              */
+/*           regarding Vega V/N   = 2.4/4096                            */
+/*           regarding VCO  ppm/V = 16 / 1   (average slope of the VCO) */
+/*      (1)  = (2*pi*2.4*16*0.9) / (4096*1*270.83)                      */
+/*           = 0.000195748                                              */
+/* C_Psi_sta_inv = 1/C_Psi_sta = 5108                                   */
+/************************************************************************/
+#define  C_Psi_sta_inv    12902L    // (1/C_Psi_sta)
+#define  C_Psi_st         4L        // C_Psi_sta * 0.8 F0.16
+#define  C_Psi_st_32      266313L  // F0.32
+#define  C_Psi_st_inv     16128L   // (1/C_Psi_st)
+
+#if (VCXO_ALGO == 1)
+// Linearity parameters
+  #define  C_AFC_DAC_CENTER     ((-1242)*8)
+  #define  C_AFC_DAC_MIN        ((-2000)*8)
+  #define  C_AFC_DAC_MAX        ((1419)*8)
+
+  #define  C_AFC_SNR_THR        2560     //  1/0.4    * 2**10
+#endif
+
+typedef struct
+{
+  WORD16  eeprom_afc;
+  UWORD32 psi_sta_inv;
+  UWORD32 psi_st;
+  UWORD32 psi_st_32;
+  UWORD32 psi_st_inv;
+
+  #if (VCXO_ALGO)
+  // VCXO adjustment parameters
+  // Parameters used when assuming linearity
+  WORD16  dac_center;
+  WORD16  dac_min;
+  WORD16  dac_max;
+    WORD16  snr_thr;
+  #endif
+}
+T_AFC_PARAMS;
+
+/************************************/
+/* Swap IQ definitions...           */
+/************************************/
+/* 0=No Swap, 1=Swap RX only, 2=Swap TX only, 3=Swap RX and TX */
+#if RF_PG==10
+    // PG 1.0 -> 1 (Swap RX only)
+    // GSM 850 => TX is ALWAYS swapped compared to GSM 900
+    #define  SWAP_IQ_GSM    1
+    #define  SWAP_IQ_DCS    1
+    #define  SWAP_IQ_PCS    1
+    #define  SWAP_IQ_GSM850 3   // Swap TX compared to GSM 900
+#else
+    // All PG versions ABOVE 1.0 -> 0 (No Swap)
+    // GSM 850 => TX is ALWAYS swapped compared to GSM 900
+    #define  SWAP_IQ_GSM    0
+    #define  SWAP_IQ_DCS    0
+    #define  SWAP_IQ_PCS    0
+    #define  SWAP_IQ_GSM850 2   // Swap TX compared to GSM 900
+#endif
+
+/************************************/
+/************************************/
+// typedef
+/************************************/
+/************************************/
+
+/*************************************************************/
+/* Define structure for apc of TX Power                 ******/
+/*************************************************************/
+typedef struct
+{ // pcm-file "rf/tx/level.gsm|dcs"
+  UWORD16 apc;            // 0..31
+  UWORD8  ramp_index;     // 0..RF_TX_RAMP_SIZE
+  UWORD8  chan_cal_index; // 0..RF_TX_CHAN_CAL_TABLE_SIZE
+}
+T_TX_LEVEL;
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+/* Define structure for sub-band definition of TX Power ******/
+typedef struct
+   {
+   UWORD16  upper_bound;    //highest physical arfcn of the sub-band
+   WORD16    agc_calib;      // AGC  for each TXPWR
+   }T_RF_AGC_BAND;
+
+/************************************/
+/*       Ramp definitions           */
+/************************************/
+#if ((ANALOG == 1) || (ANALOG == 2) || (ANALOG == 3))
+  typedef struct
+  {
+    UWORD8  ramp_up     [16];  // Ramp-up profile
+    UWORD8  ramp_down   [16];  // Ramp-down profile
+  }
+  T_TX_RAMP;
+#endif
+
+
+// RF structure definition
+//========================
+
+// Number of bands supported
+#define GSM_BANDS 2
+
+#define MULTI_BAND1     0
+#define MULTI_BAND2     1
+// RF table sizes
+#define RF_RX_CAL_CHAN_SIZE 10 // number of AGC sub-bands
+#define RF_RX_CAL_TEMP_SIZE 11 // number of temperature ranges
+
+#define RF_TX_CHAN_CAL_TABLE_SIZE  4 // channel calibration table size
+#define RF_TX_NUM_SUB_BANDS        8 // number of sub-bands in channel calibration table
+#define RF_TX_LEVELS_TABLE_SIZE   32 // level table size
+#define RF_TX_RAMP_SIZE           16 // number of ramp definitions
+#define RF_TX_CAL_TEMP_SIZE        5 // number of temperature ranges
+
+#define AGC_TABLE_SIZE            20
+#define MIN_AGC_INDEX              6
+
+#define TEMP_TABLE_SIZE          131 // number of elements in ADC->temp conversion table
+
+
+// RX parameters and tables
+//-------------------------
+
+// AGC parameters and tables
+typedef struct
+{
+  UWORD16 low_agc_noise_thr;
+  UWORD16 high_agc_sat_thr;
+  UWORD16 low_agc;
+  UWORD16 high_agc;
+  UWORD8  il2agc_pwr[121];
+  UWORD8  il2agc_max[121];
+  UWORD8  il2agc_av[121];
+}
+T_AGC;
+
+// Calibration parameters
+typedef struct
+{
+  UWORD16 g_magic;
+  UWORD16 lna_att;
+  UWORD16 lna_switch_thr_low;
+  UWORD16 lna_switch_thr_high;
+}
+T_RX_CAL_PARAMS;
+
+// RX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  WORD16 agc_calib;
+}
+T_RX_TEMP_COMP;
+
+// RF RX structure
+typedef struct
+{
+  T_AGC              agc;
+}
+T_RF_RX; //common
+
+// RF RX structure
+typedef struct
+{
+  T_RX_CAL_PARAMS rx_cal_params;
+  T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+  T_RX_TEMP_COMP  temp[RF_RX_CAL_TEMP_SIZE];
+}
+T_RF_RX_BAND;
+
+
+// TX parameters and tables
+//-------------------------
+
+// TX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  #if (ORDER2_TX_TEMP_CAL==1)
+  WORD16 a;
+  WORD16 b;
+  WORD16 c;
+  #else
+  WORD16 apc_calib;
+  #endif
+}
+T_TX_TEMP_CAL;
+
+// Ramp up and ramp down delay
+typedef struct
+{
+  UWORD16 up;
+  UWORD16 down;
+}
+T_RAMP_DELAY;
+
+typedef struct
+{
+  UWORD16 arfcn_limit;
+  WORD16  chan_cal;
+}
+T_TX_CHAN_CAL;
+
+// RF TX structure
+typedef struct
+{
+  T_RAMP_DELAY   ramp_delay;
+  UWORD8         guard_bits;  // number of guard bits needed for ramp up
+  UWORD8         prg_tx;
+}
+T_RF_TX; //common
+
+// RF TX structure
+typedef struct
+{
+  T_TX_LEVEL           levels[RF_TX_LEVELS_TABLE_SIZE];
+  T_TX_CHAN_CAL        chan_cal_table[RF_TX_CHAN_CAL_TABLE_SIZE][RF_TX_NUM_SUB_BANDS];
+  T_TX_RAMP            ramp_tables[RF_TX_RAMP_SIZE];
+  T_TX_TEMP_CAL        temp[RF_TX_CAL_TEMP_SIZE];
+}
+T_RF_TX_BAND;
+
+// band structure
+typedef struct
+{
+  T_RF_RX_BAND  rx;
+  T_RF_TX_BAND  tx;
+  UWORD8        swap_iq;
+}
+T_RF_BAND;
+
+// RF structure
+typedef struct
+{
+  // common for all bands
+  UWORD16      rf_revision;
+  UWORD16      radio_band_support;
+  T_RF_RX      rx;
+  T_RF_TX      tx;
+  T_AFC_PARAMS afc;
+}
+T_RF;
+
+/************************************/
+/*       MADC definitions           */
+/************************************/
+// Omega: 5 external channels if touch screen not used, 3 otherwise
+enum ADC_INDEX {
+   ADC_VBAT,
+   ADC_VCHARG,
+   ADC_ICHARG,
+   ADC_VBACKUP,
+   ADC_BATTYP,
+   ADC_BATTEMP,
+   ADC_ADC3,     // name of this ??
+   ADC_RFTEMP,
+   ADC_ADC4,
+   ADC_INDEX_END // ADC_INDEX_END must be the end of the enums
+};
+
+typedef struct
+{
+    WORD16 converted[ADC_INDEX_END]; // converted
+    UWORD16 raw[ADC_INDEX_END];       // raw from ADC
+}
+T_ADC;
+
+/************************************/
+/*       MADC calibration           */
+/************************************/
+typedef struct
+{
+   UWORD16 a[ADC_INDEX_END];
+   WORD16 b[ADC_INDEX_END];
+}
+T_ADCCAL;
+
+// Conversion table: ADC value -> temperature
+typedef struct
+{
+    UWORD16 adc;  // ADC reading is 10 bits
+    WORD16  temp; // temp is in approx. range -30..+80
+}
+T_TEMP;
+
+typedef struct
+{
+    char *name;
+    void *addr;
+    int  size;
+}
+T_CONFIG_FILE;
+
+typedef struct
+{
+  char      *name;         // name of ffs file suffix
+  T_RF_BAND *addr;         // address to default flash structure
+  UWORD16   max_carrier;  // max carrier
+  UWORD16   max_txpwr;    // max tx power
+}
+T_BAND_CONFIG;
+
+typedef struct
+{
+  UWORD8  band[GSM_BANDS]; // index to band address
+  UWORD8  txpwr_tp; // tx power turning point
+  UWORD16 first_arfcn;  // first index
+}
+T_STD_CONFIG;
+enum GSMBAND_DEF
+{
+  BAND_NONE,
+  BAND_EGSM900,
+  BAND_DCS1800,
+  BAND_PCS1900,
+  BAND_GSM850,
+  // put new bands here
+  BAND_GSM900  //last entry
+};
+
+/************************************/
+/* ABB (Omega) Initialization       */
+/************************************/
+
+#if ((ANALOG == 1) || (ANALOG == 2))
+  #define ABB_TABLE_SIZE 16
+#elif (ANALOG == 3)
+  #define ABB_TABLE_SIZE 22
+#endif
+
+// Note that this translation is probably not needed at all. But until L1 is
+// (maybe) changed to simply initialize the ABB from a table of words, we
+// use this to make things more easy-readable.
+#if (ANALOG == 1)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_APCDEL
+  };
+#elif (ANALOG == 2)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_BULGCAL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_VBCR2,
+    ABB_APCDEL,
+    ABB_APCDEL2
+  };
+#elif (ANALOG == 3)
+  enum ABB_REGISTERS {
+    ABB_AFCCTLADD = 0,
+    ABB_VBUR,
+    ABB_VBDR,
+    ABB_BBCTL,
+    ABB_BULGCAL,
+    ABB_APCOFF,
+    ABB_BULIOFF,
+    ABB_BULQOFF,
+    ABB_DAI_ON_OFF,
+    ABB_AUXDAC,
+    ABB_VBCR,
+    ABB_VBCR2,
+    ABB_APCDEL,
+    ABB_APCDEL2,
+    ABB_VBPOP,
+    ABB_VAUDINITD,
+    ABB_VAUDCR,
+    ABB_VAUOCR,
+    ABB_VAUSCR,
+    ABB_VAUDPLL
+  };
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust1/ind_os.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,174 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ * IND_OS.C
+ *
+ *        Filename ind_os.c
+ *        Version  1.1
+ *        Date     04/26/00
+ *
+ ************* Revision Controle System Header *************/
+
+
+// Nucleus include files.
+#include "nucleus.h"
+#include "tc_defs.h"
+#include "sys_types.h"
+#include "ind_os.h"
+
+#include "l1_confg.h"
+// Layer1 and debug include files.
+#include "l1_types.h"
+#include "l1_const.h"
+
+#if (L1_GTT == 1)
+  #include "l1gtt_const.h"
+  #include "l1gtt_defty.h"
+#endif
+
+#if (L1_MP3 == 1)
+  #include "l1mp3_defty.h"
+#endif
+
+#if (L1_MIDI == 1)
+  #include "l1midi_defty.h"
+#endif
+
+//#if ((ANALOG == 1) || (ANALOG == 2))
+//  #include "spi_drv.h"
+//#endif
+
+#if TESTMODE
+  #include "l1tm_defty.h"
+#endif
+
+#include "l1audio_const.h"
+#include "l1audio_cust.h"
+#include "l1audio_defty.h"
+#if (L1_MP3 == 1)
+  #include "l1mp3_defty.h"
+#endif
+#if (L1_MIDI == 1)
+  #include "l1midi_defty.h"
+#endif
+#include "l1_defty.h"
+#include "l1_msgty.h"
+#include "l1_varex.h"
+
+#if (CHIPSET == 2 || CHIPSET == 3 || CHIPSET == 4 || CHIPSET == 5 || CHIPSET == 6 || CHIPSET == 7 || CHIPSET == 8 || CHIPSET == 10 || CHIPSET == 11 || CHIPSET == 12) || (CHIPSET == 15)
+  #include "ulpd.h"
+#endif
+
+extern UWORD32    TCD_Priority_Groups;
+extern TC_HCB     *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
+extern VOID       *TCD_Current_Thread;
+extern TC_HCB     *TCD_Active_HISR_Tails[TC_HISR_PRIORITIES];
+extern INT        TMD_Timer_State;
+extern UWORD32    TMD_Timer;               // for big sleep 
+extern TC_PROTECT TCD_System_Protect;
+
+ 
+ /*-------------------------------------------------------*/
+ /* int ind_os_sleep()                                    */
+ /*-------------------------------------------------------*/
+ /* Parameters : none                                     */
+ /* Return     :                                          */
+ /* Functionality : Suspend the thread an interval        */
+ /*                 of millisecs.                         */
+ /* Limitation :                                          */
+ /*-------------------------------------------------------*/
+
+ T_OS_RETURN  ind_os_sleep (SYS_UWORD32 millisecs)
+{
+  NU_Sleep ((SYS_UWORD32) millisecs);
+  return OS_OK;
+}
+
+
+ /*-------------------------------------------------------*/
+ /* int OS_get_inactivity_ticks()                         */
+ /*-------------------------------------------------------*/
+ /* Parameters : none                                     */
+ /* Return     : Number of ticks of inactivity            */
+ /*              0 means immediate activity planned       */
+ /*              -1 means no activity planned             */
+ /* Functionality : Evaluates the OS activity planned     */
+ /*                 by looking at ready tasks, activated  */
+ /*                HISR and the elapsed time of the timers*/
+ /* Limitation : Must be protected from H/W interrupts    */
+ /*-------------------------------------------------------*/
+ int OS_get_inactivity_ticks(void)
+ {
+  #if (CODE_VERSION != SIMULATION)
+   int i;
+
+   // Returns immediate activity if a task is ready
+   if (TCD_Priority_Groups)
+     return 0;
+
+   //for all HISR priorities
+   for (i = 0; i < TC_HISR_PRIORITIES ; i++)
+   {
+     // if no hisr of priority "i" ==> go to next priority
+     if (TCD_Active_HISR_Heads[i] == 0)
+       continue;
+
+     // the first hisr is NOT the current one (frame hisr) so it may be
+     // with other priority ==> abort
+     if (TCD_Active_HISR_Heads[i] != TCD_Current_Thread) 
+       return 0;
+
+     // the last hisr is NOT the current one (frame hisr) so there is
+     // at least another hisr with same priority ==> abort
+     if (TCD_Active_HISR_Tails[i] != TCD_Current_Thread)
+       return 0;
+
+     // the first and last hisrs are the current one (frame hisr) but
+     // there are several occurences of it ! ==> abort
+     if (  (TCD_Active_HISR_Heads[i]->tc_activation_count != 1))
+       return 0;
+   }
+
+   // Returns remaining ticks number if any timer is active
+   if (TMD_Timer_State == TM_ACTIVE)  // any active timer ?
+     return TMD_Timer;
+
+   // Returns not activity if no timer active
+   else if (TMD_Timer_State == TM_NOT_ACTIVE)
+     return -1;
+   else
+     // otherwise, returns immediate activity if a timer is expired (TM_EXPIRED)
+     return(0);
+  #else // Simulation part
+    // the L3 simulator return the FN for the next L3 message
+    UWORD32 time;
+    time = (next_message_FN() - l1s.debug_time + MAX_FN)% MAX_FN;
+    return(time);
+  #endif
+ }
+
+ /*-------------------------------------------------------*/
+ /* int OS_system_protect()                               */
+ /*-------------------------------------------------------*/
+ /* Parameters : none                                     */
+ /* Return     : The Thread Control Block of the thread   */
+ /*              which already owns the protection or     */
+ /*              0 if no protection                       */
+ /* Functionality : Checks whether the system structures  */
+ /*                 are already protected or not          */
+ /*-------------------------------------------------------*/
+ void OS_system_protect (void)
+ {
+   NU_Protect((NU_PROTECT*) &TCD_System_Protect);
+ }
+
+ /*-------------------------------------------------------*/
+ /* int OS_system_Unprotect()                             */
+ /*-------------------------------------------------------*/
+ /* Parameters : none                                     */
+ /* Return     :                                          */
+ /* Functionality : unprotect the system structures       */
+ /*-------------------------------------------------------*/
+ void OS_system_Unprotect (void)
+ {
+   NU_Unprotect();
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust1/ind_os.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,19 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename ind_os.h
+ *        Version  1.2
+ *        Date     05/25/00
+ * 
+ ************* Revision Controle System Header *************/
+
+
+
+#define OS_OK   0
+        
+typedef SYS_WORD16  T_OS_RETURN;
+
+// Prototype for independant os commands
+extern T_OS_RETURN  ind_os_sleep (SYS_UWORD32 millisecs);
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust1/l1_cust.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,1616 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ * L1_CUST.C
+ *
+ *        Filename l1_cust.c
+ *  Copyright 2003 (C) Texas Instruments
+ *
+ ************* Revision Controle System Header *************/
+
+//#define  GLOBAL
+
+#include "l1sw.cfg"
+#include "l1_types.h"
+
+#include "string.h"
+#include "l1_confg.h"
+#include "l1_const.h"
+#include "ulpd.h"
+#include "tm_defs.h"
+#include "l1_types.h"
+#include "l1_time.h"
+#include "l1_trace.h"
+#include "sys_types.h"
+#include "l1_macro.h"
+#if (OP_L1_STANDALONE == 1)
+  #include "serialswitch_core.h"
+#else
+  #include "uart/serialswitch.h"
+#endif
+
+#include "abb.h"
+
+#if(OP_L1_STANDALONE == 0)
+  #include "buzzer/buzzer.h"       // for BZ_KeyBeep_OFF function
+  #include "sim/sim.h"
+#endif
+
+#if TESTMODE
+  #include "l1tm_defty.h"
+#endif
+
+#if (AUDIO_TASK == 1)
+  #include "l1audio_const.h"
+  #include "l1audio_cust.h"
+  #include "l1audio_defty.h"
+#endif
+
+#if (L1_GTT == 1)
+  #include "l1gtt_const.h"
+  #include "l1gtt_defty.h"
+#endif
+
+#if (L1_MP3 == 1)
+  #include "l1mp3_defty.h"
+#endif
+
+#if (L1_MIDI == 1)
+  #include "l1midi_defty.h"
+#endif
+
+#include "l1_defty.h"
+#include "l1_msgty.h"
+#include "l1_tabs.h"
+#include "l1_varex.h"
+#include "l1_proto.h"
+#if (VCXO_ALGO == 1)
+  #include "l1_ctl.h"
+#endif
+
+
+#if (RF_FAM == 61)
+ #include "drp_drive.h"
+  #include "tpudrv61.h"
+  #include "l1_rf61.h"
+  #include "l1_rf61.c"
+#endif
+
+
+#if (RF_FAM == 60 )
+#include "drp_drive.h"
+  #include "tpudrv60.h"
+  #include "l1_rf60.h"
+  #include "l1_rf60.c"
+  //#include "rf60.h"
+#endif
+
+#if (RF_FAM == 43)
+  #include "tpudrv43.h"
+  #include "l1_rf43.h"
+  #include "l1_rf43.c"
+#endif
+
+#if (RF_FAM == 35)
+  #include "tpudrv35.h"
+  #include "l1_rf35.h"
+  #include "l1_rf35.c"
+#endif
+
+#if (RF_FAM == 12)
+  #include "tpudrv12.h"
+  #include "l1_rf12.h"
+  #include "l1_rf12.c"
+#endif
+
+#if (RF_FAM == 10)
+  #include "tpudrv10.h"
+  #include "l1_rf10.h"
+  #include "l1_rf10.c"
+#endif
+
+#if (RF_FAM == 8)
+  #include "tpudrv8.h"
+  #include "l1_rf8.h"
+  #include "l1_rf8.c"
+#endif
+
+#if (RF_FAM == 2)
+  #include "l1_rf2.h"
+  #include "l1_rf2.c"
+#endif
+
+#if (DRP_FW_EXT == 1)
+#include "l1_drp_inc.h"
+#include "l1_ver.h"
+#endif
+
+
+// Nucleus functions
+extern INT                TMD_Timer_State;
+extern UWORD32            TMD_Timer;               // for big sleep
+extern UWORD32            TCD_Priority_Groups;
+extern VOID              *TCD_Current_Thread;
+extern TC_HCB            *TCD_Active_HISR_Heads[TC_HISR_PRIORITIES];
+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
+#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)        
+    effs_t ffs_fread(const char *name, void *addr, filesize_t size);
+  #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)
+  extern SYS_BOOL cama_sleep_status(void);
+#endif
+
+#if (CODE_VERSION != SIMULATION)
+  // Import serial switch configuration
+  #if (CHIPSET == 12)
+    extern char ser_cfg_info[3];
+  #else
+    extern char ser_cfg_info[2];
+  #endif
+#endif
+
+#if(REL99 && FF_PRF)
+T_TX_LEVEL *Cust_get_uplink_apc_power_reduction(UWORD8 band,
+                                                UWORD8 number_uplink_timeslot,
+                                                T_TX_LEVEL *p_tx_level);
+#endif
+
+
+void   get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+UWORD8 save_cal_in_nvmem  (UWORD8 *ptr, UWORD16 len, UWORD8 id);
+void config_rf_rw_band(char type, UWORD8 read);
+void config_rf_read(char type);
+void config_rf_write(char type);
+
+#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;
+#endif
+
+enum {
+  RF_ID        = 0,
+  ADC_ID       = 1
+};
+
+#if (L1_FF_MULTIBAND == 0)
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the location of rf-struct      */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+//omaps00090550 #83 warinng removal
+static const T_BAND_CONFIG band_config[] =
+{ /*ffs name, default addr, max carrier, min tx pwr */
+  {"",(T_RF_BAND *) 0,0,0},//undefined
+  {"900", (T_RF_BAND *)&rf_900,  174, 19 },//EGSM
+  {"1800",(T_RF_BAND *)&rf_1800, 374, 15 },//DCS
+  {"1900",(T_RF_BAND *)&rf_1900, 299, 15 },//PCS
+  {"850", (T_RF_BAND *)&rf_850,  124, 19 },//GSM850
+#if (RF_FAM == 10)
+  {"1900_us",(T_RF_BAND *)&rf_1900, 299, 15 },//usdual 1900 rf tables are the same as 3band 1900 rf tables at the moment
+#endif
+  {"900", (T_RF_BAND *)&rf_900,  124, 19 } //GSM, this should be last entry
+};
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Defines the indices into band_config   */
+/*                for each std.                          */
+/*-------------------------------------------------------*/
+const T_STD_CONFIG std_config[] =
+{
+ /* band1 index,  band2 index, txpwr turning point, first arfcn*/
+  {           0,          0,     0, 0   }, // std = 0 not used
+  { BAND_GSM900,  BAND_NONE,     0, 1   }, // std = 1 GSM
+  { BAND_EGSM900, BAND_NONE,     0, 1   }, // std = 2 EGSM
+  { BAND_PCS1900, BAND_NONE,    21, 512 }, // std = 3 PCS
+  { BAND_DCS1800, BAND_NONE,    28, 512 }, // std = 4 DCS
+  { BAND_GSM900,  BAND_DCS1800, 28, 1   }, // std = 5 DUAL
+  { BAND_EGSM900, BAND_DCS1800, 28, 1   }, // std = 6 DUALEXT
+  { BAND_GSM850,  BAND_NONE,     0, 128 }, // std = 7 850
+#if (RF_FAM == 10)
+  { BAND_GSM850,  BAND_PCS1900_US, 21, 1   }  // std = 8 850/1900
+#else
+  { BAND_GSM850,  BAND_PCS1900, 21, 1   }  // std = 8 850/1900
+#endif
+};
+#endif //if (L1_FF_MULTIBAND == 0)
+
+/*-------------------------------------------------------*/
+/* Prototypes of external functions used in this file.   */
+/*-------------------------------------------------------*/
+void l1_initialize(T_MMI_L1_CONFIG *mmi_l1_config);
+#if (L1_FF_MULTIBAND == 0)
+WORD16 Convert_l1_radio_freq  (UWORD16 radio_freq);
+#endif
+/*-------------------------------------------------------*/
+/* Cust_recover_Os()                                      */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description: adjust OS from sleep duration            */
+/* ------------                                          */
+/* This function fix the :                               */
+/* - system clock                                        */
+/* - Nucleus timers                                      */
+/* - xxxxxx (customer dependant)                         */
+/*-------------------------------------------------------*/
+
+UWORD8 Cust_recover_Os(void)
+{
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {
+    UWORD32 current_system_clock;
+
+    /***************************************************/
+    // Fix System clock and Nucleus Timers if any....  */
+    /***************************************************/
+    // Fix System clock ....
+    current_system_clock  = NU_Retrieve_Clock();
+    current_system_clock += l1s.pw_mgr.sleep_duration;
+    NU_Set_Clock(current_system_clock);
+
+    // Fix Nucleus timer (if needed) ....
+    if (TMD_Timer_State == TM_ACTIVE)
+    {
+      TMD_Timer -= l1s.pw_mgr.sleep_duration;
+      if (!TMD_Timer) TMD_Timer_State = TM_EXPIRED;
+    }
+
+    /***************************************************/
+    // Cust dependant part                        ...  */
+    /***************************************************/
+    //.............
+    //.............
+    //..............
+    return(TRUE);
+
+  }
+#endif
+    return(TRUE); //omaps00090550
+}
+
+
+
+/*-------------------------------------------------------*/
+/* Cust_check_system()                                   */
+/*-------------------------------------------------------*/
+/*                                                       */
+/* Description:                                          */
+/* ------------                                          */
+/* GSM 1.5 :                                             */
+/* - authorize UWIRE clock to be stopped                 */
+/*   and write value in l1s.pw_mgr.modules_status.       */
+/* - authorize ARMIO clock to be stopped if the light is */
+/*   off and write value in l1s.pw_mgr.modules_status.   */
+/* - check if SIM clock have been stopped                */
+/*   before allowing DEEP SLEEP.                         */
+/* - check if UARTs are ready to enter deep sleep        */
+/* - choose the sleep mode                               */
+/*                                                       */
+/* Return:                                               */
+/* -------                                               */
+/* DO_NOT_SLEEP, FRAME_STOP or CLOCK_STOP                */
+/*-------------------------------------------------------*/
+UWORD8 Cust_check_system(void)
+{
+
+#if (CODE_VERSION != SIMULATION)
+  if (l1_config.pwr_mngt == PWR_MNGT)
+  {
+
+#if (L2_L3_SIMUL == 0)
+    // Forbid deep sleep if the light is on
+    if(LT_Status())
+    {
+       //cut ARMIO and UWIRE clocks in big sleep
+       l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+       l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_LIGHT_ON;
+       return(FRAME_STOP);  // BIG sleep
+    }
+
+  #if (OP_L1_STANDALONE == 0)
+    // Forbid deep sleep if the camera is working
+    if(!cama_sleep_status())
+    {
+      l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_CAMERA;
+      return(FRAME_STOP);  // BIG sleep
+    }
+
+// Forbid deep sleep if the SIM and UARTs not ready
+#if (REQUIRED_FOR_ESAMPLE_LOCOSTO)
+    // Forbid deep sleep if the SIM and UARTs not ready
+    if(SIM_SleepStatus())
+#endif
+    {
+  #endif
+#endif
+        if(SER_UartSleepStatus())
+          {
+              return(CLOCK_STOP);   // DEEP sleep
+          }
+         else l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_UART;
+#if (L2_L3_SIMUL == 0)
+  #if (OP_L1_STANDALONE == 0)
+    }
+// Forbid deep sleep if the SIM and UARTs not ready
+#if (REQUIRED_FOR_ESAMPLE_LOCOSTO)
+    else l1s.pw_mgr.why_big_sleep = BIG_SLEEP_DUE_TO_SIM;
+#endif
+  #endif
+#endif
+        // cut ARMIO and UWIRE clocks in big sleep
+        l1s.pw_mgr.modules_status = ARMIO_CLK_CUT | UWIRE_CLK_CUT ;
+        return(FRAME_STOP);  // BIG sleep
+  }
+#else // Simulation part
+  return(CLOCK_STOP);   // DEEP sleep
+#endif
+return(CLOCK_STOP); // omaps00090550
+}
+
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configuration, tables etc. */
+/*                from FFS files.                        */
+/*-------------------------------------------------------*/
+//omaps00090550 #83-d warnimg removal
+static const  T_CONFIG_FILE config_files_common[] =
+{
+#if (CODE_VERSION != SIMULATION)
+
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+    "f/gsm/rf/afcdac",             &rf.afc.eeprom_afc, sizeof(rf.afc.eeprom_afc),
+    "F/gsm/rf/stdmap",             &rf.radio_band_support, sizeof(rf.radio_band_support),
+#if (VCXO_ALGO == 1)
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32) + 4 * sizeof(WORD16),
+#else
+    "F/gsm/rf/afcparams",          &rf.afc.psi_sta_inv, 4 * sizeof(UWORD32),
+#endif
+
+    "R/gsm/rf/rx/agcglobals",      &rf.rx.agc, 4 * sizeof(UWORD16),
+    "R/gsm/rf/rx/il2agc",          &rf.rx.agc.il2agc_pwr[0], 3 * sizeof(rf.rx.agc.il2agc_pwr),
+    "R/gsm/rf/rx/agcwords",        &AGC_TABLE, sizeof(AGC_TABLE),
+
+    "s/sys/adccal",                &adc_cal, sizeof(adc_cal),
+
+    "S/sys/abb",                   &abb, sizeof(abb),
+    "S/sys/uartswitch",            &ser_cfg_info, sizeof(ser_cfg_info),
+
+    #if (RF_FAM ==61)
+    "S/sys/drp_wrapper",  & drp_wrapper, sizeof(drp_wrapper),
+    #if (DRP_FW_EXT == 0)    
+    "S/sys/drp_calibration",  & drp_sw_data_calib, sizeof(drp_sw_data_calib),
+    #endif
+    #endif
+
+#endif
+    NULL,                          0, 0 // terminator
+ };
+
+/*-------------------------------------------------------*/
+/* Parameters:    none                                   */
+/* Return:        none                                   */
+/* Functionality: Read the RF configurations for         */
+/*                each band from FFS files. These files  */
+/*                are defined for one band, and and used */
+/*                for all bands.                         */
+/*-------------------------------------------------------*/
+//omaps00090550 #83 warning removal
+static const  T_CONFIG_FILE config_files_band[] =
+{
+    // The first char is NOT part of the filename. It is used for
+    // categorizing the ffs file contents:
+    // f=rf-cal,  F=rf-config,
+    // t=tx-cal,  T=tx-config,
+    // r=rx-cal,  R=rx-config,
+    // s=sys-cal, S=sys-config,
+
+    // generic for all bands
+    // band[0] is used as template for all bands.
+    "t/gsm/rf/tx/ramps",     &rf_band[0].tx.ramp_tables,    sizeof(rf_band[0].tx.ramp_tables),
+    "t/gsm/rf/tx/levels",    &rf_band[0].tx.levels,         sizeof(rf_band[0].tx.levels),
+    "t/gsm/rf/tx/calchan",   &rf_band[0].tx.chan_cal_table, sizeof(rf_band[0].tx.chan_cal_table),
+    "T/gsm/rf/tx/caltemp",   &rf_band[0].tx.temp,           sizeof(rf_band[0].tx.temp),
+
+    "r/gsm/rf/rx/calchan",   &rf_band[0].rx.agc_bands,      sizeof(rf_band[0].rx.agc_bands),
+    "R/gsm/rf/rx/caltemp",   &rf_band[0].rx.temp,           sizeof(rf_band[0].rx.temp),
+    "r/gsm/rf/rx/agcparams", &rf_band[0].rx.rx_cal_params,  sizeof(rf_band[0].rx.rx_cal_params),
+    NULL,                          0,                   0 // terminator
+};
+
+void config_ffs_read(char type)
+{
+  config_rf_read(type);
+  config_rf_rw_band(type, 1);
+}
+
+void config_ffs_write(char type)
+{
+  config_rf_write(type);
+  config_rf_rw_band(type, 0);
+}
+
+void config_rf_read(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fread(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_write(char type)
+{
+    const T_CONFIG_FILE *file = config_files_common;
+
+    while (file->name != NULL)
+    {
+        if (type == '*' || type == file->name[0]) {
+            ffs_fwrite(&file->name[1], file->addr, file->size);
+        }
+        file++;
+    }
+}
+
+void config_rf_rw_band(char type, UWORD8 read)
+{
+    const T_CONFIG_FILE *f1 = config_files_band;
+    UWORD8 i;
+    WORD32 offset;
+    char name[64];
+    char *p;
+#if (L1_FF_MULTIBAND == 0)
+    UWORD8 std = l1_config.std.id;
+#endif
+
+#if FFS_WORKAROUND == 1
+    struct stat_s stat;
+    UWORD16 time;
+#endif
+ #if (L1_FF_MULTIBAND == 0)
+    for (i=0; i< GSM_BANDS; i++)
+    {
+      if(std_config[std].band[i] !=0 )
+      {
+#else
+      for (i = 0; i < RF_NB_SUPPORTED_BANDS; i++)
+      {
+#endif /*if (L1_FF_MULTIBAND == 0) */
+        f1 = &config_files_band[0];
+        while (f1->name != NULL)
+        {
+          offset = (WORD32) f1->addr - (WORD32) &rf_band[0]; //offset in bytes
+          p = ((char *) &rf_band[i]) + offset;
+          if (type == '*' || type == f1->name[0])
+          {
+            strcpy(name, &f1->name[1]);
+            strcat(name, ".");
+#if (L1_FF_MULTIBAND == 0)
+            strcat(name, band_config[std_config[std].band[i]].name);
+#else
+            strcat(name, multiband_rf[i].name);
+#endif /*if (L1_FF_MULTIBAND == 0)*/
+
+            if (read == 1)
+              ffs_fread(name, p, f1->size);
+            else //write == 0
+            {
+              ffs_fwrite(name, p, f1->size);
+
+              // wait until ffs write has finished
+#if FFS_WORKAROUND == 1
+              stat.inode = 0;
+              time = 0;
+
+              do {
+                rvf_delay(10);  // in milliseconds
+                time += 10;
+                ffs_stat(name, &stat);
+              } while (stat.inode == 0 && time < 500);
+#endif
+            }
+          }
+          f1++;
+        }
+      }
+ #if (L1_FF_MULTIBAND == 0)
+}
+#endif
+}
+
+
+/*-------------------------------------------------------*/
+/* Cust_init_std()                                       */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init Standard variable configuration  */
+/*-------------------------------------------------------*/
+void Cust_init_std(void)
+#if (L1_FF_MULTIBAND == 0)
+{
+  UWORD8 std = l1_config.std.id;
+  UWORD8 band1, band2;
+  T_RF_BAND *pt1, *pt2;
+
+  band1 = std_config[std].band[0];
+  band2 = std_config[std].band[1];
+
+  //get these from std
+  pt1 = band_config[band1].addr;
+  pt2 = band_config[band2].addr;
+
+  // copy rf-struct from default flash to ram
+  memcpy(&rf_band[0], pt1, sizeof(T_RF_BAND));
+
+  if(std_config[std].band[1] != BAND_NONE )
+    memcpy(&rf_band[1], pt2, sizeof(T_RF_BAND));
+
+  // Read all RF and system configuration from FFS *before* we copy any of
+  // the rf structure variables to other places, like L1.
+
+  config_ffs_read('*');
+
+  l1_config.std.first_radio_freq       = std_config[std].first_arfcn;
+
+  if(band2!=0)
+    l1_config.std.first_radio_freq_band2 = band_config[band1].max_carrier + 1;
+  else
+    l1_config.std.first_radio_freq_band2 = 0; //band1 carrier + 1 else 0
+
+  // if band2 is not used it is initialised with zeros
+  l1_config.std.nbmax_carrier          = band_config[band1].max_carrier;
+  if(band2!=0)
+     l1_config.std.nbmax_carrier      += band_config[band2].max_carrier;
+
+  l1_config.std.max_txpwr_band1        = band_config[band1].max_txpwr;
+  l1_config.std.max_txpwr_band2        = band_config[band2].max_txpwr;
+  l1_config.std.txpwr_turning_point    = std_config[std].txpwr_tp;
+  l1_config.std.cal_freq1_band1        = 0;
+  l1_config.std.cal_freq1_band2        = 0;
+
+  l1_config.std.g_magic_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band1             = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band1  = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band1 = rf_band[MULTI_BAND1].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band1             = rf_band[MULTI_BAND1].swap_iq;
+
+  l1_config.std.g_magic_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.g_magic;
+  l1_config.std.lna_att_band2             = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_att;
+  l1_config.std.lna_switch_thr_low_band2  = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_low;
+  l1_config.std.lna_switch_thr_high_band2 = rf_band[MULTI_BAND2].rx.rx_cal_params.lna_switch_thr_high;
+  l1_config.std.swap_iq_band2             = rf_band[MULTI_BAND2].swap_iq;
+
+  l1_config.std.radio_freq_index_offset   = l1_config.std.first_radio_freq-1;
+
+  // init variable indicating which radio bands are supported by the chosen RF
+  l1_config.std.radio_band_support = rf.radio_band_support;
+
+  //TBD: DRP Calib: Currently the Calib Data are only used for the routines, TBD add to l1_config. from saved Calibration
+  // on a need basis ?
+}
+#else
+{
+  UWORD8 i;
+
+  for (i = 0; i < RF_NB_SUPPORTED_BANDS; i++)
+  {
+    switch(multiband_rf[i].gsm_band_identifier)
+    {
+        case RF_GSM900:
+            rf_band[i]=rf_900;
+        break;
+        case RF_GSM850:
+            rf_band[i]=rf_850;
+        break;
+        case RF_DCS1800:
+            rf_band[i]=rf_1800;
+        break;
+        case RF_PCS1900:
+            rf_band[i]=rf_1900;
+        break;
+        default:
+        break;
+    }
+  }
+  config_ffs_read('*');
+}
+#endif // if (L1_FF_MULTIBAND == 0)
+
+
+/*-------------------------------------------------------*/
+/* Cust_init_params()                                    */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : Init RF dependent paramters (AGC, TX) */
+/*-------------------------------------------------------*/
+void Cust_init_params(void)
+{
+
+#if (CODE_VERSION==SIMULATION)
+  extern UWORD16  simu_RX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+  extern UWORD16  simu_TX_SYNTH_SETUP_TIME; // set in xxx.txt l3 scenario file
+
+  l1_config.params.rx_synth_setup_time   = simu_RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = simu_TX_SYNTH_SETUP_TIME;
+#else
+  l1_config.params.rx_synth_setup_time   = RX_SYNTH_SETUP_TIME;
+  l1_config.params.tx_synth_setup_time   = TX_SYNTH_SETUP_TIME;
+#endif
+
+
+  // Convert SYNTH_SETUP_TIME into SPLIT.
+  // We have kept a margin of 20qbit (EPSILON_MEAS) to cover offset change and Scenario closing time + margin.
+  l1_config.params.rx_synth_load_split   = 1L + (l1_config.params.rx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_synth_load_split   = 1L + (l1_config.params.tx_synth_setup_time + EPSILON_MEAS) / (BP_DURATION/BP_SPLIT);
+
+  l1_config.params.rx_synth_start_time   = TPU_CLOCK_RANGE + PROVISION_TIME - l1_config.params.rx_synth_setup_time;
+  l1_config.params.tx_synth_start_time   = TPU_CLOCK_RANGE - l1_config.params.tx_synth_setup_time;
+
+  l1_config.params.rx_change_synchro_time = l1_config.params.rx_synth_start_time - EPSILON_SYNC;
+  l1_config.params.rx_change_offset_time  = l1_config.params.rx_synth_start_time - EPSILON_OFFS;
+
+  l1_config.params.tx_change_offset_time = TIME_OFFSET_TX -
+                                           TA_MAX -
+                                           l1_config.params.tx_synth_setup_time -
+                                           EPSILON_OFFS;
+
+  // TX duration = ramp up time + burst duration (data + tail bits)
+  l1_config.params.tx_nb_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + NB_BURST_DURATION_UL;
+  l1_config.params.tx_ra_duration = UL_ABB_DELAY + rf.tx.guard_bits*4 + RA_BURST_DURATION;
+
+  l1_config.params.tx_nb_load_split = 1L + (l1_config.params.tx_nb_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+  l1_config.params.tx_ra_load_split = 1L + (l1_config.params.tx_ra_duration - rf.tx.prg_tx - NB_MARGIN) / (BP_DURATION/BP_SPLIT);
+
+  // time for the end of RX and TX TPU scenarios
+  l1_config.params.rx_tpu_scenario_ending = RX_TPU_SCENARIO_ENDING;
+  l1_config.params.tx_tpu_scenario_ending = TX_TPU_SCENARIO_ENDING;
+
+  // FB26 anchoring time is computed backward to leave only 6 qbit margin between
+  // FB26 window and next activity (RX time tracking).
+  // This margin is used as follow:
+  //    Serving offset restore: 1 qbit (SERV_OFFS_REST_LOAD)
+  //    Tpu Sleep:              2 qbit (TPU_SLEEP_LOAD)
+  //                          ---------
+  //                     Total: 3 qbit
+
+  l1_config.params.fb26_anchoring_time = (l1_config.params.rx_synth_start_time -
+                                          #if (CODE_VERSION == SIMULATION)
+                                          // simulator: end of scenario not included in window (no serialization)
+                                            1 -
+                                          #else
+                                          // RF dependent end of RX TPU scenario
+                                            l1_config.params.rx_tpu_scenario_ending -
+                                          #endif
+                                          EPSILON_SYNC -
+                                          TPU_SLEEP_LOAD -
+                                          SERV_OFFS_REST_LOAD -
+                                          FB26_ACQUIS_DURATION -
+                                          PROVISION_TIME +
+                                          TPU_CLOCK_RANGE) % TPU_CLOCK_RANGE;
+
+  l1_config.params.fb26_change_offset_time  = l1_config.params.fb26_anchoring_time +
+                                              PROVISION_TIME -
+                                              l1_config.params.rx_synth_setup_time -
+                                              EPSILON_OFFS;
+
+  l1_config.params.guard_bits         = rf.tx.guard_bits;
+
+  l1_config.params.prg_tx_gsm         = rf.tx.prg_tx;
+  l1_config.params.prg_tx_dcs         = rf.tx.prg_tx; //delay for dual band not implemented yet
+
+  l1_config.params.low_agc_noise_thr  = rf.rx.agc.low_agc_noise_thr;
+  l1_config.params.high_agc_sat_thr   = rf.rx.agc.high_agc_sat_thr;
+  l1_config.params.low_agc            = rf.rx.agc.low_agc;
+  l1_config.params.high_agc           = rf.rx.agc.high_agc;
+  l1_config.params.il_min             = IL_MIN;
+
+  l1_config.params.fixed_txpwr        = FIXED_TXPWR;
+  l1_config.params.eeprom_afc         = rf.afc.eeprom_afc;
+  l1_config.params.setup_afc_and_rf   = SETUP_AFC_AND_RF;
+  l1_config.params.rf_wakeup_tpu_scenario_duration = l1_config.params.setup_afc_and_rf + 1; //directly dependent of l1dmacro_RF_wakeup implementation
+
+  l1_config.params.psi_sta_inv        = rf.afc.psi_sta_inv;
+  l1_config.params.psi_st             = rf.afc.psi_st;
+  l1_config.params.psi_st_32          = rf.afc.psi_st_32;
+  l1_config.params.psi_st_inv         = rf.afc.psi_st_inv;
+
+  #if (CODE_VERSION == SIMULATION)
+    #if (VCXO_ALGO == 1)
+      l1_config.params.afc_algo           = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+    #endif
+  #else
+    #if (VCXO_ALGO == 1)
+      l1_config.params.afc_dac_center       = rf.afc.dac_center;      // VCXO - assuming DAC linearity
+      l1_config.params.afc_dac_min          = rf.afc.dac_min;         // VCXO - assuming DAC linearity
+      l1_config.params.afc_dac_max          = rf.afc.dac_max;         // VCXO - assuming DAC linearity
+#if (NEW_SNR_THRESHOLD == 0)
+      l1_config.params.afc_snr_thr          = rf.afc.snr_thr;         // VCXO - SNR threshold
+#else
+      l1_config.params.afc_snr_thr = L1_TOA_SNR_THRESHOLD;
+#endif /* NEW_SNR_THRESHOLD */
+      l1_config.params.afc_algo             = ALGO_AFC_LQG_PREDICTOR; // VCXO|VCTCXO - Choosing AFC algorithm
+      l1_config.params.afc_win_avg_size_M   = C_WIN_AVG_SIZE_M;       // VCXO - Average psi values with this value
+      l1_config.params.rgap_algo            = ALGO_AFC_RXGAP;         // VCXO - Choosing Reception Gap algorithm
+      l1_config.params.rgap_bad_snr_count_B = C_RGAP_BAD_SNR_COUNT_B; // VCXO - Prediction SNR count
+    #endif
+  #endif
+
+  #if DCO_ALGO
+    #if (RF_FAM == 10)
+      // Enable DCO algorithm for direct conversion RFs
+      l1_config.params.dco_enabled = TRUE;
+    #else
+      l1_config.params.dco_enabled = FALSE;
+    #endif
+  #endif
+
+  #if (ANLG_FAM == 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
+    l1_config.params.vbdctrl          = abb[ABB_VBDCTRL];    // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctrl           = abb[ABB_BBCTRL];     // value at reset
+    l1_config.params.apcoff           = abb[ABB_APCOFF];     // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];    // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];    // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF]; // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];     // value at reset
+    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)
+    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
+    l1_config.params.vbdctrl          = abb[ABB_VBDCTRL];    // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctrl           = abb[ABB_BBCTRL];     // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];    // value at reset
+    l1_config.params.apcoff           = abb[ABB_APCOFF];     // value at reset
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];    // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];    // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF]; // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];     // value at reset
+    l1_config.params.vbctrl1          = abb[ABB_VBCTRL1];    // VULSWITCH=0, VDLAUX=1, VDLEAR=1
+    l1_config.params.vbctrl2          = abb[ABB_VBCTRL2];    // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    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)
+    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
+    l1_config.params.vbdctrl          = abb[ABB_VBDCTRL];       // Downlink gain amp 0dB, Volume control 0 dB
+    l1_config.params.bbctrl           = abb[ABB_BBCTRL];        // value at reset
+    l1_config.params.bulgcal          = abb[ABB_BULGCAL];       // value at reset
+    l1_config.params.apcoff           = abb[ABB_APCOFF];        // X2 Slope 128 and APCSWP disabled
+    l1_config.params.bulioff          = abb[ABB_BULIOFF];       // value at reset
+    l1_config.params.bulqoff          = abb[ABB_BULQOFF];       // value at reset
+    l1_config.params.dai_onoff        = abb[ABB_DAI_ON_OFF];    // value at reset
+    l1_config.params.auxdac           = abb[ABB_AUXDAC];        // value at reset
+    l1_config.params.vbctrl1          = abb[ABB_VBCTRL1];       // VULSWITCH=0
+    l1_config.params.vbctrl2          = abb[ABB_VBCTRL2];       // MICBIASEL=0, VDLHSO=0, MICAUX=0
+    l1_config.params.apcdel1          = abb[ABB_APCDEL1];       // value at reset
+    l1_config.params.apcdel2          = abb[ABB_APCDEL2];       // value at reset
+    l1_config.params.vbpop            = abb[ABB_VBPOP];         // HSOAUTO enabled
+    l1_config.params.vau_delay_init   = abb[ABB_VAUDINITD];     // 2 TDMA Frames between VDL "ON" and VDLHSO "ON"
+    l1_config.params.vaud_cfg         = abb[ABB_VAUDCTRL];      // value at reset
+    l1_config.params.vauo_onoff       = abb[ABB_VAUOCTRL];      // speech on AUX and EAR
+    l1_config.params.vaus_vol         = abb[ABB_VAUSCTRL];      // value at reset
+    l1_config.params.vaud_pll         = abb[ABB_VAUDPLL];       // value at reset
+#endif
+
+  #if (RF_FAM == 61)
+    l1_config.params.apcctrl2   =  drp_wrapper[DRP_WRAPPER_APCCTRL2];
+    l1_config.params.apcdel1   =  drp_wrapper[DRP_WRAPPER_APCDEL1];
+    l1_config.params.apcdel2   =  drp_wrapper[DRP_WRAPPER_APCDEL2];
+  #endif
+  #if (ANLG_FAM == 11)
+    l1_config.params.vulgain		= abb[ABB_VULGAIN];
+    l1_config.params.vdlgain		= abb[ABB_VDLGAIN];
+    l1_config.params.sidetone           = abb[ABB_SIDETONE];
+    l1_config.params.ctrl1			= abb[ABB_CTRL1];
+    l1_config.params.ctrl2			= abb[ABB_CTRL2];
+    l1_config.params.ctrl3			= abb[ABB_CTRL3];
+    l1_config.params.ctrl4			= abb[ABB_CTRL4];
+    l1_config.params.ctrl5			= abb[ABB_CTRL5];
+    l1_config.params.ctrl6			= abb[ABB_CTRL6];
+    l1_config.params.popauto		= abb[ABB_POPAUTO];
+    l1_config.params.outen1		= abb[ABB_OUTEN1];
+    l1_config.params.outen2		= abb[ABB_OUTEN2];
+    l1_config.params.outen3		= abb[ABB_OUTEN3];
+    l1_config.params.aulga		= abb[ABB_AULGA];
+    l1_config.params.aurga		= abb[ABB_AURGA];
+  #endif
+}
+
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_from_IL()                                */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality : returns agc value                     */
+/*-------------------------------------------------------*/
+WORD8 Cust_get_agc_from_IL(UWORD16 radio_freq, UWORD16 agc_index, UWORD8 table_id,UWORD8 lna_off_val)
+{
+
+  UWORD16 agc_index_temp;
+	
+// radio_freq currently not used
+// this parameter is passed in order to allow band dependent tables for specific RFs
+// (e.g. dual band RF with separate AGC H/W blocks for GSM and DCS)
+
+  agc_index_temp = (agc_index<<1) + (lna_off_val * l1ctl_get_lna_att(radio_freq)); 
+  agc_index= agc_index_temp>>1;
+  if (agc_index > 120)
+    agc_index = 120;    // Clip agc_index
+
+  switch (table_id)
+  {
+    case MAX_ID:  return(rf.rx.agc.il2agc_max[agc_index]);
+    case AV_ID:   return(rf.rx.agc.il2agc_av[agc_index]);
+    case PWR_ID:  return(rf.rx.agc.il2agc_pwr[agc_index]);
+  }
+  return (0);//omaps00090550
+}
+
+/*-------------------------------------------------------*/
+/* Cust_get_agc_band                                     */
+/*-------------------------------------------------------*/
+/* Parameters : radio_freq                               */
+/* Return     : band number                              */
+/* Functionality :  Computes the band for RF calibration */
+/*-------------------------------------------------------*/
+/*---------------------------------------------*/
+
+  UWORD8  band_number;
+  #if (CODE_VERSION == SIMULATION)
+    UWORD16 Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #else
+    UWORD16 inline Cust_get_agc_band(UWORD16 arfcn, UWORD8 gsm_band)
+  #endif
+    {
+//      WORD32 i =0 ;  //omaps00090550
+
+      for (band_number=0;band_number<RF_RX_CAL_CHAN_SIZE;band_number++)
+      {
+        if (arfcn <= rf_band[gsm_band].rx.agc_bands[band_number].upper_bound)
+          return(band_number);
+      }
+      // Should never happen!
+      return(0);
+    }
+
+#if (L1_FF_MULTIBAND == 0)
+/*-------------------------------------------------------*/
+/* Cust_is_band_high                                     */
+/*-------------------------------------------------------*/
+/* Parameters :  arfcn                                   */
+/* Return     :  0 if low band                           */
+/*               1 if high band                          */
+/* Functionality : Generic function which return 1 if    */
+/*                 arfcn is in the high band             */
+/*-------------------------------------------------------*/
+
+UWORD8 Cust_is_band_high(UWORD16 radio_freq)
+{
+  UWORD16 max_carrier;
+  UWORD8  std = l1_config.std.id;
+
+  max_carrier = band_config[std_config[std].band[0]].max_carrier;
+
+  return(((radio_freq >= l1_config.std.first_radio_freq) &&
+          (radio_freq < (l1_config.std.first_radio_freq + max_carrier))) ? MULTI_BAND1 : MULTI_BAND2);
+}
+#endif
+
+/*-------------------------------------------------------*/
+/* l1ctl_encode_delta2()                                 */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+WORD8 l1ctl_encode_delta2(UWORD16 radio_freq)
+{
+  WORD8    delta2_freq;
+  UWORD16  i;
+  UWORD16  arfcn;
+#if (L1_FF_MULTIBAND == 0)
+  UWORD8   band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+#else
+  WORD8   band;
+  // Corrected for input being rf_freq and not l1_freq
+  arfcn = rf_convert_l1freq_to_arfcn_rfband(rf_convert_rffreq_to_l1freq(radio_freq), &band);
+#endif
+
+  i = Cust_get_agc_band(arfcn,band); //
+  delta2_freq = rf_band[band].rx.agc_bands[i].agc_calib;
+
+  //temperature compensation
+  for (i=0;i<RF_RX_CAL_TEMP_SIZE;i++)
+  {
+    if ((WORD16)adc.converted[ADC_RFTEMP] <= rf_band[band].rx.temp[i].temperature)
+    {
+      delta2_freq += rf_band[band].rx.temp[i].agc_calib;
+      break;
+    }
+  }
+
+  return(delta2_freq);
+}
+
+#if (L1_FF_MULTIBAND == 0)
+#else
+/*-------------------------------------------------------*/
+/* l1ctl_get_g_magic()                                   */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+UWORD16 l1ctl_get_g_magic(UWORD16 radio_freq)
+{
+  // Corrected for input being rf_freq and not l1_freq
+  return (rf_band[rf_subband2band[rf_convert_rffreq_to_l1subband(radio_freq)]].rx.rx_cal_params.g_magic);
+}
+
+
+/*-------------------------------------------------------*/
+/* l1ctl_get_lna_att()                                   */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+UWORD16 l1ctl_get_lna_att(UWORD16 radio_freq)
+{
+// The function is provided with rf_freq as input so 
+// convert rf_freq to l1_subband then convert l1_subband to rf_band and index into rf_band
+  return( rf_band[rf_subband2band[rf_convert_rffreq_to_l1subband(radio_freq)]].rx.rx_cal_params.lna_att);    
+//  return (rf_band[rf_convert_l1freq_to_rf_band_idx(radio_freq)].rx.rx_cal_params.lna_att);
+}
+/*-------------------------------------------------------*/
+/* l1ctl_encode_delta1()                                 */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+WORD8 l1ctl_encode_delta1(UWORD16 radio_freq)
+{
+  return 0;
+}
+/*-------------------------------------------------------*/
+/* l1ctl_encode_lna()                                    */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+void l1ctl_encode_lna( UWORD8   input_level,
+                       UWORD8  *lna_state,
+                       UWORD16  radio_freq)
+{
+
+  /*** LNA Hysteresis is implemented as following :
+
+            |
+          On|---<>----+-------+
+            |         |       |
+   LNA      |         |       |
+            |         ^       v
+            |         |       |
+            |         |       |
+         Off|         +-------+----<>-----
+            +--------------------------------
+              50      40      30      20   input_level /-dBm
+                   THR_HIGH THR_LOW                          ***/
+  WORD8 band;
+  // Corrected for input to be rf_freq and not l1_freq
+  band = rf_subband2band[rf_convert_rffreq_to_l1subband(radio_freq)];
+  if ( input_level > rf_band[band].rx.rx_cal_params.lna_switch_thr_high)  // < -44dBm ?
+  {
+   *lna_state = LNA_ON;  // lna_off = FALSE
+  }
+  else if ( input_level < rf_band[band].rx.rx_cal_params.lna_switch_thr_low)   // > -40dBm ?
+  {
+   *lna_state = LNA_OFF; // lna off = TRUE
+  }
+}
+
+UWORD8 l1ctl_get_iqswap(UWORD16 rf_freq)
+{
+  return(rf_band[rf_subband2band[rf_convert_rffreq_to_l1subband(rf_freq)]].swap_iq);
+}
+
+#endif //if L1_FF_MULTIBAND == 0)
+
+/************************************/
+/* TX Management                    */
+/************************************/
+/*-------------------------------------------------------*/
+/* Cust_get_ramp_tab                                     */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :
+     Notes:
+Cal+
+APCRAM : Dwn(15:11)Up(10:6)Forced(0)
+Locosto:
+APCRAM: Dwn(15:8)Up(7:0)
+
+*/
+/*-------------------------------------------------------*/
+
+void Cust_get_ramp_tab(API *a_ramp, UWORD8 txpwr_ramp_up, UWORD8 txpwr_ramp_down, UWORD16 radio_freq)
+{
+  UWORD16 index_up, index_down,j, arfcn;
+#if (L1_FF_MULTIBAND == 0)
+  UWORD8 band;
+
+  band  = Cust_is_band_high(radio_freq);
+  arfcn = Convert_l1_radio_freq(radio_freq);
+#else
+  WORD8 band;
+  // Corrected for input being rf_freq and not l1_freq
+  arfcn = rf_convert_l1freq_to_arfcn_rfband(rf_convert_rffreq_to_l1freq(radio_freq), &band);
+#endif //if( L1_FF_MULTIBAND == 0)
+
+  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))
+    for (j=0; j<16; j++)
+    {
+      a_ramp[j]=((rf_band[band].tx.ramp_tables[index_down].ramp_down[j])<<11) |
+                ((rf_band[band].tx.ramp_tables[index_up].ramp_up[j])  << 6) |
+                  0x14;
+    }
+  #endif
+
+   #if (RF_FAM == 61)
+  // 20 Coeff each 8 (RampDown) + 8 (RampUp)
+      for (j=0; j<20; j++)
+      {
+         a_ramp[j]=( (255 - (rf_band[band].tx.ramp_tables[index_down].ramp_down[j]) ) <<8) |
+                ((rf_band[band].tx.ramp_tables[index_up].ramp_up[j])) ;
+      }
+   #endif
+}
+
+/*-------------------------------------------------------*/
+/* get_pwr_data                                          */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/*-------------------------------------------------------*/
+
+#if ((ANLG_FAM == 1) || (ANLG_FAM == 2) || (ANLG_FAM == 3) || (RF_FAM == 61))
+UWORD16 Cust_get_pwr_data(UWORD8 txpwr, UWORD16 radio_freq
+                          #if (REL99 && FF_PRF)
+                            , UWORD8 number_uplink_timeslot
+                          #endif
+                          )
+{
+
+  UWORD16 i,j;
+  UWORD16 arfcn;
+
+  T_TX_LEVEL *a_tx_levels;
+
+  #if (APC_VBAT_COMP == 1)
+    static UWORD16 apc_max_value = APC_MAX_VALUE;
+  #endif
+
+#if(ORDER2_TX_TEMP_CAL==1)
+        WORD16 pwr_data;
+#else
+        UWORD16  pwr_data;
+#endif
+
+#if (L1_FF_MULTIBAND == 0)
+    UWORD8 band;
+    band  = Cust_is_band_high(radio_freq);
+    arfcn = Convert_l1_radio_freq(radio_freq);
+#else
+    WORD8 band;
+    // Corrected for input being rf_freq and not l1_freq
+    arfcn = rf_convert_l1freq_to_arfcn_rfband(rf_convert_rffreq_to_l1freq(radio_freq), &band);
+#endif //if( L1_FF_MULTIBAND == 0)
+
+//  band  = Cust_is_band_high(radio_freq);
+//  arfcn = Convert_l1_radio_freq(radio_freq);
+
+  a_tx_levels = &(rf_band[band].tx.levels[txpwr]); // get pointer to rf tx structure
+
+  #if REL99
+    #if FF_PRF
+      // uplink power reduction feature which decrease power level in case of uplink multislot
+      a_tx_levels = Cust_get_uplink_apc_power_reduction(band, number_uplink_timeslot, a_tx_levels);
+    #endif
+  #endif
+
+// get uncalibrated apc
+  pwr_data = a_tx_levels->apc;
+
+  i = a_tx_levels->chan_cal_index; // get index for channel compensation
+  j=0;
+
+  while (arfcn > rf_band[band].tx.chan_cal_table[i][j].arfcn_limit)
+    j++;
+
+  // channel calibrate apc
+  pwr_data = ((UWORD32) (pwr_data * rf_band[band].tx.chan_cal_table[i][j].chan_cal))/128;
+
+  // temperature compensate apc
+  {
+    T_TX_TEMP_CAL *pt;
+
+    pt = rf_band[band].tx.temp;
+    while (((WORD16)adc.converted[ADC_RFTEMP] > pt->temperature) && ((pt-rf_band[band].tx.temp) < (RF_TX_CAL_TEMP_SIZE-1)))
+      pt++;
+#if(ORDER2_TX_TEMP_CAL==1)
+                pwr_data += (txpwr*(pt->a*txpwr + pt->b) + pt->c) / 64;      //delta apc = ax^2+bx+c
+                if(pwr_data < 0) pwr_data = 0;
+#else
+    pwr_data += pt->apc_calib;
+#endif
+  }
+
+  // Vbat compensate apc
+  #if (APC_VBAT_COMP == 1)
+
+    if (adc.converted[ADC_VBAT] < VBAT_LOW_THRESHOLD)
+       apc_max_value = APC_MAX_VALUE_LOW_BAT;
+
+    else if (adc.converted[ADC_VBAT] > VBAT_HIGH_THRESHOLD)
+            apc_max_value = APC_MAX_VALUE;
+
+    // else do nothing as Vbat is staying between VBAT_LOW_THRESHOLD and
+    // VBAT_HIGH_THRESHOLD -> max APC value is still the same than previous one
+
+    if (pwr_data > apc_max_value)
+	  pwr_data = apc_max_value;
+  #endif // APC_VBAT_COMP == 1
+
+  return(pwr_data);
+}
+#endif
+
+
+#if(REL99 && FF_PRF)
+
+/*-------------------------------------------------------*/
+/* Cust_get_uplink_apc_power_reduction                   */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* - frenquency band                                     */
+/* - modulation type                                     */
+/* - number of uplink timeslot                           */
+/* - pointer to radio power control structure            */
+/* Return     :                                          */
+/* - pointer to radio power control structure            */
+/*                                                       */
+/* Functionality : This function returns a pointer to    */
+/* the radio power control structure after power         */
+/* reduction processing.                                 */
+/* Depending of the number of uplink timeslot, the       */
+/* analogue power control (apc) value can be reduced     */
+/* in order to limit effect of terminal heat             */
+/* dissipation due to power amplifier.                   */
+/*-------------------------------------------------------*/
+
+T_TX_LEVEL *Cust_get_uplink_apc_power_reduction(UWORD8 band,
+                                                UWORD8 number_uplink_timeslot,
+                                                T_TX_LEVEL *p_tx_level)
+{
+  T_TX_LEVEL *p_power_reduction_tx_level;
+
+  #if TESTMODE
+    if ((l1_config.TestMode == TRUE) && (l1_config.tmode.tx_params.power_reduction_enable == FALSE))
+      return p_tx_level ;       // return without any power reduction
+  #endif
+
+  if ((number_uplink_timeslot >= 1) && (number_uplink_timeslot <=   MAX_UPLINK_TIME_SLOT))
+  {
+    number_uplink_timeslot--;  // index start from 0
+  }
+  else
+  {
+    return p_tx_level;         // abnormal case we do not apply any power reduction
+  }
+
+ p_power_reduction_tx_level = &(rf_band[band].tx.levels_power_reduction[number_uplink_timeslot]);
+
+  // We select the lowest power level in order to apply power reduction
+  #if (CODE_VERSION != SIMULATION)
+    if (p_tx_level->apc > p_power_reduction_tx_level->apc)   // higher apc value means higher transmit power
+  #else
+    if (p_tx_level->apc < p_power_reduction_tx_level->apc)   // ! for simulation rf apc tables are inverted so comparaison is the reverse
+  #endif
+      return p_power_reduction_tx_level;
+    else
+      return p_tx_level;
+}
+
+#endif
+
+/*-------------------------------------------------------*/
+/* Cust_Init_Layer1                                      */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :  Load and boot the DSP                */
+/* Initialize shared memory and L1 data structures       */
+/*-------------------------------------------------------*/
+
+void Cust_Init_Layer1(void)
+{
+  T_MMI_L1_CONFIG cfg;
+
+  // Get the current band configuration from the flash
+  #if (OP_WCP==1) && (OP_L1_STANDALONE!=1)
+    extern unsigned char ffs_GetBand();
+    cfg.std = ffs_GetBand();
+  #else // NO OP_WCP
+    //  cfg.std = std;
+    cfg.std = STD;
+  #endif // OP_WCP
+
+  cfg.tx_pwr_code = 1;
+
+  // sleep management configuration
+
+  #if(L1_POWER_MGT == 0)
+    cfg.pwr_mngt = 0;
+    cfg.pwr_mngt_mode_authorized = NO_SLEEP; //Sleep mode
+    cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
+  #endif
+  #if(L1_POWER_MGT == 1)
+    cfg.pwr_mngt = 1;
+    cfg.pwr_mngt_mode_authorized = ALL_SLEEP; //Sleep mode
+    cfg.pwr_mngt_clocks = 0x5ff; // list of clocks cut in Big Sleep
+  #endif
+
+
+
+
+
+  #if (CODE_VERSION != SIMULATION)
+    cfg.dwnld = DWNLD; //external define from makefile
+  #endif
+
+  l1_initialize(&cfg);
+  
+  //add below line for CSR 174476
+ 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);
+
+}
+
+
+/*****************************************************************************************/
+/***************************     TESTMODE functions     **********************************/
+/*****************************************************************************************/
+
+
+
+  /*------------------------------------------------------*/
+  /* madc_hex_2_physical                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Function to convert MAD hexadecimal  */
+  /*                 values into physical values          */
+  /*------------------------------------------------------*/
+
+void madc_hex_2_physical (UWORD16 *adc_hex, T_ADC *adc_phy)
+{
+ WORD16 i;
+ UWORD16 y;
+ WORD16 Smin = 0, Smax = TEMP_TABLE_SIZE-1;
+ WORD16 index = (TEMP_TABLE_SIZE-1)/2;       /* y is the adc code after compensation of ADC slope error introduced by VREF error */
+
+  //store raw ADC values
+  memcpy(&adc.raw[0], adc_hex, sizeof(adc.raw));
+
+  // Convert Vbat [mV] : direct equation with slope and offset compensation
+  for (i = ADC_VBAT; i<ADC_RFTEMP; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+
+  /*Convert RF Temperature [Celsius]: binsearch into a table*/
+  y = ((UWORD32)(adc_cal.a[ADC_RFTEMP] * adc.raw[ADC_RFTEMP]))>>8;       /* rf.tempcal is the calibration of VREF*/
+  while((Smax-Smin) > 1 )
+  {
+    if(y < temperature[index].adc)
+      Smax=index;
+    else
+      Smin=index;
+
+    index = (Smax+Smin)/2;
+  }
+  adc.converted[ADC_RFTEMP] = temperature[index].temp;
+
+  for (i = ADC_RFTEMP+1; i<ADC_INDEX_END; i++)
+    adc.converted[i] = (((UWORD32)(adc_cal.a[i] * adc.raw[i])) >>10) + adc_cal.b[i];
+
+  //store converted ADC values
+  memcpy(adc_phy, &adc.converted[0], sizeof(adc.raw));
+}
+
+
+  /*------------------------------------------------------*/
+  /*  get_cal_from_nvmem                                  */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated parameter to         */
+  /*                 calibration structure in RAM         */
+  /*------------------------------------------------------*/
+
+void get_cal_from_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+
+}
+
+  /*------------------------------------------------------*/
+  /*  save_cal_from_nvmem                                 */
+  /*------------------------------------------------------*/
+  /* Parameters :                                         */
+  /* Return     :                                         */
+  /* Functionality : Copy calibrated structure from RAM   */
+  /*                 into NV memory                       */
+  /*------------------------------------------------------*/
+
+UWORD8 save_cal_in_nvmem (UWORD8 *ptr, UWORD16 len, UWORD8 id)
+{
+  return (0);
+}
+
+#if (TRACE_TYPE == 4)
+
+/*------------------------------------------------------*/
+/*  l1_cst_l1_parameters                                */
+/*------------------------------------------------------*/
+/* Parameters :  s: pointer on configuration string     */
+/* Return     :  nothing: global var are set            */
+/* Functionality : Set global L1 vars for dynamic trace */
+/*                 and configuration                    */
+/*                                                      */
+/*   This function is called when a CST message is sent */
+/*   from the Condat Panel.                             */
+/*------------------------------------------------------*/
+void l1_cst_l1_parameters(char *s)
+{
+  /*
+    a sample command string can be:
+    L1_PARAMS=<1,2,3,4,5> or
+    L1_PARAMS=<1,23,3E32,4,5>
+    with n parameters (here: 5 params); n>=1
+    parameters are decoded as hexadecimal unsigned integers (UWORD16)
+  */
+
+  UWORD8  uNParams = 0;  /* Number of parameters */
+  UWORD32 aParam[10];    /* Parameters array */
+  UWORD8  uIndex = 0;
+
+  /* ***  retrieve all parameters *** */
+  while (s[uIndex] != '<') uIndex++;
+  uIndex++;
+  aParam[0] = 0;
+
+  /* uIndex points on 1st parameter */
+
+  while (s[uIndex] != '>')
+  {
+    if (s[uIndex] == ',')
+    {
+      uNParams++;
+      aParam[uNParams] = 0;
+    }
+    else
+    {
+      /* uIndex points on a parameter char */
+      UWORD8 uChar = s[uIndex];
+      aParam[uNParams] = aParam[uNParams] << 4; /* shift 4 bits left */
+      if ((uChar>='0') && (uChar<='9'))
+        aParam[uNParams] += (uChar - '0');        /* retrieve value */
+      else if ((uChar>='A') && (uChar<='F'))
+        aParam[uNParams] += (10 + uChar - 'A');        /* retrieve value */
+      else if ((uChar>='a') && (uChar<='f'))
+        aParam[uNParams] += (10 + uChar - 'a');        /* retrieve value */
+    }
+
+    uIndex++; /* go to next char */
+  }
+
+  /* increment number of params */
+  uNParams++;
+
+  /* *** handle parameters *** */
+  /*
+    1st param: command type
+    2nd param: argument for command type
+  */
+  switch (aParam[0])
+  {
+    case 0: /* Trace setting */
+      /* The 2nd parameter contains the trace bitmap*/
+      if (uNParams >=2)
+        trace_info.current_config->l1_dyn_trace = aParam[1];
+      else
+        trace_info.current_config->l1_dyn_trace = 0; /* error case: disable all trace */
+      Trace_dyn_trace_change();
+      break;
+    default: /* ignore it */
+      break;
+  } // switch
+}
+
+#endif
+
+#if ((CHIPSET == 2) || (CHIPSET == 3) || (CHIPSET == 4) || \
+     (CHIPSET == 5) || (CHIPSET == 6) || (CHIPSET == 7) || \
+     (CHIPSET == 8) || (CHIPSET == 9) || (CHIPSET == 10) || \
+     (CHIPSET == 11) || (CHIPSET == 12))
+/*-------------------------------------------------------*/
+/* power_down_config() : temporary implementation !!!    */
+/*-------------------------------------------------------*/
+/* Parameters : sleep_mode (NO, SMALL, BIG, DEEP or ALL) */
+/*              clocks to be cut in BIG sleep            */
+/* Return     :                                          */
+/* Functionality : set the l1s variables          */
+/* l1s.pw_mgr.mode_authorized and l1s.pw_mgr.clocks      */
+/* according to the desired mode.                       */
+/*-------------------------------------------------------*/
+void power_down_config(UWORD8 sleep_mode, UWORD16 clocks)
+{
+#if (OP_L1_STANDALONE == 1)
+  if(sleep_mode != NO_SLEEP)
+#endif
+  {
+    l1_config.pwr_mngt = PWR_MNGT;
+    l1s.pw_mgr.mode_authorized = sleep_mode;
+    l1s.pw_mgr.clocks = clocks;
+  }
+
+#if (OP_L1_STANDALONE == 0)
+  l1s.pw_mgr.enough_gaug = FALSE;
+#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 */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust1/l1_rf61.c	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,2108 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename l1_rf61.c
+ *        Version  1.0
+ *        Date     June 12th, 2005
+ *
+ ************* Revision Controle System Header *************/
+
+T_RF rf =
+{
+  RF_LOCOSTO,          //RF revision
+  RF_HW_BAND_SUPPORT,   // radio_band_support E-GSM/DCS + PCS
+
+  { //RX structure
+    { //AGC structure
+      140,  // low_agc_noise_thr;
+      110,  // high_agc_sat_thr;
+        0,  // low_agc;
+       23,  // high_agc;
+      //IL2AGC tables
+      {  // below is: il2agc_pwr[121];
+          //           il2agc_max[121];
+          //           il2agc_av[121];
+          // il2agc_pwr
+          // Note this is shared between PCN and EGSM.
+          0,          /*  EGSM_MAX  IL=0 */
+          0,          /*  EGSM_MAX  IL=-1 */
+          0,          /*  EGSM_MAX  IL=-2 */
+          0,          /*  EGSM_MAX  IL=-3 */
+          0,          /*  EGSM_MAX  IL=-4 */
+          0,          /*  EGSM_MAX  IL=-5 */
+          0,          /*  EGSM_MAX  IL=-6 */
+          0,          /*  EGSM_MAX  IL=-7 */
+          0,          /*  EGSM_MAX  IL=-8 */
+          0,          /*  EGSM_MAX  IL=-9 */
+          0,          /*  EGSM_MAX  IL=-10 */
+          0,          /*  EGSM_MAX  IL=-11 */
+          0,          /*  EGSM_MAX  IL=-12 */
+          0,          /*  EGSM_MAX  IL=-13 */
+          0,          /*  EGSM_MAX  IL=-14 */
+          0,          /*  EGSM_MAX  IL=-15 */
+          0,          /*  EGSM_MAX  IL=-16 */
+          0,          /*  EGSM_MAX  IL=-17 */
+          0,          /*  EGSM_MAX  IL=-18 */
+          0,          /*  EGSM_MAX  IL=-19 */
+          0,          /*  EGSM_MAX  IL=-20 */
+          0,          /*  EGSM_MAX  IL=-21 */
+          0,          /*  EGSM_MAX  IL=-22 */
+          0,          /*  EGSM_MAX  IL=-23 */
+          0,          /*  EGSM_MAX  IL=-24 */
+          0,          /*  EGSM_MAX  IL=-25 */
+          0,          /*  EGSM_MAX  IL=-26 */
+          0,          /*  EGSM_MAX  IL=-27 */
+          0,          /*  EGSM_MAX  IL=-28 */
+          0,          /*  EGSM_MAX  IL=-29 */
+          0,          /*  EGSM_MAX  IL=-30 */
+          0,          /*  EGSM_MAX  IL=-31 */
+          0,          /*  EGSM_MAX  IL=-32 */
+          0,          /*  EGSM_MAX  IL=-33 */
+          0,          /*  EGSM_MAX  IL=-34 */
+          0,          /*  EGSM_MAX  IL=-35 */
+          0,          /*  EGSM_MAX  IL=-36 */
+          0,          /*  EGSM_MAX  IL=-37 */
+          0,          /*  EGSM_MAX  IL=-38 */
+          0,          /*  EGSM_MAX  IL=-39 */
+          0,          /*  EGSM_MAX  IL=-40 */
+          0,          /*  EGSM_MAX  IL=-41 */
+          0,          /*  EGSM_MAX  IL=-42 */
+          5,          /*  EGSM_MAX  IL=-43 */
+          5,          /*  EGSM_MAX  IL=-44 */
+          0,          /*  EGSM_MAX  IL=-45 */
+          0,          /*  EGSM_MAX  IL=-46 */
+          0,          /*  EGSM_MAX  IL=-47 */
+          0,          /*  EGSM_MAX  IL=-48 */
+          0,          /*  EGSM_MAX  IL=-49 */
+          0,          /*  EGSM_MAX  IL=-50 */
+          0,          /*  EGSM_MAX  IL=-51 */
+          0,          /*  EGSM_MAX  IL=-52 */
+          0,          /*  EGSM_MAX  IL=-53 */
+          0,          /*  EGSM_MAX  IL=-54 */
+          0,          /*  EGSM_MAX  IL=-55 */
+          0,          /*  EGSM_MAX  IL=-56 */
+          0,          /*  EGSM_MAX  IL=-57 */
+          0,          /*  EGSM_MAX  IL=-58 */
+          0,          /*  EGSM_MAX  IL=-59 */
+          0,          /*  EGSM_MAX  IL=-60 */
+          0,          /*  EGSM_MAX  IL=-61 */
+          0,          /*  EGSM_MAX  IL=-62 */
+          0,          /*  EGSM_MAX  IL=-63 */
+          0,          /*  EGSM_MAX  IL=-64 */
+          0,          /*  EGSM_MAX  IL=-65 */
+          0,          /*  EGSM_MAX  IL=-66 */
+          0,          /*  EGSM_MAX  IL=-67 */
+          0,          /*  EGSM_MAX  IL=-68 */
+          0,          /*  EGSM_MAX  IL=-69 */
+          0,          /*  EGSM_MAX  IL=-70 */
+          0,          /*  EGSM_MAX  IL=-71 */
+          0,          /*  EGSM_MAX  IL=-72 */
+          0,          /*  EGSM_MAX  IL=-73 */
+          0,          /*  EGSM_MAX  IL=-74 */
+          5,          /*  EGSM_MAX  IL=-75 */
+          5,          /*  EGSM_MAX  IL=-76 */
+          8,          /*  EGSM_MAX  IL=-77 */
+          8,          /*  EGSM_MAX  IL=-78 */
+          11,          /*  EGSM_MAX  IL=-79 */
+          11,          /*  EGSM_MAX  IL=-80 */
+          11,          /*  EGSM_MAX  IL=-81 */
+          11,          /*  EGSM_MAX  IL=-82 */
+          11,          /*  EGSM_MAX  IL=-83 */
+          11,          /*  EGSM_MAX  IL=-84 */
+          14,          /*  EGSM_MAX  IL=-85 */
+          14,          /*  EGSM_MAX  IL=-86 */
+          14,          /*  EGSM_MAX  IL=-87 */
+          14,          /*  EGSM_MAX  IL=-88 */
+          14,          /*  EGSM_MAX  IL=-89 */
+          14,          /*  EGSM_MAX  IL=-90 */
+          14,          /*  EGSM_MAX  IL=-91 */
+          14,          /*  EGSM_MAX  IL=-92 */
+          14,          /*  EGSM_MAX  IL=-93 */
+          14,          /*  EGSM_MAX  IL=-94 */
+          17,          /*  EGSM_MAX  IL=-95 */
+          17,          /*  EGSM_MAX  IL=-96 */
+          20,          /*  EGSM_MAX  IL=-97 */
+          20,          /*  EGSM_MAX  IL=-98 */
+          20,          /*  EGSM_MAX  IL=-99 */
+          20,          /*  EGSM_MAX  IL=-100 */
+          23,          /*  EGSM_MAX  IL=-101 */
+          23,          /*  EGSM_MAX  IL=-102 */
+          23,          /*  EGSM_MAX  IL=-103 */
+          23,          /*  EGSM_MAX  IL=-104 */
+          23,          /*  EGSM_MAX  IL=-105 */
+          23,          /*  EGSM_MAX  IL=-106 */
+          23,          /*  EGSM_MAX  IL=-107 */
+          23,          /*  EGSM_MAX  IL=-108 */
+          23,          /*  EGSM_MAX  IL=-109 */
+          23,          /*  EGSM_MAX  IL=-110 */
+          23,          /*  EGSM_MAX  IL=-111 */
+          23,          /*  EGSM_MAX  IL=-112 */
+          23,          /*  EGSM_MAX  IL=-113 */
+          23,          /*  EGSM_MAX  IL=-114 */
+          23,          /*  EGSM_MAX  IL=-115 */
+          23,          /*  EGSM_MAX  IL=-116 */
+          23,          /*  EGSM_MAX  IL=-117 */
+          23,          /*  EGSM_MAX  IL=-118 */
+          23,          /*  EGSM_MAX  IL=-119 */
+          23           /*  EGSM_MAX  IL=-120 */
+      },
+      { // il2agc_max
+          // Note this is shared between PCN and EGSM.
+          0,          /*  EGSM_MAX  IL=0 */
+          0,          /*  EGSM_MAX  IL=-1 */
+          0,          /*  EGSM_MAX  IL=-2 */
+          0,          /*  EGSM_MAX  IL=-3 */
+          0,          /*  EGSM_MAX  IL=-4 */
+          0,          /*  EGSM_MAX  IL=-5 */
+          0,          /*  EGSM_MAX  IL=-6 */
+          0,          /*  EGSM_MAX  IL=-7 */
+          0,          /*  EGSM_MAX  IL=-8 */
+          0,          /*  EGSM_MAX  IL=-9 */
+          0,          /*  EGSM_MAX  IL=-10 */
+          0,          /*  EGSM_MAX  IL=-11 */
+          0,          /*  EGSM_MAX  IL=-12 */
+          0,          /*  EGSM_MAX  IL=-13 */
+          0,          /*  EGSM_MAX  IL=-14 */
+          0,          /*  EGSM_MAX  IL=-15 */
+          0,          /*  EGSM_MAX  IL=-16 */
+          0,          /*  EGSM_MAX  IL=-17 */
+          0,          /*  EGSM_MAX  IL=-18 */
+          0,          /*  EGSM_MAX  IL=-19 */
+          0,          /*  EGSM_MAX  IL=-20 */
+          0,          /*  EGSM_MAX  IL=-21 */
+          0,          /*  EGSM_MAX  IL=-22 */
+          0,          /*  EGSM_MAX  IL=-23 */
+          0,          /*  EGSM_MAX  IL=-24 */
+          0,          /*  EGSM_MAX  IL=-25 */
+          0,          /*  EGSM_MAX  IL=-26 */
+          0,          /*  EGSM_MAX  IL=-27 */
+          0,          /*  EGSM_MAX  IL=-28 */
+          0,          /*  EGSM_MAX  IL=-29 */
+          0,          /*  EGSM_MAX  IL=-30 */
+          0,          /*  EGSM_MAX  IL=-31 */
+          0,          /*  EGSM_MAX  IL=-32 */
+          0,          /*  EGSM_MAX  IL=-33 */
+          0,          /*  EGSM_MAX  IL=-34 */
+          0,          /*  EGSM_MAX  IL=-35 */
+          0,          /*  EGSM_MAX  IL=-36 */
+          0,          /*  EGSM_MAX  IL=-37 */
+          0,          /*  EGSM_MAX  IL=-38 */
+          0,          /*  EGSM_MAX  IL=-39 */
+          0,          /*  EGSM_MAX  IL=-40 */
+          0,          /*  EGSM_MAX  IL=-41 */
+          0,          /*  EGSM_MAX  IL=-42 */
+          5,          /*  EGSM_MAX  IL=-43 */
+          5,          /*  EGSM_MAX  IL=-44 */
+          0,          /*  EGSM_MAX  IL=-45 */
+          0,          /*  EGSM_MAX  IL=-46 */
+          0,          /*  EGSM_MAX  IL=-47 */
+          0,          /*  EGSM_MAX  IL=-48 */
+          0,          /*  EGSM_MAX  IL=-49 */
+          0,          /*  EGSM_MAX  IL=-50 */
+          0,          /*  EGSM_MAX  IL=-51 */
+          0,          /*  EGSM_MAX  IL=-52 */
+          0,          /*  EGSM_MAX  IL=-53 */
+          0,          /*  EGSM_MAX  IL=-54 */
+          0,          /*  EGSM_MAX  IL=-55 */
+          0,          /*  EGSM_MAX  IL=-56 */
+          0,          /*  EGSM_MAX  IL=-57 */
+          0,          /*  EGSM_MAX  IL=-58 */
+          0,          /*  EGSM_MAX  IL=-59 */
+          0,          /*  EGSM_MAX  IL=-60 */
+          0,          /*  EGSM_MAX  IL=-61 */
+          0,          /*  EGSM_MAX  IL=-62 */
+          0,          /*  EGSM_MAX  IL=-63 */
+          0,          /*  EGSM_MAX  IL=-64 */
+          0,          /*  EGSM_MAX  IL=-65 */
+          0,          /*  EGSM_MAX  IL=-66 */
+          0,          /*  EGSM_MAX  IL=-67 */
+          0,          /*  EGSM_MAX  IL=-68 */
+          0,          /*  EGSM_MAX  IL=-69 */
+          0,          /*  EGSM_MAX  IL=-70 */
+          0,          /*  EGSM_MAX  IL=-71 */
+          0,          /*  EGSM_MAX  IL=-72 */
+          0,          /*  EGSM_MAX  IL=-73 */
+          0,          /*  EGSM_MAX  IL=-74 */
+          5,          /*  EGSM_MAX  IL=-75 */
+          5,          /*  EGSM_MAX  IL=-76 */
+          8,          /*  EGSM_MAX  IL=-77 */
+          8,          /*  EGSM_MAX  IL=-78 */
+          11,          /*  EGSM_MAX  IL=-79 */
+          11,          /*  EGSM_MAX  IL=-80 */
+          11,          /*  EGSM_MAX  IL=-81 */
+          11,          /*  EGSM_MAX  IL=-82 */
+          11,          /*  EGSM_MAX  IL=-83 */
+          11,          /*  EGSM_MAX  IL=-84 */
+          14,          /*  EGSM_MAX  IL=-85 */
+          14,          /*  EGSM_MAX  IL=-86 */
+          14,          /*  EGSM_MAX  IL=-87 */
+          14,          /*  EGSM_MAX  IL=-88 */
+          14,          /*  EGSM_MAX  IL=-89 */
+          14,          /*  EGSM_MAX  IL=-90 */
+          14,          /*  EGSM_MAX  IL=-91 */
+          14,          /*  EGSM_MAX  IL=-92 */
+          14,          /*  EGSM_MAX  IL=-93 */
+          14,          /*  EGSM_MAX  IL=-94 */
+          17,          /*  EGSM_MAX  IL=-95 */
+          17,          /*  EGSM_MAX  IL=-96 */
+          20,          /*  EGSM_MAX  IL=-97 */
+          20,          /*  EGSM_MAX  IL=-98 */
+          20,          /*  EGSM_MAX  IL=-99 */
+          20,          /*  EGSM_MAX  IL=-100 */
+          23,          /*  EGSM_MAX  IL=-101 */
+          23,          /*  EGSM_MAX  IL=-102 */
+          23,          /*  EGSM_MAX  IL=-103 */
+          23,          /*  EGSM_MAX  IL=-104 */
+          23,          /*  EGSM_MAX  IL=-105 */
+          23,          /*  EGSM_MAX  IL=-106 */
+          23,          /*  EGSM_MAX  IL=-107 */
+          23,          /*  EGSM_MAX  IL=-108 */
+          23,          /*  EGSM_MAX  IL=-109 */
+          23,          /*  EGSM_MAX  IL=-110 */
+          23,          /*  EGSM_MAX  IL=-111 */
+          23,          /*  EGSM_MAX  IL=-112 */
+          23,          /*  EGSM_MAX  IL=-113 */
+          23,          /*  EGSM_MAX  IL=-114 */
+          23,          /*  EGSM_MAX  IL=-115 */
+          23,          /*  EGSM_MAX  IL=-116 */
+          23,          /*  EGSM_MAX  IL=-117 */
+          23,          /*  EGSM_MAX  IL=-118 */
+          23,          /*  EGSM_MAX  IL=-119 */
+          23           /*  EGSM_MAX  IL=-120 */
+        },
+        { // il2agc_av
+          // Note this is shared between PCN and EGSM.
+          0,          /*  EGSM_MAX  IL=0 */
+          0,          /*  EGSM_MAX  IL=-1 */
+          0,          /*  EGSM_MAX  IL=-2 */
+          0,          /*  EGSM_MAX  IL=-3 */
+          0,          /*  EGSM_MAX  IL=-4 */
+          0,          /*  EGSM_MAX  IL=-5 */
+          0,          /*  EGSM_MAX  IL=-6 */
+          0,          /*  EGSM_MAX  IL=-7 */
+          0,          /*  EGSM_MAX  IL=-8 */
+          0,          /*  EGSM_MAX  IL=-9 */
+          0,          /*  EGSM_MAX  IL=-10 */
+          0,          /*  EGSM_MAX  IL=-11 */
+          0,          /*  EGSM_MAX  IL=-12 */
+          0,          /*  EGSM_MAX  IL=-13 */
+          0,          /*  EGSM_MAX  IL=-14 */
+          0,          /*  EGSM_MAX  IL=-15 */
+          0,          /*  EGSM_MAX  IL=-16 */
+          0,          /*  EGSM_MAX  IL=-17 */
+          0,          /*  EGSM_MAX  IL=-18 */
+          0,          /*  EGSM_MAX  IL=-19 */
+          0,          /*  EGSM_MAX  IL=-20 */
+          0,          /*  EGSM_MAX  IL=-21 */
+          0,          /*  EGSM_MAX  IL=-22 */
+          0,          /*  EGSM_MAX  IL=-23 */
+          0,          /*  EGSM_MAX  IL=-24 */
+          0,          /*  EGSM_MAX  IL=-25 */
+          0,          /*  EGSM_MAX  IL=-26 */
+          0,          /*  EGSM_MAX  IL=-27 */
+          0,          /*  EGSM_MAX  IL=-28 */
+          0,          /*  EGSM_MAX  IL=-29 */
+          0,          /*  EGSM_MAX  IL=-30 */
+          0,          /*  EGSM_MAX  IL=-31 */
+          0,          /*  EGSM_MAX  IL=-32 */
+          0,          /*  EGSM_MAX  IL=-33 */
+          0,          /*  EGSM_MAX  IL=-34 */
+          0,          /*  EGSM_MAX  IL=-35 */
+          0,          /*  EGSM_MAX  IL=-36 */
+          0,          /*  EGSM_MAX  IL=-37 */
+          0,          /*  EGSM_MAX  IL=-38 */
+          0,          /*  EGSM_MAX  IL=-39 */
+          0,          /*  EGSM_MAX  IL=-40 */
+          0,          /*  EGSM_MAX  IL=-41 */
+          0,          /*  EGSM_MAX  IL=-42 */
+          5,          /*  EGSM_MAX  IL=-43 */
+          5,          /*  EGSM_MAX  IL=-44 */
+          0,          /*  EGSM_MAX  IL=-45 */
+          0,          /*  EGSM_MAX  IL=-46 */
+          0,          /*  EGSM_MAX  IL=-47 */
+          0,          /*  EGSM_MAX  IL=-48 */
+          0,          /*  EGSM_MAX  IL=-49 */
+          0,          /*  EGSM_MAX  IL=-50 */
+          0,          /*  EGSM_MAX  IL=-51 */
+          0,          /*  EGSM_MAX  IL=-52 */
+          0,          /*  EGSM_MAX  IL=-53 */
+          0,          /*  EGSM_MAX  IL=-54 */
+          0,          /*  EGSM_MAX  IL=-55 */
+          0,          /*  EGSM_MAX  IL=-56 */
+          0,          /*  EGSM_MAX  IL=-57 */
+          0,          /*  EGSM_MAX  IL=-58 */
+          0,          /*  EGSM_MAX  IL=-59 */
+          0,          /*  EGSM_MAX  IL=-60 */
+          0,          /*  EGSM_MAX  IL=-61 */
+          0,          /*  EGSM_MAX  IL=-62 */
+          0,          /*  EGSM_MAX  IL=-63 */
+          0,          /*  EGSM_MAX  IL=-64 */
+          0,          /*  EGSM_MAX  IL=-65 */
+          0,          /*  EGSM_MAX  IL=-66 */
+          0,          /*  EGSM_MAX  IL=-67 */
+          0,          /*  EGSM_MAX  IL=-68 */
+          0,          /*  EGSM_MAX  IL=-69 */
+          0,          /*  EGSM_MAX  IL=-70 */
+          0,          /*  EGSM_MAX  IL=-71 */
+          0,          /*  EGSM_MAX  IL=-72 */
+          0,          /*  EGSM_MAX  IL=-73 */
+          0,          /*  EGSM_MAX  IL=-74 */
+          5,          /*  EGSM_MAX  IL=-75 */
+          5,          /*  EGSM_MAX  IL=-76 */
+          8,          /*  EGSM_MAX  IL=-77 */
+          8,          /*  EGSM_MAX  IL=-78 */
+          11,          /*  EGSM_MAX  IL=-79 */
+          11,          /*  EGSM_MAX  IL=-80 */
+          11,          /*  EGSM_MAX  IL=-81 */
+          11,          /*  EGSM_MAX  IL=-82 */
+          11,          /*  EGSM_MAX  IL=-83 */
+          11,          /*  EGSM_MAX  IL=-84 */
+          14,          /*  EGSM_MAX  IL=-85 */
+          14,          /*  EGSM_MAX  IL=-86 */
+          14,          /*  EGSM_MAX  IL=-87 */
+          14,          /*  EGSM_MAX  IL=-88 */
+          14,          /*  EGSM_MAX  IL=-89 */
+          14,          /*  EGSM_MAX  IL=-90 */
+          14,          /*  EGSM_MAX  IL=-91 */
+          14,          /*  EGSM_MAX  IL=-92 */
+          14,          /*  EGSM_MAX  IL=-93 */
+          14,          /*  EGSM_MAX  IL=-94 */
+          17,          /*  EGSM_MAX  IL=-95 */
+          17,          /*  EGSM_MAX  IL=-96 */
+          20,          /*  EGSM_MAX  IL=-97 */
+          20,          /*  EGSM_MAX  IL=-98 */
+          20,          /*  EGSM_MAX  IL=-99 */
+          20,          /*  EGSM_MAX  IL=-100 */
+          23,          /*  EGSM_MAX  IL=-101 */
+          23,          /*  EGSM_MAX  IL=-102 */
+          23,          /*  EGSM_MAX  IL=-103 */
+          23,          /*  EGSM_MAX  IL=-104 */
+          23,          /*  EGSM_MAX  IL=-105 */
+          23,          /*  EGSM_MAX  IL=-106 */
+          23,          /*  EGSM_MAX  IL=-107 */
+          23,          /*  EGSM_MAX  IL=-108 */
+          23,          /*  EGSM_MAX  IL=-109 */
+          23,          /*  EGSM_MAX  IL=-110 */
+          23,          /*  EGSM_MAX  IL=-111 */
+          23,          /*  EGSM_MAX  IL=-112 */
+          23,          /*  EGSM_MAX  IL=-113 */
+          23,          /*  EGSM_MAX  IL=-114 */
+          23,          /*  EGSM_MAX  IL=-115 */
+          23,          /*  EGSM_MAX  IL=-116 */
+          23,          /*  EGSM_MAX  IL=-117 */
+          23,          /*  EGSM_MAX  IL=-118 */
+          23,          /*  EGSM_MAX  IL=-119 */
+          23           /*  EGSM_MAX  IL=-120 */
+      }
+    },
+  },
+  {
+    {0, 0},     // ramp up and down delays
+    GUARD_BITS, // number of guard bits needed for ramp up
+    PRG_TX      // propagation delay PRG_TX
+  },
+  { //AFC parameters
+    EEPROM_AFC,
+    C_Psi_sta_inv,     // (1/C_Psi_sta)
+    C_Psi_st,          // C_Psi_sta * 0.8 F0.16
+    C_Psi_st_32,       // F0.32
+    C_Psi_st_inv       // (1/C_Psi_st)
+
+#if (VCXO_ALGO==1)
+     ,C_AFC_DAC_CENTER,      // VCXO startup parameter - best guess
+      C_AFC_DAC_MIN,         // VCXO startup parameter - 15ppm
+      C_AFC_DAC_MAX,         // VCXO startup parameter + 15ppm
+      C_AFC_SNR_THR         // snr - Default threshold value
+#endif
+  }
+};
+
+#if (L1_FF_MULTIBAND == 0)
+    T_RF_BAND rf_band[GSM_BANDS]; //uninitialised rf struct for bands
+#else
+    T_RF_BAND rf_band[RF_NB_SUPPORTED_BANDS];
+#endif
+
+
+const T_RF_BAND rf_900 =
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+        229,      //g_magic
+         54,      //lna_gain_max * 2
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib
+      {  10,  0},    // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  0},    // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},    // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},    // etc.
+      {  90,  0},    //
+      { 112,  0},    //
+      { 124,  0},    //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// gsm900 T_LEVEL_TX
+      {457,  0, 0}, // 0
+      {457,  0, 0}, // 1
+      {457,  0, 0}, // 2
+      {457,  0, 0}, // 3
+      {457,  0, 0}, // 4
+      {457,  0, 0}, // 5 Highest power
+      {400,  1, 0}, // 6
+      {325,  2, 0}, // 7
+      {270,  3, 0}, // 8
+      {220,  4, 0}, // 9
+      {180,  5, 0}, // 10
+      {155,  6, 0}, // 11
+      {130,  7, 0}, // 12
+      {110,  8, 0}, // 13
+      { 95,  9, 0},  // 14
+      { 80, 10, 0}, // 15
+      { 70, 11, 0}, // 16
+      { 62, 12, 0}, // 17
+      { 55, 13, 0}, // 18
+      { 50, 14, 0}, // 19 Lowest power
+      { 50, 14, 0}, // 20
+      { 50, 14, 0}, // 21
+      { 50, 14, 0}, // 22
+      { 50, 14, 0}, // 23
+      { 50, 14, 0}, // 24
+      { 50, 14, 0}, // 25
+      { 50, 14, 0}, // 26
+      { 50, 14, 0}, // 27
+      { 50, 14, 0}, // 28
+      { 50, 14, 0}, // 29
+      { 50, 14, 0}, // 30
+      { 50, 14, 0}, // 31
+    },
+    #if(REL99 && FF_PRF)// needs proper values from RF
+    {// gsm900 levels_power_reduction
+    	{457,  0,  0}, // for uplink 1 timeslot = no power reduction ie 0,0 dB
+    	{457,  0,  0}, // for 2 uplink timeslot = reduction between 0,0 dB to 3,0 dB
+    	{457,  0,  0}, // for 3 uplink timeslot = reduction between 1,8 dB to 4,8 dB
+    	{457,  0,  0}, // for 4 uplink timselot = reduction between 3,0 dB to 6,0 dB
+	},
+    #endif
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {   20, 128 }, // Calibration Table 0
+        {  100, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 1
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 2
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 3
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      }
+    },
+    { // GSM Power Ramp Values
+     {
+      {// Ramp-Up      #0 profile - Power Level 5
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #0 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 6
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #1 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 7
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #2 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 8
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #3 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 9
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #4 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 10
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #5 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 11
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #6 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 12
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #7 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 13
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #8 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 14
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #9 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 15
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #10 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 16
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #11 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 17
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #12 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 18
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #13 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 19
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #14 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 19
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #15 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+    },
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_GSM,
+};
+
+const T_RF_BAND rf_1800 =
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      229,      //g_magic
+       54,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- DCS band --*/
+     /*--------------*/
+      { 548,  0},     //
+      { 622,  0},     //
+      { 680,  0},     //
+      { 745,  0},     //
+      { 812,  0},     //
+      { 860,  0},     //
+      { 885,  0},     //
+      { 991,  0},     //
+      { 992,  0},     //
+      {1023,  0},     //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// dcs1800 T_LEVEL_TX
+      {424, 0, 0}, // 0 Highest power
+      {375, 1, 0}, // 1
+      {310, 2, 0}, // 2
+      {255, 3, 0}, // 3
+      {210, 4, 0}, // 4
+      {180, 5, 0}, // 5
+      {152, 6, 0}, // 6
+      {130, 7, 0}, // 7
+      {112, 8, 0}, // 8
+      {98, 9, 0}, // 9
+      {85, 10, 0}, // 10
+      {75, 11, 0}, // 11
+      {66, 12, 0}, // 12
+      {58, 13, 0}, // 13
+      {52, 14, 0}, // 14
+      {47, 15, 0}, // 15 Lowest power
+      {47, 15, 0}, // 16
+      {47, 15, 0}, // 17
+      {47, 15, 0}, // 18
+      {47, 15, 0}, // 19
+      {47, 15, 0}, // 20
+      {47, 15, 0}, // 21
+      {47, 15, 0}, // 22
+      {47, 15, 0}, // 23
+      {47, 15, 0}, // 24
+      {47, 15, 0}, // 25
+      {47, 15, 0}, // 26
+      {47, 15, 0}, // 27
+      {47, 15, 0}, // 28
+      {424, 0, 0}, // 29 Highest power
+      {424, 0, 0}, // 30 Highest power
+      {424, 0, 0}, // 31 Highest power
+    },
+    #if(REL99 && FF_PRF)// needs proper values from RF
+    {// 1800 levels_power_reduction
+    	{424,  0,  0}, // for uplink 1 timeslot = no power reduction ie 0,0 dB
+    	{424,  0,  0}, // for 2 uplink timeslot = reduction between 0,0 dB to 3,0 dB
+    	{424,  0,  0}, // for 3 uplink timeslot = reduction between 1,8 dB to 4,8 dB
+    	{424,  0,  0}, // for 4 uplink timselot = reduction between 3,0 dB to 6,0 dB
+	},
+    #endif
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 0
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {
+        {  554, 128 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 2
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 3
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  851, 128 },
+        {  870, 128 },
+        {  885, 128 }
+      }
+    },
+     { // DCS Power Ramp Values
+      {
+      {// Ramp-Up      #0 profile - Power Level 0
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #0 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 1
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #1 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 2
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #2 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 3
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #3 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 4
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #4 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 5
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #5 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 6
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #6 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 7
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #7 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 8
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #8 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 9
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #9 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 10
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #10 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 11
+       0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #11 profile
+       255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 12
+        0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #12 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 13
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #13 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 14
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+
+      },
+      {// Ramp-Down    #14 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 15
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #15 profile
+        255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+      },
+     },
+    },
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_DCS
+};
+
+//copy from gsm900
+const T_RF_BAND rf_850 =
+{
+  { //RX structure
+     //T_RX_CAL_PARAMS rx_cal_params
+    {
+
+        229,      //g_magic
+         54,      //lna_gain_max * 2
+         40,      //lna_th_high
+         44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     // Remark: ARFCN=0 (GSM-E) is maintained by 1st GSM subbband.
+                     // upper_bound, agc_calib
+      {  10,  0},    // sub-band1 up to arfcn =  10, Agc calibration = 0db
+      {  30,  0},    // sub-band2 up to arfcn =  30, Agc calibration = 0db
+      {  51,  0},    // sub-band3 up to arfcn =  51, Agc calibration = 0db
+      {  71,  0},    // etc.
+      {  90,  0},    //
+      { 112,  0},    //
+      { 124,  0},    //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// gsm850 T_LEVEL_TX
+      {486, 0, 0}, // 0
+      {486, 0, 0}, // 1
+      {486, 0, 0}, // 2
+      {486, 0, 0}, // 3
+      {486, 0, 0}, // 4
+      {486, 0, 0}, // 5 Highest power
+      {400, 1, 0}, // 6
+      {330, 2, 0}, // 7
+      {270, 3, 0}, // 8
+      {223, 4, 0}, // 9
+      {186, 5, 0}, // 10
+      {158, 6, 0}, // 11
+      {133, 7, 0}, // 12
+      {114, 8, 0}, // 13
+      {97, 9, 0}, // 14
+      {84, 10, 0}, // 15
+      {73, 11, 0}, // 16
+      {64, 12, 0}, // 17
+      {57, 13, 0}, // 18
+      {52, 14, 0}, // 19 Lowest power
+      {52, 14, 0}, // 20
+      {52, 14, 0}, // 21
+      {52, 14, 0}, // 22
+      {52, 14, 0}, // 23
+      {52, 14, 0}, // 24
+      {52, 14, 0}, // 25
+      {52, 14, 0}, // 26
+      {52, 14, 0}, // 27
+      {52, 14, 0}, // 28
+      {52, 14, 0}, // 29
+      {52, 14, 0}, // 30
+      {52, 14, 0}, // 31
+    },
+    #if(REL99 && FF_PRF)// needs proper values from RF
+    {// gsm850 levels_power_reduction
+    	{486,  0,  0}, // for uplink 1 timeslot = no power reduction ie 0,0 dB
+    	{486,  0,  0}, // for 2 uplink timeslot = reduction between 0,0 dB to 3,0 dB
+    	{486,  0,  0}, // for 3 uplink timeslot = reduction between 1,8 dB to 4,8 dB
+    	{486,  0,  0}, // for 4 uplink timselot = reduction between 3,0 dB to 6,0 dB
+	},
+    #endif
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 0
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+        },
+      {// arfcn, tx_chan_cal
+        {  554, 130 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 129 },
+        {  774, 131 },
+        {  808, 132 },
+        {  851, 134 },
+        {  870, 138 },
+        { 885, 140 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 2
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {   40, 128 }, // Calibration Table 3
+        {   80, 128 },
+        {  124, 128 },
+        {  586, 128 },
+        {  661, 128 },
+        {  736, 128 },
+        {  885, 128 },
+        { 1023, 128 }
+      }
+    },
+    { // gsm850 Power Ramp Values
+      {
+        {// Ramp-Up      #0 profile - Power Level 5
+          0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #0 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #1 profile - Power Level 6
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #1 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #2 profile - Power Level 7
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #2 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #3 profile - Power Level 8
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #3 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #4 profile - Power Level 9
+          0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #4 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #5 profile - Power Level 10
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #5 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #6 profile - Power Level 11
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #6 profile
+          255,251,238,218,191,160,127,95,64,37,
+        17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #7 profile - Power Level 12
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #7 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #8 profile - Power Level 13
+          0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #8 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #9 profile - Power Level 14
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #9 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #10 profile - Power Level 15
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #10 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #11 profile - Power Level 16
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #11 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #12 profile - Power Level 17
+          0,0,0,0,0,0,10,14,17,25,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #12 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #13 profile - Power Level 18
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #13 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #14 profile - Power Level 19
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #14 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+      {
+        {// Ramp-Up      #15 profile - Power Level 19
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+        },
+        {// Ramp-Down    #15 profile
+          255,251,238,218,191,160,127,95,64,37,
+          17,4,0,0,0,0,0,0,0,0
+        },
+      },
+    },
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+      #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_GSM850,
+};
+
+//copy from dcs1800
+const T_RF_BAND rf_1900 =
+{
+  { //RX structure
+    { //T_RX_CAL_PARAMS rx_cal_params
+      229,      //g_magic
+       54,      //lna gain * 2
+       40,      //lna_th_high
+       44       //lna_th_low
+    },
+    { //T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+     /*--------------*/
+     /*-- PCS band --*/
+     /*--------------*/
+      { 548,  0},     //
+      { 622,  0},     //
+      { 680,  0},     //
+      { 745,  0},     //
+      { 812,  0},     //
+      { 860,  0},     //
+      { 885,  0},     //
+      { 991,  0},    //
+      { 992,  0},    //
+      {1023,  0},    //
+    },
+    { //RX temperature compensation
+      { -15 ,  0  },
+      {  -5 ,  0  },
+      {   6 ,  0  },
+      {  16 ,  0  },
+      {  25 ,  0  },
+      {  35 ,  0  },
+      {  45 ,  0  },
+      {  56 ,  0  },
+      {  66 ,  0  },
+      {  75 ,  0  },
+      { 100 ,  0  }
+    }
+  },
+  { //TX structure
+    {// pcs1900 T_LEVEL_TX
+      {438, 0, 0}, // 0 Highest power
+      {380, 1, 0}, // 1
+      {310, 2, 0}, // 2
+      {255, 3, 0}, // 3
+      {213, 4, 0}, // 4
+      {180, 5, 0}, // 5
+      {152, 6, 0}, // 6
+      {130, 7, 0}, // 7
+      {112, 8, 0}, // 8
+      {98, 9, 0}, // 9
+      {87, 10, 0}, // 10
+      {77, 11, 0}, // 11
+      {68, 12, 0}, // 12
+      {60, 13, 0}, // 13
+      {53, 14, 0}, // 14
+      {48, 15, 0}, // 15 Lowest power
+      {48, 15, 0}, // 16
+      {48, 15, 0}, // 17
+      {48, 15, 0}, // 18
+      {48, 15, 0}, // 19
+      {48, 15, 0}, // 20
+      {48, 15, 0}, // 21
+      {48, 15, 0}, // 22
+      {48, 15, 0}, // 23
+      {48, 15, 0}, // 24
+      {48, 15, 0}, // 25
+      {48, 15, 0}, // 26
+      {48, 15, 0}, // 27
+      {48, 15, 0}, // 28
+      {438, 0, 0}, // 29 Highest power
+      {438, 0, 0}, // 30 Highest power
+      {438, 0, 0}, // 31 Highest power
+    },
+    #if(REL99 && FF_PRF)// needs proper values from RF
+    {// PCS1900 band levels_power_reduction
+    	{438,  0,  0}, // for uplink 1 timeslot = no power reduction ie 0,0 dB
+    	{438,  0,  0}, // for 2 uplink timeslot = reduction between 0,0 dB to 3,0 dB
+    	{438,  0,  0}, // for 3 uplink timeslot = reduction between 1,8 dB to 4,8 dB
+    	{438,  0,  0}, // for 4 uplink timselot = reduction between 3,0 dB to 6,0 dB
+	},
+    #endif
+    {// Channel Calibration Tables
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 0
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {
+        {  554, 128 }, // Calibration Table 1
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 2
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      },
+      {// arfcn, tx_chan_cal
+        {  554, 128 }, // Calibration Table 3
+        {  722, 128 },
+        {  746, 128 },
+        {  774, 128 },
+        {  808, 128 },
+        {  810, 128 },
+        {  810, 128 },
+        {  810, 128 }
+      }
+    },
+    { // PCS Power Ramp Values
+     {
+      {// Ramp-Up      #0 profile - Power Level 0
+          0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #0 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #1 profile - Power Level 1
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #1 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #2 profile - Power Level 2
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #2 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #3 profile - Power Level 3
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #3 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #4 profile - Power Level 4
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #4 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #5 profile - Power Level 5
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #5 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #6 profile - Power Level 6
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #6 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #7 profile - Power Level 7
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #7 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #8 profile - Power Level 8
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #8 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #9 profile - Power Level 9
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #9 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #10 profile - Power Level 10
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #10 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #11 profile - Power Level 11
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #11 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #12 profile - Power Level 12
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #12 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #13 profile - Power Level 13
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #13 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #14 profile - Power Level 14
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #14 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+     {
+      {// Ramp-Up      #15 profile - Power Level 15
+        0,0,0,0,0,0,10,14,21,29,
+		37,64,95,127,160,191,218,238,251,255
+      },
+      {// Ramp-Down    #15 profile
+        255,240,228,220,185,160,127,95,64,37,
+        17,14,0,0,0,0,0,0,0,0
+      },
+     },
+    },
+    { //TX temperature compensation
+      #if (ORDER2_TX_TEMP_CAL==1)
+      { -11,  0,  0,  0 },
+      {  +9,  0,  0,  0 },
+      { +39,  0,  0,  0 },
+      { +59,  0,  0,  0 },
+      { 127,  0,  0,  0 }
+      #else
+      { -11,  0 },
+      {  +9,  0 },
+      { +39,  0 },
+      { +59,  0 },
+      { 127,  0 }
+    #endif
+    },
+  },
+  //IQ swap
+  SWAP_IQ_PCS
+};
+
+
+
+
+
+UWORD16 drp_wrapper[DRP_WRAPPER_TABLE_SIZE]=
+{
+    C_APCCTRL2,
+    C_APCDEL1,
+    C_APCDEL2
+    };
+
+
+
+/*------------------------------------------*/
+/*             Gain table                   */
+/*  specified in the TRF6053 spec           */
+/*     2 dB steps - LNA always ON           */
+/*------------------------------------------*/
+UWORD16 AGC_TABLE[AGC_TABLE_SIZE] =
+{
+   ABE_0_DB,
+   ABE_0_DB,
+   ABE_2_DB,
+   ABE_2_DB,
+   ABE_2_DB,
+   ABE_5_DB,
+   ABE_5_DB,
+   ABE_5_DB,
+   ABE_8_DB,
+   ABE_8_DB,
+   ABE_8_DB,
+   ABE_11_DB,
+   ABE_11_DB,
+   ABE_11_DB,
+   ABE_14_DB,
+   ABE_14_DB,
+   ABE_14_DB,
+   ABE_17_DB,
+   ABE_17_DB,
+   ABE_17_DB,
+   ABE_20_DB,
+   ABE_20_DB,
+   ABE_20_DB,
+   ABE_23_DB
+};
+
+// structure for ADC conversion (4 Internal channel + 5 Ext channels max.)
+T_ADC adc;
+
+// MADC calibration structure
+T_ADCCAL adc_cal=
+{ // a: 0,..,8
+  // b, 0,..,8
+  // cal_a = 4*1750 is the Typical value 1.75 V ref voltage , divide by 4
+  7000, 8750, 7000, 7000, 7000, 7000, 7000, 256, 7000,
+     0,    0,    0,    0,    0,    0,   0,    0,    0
+};
+
+// table which converts ADC value into RF temperature
+const T_TEMP temperature[TEMP_TABLE_SIZE] =
+{
+  7, -35,
+  7, -34,
+  8, -33,
+  8, -32,
+  9, -31,
+  9, -30,
+  10, -29,
+  11, -28,
+  11, -27,
+  12, -26,
+  13, -25,
+  14, -24,
+  14, -23,
+  15, -22,
+  16, -21,
+  17, -20,
+  18, -19,
+  19, -18,
+  21, -17,
+  22, -16,
+  23, -15,
+  24, -14,
+  26, -13,
+  27, -12,
+  29, -11,
+  30, -10,
+  32, -9,
+  34, -8,
+  36, -7,
+  37, -6,
+  39, -5,
+  41, -4,
+  44, -3,
+  46, -2,
+  48, -1,
+  51, 0,
+  53, 1,
+  56, 2,
+  59, 3,
+  61, 4,
+  64, 5,
+  68, 6,
+  71, 7,
+  74, 8,
+  78, 9,
+  81, 10,
+  85, 11,
+  89, 12,
+  93, 13,
+  97, 14,
+  101, 15,
+  105, 16,
+  110, 17,
+  115, 18,
+  119, 19,
+  124, 20,
+  130, 21,
+  135, 22,
+  140, 23,
+  146, 24,
+  152, 25,
+  158, 26,
+  164, 27,
+  170, 28,
+  176, 29,
+  183, 30,
+  190, 31,
+  197, 32,
+  204, 33,
+  211, 34,
+  219, 35,
+  226, 36,
+  234, 37,
+  242, 38,
+  250, 39,
+  259, 40,
+  267, 41,
+  276, 42,
+  285, 43,
+  294, 44,
+  303, 45,
+  312, 46,
+  322, 47,
+  331, 48,
+  341, 49,
+  351, 50,
+  361, 51,
+  371, 52,
+  382, 53,
+  392, 54,
+  403, 55,
+  413, 56,
+  424, 57,
+  435, 58,
+  446, 59,
+  458, 60,
+  469, 61,
+  480, 62,
+  492, 63,
+  503, 64,
+  515, 65,
+  527, 66,
+  539, 67,
+  550, 68,
+  562, 69,
+  574, 70,
+  586, 71,
+  598, 72,
+  611, 73,
+  623, 74,
+  635, 75,
+  647, 76,
+  659, 77,
+  671, 78,
+  683, 79,
+  696, 80,
+  708, 81,
+  720, 82,
+  732, 83,
+  744, 84,
+  756, 85,
+  768, 86,
+  780, 87,
+  792, 88,
+  804, 89,
+  816, 90,
+  827, 91,
+  839, 92,
+  851, 93,
+  862, 94,
+  873, 95
+};
+
+
+/*------------------------------------------*/
+/* ABB Initialization words                 */
+/*------------------------------------------*/
+#if (ANLG_FAM == 11)
+ UWORD8 abb[ABB_TABLE_SIZE] =
+{
+    C_VULGAIN,
+    C_VDLGAIN,
+    C_SIDETONE,
+    C_CTRL1,
+    C_CTRL2,
+    C_CTRL3,
+    C_CTRL4,
+    C_CTRL5,
+    C_CTRL6,
+    C_POPAUTO,
+    C_OUTEN1,
+    C_OUTEN2,
+    C_OUTEN3,
+    C_AULGA,
+    C_AURGA
+};
+#endif
+
+#if (L1_FF_MULTIBAND == 0)
+#else
+/* The physical RF bands are enumerated in order of increasing frequencies */
+/* The same order must be used in l1_rf61, l1_cust, and l1_const */
+const T_MULTIBAND_RF multiband_rf[RF_NB_SUPPORTED_BANDS + 1] =
+{
+ /*power_class, tx_turning_point, max_txpwr, gsm_band_identifier, name*/
+#if (GSM900_SUPPORTED == 1)
+  { 4,           0,                19,        RF_GSM900,              "900"},
+#endif /* if(GSM900_SUPPORTED == 1)*/
+#if (GSM850_SUPPORTED == 1)
+  { 4,          0,                19,        RF_GSM850,              "850"},
+#endif /*if (GSM850_SUPPORTED == 1)*/
+#if (DCS1800_SUPPORTED == 1)
+  { 1,          28,               15,        RF_DCS1800,             "1800"},
+#endif /*if (DCS1800_SUPPORTED == 1)*/
+#if (PCS1900_SUPPORTED == 1)
+  {1,           21,               15,        RF_PCS1900,             "1900"},
+#endif /*if (PCS1900_SUPPORTED == 1)*/
+} ;
+
+/* Array for mapping from subband index into physical band index */
+const WORD8 rf_subband2band[RF_NB_SUBBANDS] =
+{
+#if (GSM900_SUPPORTED == 1)
+  RF_GSM900,
+  RF_GSM900,
+#endif
+#if (GSM850_SUPPORTED == 1)
+  RF_GSM850,
+#endif
+#if (DCS1800_SUPPORTED == 1)
+  RF_DCS1800,
+#endif
+#if (PCS1900_SUPPORTED == 1)
+  RF_PCS1900,
+#endif
+};
+
+const T_MULTIBAND_CONVERT multiband_convert[RF_NB_SUBBANDS] =
+{ /*first_rf_freq,   last_rf_freq,                  first_l1_freq,    l1freq2rffreq */
+#if (GSM900_SUPPORTED == 1)
+ { RF_FREQ_1ST_900L, RF_FREQ_1ST_900L+NB_CHAN_900L, L1_FREQ_1ST_900L, RF_FREQ_1ST_900L-L1_FREQ_1ST_900L},
+ { RF_FREQ_1ST_900H, RF_FREQ_1ST_900H+NB_CHAN_900H, L1_FREQ_1ST_900H, RF_FREQ_1ST_900H-L1_FREQ_1ST_900H},
+#endif
+#if (GSM850_SUPPORTED == 1)
+ { RF_FREQ_1ST_850, RF_FREQ_1ST_850+NB_CHAN_850, L1_FREQ_1ST_850,  RF_FREQ_1ST_850-L1_FREQ_1ST_850},
+#endif
+#if (DCS1800_SUPPORTED == 1)
+ { RF_FREQ_1ST_1800, RF_FREQ_1ST_1800+NB_CHAN_1800, L1_FREQ_1ST_1800, RF_FREQ_1ST_1800-L1_FREQ_1ST_1800},
+#endif
+#if (PCS1900_SUPPORTED == 1)
+ { RF_FREQ_1ST_1900, RF_FREQ_1ST_1900+NB_CHAN_1900, L1_FREQ_1ST_1900, RF_FREQ_1ST_1900-L1_FREQ_1ST_1900},
+#endif
+};
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_l1subband                        */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+/* Return     : The l1 subband index l1freq belongs to   */
+/*                                                       */
+/* Functionality : compare l1freq with the band ranges,  */
+/*      return the l1 band index where match is found     */
+ /*-------------------------------------------------------*/
+UWORD8 rf_convert_l1freq_to_l1subband(UWORD16 l1_freq)
+{
+  WORD32 subband_idx;
+  for(subband_idx = RF_NB_SUBBANDS -1; subband_idx>=0; subband_idx--)
+  {
+    if(l1_freq >= multiband_convert[subband_idx].first_l1_freq)
+      return ((UWORD8)subband_idx);
+  }
+  l1_multiband_error_handler(l1_freq);
+  return 0;
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_rffreq_to_l1subband                        */
+/*-------------------------------------------------------*/
+/* Parameters : rffreq, the physical rf freq channel     */
+/*              number to convert                        */
+/*                                                       */
+/* Return     : The l1 subband index rf_freq belongs to  */
+/*                                                       */
+/* Functionality : compare rf_freq with the band ranges,  */
+/*      return the l1 band index where match is found     */
+ /*-------------------------------------------------------*/
+UWORD8 rf_convert_rffreq_to_l1subband(UWORD16 rf_freq)
+{
+  WORD32 subband_idx;
+  for(subband_idx = RF_NB_SUBBANDS -1; subband_idx>=0; subband_idx--)
+  {
+    if((rf_freq >= multiband_convert[subband_idx].first_rf_freq)&&
+      (rf_freq < multiband_convert[subband_idx].last_rf_freq))
+      return ((UWORD8)subband_idx);
+  }
+  l1_multiband_error_handler(rf_freq);
+  return 0;
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_band_idx                         */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+/* Return     : The physical index of the band of l1freq */
+/*                                                       */
+/* Functionality : compare l1freq with the band ranges,  */
+/*      return the rf_band_index of the l1_band_index    */
+/*      where match is found                             */
+ /*-------------------------------------------------------*/
+WORD8 rf_convert_l1freq_to_rf_band_idx(UWORD16 l1_freq)
+{
+  return rf_subband2band[rf_convert_l1freq_to_l1subband(l1_freq)];
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_rffreq                            */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+ /* Return    : ARFCN, absolute radio frequency channel  */
+/*             number and in *bandidx the band index     */
+/* Functionality : identify band index and look up ARFCN */
+/*-------------------------------------------------------*/
+UWORD16 rf_convert_l1freq_to_rffreq(UWORD16 l1_freq )
+{
+  WORD32 subband_idx = rf_convert_l1freq_to_l1subband(l1_freq);
+  return(l1_freq+multiband_convert[subband_idx].l1freq2rffreq);
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_arfcn_and_bandidx                */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+ /* Return    : ARFCN, absolute radio frequency channel  */
+/*             number and in *bandidx the RF band index  */
+/* Functionality : identify band index and look up ARFCN */
+/*-------------------------------------------------------*/
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_rffreq_and_bandidx                */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+ /* Return    : ARFCN, absolute radio frequency channel  */
+/*             number and in *bandidx the band index     */
+/* Functionality : identify band index and look up ARFCN */
+/*-------------------------------------------------------*/
+UWORD16 rf_convert_l1freq_to_rffreq_rfband(UWORD16 l1_freq, WORD8 *rf_band_index)
+{
+  WORD32 subband_idx = rf_convert_l1freq_to_l1subband(l1_freq);
+  *rf_band_index = rf_subband2band[subband_idx];
+  return(l1_freq+multiband_convert[subband_idx].l1freq2rffreq);
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_l1freq_to_arfcn_and_bandidx                */
+/*-------------------------------------------------------*/
+/* Parameters : l1freq, the l1 radio_freq to convert     */
+/*                                                       */
+ /* Return    : ARFCN, absolute radio frequency channel  */
+/*             number and in *bandidx the RF band index  */
+/* Functionality : identify band index and look up ARFCN */
+/*-------------------------------------------------------*/
+UWORD16 rf_convert_l1freq_to_arfcn_rfband(UWORD16 l1_freq, WORD8 *rf_band_index)
+{
+  WORD32 subband_idx = rf_convert_l1freq_to_l1subband(l1_freq);
+  *rf_band_index = rf_subband2band[subband_idx];
+#if (PCS1900_SUPPORTED)
+  if(RF_PCS1900 == rf_subband2band[subband_idx])
+    return(l1_freq+multiband_convert[subband_idx].l1freq2rffreq-512);
+  else
+#endif
+    return(l1_freq+multiband_convert[subband_idx].l1freq2rffreq);
+}
+
+UWORD16 rf_convert_rffreq_to_l1freq(UWORD16 rf_freq)
+{
+  WORD32 subband_idx = rf_convert_rffreq_to_l1subband(rf_freq);
+  return(rf_freq - multiband_convert[subband_idx].l1freq2rffreq);
+}
+
+/*-------------------------------------------------------*/
+/* rf_convert_rffreq_to_l1freq_rfband                    */
+/*-------------------------------------------------------*/
+/* Parameters : rffreq, the physical rf channel number   */
+/*              to convert                               */
+/*                                                       */
+ /* Return    : l1freq, l1 internal frequency number     */
+/*             and in *bandidx the RF band index         */
+/* Functionality : identify band index and look up ARFCN */
+/*-------------------------------------------------------*/
+UWORD16 rf_convert_rffreq_to_l1freq_rfband(UWORD16 rf_freq, WORD8 *rf_band_index)
+{
+  WORD32 subband_idx = rf_convert_rffreq_to_l1subband(rf_freq);
+  *rf_band_index = (WORD8)subband_idx;
+  return(rf_freq - multiband_convert[subband_idx].l1freq2rffreq);
+}
+
+#if(PCS1900_SUPPORTED)
+extern UWORD16 tm_std_band;
+#endif
+UWORD16 rf_convert_tmarfcn_to_l1freq(UWORD16 tm_arfcn, WORD8 *error_flag)
+{
+  *error_flag = 0;
+#if(GSM900_SUPPORTED)
+  if(NB_CHAN_900L> tm_arfcn)
+    return (tm_arfcn + L1_FREQ_1ST_900L- RF_FREQ_1ST_900L);
+  if((ARFCN_1ST_900H <= tm_arfcn)&&(ARFCN_1ST_900H + NB_CHAN_900H > tm_arfcn))
+    return (tm_arfcn + L1_FREQ_1ST_900H- RF_FREQ_1ST_900H);
+#endif
+#if(GSM850_SUPPORTED)
+  if((ARFCN_1ST_850 <= tm_arfcn)||(ARFCN_1ST_850+NB_CHAN_850 > tm_arfcn))
+    return(tm_arfcn + L1_FREQ_1ST_850- RF_FREQ_1ST_850);
+#endif
+#if(PCS1900_SUPPORTED)
+  if((RF_FREQ_1ST_1900<=tm_arfcn)&&((RF_FREQ_1ST_1900+NB_CHAN_1900)>tm_arfcn))
+    return (tm_arfcn + L1_FREQ_1ST_1900 - RF_FREQ_1ST_1900); /* PCS RF_FREQ format */
+  if(((3 == (tm_std_band & 0xff))||(8==(tm_std_band & 0xff))) &&
+    (ARFCN_1ST_1900 <= tm_arfcn) && (ARFCN_1ST_1900+NB_CHAN_1900 > tm_arfcn))
+    return(tm_arfcn+L1_FREQ_1ST_1900-ARFCN_1ST_1900); /* PCS Legacy compatible*/
+  if((1000+ARFCN_1ST_1900 <= tm_arfcn)&&
+    (1000+ARFCN_1ST_1900+NB_CHAN_1900 >= tm_arfcn))
+    return(tm_arfcn+L1_FREQ_1ST_1900-ARFCN_1ST_1900-1000); /*ARFCN+1000 format*/
+#endif
+#if(DCS1800_SUPPORTED)
+    if((ARFCN_1ST_1800 <= tm_arfcn)||(ARFCN_1ST_1800+NB_CHAN_1800 > tm_arfcn))
+      return(tm_arfcn + L1_FREQ_1ST_1800- RF_FREQ_1ST_1800);
+#endif
+  *error_flag = 1;
+  return (tm_arfcn);
+}
+#endif// if(L1_FF_MULTIBAND == 1)
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gsm-fw/L1/cust1/l1_rf61.h	Thu Jul 10 03:43:04 2014 +0000
@@ -0,0 +1,577 @@
+/************* Revision Controle System Header *************
+ *                  GSM Layer 1 software
+ *
+ *        Filename l1_rf61.h
+ *        Version  1.0
+ *        Date     June 16th, 2005
+ *
+ ************* Revision Controle System Header *************/
+
+#ifndef __L1_RF_H__
+#define __L1_RF_H__
+
+#if (ANLG_FAM == 11)
+#include "bspTwl3029_Madc.h"
+#endif
+
+#define RF_LOCOSTO 0x2050 // Check with TIDK
+
+//LNA Specific BAND Index Settings
+#define RF_QUADBAND 0 //Default Setting 850, EGSM,DCS,PCS
+#define RF_EU_TRIBAND 1 //  EGSM,DCS,PCS
+#define RF_EU_DUALBAND 2 //  EGSM,DCS
+#define RF_US_TRIBAND 3  // 850,DCS,PCS
+#define RF_US_DUALBAND 4 //850, PCS
+#define RF_PCS1900_900_DUALBAND 5 // EGSM, PCS
+#define RF_DCS1800_850_DUALBAND 6 //850, DCS
+
+#define RF_BAND_SYSTEM_INDEX RF_QUADBAND //for other PCB's Please redefine here.
+#define RF_LNA_MASK 0x0003 // Reuse last 2 bits from
+
+//End LNA Changes
+
+//#define RF_HW_BAND_EGSM
+//#define RF_HW_BAND_DCS
+#define RF_HW_BAND_PCS 0x4
+#define RF_HW_BAND_DUAL_US  0x80
+#define RF_HW_BAND_DUAL_EXT 0x20
+#define RF_HW_BAND_SUPPORT (RF_HW_BAND_DUAL_EXT)
+
+/************************************/
+/* SYNTHESIZER setup time... */
+/************************************/
+#define RX_SYNTH_SETUP_TIME (PROVISION_TIME - TRF_R1) //RX Synthesizer setup time in qbit.
+#define TX_SYNTH_SETUP_TIME (- TRF_T1)               //TX Synthesizer setup time in qbit.
+
+/************************************/
+/* Time for TPU scenario ending...  */
+/************************************/
+//
+// The following values are used to take into account any TPU activity AFTER
+// BDLON (or BDLENA) down (for RX) and BULON down (for TX)
+// - If there are no TPU commands after BDLON (or BDLENA) down and BULON down,
+//   these defines must be ZERO
+// - If there IS some TPU command after BDLON (or BDLENA) and BULON down,
+//   these defines must be equal to the time difference (in qbits) between
+//   the BDLON (or BDLENA) or BULON time and the last TPU command on
+//   the TPU scenario
+#define RX_TPU_SCENARIO_ENDING  6   // execution time of AFTER BDLENA down	   last value : 0
+#define TX_TPU_SCENARIO_ENDING  0   // execution time of AFTER BULON down	   last value : 14
+
+
+/******************************************************/
+/* TXPWR configuration...                             */
+/* Fixed TXPWR value when GSM management is disabled. */
+/******************************************************/
+#if ( ANLG_FAM == 11)
+  #define FIXED_TXPWR       0x5C // TXPWR=500 for the moment...change later TEMP_FIX
+#endif
+
+
+/************************************/
+/* RF  delay (in qbits)             */
+/************************************/
+#define  DL_DELAY_RF      0   // time spent in the Downlink global RF chain by the modulated signal
+#define  UL_DELAY_1RF     0   // time spent in the first  uplink RF block
+#define  UL_DELAY_2RF     0   // time spent in the second uplink RF block
+
+#define  UL_ABB_DELAY   12   // 12 for RF output DELAY
+
+#define GUARD_BITS 5
+
+/************************************/
+/* TX Propagation delay...          */
+/************************************/
+#define  PRG_TX       (DL_DELAY_RF + UL_DELAY_2RF + (GUARD_BITS*4) + UL_DELAY_1RF + UL_ABB_DELAY)   // = 50
+
+/************************************/
+/* Initial value for APC DELAY     */
+/************************************/
+#define APCDEL_DOWN     (0)                        // To add this value, the setup delay minimum value: 2	  last value : 0
+//SG #define APCDEL_UP       (12)
+#define APCDEL_UP       (0)                        //To add this value, the setup delay minimum value: 6
+#define C_APCDEL1       (((APCDEL_DOWN & 0x1f)<<5)  |(APCDEL_UP & 0x1f) )
+#define C_APCDEL2       (((APCDEL_DOWN & 0x3e0)) |((APCDEL_UP>>5) & 0x1f) )
+
+
+/************************************/
+/* Initial value for AFC...         */
+/************************************/
+#define  EEPROM_AFC    ((150)*8)    // F14.2 required!!!!! (default : -952*8, initial deviation of -2400 forced)
+
+#if(CHIPSET == 15)
+	#define  SETUP_AFC_AND_RF     0
+#else
+	#define  SETUP_AFC_AND_RF     6       // AFC converges in 2 frames and RF BAND GAP stable after 4 frames
+#endif
+#define  C_DRP_DCXO_XTAL_DSP_ADDRESS   0x7F80  // DRP DCXO XTAL DSP address
+
+/************************************/
+/* DCO Registers Initialization      */
+/************************************/
+#define C_DCO_SAMPLES_PER_SYMBOL  1
+/* The basic frequency table in DSP is approximately 2.115KHz (26MHZ/(512*24))
+ * The FCW value needs to intended IF Frequency / 2.115KHZ.
+ * Hence since IF is 100KFZ, FCW = 100 / 2.115 ~= 47 */
+#define C_DCO_FCW                 47
+
+/***************************************************************
+ * Threshold between LIF_100 KHZ (at high power levels) and
+ * LIF_120KHz (at low power level)
+ * the threshold defintion for GSM and GPRS is as given below
+ * ************************************************************ */
+#define C_IF_ZERO_LOW_THRESHOLD_GSM   180  // if IL < -90dbm use Zero IF else Low IF STd L1 format
+#define C_IF_ZERO_LOW_THRESHOLD_GPRS   180  // if IL < -90dbm use Zero IF else Low IF STd L1 format
+
+/* Since CSF filter coefficients are changed in accordance with GENIE
+ * algorithm, below are values programmed in DRP to select HW/SW CSF filter */
+#define CSF_CWL_HARDWARE_FILTER_64TAP      0x0100
+#define CSF_CWL_PROGRAMMABLE_FILTER_64TAP  0x0000
+
+/* Below are the attenuation losses to be compensated for LIF_100KHZ and LIF_120KHZ Path
+ * !!!! Note: The below attenuations are applicable when ROC is enabled  !!!! */
+#define SCF_ATTENUATION_LIF_100KHZ  (0) /* value of 0 represents 0dB attenuation as per L1 F7.1 format */
+#define SCF_ATTENUATION_LIF_120KHZ  (1) /* value of 1 represents 0.5dB attenuation */
+#define SCF_ATTENUATION_ZIF         (0) /* No attenuation when ZIF mode is used */
+
+
+/************************************/
+/* DRP Retiming Related             */
+/************************************/
+#define C_RETIMING_DISABLED 0x0
+#define C_RETIMING_ENABLED  0x1
+
+#define C_RETIMING_CONFIG C_RETIMING_DISABLED
+
+/*************************************/
+/*      DRP WRAPPER Initialization   */
+/*************************************/
+#define C_APCCTRL2             0x05C8   // BGEN=1, APCOFF=64, APC_LDO_EN=0, MODE=0
+// SG #define C_APCCTRL2             0x01FC
+#define DRP_DBB_RX_IRQ_COUNT   16
+
+#define TTY_L1_STANDALONE 0
+
+/************************************/
+/* Triton audio initialize          */
+/************************************/
+#if (ANLG_FAM == 11)
+#if (TTY_L1_STANDALONE == 1)
+  #define  C_VULGAIN       0x10 // -12dB
+//  #define  C_VULGAIN       0x09 // voice uplink gain set to 7dB
+  #define  C_SIDETONE      0x0d // -23dB
+//  #define  C_SIDETONE      0x0f // side tone set to MUTE
+  #define  C_VDLGAIN       0x4c //
+//  #define  C_VDLGAIN       0x2c // set PGA gain to 2dB
+  #define  C_CTRL1         0x30 // MicBias = 1, DL Filter Bypass
+//  #define  C_CTRL1         0x00 // VSYNC = 1, reset Dig Modulator, VSP, Digital filter
+  #define  C_CTRL2         0x10 //
+//  #define  C_CTRL2         0x00 // reset value
+  #define  C_CTRL3         0x25 // MIC IN (diff), MICIP, MICIN. Amplifier: MIC AMP, Gain = 25.6 dB, SPKAMP = +2.5 dB
+  #define  C_CTRL4         0x00 // reset value
+  #define  C_CTRL5         0x28 // SAMP FREQ = 48Khz, EARAMP = 1 dB
+  #define  C_CTRL6         0x00 // reset value
+  #define  C_POPAUTO       0x01 // POPmode set to/Automatic mode
+  #define  C_OUTEN1        0x12 // Audio left/Audio Mono, Audio Right/ Audio mono
+  #define  C_OUTEN2        0x05 // EAR= voice speech, AUXO = voice speech
+  #define  C_OUTEN3        0x01 // SPK = voice speech
+  #define  C_AULGA         0x00 // reset value
+  #define  C_AURGA         0x00 // reset value
+#else
+  #define  C_VULGAIN       0x09 // voice uplink gain set to 7dB
+  #define  C_SIDETONE      0x06 // side tone set to MUTE
+  #define  C_VDLGAIN       0x2c // set PGA gain to 2dB
+  #define  C_CTRL1         0x00 // VSYNC = 1, reset Dig Modulator, VSP, Digital filter
+  #define  C_CTRL2         0x00 // reset value
+  #define  C_CTRL3         0x21 // MIC IN (diff), MICIP, MICIN. Amplifier: MIC AMP, Gain = 25.6 dB, SPKAMP = +2.5 dB
+  #define  C_CTRL4         0x00 // reset value
+  #define  C_CTRL5         0x28 // SAMP FREQ = 48Khz, EARAMP = 1 dB
+  #define  C_CTRL6         0x00 // reset value
+  #define  C_POPAUTO       0x01 // POPmode set to/Automatic mode
+  #define  C_OUTEN1        0x24 // Audio left/Audio Mono, Audio Right/ Audio mono
+  #define  C_OUTEN2        0x01 // EAR= voice speech, AUXO = voice speech
+  #define  C_OUTEN3        0x01 // SPK = voice speech
+  #define  C_AULGA         0x00 // reset value
+  #define  C_AURGA         0x00 // reset value
+#endif   //(L1_GTT == 1)
+#endif   //(ANLG_FAM == 11)
+
+/************************************/
+/* Automatic frequency compensation */
+/************************************/
+/********************* C_Psi_sta definition *****************************/
+/* C_Psi_sta = (2*pi*Fr)        / (N * Fb)                              */
+/*      (1)  = (2*pi*V*ppm*0.9) / (N*V*Fb)                              */
+/*           regarding Vega V/N   = 2.4/4096                            */
+/*           regarding VCO  ppm/V = 16 / 1   (average slope of the VCO) */
+/*      (1)  = (2*pi*2.4*16*0.9) / (4096*1*270.83)                      */
+/*           = 0.000195748                                              */
+/* C_Psi_sta_inv = 1/C_Psi_sta = 5108                                   */
+/************************************************************************/
+#define  C_Psi_sta_inv    6142L		// 12902L    // (1/C_Psi_sta)
+#define  C_Psi_st         9L		// 4L        // C_Psi_sta * 0.8 F0.16
+#define  C_Psi_st_32      559386L	// 266313L  // F0.32
+#define  C_Psi_st_inv     7678L		// 16128L   // (1/C_Psi_st)
+
+#if (VCXO_ALGO == 1)
+// Linearity parameters
+  #define  C_AFC_DAC_CENTER     ((4264))	//((-1242)*8)
+  #define  C_AFC_DAC_MIN        ((-11128))	//((-2000)*8)
+  #define  C_AFC_DAC_MAX        ((19656))	//((1419)*8)
+  #define  C_AFC_SNR_THR        2560     //  1/0.4    * 2**10
+#endif
+
+typedef struct
+{
+  WORD16  eeprom_afc;
+  UWORD32 psi_sta_inv;
+  UWORD32 psi_st;
+  UWORD32 psi_st_32;
+  UWORD32 psi_st_inv;
+
+  #if (VCXO_ALGO)
+  // VCXO adjustment parameters
+  // Parameters used when assuming linearity
+  WORD16  dac_center;
+  WORD16  dac_min;
+  WORD16  dac_max;
+  WORD16  snr_thr;
+#endif
+}
+T_AFC_PARAMS;
+
+/************************************/
+/* Swap IQ definitions...           */
+/************************************/
+/* 0=No Swap, 1=Swap RX only, 2=Swap TX only, 3=Swap RX and TX */
+#define  SWAP_IQ_GSM    0
+#define  SWAP_IQ_DCS    0
+#define  SWAP_IQ_PCS    0
+#define  SWAP_IQ_GSM850 0   // Swap TX compared to GSM 900
+
+#define LNA_OFF (1)
+#define LNA_ON (0)
+/************************************/
+/************************************/
+// typedef
+/************************************/
+/************************************/
+
+/*************************************************************/
+/* Define structure for apc of TX Power                 ******/
+/*************************************************************/
+typedef struct
+{ // pcm-file "rf/tx/level.gsm|dcs"
+  UWORD16 apc;            // 0..31
+  UWORD8  ramp_index;     // 0..RF_TX_RAMP_SIZE
+  UWORD8  chan_cal_index; // 0..RF_TX_CHAN_CAL_TABLE_SIZE
+}
+T_TX_LEVEL;
+
+/************************************/
+/* Automatic Gain Control           */
+/************************************/
+/* Define structure for sub-band definition of TX Power ******/
+typedef struct
+   {
+   UWORD16   upper_bound;    //highest physical arfcn of the sub-band
+   WORD16    agc_calib;      // AGC  for each TXPWR
+   } T_RF_AGC_BAND;
+
+/************************************/
+/*       Ramp definitions           */
+/************************************/
+
+  typedef struct
+  {
+    UWORD8 ramp_up     [20];  // Ramp-up profile
+    UWORD8 ramp_down   [20];  // Ramp-down profile
+  }
+  T_TX_RAMP;
+
+
+// RF structure definition
+//========================
+#if (L1_FF_MULTIBAND == 0)
+// Number of bands supported
+#define GSM_BANDS 2
+
+#define MULTI_BAND1     0
+#define MULTI_BAND2     1
+#else
+#endif
+
+// RF table sizes
+#define RF_RX_CAL_CHAN_SIZE 10 // number of AGC sub-bands
+#define RF_RX_CAL_TEMP_SIZE 11 // number of temperature ranges
+
+#define RF_TX_CHAN_CAL_TABLE_SIZE  4 // channel calibration table size
+#define RF_TX_NUM_SUB_BANDS        8 // number of sub-bands in channel calibration table
+#define RF_TX_LEVELS_TABLE_SIZE   32 // level table size
+#define RF_TX_RAMP_SIZE           16 // number of ramp definitions
+#define RF_TX_CAL_TEMP_SIZE        5 // number of temperature ranges
+
+#define AGC_TABLE_SIZE            24
+#define MIN_AGC_INDEX              0  // size step for AGC table
+
+#define TEMP_TABLE_SIZE          131 // number of elements in ADC->temp conversion table
+#if (REL99 && FF_PRF)
+  #define MAX_UPLINK_TIME_SLOT     4 // max number of time slot in uplink
+#endif
+
+
+// RX parameters and tables
+//-------------------------
+
+// AGC parameters and tables
+typedef struct
+{
+  UWORD16 low_agc_noise_thr;
+  UWORD16 high_agc_sat_thr;
+  UWORD16 low_agc;
+  UWORD16 high_agc;
+  UWORD8  il2agc_pwr[121];
+  UWORD8  il2agc_max[121];
+  UWORD8  il2agc_av[121];
+}
+T_AGC;
+
+// Calibration parameters
+typedef struct
+{
+  UWORD16 g_magic;
+  UWORD16 lna_att;
+  UWORD16 lna_switch_thr_low;
+  UWORD16 lna_switch_thr_high;
+}
+T_RX_CAL_PARAMS;
+
+// RX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  WORD16 agc_calib;
+}
+T_RX_TEMP_COMP;
+
+// RF RX structure
+typedef struct
+{
+  T_AGC              agc;
+}
+T_RF_RX; //common
+
+// RF RX structure
+typedef struct
+{
+  T_RX_CAL_PARAMS rx_cal_params;
+  T_RF_AGC_BAND   agc_bands[RF_RX_CAL_CHAN_SIZE];
+  T_RX_TEMP_COMP  temp[RF_RX_CAL_TEMP_SIZE];
+}
+T_RF_RX_BAND;
+
+
+// TX parameters and tables
+//-------------------------
+
+// TX temperature compensation
+typedef struct
+{
+  WORD16 temperature;
+  #if (ORDER2_TX_TEMP_CAL==1)
+  WORD16 a;
+  WORD16 b;
+  WORD16 c;
+  #else
+  WORD16 apc_calib;
+  #endif
+}
+T_TX_TEMP_CAL;
+
+// Ramp up and ramp down delay
+typedef struct
+{
+  UWORD16 up;
+  UWORD16 down;
+}
+T_RAMP_DELAY;
+
+typedef struct
+{
+  UWORD16 arfcn_limit;
+  WORD16  chan_cal;
+}
+T_TX_CHAN_CAL;
+
+// RF TX structure
+typedef struct
+{
+  T_RAMP_DELAY   ramp_delay;
+  UWORD8         guard_bits;  // number of guard bits needed for ramp up
+  UWORD8         prg_tx;
+}
+T_RF_TX; //common
+
+// RF TX structure
+typedef struct
+{
+  T_TX_LEVEL           levels[RF_TX_LEVELS_TABLE_SIZE];
+  #if (REL99 && FF_PRF)
+    T_TX_LEVEL         levels_power_reduction[MAX_UPLINK_TIME_SLOT];
+  #endif
+  T_TX_CHAN_CAL  chan_cal_table[RF_TX_CHAN_CAL_TABLE_SIZE][RF_TX_NUM_SUB_BANDS];
+  T_TX_RAMP            ramp_tables[RF_TX_RAMP_SIZE];
+  T_TX_TEMP_CAL        temp[RF_TX_CAL_TEMP_SIZE];
+}
+T_RF_TX_BAND;
+
+// band structure
+typedef struct
+{
+  T_RF_RX_BAND  rx;
+  T_RF_TX_BAND  tx;
+  UWORD8        swap_iq;
+}
+T_RF_BAND;
+
+// RF structure
+typedef struct
+{
+  // common for all bands
+  UWORD16      rf_revision;
+  UWORD16      radio_band_support;
+  T_RF_RX      rx;
+  T_RF_TX      tx;
+  T_AFC_PARAMS afc;
+}
+T_RF;
+
+/************************************/
+/*       MADC definitions           */
+/************************************/
+// TRITON: 5 external channels
+enum ADC_INDEX {
+  ADC_ADIN1,
+  ADC_ADIN2,
+  ADC_ADIN3,
+  ADC_BATT_TYPE,
+  ADC_BTEMP,
+  ADC_USBVBUS   ,
+  ADC_VBKP,
+  ADC_ICHG,
+  ADC_VCHG,
+  ADC_VBAT,
+  ADC_HOTDIE   ,
+  ADC_RFTEMP,
+  ADC_INDEX_END // ADC_INDEX_END must be the end of the enums
+};
+
+
+typedef struct
+{
+    WORD16 converted[ADC_INDEX_END]; // converted
+    UWORD16 raw[ADC_INDEX_END];       // raw from ADC
+}
+T_ADC;
+
+
+/************************************/
+/*       MADC calibration           */
+/************************************/
+typedef struct
+{
+   UWORD16 a[ADC_INDEX_END];
+   WORD16 b[ADC_INDEX_END];
+}
+T_ADCCAL;
+
+// Conversion table: ADC value -> temperature
+typedef struct
+{
+    UWORD16 adc;  // ADC reading is 10 bits
+    WORD16  temp; // temp is in approx. range -30..+80
+}
+T_TEMP;
+
+typedef struct
+{
+    char *name;
+    void *addr;
+    int  size;
+}
+T_CONFIG_FILE;
+
+#if (L1_FF_MULTIBAND == 0)
+
+    typedef struct
+    {
+      char      *name;         // name of ffs file suffix
+      T_RF_BAND *addr;         // address to default flash structure
+      UWORD16   max_carrier;  // max carrier
+      UWORD16   max_txpwr;    // max tx power
+    }
+    T_BAND_CONFIG;
+
+typedef struct
+{
+  UWORD8  band[GSM_BANDS]; // index to band address
+  UWORD8  txpwr_tp; // tx power turning point
+  UWORD16 first_arfcn;  // first index
+}
+T_STD_CONFIG;
+
+enum GSMBAND_DEF
+{
+  BAND_NONE,
+  BAND_EGSM900,
+  BAND_DCS1800,
+  BAND_PCS1900,
+  BAND_GSM850,
+  // put new bands here
+  BAND_GSM900  //last entry
+};
+#endif // L1_FF_MULTIBAND == 0
+
+/************************************/
+/* ABB (TRITON) Initialization       */
+/************************************/
+
+/* ABB_TABLE_SIZE definitions for Triton */
+#if (ANLG_FAM == 11)
+   #define ABB_TABLE_SIZE 15
+#endif
+
+/* ABB enum definitions for TRITON */
+#if (ANLG_FAM == 11)
+  enum ABB_REGISTERS {
+    ABB_VULGAIN = 0,
+    ABB_VDLGAIN,
+    ABB_SIDETONE,
+    ABB_CTRL1,
+    ABB_CTRL2,
+    ABB_CTRL3,
+    ABB_CTRL4,
+    ABB_CTRL5,
+    ABB_CTRL6,
+    ABB_POPAUTO,
+    ABB_OUTEN1,
+    ABB_OUTEN2,
+    ABB_OUTEN3,
+    ABB_AULGA,
+    ABB_AURGA
+  };
+#endif
+
+/*************************************/
+/*      DRP WRAPPER Table            */
+/*************************************/
+ #define DRP_WRAPPER_TABLE_SIZE 3
+
+enum DRP_WRAPPER_REGISTERS {
+    DRP_WRAPPER_APCCTRL2 = 0,
+    DRP_WRAPPER_APCDEL1,
+    DRP_WRAPPER_APCDEL2
+};
+
+extern T_RF_BAND rf_band[];
+#endif //__L1_RF_H