changeset 616:4d40f9a99445

gsm-fw/L1/stand: plan to use L1IF forwarder entity
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 30 Aug 2014 22:52:35 +0000
parents 13e55e310eea
children d6cecf1e5235
files gsm-fw/L1/stand/README gsm-fw/L1/stand/l1_pei.c
diffstat 2 files changed, 39 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/L1/stand/README	Fri Aug 29 18:41:55 2014 +0000
+++ b/gsm-fw/L1/stand/README	Sat Aug 30 22:52:35 2014 +0000
@@ -31,3 +31,27 @@
 regular fw build, and not at all like TI's standalone L1, we do NOT define
 OP_L1_STANDALONE.  Instead we have a different preprocessor symbol:
 CONFIG_L1_STANDALONE.
+
+The standard version of l1_pei calls vsi_c_open() to get queue handles of
+several G23 stack entities; it connects by name to "PL", "MMI", and if GPRS is
+enabled, also to "GRR", "LLC" and "SND".  If we leave these connect-by-name
+calls unchanged in our L1 standalone version, our pei_init() will always return
+PEI_ERROR and never successfully initialize, which would not be very useful.
+If we removed these vsi_c_open() calls and the associated OSX queue setup, the
+first osx_send_prim() addressed to the queue in question will crash, so that
+approach wouldn't be useful either.
+
+What we would like to do is redirect all outbound messages emitted by our
+standalone L1 to the debug serial interface, using GPF's TST entity, just as if
+an L1 REDIRECT or DUPLICATE command was given to a complete GSM fw image.
+However, simply connecting our queues to TST won't work, as TST is not designed
+to receive "internal" protocol stack primitives directly.  When the routing
+facility is used to DUPLICATE or REDIRECT a prim to an external entity, the
+code in gpf/frame/route.c sends a special "wrapper" prim to TST, and we need to
+replicate this wrapping in order to achieve the same effect.
+
+Our solution: we are going to construct a special forwarder entity called L1IF,
+and the connect-by-name calls in l1_pei which normally point to PL, MMI etc
+will point to L1IF instead.  L1IF will run in the passive body variant, and its
+pei_primitive() function will replicate the routing facility's logic for
+forwarding PS primitives to TST.  Whew!
--- a/gsm-fw/L1/stand/l1_pei.c	Fri Aug 29 18:41:55 2014 +0000
+++ b/gsm-fw/L1/stand/l1_pei.c	Sat Aug 30 22:52:35 2014 +0000
@@ -35,7 +35,8 @@
 
 #define VSI_CALLER L1_Handle,
 
-static T_HANDLE       hCommL1 = VSI_ERROR;
+static T_HANDLE       hCommL1  = VSI_ERROR;
+static T_HANDLE       hCommFWD = VSI_ERROR;
 
 /*==== PROTOTYPES ============================================================*/
 
@@ -77,43 +78,23 @@
     _osx_open (VSI_CALLER L1_QUEUE, hCommL1);
   }
 
-  if (hCommPL < VSI_OK)
+  /*
+   * Redirect all L1-> outbound messages to our special forwarder
+   * entity; see README for the explanation.
+   */
+
+  if (hCommFWD < VSI_OK)
   {
-    if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK)
+    if ((hCommFWD = vsi_c_open (VSI_CALLER "L1IF")) < VSI_OK)
       return PEI_ERROR;
-    _osx_open (VSI_CALLER DL_QUEUE, hCommPL);
-    _osx_open (VSI_CALLER RR_QUEUE, hCommPL);
-  }
-
-  if (hCommACI < VSI_OK)
-  {
-    if ((hCommACI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK)
-      return PEI_ERROR;
-    _osx_open (VSI_CALLER GPF_ACI_QUEUE, hCommACI);
   }
 
-#ifdef GPRS
-  if (hCommGRR < VSI_OK)
-  {
-    if ((hCommGRR = vsi_c_open (VSI_CALLER GRR_NAME)) < VSI_OK)
-      return PEI_ERROR;
-    _osx_open (VSI_CALLER GRR_QUEUE, hCommGRR);
-  }
-
-  if (hCommLLC < VSI_OK)
-  {
-    if ((hCommLLC = vsi_c_open (VSI_CALLER LLC_NAME)) < VSI_OK)
-      return PEI_ERROR;
-    _osx_open (VSI_CALLER LLC_QUEUE, hCommLLC);
-  }
-
-  if (hCommSNDCP < VSI_OK)
-  {
-    if ((hCommSNDCP = vsi_c_open (VSI_CALLER SNDCP_NAME)) < VSI_OK)
-      return PEI_ERROR;
-    _osx_open (VSI_CALLER SNDCP_QUEUE, hCommSNDCP);
-  }
-#endif
+  _osx_open (VSI_CALLER DL_QUEUE, hCommFWD);
+  _osx_open (VSI_CALLER RR_QUEUE, hCommFWD);
+  _osx_open (VSI_CALLER GPF_ACI_QUEUE, hCommFWD);
+  _osx_open (VSI_CALLER GRR_QUEUE, hCommFWD);
+  _osx_open (VSI_CALLER LLC_QUEUE, hCommFWD);
+  _osx_open (VSI_CALLER SNDCP_QUEUE, hCommFWD);
 
   /*
    * Register VSI_CALLER as generic caller entity.