Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
29:8e7c5c1e9aab
Parent:
28:0376b97b4b55
Child:
30:d775c1409849
diff -r 0376b97b4b55 -r 8e7c5c1e9aab src/d7a_fs.cpp
--- a/src/d7a_fs.cpp	Mon Apr 04 14:00:28 2016 +0000
+++ b/src/d7a_fs.cpp	Tue May 03 16:53:52 2016 +0000
@@ -36,6 +36,7 @@
     Queue<void, 8> fs_done;
     WriteFileFunction write_file;
     ReadFileFunction read_file;
+    TouchFileFunction touch_file;
     Queue<d7a_com_rx_msg_t, 16> pkt_queue;
     uint8_t  hdr_map[FS_MAX_FILE_QTY];
     uint8_t  nb_files;
@@ -46,13 +47,14 @@
 
 void d7a_fs_thread(const void *p);
 
-void d7a_fs_open(WriteFileFunction write_file, ReadFileFunction read_file)
+void d7a_fs_open(WriteFileFunction write_file, ReadFileFunction read_file, TouchFileFunction touch_file)
 {
     FPRINT("\r\n");
     
     memset(&g_fs_ctx.com, 0, sizeof(g_fs_ctx.com));
     g_fs_ctx.write_file = write_file;
     g_fs_ctx.read_file = read_file;
+    g_fs_ctx.touch_file = touch_file;
     //g_fs_ctx.fs_done = new Semaphore(1);
     g_fs_ctx.thread = new Thread(d7a_fs_thread, NULL, osPriorityBelowNormal, DEFAULT_STACK_SIZE*2);
     
@@ -337,6 +339,11 @@
                     //d7a_fs_create(req->fid,(d7a_fs_properties_t*)&pkt->buffer[OP_SIZE_CREATE]);
                     //d7a_fs_msg((uint8_t*)&buf, OP_SIZE_RETSTAT, KAL_COM_FLOW_FS_RESP);
                 }
+                else if (req->cmd == FS_OP_TOUCH)
+                {
+                    buf.length = g_fs_ctx.touch_file(req->fid, req->offset, req->length);
+                    d7a_fs_msg((uint8_t*)&buf, OP_SIZE_RETSTAT, KAL_COM_FLOW_FS_RESP);
+                }
                 else
                 {
                     ASSERT(false, "FS: Unknown cmd %d\r\n", req->cmd);