aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2020-02-18 10:19:36 +0200
committerShlomo Hecht <shlomo@twine-s.com>2020-02-18 10:19:36 +0200
commitb14dc1bc35994c4da27bd64e7de65ff66ae7ee0d (patch)
tree514890d752ef029d97730b6021682e95f17691ee /Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
parent493a38117c886c9c9599b67c5297025e54917cfe (diff)
downloadTango-b14dc1bc35994c4da27bd64e7de65ff66ae7ee0d.tar.gz
Tango-b14dc1bc35994c4da27bd64e7de65ff66ae7ee0d.zip
preparing rapid release
Diffstat (limited to 'Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c')
-rw-r--r--Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
index 873c89b7e..e8d7f6f58 100644
--- a/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
+++ b/Software/Embedded_SW/Embedded/Common/SWUpdate/FileSystem.c
@@ -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");