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

📄 nvimnv.c

📁 free sources for gsm
💻 C
📖 第 1 页 / 共 5 页
字号:
/*===========================================================================

                   N V   I T E M    M A N A G E R  T A S K
DESCRIPTION
  All the declarations and definitions necessary to support the table
  lookup of mapping between an NV item and the Flash File System files
  which simulate storage in an EEPROM.  External tasks queue requests for
  this task for NV EEPROM read and write operations.  This tasks then
  performs the necessary internal operations to read, write
  and control access to the Flash File System files which simulate storage
  in an EEPROM.
  This task includes the following files:
    nv.h,       nvimnv.c   -  NVM Item Manager task services
    nvim.h,     nvim.c     -  NVM Item Manager item services
    nvimw.h,    nvimw.c    -  NVM Item Manager write services
    nvimr.h,    nvimr.c    -  NVM Item Manager read services
    nvi.h                  -  Common internal definitions

EXTERNALIZED FUNCTIONS
    nv_write_err_log
      Write an error log without requiring any tasking services.
    nv_read_err_log
      Read an error log without requiring any tasking services.
    nv_built
      Return status if NV has been built or not.
    nv_cmd
      This is the applications read and write interface to this task.
    nv_task
      This is the nv task initialization entry, started up with rex_def_task.
    nv_memavail
      Return the number of bytes available in the dynamic pool.
    nv_reserve_mem
      Reserve a specified quantity of dynamic pool memory.
    nv_cancel_reservation
      Release a previous dynamic pool memory reservation.

INITIALIZATION AND SEQUENCING REQUIREMENTS
  This task should be started up with rex_def_task.  Caution must be
  taken when invoking error services from this task.  These services invoke
  this task again (to log errors) and could cause an infinite loop.

REFERENCES

Copyright (c)  1999,2000 by QUALCOMM, Incorporated.  All Rights Reserved.
Copyright (c)  2001,2004 by QUALCOMM, Incorporated.  All Rights Reserved.
===========================================================================*/


/*===========================================================================

                      EDIT HISTORY FOR FILE

  This section contains comments describing changes made to this file.
  Notice that changes are listed in reverse chronological order.

$PVCSPath:  L:/src/asw/MSM5200/drivers/vcs/nvimnv.c_v   1.10   13 Mar 2002 16:38:08   karthick  $
$Header: //depot/asic/msmshared/services/meta_nv/nvimnv.c#18 $ $DateTime: 2005/11/11 20:18:29 $ $Author: pratapc $

when       who     what, where, why
--------   ---     ----------------------------------------------------------
10/21/05   ck      Modified nv_free to delete SMS item files
04/09/05   pc      Added functionality to backup and restore NV via CNV
10/12/04   as      NVM directory in file system is protected to prevent access
                   to NV files using EFS explorer.
05/18/04   as      Corrected the range in nv_peek and nv_poke.
05/11/04   wli     Support PRL update when using RUIM.
05/11/04   adm     Modified nv_rtre_control_value to NV_RTRE_CONTROL_USE_RUIM
                   as requested by wli
10/29/03   pg      Changed code to avoid compiling warnings.
05/21/03   pg      Changed NV_FEATURE_ROAMING_LIST_683 to NV_FEATURE_IS683A_PRL.
10/29/02   pg      Added code for Run Time R-UIM Enable.  Added another command
                   for NV to process and added another interface function to
                   retrieve RTRE control.
03/13/02   kar     Added nv_cmd_r under FEATURE_RPC
02/21/02   pg      Removed declaration of some unwanted variable.
02/13/02   pg      Fixed bug in nv_free to support freeing NV_SMS_GW_I
                   correctly.
10/10/01   pg      Removed #ifdef FEATURE_BT block and IMEI block from
                   nv_clear_crc() for more efficiency at rebuild time.
                   Removed function nv_determine_bd_addr_validity().
                   Removed function nv_determine_imei_validity().
10/04/01   pg      Took out #ifdef FEATURE_BT around varible "i" declaration.
                   This variable is now used discard whether FEATURE_BT is
                   defined.
09/27/01   pg      Added support for dynamic item NV_SMS_GW_I under
                   FEATURE_GWSMS.
09/24/01   pg      Removed support for NV_IMEI_I and NV_IMEI_CHKSUM_I.
                   These items are no longer used.
                   Added support for special item NV_UE_IMEI_I.
05/15/01   pg      Changed MC task related signals and queues to TMC task
                   related signals and queues.
04/13/01   pg      Added support for special items NV_IMEI_I and
                   NV_IMEI_CHKSUM_I.
04/02/01   pg      Deleted some unused variables.
03/30/01   pg      Made changes to make use of the files generated by NVC.
                   Ported to simba MSM5200.
11/28/00   pg      Added support for FEATURE_RUIM so that roaming list is not
                   supported when the feature is on for now.
11/01/00   pg      Reverted the previous change.
10/31/00   pg      Replaced NV_FEATURE_TRIMODE_ITEMS with FEATURE_TRIMODE_ITEMS.
                   And made it a feature to be turned on by customers.
10/05/00   pg      Merged TigerII and PP/PPG archive.
                   In nv_determine_bd_addr_validity(), returns TRUE only when
                   the active flag for Bluetooth address is set.
09/27/00   pg      In nv_clear_crc(), moved the last return statement in the
                   block of #ifdef FEATURE_BT into an if statement so that
                   it would only returns when the status is not NV_DONE_S.
09/21/00   rp      Moved includes of target.h and comdef.h before
                   #ifdef FEATURE_NV_ITEM_MGR which is around all code.
09/20/00   pg      Added support for invariant item NV_BD_ADDR_I associated
                   with FEATURE_BT.
                   Added #ifdef FEATURE_NV_ITEM_MGR to whole file.
                   In nv_built() now simply returning value of boolean
                   nvi_initialized to indicate if NV is available.
08/29/00   rp      Fixed compiler warning in nv_free().
08/04/00   ms      R-UIM feature support
07/07/00   rp      In nv_write_err_log added check if file system is error
                   fataling not to perform a write.
03/02/00   rp      In nv_built() now calling nvim_rebuild_needed() to
                   determine if NV needs a rebuild.
                   In nv_init() now calling nvim_update_klt() after a
                   rebuild occurs to initialize verno_maj, klt_magic, etc.
02/22/00   rp      Added NAM_LOCK support to OTASP_COMMIT based on
                   FEATURE_OTASP_OTAPA.
01/13/00   rp      Restored original nv_write_err_log() code since
                   nvimio_fixed_array will open the appropriate file for
                   updating.
12/06/99   rp      Changed OTASP Commit for new Trimode featurization.
12/01/99   rp      Removed calls to nvim_open_write_all() and
                   nvim_close_write_all(void) from nv_init() as these calls
                   are no longer necessary due to changes in nvim_nv_clear().
10/25/99   rp      Added check in nv_reserve_mem that currently_available
                   memory is > 0.
10/20/99   rp      Fixed compiler warning in nv_init_rental_timer().
10/08/99   pg      Simplified nv_init_rental_timer() and nv_init_rental_cnt()
                   because wearing out of eeprom bits is no longer a concern.
10/04/99   rp      Added feature FEATURE_NV_OTASP to nv_otasp_commit().
08-18-99   rp      Raised priority of NV task during OTASP commit operation.
08-13-99   rp      Initial ASW version.
07-26-99   rp      Made fact_data global so that NV_FACTORY_INFO_I support
                   may read/write to this cache.
07-06-99   rp      Peek/poke of factory data area now use nvimr_read_factory()
                   and nvimw_write_factory() respectively.
06-23-99   rp      Added support for reservation requests to use "revertable"
                   files, also cleaned up compiler warnings
06-18-99   rp      Removed formation of confirmation code as fs_ops now
                   returns count as part of confirmation code.
06-14-99   rp      Added updating nvi_memavail_data in nv_free
06-09-99   rp      Added support for updating nvi_memavail_data.
05-26-99   rp      Added support for poke/peek of factory data block.
05-20-99   rp      Added nvimnv_build_nvm(void) to re-init all nv files.
05-18-99   dlb     Added handover block support.
05-09-99   st      Made otasp_commit in nv_item_type a pointer.
05-07-99   rp      Fixed OTASP commit bug.
04-30-99   rp      Initial version.


===========================================================================*/

/* ======================================================================

                       INCLUDE FILES FOR MODULE

========================================================================*/

#include "target.h"
#include "comdef.h"

#ifdef FEATURE_NV_ITEM_MGR

#include "fs.h"
#include "nv.h"
#include "nvim.h"
#include "nvi.h"
#include "msg.h"
#include "nvimr.h"
#include "nvimw.h"
#include "nv_op.h"
#include "err.h"
#include "task.h"
#include "fs.h"
#include "dog.h"
#include "mc.h"
#include "crc.h"
#include "memory.h"

#ifdef FEATURE_TREX
#error code not present
#endif
#include "nvim_items.h"
#ifdef FEATURE_TREX
#error code not present
#endif


#ifdef FEATURE_NV_HANDOVER_BLOCK
# include "nvi_hand.h"
#endif

#ifdef FEATURE_NV_RUIM
#include "nvruimi.h"
#endif


#ifdef FEATURE_NV_CNV
#include "nv_cnv.h"
#endif
#include "fs_public.h"
#include <stdio.h>


#ifdef _SAMSUNG_HW_RF
 /* SAMSUNG_UMTS supports only quadband ; WCDMA2100/GSM900/DCS/PCS. */   
#define RF_HAS_GSM900   
#define RF_HAS_GSM1800 
#define RF_HAS_GSM1900
#define RF_HAS_WCDMA2100  

#include "rfnv.h"
#include "rfnv_cmn.h"
                    
#ifdef FEATURE_WCDMA
#include "rfnv_wcdma.h"
#endif

#ifdef RF_HAS_WCDMA2100
#include "rfnv_wcdma_2100.h"
#endif

#ifdef RF_HAS_WCDMA1900
#error code not present
#endif

#ifdef FEATURE_GSM
#include "rfnv_gsm.h"
#endif

#ifdef RF_HAS_GSM900
#include "rfnv_gsm_900.h"
#endif

#ifdef RF_HAS_GSM1800
#include "rfnv_gsm_1800.h"
#endif

#ifdef RF_HAS_GSM850
#include "rfnv_gsm_850.h"
#endif

#ifdef RF_HAS_GSM1900
#include "rfnv_gsm_1900.h"
#endif

#include "rfnv.h"

#ifdef _SAMSUNG_BREW_COMMON
#include "AEELngCode.h"
#endif
#endif // _SAMSUNG_HW_RF


/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                         */
/*                         DATA DEFINITIONS                                */
/*                                                                         */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
#ifdef _SAMSUNG_MP_CUSTOM_RESET
boolean nv_rebuild = FALSE;
#endif
boolean  nvi_task_running=FALSE;

/* Contains the roaming list "valid" indicator */
boolean  nv_prl_valid_data[NV_MAX_NAMS];

/* Contains the roaming list "prl_version" field */
word     nv_prl_version_data[NV_MAX_NAMS];

/* Buffer holding the union of all internal NVM storage types.  Use as    */
/* a working buffer when reading or writing data from or to NVM and the   */
/* data requires translation between internal format and external format. */
nvi_item_type  nvi_item;

/* Data buffer for individual writes/reads issued internally. */
nv_item_type  local_item;

/* Command buffer for individual writes/reads issued internally. */
nv_cmd_type   local_cmd;

#ifdef NV_FEATURE_PRL_ITEMS
/* Globally used buffer to contain the roaming list read-from  */
/* or written-to NV memory.                                    */
nv_roaming_list_type   nv_pr_list;
#endif

#ifdef NV_FEATURE_RENTAL_ITEMS
#error code not present
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                         */
/*                      REX Timers and Queues                              */
/*                                                                         */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

rex_timer_type         nv_rpt_timer;     /* NV watchdog report timer. */
rex_timer_type         nv_write_timer;   /* NVM write timer. */
LOCAL q_type           nv_cmd_q;         /* NV task command queue. */

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                         */
/*                            Local Data                                   */
/*                                                                         */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/


/* Flag to determine if EEPROM initialization has occurred    */
boolean                 nvi_initialized = FALSE;

/* The total factory data block cache for peek/poke access */
byte fact_data[NVIM_FACTORY_DATA_SIZE];


/* Structure used to essentially double buffer the error log  */
struct
{
  nv_err_log_type  external[NV_MAX_ERR_LOG];
  nv_err_log_type  internal[NV_MAX_ERR_LOG];
  boolean          update_required[NV_MAX_ERR_LOG];
  boolean          update_in_progress[NV_MAX_ERR_LOG];
  boolean          processing_required;
} nverr_log;

#if defined( FEATURE_UIM_RUN_TIME_ENABLE )
/* Run Time R-UIM Enable control.  Default: do not use the R-UIM */
nv_rtre_control_type nv_rtre_control_value = NV_RTRE_CONTROL_USE_RUIM;
/* Run Time R-UIM Enable polling control.  Default:  do not poll */
nv_rtre_polling_control_type nv_rtre_polling_control_value =
  NV_RTRE_POLLING_CONTROL_NO_POLL;
#endif /* FEATURE_UIM_RUN_TIME_ENABLE */

#ifdef FEATURE_DIAG_FS_ACCESS_VALIDATION
  #ifdef FEATURE_EFS2
    #include "fs_diag.h"
  #else
    #include "fsdiag.h"
  #endif

static const char *nv_access_dirs[] = {
  "nvm"
};

#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                         */
/*                            Debug Data                                   */
/*                                                                         */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/*                                                                         */
/*                               Macros                                    */
/*                                                                         */
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/


#ifdef FEATURE_DIAG_FS_ACCESS_VALIDATION

/*==================================================================
Function: NV_CHECK_REMOTE_ACCESS

Description: This functions returns access permissions for
             directories specified by input parameter "path".
==================================================================*/
static boolean
nv_check_remote_access (char *path, uint32 op_type)
{
  (void) path;
  (void) op_type;
#ifndef _SAMSUNG_EFS_REMOVE
  return FALSE;
#else
  return TRUE;
#endif
}

/*====================================================================
Function: NV_REGISTER_REMOTE_ACCESS_CHECK

Description: Registers callback function nv_check_remote_access()
             with directory listed in nv_access_dirs. On any access to
             nv_access_dirs directories, nv_check_remote_access will
             be called to determine access permissions.
=====================================================================*/
void
nv_register_remote_access_check (void)
{
  diag_fs_register_access_check (nv_access_dirs, 1, nv_check_remote_access);

}
#endif /* FEATURE_DIAG_FS_ACCESS_VALIDATION */


/*===========================================================================
FUNCTION NVERR_INIT

DESCRIPTION
  Initialize nv error queue for external tasks

DEPENDENCIES
  Called once, by NV.C to init buffers

⌨️ 快捷键说明

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