添加不恢复出厂不删除文件Not_Clear.nvm.
authorp15692025051 <846603105@qq.com>
Wed, 15 Nov 2023 08:46:04 +0000 (16:46 +0800)
committerp15692025051 <846603105@qq.com>
Wed, 15 Nov 2023 08:46:04 +0000 (16:46 +0800)
3918校准数据保存问题处理

2.sdk/sdk/gui/lv_drivers/indev/HX3918/hx3918.h
2.sdk/sdk/gui/lv_drivers/indev/HX3918/hx3918_prox.c
2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm.h
2.sdk/sdk/gui/lv_watch/framework/nvm/ui_nvm_api.c
2.sdk/sdk/gui/lv_watch/include/ui_nvm_interface.h
2.sdk/sdk/product/craneg_modem/CrossPlatformSW/CrossPlatformSW/src/crossPlatformSW.c
2.sdk/sdk/product/craneg_modem/pcac/mbedTLS/include/mbedtls/config.h

index f64c2dd..24c669e 100644 (file)
@@ -6,6 +6,7 @@
 #define HX3918_DEBUG  1
 #if HX3918_DEBUG == 1
 #define HX3918_LOG(msg, ...)      cplog_printf( msg, ##__VA_ARGS__)//printf( msg, ##__VA_ARGS__)//
+//#define HX3918_LOG(msg, ...)      printf( msg, ##__VA_ARGS__)//printf( msg, ##__VA_ARGS__)//
 #else
 #define HX3918_LOG(msg, ...)  
 #endif
index 4e5d765..7142747 100644 (file)
@@ -52,6 +52,14 @@ hx_set_wear_detect_mode(SLEEP_WEAR_MODE)    //在手表检测到进入睡眠后
 6.  注意CSx和CHx, CSx是指外部PAD接到芯片的对应CS管脚. CH是指内部采集数据的3个通道, CSx可配置在不同的CH上;
 -------------------------------- -------------------------------- -----------------------------------*/
 
+extern int item32_CARDID_write(char * data);
+ 
+extern int tem32_CARDID_read(char * data,int data_MAX_len);
+
+
+
+void hx3918_read_nv(void);
+//#include "../../../../product/craneg_modem/ril/libasr-ril/at-item32_CARDID.h"
 #ifdef  SAR_ALG_LIB
 //#define TEMP_COMPENSATION
 
@@ -604,52 +612,6 @@ void hx3918_update_nv_data()
        }
 }
 
-/**
- * hx3918 从flash读取对空校准后的OFFSET和NV_BASE
-* @param NULL
-*/
-void hx3918_read_nv(void)
-{
-
-    // 
-    //从flash读取4个值, 分别是以前保存的值; 这个函数用户需要自己完成, flash存储的位置不能被用户操作删掉
-    //flash_fds_data_get(4);
-    // Helios_SecureData_t r_data={0};
-    // r_data.index = 1;
-    // r_data.pBuffer = (uint8_t *)fds_read;
-    // r_data.len = sizeof(fds_read);
-    // Helios_Securedata_Read(&r_data);
-    nv_watch_sensor_hx3918_data_t nv_data = {0};
-    
-    UI_NV_Read_Req(NV_SECTION_UI_SENSOR_HX3918_DATA, 0, sizeof(nv_watch_sensor_hx3918_data_t), (uint8_t *)&nv_data);
-    memcpy(fds_read,&nv_data.data,sizeof(fds_read));
-    nv_wear_offset[0] = fds_read[0];
-    nv_wear_offset[1] = fds_read[1];
-    nv_base_data[0] = fds_read[2];
-    nv_base_data[1] = fds_read[3];
-
-       //如果flash记录的值大于上限, 则让靠近感应进入相对值模式
-    if ( (nv_wear_offset[0] == 0&& nv_base_data[0] == 0) || nv_wear_offset[0] == 0xFFFF)
-    {
-                       nv_wear_offset[0] = 0;
-                       nv_base_data[0] = 0;
-                       nv_wear_offset[1] = 0;
-                       nv_base_data[1] = 0;
-                       cap_enable = false;
-                       is_offset_manual = 0;
-    }
-    else
-    {
-        is_offset_manual = 1;
-        
-    }
-
-               TYHX_LOG("hx3918_read_nv ,OFF[0]:       %d,  OFF[1]:%d\r\n",nv_wear_offset[0],nv_wear_offset[1]);
-               TYHX_LOG("BASE[0]:      %d, BASE[1]:%d,mode: %d \r\n",nv_base_data[0],nv_base_data[1],is_offset_manual);
-
-
-    
-}
 
 /**
  * hx3918 靠近感应初始化, 通过对hx3918_chip_id 判断,来判断靠近感应是独立工作还是跟PPG一起工作
@@ -808,7 +770,7 @@ void hx3918_prox_factory_hanging_cali(void)
 
     if((prox_factory_offset0 == 510) &&(prox_factory_offset1 == 510)&&(prox_factory_lp[0]==0)&&(prox_factory_lp[1]==0))
     {
-        TYHX_LOG("ERR,  read offset err, please redo it !!!\r\n");
+        HX3918_LOG("ERR,  read offset err, please redo it !!!\r\n");
     }
     else
     {
@@ -838,14 +800,12 @@ void hx3918_factory_cali_save_nv(void)
     fds_read[1] = fds_write[1];
     fds_read[2] = fds_write[2];
     fds_read[3] = fds_write[3];
-    // Helios_SecureData_t w_data={0};
-    // w_data.index = 1;
-    // w_data.pBuffer = (uint8_t *)fds_write;
-    // w_data.len = sizeof(fds_write);
-    // Helios_Securedata_Store(&w_data);
-    nv_watch_sensor_hx3918_data_t nv_data = {0};
-    memcpy(&nv_data.data,fds_write,sizeof(nv_watch_sensor_hx3918_data_t));
-    UI_NV_Write_Req(NV_SECTION_UI_SENSOR_HX3918_DATA, 0, sizeof(nv_watch_sensor_hx3918_data_t), (uint8_t *)&nv_data);
+
+    HX3918_LOG("hx3918_factory_cali_save_nv:%d,%d,%d,%d\n",fds_read[0],fds_read[1],fds_read[2],fds_read[3]);
+    nv_watch_not_clean_data_t nv_data = {0};
+    UI_NV_Read_Req(NV_SECTION_UI_Not_Clear_DATA, 0, sizeof(nv_watch_not_clean_data_t), (uint8_t *)&nv_data);
+    memcpy(&nv_data.hx3918_data,fds_write,sizeof(nv_data.hx3918_data));
+    UI_NV_Write_Req(NV_SECTION_UI_Not_Clear_DATA, 0, sizeof(nv_watch_not_clean_data_t), (uint8_t *)&nv_data);
     TYHX_LOG("[hx3918_factory_cali_save_nv]");
     for(int i=0; i<4; i++)
     {
@@ -854,6 +814,50 @@ void hx3918_factory_cali_save_nv(void)
        //用户需要flash保存
     //flash_fds_data_write(4);
 }
+/**
+ * hx3918 从flash读取对空校准后的OFFSET和NV_BASE
+* @param NULL
+*/
+void hx3918_read_nv(void)
+{
+
+    // 
+    //从flash读取4个值, 分别是以前保存的值; 这个函数用户需要自己完成, flash存储的位置不能被用户操作删掉
+
+    nv_watch_not_clean_data_t nv_data = {0};
+    
+    UI_NV_Read_Req(NV_SECTION_UI_Not_Clear_DATA, 0, sizeof(nv_watch_not_clean_data_t), (uint8_t *)&nv_data);
+    memcpy(fds_read,&nv_data.hx3918_data,sizeof(fds_read));
+  
+    HX3918_LOG("hx3918_read_nv!!!!!!!!!!!!!\n\n\n");
+
+    HX3918_LOG("hx3918_read_nv:%d,%d,%d,%d\n",fds_read[0],fds_read[1],fds_read[2],fds_read[3]);
+    nv_wear_offset[0] = fds_read[0];
+    nv_wear_offset[1] = fds_read[1];
+    nv_base_data[0] = fds_read[2];
+    nv_base_data[1] = fds_read[3];
+
+       //如果flash记录的值大于上限, 则让靠近感应进入相对值模式
+    if ( (nv_wear_offset[0] == 0&& nv_base_data[0] == 0) || nv_wear_offset[0] == 0xFFFF)
+    {
+                       nv_wear_offset[0] = 0;
+                       nv_base_data[0] = 0;
+                       nv_wear_offset[1] = 0;
+                       nv_base_data[1] = 0;
+                       cap_enable = false;
+                       is_offset_manual = 0;
+    }
+    else
+    {
+        is_offset_manual = 1;
+        
+    }
+
+               TYHX_LOG("hx3918_read_nv ,OFF[0]:       %d,  OFF[1]:%d\r\n",nv_wear_offset[0],nv_wear_offset[1]);
+               TYHX_LOG("BASE[0]:      %d, BASE[1]:%d,mode: %d \r\n",nv_base_data[0],nv_base_data[1],is_offset_manual);
+
+
+}
 
 #endif // SAR_ALG_LIB
 
index 3c39514..f1c35e6 100644 (file)
@@ -56,7 +56,7 @@ extern "C" {
 #define NV_SECTION_UI_SIM_UNBIND_SWITCH_LEN                    (sizeof(nv_watch_switch_t))
 #define NV_SECTION_UI_SIM_ICCID_DATA_LEN                       (sizeof(nv_watch_sim_iccid_t))
 #endif
-#define NV_SECTION_UI_SENSOR_HX3918_DATA_LEN           (sizeof(nv_watch_sensor_hx3918_data_t))
+#define NV_SECTION_UI_Not_Clear_DATA_LEN               (sizeof(nv_watch_not_clean_data_t))
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
 #define NV_SECTION_UI_REMIND_WAKE_UP_DATA_LEN          (sizeof(nv_watch_remind_wake_up_t))
 #endif
@@ -165,7 +165,7 @@ typedef lv_fs_dir_t  ui_dir_t;
 #define NV_SECTION_UI_SIM_UNBIND_SWITCH_FILE           "ui_sim_unbind_switch.nv"
 #define NV_SECTION_UI_SIM_ICCID_DATA_FILE                      "ui_sim_iccid_data.nv"
 #endif
-#define NV_SECTION_UI_SENSOR_HX3918_DATA_FILE          "ui_sensor_hx3918_data.nv"
+#define NV_SECTION_UI_Not_Clear_DATA_FILE              "Not_Clear.nvm"
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
 #define NV_SECTION_UI_REMIND_WAKE_UP_DATA_FILE         "ui_remind_wake_up_data.nv"
 #endif
index 2e8f4ab..92c348c 100644 (file)
@@ -106,8 +106,8 @@ uint32_t UI_NV_Get_Section_Len(NV_UI_SECTION_ID SectionId)
                case NV_SECTION_UI_SIM_ICCID_DATA:
                        return (NV_SECTION_LEN(NV_SECTION_UI_SIM_ICCID_DATA));
        #endif
-               case NV_SECTION_UI_SENSOR_HX3918_DATA:
-                       return (NV_SECTION_LEN(NV_SECTION_UI_SENSOR_HX3918_DATA));
+               case NV_SECTION_UI_Not_Clear_DATA:
+                       return (NV_SECTION_LEN(NV_SECTION_UI_Not_Clear_DATA));
        #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
                        return (NV_SECTION_LEN(NV_SECTION_UI_REMIND_WAKE_UP_DATA));
@@ -223,8 +223,8 @@ char * UI_NV_Get_Section_path(NV_UI_SECTION_ID SectionId)
                case NV_SECTION_UI_SIM_ICCID_DATA:
                        return (NV_SECTION_FILE_PATH(NV_SECTION_UI_SIM_ICCID_DATA));
        #endif
-               case NV_SECTION_UI_SENSOR_HX3918_DATA:
-                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_SENSOR_HX3918_DATA));
+               case NV_SECTION_UI_Not_Clear_DATA:
+                       return (NV_SECTION_FILE_PATH(NV_SECTION_UI_Not_Clear_DATA));
        #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
                        return (NV_SECTION_FILE_PATH(NV_SECTION_UI_REMIND_WAKE_UP_DATA));
@@ -252,6 +252,7 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
 {
     char * TempData;
     uint32_t SectionLen = UI_NV_Get_Section_Len(SectionId);
+    char not_clean_flag = 0;
     char FilePath[NV_MAX_SECTION_PATH_NAME];
     ui_file_t * pfile;
     nv_watch_settings_t * setting;
@@ -292,7 +293,7 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
 #ifdef __MMI_ZHSX_SUPPORT_CHECK_SIM_UNBIND__
        nv_watch_sim_iccid_t * sim_iccid_data;
 #endif
-       nv_watch_sensor_hx3918_data_t * sensor_hx3918_data;
+       nv_watch_not_clean_data_t * not_clean_data;
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
        nv_watch_remind_wake_up_t * remind_wake_up_data;
 #endif
@@ -541,11 +542,12 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
                        break;                  
        #endif
 
-               case NV_SECTION_UI_SENSOR_HX3918_DATA:
-                       sensor_hx3918_data = lv_mem_alloc(SectionLen);
-                       memset(sensor_hx3918_data, 0x0, SectionLen);
-                       TempData = (char *)sensor_hx3918_data;
-                       break;                  
+               case NV_SECTION_UI_Not_Clear_DATA:
+                       not_clean_data = lv_mem_alloc(SectionLen);
+                       memset(not_clean_data, 0x0, SectionLen);
+                       TempData = (char *)not_clean_data;
+            
+                   break;              
 
        #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
                case NV_SECTION_UI_REMIND_WAKE_UP_DATA:
@@ -570,13 +572,16 @@ uint8_t UI_NV_Reset_Default(NV_UI_SECTION_ID SectionId)
             TempData = NULL;
             break;
     }
-
-    snprintf(FilePath, NV_MAX_SECTION_PATH_NAME, "%s%s", NV_SECTION_ROOT_DIR, UI_NV_Get_Section_path(SectionId));
-    UI_FILE_REMOVE(FilePath);
-    pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_WRITE_ONLY);
-    UI_FILE_WRITE(pfile, TempData, SectionLen);                                                          // write to operate file
-    UI_FILE_CLOSE(pfile);
-    lv_mem_free(TempData);
+    if(TempData != NULL)
+    {
+        snprintf(FilePath, NV_MAX_SECTION_PATH_NAME, "%s%s", NV_SECTION_ROOT_DIR, UI_NV_Get_Section_path(SectionId));
+        UI_FILE_REMOVE(FilePath);
+        pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_WRITE_ONLY);
+        UI_FILE_WRITE(pfile, TempData, SectionLen);                                                          // write to operate file
+        UI_FILE_CLOSE(pfile);
+        lv_mem_free(TempData);
+    }
+    
     return (1);
 }
 
@@ -598,7 +603,7 @@ uint32_t UI_NV_Write_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t L
     SectionLen = UI_NV_Get_Section_Len(SectionId);
 
     if(SectionLen < (Offset + Len)) {
-        printf("Len of Section is %d, offset + len = %d is too big\n",
+        cplog_printf("Len of Section is %d, offset + len = %d is too big\n",
                SectionLen,
                Offset + Len);
         return(0);
@@ -609,7 +614,7 @@ uint32_t UI_NV_Write_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t L
 
     pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_RD_APPEND);
     if(NULL == pfile->file_d) {
-        printf("please check file path\n");
+        cplog_printf("please check file path\n");
         UI_NV_Reset_Default(SectionId);
         return(0);
     }
@@ -617,7 +622,7 @@ uint32_t UI_NV_Write_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t L
     UI_FILE_SEEK(pfile, Offset);                        // write nv data
     WriteLen = UI_FILE_WRITE(pfile, Data, Len);
     if(0 == WriteLen) {
-        printf("write in fs is wrong, return default valure\n");
+        cplog_printf("write in fs is wrong, return default valure\n");
         return(0);
     }
     UI_FILE_CLOSE(pfile);
@@ -640,7 +645,7 @@ uint32_t UI_NV_Read_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t Le
     char      FilePath[NV_MAX_SECTION_PATH_NAME] = {0};
 
     if(SectionLen < (Offset + Len)) {
-        printf("len of section is %d, offset + len = %d is too big\n",
+        cplog_printf("len of section is %d, offset + len = %d is too big\n",
                SectionLen,
                Offset + Len);
         return(ReadLen);
@@ -650,7 +655,7 @@ uint32_t UI_NV_Read_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t Le
     snprintf(FilePath, NV_MAX_SECTION_PATH_NAME, "%s%s", NV_SECTION_ROOT_DIR, UI_NV_Get_Section_path(SectionId));
     pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_RD_APPEND);
     if(NULL == pfile->file_d) {
-        printf("please check file path\n");
+        cplog_printf("please check file path\n");
     } else {
         UI_FILE_SEEK(pfile, Offset);                // read data
         ReadLen = UI_FILE_READ(pfile, Data, Len);
@@ -658,11 +663,11 @@ uint32_t UI_NV_Read_Req(NV_UI_SECTION_ID SectionId, uint32_t Offset, uint32_t Le
     }
 
     if(0 == ReadLen) {
-        printf("read in fs is wrong return default value\n");
+        cplog_printf("read in fs is wrong return default value\n");
         if(1 == UI_NV_Reset_Default(SectionId)) {
             pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_RD_APPEND);
             if(NULL == pfile->file_d) {
-                printf("please check file path\n");
+                cplog_printf("please check file path\n");
                 return(0);
             }
 
@@ -688,8 +693,11 @@ void UI_NV_Restroe_Req(void)
         // section before this has default value,open default nv file
         snprintf(FilePath, NV_MAX_SECTION_PATH_NAME, "%s%s", NV_SECTION_ROOT_DIR, UI_NV_Get_Section_path(i));
         pfile = UI_FILE_OPEN((const char *)FilePath, UI_FILE_READ_ONLY);
-        if(NULL == pfile->file_d) {
-            UI_NV_Reset_Default(i);
+        if(NULL == pfile->file_d) {           
+                UI_NV_Reset_Default(i);
+                
+            
+                
         }
         UI_FILE_CLOSE(pfile);
     }
index 0e120ed..1624a80 100644 (file)
@@ -300,8 +300,8 @@ typedef struct
 
 typedef struct
 {
-    uint32_t data[4];                 // ::string
-} __packed nv_watch_sensor_hx3918_data_t;
+    uint32_t hx3918_data[4];                 // ::string
+} __packed nv_watch_not_clean_data_t;
 
 
 
@@ -506,7 +506,7 @@ enum
        NV_SECTION_UI_SIM_UNBIND_SWITCH,                                // nv_watch_switch_t
        NV_SECTION_UI_SIM_ICCID_DATA,                                   // nv_watch_sim_iccid_t
 #endif
-       NV_SECTION_UI_SENSOR_HX3918_DATA,                               // nv_watch_sensor_hx3918_data_t
+       NV_SECTION_UI_Not_Clear_DATA,                           // nv_watch_not_clean_data_t
 #ifdef __MMI_REMIND_WAKE_UP_SUPPORT__
        NV_SECTION_UI_REMIND_WAKE_UP_DATA,                              // nv_watch_remind_wake_up_t
 #endif
index a3cfd57..af1202f 100644 (file)
@@ -6605,7 +6605,7 @@ int nvm_tfs_findfirst(char *filename_ptr, FILE_INFO *fileinfo_ptr)
        long rec;
        UINT32 file_size=0;
 
-//     qspi_printf("nvm_tfs_findfirst %s\r\n",filename_ptr);
+       cplog_printf("nvm_tfs_findfirst %s\r\n",filename_ptr);
 
        DIAG_FILTER(TFSOP, FFINDFIRST, LAB001, DIAG_INFORMATION)
        diagPrintf("nvm_tfs_findfirst %s", filename_ptr);
@@ -6619,7 +6619,7 @@ int nvm_tfs_findfirst(char *filename_ptr, FILE_INFO *fileinfo_ptr)
        if ((filename_ptr == NULL) ||(strlen(filename_ptr) >= NVM_TFS_FILE_NAME_LEN_MAX))
        {
                nvm_tfs_unlock();
-               qspi_printf("file name error\r\n");
+               cplog_printf("file name error\r\n");
                return 1;
        }
 
@@ -6630,11 +6630,11 @@ int nvm_tfs_findfirst(char *filename_ptr, FILE_INFO *fileinfo_ptr)
 
                if(p_tfs_file_info->free==0)
                {
-//                     qspi_printf("Match:%s,%s\r\n", p_tfs_file_info->file_name, filename_ptr);
+                       //cplog_printf("Match:%s,%s\r\n", p_tfs_file_info->file_name, filename_ptr);
 
                        if (NVMFileNameMatch(p_tfs_file_info->file_name, filename_ptr))
                        {
-//                             qspi_printf("Matched %s, %s\r\n", p_tfs_file_info->file_name, filename_ptr);
+                               //cplog_printf("Matched %s, %s\r\n", p_tfs_file_info->file_name, filename_ptr);
 
                                file_size=p_tfs_file_info->size;
 
@@ -10246,7 +10246,7 @@ void FDI_Factory_Reset(void)
        diagPrintf("filter file count: %d",count);
        for(i=0;i<count;i++)
        {
-               uart_printf("%s ",filename_filter[i]);
+               uart_printf("count: %d %s ",count,filename_filter[i]);
        }
        uart_printf("\r\n");
 
@@ -10256,49 +10256,61 @@ void FDI_Factory_Reset(void)
                ret=FDI_findfirst("*", &info);
                if (ret!=0)
                        return;
-       if(get_fs_mode()==FAT_FS_MODE)
-       {
-               for(i=0;i<FILE_NUM_LFS;i++)
+               if(get_fs_mode()==FAT_FS_MODE)
                {
-       //              uart_printf("i=%d, name: %s, 0x%x\r\n",i,  FILE_LIST_LFS[i].file_name, FILE_LIST_LFS[i].permissions);
-                       // skip '.' and root '..'
-                       if ((memcmp(FILE_LIST_LFS[i].file_name, ".", 1) == 0) || ( memcmp(FILE_LIST_LFS[i].file_name, "..", 2) == 0)) 
-                               continue;
-
-                       for (j=0;j<count;j++)
+                       for(i=0;i<FILE_NUM_LFS;i++)
                        {
-                               if(strcmp(FILE_LIST_LFS[i].file_name,filename_filter[j])==0)
+                               //uart_printf("FILE_NUM_LFS:i=%d, name: %s, 0x%x\r\n",i,  FILE_LIST_LFS[i].file_name, FILE_LIST_LFS[i].permissions);
+                               // skip '.' and root '..'
+                               if ((memcmp(FILE_LIST_LFS[i].file_name, ".", 1) == 0) || ( memcmp(FILE_LIST_LFS[i].file_name, "..", 2) == 0)) 
+                                       continue;
+
+                               for (j=0;j<count;j++)
                                {
-                                       break;
+                                       if(strcmp(FILE_LIST_LFS[i].file_name,filename_filter[j])==0)
+                                       {
+                                               break;
+                                       }
+                               }
+                               if(j==count)
+                               {
+                                       if(FILE_LIST_LFS[i].permissions==FDI5_FILE_DEFAULT_PERMISSIONS)//file
+                                               ret=FDI_remove(FILE_LIST_LFS[i].file_name);
+                                       else    //dir
+                                               ret=FDI_removeDir(FILE_LIST_LFS[i].file_name);
+                                       if(ret!=0)
+                                               uart_printf("remove fail: %d, %s, 0x%x\r\n", ret, FILE_LIST_LFS[i].file_name,FILE_LIST_LFS[i].permissions);
                                }
-                       }
-                       if(j==count)
-                       {
-                               if(FILE_LIST_LFS[i].permissions==FDI5_FILE_DEFAULT_PERMISSIONS)//file
-                                       ret=FDI_remove(FILE_LIST_LFS[i].file_name);
-                               else    //dir
-                                       ret=FDI_removeDir(FILE_LIST_LFS[i].file_name);
-                               if(ret!=0)
-                                       uart_printf("remove fail: %d, %s, 0x%x\r\n", ret, FILE_LIST_LFS[i].file_name,FILE_LIST_LFS[i].permissions);
                        }
                }
-       }
-       else if(get_fs_mode()==TFS_FS_MODE)
-       {
-               do
+               else if(get_fs_mode()==TFS_FS_MODE)
                {
-                       for (j=0;j<count;j++)
+                       do
                        {
-                               if(strcmp(info.file_name,filename_filter[j])==0)
-                                       break;
-                       }
-                       if(j==count)
-                               FDI_remove(info.file_name);
+                               for (j=0;j<count;j++)
+                               {
+                                       if(strcmp(info.file_name,filename_filter[j])==0)
+                                               break;
+                               }
+                               if(j==count)
+                               {
+                                       //uart_printf("TFS_FS_MODE:FDI_remove:%s \r\n",info.file_name);
+                                       //不删除Not_Clear.nvm
+                                       if(strcmp(info.file_name,"Not_Clear.nvm")!=0)
+                                       {
+                                               FDI_remove(info.file_name);
+                                               uart_printf("TFS_FS_MODE:FDI_remove:%s \r\n",info.file_name);
+                                       }else
+                                               uart_printf("TFS_FS_MODE:Not remove:%s \r\n",info.file_name);
+                                               
+                               }
+                                       
 
-                       ret=FDI_findnext(&info);
-               }while(ret==0);
+                               ret=FDI_findnext(&info);
+                               //uart_printf("TFS_FS_MODE:%s \r\n",info.file_name);
+                       }while(ret==0);
 
-       }
+               }
                nvm_cache_flush_all();
        }
        else
index ee1e706..cfd1968 100644 (file)
@@ -38,7 +38,8 @@
 #ifdef PLAT_USE_ALIOS
 #include "alios_mbedtls_config.h"
 #else
-#include "asros_mbedtls_config.h"
+#include "../../asros/asros_mbedtls_config.h"
+//#include "asros_mbedtls_config.h"
 #endif
 
 #if defined(MBEDTLS_USER_CONFIG_FILE)