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

📄 nvimr.c

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

            efs_params = nv_op_get_fparams(cmd_ptr->item);

            /* Turn off permanent file attribute in order to write */
            if ((status = nvim_update_fs_item_file_attrs(efs_params,
                                       FS_FA_UNRESTRICTED)) != NV_DONE_S)
              return status;

            status = nvimw_write(cmd_ptr);

            /* Turn back on permanent file attribute */
            if (status == NV_DONE_S) {
              status = nvim_update_fs_item_file_attrs(efs_params,
                                        FS_FA_SYS_PERMANENT);
              MSG_HIGH ("IMEI successfully propagated from OTP to NV.",0,0,0);
              return status;
            }

            MSG_HIGH ("IMEI could not propagate from OTP to NV.",0,0,0);
            return (NV_FAIL_S);
          }

          /* Compare the contents of OTP and NV */
          if (memcmp(local_imei, (byte *)cmd_ptr->data_ptr->ue_imei.ue_imei,
                     sizeof(local_imei))==0)
          {
            /* Do nothing */
            MSG_HIGH ("OTP and NV contents are same.",0,0,0);
            return status;
          }
          else
          {
            /* Return Failure */
            MSG_HIGH ("IMEI does not match between OTP and NV",0,0,0);
            return (NV_FAIL_S);
          }
        }
        break;

#elif defined (FEATURE_NV_SFS_PRIVATE)

      case NV_UE_IMEI_I:
        num_imei_bytes = sfs_priv_imei_read((uint8 *)cmd_ptr->data_ptr, nv_op_get_size(cmd_ptr->item));
        if(num_imei_bytes == 0)
        {
          return NV_FAIL_S;
        }
        else
        {
          return NV_DONE_S;
        }

#else

      case NV_UE_IMEI_I:
        return nvimr_read_fixed(cmd_ptr->item,
                                (byte *)cmd_ptr->data_ptr,
                                nv_op_get_size(cmd_ptr->item));

#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      /* This item is a special case for writes, so it has no generic path in
       * nvimio_io(). Thus we have to handle the read of this item here
       * rather than in nvimio_io().
       */
      case NV_VERNO_MAJ_I:
        fparams = nv_op_get_fparams(cmd_ptr->item);
        return nvim_read_efs(fparams->rd_handle,  /* file handle */
                             nv_op_get_file_pos(cmd_ptr->item), /* file position */
                             &cmd_ptr->data_ptr->verno_maj, /* data ptr */
                             sizeof(nvi_item.verno_maj)); /* data count */

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      /* This item is a special case for writes, so it has no generic path in
       * nvimio_io(). Thus we have to handle the read of this item here
       * rather than in nvimio_io().
       */
      case NV_VERNO_MIN_I:
        fparams = nv_op_get_fparams(cmd_ptr->item);
        return nvim_read_efs(fparams->rd_handle,  /* file handle */
                             nv_op_get_file_pos(cmd_ptr->item), /* file position */
                             &cmd_ptr->data_ptr->verno_min, /* data ptr */
                             sizeof(nvi_item.verno_min));   /* data count */

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
      /* Some invariant offset items are handled as a special case,
         because they will always have a valid entry, but if their
         feature is not turned on, then you can't read, write or build
         them */
      case NV_PAP_PASSWORD_I:
        #ifdef NV_FEATURE_PAP
          return nvimr_read_fixed(cmd_ptr->item,
                                  (byte *)cmd_ptr->data_ptr,
                                  nv_op_get_size(cmd_ptr->item));
        #else
          return NV_BADPARM_S;
        #endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
      case NV_UP_KEY_I:
        #ifdef NV_FEATURE_UP
          index = *((byte *)cmd_ptr->data_ptr);
          if (index >= NV_UP_LINK_INFO_TABLE_SIZE)
            return NV_BADPARM_S;
          else
            return nvimr_read_fixed_array(cmd_ptr->item,
                                          index,
                                          ((byte *)cmd_ptr->data_ptr)+sizeof(index),
                                          nv_op_get_size(cmd_ptr->item));
        #else
          return NV_BADPARM_S;
        #endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
      case NV_BD_ADDR_I:
        #ifdef FEATURE_BT
          return nvimr_read_fixed(cmd_ptr->item,
                                  (byte *)cmd_ptr->data_ptr,
                                  nv_op_get_size(cmd_ptr->item));
        #else
          return NV_BADPARM_S;
        #endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      case NV_DIAL_I:
        return  nvimr_read_dial(NV_DIAL_I,
                                NV_MAX_SPEED_DIALS,
                                cmd_ptr->data_ptr->dial.address,
                                &cmd_ptr->data_ptr->dial);

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      case NV_STACK_I:
        return  nvimr_read_stdial(NV_STACK_I,
                                  NV_MAX_STACK_DIALS,
                                  cmd_ptr->data_ptr->stack.address,
                                  &cmd_ptr->data_ptr->stack);

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef NV_FEATURE_REDIAL
      case NV_REDIAL_I:
        return  nvimr_read_dial(NV_DIAL_I,
                                NV_MAX_SPEED_DIALS + NVI_REDIAL_EXTENSIONS,
                                NV_MAX_SPEED_DIALS,
                                &cmd_ptr->data_ptr->dial);
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      case NV_SMS_I:
      case NV_SMS_DM_I:
        return nvimr_read_sms(cmd_ptr);

/*- - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef NV_FEATURE_RENTAL_ITEMS
#error code not present
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef NV_FEATURE_RENTAL_ITEMS
#error code not present
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef NV_FEATURE_FACTORY_INFO
      case NV_FACTORY_INFO_I:
        /* Copy from the static block, latest factory data */
        memcpy((void *) cmd_ptr->data_ptr->fact_info,
               fact_data,
               (word) NV_FACTORY_INFO_SIZ);
        return NV_DONE_S;
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef NV_FEATURE_PRL_ITEMS
  #ifdef NV_FEATURE_IS683A_PRL
    case NV_ROAMING_LIST_683_I:
  #else
    case NV_ROAMING_LIST_I:
  #endif
      status = nvimr_read_roaming_list(cmd_ptr);
      return status;
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef FEATURE_GWSMS
      case NV_SMS_GW_I:
        status = nvimr_read_sms_gw(cmd_ptr);
        return status;
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

#ifdef FEATURE_NV_SUPPORT_FLASH_OTP
      case NV_DEVICE_SERIAL_NO_I:
         if (flash_otp_operation(FLASH_OTP_OP_SERIALNO_READ,
                       (byte *)cmd_ptr->data_ptr) != FLASH_OTP_IO_SUCCESS)
         {
           return NV_FAIL_S;
         }
         else
         {
           return NV_DONE_S;
         }
#endif

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
//whlee. DRX Toggle mode 备泅阑 困秦 眠啊. NV俊辑 蔼阑 佬绢甸捞绰 镑---------------------------------
#ifdef _SAMSUNG_PROT_DRX_OFF
      case NV_UE_DRX_MODE_I:
	
        fparams = nv_op_get_fparams(NV_UE_DRX_MODE_I);
        status = nvim_read_efs(fparams->rd_handle,/* file handle */
                               nv_op_get_file_pos(NV_UE_DRX_MODE_I), /* file position */
                               &nvi_item.ue_drx_mode,          /* data ptr */
                               sizeof(nvi_item.ue_drx_mode)); /* data count */
        if(nvi_item.ue_drx_mode.value)
        {
          is_drx_mode = TRUE;
        }
        else 
        {
          is_drx_mode = FALSE;
        }
        return NV_DONE_S;
#endif

#ifdef FEATURE_SAMSUNG_DUALMODE_IMPROVEMENT  // hym_2_mode_perf_for_Tmobile 050120
      case NV_DUALMODEPERFIMPROVE_VER_I:
	
        fparams = nv_op_get_fparams(NV_DUALMODEPERFIMPROVE_VER_I);
        status = nvim_read_efs(fparams->rd_handle,/* file handle */
                               nv_op_get_file_pos(NV_DUALMODEPERFIMPROVE_VER_I), /* file position */
                               &nvi_item.dualModePerfImprove_enabled,          /* data ptr */
                               sizeof(nvi_item.dualModePerfImprove_enabled)); /* data count */
        if(nvi_item.dualModePerfImprove_enabled.value)
        {
          dualModePerfImprove_enabled_nv = TRUE; 
        }
        else 
        {
          dualModePerfImprove_enabled_nv = FALSE; 
        }
		
        return NV_DONE_S;
#endif

#ifdef _SAMSUNG_HW_USB_SELECT
       case NV_SAMSUNG_USB_DRIVER_I:
        fparams = nv_op_get_fparams(NV_SAMSUNG_USB_DRIVER_I);
        status = nvim_read_efs(fparams->rd_handle,
                               nv_op_get_file_pos(NV_SAMSUNG_USB_DRIVER_I),
                               &nvi_item.usb_driver,
                               sizeof(nvi_item.usb_driver));
        usb_driver = nvi_item.usb_driver.value;
        return NV_DONE_S;
#endif /* _SAMSUNG_HW_USB_SELECT */

//---------------------------------------------------------------------------
#ifdef _SAMSUNG_PROT_GCF_VERSION
//whlee. 2004_1112. To mode change for GCF Version
      case NV_SAMSUNG_GCF_TEST_I:
	 fparams = nv_op_get_fparams(NV_SAMSUNG_GCF_TEST_I);
        status = nvim_read_efs(fparams->rd_handle,/* file handle */
                               nv_op_get_file_pos(NV_SAMSUNG_GCF_TEST_I), /* file position */
                               &nvi_item.samsung_gcf_test,          /* data ptr */
                               sizeof(nvi_item.samsung_gcf_test)); /* data count */
        if(nvi_item.samsung_gcf_test.value)
        {
          samsung_gcf_test_nv= TRUE;
        }
        else 
        {
          samsung_gcf_test_nv = FALSE;
        }
		
        return NV_DONE_S;
#endif // _SAMSUNG_PROT_GCF_VERSION
//--------------------------------------------------------end of whlee. 2004_1112

//whlee. 2004_1206. To adjust C1 threhold        -------------------------------------- 
//Actually C1 threshold value shold be zero according to the spec(TS05.08). 
//But for the practical reason, this item is added to adjust the threshold value.
#ifdef _SAMSUNG_PROT_ADJUST_C1_THRESHOLD
      case NV_USER_C1_SETTING_I:
        fparams = nv_op_get_fparams(NV_USER_C1_SETTING_I);
        status = nvim_read_efs(fparams->rd_handle,/* file handle */
                               nv_op_get_file_pos(NV_USER_C1_SETTING_I), /* file position */
                               &nvi_item.user_C1_setting,          /* data ptr */
                               sizeof(nvi_item.user_C1_setting)); /* data count */
// C1 threshold range : -9 ~ 9
// Less than -110 dBm is meaningless.(By an experiment, -5 reaches -110dBm.)
// Also there's no reason to set C1 threshold more than 0 except for an experiment.
        if (nvi_item.user_C1_setting.value > 10 | nvi_item.user_C1_setting.value < -10)
        {
           return NV_BADPARM_S;
        }
	      else
	      {
	        C1_threshold = nvi_item.user_C1_setting.value;
        }
        return NV_DONE_S;  
#endif //_SAMSUNG_PROT_ADJUST_C1_THRESHOLD
//--------------------------------------------------------end of whlee. 2004_1206
//ccy_pwron_attach_mode_realization(
#ifdef _SAMSUNG_PROT_PWR_ON_ATT
case NV_PWRON_ATT_MANUAL_MODE_I:
	 fparams = nv_op_get_fparams(NV_PWRON_ATT_MANUAL_MODE_I);
        status = nvim_read_efs(fparams->rd_handle,/* file handle */
                               nv_op_get_file_pos(NV_PWRON_ATT_MANUAL_MODE_I), /* file position */
                               &nvi_item.pwron_att_manual_mode,          /* data ptr */
                               sizeof(nvi_item.pwron_att_manual_mode)); /* data count */
	 MSG_ERROR("[ccy]nv_pwron_att_manual_mode->%d",nvi_item.pwron_att_manual_mode.value,0,0);	
        if(nvi_item.pwron_att_manual_mode.value)
        {
          pwron_att_manualmode_on= TRUE;
        }
        else 
        {
          pwron_att_manualmode_on = FALSE;
        }
        MSG_ERROR("[ccy]pwron_att_manualmode_on->%d",pwron_att_manualmode_on,0,0);				
        return NV_DONE_S;
#endif
//)
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

      default:
        /* Check if there's an actual entry */
        if (nv_op_is_valid_entry(cmd_ptr->item))
        {
          /* If it is a single item then just call nvr_read_fixed */
          /* else must be an array so call nvr_read_fixed_array */
          array_size = nv_op_get_array_size(cmd_ptr->item);

          if (array_size == 0)  /* Not an array item */
            return nvimr_read_fixed(cmd_ptr->item,
                                    (byte *) cmd_ptr->data_ptr,
                                    nv_op_get_size(cmd_ptr->item));

          else /* An array */
          {
            index = *((byte *)cmd_ptr->data_ptr);
            if (index >= array_size)
              return NV_BADPARM_S;
            else
              return nvimr_read_fixed_array(cmd_ptr->item,
                                            index,
                                            ((byte *)cmd_ptr->data_ptr)+sizeof(index),
                                            nv_op_get_size(cmd_ptr->item));
          }
        }
        else  /* Not a valid entry */
        {
          MSG_HIGH("nvimr_read item %d not for this target", cmd_ptr->item, 0, 0);
          return NV_BADPARM_S;
        }

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/

    /* End read switch and return status. */

    } /* switch */
  } /* else */

} /* nvimr_read */

#endif /* FEATURE_NV_ITEM_MGR */

⌨️ 快捷键说明

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