diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-01 14:34:42 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-12-01 14:34:42 +0200 |
| commit | 797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f (patch) | |
| tree | d16c6a43558a34f0d2d2fb2cb0c7d7393eddb67d /Software/Embedded_SW/Embedded/Common/SWUpdate | |
| parent | 8276e5eb7c56b58ed86f611ca5bd9b1dc56b25b9 (diff) | |
| download | Tango-797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f.tar.gz Tango-797d4654f845a6d6c8f6e02bcdc6bc11ceeed51f.zip | |
update with Beta code
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c | 65 |
1 files changed, 45 insertions, 20 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c index 7871c5e28..5650cbd1b 100644 --- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c +++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c @@ -94,32 +94,39 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer) Fresult = FR_DENIED; else { - Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); - Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); - if (Fresult == FR_OK) + if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT)) { - FileLength = request->length; - FileReceivedLength = 0; - REPORT_MSG (FileLength,"file upload request"); - response.has_maxchunklength = true; - response.maxchunklength = MAX_CHUNK_LENGTH; - strcpy(FileHandleChar, "1234"); - response.uploadid = FileHandleChar; //supporting only single file at each time. - FileDone = false; + CommRxTaskHandle = Task_self(); + Task_setPri(CommRxTaskHandle, 3); + // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); + Report("FileUploadRequestFunc 2", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); + Fresult = f_open(UploadFileHandle,request->path,FA_READ | FA_WRITE | FA_OPEN_ALWAYS | FA_CREATE_ALWAYS); + if (Fresult == FR_OK) + { + Report("FileUploadRequestFunc 3", __FILE__, __LINE__, msec_millisecondCounter, RpWarning, (int)0, 0); + FileLength = request->length; + FileReceivedLength = 0; + REPORT_MSG (FileLength,"file upload request"); + response.has_maxchunklength = true; + response.maxchunklength = MAX_CHUNK_LENGTH; + strcpy(FileHandleChar, "1234"); + response.uploadid = FileHandleChar; //supporting only single file at each time. + FileDone = false; + } + else + { + my_free (UploadFileHandle); + UploadFileHandle = 0; + Semaphore_post(FFS_Sem); + } } else { - my_free (UploadFileHandle); - UploadFileHandle = 0; - Semaphore_post(FFS_Sem); + Fresult = FR_DENIED; + Report("Semaphore_pend failed", __FILE__, __LINE__, 4, RpWarning, (int)0, 0); } - } } - CommRxTaskHandle = Task_self(); - Task_setPri(CommRxTaskHandle, 4); - // Report("Task_setPri", __FILE__, __LINE__, 4, RpWarning, (int)CommRxTaskHandle, 0); - responseContainer = createContainer(MESSAGE_TYPE__FileUploadResponse, requestContainer->token, false, &response, &file_upload_response__pack, &file_upload_response__get_packed_size); if (Fresult!= FR_OK) @@ -533,6 +540,8 @@ uint32_t GetStorageInfoRequestFunc(MessageContainer* requestContainer) return OK; } +//char Datestr[100]; + uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) { //uint32_t status = OK; @@ -549,6 +558,15 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) char FullPath[MAX_NUM_OF_FILES][60]; int i,NumOfFiles = 0; FRESULT Fresult = FR_OK; + /* + time_t t; + struct tm *ltm; + char *curTime; + t = time(NULL); + ltm = localtime(&t); + curTime = asctime(ltm); + Report(curTime, __FILE__, ltm->tm_hour,ltm->tm_min , RpWarning, ltm->tm_sec, 0); + */ Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER); Fresult |= f_opendir(&dir, g_cCwdBuf); @@ -600,7 +618,14 @@ uint32_t GetFilesRequestFunc(MessageContainer* requestContainer) Data[i].lastmodifieddate = fno[i]->fdate; Data[i].has_lastmodifiedtime = true; Data[i].lastmodifiedtime = fno[i]->ftime; - //Report(Data[i].name, __FILE__, __LINE__, Data[i].lastmodifieddate, RpWarning, (int)Data[i].lastmodifiedtime, 0); + /* + t = (fno[i]->fdate<<16)+fno[i]->ftime; + ltm = localtime(&t); + curTime = asctime(ltm); + usnprintf(&Datestr, 100, "File info %s %s",fno[i]->fname, curTime); + Report(Datestr, __FILE__, __LINE__, t, RpWarning, (int)Data[i].lastmodifiedtime, 0); + Task_sleep(50); + */ if (i==0) usnprintf(&FullPath[i], 50, "%s", request->path); |
