www.pudn.com > drivers.rar > ffspcm.c


/* 
 * Flash File System (ffs) 
 * 
 * WCP PCM Compatibility Support 
 */ 
 
#include  
#include "sys_types.h" 
#include "memif/mem.h" 
#include "ffs/ffs_api.h" 
#include "ffs/ffspcm.h" 
#include "nucleus.h" 
#if (CHIPSET!=15) 
#include "csmi/csmi.h" 
#include "csmi/csmi_gsmctrl.h" 
#endif 
#include "ffs/pcm.h" 
 
 
// DAR debug file 
char DAR_DebugFile[DAR_DEBUG_FILE_LENGTH]; 
 
/* 
 * 
 * ffs_InitRFCap 
 *  
 * Purpose  : Set rfcap for tri-band config 
 * 
 * Arguments: In : none 
 *                  
 *            Out: none 
 * 
 * Returns  : none 
 * 
 */ 
 
#define SIZE_EF_RFCAP	16 
 
// BUG 16054 in Layer 1 prevents from using quadband AND VCXO algorithm at the same time 
// we can temporarily use a triple band rfcap in the meantime if needed 
// 
// static const UBYTE rfcap_TriBand[SIZE_EF_RFCAP] =     {0x00, 0x0F, 0x41, 0x10, 0x00, 0x00, 0x00, 0x00, \ 
//                                                        0x50, 0x00, 0x00, 0xA5, 0x05, 0x00, 0xC0, 0x00}; 
 
#if (BOARD == 46) /* Edge capability */ 
static const UBYTE rfcap_QuadBand[SIZE_EF_RFCAP] =  {0x00, 0x1F, 0x41, 0x14, 0x0A, 0x00, 0x00, 0x00, \ 
                                                     0x50, 0x00, 0x50, 0xA7, 0x05, 0x00, 0xC0, 0x00}; 
#else 
static const UBYTE rfcap_QuadBand[SIZE_EF_RFCAP] =  {0x00, 0x1F, 0x41, 0x14, 0x00, 0x00, 0x00, 0x00, \ 
                                                     0x50, 0x00, 0x00, 0xA5, 0x05, 0x00, 0xC0, 0x00}; 
#endif 
 
effs_t ffs_InitRFCap () 
{ 
    ffs_mkdir_nb("/gsm" ,0); 
    ffs_mkdir_nb("/gsm/com" ,0); 
 
    ffs_fwrite_nb("/gsm/com/rfcap", (void*)rfcap_QuadBand, SIZE_EF_RFCAP, 0); 
} 
 
effs_t ffs_InitSerialCfg () 
{ 
    ffs_mkdir_nb("/sys" ,0); 
    ffs_mkdir_nb("/sys/serial" ,0); 
} 
 
/* ffs_GetBand 
 *  
 * Purpose  : Get STD config as recorded in FFS 
 * 
 * Arguments: In : none 
 *                  
 *            Out: none 
 * 
 * Returns  : STD 
 * 
 */ 
 
unsigned char ffs_GetBand () 
{ 
    return 6; // Default STD value 
} 
 
/* 
 * 
 * ffs_LoadDarDebugFile 
 *  
 * Purpose  : Update the DAR_DebugFile with values stored in FFS 
 * 
 */ 
effs_t ffs_LoadDarDebugFile()  //typedef int8   effs_t;  
{ 
  void* src = &DAR_DebugFile; 
  fd_t fdi; // file descriptor 
  int count = 0xFFFF; 
   
  fdi = ffs_open("/var/dbg/dar", FFS_O_RDONLY); 
  if (fdi < 0) 
  { 
    return 0; 
  } 
 
  count = ffs_read(fdi, src, DAR_DEBUG_FILE_LENGTH); 
  ffs_close(fdi); 
 
  return count; 
}