比较复杂:首先其偏移在offset =0位置,还用到了一个配置文件,
nvm_config.txt,要读取其中的一个值,
void tc_RF_operation( )
{
char temp[40*1024];
long offset;
UINT32 length;
UINT32 ret_len;
int nvm_fd;
char nvm_flag;
FILE *fp = NULL;
length= sizeof(temp);
offset=0;
TCMD_TRACE("The length is %d: \n",length);
memset(temp,0,length);
nvm_fd = open("/telephony/tel/NVM/nvm_config.txt", O_RDWR);
read(nvm_fd,&nvm_flag,1);
close(nvm_fd);
if(nvm_flag=='0')
{
LoadBackNVM(temp,length,offset);
if(lenBackNVM>1024*10)
{
fp = fopen( "/data/telephony/nvm/GsmCalData.nvm", "w" );
if(fp!=NULL)
{
ret_len = fwrite(temp,1,lenBackNVM,fp);
TCMD_TRACE("the real write length is %d: \n",ret_len);
nvm_flag='1';
nvm_fd = open("/telephony/tel/nvm_config.txt", O_RDWR);
write(nvm_fd,&nvm_flag,1);
close(nvm_fd);
}
else
{
TCMD_TRACE("Error operarion the fileeeee \n");
}
fclose(fp);
}
}
}
|
阅读(1166) | 评论(0) | 转发(0) |