aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-26 13:24:31 +0200
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-02-26 13:24:31 +0200
commit6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9 (patch)
tree832169bbbb3fb93063230b8c767f6f6ac777f3ca /Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
parenta64cfe8b7dec8417a3d380b55f4ae79c5459f49d (diff)
parent5cedf7cc7de176c6b3ecdcef9b7ad1382400e880 (diff)
downloadTango-6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9.tar.gz
Tango-6b223bcd7f7e1e0b76a33ecd00c17d7b846c91a9.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 873c89b7e..1ba656657 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -100,7 +100,7 @@ uint32_t FileUploadRequestFunc(MessageContainer* requestContainer)
if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT))
{
CommRxTaskHandle = Task_self();
- Task_setPri(CommRxTaskHandle, 3);
+ Task_setPri(CommRxTaskHandle, 2);
// 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);
@@ -280,16 +280,22 @@ uint32_t FileDownloadRequestFunc(MessageContainer* requestContainer)
Fresult = FR_DENIED;
else
{
- Semaphore_pend(FFS_Sem, BIOS_WAIT_FOREVER);
- Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
- if (Fresult == FR_OK)
+ if (Semaphore_pend(FFS_Sem, BIOS_NO_WAIT))
{
- response.has_maxchunklength = true;
- response.maxchunklength = MAX_CHUNK_LENGTH;
- strcpy(FileHandleChar, "1234");
- response.downloadid = FileHandleChar; //supporting only single file at each time.
+ Fresult = f_open(DownloadFileHandle,request->filename,FA_READ );
+ if (Fresult == FR_OK)
+ {
+ response.has_maxchunklength = true;
+ response.maxchunklength = MAX_CHUNK_LENGTH;
+ strcpy(FileHandleChar, "1234");
+ response.downloadid = FileHandleChar; //supporting only single file at each time.
+ Report("data request", __FILE__, 1234, MAX_CHUNK_LENGTH, RpWarning, (int)fno->fsize, 0);
+ }
+ else
+ {
+ Semaphore_post(FFS_Sem);
+ }
}
-
}
}
@@ -323,10 +329,11 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
Buffer = my_malloc (MAX_CHUNK_LENGTH);
if (Buffer != NULL)
{
- Fresult = f_read(SentFileHandle,Buffer,2000,&ReadBytes );
+ Fresult = f_read(SentFileHandle,Buffer,MAX_CHUNK_LENGTH,&ReadBytes );
if(Fresult != FR_OK)
{
- LOG_ERROR (Fresult,"f_write error");
+ LOG_ERROR (Fresult,"f_read error");
+ Semaphore_post(FFS_Sem);
}
else
{
@@ -334,6 +341,7 @@ uint32_t FileChunkDownloadRequestFunc(MessageContainer* requestContainer)
response.buffer.len = ReadBytes;
response.buffer.data = Buffer;
FileSentLength += ReadBytes;
+ Report("sending data to MS", __FILE__, ReadBytes, FileSentLength, RpWarning, (int)FileLength, 0);
if (FileSentLength == FileLength)
{
REPORT_MSG (FileSentLength,"file download ended successfully");