changeset 228:a40cdf33f1f6

l1tm_func.c: l1tm_version_get() reconstructed
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jan 2017 04:37:08 +0000
parents 19f9395bb274
children 5bac269a6c27
files chipsetsw/layer1/tm_cfile/l1tm_func.c
diffstat 1 files changed, 50 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 01:07:58 2017 +0000
+++ b/chipsetsw/layer1/tm_cfile/l1tm_func.c	Sun Jan 15 04:37:08 2017 +0000
@@ -1001,9 +1001,9 @@
   Cust_tm_tx_template_read(tm_return, prim->u.tm_table.index);
 }
 
+/* TCS211 function missing in LoCosto, reconstructed from disassembly */
 void l1tm_mode_set(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)
 {
-  /* TCS211 function missing in LoCosto, reconstructed from disassembly */
   switch (prim->u.tm_params.index) {
   case 0:
     l1_config.TestMode = 0;
@@ -1024,9 +1024,57 @@
   tm_return->size = 0;
 }
 
+/* TCS211 function missing in LoCosto, reconstructed from disassembly */
 void l1tm_version_get(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)
 {
-/* TCS211 function missing in LoCosto, to be reconstructed from disasm */
+  UWORD16 revision;
+  extern  T_RF rf;
+
+  tm_return->index = prim->u.tm_params.index;
+
+  switch (prim->u.tm_params.index) {
+    /* "meat" of this switch statement taken from LoCosto etm_tm3core.c */
+    case BBCHIP_MODULE_REV:
+        revision = CHIPSET;
+        break;
+    case CHIPID_MODULE_REV:
+        revision = *( (volatile UWORD16 *) (MEM_JTAGID_PART));
+        break;
+    case CHIPVER_MODULE_REV:
+        revision = *( (volatile UWORD16 *) (MEM_JTAGID_VER));
+        break;
+    case DSPSW_MODULE_REV:
+        revision = l1s.version.dsp_code_version;
+        break;
+    case ANALOGCHIP_MODULE_REV:
+        revision = ((ANLG_PG << 7) | ANLG_FAM);
+        break;
+    case LAYER1_MODULE_REV:
+        revision = l1s.version.mcu_tcs_official;
+        break;                
+    case RFDRIVER_MODULE_REV:
+        revision = rf.rf_revision;
+        break;                
+    case TM_API_MODULE_REV:
+        revision = TMAPIVERSION;
+        break;
+    case L1_TM_CORE_MODULE_REV:
+        revision = l1s.version.mcu_tm_version;
+        break;
+    case DSP_MODULE_REV:
+        revision = DSP;
+        break;
+    case RF_MODULE_REV: 
+        revision = ((RF_PA << 10) | (RF_PG << 7) | RF_FAM);
+        break;
+    default:
+        tm_return->status = E_BADINDEX;
+        tm_return->size = 0;
+        return;
+  }
+  memcpy(tm_return->result, &revision, sizeof revision);
+  tm_return->size = sizeof revision;
+  tm_return->status = E_OK;
 }
 
 void l1tm_mem_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return)