diff gsm-fw/L1/stand/l1_pei.c @ 614:4274171eabd2

gsm-fw/L1/stand/l1_pei.c: getting close to passing compilation
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 29 Aug 2014 18:38:07 +0000
parents 9e605ec89ed0
children 4d40f9a99445
line wrap: on
line diff
--- a/gsm-fw/L1/stand/l1_pei.c	Fri Aug 29 17:25:46 2014 +0000
+++ b/gsm-fw/L1/stand/l1_pei.c	Fri Aug 29 18:38:07 2014 +0000
@@ -1,23 +1,7 @@
-/* 
-+----------------------------------------------------------------------------- 
-|  Project :  
-|  Modul   :  
-+----------------------------------------------------------------------------- 
-|  Copyright 2002 Texas Instruments Berlin, AG 
-|                 All rights reserved. 
-| 
-|                 This file is confidential and a trade secret of Texas 
-|                 Instruments Berlin, AG 
-|                 The receipt of or possession of this file does not convey 
-|                 any rights to reproduce or disclose its contents or to 
-|                 manufacture, use, or sell anything it may describe, in 
-|                 whole, or in part, without the specific written consent of 
-|                 Texas Instruments Berlin, AG. 
-+----------------------------------------------------------------------------- 
-|  Purpose :  This module implements the process body interface
-|             for the entity L1.
-+----------------------------------------------------------------------------- 
-*/ 
+/*
+ * This is a bastardized version of L1 PEI that will be used only when
+ * building FreeCalypso in the standalone L1 configuration; see README.
+ */
 
 #define L1_PEI_C
 
@@ -26,70 +10,13 @@
 #define CUST_OS_C
 /*==== INCLUDES =============================================================*/
 
-#if 1
 #include <string.h>
-#if defined (NEW_FRAME)
- #include "typedefs.h"  /* to get Condat data types */
-#else
- #include "stddefs.h"   /* to get Condat data types */
-#endif
+#include "typedefs.h"	/* to get Condat data types */
 #include "vsi.h"        /* to get a lot of macros */
-#include "custom.h"
-#ifdef GPRS
-#include "macdef.h"
-#include "gprs.h"
-#endif
-#include "gsm.h"        /* to get a lot of macros */
-#include "prim.h"       /* to get the definitions of used SAP and directions */
 #include "pei.h"        /* to get PEI interface */
 #include "tools.h"      /* to get common tools */
-#include "l1.h"         /* to get the global entity definitions */
 #include "cust_os.h"    /* to get cust_os definitions */
 
-#else /* 1 */
-
-#if defined NEW_FRAME
-
-#include <string.h>
-#include <stdio.h>
-#include "typedefs.h"
-#include "pconst.cdg"
-#include "mconst.cdg"
-#include "message.h"
-#include "ccdapi.h"
-#include "vsi.h"
-#include "custom.h"
-#include "gsm.h"
-#include "prim.h"
-#include "cnf_l1.h"
-#include "mon_l1.h"
-#include "cus_l1.h"
-#include "pei.h"
-#include "tok.h"
-#include "l1.h"
-
-
-#else
-#include <string.h>
-#include <stdio.h>
-#include "stddefs.h"
-#include "pconst.cdg"
-#include "mconst.cdg"
-#include "message.h"
-#include "ccdapi.h"
-#include "custom.h"
-#include "gsm.h"
-#include "prim.h"
-#include "cnf_l1.h"
-#include "mon_l1.h"
-#include "vsi.h"
-#include "pei.h"
-#include "tok.h"
-#include "l1.h"
-
-#endif
-#endif /* 1 */
-
 /*==== CONSTS ================================================================*/
 
 /*==== TYPES =================================================================*/
@@ -104,11 +31,15 @@
 static  T_MONITOR     l1_mon;
 static USHORT first_access = TRUE;
 
+static T_HANDLE       L1_Handle;
+
+#define VSI_CALLER L1_Handle,
+
+static T_HANDLE       hCommL1 = VSI_ERROR;
+
 /*==== PROTOTYPES ============================================================*/
 
-SHORT pei_create (T_PEI_INFO **info);
-
-void l1_create_ISR (void);
+void l1_create_HISR (void);
 void l1a_task(unsigned arcg, void *argv);
 
 /*==== PRIVATE FUNCTIONS =====================================================*/
@@ -116,57 +47,6 @@
 
 /*
 +------------------------------------------------------------------------------
-|  Function     :  pei_primitive
-+------------------------------------------------------------------------------
-|  Description  :  Process protocol specific primitive.
-|
-|  Parameters   :  prim      - pointer to the received primitive
-|
-|  Return       :  PEI_OK    - function succeeded
-|                  PEI_ERROR - function failed
-+------------------------------------------------------------------------------
-
-                          |           |
-                          PL         PPC(GPRS only)    UPLINK
-                          |           |
-                   +------v-----------v-------+
-                   |                          |
-                   |         L1 ASYNC         |
-                   |                          |
-                   +-------------^------------+
-                                 |
-                               L1 SYNC                 DOWNLINK
-                                 |
-
-*/
-#if defined (NEW_FRAME)
-LOCAL SHORT pei_primitive (void * ptr)
-#else
-EXPORT T_PEI_RETURN pei_primitive (T_PRIM * prim)
-#endif
-{
-#if defined (NEW_FRAME)
-  T_PRIM *prim = (T_PRIM*)ptr;
-#endif
-
-  USHORT opc = prim->custom.opc;
-
-  /*
-   * primitive is not a GSM primitive - forward it to the environment
-   */
-  if (opc & SYS_MASK)
-    vsi_c_primitive (VSI_CALLER prim);
-  else
-  {
-    PFREE (P2D(prim));
-    return PEI_ERROR;
-  }
-
-  return PEI_OK;
-}
-
-/*
-+------------------------------------------------------------------------------
 |  Function     : pei_init
 +------------------------------------------------------------------------------
 |  Description  :  Initialize Protocol Stack Entity
@@ -177,38 +57,10 @@
 |                  PEI_ERROR - entity not (yet) initialised
 +------------------------------------------------------------------------------
 */
-#if defined (NEW_FRAME)
 LOCAL SHORT pei_init ( T_HANDLE Handle )
-#else
-T_PEI_RETURN pei_init (void)
-#endif
 {
-#if defined (NEW_FRAME)
   L1_Handle = Handle;
-#endif
-
-  
 
-#ifdef TI_PS_HCOMM_CHANGE
-#ifdef NEW_FRAME
-  if ( first_access == TRUE )
-  {
-    first_access = FALSE;
-    _osx_init();
-  }
-#endif
-
-  if (!cl_hcom_all_handles_open()) return PEI_ERROR;
-
-#ifdef NEW_FRAME
-  _osx_open (VSI_CALLER L1_QUEUE, _hCommL1);
-#endif
-  _osx_open (VSI_CALLER DL_QUEUE, _hCommPL);
-  _osx_open (VSI_CALLER RR_QUEUE, _hCommPL);
-
-  _osx_open (VSI_CALLER GPF_ACI_QUEUE, _hCommMMI);
-#else
-#ifdef NEW_FRAME
   if ( first_access == TRUE )
   {
     first_access = FALSE;
@@ -220,11 +72,10 @@
    */
   if (hCommL1 < VSI_OK)
   {
-    if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK)
+    if ((hCommL1 = vsi_c_open (VSI_CALLER "L1")) < VSI_OK)
       return PEI_ERROR;
     _osx_open (VSI_CALLER L1_QUEUE, hCommL1);
   }
-#endif
 
   if (hCommPL < VSI_OK)
   {
@@ -240,7 +91,6 @@
       return PEI_ERROR;
     _osx_open (VSI_CALLER GPF_ACI_QUEUE, hCommACI);
   }
-#endif /* TI_PS_HCOMM_CHANGE */
 
 #ifdef GPRS
   if (hCommGRR < VSI_OK)
@@ -270,59 +120,8 @@
    */
   _osx_open (VSI_CALLER 0, 0);
 
-  l1_create_ISR ();
-
-  return PEI_OK;
-}
-
-/*
-+------------------------------------------------------------------------------
-|  Function     :  pei_timeout
-+------------------------------------------------------------------------------
-|  Description  :  Process timeout.
-|
-|  Parameters   :  index     - timer index
-|
-|  Return       :  PEI_OK    - timeout processed
-|                  PEI_ERROR - timeout not processed
-+------------------------------------------------------------------------------
-*/
-#if !defined (NEW_FRAME)
-
-T_PEI_RETURN l1_pei_timeout (T_VSI_THANDLE handle)
-{
-  TRACE_FUNCTION ("pei_timeout()")
-
-  return PEI_OK;
-}
+  l1_create_HISR ();
 
-#endif
-
-/*
-+------------------------------------------------------------------------------
-|  Function     :  pei_exit
-+------------------------------------------------------------------------------
-|  Description  :  Close Resources and terminate.
-|
-|  Parameters   :            -
-|
-|  Return       :  PEI_OK    - exit sucessful
-+------------------------------------------------------------------------------
-*/
-#if defined (NEW_FRAME)
-LOCAL SHORT pei_exit (void)
-#else
-T_PEI_RETURN l1_pei_exit (void)
-#endif
-{
-
-  
-
-#ifdef TI_PS_HCOMM_CHANGE
-#else
-  vsi_c_close (VSI_CALLER hCommPL);
-  hCommPL = VSI_ERROR;
-#endif
   return PEI_OK;
 }
 
@@ -341,18 +140,9 @@
 |                  PEI_ERROR   - not successful
 +------------------------------------------------------------------------------
 */
-#if defined (NEW_FRAME)
 LOCAL SHORT pei_run ( T_HANDLE taskhandle, T_HANDLE comhandle )
-#else
-T_PEI_RETURN l1_pei_run (T_VSI_CHANDLE comhandle)
-#endif
 {
-  
-#ifdef TI_PS_HCOMM_CHANGE
-#else
   hCommL1 = comhandle;
-#endif
-  
 
   l1a_task (0, NULL);
   return PEI_OK;
@@ -392,15 +182,9 @@
 |                  PEI_ERROR   - not successful
 +------------------------------------------------------------------------------
 */
-#if defined (NEW_FRAME)
 LOCAL SHORT pei_monitor (void ** monitor)
-#else
-T_PEI_RETURN l1_pei_monitor (void ** monitor)
-#endif
 {
-  
-
-  l1_mon.version = "ALR 2.0.0";
+  l1_mon.version = "FC standalone L1";
   *monitor = &l1_mon;
 
   return PEI_OK;
@@ -421,8 +205,6 @@
 |
 +------------------------------------------------------------------------------
 */
-#if defined (NEW_FRAME)
-
 GLOBAL SHORT l1_pei_create ( T_PEI_INFO **info )
 {
   static T_PEI_INFO pei_info =
@@ -430,11 +212,7 @@
     "L1",
     {
       pei_init,
-#ifdef _SIMULATION_
-      pei_exit,
-#else
       NULL,
-#endif
       NULL,             /* no primitive function */
       NULL,             /* no timeout function */
       NULL,             /* no signal function  */
@@ -442,23 +220,11 @@
       pei_config,
       pei_monitor,
     },
-    #if defined (GPRS)
     2800,     /* Stack Size      */
-    #else 
-    #if defined (FAX_AND_DATA)
-    2800,     /* Stack Size      */
-    #else
-    1805,     /* Stacksize       */
-    #endif
-    #endif
     10,       /* Queue Entries   */
     235,      /* Priority        */
     0,        /* number of timer */
-#ifdef GPRS    
     COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND      /* flags           */
-#else
-    COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND      /* flags           */
-#endif    
   };
 
   /*
@@ -472,17 +238,4 @@
   return PEI_OK;
 }
 
-#else /* NEW_FRAME */
-
-T_PEI_RETURN pei_create (T_VSI_CNAME * name)
-{
-  TRACE_FUNCTION ("pei_create()")
-
-  *name = L1_NAME;
-
-  return PEI_OK;
-}
-
-#endif /* NEW_FRAME */
-
 /*==== END OF FILE ==========================================================*/