changeset 230:217942c111e1

l1tm_func.c: l1tm_mem_read() reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jan 2017 05:33:34 +0000
parents 5bac269a6c27
children 28734e076576
files chipsetsw/layer1/tm_cfile/l1tm_func.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 05:07:32 2017 +0000
+++ b/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 05:33:34 2017 +0000
@@ -1093,9 +1093,20 @@
   tm_return->status = E_OK;
 }
 
+/* TCS211 function missing in LoCosto, reconstructed from disassembly */
 void l1tm_mem_read(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)
 {
-/* TCS211 function missing in LoCosto, to be reconstructed from disasm */
+  tm_return->index = 0;
+  if (prim->u.mem_read.length > TM_PAYLOAD_UPLINK_SIZE_MAX - 4) {
+    tm_return->size = 0;
+    tm_return->status = E_BADSIZE;
+    return;
+  }
+  memcpy(tm_return->result, &prim->u.mem_read.length, 4);
+  memcpy(tm_return->result + 4, (UWORD8 *) prim->u.mem_read.src,
+         prim->u.mem_read.length);
+  tm_return->size = prim->u.mem_read.length + 4;
+  tm_return->status = E_OK;
 }
 
 void l1tm_codec_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)