changeset 231:28734e076576

l1tm_func.c: l1tm_codec_write() reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jan 2017 06:06:31 +0000
parents 217942c111e1
children 3061759abe6a
files chipsetsw/layer1/tm_cfile/l1tm_func.c
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 05:33:34 2017 +0000
+++ b/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 06:06:31 2017 +0000
@@ -1109,9 +1109,27 @@
   tm_return->status = E_OK;
 }
 
+/* TCS211 function missing in LoCosto, reconstructed from disassembly */
 void l1tm_codec_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)
 {
-/* TCS211 function missing in LoCosto, to be reconstructed from disasm */
+  UWORD16 page, reg;
+
+  page = (prim->u.tm_params.index >> 5) & 1;
+  reg = prim->u.tm_params.index & 0x1F;
+  if (!l1_config.TestMode) {
+    tm_return->status = E_TESTMODE;
+    goto out;
+  }
+  if (page >= 2 || reg >= 32) {
+    tm_return->status = E_INVAL;
+    goto out;
+  }
+  ABB_Write_Register_on_page(page + 1, reg << 1,
+                             prim->u.tm_params.value & 0x3FF);
+  tm_return->status = E_OK;
+out:
+  tm_return->index = 0;
+  tm_return->size = 0;
 }
 
 void l1tm_codec_read(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)