⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l1_cust.c_traceversion

📁 是一个手机功能的模拟程序
💻 C_TRACEVERSION
📖 第 1 页 / 共 4 页
字号:
/************* 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)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -