FreeCalypso > hg > freecalypso-sw
changeset 613:9e605ec89ed0
gsm-fw/L1/stand: starting work on our version of standalone L1
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Fri, 29 Aug 2014 17:25:46 +0000 |
parents | 700d450bb8da |
children | 4274171eabd2 |
files | gsm-fw/L1/stand/README gsm-fw/L1/stand/cus_l1.h gsm-fw/L1/stand/dll-functions gsm-fw/L1/stand/l1.h gsm-fw/L1/stand/l1_pei.c |
diffstat | 5 files changed, 722 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/stand/README Fri Aug 29 17:25:46 2014 +0000 @@ -0,0 +1,33 @@ +In their internal development environment, TI had a way to build L1 standalone, +i.e., omitting the G23 protocol stack and other large and complex pieces of the +full firmware. Such an ability is essential for sane development, and the +abundant references to OP_L1_STANDALONE throughout the codebase confirm that TI +had it indeed. + +However, we (FreeCalypso) don't have a way to build an OP_L1_STANDALONE image +exactly the way TI did it - we don't have all of the necessary source - the +glue pieces specific to this configuration are missing. Nor do we necessarily +need to imitate what TI did in this department: it appears that TI's standalone +L1 build omitted GPF (with the exception of OS and OSX) and everything that +lives in Riviera land, but for us the situation is different: we already have +a successful build with Riviera and GPF, but no L1, thus we simply need to add +L1 to what we have. Our idea of standalone L1 simply means building without +the G23 stack, which we have yet to begin integrating. + +In the standard firmware build, there is a component called L1 PEI. It is part +of the G23 stack, and has header and library dependencies of the latter - thus +it is *not* part of the L1 code proper. However, it performs some essential +initialization steps, and runs the L1A task. We don't know how TI handled +these functions in their standalone L1 build - we don't have that part of their +source, not even in the otherwise complete LoCosto version, not even if we were +targeting LoCosto hardware. + +Our solution: we are going to lift l1_pei out of LoCosto's g23m-gsm, and hack +up a special version of it that won't have the standard complement of G23 +header and library dependencies. It is virtually certain that TI did something +different, but our hack-solution should work for our needs. + +Because our standalone L1 build is a specially stripped-down version of the +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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/stand/cus_l1.h Fri Aug 29 17:25:46 2014 +0000 @@ -0,0 +1,55 @@ +/* ++----------------------------------------------------------------------------- +| Project : GSM-PS (6147) +| Modul : CUS_L1 ++----------------------------------------------------------------------------- +| 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 : Custom dependent definitions for L1 of the +| mobile station ++----------------------------------------------------------------------------- +*/ + +#ifndef CUS_L1_H +#define CUS_L1_H + +/*==== CONSTANTS ==================================================*/ +/* + * VERSION + * + * Description : The constants define the type and the value + * of a version identification. The version + * is part of the monitor struct. + */ + +#define T_VERSION char +#define VERSION_L1 "L1 1.0" + +/* + * VSI_CALLER + * + * Description : For multithread applications the constant VSI_CALLER + * must be defined to identify the calling thread of the + * VSI-Interface. This must be done correponding to the + * type of T_VSI_CALLER in VSI.H. The comma symbol is + * neccessary because the vsi-functions are called + * like this vsi_xxx (VSI_CALLER par2, par3 ...) + */ + +#ifdef NEW_FRAME + #define VSI_CALLER L1_Handle, +#else + #define VSI_CALLER L1_NAME, +#endif + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/stand/dll-functions Fri Aug 29 17:25:46 2014 +0000 @@ -0,0 +1,9 @@ +L1S (l1_cmplx.c specifically) calls these 3 functions which are normally +defined in the DL protocol stack entity: + +dll_dcch_downlink() +dll_read_dcch() +dll_read_sacch() + +If we are building L1 standalone (without the G23 protocol stack), we need +to provide stubs for these functions.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/stand/l1.h Fri Aug 29 17:25:46 2014 +0000 @@ -0,0 +1,137 @@ +/* ++----------------------------------------------------------------------------- +| 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 : Definitions for the Protocol Stack Entity l1. ++----------------------------------------------------------------------------- +*/ + +#ifndef L1_H +#define L1_H + +#ifdef TI_PS_HCOMM_CHANGE +#include "cl_hComm_handle.h" + +#ifdef NEW_FRAME + + + #define hCommGRR l1_hCommGRR + #define hCommLLC l1_hCommLLC + #define hCommSNDCP l1_hCommSNDCP + #define hCommGMM l1_hCommGMM + #define hCommTOM l1_hCommTOM + + #define L1_Handle l1_L1_Handle + +/*jk: delete warnings #define VSI_CALLER L1_Handle, */ + + #ifdef L1_PEI_C + + /* Communication handles */ + + #ifdef GPRS + T_HANDLE hCommGRR = VSI_ERROR; + T_HANDLE hCommLLC = VSI_ERROR; + T_HANDLE hCommSNDCP = VSI_ERROR; + T_HANDLE hCommGMM = VSI_ERROR; + T_HANDLE hCommTOM = VSI_ERROR; + #endif + T_HANDLE L1_Handle; + + #else /* L1_PEI_C */ + + extern T_HANDLE hCommGRR; + extern T_HANDLE hCommLLC; + extern T_HANDLE hCommSNDCP; + extern T_HANDLE hCommGMM; + extern T_HANDLE hCommTOM; + extern T_HANDLE L1_Handle; + + #endif /* L1_PEI_C */ + +#else /* NEW_FRAME */ + + #define PL_NAME "PL" + #define L1_NAME "L1" + + #define VSI_CALLER L1_NAME, + +#endif /* NEW_FRAME */ +#else +#ifdef NEW_FRAME + + #define hCommPL l1_hCommPL + #define hCommL1 l1_hCommL1 + #define hCommGRR l1_hCommGRR + #define hCommLLC l1_hCommLLC + #define hCommSNDCP l1_hCommSNDCP + #define hCommGMM l1_hCommGMM + #define hCommTOM l1_hCommTOM + #define hCommACI l1_hCommACI + #define L1_Handle l1_L1_Handle + +/*jk: delete warnings #define VSI_CALLER L1_Handle, */ + + #ifdef L1_PEI_C + + /* Communication handles */ + T_HANDLE hCommPL = VSI_ERROR; + T_HANDLE hCommACI = VSI_ERROR; + T_HANDLE hCommL1 = VSI_ERROR; + #ifdef GPRS + T_HANDLE hCommGRR = VSI_ERROR; + T_HANDLE hCommLLC = VSI_ERROR; + T_HANDLE hCommSNDCP = VSI_ERROR; + T_HANDLE hCommGMM = VSI_ERROR; + T_HANDLE hCommTOM = VSI_ERROR; + #endif + T_HANDLE L1_Handle; + + #else /* L1_PEI_C */ + + extern T_HANDLE hCommPL; + extern T_HANDLE hCommACI; + extern T_HANDLE hCommL1; + extern T_HANDLE hCommGRR; + extern T_HANDLE hCommLLC; + extern T_HANDLE hCommSNDCP; + extern T_HANDLE hCommGMM; + extern T_HANDLE hCommTOM; + extern T_HANDLE L1_Handle; + + #endif /* L1_PEI_C */ + +#else /* NEW_FRAME */ + + #define PL_NAME "PL" + #define L1_NAME "L1" + + #define VSI_CALLER L1_NAME, + + #ifdef L1_PEI_C + + T_VSI_CHANDLE hCommPL = VSI_ERROR; + T_VSI_CHANDLE hCommL1 = VSI_ERROR; + + #else /* L1_PEI_C */ + + extern T_VSI_CHANDLE hCommPL; + extern T_VSI_CHANDLE hCommL1; + + #endif /* L1_PEI_C */ + +#endif /* NEW_FRAME */ +#endif /* TI_PS_HCOMM_CHANGE */ +#endif /* L1_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/L1/stand/l1_pei.c Fri Aug 29 17:25:46 2014 +0000 @@ -0,0 +1,488 @@ +/* ++----------------------------------------------------------------------------- +| 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. ++----------------------------------------------------------------------------- +*/ + +#define L1_PEI_C + +#define ENTITY_L1 + +#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 "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 =================================================================*/ + +typedef struct +{ + char *version; +} T_MONITOR; + +/*==== LOCALS ================================================================*/ + +static T_MONITOR l1_mon; +static USHORT first_access = TRUE; + +/*==== PROTOTYPES ============================================================*/ + +SHORT pei_create (T_PEI_INFO **info); + +void l1_create_ISR (void); +void l1a_task(unsigned arcg, void *argv); + +/*==== PRIVATE FUNCTIONS =====================================================*/ + + +/* ++------------------------------------------------------------------------------ +| 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 +| +| Parameters : handle - task handle +| +| Return : PEI_OK - entity initialised +| 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; + _osx_init(); + } + /* + * Associate own "queue" handle (a task handle in the end) with L1_QUEUE, + * in order to be able to receive primitives. + */ + if (hCommL1 < VSI_OK) + { + if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK) + return PEI_ERROR; + _osx_open (VSI_CALLER L1_QUEUE, hCommL1); + } +#endif + + if (hCommPL < VSI_OK) + { + if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < 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); + } +#endif /* TI_PS_HCOMM_CHANGE */ + +#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 + + /* + * Register VSI_CALLER as generic caller entity. + */ + _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; +} + +#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; +} + +/* ++------------------------------------------------------------------------------ +| Function : pei_run ++------------------------------------------------------------------------------ +| Description : Process Primitives, main loop is located in the +| Protocol Stack Entity. +| Only needed in active body variant +| +| Parameters : taskhandle - handle of current process +| comhandle - queue handle of current process +| +| Return : PEI_OK - sucessful +| 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; +} + +/* ++------------------------------------------------------------------------------ +| Function : pei_config ++------------------------------------------------------------------------------ +| Description : Dynamic Configuration. +| +| Parameters : in_string - configuration string +| +| Return : PEI_OK - sucessful +| PEI_ERROR - not successful ++------------------------------------------------------------------------------ +*/ +LOCAL SHORT pei_config (T_PEI_CONFIG inString) +{ + + + if ( _osx_config ( inString ) == OSX_OK ) + return PEI_OK; + else + return PEI_ERROR; +} + +/* ++------------------------------------------------------------------------------ +| Function : pei_monitor ++------------------------------------------------------------------------------ +| Description : Monitoring of physical Parameters. +| +| Parameters : out_monitor - return the address of the data to be monitored +| +| Return : PEI_OK - sucessful (address in out_monitor is valid) +| 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"; + *monitor = &l1_mon; + + return PEI_OK; +} + + +/*==== PUBLIC FUNCTIONS =====================================================*/ + +/* ++------------------------------------------------------------------------------ +| Function : pei_create ++------------------------------------------------------------------------------ +| Description : Create the Protocol Stack Entity. +| +| Parameters : info - Pointer to the structure of entity parameters +| +| Return : PEI_OK - entity created successfully +| ++------------------------------------------------------------------------------ +*/ +#if defined (NEW_FRAME) + +GLOBAL SHORT l1_pei_create ( T_PEI_INFO **info ) +{ + static T_PEI_INFO pei_info = + { + "L1", + { + pei_init, +#ifdef _SIMULATION_ + pei_exit, +#else + NULL, +#endif + NULL, /* no primitive function */ + NULL, /* no timeout function */ + NULL, /* no signal function */ + pei_run, + 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 + }; + + /* + * export startup configuration data + */ + *info = &pei_info; + /* + * Initialize entity data + */ + + 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 ==========================================================*/