FreeCalypso > hg > freecalypso-sw
changeset 316:79080922d8e4
GPF: FRAME C sources and include files imported from LoCosto source
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/esf_func.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,295 @@ +/* ++------------------------------------------------------------------------------ +| File: esf_func.c ++------------------------------------------------------------------------------ +| 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 Modul defines the ESF interface functions. ++----------------------------------------------------------------------------- +*/ + + + +#ifndef __ESF_FUNC_C__ +#define __ESF_FUNC_C__ +#endif + +#undef TEST_ESF_REGISTER + +/*==== INCLUDES ===================================================*/ + +#ifdef _NUCLEUS_ + /* the include of nucleus.h in this file is a dirty hack to mask the + issue of different type definitions in typedefs.h nad nucleus.h. + typedefs.h contains #if defined (NUCLEUS) to protect against + double definition and must be included after nucleus.h + */ + #include "nucleus.h" +#endif +#include "typedefs.h" +#include "glob_defs.h" +#include "vsi.h" +#include "os.h" +#include "os_types.h" +#include "header.h" +#include "esf_func.h" +#include "string.h" +#include "stdio.h" + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +#ifdef FF_OS_ONLY + extern char esf_pool[]; + extern int esf_pool_size; +#endif + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM + T_ESF_FUNC esf_func; +#ifdef FF_OS_ONLY + OS_HANDLE esf_pool_handle; +#endif +#else + extern T_ESF_FUNC esf_func; + extern void esf_register ( T_ESF_FUNC * func ); +#endif + +/*==== LINT =======================================================*/ + + +/*==== FUNCTIONS ==================================================*/ + +#ifdef TEST_ESF_REGISTER + +#ifndef RUN_INT_RAM +void init_func1 ( void ) +{ +#ifndef _TARGET_ + printf ("%s\n","ESF inif_func1 called"); +#endif +} +#endif + +#ifndef RUN_INT_RAM +void init_func2 ( void ) +{ +#ifndef _TARGET_ + printf ("%s\n","ESF inif_func2 called"); +#endif +} +#endif + +#ifndef RUN_INT_RAM +void send_prim ( T_PRIM_HEADER * prim ) +{ +#ifndef _TARGET_ + printf ("%s\n","ESF send_prim called"); +#endif +} +#endif + +#ifndef RUN_INT_RAM +T_ESF_FUNC esf_functions = +{ +ESF_INITIALIZED, +init_func1, +init_func2, +send_prim +}; +#endif + +#endif + +#ifdef FF_OS_ONLY +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : OS_FRM | +| STATE : code ROUTINE : esf_task_entry | ++--------------------------------------------------------------------+ + + PURPOSE : entry function for the ESF helping task. + +*/ + +GLOBAL void esf_task_entry (OS_HANDLE TaskHandle, ULONG Value) +{ + /* call second ESF init function */ + esf_init_func2(); + + /* suspend helping task forever */ + for(;;) + { + os_SuspendTask(TaskHandle,10000); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : OS_FRM | +| STATE : code ROUTINE : StartFrame | ++--------------------------------------------------------------------+ + + PURPOSE : this is called by ESF. + +*/ +SHORT StartFrame ( void ) +{ +OS_HANDLE esf_task_handle; + + os_Initialize(); + + /* set the OS tick to 10ms */ + os_set_tick(SYSTEM_TICK_10_MS); + + /* create memory pool for temporary usage during ESF partition pool creation and HISR stacks */ + os_CreateMemoryPool (OS_NOTASK, "ESF_POOL", &esf_pool, esf_pool_size, &esf_pool_handle); + + /* tell this pool handle to the OS layer */ + os_SetPoolHandles (esf_pool_handle, esf_pool_handle); + + /* create a helping task that calls esf_init2() from task context */ + os_CreateTask (OS_NOTASK, "ESF_TASK", esf_task_entry, 1024, 255, &esf_task_handle, esf_pool_handle); + + /* and start it */ + os_StartTask (OS_NOTASK, esf_task_handle, 0); + + esf_init(); + /* call fist ESF init function */ + esf_init_func1(); + + return OS_OK; + +} +#endif +#endif /* FF_OS_ONLY */ + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : esf_init ++------------------------------------------------------------------------------ +| Description : initialize ESF API function pointer table. +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void esf_init ( void ) +{ +#ifdef TEST_ESF_REGISTER + esf_register ( &esf_functions ); +#endif + if ( esf_func.magic_nr != ESF_INITIALIZED ) + { + esf_func.init_func1 = NULL; + esf_func.init_func2 = NULL; + esf_func.send_prim = NULL; + } +} +#endif + + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : esf_register ++------------------------------------------------------------------------------ +| Description : register the ESF API functions. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void esf_register ( T_ESF_FUNC * func ) +{ + esf_func.init_func1 = func->init_func1; + esf_func.init_func2 = func->init_func2; + esf_func.send_prim = func->send_prim; + esf_func.magic_nr = ESF_INITIALIZED; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : esf_init_func1 ++------------------------------------------------------------------------------ +| Description : call first ESF init function +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void esf_init_func1 ( void ) +{ + if ( esf_func.init_func1 != NULL ) + { + esf_func.init_func1 (); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : esf_init_func2 ++------------------------------------------------------------------------------ +| Description : call second ESF init function +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void esf_init_func2 ( void ) +{ + if ( esf_func.init_func2 != NULL ) + { + esf_func.init_func2 (); + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : esf_send_prim ++------------------------------------------------------------------------------ +| Description : call ESF send primitive function +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void esf_send_prim ( T_PRIM_HEADER * prim ) +{ + if ( esf_func.send_prim != NULL ) + { + esf_func.send_prim ( prim ); + } +} +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/frame.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,1470 @@ +/* ++------------------------------------------------------------------------------ +| File: frame.c ++------------------------------------------------------------------------------ +| 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 Modul defines the general frame functionality. ++----------------------------------------------------------------------------- +*/ + + +#ifndef __FRAME_C__ +#define __FRAME_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include <stdarg.h> +#include "typedefs.h" +#include "string.h" +#include "stdio.h" + +#include "glob_defs.h" +#include "os.h" +#include "vsi.h" +#include "pei.h" +#include "frame.h" +#include "tools.h" +#include "gdi.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "route.h" +#include "p_frame.h" +#include "prf_func.h" +#ifdef _ESF_SUPPORT_ +#include "esf_func.h" +#endif +#include "frm_ext.h" + +/*==== TYPES ======================================================*/ + +typedef struct +{ + char const *Name; + USHORT Id; +} T_NAME_ID; + +/*==== CONSTANTS ==================================================*/ + +#define RUNNING 0x01 +#undef VSI_CALLER +#define VSI_CALLER TaskHandle, + +/*==== EXTERNALS ==================================================*/ +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +#if defined _NUCLEUS_ && !defined _TARGET_ +extern char TraceBuffer[]; +#endif + +#ifndef _TOOLS_ +extern const T_MEMORY_POOL_CONFIG memory_pool_config[]; +extern const T_FRM_PARTITION_GROUP_CONFIG partition_grp_config[]; +extern T_HANDLE MemoryPoolHandle[]; +extern OS_HANDLE PoolGroupHandle[]; +extern const T_DRV_LIST DrvList[]; +#ifdef MEMORY_SUPERVISION +extern USHORT NumberOfPPMPartitions; +extern USHORT NumOfPPMPools; +extern USHORT NumOfPPMGroups; +extern USHORT NumOfPrimPools; +extern USHORT NumOfDmemPools; +#endif +#endif + +extern T_DRV_LIST const *DriverConfigList; + +#ifndef _TOOLS_ +extern const T_COMPONENT_ADDRESS *ComponentTables[]; +extern const char * const frame_version_date; +extern const char * const frame_version_time; +extern const char * const misc_version_date; +extern const char * const misc_version_time; +extern const char * const tif_version_date; +extern const char * const tif_version_time; +#endif + +#ifdef _TOOLS_ + __declspec (dllimport) T_HANDLE TST_Handle; +#else + extern T_HANDLE TST_Handle; +#endif + +#ifdef MEMORY_SUPERVISION +extern int ppm_check_partition_owner; +#endif + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM +UBYTE SuppressOK=1; +GLOBAL T_HANDLE MemPoolHandle; +GLOBAL T_HANDLE PrimGroupHandle; +GLOBAL T_HANDLE DmemGroupHandle; +GLOBAL T_HANDLE TestGroupHandle; +GLOBAL T_HANDLE LemuGroupHandle; +GLOBAL T_HANDLE int_data_pool_handle; +GLOBAL T_HANDLE ext_data_pool_handle; +GLOBAL UBYTE FrameEnv=0; +GLOBAL USHORT TestInterface = 0; +GLOBAL USHORT NextTimerEntry = 0; +int time_is_tdma_frame; +char error_ind_dst[RESOURCE_NAMELEN] = {0}; +T_FRM_ERROR_IND *frm_error_ind = NULL; +char check_desclist = FALSE; +GLOBAL USHORT NumberOfStartedTasks = 0; +GLOBAL USHORT NumberOfRunningTasks = 0; +GLOBAL USHORT TooManyTasks = 0; + +const T_PEI_INFO DummyInfo = + { + "", /* Name */ + { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + 768, /* stack size */ + 10, /* queue entries */ + 1, /* priority */ + 0, /* number of timers */ + COPY_BY_REF /* Flags */ + }; + +const T_NAME_ID Resource[] = +{ + { "TASK", OS_OBJTASK}, + { "QUEUE", OS_OBJQUEUE}, + { "TIMER", OS_OBJTIMER }, + { "SEMAPHORE", OS_OBJSEMAPHORE}, + { "PARTITION", OS_OBJPARTITIONGROUP}, + { "MEMORY", OS_OBJMEMORYPOOL}, + { NULL, 0 } +}; + +#ifdef _TOOLS_ +LOCAL T_COMPONENT_ADDRESS *ComponentTables [NUM_OF_COMPONENT_TABLES+1]={0}; +typedef void T_INIT_FUNC ( void ); +T_INIT_FUNC *InitFunc; +ULONG init_stack_time = 0; +ULONG init_local_time = 0; +ULONG MaxPrimPartSize = 65536; +USHORT TextTracePartitionSize = 260; +#endif + +char TaskName [ RESOURCE_NAMELEN ]; + +#else /* RUN_INT_RAM */ +extern USHORT TestInterface; +extern USHORT NextTimerEntry; +extern USHORT NumberOfStartedTasks; +extern USHORT NumberOfRunningTasks; +extern USHORT TooManyTasks; +extern char TaskName[]; +extern T_HANDLE int_data_pool_handle; +extern T_HANDLE ext_data_pool_handle; +#endif /* RUN_INT_RAM */ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif + +#ifdef _ESF_SUPPORT_ +int esf_init_func2_ready = FALSE; +int firstTime = TRUE; +#endif + +/* -------------- S H A R E D - END ---------------- */ + + +/*==== PROTOTYPES =================================================*/ + +GLOBAL void pf_TaskEntry (T_HANDLE TaskHandle, ULONG Value ); +LOCAL SHORT pf_HandleMessage (T_HANDLE TaskHandle, OS_QDATA *pMsg ); +LOCAL LONG pf_CreateTask ( const T_COMPONENT_ADDRESS *Comp ); +LOCAL void pf_ProcessProtocolPrim ( T_HANDLE TaskHandle, T_VOID_STRUCT *pPrim); +LOCAL void pf_Reset (T_HANDLE TaskHandle); +int is_entity_in_task (T_HANDLE t_handle, char *name ); +int int_vsi_o_ttrace ( T_HANDLE Caller, ULONG TraceClass, const char * const format, va_list varpars ); + +#ifndef _TOOLS_ +GLOBAL void InitializeApplication ( void ); +#endif + +/*==== LINT =======================================================*/ + +/*lint -e522 suppress Warning -- Expected void type, assignment, increment or decrement */ + +/*==== FUNCTIONS ==================================================*/ + +#ifdef _TOOLS_ +/* ++------------------------------------------------------------------------------ +| Function : pf_get_frameenv ++------------------------------------------------------------------------------ +| Description : This function returns the current value of FrameEnv +| +| Parameters : void +| +| Return : FrameEnv ++------------------------------------------------------------------------------ +*/ +USHORT pf_get_frameenv (void) +{ + return (USHORT) FrameEnv; +} + +#endif /* _TOOLS_ */ + +#ifndef _TOOLS_ +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : StartFrame | ++--------------------------------------------------------------------+ + + PURPOSE : Start the frame + +*/ +SHORT StartFrame ( void ) +{ + prf_init(); + pf_Init(NULL); + pf_CreateAllEntities(); +#ifdef _ESF_SUPPORT_ + esf_init(); + esf_init_func1(); +#endif + pf_StartAllTasks (); + return ( PF_OK ); +} +#endif +#endif /* ndef _TOOLS_ */ + +#if defined (_LINUX_) || (defined _SOLARIS_) +int main () +{ + (void) StartFrame (); + for (;;) + { + os_SuspendTask (0, 1500); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : is_entity_in_task | ++--------------------------------------------------------------------+ + + PURPOSE : Initialize the frame + +*/ +int is_entity_in_task ( T_HANDLE t_handle, char *name ) +{ +int i; + + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == t_handle ) + { + if ( !strncmp (pf_TaskTable[i].Name, name, RESOURCE_NAMELEN-1) ) + return TRUE; + } + } + return FALSE; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_Init | ++--------------------------------------------------------------------+ + + PURPOSE : Initialize the frame + +*/ + +/*lint -esym(715,ConfigAddress) only needed for _TOOLS_*/ +GLOBAL void pf_Init ( T_CONFIGURATION_ADDRESS *ConfigAddress) +{ +#ifndef _TOOLS_ +const T_FRM_PARTITION_POOL_CONFIG * pool_config; +USHORT i = 1,j = 0; +#endif + +#if defined _NUCLEUS_ && !defined _TARGET_ || defined (_LINUX_) + printf ("FRAME VERSION: %s, %s\n",frame_version_date, frame_version_time); + printf ("MISC VERSION: %s, %s\n",misc_version_date, misc_version_time); + printf ("TIF VERSION: %s, %s\n\n",tif_version_date, tif_version_time); +#endif + if ( os_Initialize() == OS_ERROR ) + { + vsi_o_assert ( 0, OS_SYST_ERR, __FILE__, __LINE__, "OS initialization error" ); + } + + time_is_tdma_frame = 0; + TestInterface = 0; + NextTimerEntry = 0; +#ifdef _TOOLS_ + ComponentTables[RCV_ADR] = ConfigAddress->RcvAdr; + ComponentTables[TST_ADR] = ConfigAddress->TstAdr; + ComponentTables[END_OF_COMP_TABLE] = NULL; + DriverConfigList = ConfigAddress->DrvListAdr; + InitFunc = ConfigAddress->InitFuncAdr; + FrameEnv = *ConfigAddress->FrameEnvAdr; +#else + DriverConfigList = &DrvList[0]; +#endif + +#ifndef _TOOLS_ + + + j = 0; + /* + * create memory pools + */ + while ( memory_pool_config[j].Name != NULL ) + { + if ( memory_pool_config[j].Size > 1 ) + os_CreateMemoryPool ( NO_TASK, + memory_pool_config[j].Name, + memory_pool_config[j].PoolAddress, + memory_pool_config[j].Size, + (OS_HANDLE*)MemoryPoolHandle[j] ); + j++; + } + +#ifdef _NUCLEUS_ + os_SetPoolHandles (ext_data_pool_handle, int_data_pool_handle); +#endif + + /* + * create partition pools + */ + + for ( i = 0; partition_grp_config[i].name != NULL; i++ ) + { +#ifdef MEMORY_SUPERVISION +// if ( strcmp ("TEST", partition_grp_config[i].name ) ) +// { + /* currently all created groups are counted to ease offset calculation for + partition supervision */ + NumOfPPMGroups++; +// } +#endif + pool_config = partition_grp_config[i].grp_config; + while ( pool_config->part_size && pool_config->part_num ) + { + os_CreatePartitionPool ( NO_TASK, + partition_grp_config[i].name, + pool_config->mem, + (USHORT)pool_config->part_num, + pool_config->part_size, + (OS_HANDLE*)PoolGroupHandle[i] ); +#ifdef MEMORY_SUPERVISION + /* TEST pool not under partition supervision */ + if ( strcmp ("TEST", partition_grp_config[i].name ) ) + { + NumOfPPMPools++; + NumberOfPPMPartitions += pool_config->part_num; + } +#endif + if ( !strcmp ("PRIM", partition_grp_config[i].name ) ) + { + if ( MaxPrimPartSize < pool_config->part_size ) + { + MaxPrimPartSize = pool_config->part_size; + } +#ifdef MEMORY_SUPERVISION + NumOfPrimPools++; +#endif + } +#ifdef MEMORY_SUPERVISION + if ( !strcmp ("DMEM", partition_grp_config[i].name ) ) + { + NumOfDmemPools++; + } +#endif + pool_config++; + } + } + +#endif + /* + * To allow CCD (TaskHandle = 0) the usage of dynamic Memory to create a semaphore + * the MemPoolHandle for non-task users is initialized with the handle of the int_data_pool + * pool. + */ + pf_TaskTable[0].MemPoolHandle = int_data_pool_handle; + strcpy ( pf_TaskTable[0].Name, "IRQ" ); + + rt_Init(); +#ifdef _TOOLS_ + (InitFunc)(); +#else + InitializeApplication(); +#endif +#ifdef MEMORY_SUPERVISION + InitializePPM(); +#endif /* MEMORY_SUPERVISION */ + + InitializeTimer(); + InitializeDriverConfig(); +#if !defined _TARGET_ && !defined _TOOLS_ + vsi_pcheck_init(); +#endif +#ifndef _TOOLS_ + fei_lemu_SendToQueue_init(); +#endif + /* + not needed -> temporarily removed + vsi_c_init_com_matrix (MaxEntities); + */ +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_CreateAllEntities| ++--------------------------------------------------------------------+ +*/ +GLOBAL SHORT pf_CreateAllEntities (void) +{ +int i = 0; + + while ( ComponentTables[i] != NULL ) + { + pf_CreateTask ( ComponentTables[i] ); + i++; + } + InitializeTrace(); + return PF_OK; +} +#endif +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_CreateEntity | ++--------------------------------------------------------------------+ +*/ +LOCAL LONG pf_CreateTask ( const T_COMPONENT_ADDRESS *Comp ) +{ +T_PEI_INFO const *Info; +T_HANDLE TaskHandle; +T_HANDLE mem_pool_handle = ext_data_pool_handle; +int Priority = 0; +ULONG StackSize = 0; +const T_PEI_FUNC *PeiTable; +USHORT QueueEntries = 0; +USHORT NumOfTimers = 0; +U32 Flags; +char *Name = NULL; +static int e_handle = 1; +int start_e_handle; +int i; + + start_e_handle = e_handle; + while ( Comp->PeiCreate || Comp->Name ) + { + if ( e_handle > MaxEntities ) + { + vsi_o_assert ( 0, OS_SYST_ERR, __FILE__, __LINE__, "More than MAX_ENTITIES" ); + } + if ( Comp->PeiCreate && Comp->PeiCreate ( &Info ) == PEI_OK ) + { + if ( Comp->Priority != ASSIGNED_BY_TI ) + { + if ( Priority < Comp->Priority ) + Priority = Comp->Priority; + } + else + { + if ( Priority < Info->Priority ) + Priority = Info->Priority; + } + Flags = Info->Flags; + PeiTable = &Info->PeiTable; + Name = (char*)Info->Name; + if ( StackSize < Info->StackSize ) + StackSize = Info->StackSize; + pf_TaskTable[e_handle].QueueEntries = Info->QueueEntries; + NumOfTimers = Info->NumOfTimers; + } + else if ( Comp->Name && strlen (Comp->Name) <= RESOURCE_NAMELEN ) + { + Flags = DummyInfo.Flags; + PeiTable = &DummyInfo.PeiTable; + Name = Comp->Name; + if ( StackSize < DummyInfo.StackSize ) + StackSize = DummyInfo.StackSize; + if ( Priority < DummyInfo.Priority ) + Priority = DummyInfo.Priority; + pf_TaskTable[e_handle].QueueEntries = DummyInfo.QueueEntries; + NumOfTimers = DummyInfo.NumOfTimers; + } + else + return PF_ERROR; + + if ( QueueEntries < pf_TaskTable[e_handle].QueueEntries ) + QueueEntries = pf_TaskTable[e_handle].QueueEntries; + + pf_TaskTable[e_handle].Flags = Flags; + pf_TaskTable[e_handle].PeiTable = PeiTable; + pf_TaskTable[e_handle].NumOfTimers = NumOfTimers; + strncpy (pf_TaskTable[e_handle].Name, Name, RESOURCE_NAMELEN); + pf_TaskTable[e_handle].Name[RESOURCE_NAMELEN-1] = 0; + if ( pf_TaskTable[e_handle].Flags & INT_DATA_TASK ) + { + pf_TaskTable[e_handle].MemPoolHandle = int_data_pool_handle; + mem_pool_handle = int_data_pool_handle; + } + else + { + pf_TaskTable[e_handle].MemPoolHandle = ext_data_pool_handle; + mem_pool_handle = ext_data_pool_handle; + } + prf_log_entity_create ((void*)e_handle, Name); + e_handle++; + Comp++; + } + if ( e_handle > start_e_handle + 1 ) + Name = (char*)Comp->Priority; + +#ifdef MEMORY_SUPERVISION + StackSize = StackSize + (StackSize>>3); +#endif + if ( os_CreateTask (NO_TASK, Name, pf_TaskEntry, StackSize, (USHORT)Priority, &TaskHandle, + mem_pool_handle) == OS_OK ) + { + for ( i = start_e_handle; i < e_handle; i++ ) + { + pf_TaskTable[i].TaskHandle = TaskHandle; + } + return PF_OK; + } + else + vsi_o_assert ( NO_TASK, OS_SYST_ERR, __FILE__, __LINE__, "Error at creating %s Task", Name ); + /*lint +e771 */ + + return PF_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_StartAllTasks | ++--------------------------------------------------------------------+ +*/ +GLOBAL SHORT pf_StartAllTasks ( void ) +{ +int e_handle; +int t_handle; +int started_t_handle = 0; + + for ( e_handle = 1; e_handle <= MaxEntities; e_handle++ ) + { + if ( pf_TaskTable[e_handle].Name[0] != 0 ) + { + if ( (t_handle = pf_TaskTable[e_handle].TaskHandle) != started_t_handle ) + { + if ( os_StartTask ( NO_TASK, t_handle, 0 ) == OS_ERROR) + return OS_ERROR; + NumberOfStartedTasks++; + started_t_handle = t_handle; + } + } + } + return OS_OK; +} +#endif + + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_TaskEntry | ++--------------------------------------------------------------------+ +*/ +/*lint -esym(715,Value) suppress Info -- Symbol 'Value' not referenced */ +GLOBAL void pf_TaskEntry (T_HANDLE TaskHandle, ULONG Value ) +{ +OS_QDATA Msg; +OS_HANDLE mem_pool_handle = ext_data_pool_handle; +LONG sts; +int i; +int queue_entries; +int queue_handle; +int biggest_queue_size = 0; +int sum_queue_size = 0; +U32 entity_flags = 0; +#ifndef _TOOLS_ +char queue_name [ RESOURCE_NAMELEN ]; +#endif +static int entity_init_fail_cnt = 0; + +#ifdef _ESF_SUPPORT_ + { + /* OS timer should not be started at this point, otherwise risk of + race condition. + Furthermore, ESF THIF socket interface can't be used by task tst + before esf_init_func2() is completed. + */ + + T_HANDLE esf_init_func2_sem; + T_HANDLE caller; + + caller = e_running[os_MyHandle()]; + esf_init_func2_sem = vsi_s_open (caller, "esf_init_func2_sem", 1); + + vsi_s_get (caller, esf_init_func2_sem); /* start of critical section */ + if (firstTime) + { + firstTime = FALSE; + esf_init_func2(); + esf_init_func2_ready = TRUE; + } + vsi_s_release(caller, esf_init_func2_sem); /* end of critical section */ + + while (!esf_init_func2_ready) + { + os_SuspendTask(caller, 100); + } + } +#endif + + if ( is_entity_in_task ( TaskHandle, FRM_TST_NAME ) == FALSE + && is_entity_in_task ( TaskHandle, FRM_RCV_NAME ) == FALSE ) + { + while ( !(TestInterface & RUNNING) ) + { + os_SuspendTask (TaskHandle, 100); + } + } + + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == TaskHandle ) + { + if ( pf_TaskTable[i].Flags & ADD_QUEUE_SIZES ) + { + entity_flags |= ADD_QUEUE_SIZES; + } + sum_queue_size += pf_TaskTable[i].QueueEntries; + if ( biggest_queue_size < pf_TaskTable[i].QueueEntries ) + { + biggest_queue_size = pf_TaskTable[i].QueueEntries; + } + if ( pf_TaskTable[i].Flags & INT_DATA_TASK ) + mem_pool_handle = int_data_pool_handle; + } + } + + /* set queue size depending on the flag exported by the entities */ + if ( entity_flags & ADD_QUEUE_SIZES ) + { + queue_entries = sum_queue_size; + } + else + { + queue_entries = biggest_queue_size; + } + +#ifdef _TOOLS_ + if ( os_CreateQueue ( TaskHandle, 0, pf_TaskTable[TaskHandle].Name, (USHORT)queue_entries, &queue_handle, + pf_TaskTable[TaskHandle].MemPoolHandle) == OS_ERROR ) + { + vsi_o_assert ( NO_TASK, OS_SYST_ERR_QUEUE_CREATE, __FILE__, __LINE__, + "Error at creating %s Queue", pf_TaskTable[TaskHandle].Name ); + } +#else + os_GetTaskName ( TaskHandle, TaskHandle, queue_name ); + if ( os_CreateQueue ( TaskHandle, 0, queue_name, (USHORT)queue_entries, &queue_handle, mem_pool_handle) == OS_ERROR ) + { + vsi_o_assert ( NO_TASK, OS_SYST_ERR_QUEUE_CREATE, __FILE__, __LINE__, "Error at creating %s Queue", queue_name ); + } +#endif + + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == TaskHandle ) + { + pf_TaskTable[i].QueueHandle = queue_handle; + pf_TaskTable[i].FirstTimerEntry = &TimerHandleField [ NextTimerEntry ]; + if ( (NextTimerEntry += pf_TaskTable[i].NumOfTimers) >= MaxTimer ) + vsi_o_assert ( NO_TASK, OS_SYST_ERR_MAX_TIMER, __FILE__, __LINE__, + "Number of Timers > MAX_TIMER" ); + } + } + + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == TaskHandle ) + { + if (pf_TaskTable[i].PeiTable->pei_init != NULL) + { + e_running[TaskHandle] = i; + while (pf_TaskTable[i].PeiTable->pei_init (i) == PEI_ERROR) + { + if ( entity_init_fail_cnt++ > (NumberOfStartedTasks * 5) ) + vsi_o_ttrace(NO_TASK, TC_SYSTEM, "%s pei_init() failed",pf_TaskTable[i].Name ); + os_SuspendTask (TaskHandle, 100); + } + e_running[TaskHandle] = 0; + } + } + } + + if ( is_entity_in_task ( TaskHandle, FRM_TST_NAME ) == TRUE ) + TestInterface |= RUNNING; + + + if ( ++NumberOfRunningTasks == NumberOfStartedTasks ) + { + if ( TooManyTasks ) + vsi_o_assert (NO_TASK, OS_SYST_ERR_MAX_TASK, __FILE__, __LINE__, "Number of entities > MAX_ENTITIES" ); + vsi_o_ttrace(NO_TASK, TC_SYSTEM, "All tasks entered main loop" ); +#if defined _NUCLEUS_ && !defined _TARGET_ + printf ("%s\n","All tasks entered main loop"); +#endif +#ifdef _TARGET_ + TraceMask[0] = 0; + os_dar_set_filter(); +#endif + } + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == TaskHandle ) + { + if (pf_TaskTable[i].PeiTable->pei_run != NULL) + { + if ( !(pf_TaskTable[i].Flags & PASSIVE_BODY) ) + { + /* + * in the active body variant call pei_run + */ + e_running[TaskHandle] = i; + pf_TaskTable[i].PeiTable->pei_run (TaskHandle, pf_TaskTable[i].QueueHandle ); +#ifdef _TOOLS_ + pf_TaskTable[i].PeiTable->pei_exit(); + NextTimerEntry -= pf_TaskTable[i].NumOfTimers; + rt_RoutingModify ( TaskHandle, (char*)SYSPRIM_REDIRECT_TOKEN, (char*)SYSPRIM_CLEAR_TOKEN ); + os_DestroyQueue ( TaskHandle, pf_TaskTable[i].QueueHandle ); + e_running[TaskHandle] = 0; + os_DestroyTask ( TaskHandle, TaskHandle ); +#endif + e_running[TaskHandle] = 0; + for (;;) + os_SuspendTask(TaskHandle,10000); + } + } + } + } + + /* + * in the passive body variant wait for a message and + * handle it + */ + for ( i = MaxEntities; i > 0; i-- ) + { + if ( pf_TaskTable[i].TaskHandle == TaskHandle ) + { + break; + } + } + for (;;) + { + sts = os_ReceiveFromQueue ( TaskHandle, pf_TaskTable[i].QueueHandle, + &Msg, OS_SUSPEND ); + switch ( sts ) + { + case OS_OK: +#if defined (_TOOLS_) || defined (_LINUX_) + e_running[TaskHandle] = TaskHandle; + pf_HandleMessage (TaskHandle, &Msg); +#else + e_running[TaskHandle] = Msg.e_id; + prf_log_entity_activate ((void*)Msg.e_id); + pf_HandleMessage (Msg.e_id, &Msg); +#endif + e_running[TaskHandle] = 0; +#ifdef _NUCLEUS_ + if ( os_CheckTaskStack ( TaskHandle ) == OS_ERROR ) + { + os_GetTaskName ( TaskHandle, TaskHandle, TaskName ); + vsi_o_assert ( TaskHandle, OS_SYST_ERR_STACK_OVERFLOW, __FILE__, __LINE__, + "%s Stack overflow", TaskName ); + } +#endif + break; + case OS_TIMEOUT: + break; + case OS_ERROR: + for(;;) + os_SuspendTask(TaskHandle,10000); + /*lint -e527, suppress Warning -- Unreachable */ + break; + default: + for(;;) + os_SuspendTask(TaskHandle,10000); + break; + /*lint +e527 */ + + } + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_Timeout | ++--------------------------------------------------------------------+ +*/ +GLOBAL void pf_Timeout (T_HANDLE TaskHandle, T_HANDLE EntityHandle, USHORT TimerIndex ) +{ +OS_QDATA TimeoutMsg; + + TimeoutMsg.data16 = MSG_TIMEOUT; + TimeoutMsg.data32 = (ULONG)TimerIndex; +#ifdef _TOOLS_ + TimeoutMsg.len = 0; +#endif + TimeoutMsg.e_id = EntityHandle; + os_GetTime ( 0, &TimeoutMsg.time ); + + *(pf_TaskTable[EntityHandle].FirstTimerEntry + TimerIndex) |= TIMEOUT_OCCURRED; + +#ifdef _TOOLS_ + if ( rt_Route (TaskHandle, pf_TaskTable[EntityHandle].QueueHandle, OS_NORMAL, OS_SUSPEND, + &TimeoutMsg ) == OS_TIMEOUT ) +#else + if ( rt_Route (TaskHandle, EntityHandle, OS_NORMAL, OS_SUSPEND, + &TimeoutMsg ) == OS_TIMEOUT ) +#endif + vsi_o_assert ( 0, OS_SYST_ERR_QUEUE_FULL, __FILE__, __LINE__, + "Timeout write attempt to %s queue failed", pf_TaskTable[EntityHandle].Name ); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_HandleMessage | ++--------------------------------------------------------------------+ +*/ +LOCAL SHORT pf_HandleMessage (T_HANDLE TaskHandle, OS_QDATA *pMsg ) +{ +ULONG PrimId = 0; + + switch (pMsg->data16) + { + case MSG_PRIMITIVE: + if ( pMsg->ptr != NULL ) + { + PrimId = ((T_PRIM_HEADER*)(pMsg->ptr))->opc; + + if ( PrimId & SYS_MASK ) + { + pf_ProcessSystemPrim ( TaskHandle, pMsg->ptr ); + } + else + { + pf_ProcessProtocolPrim ( TaskHandle, pMsg->ptr ); + } + } + break; + case MSG_SIGNAL: + if ( pf_TaskTable[TaskHandle].PeiTable->pei_signal != NULL ) + { + pf_TaskTable[TaskHandle].PeiTable->pei_signal ( pMsg->data32, pMsg->ptr ); + } + break; + case MSG_TIMEOUT: + if ( *(pf_TaskTable[TaskHandle].FirstTimerEntry + pMsg->data32) & TIMEOUT_OCCURRED ) + { + if ( !(*(pf_TaskTable[TaskHandle].FirstTimerEntry + pMsg->data32) & PERIODIC_TIMER) ) + { + os_DestroyTimer ( TaskHandle, (OS_HANDLE)(*(pf_TaskTable[TaskHandle].FirstTimerEntry + pMsg->data32) & TIMER_HANDLE_MASK) ); + *(pf_TaskTable[TaskHandle].FirstTimerEntry + pMsg->data32) = 0; + } + else + { + *(pf_TaskTable[TaskHandle].FirstTimerEntry + pMsg->data32) &= ~TIMEOUT_OCCURRED; + } + vsi_o_ttrace ( TaskHandle, TC_TIMER, "Timeout : Index %d",pMsg->data32) ; + if ( pf_TaskTable[TaskHandle].PeiTable->pei_timeout != NULL ) + pf_TaskTable[TaskHandle].PeiTable->pei_timeout ( (USHORT)pMsg->data32 ); + } + break; + default: + VSI_PPM_FREE(pMsg->ptr); + os_DeallocatePartition (TaskHandle, pMsg->ptr-PPM_OFFSET ); + return PF_ERROR; + /*lint -e527, suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + } + return PF_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_ProcessProtocolPrim| ++--------------------------------------------------------------------+ +*/ +LOCAL void pf_ProcessProtocolPrim ( T_HANDLE TaskHandle, T_VOID_STRUCT *pPrim) +{ + + if ( TaskHandle != NO_TASK ) + { + if (pf_TaskTable[TaskHandle].PeiTable->pei_primitive != NULL) + { +#ifdef PRIM_AUTO_FREE + if ( pf_TaskTable[TaskHandle].Flags & PARTITION_AUTO_FREE ) + { + /* + * TST uses its own partition pool and is handled differently + */ + if ( TaskHandle != TST_Handle ) + { + processed_prim[TaskHandle] = pPrim; + freed_prim[TaskHandle] = NULL; + } + } +#endif /* PRIM_AUTO_FREE */ +#ifdef MEMORY_SUPERVISION + if ( TaskHandle != TST_Handle ) /* Trace pools are not monitored by PPM */ + VSI_PPM_RCV(pPrim); +#endif + pf_TaskTable[TaskHandle].PeiTable->pei_primitive (pPrim); + +#ifdef PRIM_AUTO_FREE + if ( pf_TaskTable[TaskHandle].Flags & PARTITION_AUTO_FREE ) + { + /* + * if PSTORE was called during the primitive processing, PFREE was no longer + * blocked inside the entity and it could have happened that a primitive + * was freed and then newly allocated either by the same or by a different + * entity (IRQ). To avoid auto free it is checked if an effective free was + * done with the pointer passed to pei_primitive(). In this case the + * partition is not freed. + */ + if ( freed_prim[TaskHandle] == pPrim ) + { + freed_prim[TaskHandle] = NULL; + return; + } + else + { + processed_prim[TaskHandle] = NULL; + + if ( pPrim != NULL ) + { + FREE ( P2D(pPrim) ); + } + return; + } + } + else +#endif /* PRIM_AUTO_FREE */ + return; + } + } + if ( pPrim != NULL) + { +#ifndef _TARGET_ + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "Primitive discarded in dummy entity %s, opc 0x%x", + pf_TaskTable[TaskHandle].Name, ((T_PRIM_HEADER*)pPrim)->opc ); +#endif + VSI_PPM_RCV(pPrim); + FREE ( P2D(pPrim) ); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_ProcessSystemPrim | ++--------------------------------------------------------------------+ +*/ +GLOBAL void pf_ProcessSystemPrim ( T_HANDLE TaskHandle, T_VOID_STRUCT *pPrim) +{ +char * data; +/*lint -e813, suppress Info 813: auto variable 'token' has size '132' -> uncritical in this context */ +char token[TRACE_TEXT_SIZE]; +/*lint +e813 */ +BOOL Error = FALSE; +LONG i; +unsigned int Length; +T_HANDLE min, max; +char TraceMaskBuffer[9]; +ULONG trace_mask; +LONG state; +#ifdef _TOOLS_ +T_S_HEADER *s_hdr; +#endif + + VSI_PPM_RCV(pPrim); + + data = (char *)P2D( pPrim ); + + Length = GetNextToken (data, token, " #"); + + if (!strcmp (token, SYSPRIM_REDIRECT_TOKEN) + OR !strcmp (token, SYSPRIM_DUPLICATE_TOKEN)) + { + + if (TaskHandle NEQ NO_TASK) + { + /* + * Redirect or Duplicate primitives + */ + if ( (state = rt_RoutingModify (TaskHandle, token, data+strlen(token)+1)) != RT_OK ) + { +#ifdef NU_DEBUG + switch ( state ) + { + case RT_NO_MEM: + vsi_o_ttrace(NO_TASK, TC_SYSTEM, "SYSTEM WARNING: Out of Memory - routing command rejected"); + VSI_PPM_FREE(pPrim); + os_DeallocatePartition (TaskHandle, pPrim-PPM_OFFSET ); + return; + /*lint -e527, suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + case RT_ERROR: Error = TRUE; + break; + } +#else + Error = TRUE; +#endif + } + } + } + else if ( !strcmp ( token, SYSPRIM_TRACECLASS_TOKEN) ) + { + if ( Length < strlen(data)-1 ) + { + GetNextToken (data+Length+1, token, " #"); + trace_mask = ASCIIToHex(token, CHARS_FOR_32BIT); + if ( TaskHandle == TST_Handle ) + { + min = 1; + max = MaxEntities; + } + else + { + min = TaskHandle; + max = TaskHandle; + } + for ( i = min; i <= max; i++ ) + { + if ( vsi_settracemask ( TaskHandle, i, trace_mask) == VSI_ERROR ) + break; + } + } + else + { + vsi_gettracemask ( TaskHandle, TaskHandle, &trace_mask); + HexToASCII ( trace_mask, TraceMaskBuffer, CHARS_FOR_32BIT ); + TraceMaskBuffer[8] = 0; + sprintf ( data, "%s %s %s", pf_TaskTable[TaskHandle].Name, SYSPRIM_TRACECLASS_TOKEN, TraceMaskBuffer ); + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, data ); + } + } + else if (!strcmp (token, SYSPRIM_CONFIG_TOKEN)) + { + /* + * Dynamic Configuration + */ + if (TaskHandle != NO_TASK) + { + /* + * call the pei_config function of the entity + */ + if (pf_TaskTable[TaskHandle].PeiTable->pei_config NEQ NULL) + if ( pf_TaskTable[TaskHandle].PeiTable->pei_config ( data+strlen (token)+1 ) == PEI_ERROR ) + Error = TRUE; + } + } +#if 0 + /* not needed -> temporarily removed */ + else if (!strcmp (token, SYSPRIM_ISOLATE_TOKEN)) + { + if ( rt_isolate_entity (TaskHandle, data+strlen(token)+1) == RT_ERROR ) + Error = TRUE; + } +#endif + else if (!strcmp (token, SYSPRIM_REGISTER_ERR_IND)) + { + strncpy ( error_ind_dst, data+strlen(token)+1, RESOURCE_NAMELEN ); + error_ind_dst[RESOURCE_NAMELEN-1] = 0; + if ( frm_error_ind == NULL ) + { + frm_error_ind = (T_FRM_ERROR_IND*)vsi_c_pnew (sizeof(T_FRM_ERROR_IND), FRM_ERROR_IND FILE_LINE_MACRO ); + } + } + else if (!strcmp (token, SYSPRIM_WITHDRAW_ERR_IND)) + { + if ( frm_error_ind != NULL ) + { + error_ind_dst[0] = 0; + vsi_c_pfree( (T_VOID_STRUCT**)&frm_error_ind FILE_LINE_MACRO ); + frm_error_ind = NULL; + } + } + else if (!strcmp (token, SYSPRIM_STATUS_TOKEN)) + { + GetNextToken (data+strlen(token)+1, token, " #"); + VSI_PPM_FREE(pPrim); + os_DeallocatePartition (TaskHandle, pPrim-PPM_OFFSET ); + i = 0; + while ( Resource[i].Name && strcmp ( Resource[i].Name, token ) ) + i++; + if ( vsi_object_info (TaskHandle, Resource[i].Id, FIRST_ENTRY, token, sizeof(token)) == VSI_OK ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + while ( vsi_object_info (TaskHandle, Resource[i].Id, NEXT_ENTRY, token, sizeof(token)) == VSI_OK ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + } + } + return; + } +#if 0 + else if (!strcmp (token, SYSPRIM_READ_COM_MATRIX)) + { + state = vsi_c_get_com_matrix_entry ( FIRST_ENTRY, token ); + if ( state == VSI_OK ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + do + { + if ( (state = vsi_c_get_com_matrix_entry ( NEXT_ENTRY, token)) == VSI_OK ) + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + } while ( state == VSI_OK ); + } + } +#endif +#ifdef _TARGET_ + else if (!strcmp (token, SYSPRIM_READ_FFS_DAR)) + { + state = os_read_dar_ffs_data ( FIRST_ENTRY, token, TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER) - 1 ); + if ( state == OS_OK ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + do + { + if ( (state = os_read_dar_ffs_data ( NEXT_ENTRY, token, TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER) - 1)) == OS_OK ) + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, token ); + } while ( state == OS_OK ); + } + else + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "No DAR entry stored" ); + + } +#endif +#if !defined _TARGET_ && !defined _TOOLS_ + else if (!strcmp (token, SYSPRIM_PCHECK)) + { + pcheck_active[TaskHandle] = TRUE; + } +#endif + else if (!strcmp (token, SYSPRIM_ROUTE_DESCLIST)) + { + route_desclist[TaskHandle] = TRUE; + } + else if (!strcmp (token, SYSPRIM_CHECK_DESCLIST)) + { + check_desclist = TRUE; + } +#ifdef _NUCLEUS_ + else if (!strcmp (token, SYSPRIM_VERSION_TOKEN)) + { + vsi_o_ttrace (NO_TASK, TC_SYSTEM,"FRAME VERSION: %s, %s",frame_version_date, frame_version_time); + vsi_o_ttrace (NO_TASK, TC_SYSTEM,"MISC VERSION: %s, %s",misc_version_date, misc_version_time); + vsi_o_ttrace (NO_TASK, TC_SYSTEM,"TIF VERSION: %s, %s",tif_version_date, tif_version_time); + } +#endif + else if (!strcmp (token, SYSPRIM_RESET_TOKEN)) + { + /* + * Reset + */ + pf_Reset (TaskHandle); + } +#ifdef _TOOLS_ + else if (!strcmp (token, SYSPRIM_EXIT_TOKEN)) + { + /* + * Exit and delete + */ + if (pf_TaskTable[TaskHandle].PeiTable->pei_exit != NULL) + { + pf_TaskTable[TaskHandle].PeiTable->pei_exit(); + } + VSI_PPM_FREE(pPrim); + os_DeallocatePartition (TaskHandle, pPrim-PPM_OFFSET ); + vsi_p_delete(0,TaskHandle); + } +#endif /* _TOOLS_ */ +#ifdef MEMORY_SUPERVISION + else if (!strcmp (token, SYSPRIM_CHECK_OWNER)) + { + ppm_check_partition_owner = 1; + } + else if (!strcmp (token, SYSPRIM_SHOW_MEMORY)) + { + /* + * Show state of the partition pool monitor + */ + VSI_PPM_FREE(pPrim); + os_DeallocatePartition (TaskHandle, pPrim-PPM_OFFSET ); + TracePoolstatus (TaskHandle); + return; + } +#endif /* MEMORY_SUPERVISION */ +#ifndef _TOOLS_ + else if (!strcmp (token, SYSPRIM_SELECT_TIME_TDMA)) + { + time_is_tdma_frame = 1; + } +#endif +#ifdef _TOOLS_ + else if (!strcmp (token, SYSPRIM_IS_STACK_TIME)) + { + s_hdr = P_SHDR(pPrim); + set_stack_time (s_hdr->time); + } + else if (!strcmp (token, SYSPRIM_REGISTER_TOKEN)) + { + OS_HANDLE comhandle; + GetNextToken (data+strlen(token)+1, token, " #"); + if (os_create_extq (token, &comhandle) == OS_OK) + { + if (!strcmp (token, FRM_PCO_NAME)) + { + vsi_o_set_htrace (comhandle); + } + } + else + Error = TRUE; + } + else if (!strcmp (token, SYSPRIM_WITHDRAW_TOKEN)) + { + GetNextToken (data+strlen(token)+1, token, " #"); + if (os_destroy_extq (token) == OS_OK) + { + if (!strcmp (token, FRM_PCO_NAME)) + { + vsi_o_set_htrace (0); + } + } + else + Error = TRUE; + } +#endif /* _TOOLS_ */ + else + Error = TRUE; + + if ( Error ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "SYSTEM WARNING:Invalid system primitive '%s'",data ); + } + else + { + if ( !SuppressOK ) + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "OK (%s %s)", pf_TaskTable[TaskHandle].Name, data ); + } + } + VSI_PPM_FREE(pPrim); + os_DeallocatePartition (TaskHandle, pPrim-PPM_OFFSET ); +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-GPF (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_Reset | ++--------------------------------------------------------------------+ +*/ +LOCAL void pf_Reset (T_HANDLE TaskHandle) +{ + if (TaskHandle != NO_TASK) + { + if (pf_TaskTable[TaskHandle].PeiTable->pei_exit != NULL) + pf_TaskTable[TaskHandle].PeiTable->pei_exit(); + /* + * reset a single entity + */ + if (pf_TaskTable[TaskHandle].PeiTable->pei_init != NULL) + while (pf_TaskTable[TaskHandle].PeiTable->pei_init(TaskHandle) == PEI_ERROR) + os_SuspendTask ( TaskHandle, 5); + } + else + { + USHORT Handle; + /* + * reset all entities + */ + for (Handle = 1; Handle <= MaxEntities; Handle++) + { + if (pf_TaskTable[TaskHandle].PeiTable->pei_exit != NULL) + pf_TaskTable[TaskHandle].PeiTable->pei_exit(); + + if (pf_TaskTable[Handle].PeiTable->pei_init != NULL) + while (pf_TaskTable[TaskHandle].PeiTable->pei_init(TaskHandle) == PEI_ERROR) + os_SuspendTask ( TaskHandle, 5); + } + } +} +#endif + +#ifdef _TOOLS_ +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : FRAME | +| STATE : code ROUTINE : set_stack_time | ++--------------------------------------------------------------------+ + + PURPOSE : stores the local time of stack under test. Used to align + timestamps while tracing. + +*/ +void set_stack_time ( ULONG time ) +{ + init_stack_time = time; + os_GetTime ( NO_TASK, &init_local_time ); +} + +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : FRAME | +| STATE : code ROUTINE : get_stack_time | ++--------------------------------------------------------------------+ + + PURPOSE : returns the local time of stack under test. Used to align + timestamps while tracing. + +*/ +void get_local_time ( ULONG *time ) +{ +OS_TIME current_local_time; + + os_GetTime ( NO_TASK, ¤t_local_time ); + *time = init_stack_time + current_local_time - init_local_time; +} + +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : FRAME | +| STATE : code ROUTINE : pf_handle_error | ++--------------------------------------------------------------------+ + + PURPOSE : frame error and warning handling + +*/ +/*lint -e506, suppress Warning 506: Constant value Boolean */ +/*lint -e718, suppress nfo 718: Symbol '_va_argref' undeclared, assumed to return int */ +int pf_handle_warning ( USHORT cause, const char * const format,...) +{ +T_HANDLE caller; +va_list varpars; +static int recursion_count = 0; +USHORT free; +USHORT alloc; + + /* recursion counter is needed to avoid endless loop when generating warning during processing of warning */ + if ( recursion_count == 0 ) + { + recursion_count++; + caller = e_running[os_MyHandle()]; + va_start (varpars, format); + int_vsi_o_ttrace ( NO_TASK, TC_SYSTEM, format, varpars ); + + if ( error_ind_dst[0] != 0 ) + { + /* drop the warning, if there are fewer than 3 partitions available to avoid deadlock */ + vsi_m_status ( caller, sizeof(T_FRM_WARNING_IND)+sizeof(T_PRIM_HEADER), PrimGroupHandle, &free, &alloc ); + if ( free >= 3 ) + { + PALLOC(frm_warning_ind,FRM_WARNING_IND); + frm_warning_ind->warning_code = cause; +#ifdef _TARGET_ + /* We will destroy the partition guard pattern if the warning is longer than the warning string in FRM_WARNING_IND */ + vsprintf ((char*)frm_warning_ind->warning_string, format, varpars); +#else +#if defined(_LINUX_) || defined(_SOLARIS_) + vsnprintf ((char*)frm_warning_ind->warning_string, + sizeof(frm_warning_ind->warning_string), format, varpars); +#else + _vsnprintf ((char*)frm_warning_ind->warning_string, sizeof(frm_warning_ind->warning_string), format, varpars); +#endif +#endif + vsi_o_primsend ( caller, TC_SYSTEM, 0, error_ind_dst, (unsigned int)FRM_WARNING_IND, frm_warning_ind, sizeof(T_FRM_WARNING_IND) FILE_LINE_MACRO ); + } + else + { + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "FRM_WARNING_IND dropped" ); + } + } +#if defined _NUCLEUS_ && !defined _TARGET_ + vsprintf (TraceBuffer, format, varpars); + printf ("%s\n",TraceBuffer); +#endif +#ifdef _NUCLEUS_ + os_SystemError ( os_MyHandle(), cause, NULL ); +#endif + recursion_count--; + } + return VSI_OK; +} +/*lint +e718 */ +/*lint +e506 */ + +#endif + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/frame.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,148 @@ +/* ++------------------------------------------------------------------------------ +| File: frame.h ++------------------------------------------------------------------------------ +| 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 frame. ++----------------------------------------------------------------------------- +*/ + +#ifndef FRAME_H +#define FRAME_H + +/*==== INCLUDES =============================================================*/ + + +/*==== TYPES ================================================================*/ + +typedef enum { TST_ADR, RCV_ADR, END_OF_COMP_TABLE } T_COMPONENT_ID; + +typedef struct +{ + void *RcvAdr; + void *TstAdr; + void *DrvListAdr; + void *InitFuncAdr; + UBYTE *FrameEnvAdr; +} T_CONFIGURATION_ADDRESS; + +/*==== CONSTANTS ============================================================*/ + +#define PF_OK 0 +#define PF_ERROR -1 + +#define VSI_CALLER 0, + +#ifdef __FRAME_C__ + #ifndef RUN_INT_RAM + char FRM_TST_NAME[RESOURCE_NAMELEN] = { 'T','S','T',0x0,0x0,0x0,0x0,0x0 }; + char FRM_RCV_NAME[RESOURCE_NAMELEN] = { 'R','C','V',0x0,0x0,0x0,0x0,0x0 }; + char FRM_SYST_NAME[RESOURCE_NAMELEN] = { 'S','Y','S','T',0x0,0x0,0x0,0x0 }; + char FRM_PCO_NAME [RESOURCE_NAMELEN] = { 'P','C','O',0x0,0x0,0x0,0x0,0x0 }; + char const *syst_wrn = "SYSTEM WARNING:"; + #else + extern char FRM_TST_NAME[]; + extern char FRM_RCV_NAME[]; + extern char FRM_SYST_NAME[]; + extern char FRM_PCO_NAME[]; + #endif +#else + extern char const *syst_wrn; +#endif + +/* + * Tokens of the system primitives + */ +#define SYSPRIM_REDIRECT_TOKEN "REDIRECT" +#define SYSPRIM_CONNECT_TOKEN "CONNECT" +#define SYSPRIM_DISCONNECT_TOKEN "DISCONNECT" +#define SYSPRIM_DUPLICATE_TOKEN "DUPLICATE" +#define SYSPRIM_CONFIG_TOKEN "CONFIG" +#define SYSPRIM_MEMCHECK_TOKEN "MEMCHECK" +#define SYSPRIM_RESET_TOKEN "RESET" +#define SYSPRIM_VERSION_TOKEN "VERSION" +#define SYSPRIM_CLEAR_TOKEN "CLEAR" +#define SYSPRIM_NULL_TOKEN "NULL" +#define SYSPRIM_TRACECLASS_TOKEN "TRACECLASS" +#define SYSPRIM_DISPLAY_TOKEN "DISPLAY" +#define SYSPRIM_BOOT_TOKEN "BOOT" +#define SYSPRIM_SHOW_MEMORY "MEMORY" +#define SYSPRIM_TRC_SUSPEND "TRCSUSPEND" +#define SYSPRIM_READ_ROUTING "ROUTING" +#define SYSPRIM_STR2IND_VERSION "STR2INDVERSION" +#define SYSPRIM_EXIT_TOKEN "EXIT" +#define SYSPRIM_REGISTER_TOKEN "REGISTER" +#define SYSPRIM_WITHDRAW_TOKEN "WITHDRAW" +#define SYSPRIM_STATUS_TOKEN "STATUS" +#define SYSPRIM_SUPPRESS_OK "SUPPRESS_OK" +#define SYSPRIM_GET_STACK_TIME "GET_STACK_TIME" +#define SYSPRIM_IS_STACK_TIME "IS_STACK_TIME" +#define SYSPRIM_READ_FFS_DAR "READ_DAR_FILE" +#define SYSPRIM_SELECT_TIME_TDMA "TIME_TDMA" +#define SYSPRIM_CHECK_OWNER "PPM_CHECK_OWNER" +#define SYSPRIM_TST_SYNC_REQ "TST_SYNC_REQ" +#define SYSPRIM_TST_SYNC_CNF "TST_SYNC_CNF" +#define SYSPRIM_TST_SYNC_REJ "TST_SYNC_REJ" +#define SYSPRIM_ROUTE_DESCLIST "ROUTE_DESCLIST" +#define SYSPRIM_READ_COM_MATRIX "READ_COM_MATRIX" +#define SYSPRIM_ISOLATE_TOKEN "ISOLATE" +#define SYSPRIM_REGISTER_ERR_IND "REG_ERROR_IND" +#define SYSPRIM_WITHDRAW_ERR_IND "WITHDRAW_ERROR_IND" +#define SYSPRIM_CHECK_DESCLIST "CHECK_DESCLIST" +#define SYSPRIM_PCHECK "PCHECK" + + +#define PERIODIC_TIMER 0x8000 +#define TIMEOUT_OCCURRED 0x4000 +#define TIMER_HANDLE_MASK (~(PERIODIC_TIMER|TIMEOUT_OCCURRED)) + +/* + * message prioritiey + */ +#define MSG_PRIMITIVE_PRIO OS_NORMAL +#define MSG_SIGNAL_PRIO OS_URGENT +#define MSG_TRACE_PRIO OS_NORMAL +/* + * length for traces + */ +#define ITRACE_LEN (2*sizeof(USHORT)+1) +#define PTRACE_LEN_OPC16 18 +#define PTRACE_LEN_OPC32 22 +#define STRACE_LEN 80 + +#define TRACE_TEXT_SIZE (sizeof(T_S_HEADER)+TTRACE_LEN) +#define TRACE_INDEX_SIZE (sizeof(T_S_HEADER)+ITRACE_LEN) +#define TRACE_PRIM_SIZE (sizeof(T_S_HEADER)+PTRACE_LEN_OPC32) +#define TRACE_STATE_SIZE (sizeof(T_S_HEADER)+STRACE_LEN) + +/*==== PROTOTYPES ===========================================================*/ + +GLOBAL void pf_Init (T_CONFIGURATION_ADDRESS *ConfigAddress); +GLOBAL SHORT pf_CreateAllEntities (void); +GLOBAL SHORT pf_StartAllTasks ( void ); +GLOBAL void pf_Timeout (T_HANDLE TaskHandle, T_HANDLE EntityHandle, USHORT TimerIndex ); +GLOBAL void pf_ProcessSystemPrim ( T_HANDLE TaskHandle, T_VOID_STRUCT *pPrim); +GLOBAL int pf_handle_warning ( USHORT cause, const char * const format,...); +GLOBAL void InitializeTimer (void); +GLOBAL void InitializeTrace (void); +GLOBAL void TracePoolstatus (T_HANDLE Caller ); +GLOBAL void InitializePPM (void); +GLOBAL void InitializeDriverConfig (void); + +#ifdef _TOOLS_ +extern USHORT pf_get_frameenv (void); +void set_stack_time (ULONG time); +void get_local_time (ULONG *time); +#endif /* _TOOLS_ */ + +#endif /* FRAME_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/frame_version.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,43 @@ +/* ++------------------------------------------------------------------------------ +| File: frame_version.c ++------------------------------------------------------------------------------ +| 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 contain build date and time ++----------------------------------------------------------------------------- +*/ + +#ifndef __FRAME_VERSION_C__ +#define __FRAME_VERSION_C__ +#endif + + +/*==== INCLUDES ===================================================*/ + + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + +#ifndef RUN_INT_RAM +const char * const frame_version_date = __DATE__; +const char * const frame_version_time = __TIME__; +#endif + +/*==== EXTERNALS ==================================================*/ + + +/*==== FUNCTIONS ==================================================*/ + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/frm_ext.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,114 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_ext.h ++------------------------------------------------------------------------------ +| Copyright 2005 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 provides functionality for the Frame Extension +| Interface. ++----------------------------------------------------------------------------- +*/ + +#ifndef __FRM_EXT_C__ +#define __FRM_EXT_C__ +/*==== INCLUDES ===================================================*/ + +#include <stdio.h> +#include <string.h> + +#include "typedefs.h" +#include "os.h" +#include "vsi.h" +#include "frame.h" +#include "tools.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "p_mem.h" +#include "frm_ext.h" + +/*==== TYPES ================================================================*/ + + +/*==== PROTOTYPES ===============================================================*/ + +void fei_lemu_SendToQueue_init ( void ); +void fei_lemu_SendToQueue_register(int(* func)(OS_HANDLE SndComHandle, OS_HANDLE RcvComHandle, + OS_HANDLE RcvQHandle, USHORT Prio, ULONG Suspend, + OS_QDATA *Msg ), ULONG ret_ok); + +/*==== MACROS ================================================================*/ + +#define LEMU_SENDTOQUEUE_INITIALIZED 0xaffedead + +/*==== VARIABLES ==================================================*/ + +#ifndef _TOOLS_ +#ifndef RUN_INT_RAM + T_lemu_SendToQueue lemu_SendToQueue_func; +#else + extern T_lemu_SendToQueue lemu_SendToQueue_func; +#endif +#endif + +/*==== FUNCTIONS ==================================================*/ + +#ifndef _TOOLS_ +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : fei_lemu_SendToQueue_register ++------------------------------------------------------------------------------ +| Description : register the lemu_SendToQueue function. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void fei_lemu_SendToQueue_register( int (* func)(OS_HANDLE SndComHandle, + OS_HANDLE RcvComHandle, OS_HANDLE RcvQHandle, USHORT Prio, + ULONG Suspend, OS_QDATA *Msg ), ULONG ret_ok) +{ + lemu_SendToQueue_func.ret_ok = ret_ok; + lemu_SendToQueue_func.plemu_SendToQueue = func; + lemu_SendToQueue_func.magic_nr = LEMU_SENDTOQUEUE_INITIALIZED; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : fei_lemu_SendToQueue_init ++------------------------------------------------------------------------------ +| Description : initialize lemu_SendToQueue function pointer table. +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void fei_lemu_SendToQueue_init ( void ) +{ + if ( lemu_SendToQueue_func.magic_nr != LEMU_SENDTOQUEUE_INITIALIZED) + { + lemu_SendToQueue_func.ret_ok = 0; + lemu_SendToQueue_func.plemu_SendToQueue = NULL; + lemu_SendToQueue_func.magic_nr = 0; + } +} +#endif + +#endif /* !_TOOLS_*/ + + +#endif /* __FRM_EXT_C__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/prf_func.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,380 @@ +/* ++------------------------------------------------------------------------------ +| File: prf_func.c ++------------------------------------------------------------------------------ +| 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 Modul defines the profiler interface functions. ++----------------------------------------------------------------------------- +*/ + + + +#ifndef __PRF_FUNC_C__ +#define __PRF_FUNC_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "typedefs.h" +#include "glob_defs.h" +#include "vsi.h" +#include "os.h" +#include "prf_func.h" +#include "string.h" + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +extern ULONG TraceMask[]; +extern T_HANDLE e_running[]; + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM + T_PROFILER_FUNC prf_func; +#else + extern T_PROFILER_FUNC prf_func; + extern void prf_register ( T_PROFILER_FUNC * func ); +#endif + +/*==== LINT =======================================================*/ + + +/*==== FUNCTIONS ==================================================*/ + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : prf_init ++------------------------------------------------------------------------------ +| Description : initialize profiler API function pointer table. +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_init ( void ) +{ + if ( prf_func.magic_nr != PRF_INITIALIZED ) + { + memset ( &prf_func, 0, sizeof ( T_PROFILER_FUNC ) ); + } +} +#endif + + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : prf_register ++------------------------------------------------------------------------------ +| Description : register the profiler API functions. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_register ( T_PROFILER_FUNC * func ) +{ + prf_func.log_entity_create = func->log_entity_create; + prf_func.log_entity_delete = func->log_entity_delete; + prf_func.log_entity_activate = func->log_entity_activate; + prf_func.log_function_entry = func->log_function_entry; + prf_func.log_function_exit = func->log_function_exit; + prf_func.log_point_of_interest = func->log_point_of_interest; + prf_func.magic_nr = PRF_INITIALIZED; +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_entity_create ++------------------------------------------------------------------------------ +| Description : log entity create +| +| Parameters : entity - unique entity indentifier +| name - entity name +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_entity_create ( void * entity, const char * name ) +{ + if ( prf_func.log_entity_create != NULL ) + { + prf_func.log_entity_create ( entity, name ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_entity_delete ++------------------------------------------------------------------------------ +| Description : log entity delete +| +| Parameters : entity - unique entity indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_entity_delete ( void * entity ) +{ + if ( prf_func.log_entity_delete != NULL ) + { + prf_func.log_entity_delete ( entity ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_entity_activate ++------------------------------------------------------------------------------ +| Description : log entity activate +| +| Parameters : entity - unique entity indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_entity_activate ( void * entity ) +{ + if ( prf_func.log_entity_activate != NULL ) + { + prf_func.log_entity_activate ( entity ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_function_entry ++------------------------------------------------------------------------------ +| Description : log function entry +| +| Parameters : function - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_function_entry ( void * function ) +{ +T_HANDLE caller; + + caller = e_running [ os_MyHandle() ]; + if ( TraceMask [ caller ] & TC_PROFILER ) + { + if ( prf_func.log_function_entry != NULL ) + { + prf_func.log_function_entry ( function ); + } + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_function_exit ++------------------------------------------------------------------------------ +| Description : log function exit +| +| Parameters : function - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_function_exit ( void * function ) +{ +T_HANDLE caller; + + caller = e_running [ os_MyHandle() ]; + if ( TraceMask [ caller ] & TC_PROFILER ) + { + if ( prf_func.log_function_exit != NULL ) + { + prf_func.log_function_exit ( function ); + } + } +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_point_of_interest ++------------------------------------------------------------------------------ +| Description : log point of interest +| +| Parameters : poi - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void prf_log_point_of_interest ( const char * poi ) +{ +T_HANDLE caller; + + caller = e_running [ os_MyHandle() ]; + if ( TraceMask [ caller ] & TC_PROFILER ) + { + if ( prf_func.log_point_of_interest != NULL ) + { + prf_func.log_point_of_interest ( poi ); + } + } +} +#endif + +//#define TEST_PROFILER_API +#ifdef TEST_PROFILER_API + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_register ++------------------------------------------------------------------------------ +| Description : register the profiler API functions. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_entity_create ( void * entity, const char * name ) +{ + vsi_o_ttrace ( e_running[os_MyHandle()], TC_SYSTEM, "PRF: Create entity %s, id=%d", name, entity ); +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_entity_delete ++------------------------------------------------------------------------------ +| Description : log entity delete +| +| Parameters : entity - unique entity indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_entity_delete ( void * entity ) +{ + vsi_o_ttrace ( e_running[os_MyHandle()], TC_SYSTEM, "PRF: Delete entity id=%d", entity ); +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_entity_activate ++------------------------------------------------------------------------------ +| Description : log entity activate +| +| Parameters : entity - unique entity indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_entity_activate ( void * entity ) +{ +T_HANDLE caller; +extern T_HANDLE TST_Handle; + + caller = e_running[os_MyHandle()]; + if ( caller != TST_Handle ) + vsi_o_ttrace ( caller, TC_SYSTEM, "PRF: Activate entity %d", entity ); +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_function_entry ++------------------------------------------------------------------------------ +| Description : log function entry +| +| Parameters : function - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_function_entry ( void * function ) +{ + vsi_o_ttrace ( e_running[os_MyHandle()], TC_SYSTEM, "PRF: Function entry %s", function ); +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_function_exit ++------------------------------------------------------------------------------ +| Description : log function exit +| +| Parameters : function - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_function_exit ( void * function ) +{ + vsi_o_ttrace ( e_running[os_MyHandle()], TC_SYSTEM, "PRF: Function exit %s", function ); +} +#endif + +#ifndef RUN_FLASH +/* ++------------------------------------------------------------------------------ +| Function : prf_log_point_of_interest ++------------------------------------------------------------------------------ +| Description : log point of interest +| +| Parameters : poi - unique function indentifier +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void log_point_of_interest ( const char * poi ) +{ + vsi_o_ttrace ( e_running[os_MyHandle()], TC_SYSTEM, "PRF: POI %s", poi ); +} +#endif + +#ifndef RUN_FLASH +T_PROFILER_FUNC profiler_functions = +{ +PRF_INITIALIZED, +log_entity_create, +log_entity_delete, +log_entity_activate, +log_function_entry, +log_function_exit, +log_point_of_interest, +}; +#endif + +#endif /* TEST_PROFILER_API */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/route.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,1240 @@ +/* ++------------------------------------------------------------------------------ +| File: route.c ++------------------------------------------------------------------------------ +| Copyright 2004 Texas Instruments Deutschland, 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 Deutschland, AG. ++----------------------------------------------------------------------------- +| Purpose : This Modul performs the filtering and routing of +| primitives for testing capabilities of the protocol stack. ++----------------------------------------------------------------------------- +*/ + +#ifndef __ROUTE_C__ +#define __ROUTE_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include <stdio.h> +#include <string.h> + +#include "typedefs.h" +#include "os.h" +#include "vsi.h" +#include "frame.h" +#include "tools.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "p_mem.h" +#include "route.h" +#include "frm_ext.h" + +/*==== CONSTANTS ==================================================*/ + +/*==== TYPES ======================================================*/ + +/*==== CONSTANTS ====================================================*/ + +/*==== EXTERNALS =====================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +extern OS_HANDLE ext_data_pool_handle; +extern T_HANDLE TestGroupHandle; +extern T_FRM_ROUTING_TABLE_ENTRY *Routing[]; +extern char TaskName[]; +#ifndef _TOOLS_ +extern T_lemu_SendToQueue lemu_SendToQueue_func; +#endif +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM +T_HANDLE rt_tst_handle = VSI_ERROR; +#else +extern int rt_tst_handle; +#endif + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +#ifndef _TOOLS_ +extern const T_MEM_PROPERTIES *mem; +#endif + +/*==== FUNCTIONS ==================================================*/ + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_Init | ++--------------------------------------------------------------------+ + + PURPOSE : initialize the routing table. +*/ + +GLOBAL SHORT rt_Init (void) +{ +USHORT i; + /* + * Initialize the routingTable + */ + for ( i = 0; i <= MaxEntities; i++ ) + Routing[i] = NULL; + + return OS_OK; +} +#endif + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_CvrtOpcMask | ++--------------------------------------------------------------------+ + + PURPOSE : convert "1010101" mask to opcMask and opcStatus +*/ + +LOCAL SHORT rt_CvrtToOpcMask ( char *OpcString, ULONG *opcMask, ULONG *opcStatus ) +{ +unsigned int len; +unsigned int i; +char *p; + + len = strlen ( OpcString ); + p = OpcString + len; + + for ( i = 0; i < len; i++ ) + { + switch (*--p) + { + case '1': + *opcMask |= (1<<i); + *opcStatus |= (1<<i); + break; + case '0': + *opcMask |= (1<<i); + *opcStatus &= ~((unsigned int)1<<i); + break; + case '*': /* wildcard matches */ + *opcMask &= ~((unsigned int)1<<i); + *opcStatus &= ~((unsigned int)1<<i); + break; + default: + break; + } + } + return OS_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_CvrtOpcMask | ++--------------------------------------------------------------------+ + + PURPOSE : convert opcMask and opcStatus to "1010101" +*/ +LOCAL SHORT rt_CvrtFromOpcMask ( char *OpcString, ULONG opcMask, ULONG opcStatus ) +{ +signed char i; +char len; + + if ( opcMask >> 16 ) + len = 32; + else + len = 16; + for ( i = len-1; i >= 0; i-- ) + { + if ( opcMask & (1<<i) ) + { + if ( opcStatus & (1<<i) ) + *OpcString = '1'; + else + *OpcString = '0'; + } + else + *OpcString = '*'; + OpcString++; + } + *(OpcString++) = ' '; + *(OpcString++) = 0; + + return OS_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_ReadRouting | ++--------------------------------------------------------------------+ + + PURPOSE : reads all routings of the routing table of the task. +*/ + +GLOBAL SHORT rt_RouteRead ( T_HANDLE Handle, char *Buffer ) +{ +T_HANDLE TstComHandle; +static T_FRM_ROUTING_TABLE_ENTRY *pEntry; +char OrgReceiver[ RESOURCE_NAMELEN ]; +char NewReceiver[ RESOURCE_NAMELEN ]; +char OpcString [18]; +char const *pCmd; +static UBYTE FirstRead = 1; + + if ( FirstRead ) + { + FirstRead = 0; + pEntry = Routing[Handle]; + } + if ( pEntry ) + { + if ( pEntry->OldDestComHandle == ROUTE_ALL ) + strcpy ( OrgReceiver, RT_ALL_TOKEN ); + else + strcpy ( OrgReceiver, pf_TaskTable[pEntry->OldDestComHandle].Name ); + TstComHandle = vsi_c_open ( Handle, FRM_TST_NAME ); + if ( pEntry->NewDestComHandle == TstComHandle ) + strcpy ( NewReceiver, pEntry->ExtDest ); + else + { + if ( pEntry->NewDestComHandle != 0 ) + strcpy ( NewReceiver, pf_TaskTable[pEntry->NewDestComHandle].Name ); + } + if ( pEntry->opcMask ) + rt_CvrtFromOpcMask ( OpcString, pEntry->opcMask, pEntry->opcStatus ); + else + OpcString[0] = 0; + + switch (pEntry->Command & RT_COMMAND_MASK) + { + case RT_DUPLICATE: pCmd = SYSPRIM_DUPLICATE_TOKEN; + break; + case RT_REDIRECT: pCmd = SYSPRIM_REDIRECT_TOKEN; + break; + case RT_DESTROY: pCmd = SYSPRIM_REDIRECT_TOKEN; + strcpy ( NewReceiver, SYSPRIM_NULL_TOKEN ); + break; + default: pCmd = NULL; + break; + } + sprintf ( Buffer, "%s %s %s %s%s", pf_TaskTable[Handle].Name, pCmd, OrgReceiver, OpcString, NewReceiver ); + pEntry = pEntry->pNextEntry; + return RT_OK; + } + else + { + FirstRead = 1; + pEntry = Routing[Handle]; + return RT_ERROR; + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_RoutingEntry | ++--------------------------------------------------------------------+ + + PURPOSE : adds a new routing to the routing table of the task. + routings with duplicates are stored in the beginning + of the table because if the primitive is redirected and + send it can not be duplicated. +*/ + +LOCAL SHORT rt_RoutingEntry ( T_HANDLE SndTaskHandle, T_FRM_ROUTING_TABLE_ENTRY *pNewEntry, RT_ENTRY Status ) +{ +T_FRM_ROUTING_TABLE_ENTRY *pEntry, *pNextEntry, *pPrevEntry; + + /* + * delete all entries with same OldDestComHandle if a destroy command is stored + */ + if ( pNewEntry->Command & RT_DESTROY ) + { + if ( ( pEntry = Routing[SndTaskHandle] ) != NULL ) + { + do + { + if ( pEntry->OldDestComHandle == pNewEntry->OldDestComHandle ) + { + if ( pEntry == Routing[SndTaskHandle] ) + { + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = NULL; + } + Routing[SndTaskHandle] = pEntry->pNextEntry; + } + else + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pPrevEntry)->pNextEntry = pEntry->pNextEntry; + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = pEntry->pPrevEntry; + } + } + pNextEntry = pEntry->pNextEntry; + os_DeallocateMemory ( SndTaskHandle, (T_VOID_STRUCT*)pEntry ); + } + else + pNextEntry = pEntry->pNextEntry; + + pEntry = pNextEntry; + } + while ( pEntry ); + } + } + else + { + /* + * delete destroy command for OldDestComHandle if a new command is stored + */ + if ( ( pEntry = Routing[SndTaskHandle] ) != NULL ) + { + do + { + if ( pEntry->OldDestComHandle == pNewEntry->OldDestComHandle ) + { + if ( pEntry->Command == RT_DESTROY ) + { + if ( pEntry == Routing[SndTaskHandle] ) + { + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = NULL; + } + Routing[SndTaskHandle] = pEntry->pNextEntry; + } + else + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pPrevEntry)->pNextEntry = pEntry->pNextEntry; + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = pEntry->pPrevEntry; + } + } + pNextEntry = pEntry->pNextEntry; + os_DeallocateMemory ( SndTaskHandle, (T_VOID_STRUCT*)pEntry ); + } + break; + } + else + pNextEntry = pEntry->pNextEntry; + + pEntry = pNextEntry; + } + while ( pEntry ); + } + } + + + if ( (pEntry = Routing[SndTaskHandle]) != NULL ) + { + do + { + if ( pEntry->SndTaskHandle == SndTaskHandle + && pEntry->NewDestComHandle == pNewEntry->NewDestComHandle + && pEntry->OldDestComHandle == pNewEntry->OldDestComHandle + && pEntry->MsgType == pNewEntry->MsgType ) + { + if ( !strcmp (pEntry->ExtDest, pNewEntry->ExtDest) ) + { + if ( Status == RT_DELETE ) + { + if ( pEntry == Routing[SndTaskHandle] ) + { + Routing[SndTaskHandle] = pEntry->pNextEntry; + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = NULL; + } + } + else + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pPrevEntry)->pNextEntry = pEntry->pNextEntry; + if ( pEntry->pNextEntry ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = pEntry->pPrevEntry; + } + } + pNextEntry = pEntry->pNextEntry; + os_DeallocateMemory ( SndTaskHandle, (T_VOID_STRUCT*)pEntry ); + return RT_OK; + } +#ifndef _TOOLS_ + else + { + pEntry->Command = pNewEntry->Command; /* modify command for old routing entry */ + pEntry->opcMask = pNewEntry->opcMask; /* set new opcMask in old routing entry */ + pEntry->opcStatus = pNewEntry->opcStatus; /* set new opcStatus in old routing entry */ + return RT_OK; + } +#else + pEntry = pEntry->pNextEntry; +#endif + } + else + { +#ifdef _TOOLS_ + if ( ( pEntry->opcMask == pNewEntry->opcMask ) + && ( pEntry->opcStatus == pNewEntry->opcStatus ) ) + { + strcpy ( pEntry->ExtDest, pNewEntry->ExtDest ); + return RT_OK; + } + else +#endif + pEntry = pEntry->pNextEntry; + } + } + else + pEntry = pEntry->pNextEntry; + } while ( pEntry ); + } + + pPrevEntry = NULL; + if ( ( pEntry = Routing[SndTaskHandle] ) != NULL ) + { + do + { + pPrevEntry = pEntry; + if ( pNewEntry->Command & RT_DUPLICATE )/* put Duplications at the end of Duplications */ + { + if ( pEntry->Command & RT_DUPLICATE ) + pEntry = pEntry->pNextEntry; + else + { + if ( pPrevEntry == Routing[SndTaskHandle] ) + pPrevEntry = NULL; + else + pPrevEntry = pEntry->pPrevEntry; + break; + } + } + else + pEntry = pEntry->pNextEntry; + } + while ( pEntry ); + } + if ( os_AllocateMemory ( SndTaskHandle, (T_VOID_STRUCT**)&pNextEntry, sizeof(T_FRM_ROUTING_TABLE_ENTRY), OS_NO_SUSPEND, ext_data_pool_handle ) == OS_TIMEOUT ) + return RT_NO_MEM; + pNextEntry->SndTaskHandle = SndTaskHandle; + pNextEntry->OldDestComHandle = pNewEntry->OldDestComHandle; + pNextEntry->NewDestComHandle = pNewEntry->NewDestComHandle; + pNextEntry->OldDestTaskHandle = pNewEntry->OldDestTaskHandle; + pNextEntry->Command = pNewEntry->Command; + pNextEntry->MsgType = pNewEntry->MsgType; + pNextEntry->opcMask = pNewEntry->opcMask; + pNextEntry->opcStatus = pNewEntry->opcStatus; + strcpy ( pNextEntry->ExtDest, pNewEntry->ExtDest ); + + if ( pEntry ) + { + pEntry->pPrevEntry = pNextEntry; /* store at the beginning/in the list */ + } + else + pNextEntry->pNextEntry = NULL; /* append to the list */ + + if ( pPrevEntry ) + { + pPrevEntry->pNextEntry = pNextEntry; /* store in the list */ + pNextEntry->pPrevEntry = pPrevEntry; + pNextEntry->pNextEntry = pEntry; + } + else + { + Routing[SndTaskHandle] = pNextEntry; /* store at the beginning */ + pNextEntry->pNextEntry = pEntry; + } + return RT_OK; +} +#endif + +#if 0 +/* not needed -> temporarily removed */ +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_ModifyRouting | ++--------------------------------------------------------------------+ + + PURPOSE : handle the contents of the redirection or duplicate + system primitive + +*/ +GLOBAL SHORT rt_isolate_entity ( T_HANDLE caller, char *entity ) +{ +T_FRM_ROUTING_TABLE_ENTRY entry; +T_HANDLE snd; +T_HANDLE rcv; +int read_entry = FIRST_ENTRY; + + if ( (rcv = vsi_e_handle ( caller, entity )) == VSI_ERROR ) + return RT_ERROR; + else + { + while ( vsi_c_get_entity_com_entry ( read_entry, rcv, &snd ) == VSI_OK ) + { + read_entry = NEXT_ENTRY; + entry.SndTaskHandle = snd; + entry.OldDestComHandle = rcv; + entry.NewDestComHandle = 0; + entry.opcMask = 0; + entry.MsgType = RT_PRIMITIVE_TYPE; + entry.Command = RT_DESTROY; + rt_RoutingEntry ( snd, &entry, RT_STORE ); + } + + entry.SndTaskHandle = rcv; + entry.OldDestComHandle = ROUTE_ALL; + entry.NewDestComHandle = 0; + entry.opcMask = 0; + entry.MsgType = RT_PRIMITIVE_TYPE; + entry.Command = RT_DESTROY; + rt_RoutingEntry ( rcv, &entry, RT_STORE ); + + return RT_OK; + } +} +#endif +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_ModifyRouting | ++--------------------------------------------------------------------+ + + PURPOSE : handle the contents of the redirection or duplicate + system primitive + +*/ +GLOBAL SHORT rt_RoutingModify ( T_HANDLE SndTaskHandle, char *Command, char *RoutingString) +{ +char Token[81]; +char *pChar = RoutingString; +T_FRM_ROUTING_TABLE_ENTRY Entry = { 0 }; +unsigned int len; +T_FRM_ROUTING_TABLE_ENTRY *pEntry, *pNextEntry; + + if ( !strcmp (Command, SYSPRIM_DUPLICATE_TOKEN) ) + Entry.Command = RT_DUPLICATE; + + if ( !strcmp (Command, SYSPRIM_REDIRECT_TOKEN) ) + Entry.Command = RT_REDIRECT; + + if ( (len = GetNextToken (pChar, Token, " #")) == 0 ) + return RT_ERROR; + else + pChar += (len+1); + + if ( !strcmp (Token, RT_CLEAR_TOKEN) ) + Entry.Command |= RT_CLEAR_ENTRY; + + if ( !strcmp (Token, RT_ALL_TOKEN) ) + Entry.Command |= RT_ALL_DESTINATION; + + if ( Entry.Command & RT_CLEAR_ENTRY ) + { + if ( (pEntry = Routing[SndTaskHandle]) != NULL ) + { + do + { + pNextEntry = (T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry; + os_DeallocateMemory ( SndTaskHandle, (T_VOID_STRUCT*)pEntry ); + pEntry = pNextEntry; + } + while ( pEntry ); + Routing[SndTaskHandle] = NULL; + } + return RT_OK; + } + + if ( Entry.Command & RT_ALL_DESTINATION ) + { + Entry.OldDestComHandle = ROUTE_ALL; + Entry.OldDestTaskHandle = ROUTE_ALL; + } + else + { + if ( ( Entry.OldDestComHandle = vsi_c_open (SndTaskHandle, Token ) ) == VSI_ERROR ) + return RT_ERROR; + Entry.OldDestTaskHandle = Entry.OldDestComHandle; + } + + if ( (len = GetNextToken (pChar, Token, " #")) == 0 ) + return RT_ERROR; + else + pChar += (len+1); + + if ( !strcmp (Token, RT_TIMEOUT_TOKEN) ) + { + Entry.MsgType = RT_TIMEOUT_TYPE; + if ( (len = GetNextToken (pChar, Token, " #")) == 0 ) + return RT_ERROR; + else + pChar += (len+1); + + } + else + { + if ( !strcmp (Token, RT_SIGNAL_TOKEN) ) + { + Entry.MsgType = RT_SIGNAL_TYPE; + if ( (len = GetNextToken (pChar, Token, " #")) == 0 ) + return RT_ERROR; + else + pChar += (len+1); + } + else + Entry.MsgType = RT_PRIMITIVE_TYPE; + } + + if ( (Token[0] == '1') || (Token[0] == '0') || (Token[0] == '*') ) + { + rt_CvrtToOpcMask(Token, &Entry.opcMask, &Entry.opcStatus); + if ( (len = GetNextToken (pChar, Token, " #")) == 0 ) + return RT_ERROR; + else + pChar += (len+1); + } +/* else */ + { + if (!strcmp (Token, SYSPRIM_NULL_TOKEN)) + { + if ( Entry.Command & RT_REDIRECT ) + { + Entry.Command |= RT_DESTROY; /* destroy the primitive */ + Entry.Command &= ~RT_REDIRECT; + } + else + return RT_ERROR; + } + else + { + if ( ( Entry.NewDestComHandle = vsi_c_open (SndTaskHandle, Token ) ) == VSI_ERROR ) + { +#ifdef _TOOLS_ + if ( !strcmp ( FRM_PCO_NAME, Token ) ) + return RT_ERROR; +#endif + if ( ( Entry.NewDestComHandle = vsi_c_open (SndTaskHandle, FRM_TST_NAME ) ) != VSI_ERROR ) + { + rt_tst_handle = Entry.NewDestComHandle; + if ( len < RESOURCE_NAMELEN ) + { + strncpy( Entry.ExtDest, Token, RESOURCE_NAMELEN ); + Entry.ExtDest[RESOURCE_NAMELEN-1] = 0; + } + else + return RT_ERROR; + } + } + } + + if ( Entry.Command & RT_ALL_DESTINATION ) + { + if ( (pEntry = Routing[SndTaskHandle]) != NULL ) + { + int all_cleared = 1; + do + { + pNextEntry = (T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry; + if ( (pEntry->NewDestComHandle == Entry.NewDestComHandle ) + && !strcmp(pEntry->ExtDest, Entry.ExtDest) ) + { + if ( pEntry == Routing[SndTaskHandle] ) + { + Routing[SndTaskHandle] = pEntry->pNextEntry; + if ( pEntry->pNextEntry != NULL ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = NULL; + } + } + else + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pPrevEntry)->pNextEntry = pEntry->pNextEntry; + if ( pEntry->pNextEntry != NULL ) + { + ((T_FRM_ROUTING_TABLE_ENTRY*)pEntry->pNextEntry)->pPrevEntry = pEntry->pPrevEntry; + } + } + os_DeallocateMemory ( SndTaskHandle, (T_VOID_STRUCT*)pEntry ); + } + else + { + all_cleared = 0; + } + pEntry = pNextEntry; + } + while ( pEntry ); + if ( all_cleared == 1 ) + Routing[SndTaskHandle] = NULL; + } + } + + if ( (pChar >= RoutingString+ strlen (RoutingString)) + || ((len = GetNextToken (pChar, Token, " #")) == 0) ) + return ( rt_RoutingEntry(SndTaskHandle, &Entry, RT_STORE) ); + else + pChar += (len+1); + + if ( Entry.Command & RT_CLEAR_ENTRY ) + return ( rt_RoutingEntry(SndTaskHandle, &Entry, RT_DELETE) ); + return RT_ERROR; + } + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_routePrim | ++--------------------------------------------------------------------+ + + PURPOSE : Looks if the task have some routing rules stored and + perform the redirection or duplication. + +*/ + +GLOBAL SHORT rt_Route ( T_HANDLE SndTaskHandle, T_HANDLE RcvComHandle, USHORT Prio, ULONG Suspend, OS_QDATA *Msg ) +{ +T_FRM_ROUTING_TABLE_ENTRY *pEntry; + +T_PRIM_HEADER *prim; +ULONG opc; + + if ( ( pEntry = Routing[SndTaskHandle] ) != NULL ) + { + if ( pEntry->MsgType == Msg->data16 ) + { + prim = (T_PRIM_HEADER*)Msg->ptr; + +#ifndef _TOOLS_ + if (prim->opc & MEMHANDLE_OPC) + { + P_MEMHANDLE_SDU(prim)=0x00000000; + } +#endif + + do + { + if ( SndTaskHandle == pEntry->SndTaskHandle + && ( (RcvComHandle == pEntry->OldDestComHandle) || (pEntry->OldDestComHandle == ROUTE_ALL) ) ) + { + /* + * a route for the receiver is defined. Now + * check the filter conditions + */ + opc = ((T_PRIM_HEADER*)Msg->ptr)->opc; + if ( (opc & pEntry->opcMask) == (pEntry->opcStatus & pEntry->opcMask) ) + { + /* + * filter matched -> redirect, duplicate or destroy + * the primitive. + */ + switch (pEntry->Command & RT_COMMAND_MASK) + { + case RT_DESTROY: + /* add VSI_PPM_FREE(Msg->ptr) just to avoid the PPM warning of freeing a primitive in a queue */ + VSI_PPM_RCV(Msg->ptr); + VSI_PPM_FREE(Msg->ptr); + os_DeallocatePartition (SndTaskHandle, Msg->ptr-PPM_OFFSET ); + return RT_OK; + + case RT_REDIRECT: +#ifndef _TOOLS_ + if (pEntry->NewDestComHandle != rt_tst_handle) + { + /* if not on tool side and not sending via TST -> send directly */ + Msg->e_id = pEntry->NewDestComHandle; + return ( (SHORT)os_SendToQueue ( SndTaskHandle, pf_TaskTable[pEntry->NewDestComHandle].QueueHandle, OS_NORMAL, OS_SUSPEND, Msg ) ); + } +#endif + /*lint -fallthrough */ + case RT_DUPLICATE: + if (pEntry->NewDestComHandle != OS_ERROR) + { + OS_QDATA QData; +#ifdef _TOOLS_ + QData.len = (USHORT)(PSIZE(P2D(Msg->ptr))-sizeof(T_PRIM_HEADER)); +#else + /* QData.len = 4; not needed if per reference */ + T_DP_HEADER *dp_hdr; +#if 0 + P_ATTACH(P2D(prim)); /* recursivly increase use counters */ +#else + prim->use_cnt++; + if ( prim->dph_offset != 0 ) + { + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + /* only increment use_cnt for dynamic primitives - not for DTI primitives */ + if ( dp_hdr->magic_nr == GUARD_PATTERN ) + { + do + { + dp_hdr->use_cnt++; + } while ( (dp_hdr = (T_DP_HEADER*)dp_hdr->next) != NULL ); + } + } +#endif /* 0 */ + +#endif + QData.data16 = MSG_PRIMITIVE; + QData.ptr = Msg->ptr; + +#ifndef _TOOLS_ + if (pEntry->NewDestComHandle != rt_tst_handle) + { + Msg->e_id = pEntry->NewDestComHandle; + os_SendToQueue ( SndTaskHandle, pf_TaskTable[pEntry->NewDestComHandle].QueueHandle, OS_NORMAL, OS_SUSPEND, Msg ); + } + else +#endif + { + /* if on tool side or sending via TST -> send with sys header a.s.o */ + rt_ExtPrimitive ( SndTaskHandle, pEntry->NewDestComHandle, RcvComHandle, pEntry->ExtDest, &QData ); + } + } + if ( pEntry->Command & RT_REDIRECT ) + { + T_VOID_STRUCT *free_ptr = (T_VOID_STRUCT*)P2D(prim); + +#ifndef _TOOLS_ + if ((prim->opc & MEMHANDLE_OPC) && (mem!=NULL)) + { + if (P_MEMHANDLE(prim)!=0) + { + mem->dealloc(P_MEMHANDLE(prim)); + } + } +#endif /* !_TOOLS_ */ + + vsi_free ((T_VOID_STRUCT**)&free_ptr FILE_LINE_MACRO); + return RT_OK; + } + break; + default: + break; + } + } + } + pEntry = pEntry->pNextEntry; + } while ( pEntry ); + } + } + + /* + * send original + */ + +#ifdef _TOOLS_ + return ( (SHORT)os_SendToQueue ( SndTaskHandle, RcvComHandle, Prio, Suspend, Msg ) ); +#else + if((pf_TaskTable[RcvComHandle].Flags & USE_LEMU_QUEUE) AND + (lemu_SendToQueue_func.magic_nr == LEMU_SENDTOQUEUE_INITIALIZED)) + { + if(lemu_SendToQueue_func.plemu_SendToQueue( SndTaskHandle, RcvComHandle, + pf_TaskTable[RcvComHandle].QueueHandle, Prio, Suspend, Msg ) + != lemu_SendToQueue_func.ret_ok ) + { + return OS_ERROR; + } + return OS_OK; + } + else + { + return ( (SHORT)os_SendToQueue ( SndTaskHandle, pf_TaskTable[RcvComHandle].QueueHandle, Prio, Suspend, Msg ) ); + } +#endif +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_ExtPrimitive | ++--------------------------------------------------------------------+ + + PURPOSE : formats duplicated primitive to be sent to TST + +*/ +void rt_ExtPrimitive ( T_HANDLE TaskHandle, T_HANDLE DestComHandle, T_HANDLE OrgDestTaskHandle, char *ExtDest, OS_QDATA *Msg ) +{ +T_PRIM_HEADER *prim; +#ifndef _TOOLS_ +T_PRIM_HEADER *sdu_prim; +#endif /* not _TOOLS_ */ +T_PRIM_HEADER *ptr; +T_S_HEADER *s_hdr; +OS_QDATA DMsg; +ULONG AllocSize; +LONG Status; +ULONG suspend; +#ifdef _TOOLS_ +T_S_HEADER *prim_s_hdr; +unsigned int i; +#endif + + prim = (T_PRIM_HEADER*)Msg->ptr; +#ifdef _TOOLS_ + AllocSize = S_ALLOC_SIZE(Msg->len + 1); /* +1 To add LF in TIF */ +#else + if ( prim->dph_offset != 0 ) + { + T_DP_HEADER *dp_hdr; + + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + if ( dp_hdr->magic_nr != GUARD_PATTERN +#ifdef _TARGET_ + && route_desclist[TaskHandle] == TRUE +#endif + ) + { + rt_desclist_to_sdu ( TaskHandle, DestComHandle, prim, &sdu_prim ); + prim = sdu_prim; + } + } + + AllocSize = S_ALLOC_SIZE(4 + 1); /* only ptr to primitive */ +#endif /* _TOOLS_ */ + suspend = get_suspend_state(TaskHandle,CHECK_PRIM_SUSPEND); + Status = os_AllocatePartition ( TaskHandle, (T_VOID_STRUCT**)&ptr, AllocSize, suspend, TestGroupHandle ); + if ( Status == OS_OK || Status == OS_WAITED || Status == OS_ALLOCATED_BIGGER ) + { + DMsg.data16 = MSG_PRIMITIVE; + DMsg.data32 = Msg->data32; +#ifdef _TOOLS_ + DMsg.len = AllocSize; +#endif + DMsg.ptr = (T_VOID_STRUCT*)ptr; + + ptr->opc = prim->opc; + ptr->len = AllocSize; + ptr->sh_offset = S_HDR_OFFSET(AllocSize - sizeof(T_S_HEADER)); + s_hdr = (T_S_HEADER*)((ULONG*)ptr + ptr->sh_offset); +#ifdef _TOOLS_ + if ( prim->sh_offset == 0 ) + { + /* + if the primitive is sent via the TAP REDIRECT TAP ... mechanism, then the prim->sh_offset + is zero and the org_rcv is filled corresponding to the original addressed entity name. + */ + vsi_e_name ( TaskHandle, OrgDestTaskHandle, TaskName ); + strcpy (s_hdr->org_rcv, TaskName); + strcpy (s_hdr->rcv, ExtDest); + } + else + { + /* + if the primitive is sent via the TAP TPORT mechanism then the original receiver is already + filled by the TAP and copied to the newly allocated primitive to be routed. + */ + prim_s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); + + for (i = 0; prim_s_hdr->org_rcv[i] != 0 && i < sizeof (s_hdr->org_rcv)-1; i++) + s_hdr->org_rcv[i] = prim_s_hdr->org_rcv[i]; + for (i = 0; prim_s_hdr->rcv[i] != 0 && i < sizeof (s_hdr->rcv)-1; i++) + s_hdr->rcv[i] = prim_s_hdr->rcv[i]; + } + get_local_time (&s_hdr->time); + os_GetTaskName ( TaskHandle, TaskHandle, TaskName ); + strcpy (s_hdr->snd, TaskName); +#else + vsi_e_name ( TaskHandle, OrgDestTaskHandle, TaskName ); + strcpy (s_hdr->org_rcv, TaskName); + strcpy (s_hdr->rcv, ExtDest); + os_GetTime(TaskHandle,&s_hdr->time); + s_hdr->snd[0] = (char)(TaskHandle | HANDLE_BIT); +#endif +#ifdef _TOOLS_ + memcpy ( (char*)P2D(ptr), P2D(Msg->ptr), Msg->len ); +#else + ((T_PRIM_X*)(ptr))->prim_ptr = prim; +#endif + DMsg.e_id = DestComHandle; +#ifdef _TOOLS_ + os_SendToQueue ( TaskHandle, DestComHandle, OS_NORMAL, OS_SUSPEND, &DMsg ); +#else + if ((prim->opc & MEMHANDLE_OPC) && (mem!=NULL)) + { + if (P_MEMHANDLE_SDU(prim)==0x00000000) + { + /* copy MEM-handle content into new sdu */ + U8 *user_data; + U16 ptr_length; + user_data=mem->get_user_data(P_MEMHANDLE(prim), &ptr_length); + + if (user_data) + { + T_sdu *sdu=(T_sdu *)M_ALLOC(ptr_length+2*sizeof(U16)); + + sdu->l_buf=ptr_length*8; + sdu->o_buf=0; + memcpy(sdu->buf,user_data,ptr_length); + + P_MEMHANDLE_SDU(prim)=(U32)sdu; + } + } + else + { + M_ATTACH((void*)P_MEMHANDLE_SDU(prim)); + } + } + + if ( PrimAborted[TaskHandle] > 0 ) + { + if ( vsi_o_ttrace ( 0, TC_SYSTEM, "%d %s primitive routings aborted",PrimAborted[TaskHandle], pf_TaskTable[TaskHandle].Name ) == VSI_OK ) + PrimAborted[TaskHandle] = 0; + } + if ( os_SendToQueue ( TaskHandle, pf_TaskTable[DestComHandle].QueueHandle, OS_NORMAL, suspend, &DMsg ) == OS_TIMEOUT ) + { + T_VOID_STRUCT *free_ptr = (T_VOID_STRUCT*)P2D(prim); + vsi_free ((T_VOID_STRUCT**)&free_ptr FILE_LINE_MACRO); + vsi_trc_free (0, (T_VOID_STRUCT**)&ptr); + PrimAborted[TaskHandle]++; + } +#endif + } + else + { + T_VOID_STRUCT *free_ptr = (T_VOID_STRUCT*)P2D(prim); + vsi_free ((T_VOID_STRUCT**)&free_ptr FILE_LINE_MACRO); + PrimAborted[TaskHandle]++; + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-PS (6147) MODULE : PF_ROUTE | +| STATE : code ROUTINE : rt_desclist_to_sdu | ++--------------------------------------------------------------------+ + + PURPOSE : formats duplicated primitive with descriptor list into a + primitive with SDU + +*/ +int rt_desclist_to_sdu ( T_HANDLE caller, T_HANDLE dst, T_PRIM_HEADER *prim, T_PRIM_HEADER **sdu_prim ) +{ +T_PRIM_HEADER *ptr; +T_DP_HEADER *dp_hdr; +T_M_HEADER *m_hdr; +T_desc3 *desc3; +T_desc2 *desc2; +T_desc *desc; +int len = 0; +int sdu_prim_size = 0; +char *fill_ptr; +USHORT *l_buf_ptr; +USHORT *o_buf_ptr; +char *sdu_data_ptr; +T_sdu *sdu = NULL; +unsigned int new_opc; +int desc_type = 0; + + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + /* primitive contains descriptor list */ + + /* + START OF NON GENERIC CODE + This code is for the phase 1 routing of primitives containing descriptor lists. + It is non-generic and depends on the primitive ids defined in SAP docs. + It should be removed as soon as the generic descriptor list routing is ready + */ + switch ( prim->opc ) + { + case 0x7754: /* DTI2_DATA_IND */ + new_opc = 0x7755; /* DTI2_DATA_TEST_IND */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x3754: /* DTI2_DATA_REQ */ + new_opc = 0x3755; /* DTI2_DATA_TEST_REQ */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x6800: /* SN_DATA_IND */ + new_opc = 0x6806; /* SN_DATA_TEST_IND */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x2800: /* SN_DATA_REQ */ + new_opc = 0x2806; /* SN_DATA_TEST_REQ */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x6801: /* SN_UNITDATA_IND */ + new_opc = 0x6807; /* SN_DATA_TEST_IND */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x2801: /* SN_UNITDATA_REQ */ + new_opc = 0x2807; /* SN_DATA_TEST_REQ */ + desc_type = VSI_DESC_TYPE2 >> 16; + break; + case 0x7701: /* DTI_DATA_IND */ + new_opc = 0x7702; /* DTI_DATA_TEST_IND */ + desc_type = VSI_DESC_TYPE1 >> 16; + break; + case 0x3701: /* DTI_DATA_REQ */ + new_opc = 0x3702; /* DTI_DATA_TEST_REQ */ + desc_type = VSI_DESC_TYPE1 >> 16; + break; + case 0x80004097: /* GRLC_DATA_IND */ + new_opc = 0x80014097; /* GRLC_DATA_IND_TEST */ + desc_type = VSI_DESC_TYPE1 >> 16; + break; + case 0x80024097: /* GRLC_UNITDATA_IND */ + new_opc = 0x80034097; /* GRLC_UNITDATA_IND_TEST */ + desc_type = VSI_DESC_TYPE1 >> 16; + break; + default: + new_opc = prim->opc; + break; + } + /* END OF NON GENERIC CODE */ + + /* + it has to be distinguished between T_desc, T_desc2 and T_desc3 because to length information + is located at different places inside the structure + */ + m_hdr = (T_M_HEADER*)(((T_desc_list*)dp_hdr)->first) - 1; + if ( m_hdr->desc_type != 0 ) + { + desc_type = m_hdr->desc_type; + } + if ( desc_type == (VSI_DESC_TYPE2 >> 16) ) + { + desc2 = (T_desc2*)(((T_desc_list2*)dp_hdr)->first); + while (desc2 != NULL) + { + len = len + desc2->len; + desc2 = (T_desc2 *)desc2->next; + } + /* the size to be allocated for the primitive containing the sdu needs to be + root prim length + data length + sdu size minus data buffer - desc list2 size */ + sdu_prim_size = prim->len + len + sizeof(sdu->l_buf) + sizeof(sdu->o_buf) - sizeof(T_desc_list2); + } + else if ( desc_type == (VSI_DESC_TYPE1 >> 16) ) + { + desc = (T_desc*)(((T_desc_list*)dp_hdr)->first); + while (desc != NULL) + { + len = len + desc->len; + desc = (T_desc *)desc->next; + } + /* the size to be allocated for the primitive containing the sdu needs to be + root prim length + data length + sdu size minus data buffer - desc list size */ + sdu_prim_size = prim->len + len + sizeof(sdu->l_buf) + sizeof(sdu->o_buf) - sizeof(T_desc_list); + } + else if ( desc_type == (VSI_DESC_TYPE3 >> 16) ) + { + /* it is assumed that type 3 is valid if not 1 or 2 */ + desc3 = (T_desc3*)(((T_desc_list3*)dp_hdr)->first); + while (desc3 != NULL) + { + len = len + desc3->len; + desc3 = (T_desc3 *)desc3->next; + } + /* the size to be allocated for the primitive containing the sdu needs to be + root prim length + data length + sdu size minus data buffer - desc list3 size */ + sdu_prim_size = prim->len + len + sizeof(sdu->l_buf) + sizeof(sdu->o_buf) - sizeof(T_desc_list3); + } + else + { + vsi_o_ttrace ( 0, TC_SYSTEM, "unknown desc type in 0x%x, routing aborted", prim->opc ); + vsi_c_free ( caller, (T_VOID_STRUCT**)&prim FILE_LINE_MACRO ); + return RT_ERROR; + } + + if ( sdu_prim_size < (int)MaxPrimPartSize ) + { + ptr = (T_PRIM_HEADER*)vsi_c_new ( caller, sdu_prim_size, new_opc FILE_LINE_MACRO ); + } + else + { + vsi_o_ttrace ( 0, TC_SYSTEM, "desclist in 0x%x too long, routing aborted", prim->opc ); + vsi_c_free ( caller, (T_VOID_STRUCT**)&prim FILE_LINE_MACRO ); + return RT_ERROR; + } +#ifdef MEMORY_SUPERVISION + vsi_ppm_send ( caller, dst, (T_PRIM_HEADER*)ptr FILE_LINE_MACRO ); +#endif /* MEMORY_SUPERVISION */ + + fill_ptr = (char*)ptr; + l_buf_ptr = &((T_sdu*)((int*)fill_ptr + prim->dph_offset))->l_buf; + o_buf_ptr = &((T_sdu*)((int*)fill_ptr + prim->dph_offset))->o_buf; + sdu_data_ptr = (char*)&((T_sdu*)((int*)fill_ptr + prim->dph_offset))->buf; + + memcpy ( (char*)P2D(fill_ptr), (char*)P2D(prim), prim->len-sizeof(T_PRIM_HEADER) ); + + *l_buf_ptr = 0; + *o_buf_ptr = 0; + + fill_ptr = sdu_data_ptr; + + if ( desc_type == (VSI_DESC_TYPE2 >> 16) ) + { + desc2 = (T_desc2*)(((T_desc_list2*)dp_hdr)->first); + while (desc2 != NULL) + { + *l_buf_ptr += (desc2->len*8); + memcpy ( fill_ptr, (char*)(&desc2->buffer)+desc2->offset, desc2->len ); + fill_ptr += desc2->len; + desc2 = (T_desc2 *)desc2->next; + } + } + else if ( desc_type == (VSI_DESC_TYPE1 >> 16) ) + { + desc = (T_desc*)(((T_desc_list*)dp_hdr)->first); + while (desc != NULL) + { + *l_buf_ptr += (desc->len*8); + memcpy ( fill_ptr, (char*)(&desc->buffer), desc->len ); + fill_ptr += desc->len; + desc = (T_desc *)desc->next; + } + } + else if ( desc_type == (VSI_DESC_TYPE3 >>16) ) + { + desc3 = (T_desc3*)(((T_desc_list3*)dp_hdr)->first); + while (desc3 != NULL) + { + *l_buf_ptr += (desc3->len*8); + memcpy ( fill_ptr, (char*)(desc3->buffer)+desc3->offset, desc3->len ); + fill_ptr += desc3->len; + desc3 = (T_desc3 *)desc3->next; + } + } + vsi_c_free ( caller, (T_VOID_STRUCT**)&prim FILE_LINE_MACRO ); + *sdu_prim = ptr; + return RT_OK; +} +#endif + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/route.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,72 @@ +/* ++----------------------------------------------------------------------------- +| File: route.h ++----------------------------------------------------------------------------- +| 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 : Type definitions and prototypes for routing. ++----------------------------------------------------------------------------- +*/ + +#ifndef __ROUTE_H__ +#define __ROUTE_H__ + +#define RT_DUPLICATE 0x01 +#define RT_REDIRECT 0x02 +#define RT_DESTROY 0x04 +#define RT_COMMAND_MASK (RT_DUPLICATE|RT_REDIRECT|RT_DESTROY) + +#define RT_CLEAR_ENTRY 0x10 +#define RT_ALL_DESTINATION 0x20 + +typedef enum { RT_STORE = 1, RT_DELETE } RT_ENTRY; +typedef enum { RT_PRIMITIVE_TYPE = 1, RT_SIGNAL_TYPE, RT_TIMEOUT_TYPE } RT_MESSAGE_TYPE; + +typedef struct _T_ROUTING_ENTRY +{ + T_HANDLE SndTaskHandle; /* sender of a mesage */ + T_HANDLE OldDestComHandle; /* original destination queue handle */ + T_HANDLE OldDestTaskHandle;/* original destination task handle */ + T_HANDLE NewDestComHandle; /* new destination queue handle */ + RT_MESSAGE_TYPE MsgType; /* message type (primitive,timeout,signal) */ + ULONG opcStatus; /* mask for messages to be routed */ + ULONG opcMask; /* relevant bits in opcStatus */ + int Command; /* redirect/duplicate */ + char ExtDest[RESOURCE_NAMELEN]; + struct _T_ROUTING_ENTRY * pNextEntry; + struct _T_ROUTING_ENTRY * pPrevEntry; +} T_FRM_ROUTING_TABLE_ENTRY; + +#define RT_OK 0 +#define RT_ERROR (-1) +#define RT_NO_MEM (-2) + +#define ROUTE_ALL (T_HANDLE)0xFFFF + +#define RT_CLEAR_TOKEN "CLEAR" +#define RT_ALL_TOKEN "ALL" + +#define RT_SIGNAL_TOKEN "S" +#define RT_TIMEOUT_TOKEN "T" + +GLOBAL SHORT rt_Init (void); +GLOBAL SHORT rt_RoutingModify ( T_HANDLE TaskHandle, char *Command, char *String); +GLOBAL SHORT rt_ConnectRoute ( T_HANDLE TaskHandle, char *Destination); +GLOBAL SHORT rt_DisconnectRoute ( T_HANDLE TaskHandle, char *Destination); +GLOBAL SHORT rt_Route ( T_HANDLE SndTaskHandle, T_HANDLE RcvComHandle, USHORT Prio, ULONG Suspend, OS_QDATA *Msg ); +GLOBAL SHORT rt_RouteRead ( T_HANDLE TaskHandle, char *token ); +GLOBAL void rt_ExtPrimitive ( T_HANDLE TaskHandle, T_HANDLE DestComHandle, T_HANDLE OrgDestComHandle, char *ExtDest, OS_QDATA *Msg ) ; +GLOBAL SHORT rt_isolate_entity ( T_HANDLE caller, char *entity ); +GLOBAL int rt_desclist_to_sdu ( T_HANDLE caller, T_HANDLE dst, T_PRIM_HEADER *prim, T_PRIM_HEADER **sdu_prim ); + + +#endif /* ROUTE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_com.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,2295 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_com.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| about communication via primitives and signals. ++----------------------------------------------------------------------------- +*/ + +#undef TEST_PCHECK + +#ifndef __VSI_COM_C__ +#define __VSI_COM_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "typedefs.h" +#include "string.h" +#include "os.h" +#include "vsi.h" +#include "frame.h" +#include "vsi.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "route.h" + +#ifdef MEMORY_SUPERVISION + #include "tools.h" +#endif + +#ifdef _TOOLS_ + #include "stdlib.h" +#endif + +/*==== CONSTANTS ==================================================*/ + +#ifndef RUN_INT_RAM +char const *waited_queue_str= "Waited for space in queue"; +char const *freed_sent_str = "Freed partition sent"; +char const *disc_str = "Signal discarded"; +char const *freed_str = "Partition already freed"; +char const *trunc_str = "Allocation request truncated"; +char const *guard_str = "Partition guard pattern destroyed"; +char const *unknown_str = "unknown"; +#else +extern char const *waited_queue_str; +extern char const *freed_sent_str; +extern char const *disc_str; +extern char const *freed_str; +extern char const *trunc_str; +extern char const *guard_str; +extern char const *unknown_str; +#endif + +#if !defined _TARGET_ && !defined _TOOLS_ +char const *pcheck_str = "pcon_check() returned error"; +#define PCHECK_INITIALIZED 0xaffedead +#endif + + +#define MAX_DRP_BOUND 12 + +/*==== TYPES ======================================================*/ + +#if !defined _TARGET_ && !defined _TOOLS_ +typedef struct +{ + unsigned int magic_nr; + ULONG ret_ok; + ULONG (*pcheck)(ULONG opc, void * decoded_prim); +} T_PCHECK; +#endif + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + + +#ifdef _TOOLS_ + extern char FRM_TST_NAME[]; + __declspec (dllimport) T_HANDLE TST_Handle; +#else + extern T_HANDLE TST_Handle; +#endif + +extern T_HANDLE vsi_m_sem_handle; +extern char TaskName []; +//extern OS_HANDLE ext_data_pool_handle; +#if defined _NUCLEUS_ && defined NU_DEBUG + extern char check_desclist; +#endif + +/*==== VARIABLES ==================================================*/ + +#if !defined _TARGET_ && !defined _TOOLS_ +T_PCHECK pcheck_func; +#endif /* _TARGET_ */ + +#ifndef RUN_INT_RAM +char QueueName [ RESOURCE_NAMELEN ]; +//char *pf_com_matrix = NULL; +#else +extern char QueueName []; +#endif + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== PROTOTYPES =================================================*/ + +#if !defined _TARGET_ && !defined _TOOLS_ +#ifdef TEST_PCHECK +ULONG test_pcheck ( ULONG opc, void * decoded_prim ); +#endif +#endif /* _TARGET_ */ + + +#if defined _NUCLEUS_ && defined NU_DEBUG + int check_descriptor_list ( T_HANDLE caller, T_PRIM_HEADER *prim FILE_LINE_TYPE ); +#endif + +int int_vsi_c_pattach (T_VOID_STRUCT *prim FILE_LINE_TYPE); + + +/*==== FUNCTIONS ==================================================*/ + +#if 0 + not needed -> temporarily removed +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_open | ++--------------------------------------------------------------------+ + + PURPOSE : get the handle of a queue + +*/ + +char * vsi_c_init_com_matrix ( int max_entities ) +{ +int size; + + size = (max_entities+1)*(max_entities+1); + if ( os_AllocateMemory ( NO_TASK, (T_VOID_STRUCT**)&pf_com_matrix, size, OS_NO_SUSPEND, ext_data_pool_handle ) != OS_OK ) + { + vsi_o_assert ( NO_TASK, OS_SYST_ERR_NO_MEMORY, __FILE__, __LINE__, "No memory available for com matrix"); + } + return pf_com_matrix; +} +#endif + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_get_com_matrix_entry| ++--------------------------------------------------------------------------+ + + PURPOSE : get an entry of the com matrix + +*/ + +int vsi_c_get_com_matrix_entry ( int entry, char *dst ) +{ +T_HANDLE snd, rcv; +static int cnt; +int size_of_matrix = (MaxEntities+1)*(MaxEntities+1); +int snd_len; + + if ( entry == FIRST_ENTRY ) + { + cnt = 0; + } + while ( cnt <= size_of_matrix ) + { + if ( pf_com_matrix[cnt] != 0 ) + { + snd = cnt/(MaxEntities+1); + vsi_e_name (NO_TASK, snd, &dst[0]); + snd_len = strlen(&dst[0]); + dst[snd_len]=' '; + rcv = cnt%(MaxEntities+1); + vsi_e_name (NO_TASK, rcv, &dst[snd_len+1]); + cnt++; + return VSI_OK; + } + cnt++; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_get_entity_com_entry| ++--------------------------------------------------------------------------+ + + PURPOSE : get a entity handle the is used by an entity to send primitives + +*/ + +int vsi_c_get_entity_com_entry ( int entry, T_HANDLE rcv, T_HANDLE *snd ) +{ +static int cnt; +int size_of_matrix = (MaxEntities+1)*(MaxEntities+1); + + if ( entry == FIRST_ENTRY ) + { + cnt = rcv; + } + while ( cnt <= size_of_matrix ) + { + if ( pf_com_matrix[cnt] != 0 ) + { + *snd = cnt / (MaxEntities + 1); + cnt = cnt + MaxEntities + 1; + return VSI_OK; + } + cnt = cnt + MaxEntities + 1; + } + return VSI_ERROR; +} +#endif +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_open | ++--------------------------------------------------------------------+ + + PURPOSE : get the handle of a queue + +*/ + +T_HANDLE vsi_c_open (T_HANDLE Caller, char *Name) +{ +#ifdef _TOOLS_ +OS_HANDLE ComHandle; + + if ( os_OpenQueue ( Caller, Name, &ComHandle ) != OS_ERROR ) + return ComHandle; +#else +T_HANDLE e_handle; + + for ( e_handle = MaxEntities; e_handle > 0; e_handle-- ) + { + if ( pf_TaskTable[e_handle].Name[0] != 0 + && pf_TaskTable[e_handle].QueueHandle != 0 + && !strncmp (pf_TaskTable[e_handle].Name, Name, RESOURCE_NAMELEN-1) ) + { + /* + not needed -> temporarily removed + pf_com_matrix[Caller*(MaxEntities+1)+e_handle] = 1; + */ + return e_handle; + } + } +#endif + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_close | ++--------------------------------------------------------------------+ + + PURPOSE : return the handle of a queue + +*/ + +int vsi_c_close (T_HANDLE Caller, T_HANDLE ComHandle) +{ + + if ( os_CloseQueue ( Caller, ComHandle ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_clear | ++--------------------------------------------------------------------+ + + PURPOSE : read all messages from a queue + +*/ + +int vsi_c_clear (T_HANDLE Caller, T_HANDLE ComHandle) +{ +OS_QDATA Msg; + + while ( os_ReceiveFromQueue ( NO_TASK, ComHandle, &Msg, OS_NO_SUSPEND ) == OS_OK ) + { + ; + } + + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_send | ++--------------------------------------------------------------------+ + + PURPOSE : write a message to a queue + +*/ + +int vsi_c_send (T_HANDLE Caller, T_HANDLE ComHandle, T_QMSG *Msg FILE_LINE_TYPE) +{ +OS_QDATA OS_Msg = { 0 }; +LONG Status; +USHORT Prio; +#ifdef NU_DEBUG +T_PRIM_HEADER *prim; + #ifdef _TARGET_ + T_HANDLE t_handle; + #endif +#endif + + OS_Msg.data16 = Msg->MsgType; + OS_Msg.e_id = ComHandle; + switch ( Msg->MsgType ) + { + case MSG_PRIMITIVE: + OS_Msg.ptr = Msg->Msg.Primitive.Prim; + OS_Msg.data32 = P_OPC(Msg->Msg.Primitive.Prim); +#ifdef _TOOLS_ + OS_Msg.len = Msg->Msg.Primitive.PrimLen; +#endif + os_GetTime ( 0, &OS_Msg.time ); + Prio = MSG_PRIMITIVE_PRIO; + break; + case MSG_SIGNAL: + OS_Msg.ptr = Msg->Msg.Signal.SigBuffer; + OS_Msg.data32 = Msg->Msg.Signal.SigOPC; +#ifdef _TOOLS_ + OS_Msg.len = Msg->Msg.Signal.SigLen; +#endif + os_GetTime ( 0, &OS_Msg.time ); + Prio = MSG_SIGNAL_PRIO; + break; + default: return VSI_ERROR; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + } + +#ifdef _NUCLEUS_ +#ifdef NU_DEBUG + /* PARTITION GUARD PATTERN CHECK */ + if ( Msg->MsgType == MSG_PRIMITIVE ) + { + prim = (T_PRIM_HEADER*)Msg->Msg.Primitive.Prim; + if ( (Status = os_PartitionCheck ( (T_VOID_STRUCT*)prim )) == OS_OK ) + { + if ( check_desclist == TRUE && prim->dph_offset != 0 ) + { + check_descriptor_list ( Caller, prim FILE_LINE ); + } + } + else + { + switch ( Status ) + { + case OS_PARTITION_FREE: + vsi_o_assert ( Caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "%s (PSEND),entity %s, partition 0x%x, opc 0x%x", + freed_sent_str, pf_TaskTable[Caller].Name, prim, prim->opc ); + break; + case OS_PARTITION_GUARD_PATTERN_DESTROYED: + vsi_o_assert ( Caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "%s (PSEND), entity %s, partition 0x%x, opc 0x%x", + guard_str, pf_TaskTable[Caller].Name, prim, prim->opc ); + break; + default: + break; + } + } +#ifdef MEMORY_SUPERVISION + vsi_ppm_send ( Caller, ComHandle, (T_PRIM_HEADER*)Msg->Msg.Primitive.Prim, file, line ); +#endif /* MEMORY_SUPERVISION */ + } +#ifdef _TARGET_ + if ( (t_handle = os_MyHandle()) != 0 ) + { + int opc; + switch ( os_CheckTaskStack ( t_handle ) ) + { + case OS_ERROR: + if ( Msg->MsgType == MSG_PRIMITIVE ) + { + opc = ((T_PRIM_HEADER*)Msg->Msg.Primitive.Prim)->opc; + } + else + { + opc = Msg->Msg.Signal.SigOPC; + } + vsi_o_assert ( Caller, OS_SYST_ERR_STACK_OVERFLOW FILE_LINE_MACRO_PASSED, + "%s Stack overflow, 0x%x", pf_TaskTable[Caller].Name, opc ); + break; + default: + break; + } + } +#endif /* _TARGET_ */ +#endif /* NU_DEBUG */ +#endif /* _NUCLEUS_ */ + + Status = rt_Route ( Caller, ComHandle, Prio, OS_SUSPEND, &OS_Msg ); + + switch ( Status ) + { + case OS_WAITED: +#ifdef NU_DEBUG + pf_handle_warning ( OS_SYST_WRN_WAIT_QUEUE, "%s %s, entity %s, queue %s, %s(%d)", + syst_wrn, waited_queue_str, pf_TaskTable[Caller].Name, pf_TaskTable[ComHandle].Name FILE_LINE_MACRO_PASSED ); +#endif + return VSI_OK; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + case OS_TIMEOUT: + case OS_ERROR: + case OS_INVALID_QUEUE: + Caller = e_running[os_MyHandle()]; + if ( Msg->MsgType == MSG_SIGNAL ) + { +#ifdef NU_DEBUG + pf_handle_warning ( OS_SYST_WRN_WAIT_QUEUE, "%s %s from %s to %s, opc 0x%x, %s(%d)", + syst_wrn, disc_str, pf_TaskTable[Caller].Name, pf_TaskTable[ComHandle].Name, Msg->Msg.Signal.SigOPC FILE_LINE_MACRO_PASSED ); +#endif + return VSI_OK; + } + else + { + char const *p_queue_name; + if ( Status == OS_INVALID_QUEUE ) + { + p_queue_name = unknown_str; + } + else + { +#ifdef _TOOLS_ + os_GetQueueName ( Caller, ComHandle, QueueName ); + p_queue_name = QueueName; +#else + p_queue_name = pf_TaskTable[ComHandle].Name; +#endif + } + vsi_o_assert ( Caller, OS_SYST_ERR_QUEUE_FULL FILE_LINE_MACRO_PASSED, + "%s write attempt to %s queue failed", + pf_TaskTable[Caller].Name, p_queue_name ); +#ifdef MEMORY_SUPERVISION + vsi_ppm_free ( Caller, (T_PRIM_HEADER*)(OS_Msg.ptr-PPM_OFFSET), file, line); +#endif + os_DeallocatePartition (Caller, OS_Msg.ptr-PPM_OFFSET ); + return VSI_ERROR; + } + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + case OS_OK: + return VSI_OK; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + default: + return VSI_ERROR; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + } + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_psend | ++--------------------------------------------------------------------+ + + PURPOSE : wrapper for vsi_c_send to avoid code wasting macro + +*/ +int vsi_c_psend_caller ( T_HANDLE Caller, T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE ) +{ +T_QMSG QMsg; +T_VOID_STRUCT *snd_ptr = (T_VOID_STRUCT*)D2P(ptr); + + QMsg.Msg.Primitive.Prim = snd_ptr; +#ifdef _TOOLS_ + if ( ((T_PRIM_HEADER*)snd_ptr)->sh_offset != 0 ) + QMsg.Msg.Primitive.PrimLen = ALIGN(PSIZE(ptr)) + sizeof(T_S_HEADER); + else +#endif + QMsg.Msg.Primitive.PrimLen = PSIZE(ptr); + QMsg.MsgType = MSG_PRIMITIVE; + if ( Caller != TST_Handle && !(P_OPC(QMsg.Msg.Primitive.Prim) & SYS_MASK ) ) + vsi_o_ptrace (Caller, P_OPC(QMsg.Msg.Primitive.Prim), 1); + +#if !defined _TARGET_ && !defined _TOOLS_ + if ( (pcheck_active[Caller] == 1) && (pcheck_func.pcheck != NULL) ) + { + ULONG ret; + if ( (ret = pcheck_func.pcheck ( D_OPC(ptr), ptr )) != pcheck_func.ret_ok ) + { + pf_handle_warning ( OS_SYST_WRN, "%s %s %d in %s, opc 0x%x, %s(%d)", + syst_wrn, pcheck_str, ret, pf_TaskTable[Caller].Name, D_OPC(ptr) FILE_LINE_MACRO_PASSED ); + } + } +#endif + return ( vsi_c_send ( Caller, ComHandle, &QMsg FILE_LINE) ); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_psend | ++--------------------------------------------------------------------+ + + PURPOSE : wrapper for vsi_c_send to avoid code wasting macro + +*/ +int vsi_c_psend ( T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE ) +{ +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + return ( vsi_c_psend_caller ( Caller, ComHandle, ptr FILE_LINE) ); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_ssend | ++--------------------------------------------------------------------+ + + PURPOSE : wrapper for vsi_c_send to avoid code wasting macro + +*/ +int vsi_c_ssend ( T_HANDLE ComHandle, ULONG opc, T_VOID_STRUCT *ptr, + ULONG MsgLen FILE_LINE_TYPE ) +{ +T_QMSG QMsg; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + QMsg.Msg.Signal.SigBuffer = (T_VOID_STRUCT*)ptr; + QMsg.Msg.Signal.SigOPC = opc; + QMsg.Msg.Signal.SigLen = MsgLen; + QMsg.MsgType = MSG_SIGNAL; + + return ( vsi_c_send ( Caller, ComHandle, &QMsg FILE_LINE ) ); + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a partition to send a primitive + +*/ + +T_VOID_STRUCT * vsi_c_new (T_HANDLE Caller, ULONG Size, ULONG opc FILE_LINE_TYPE) +{ +T_VOID_STRUCT *prim; +ULONG flags; + + /* VSI_MEM_NON_BLOCKING not set, blocking allocation for backwards compatibility */ + flags = PrimGroupHandle; + prim = (T_VOID_STRUCT*)D2P(vsi_c_pnew_generic (Caller, Size, opc, flags FILE_LINE)); + return prim; + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a partition to send a primitive + +*/ + +T_VOID_STRUCT * vsi_c_pnew_generic (T_HANDLE Caller, ULONG Size, ULONG opc, ULONG flags FILE_LINE_TYPE) +{ +T_VOID_STRUCT *prim; + + if ( Size < sizeof(T_PRIM_HEADER) ) + Size = sizeof(T_PRIM_HEADER); + + if ( (prim = vsi_m_new ( Size, flags FILE_LINE )) != NULL ) + { + P_OPC(prim) = opc; + P_LEN(prim) = Size; + P_SDU(prim) = NULL; + P_CNT(prim) = 1; + P_SHO(prim) = 0; + P_DPHO(prim) = 0; +#ifdef MEMORY_SUPERVISION + Caller = e_running[os_MyHandle()]; + vsi_ppm_new ( Caller, Size, (T_PRIM_HEADER*)prim, file, line ); +#endif + +#ifndef _TOOLS_ + if (opc & MEMHANDLE_OPC) + { + P_MEMHANDLE_SDU(prim)=0x00000000; + } +#endif + + return (T_VOID_STRUCT*)P2D(prim); + } + return NULL; + +} +#endif +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pnew | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a partition to send a primitive + +*/ + +T_VOID_STRUCT * vsi_c_pnew (ULONG Size, ULONG opc FILE_LINE_TYPE) +{ +T_HANDLE Caller; + + Caller = 0; + + Size += sizeof(T_PRIM_HEADER); + + return ( (T_VOID_STRUCT*)vsi_c_pnew_generic ( Caller, Size, opc, PrimGroupHandle FILE_LINE )); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pnew | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a partition to send a primitive + +*/ + +T_VOID_STRUCT * vsi_c_pnew_nb (ULONG Size, ULONG opc FILE_LINE_TYPE) +{ +T_HANDLE Caller; + + Caller = 0; + + Size += sizeof(T_PRIM_HEADER); + + return ( (T_VOID_STRUCT*)vsi_c_pnew_generic ( Caller, Size, opc, VSI_MEM_NON_BLOCKING|PrimGroupHandle FILE_LINE )); +} +#endif + +#ifndef RUN_FLASH +/* ++---------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_new_sdu_generic| ++---------------------------------------------------------------------+ + + PURPOSE : allow pool selection and flags for blocking bahavior + +*/ +T_VOID_STRUCT * vsi_c_new_sdu_generic (ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset, ULONG flags FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +ULONG alloc_size; +T_HANDLE Caller; + + Caller = 0; + alloc_size = Size + sizeof(T_PRIM_HEADER) + BYTELEN((SHORT)sdu_len + (SHORT)encode_offset); + if ( (prim = (T_PRIM_HEADER*)vsi_c_pnew_generic (Caller, alloc_size, opc, flags FILE_LINE)) != NULL ) + { + D_SDU(prim) = (T_sdu*)(((char*)prim) + sdu_offset); + D_SDU_LEN(prim) = sdu_len; + D_SDU_OFF(prim) = encode_offset; + return ( (T_VOID_STRUCT*)prim ); + } + else + { + return NULL; + } +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_new_sdu | ++--------------------------------------------------------------------+ + + PURPOSE : wrapper for vsi_c_new to avoid code wasting macro + +*/ +T_VOID_STRUCT * vsi_c_new_sdu (ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset FILE_LINE_TYPE ) +{ +ULONG flags; + + flags = PrimGroupHandle; + + return vsi_c_new_sdu_generic (Size, opc, sdu_len, sdu_offset, encode_offset, flags FILE_LINE); +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_ppass | ++--------------------------------------------------------------------+ + + PURPOSE : pass a partition from one primitive to another + +*/ +T_VOID_STRUCT * vsi_c_ppass (T_VOID_STRUCT *prim, ULONG opc FILE_LINE_TYPE ) +{ +T_VOID_STRUCT *ptr; +ULONG len; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + if ( D_CNT(prim) > 1 ) + { + /* + * This does not work for dynamic primitive containing pointers, PDUP needed !!!! + * The sdu pointer is currently not set correctly because it is never used !!! + */ + len = D_LEN(prim); + ptr = vsi_c_pnew ( len, opc FILE_LINE ); + memcpy ( ptr, prim, len - sizeof(T_PRIM_HEADER) ); +#ifdef PRIM_AUTO_FREE + if ( !(pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE) ) +#endif + vsi_c_pfree ( &prim FILE_LINE ); + return ptr; + } + else + { + D_OPC(prim) = opc; +#ifdef PRIM_AUTO_FREE + if ( pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + { + D_CNT(prim)++; + } +#endif +#ifdef MEMORY_SUPERVISION + vsi_ppm_reuse ( Caller, D2P(prim), file, line); +#endif + return prim; + } + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pstore | ++--------------------------------------------------------------------+ + + PURPOSE : store a partition (increment the reference counter) + consider PARTITION_AUTO_FREE + +*/ +void vsi_c_pstore ( T_VOID_STRUCT *prim FILE_LINE_TYPE ) +{ +#ifdef PRIM_AUTO_FREE +T_PRIM_HEADER *ptr; +T_DP_HEADER *dp_hdr; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + if ( pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + { + ptr = D2P(prim); + /* take control -> enable entity to free the prim */ + processed_prim[Caller] = NULL; + /* increment reference counter */ + D_CNT(prim)++; +#ifdef MEMORY_SUPERVISION + vsi_ppm_store ( Caller, ptr, file, line ); +#endif + if ( P_DPHO(ptr) != 0 ) + { + dp_hdr = (T_DP_HEADER*)((ULONG*)ptr + ptr->dph_offset); + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + while ( (ptr = (T_PRIM_HEADER*)dp_hdr) != NULL ) + { +#ifdef MEMORY_SUPERVISION + vsi_ppm_store ( Caller, ptr, file, line ); +#endif + P_CNT(ptr)++; + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + vsi_o_assert ( Caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Magic number in dp_header destroyed (PSTORE) %s , opc: 0x%lx, partition 0x%lx", + pf_TaskTable[Caller].Name, ptr->opc, ptr ); + } + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } + } + } +#endif /* PRIM_AUTO_FREE */ +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pattach | ++--------------------------------------------------------------------+ + + PURPOSE : call internal function to store a partition (increment the reference counter) + +*/ +int vsi_c_pattach ( T_VOID_STRUCT *prim FILE_LINE_TYPE ) +{ +T_HANDLE Caller = 0; +LONG sts; +int ret; + + sts = os_ObtainSemaphore (Caller, vsi_m_sem_handle, OS_SUSPEND); + if ( sts == OS_ERROR || sts == OS_TIMEOUT ) + { + /* Semaphore invalid or overrun */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[Caller].Name ); + } + + ret=int_vsi_c_pattach(prim FILE_LINE_MACRO); + + os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + + return ret; +} + +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : int_vsi_c_pattach | ++--------------------------------------------------------------------+ + + PURPOSE : actually store a partition (increment the reference counter) + +*/ +int int_vsi_c_pattach ( T_VOID_STRUCT *prim FILE_LINE_TYPE) +{ +T_PRIM_HEADER *ptr; +T_DP_HEADER *dp_hdr; +T_HANDLE Caller = 0; +int pos; + + ptr = D2P(prim); + +#ifdef NU_DEBUG + if ( os_is_valid_partition ((T_VOID_STRUCT*)ptr) ) + { + /* attach to non-partition memory */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "PATTACH to non-partition memory, entity %s, ptr 0x%x", pf_TaskTable[Caller].Name, ptr ); + } +#endif + + if ( ptr->use_cnt <= 0 ) + { + /* attach to non allocated memory */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "PATTACH to free memory, entity %s, ptr 0x%x", pf_TaskTable[Caller].Name, ptr ); + } + + dp_hdr=NULL; + + /* check if we have a primitive pointer */ + if ( ((T_DP_HEADER*)ptr)->magic_nr != GUARD_PATTERN ) + { + /* increment reference counter */ + P_CNT(ptr)++; + #ifdef MEMORY_SUPERVISION + vsi_ppm_store ( Caller, ptr, file, line ); + #endif + + /* look for dynamic partition header */ + if ( P_DPHO(ptr) != 0 ) + { + dp_hdr = (T_DP_HEADER*)((ULONG*)ptr + ptr->dph_offset); + if (dp_hdr->drp_bound_list) + { + /* call attach for bound root pointers */ + pos=0; + while(pos<MAX_DRP_BOUND && dp_hdr->drp_bound_list[pos]) + { + int_vsi_c_pattach(dp_hdr->drp_bound_list[pos] FILE_LINE_MACRO); + pos++; + } + } + + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } + } + else + { + dp_hdr=(T_DP_HEADER*)ptr; + } + + if ( dp_hdr ) + { + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + /* primitive with T_desc_list element, use MATTACH */ + os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + return VSI_OK; + } + else + { + while ( (ptr = (T_PRIM_HEADER*)dp_hdr) != NULL ) + { +#ifdef MEMORY_SUPERVISION + vsi_ppm_store ( Caller, ptr, file, line ); +#endif + P_CNT(ptr)++; + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + vsi_o_assert ( Caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Magic number in dp_header destroyed (PATTACH), %s, opc: 0x%lx, partition 0x%lx", + pf_TaskTable[Caller].Name, ptr->opc, ptr ); + } + + if (dp_hdr->drp_bound_list) + { + /* call attach for bound root pointers */ + pos=0; + while(pos<MAX_DRP_BOUND && dp_hdr->drp_bound_list[pos]) + { + int_vsi_c_pattach(dp_hdr->drp_bound_list[pos] FILE_LINE_MACRO); + pos++; + } + } + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_reuse | ++--------------------------------------------------------------------+ + + PURPOSE : function to avoid code wasting macro + +*/ +T_VOID_STRUCT *vsi_c_reuse ( T_PRIM_HEADER *ptr, ULONG Size, ULONG opc, + USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset FILE_LINE_TYPE ) +{ +T_HANDLE Caller; + + D_OPC(ptr) = opc; + D_LEN(ptr) = Size; + if ( sdu_offset != NO_SDU ) + { + D_SDU(ptr) = (T_sdu*)((char*)(ptr) + sdu_offset); + D_SDU_LEN(ptr) = sdu_len; + D_SDU_OFF(ptr) = encode_offset; + } + else + D_SDU(ptr) = NULL; + + Caller = e_running[os_MyHandle()]; +#ifdef MEMORY_SUPERVISION + vsi_ppm_reuse ( Caller, D2P(ptr), file, line); +#endif +#ifdef PRIM_AUTO_FREE + if ( pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + { + D_CNT(ptr)++; + } +#endif + return ( (T_VOID_STRUCT*)ptr ); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_free | ++--------------------------------------------------------------------+ + + PURPOSE : deallocate a partition that was used to send a primitive + +*/ + +int vsi_c_free (T_HANDLE Caller, T_VOID_STRUCT **Msg FILE_LINE_TYPE) +{ +static T_VOID_STRUCT *protected_prim_to_free = NULL; +#if defined (NU_DEBUG) || defined (OSL_DEBUG) +LONG count; +#endif + +//LONG sts; + +#if 0 + sts = os_ObtainSemaphore (Caller, vsi_m_sem_handle, OS_SUSPEND); + if ( sts == OS_ERROR || sts == OS_TIMEOUT ) + { + /* Semaphore invalid or overrun */ + if ( *Msg == protected_prim_to_free ) + { + /* fatal error only if semaphore overrun on same primitive */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[Caller].Name ); + return VSI_ERROR; + } + } + else +#endif + { + protected_prim_to_free = *Msg; + } +#if defined (NU_DEBUG) || defined (OSL_DEBUG) + count = (LONG)((T_PRIM_HEADER*)*Msg)->use_cnt; + if ( count <= 0 ) + { + pf_handle_warning ( OS_SYST_WRN_MULTIPLE_FREE, "%s %s in %s, 0x%x, %s(%d)", + syst_wrn, freed_str, pf_TaskTable[Caller].Name, P_OPC(*Msg) FILE_LINE_MACRO_PASSED ); + protected_prim_to_free = NULL; + // os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + return VSI_OK; + } +#endif + if ( --((T_PRIM_HEADER*)*Msg)->use_cnt == 0 ) + { +#ifdef PRIM_AUTO_FREE + if ( pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + freed_prim[Caller] = *Msg; +#endif +#ifdef _NUCLEUS_ +#ifdef NU_DEBUG + + if ( os_PartitionCheck( (ULONG*)*Msg ) == OS_PARTITION_GUARD_PATTERN_DESTROYED ) + { +// os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + vsi_o_assert ( Caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "%s (PFREE), entity %s,Partition 0x%x", + guard_str, pf_TaskTable[Caller].Name, *Msg ); + return VSI_ERROR; + } +#endif +#endif + protected_prim_to_free = NULL; +// os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + return ( vsi_m_free ( Msg FILE_LINE ) ); + } + + protected_prim_to_free = NULL; +// os_ReleaseSemaphore (Caller, vsi_m_sem_handle); + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pfree | ++--------------------------------------------------------------------+ + + PURPOSE : deallocate a partition that was used to send a primitive + +*/ + +int vsi_c_pfree (T_VOID_STRUCT **Msg FILE_LINE_TYPE) +{ +T_VOID_STRUCT *free_ptr; +T_HANDLE Caller; + + /* + * PFREE is disabled if the primitive to be freed is the currently + * processed one and the auto free is enabled for the calling entity + */ + + Caller = e_running[os_MyHandle()]; + free_ptr = (T_VOID_STRUCT*)D2P(*Msg); +#ifdef NU_DEBUG + if ( os_is_valid_partition ((T_VOID_STRUCT*)free_ptr) ) + { + /* free to non-partition memory */ + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "PFREE to non-partition memory, entity %s, prim 0x%x", pf_TaskTable[Caller].Name, *Msg ); + } +#endif +#ifdef PRIM_AUTO_FREE + if ( free_ptr == processed_prim[Caller] && pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + { + return VSI_OK; + } +#endif /* PRIM_AUTO_FREE */ + return ( vsi_c_free ( Caller, &free_ptr FILE_LINE ) ); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_await | ++--------------------------------------------------------------------+ + + PURPOSE : receive a primitive + +*/ + +int vsi_c_await (T_HANDLE Caller, T_HANDLE ComHandle, T_QMSG *Msg, ULONG Timeout) +{ +OS_QDATA OS_Msg; +LONG ret; +OS_HANDLE q_handle; + + +#ifdef _TOOLS_ + q_handle = ComHandle; +#else + q_handle = pf_TaskTable[ComHandle].QueueHandle; +#endif + e_running[os_MyHandle()] = 0; + + if ( (ret = os_ReceiveFromQueue ( Caller, q_handle, &OS_Msg, Timeout)) == OS_OK ) + { + Msg->MsgType = OS_Msg.data16; + switch ( Msg->MsgType ) + { + case MSG_PRIMITIVE: + Msg->Msg.Primitive.Prim = OS_Msg.ptr; +#ifdef _TOOLS_ + Msg->Msg.Primitive.PrimLen = OS_Msg.len; +#endif + vsi_o_ptrace (Caller, ((T_PRIM_HEADER*)Msg->Msg.Primitive.Prim)->opc, 0); + break; + case MSG_SIGNAL: + Msg->Msg.Signal.SigBuffer = OS_Msg.ptr; + Msg->Msg.Signal.SigOPC = OS_Msg.data32; +#ifdef _TOOLS_ + Msg->Msg.Signal.SigLen = OS_Msg.len; +#endif + break; + case MSG_TIMEOUT: + if ( *(pf_TaskTable[Caller].FirstTimerEntry + OS_Msg.data32) & TIMEOUT_OCCURRED ) + { + if ( !(*(pf_TaskTable[Caller].FirstTimerEntry + OS_Msg.data32) & PERIODIC_TIMER) ) + { + os_DestroyTimer ( Caller, (OS_HANDLE)(*(pf_TaskTable[Caller].FirstTimerEntry + OS_Msg.data32) & TIMER_HANDLE_MASK) ); + *(pf_TaskTable[Caller].FirstTimerEntry + OS_Msg.data32) = 0; + } + else + { + *(pf_TaskTable[Caller].FirstTimerEntry + OS_Msg.data32) &= ~TIMEOUT_OCCURRED; + } + Msg->Msg.Timer.Index = OS_Msg.data32; + } + break; + default: return VSI_ERROR; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + } + e_running[os_MyHandle()] = Caller; + prf_log_entity_activate ((void*)Caller); + return VSI_OK; + } + else + { + if ( ret == OS_TIMEOUT ) + { + e_running[os_MyHandle()] = Caller; + return VSI_TIMEOUT; + } + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_primitive | ++--------------------------------------------------------------------+ + + PURPOSE : send a non GSM primitive to the frame + +*/ + +int vsi_c_primitive (T_HANDLE Caller, void *Msg) +{ + /* + * the following line of code causes a warning on tms470 compiler, that cannot be avoided + * without changing all entities PEI modules. Warning will not cause a problem + */ + pf_ProcessSystemPrim ( Caller, Msg ); + return VSI_OK; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_awake | ++--------------------------------------------------------------------+ + + PURPOSE : send NULL primitive to itself + +*/ +GLOBAL int vsi_c_awake ( T_HANDLE caller ) +{ +OS_QDATA QMsg = { 0 }; + + QMsg.data16 = MSG_PRIMITIVE; + QMsg.ptr = NULL; + os_SendToQueue ( caller, caller, OS_URGENT, OS_NO_SUSPEND, &QMsg ); + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_status | ++--------------------------------------------------------------------+ + + PURPOSE : allocate root of dynamic sized primitive + +*/ +int vsi_c_status (T_HANDLE handle, unsigned int *used, unsigned int *free) +{ +#ifdef _NUCLEUS_ +int status; + + if ( (status = os_GetQueueState (0, pf_TaskTable[handle].QueueHandle, (ULONG*)used, (ULONG*)free)) == OS_OK ) + return OS_OK; + else +#endif + return OS_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_drpo_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate root of dynamic sized primitive + +*/ +GLOBAL T_VOID_STRUCT *vsi_drpo_new ( ULONG size, ULONG opc, ULONG guess FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +T_DP_HEADER *dp_hdr; +T_S_HEADER *s_hdr; +ULONG alloc_size; +ULONG partition_size; +ULONG header_size; +T_HANDLE caller; + + caller = e_running[os_MyHandle()]; + + header_size = sizeof(T_PRIM_HEADER) + sizeof(T_DP_HEADER); + + if ( ALIGN(header_size + size) > MaxPrimPartSize ) + { + os_GetTaskName ( caller, caller, TaskName ); + vsi_o_assert ( NO_TASK, OS_SYST_ERR_BIG_PARTITION FILE_LINE_MACRO_PASSED, + "No Partition available, entity %s, size %d", pf_TaskTable[caller].Name, size ); + return NULL; + } + + if ( guess == DP_NO_FRAME_GUESS ) + alloc_size = ALIGN(header_size + size); + else if ( guess == DP_FRAME_GUESS ) + alloc_size = ALIGN(header_size + size * 3); + else + alloc_size = ALIGN(header_size + guess + size); + + if ( caller != 0 && caller == TST_Handle ) + { + /* + if called by PCON in the test interface while decoding we need to reserve + space for the S_HEADER + */ + alloc_size += sizeof(T_S_HEADER); + } + + if ( alloc_size > MaxPrimPartSize ) + { +#ifdef NU_DEBUG + pf_handle_warning ( OS_SYST_WRN_REQ_TRUNCATED, "%s %s (%d->%d), entity %s, opc 0x%x, %s(%d)", + syst_wrn, trunc_str, alloc_size, MaxPrimPartSize, pf_TaskTable[caller].Name, opc FILE_LINE_MACRO_PASSED ); +#endif + alloc_size = MaxPrimPartSize; + } + if ( ( prim = (T_PRIM_HEADER*)vsi_m_new_size ( alloc_size, PrimGroupHandle, + &partition_size FILE_LINE ) ) != NULL ) + { +#ifdef MEMORY_SUPERVISION + vsi_ppm_new ( caller, alloc_size, (T_PRIM_HEADER*)prim, file, line ); +#endif + prim->len = partition_size; /* complete partition because header is at the end */ + prim->opc = opc; + prim->sdu = NULL; + prim->use_cnt = 1; + prim->sh_offset = 0; + prim->dph_offset = D_HDR_OFFSET(partition_size); + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + dp_hdr->magic_nr = GUARD_PATTERN; + dp_hdr->drp_bound_list = NULL; + dp_hdr->next = NULL; + dp_hdr->offset = sizeof(T_PRIM_HEADER) + ALIGN(size); + dp_hdr->size = partition_size - sizeof(T_DP_HEADER); + if ( dp_hdr->offset > dp_hdr->size ) + { + dp_hdr->offset = dp_hdr->size; + } + /* + * The following code does not work since the 'caller' parameter has been removed from the function + * prototype. The code was needed for the case where the function was called by PCON when decoding a + * received primitive in the test interface. The caller in this case is 0 because it is either the + * RCV_HISR on the target or the EXTR task in the simulation which is not running in the context of + * the frame. Currently the sh_offset is set in the TIF driver tif.c although the guard pattern is not + * set there. This is working fine so there is no reason to modify the code here. This comment + * is just the result of some brainstorming and can be used for future modifications + */ + if ( caller != 0 && caller == TST_Handle ) /* called by PCON */ + { + prim->sh_offset = prim->dph_offset - sizeof(T_S_HEADER); + dp_hdr->size = dp_hdr->size - sizeof(T_S_HEADER); + s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); + s_hdr->magic_nr = GUARD_PATTERN; + } + else + prim->sh_offset = 0; + return ((T_VOID_STRUCT*)P2D(prim)); + } + return NULL; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_drpo_new_sdu | ++--------------------------------------------------------------------+ + + PURPOSE : allocate dynamic sized partition root + +*/ + +T_VOID_STRUCT * vsi_drpo_new_sdu (ULONG Size, ULONG opc, USHORT sdu_len, + USHORT sdu_offset, USHORT encode_offset, ULONG guess FILE_LINE_TYPE ) +{ +T_VOID_STRUCT *ptr; +ULONG alloc_size; +T_HANDLE Caller; + + Caller = 0; + alloc_size = Size + BYTELEN((SHORT)sdu_len + (SHORT)encode_offset); + ptr = vsi_drpo_new ( alloc_size, opc, guess FILE_LINE ); + /* + * the following line of code causes a warning on tms470 compiler, + * that cannot be avoided. Warning will not cause a problem because due to the + * arm7 alignment it is guaranteed that the sdu will start at an address divisable + * by 4. + */ + D_SDU(ptr) = (T_sdu*)((char*)ptr + sdu_offset); + D_SDU_LEN(ptr) = sdu_len; + D_SDU_OFF(ptr) = encode_offset; + + return ( (T_VOID_STRUCT*)ptr ); +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_drp_bind | ++--------------------------------------------------------------------+ + + PURPOSE : bind child root pointer to a given parent root pointer + +*/ +GLOBAL int vsi_drp_bind (T_VOID_STRUCT *child, T_VOID_STRUCT *parent FILE_LINE_TYPE) +{ +T_PRIM_HEADER *prim; +T_DP_HEADER *dp_hdr; +T_VOID_STRUCT **new_drp_bound_list; +ULONG alloc_size; +T_HANDLE caller; +int pos; + + caller = e_running[os_MyHandle()]; + + prim = D2P(parent); + if ( ((T_DP_HEADER*)prim)->magic_nr == GUARD_PATTERN ) + { + dp_hdr = (T_DP_HEADER*)prim; + } + else + { + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + } + + if (dp_hdr->drp_bound_list == NULL) + { + /* no partitions bound so far */ + alloc_size=MAX_DRP_BOUND*sizeof(T_DP_HEADER*); + if ( ( new_drp_bound_list = (T_VOID_STRUCT**)M_ALLOC (alloc_size) ) == NULL ) + { + /* no more memory */ + return VSI_ERROR; + } + + memset(new_drp_bound_list,0x00,alloc_size); + dp_hdr->drp_bound_list=new_drp_bound_list; + } + + /* find free bind pointer */ + pos=0; + while(pos<MAX_DRP_BOUND && dp_hdr->drp_bound_list[pos]) + { + pos++; + } + if (pos == MAX_DRP_BOUND) + { + /* no more free bound pointers */ + return VSI_ERROR; + } + + /* actually bind */ + P_ATTACH(child); + dp_hdr->drp_bound_list[pos]=child; + + return VSI_OK; +} + +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_dp_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate dynamic sized partition root + +*/ +GLOBAL T_VOID_STRUCT *vsi_dp_new ( ULONG size, T_VOID_STRUCT *addr, ULONG guess FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +T_PRIM_HEADER *last_in_chain; +T_PRIM_HEADER *dyn_ptr; +T_DP_HEADER *dp_hdr; +T_DP_HEADER *new_prim; +T_VOID_STRUCT *ptr; +ULONG partition_size; +ULONG alloc_size; +//ULONG estimated_size; +T_HANDLE caller; +char is_opc_root; + + if ( size + sizeof(T_DP_HEADER) > MaxPrimPartSize ) + { + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR_BIG_PARTITION FILE_LINE_MACRO_PASSED, + "No Partition available, entity %s, size %d", pf_TaskTable[caller].Name, size ); + return NULL; + } + prim = D2P(addr); + dyn_ptr = prim; + if ( ((T_DP_HEADER*)prim)->magic_nr == GUARD_PATTERN ) + { + dp_hdr = (T_DP_HEADER*)prim; + is_opc_root = 0; + } + else + { + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + is_opc_root = 1; + } + + if ( guess == DP_NO_FRAME_GUESS ) + alloc_size = size + sizeof(T_DP_HEADER); + else if ( guess == DP_FRAME_GUESS ) + alloc_size = size * 3 + sizeof(T_DP_HEADER); + else + alloc_size = size + guess + sizeof(T_DP_HEADER); + +#if 0 + /* + * update estimated size + */ + estimated_size = dp_hdr->est_size; + + if ( guess != DP_NO_FRAME_GUESS && guess != DP_FRAME_GUESS ) + { + estimated_size = size + guess; + alloc_size = estimated_size + sizeof(T_DP_HEADER); + estimated_size -= size; + } + else + { + if ( size > estimated_size ) + { + if ( guess == DP_FRAME_GUESS ) + estimated_size = size * 3; + else + estimated_size = size; + } + estimated_size -= size; + if ( size > estimated_size ) + estimated_size = size * 2; + alloc_size = estimated_size + sizeof(T_DP_HEADER); + } + + if ( estimated_size > MaxPrimPartSize ) + estimated_size = MaxPrimPartSize; + + dp_hdr->est_size = estimated_size; +#endif + /* + * check if free space in already allocated blocks (first fit) + */ + do + { + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + caller = e_running[os_MyHandle()]; + vsi_o_assert ( caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Magic number in dp_header destroyed (DP_ALLOC), %s opc: 0x%lx, partition 0x%lx", + pf_TaskTable[caller].Name, ((T_PRIM_HEADER*)prim)->opc, prim ); + } + if ( dp_hdr->size - dp_hdr->offset > size ) + { + /* + * if root was allocated with drpo_alloc then dp header is at the end, + * the dph offset is not 0 and a primitive header is present. + */ + if ( is_opc_root && dyn_ptr == prim ) + ptr = (T_VOID_STRUCT*)(((ULONG*)prim) + (dp_hdr->offset>>2)); + else + ptr = (T_VOID_STRUCT*)(((ULONG*)dp_hdr) + (dp_hdr->offset>>2)); + dp_hdr->offset += ALIGN(size); + return ( ptr ); + } + if ( is_opc_root && dyn_ptr == prim ) + last_in_chain = prim; + else + last_in_chain = (T_PRIM_HEADER*)dp_hdr; + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + dyn_ptr = (T_PRIM_HEADER*)dp_hdr; + } while ( dp_hdr ); + + /* + * not enough free space -> additional allocation needed + */ + if ( alloc_size > MaxPrimPartSize ) + { +#ifdef NU_DEBUG + caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_REQ_TRUNCATED, "%s %s (%d->%d), entity %s, %s(%d)", + syst_wrn, trunc_str, alloc_size, MaxPrimPartSize, pf_TaskTable[caller].Name FILE_LINE_MACRO_PASSED ); +#endif + alloc_size = MaxPrimPartSize; + } + + if ( ( new_prim = (T_DP_HEADER*)vsi_m_new_size ( alloc_size, PrimGroupHandle, + &partition_size FILE_LINE ) ) != NULL ) + { +#ifdef MEMORY_SUPERVISION + caller = e_running[os_MyHandle()]; + vsi_ppm_new ( caller, alloc_size, (T_PRIM_HEADER*)new_prim, file, line ); +#endif + if ( ((T_DP_HEADER*)last_in_chain)->magic_nr == GUARD_PATTERN ) + dp_hdr = (T_DP_HEADER*)last_in_chain; + else + dp_hdr = (T_DP_HEADER*)((ULONG*)last_in_chain + last_in_chain->dph_offset); + dp_hdr->next = new_prim; + new_prim->magic_nr = GUARD_PATTERN; + new_prim->drp_bound_list = NULL; + new_prim->use_cnt = 1; + new_prim->next = NULL; + new_prim->size = partition_size; + new_prim->offset = sizeof(T_DP_HEADER) + ALIGN(size); + if ( new_prim->offset > new_prim->size ) + { + new_prim->offset = new_prim->size; + } + return (T_VOID_STRUCT*)(new_prim + 1); + } + + return NULL; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_drp_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate dynamic sized partition except root + +*/ +GLOBAL T_VOID_STRUCT *vsi_drp_new ( ULONG size, ULONG guess FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +T_DP_HEADER *dp_hdr; +ULONG alloc_size; +ULONG header_size; +ULONG partition_size; +T_HANDLE caller; + + header_size = sizeof(T_DP_HEADER); + + if ( ALIGN(header_size + size) > MaxPrimPartSize ) + { + caller = e_running[os_MyHandle()]; + os_GetTaskName ( caller, caller, TaskName ); + vsi_o_assert ( NO_TASK, OS_SYST_ERR_BIG_PARTITION FILE_LINE_MACRO_PASSED, + "No Partition available, entity %s, size %d", pf_TaskTable[caller].Name, size ); + return NULL; + } + + if ( guess == DP_NO_FRAME_GUESS ) + alloc_size = header_size + size; + else if ( guess == DP_FRAME_GUESS ) + alloc_size = header_size + size * 3; + else + alloc_size = header_size + guess + size; + + if ( alloc_size > MaxPrimPartSize ) + { +#ifdef NU_DEBUG + caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_REQ_TRUNCATED, "%s %s (%d->%d), entity %s, %s(%d)", + syst_wrn, trunc_str, alloc_size, MaxPrimPartSize, pf_TaskTable[caller].Name FILE_LINE_MACRO_PASSED ); +#endif + alloc_size = MaxPrimPartSize; + } + + if ( ( prim = (T_PRIM_HEADER*)vsi_m_new_size ( alloc_size, PrimGroupHandle, + &partition_size FILE_LINE ) ) != NULL ) + { +#ifdef MEMORY_SUPERVISION + caller = e_running[os_MyHandle()]; + vsi_ppm_new ( caller, alloc_size, (T_PRIM_HEADER*)prim, file, line ); +#endif + dp_hdr = (T_DP_HEADER*)prim; + dp_hdr->next = NULL; + dp_hdr->magic_nr = GUARD_PATTERN; + dp_hdr->drp_bound_list = NULL; + dp_hdr->use_cnt = 1; + dp_hdr->offset = sizeof(T_DP_HEADER) + ALIGN(size); + dp_hdr->size = partition_size; + if ( dp_hdr->offset > dp_hdr->size ) + { + dp_hdr->offset = dp_hdr->size; + } + return (T_VOID_STRUCT*)(dp_hdr+1); + } + + return NULL; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_free | ++--------------------------------------------------------------------+ + + PURPOSE : deallocate a chain of linked partitions + +*/ + +int vsi_free ( T_VOID_STRUCT **Msg FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +T_DP_HEADER *dp_hdr; +T_VOID_STRUCT** drp_bound_list; +T_HANDLE Caller = 0; +int pos; + + /* + * PFREE is disabled if the primitive to be freed is the currently + * processed one and the auto free is enabled for the calling entity + */ + + Caller = e_running[os_MyHandle()]; + + prim = D2P(*Msg); + +#ifdef NU_DEBUG + if ( os_is_valid_partition ((T_VOID_STRUCT*)prim) ) + { + /* free to non-partition memory */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "FREE to non-partition memory, entity %s, prim 0x%x", pf_TaskTable[Caller].Name, *Msg ); + } +#endif + +#ifdef PRIM_AUTO_FREE + if ( prim == (T_PRIM_HEADER*)processed_prim[Caller] && pf_TaskTable[Caller].Flags & PARTITION_AUTO_FREE ) + { + return VSI_OK; + } +#endif /* PRIM_AUTO_FREE */ + + /* check if we have dynamic partition or primitive */ + if ( ((T_DP_HEADER*)prim)->magic_nr == GUARD_PATTERN ) + { + dp_hdr = (T_DP_HEADER*)prim; + } + else if ( prim->dph_offset != 0 ) + { + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + } + else + { + return ( vsi_c_free ( Caller, (T_VOID_STRUCT**)&prim FILE_LINE ) ); + } + + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + /* primitive with T_desc_list element */ + vsi_c_free ( Caller, (T_VOID_STRUCT**)&prim FILE_LINE ); + return VSI_OK; + } + else + { + do + { + drp_bound_list=dp_hdr->drp_bound_list; + if (drp_bound_list) + { + /* call free for bound root pointers */ + pos=0; + while(pos<MAX_DRP_BOUND && drp_bound_list[pos]) + { + FREE(drp_bound_list[pos]); + pos++; + } + } + + /* free linked memory */ + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + vsi_c_free ( Caller, (T_VOID_STRUCT**)&prim FILE_LINE ); + + if (prim == NULL && drp_bound_list) + { + /* free drp_bound_list */ + M_FREE(drp_bound_list); + } + } while ( (prim = (T_PRIM_HEADER*)dp_hdr) != NULL ); + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_d_sum | ++--------------------------------------------------------------------+ + + PURPOSE : get number of bytes in dynamic sized primitive + +*/ +GLOBAL int vsi_dp_sum ( T_VOID_STRUCT *addr, ULONG *bytes ) +{ +T_PRIM_HEADER *prim; +T_DP_HEADER *dp_hdr; +ULONG size; +T_HANDLE caller; + + prim = D2P(addr); + if ( ((T_DP_HEADER*)prim)->magic_nr == GUARD_PATTERN ) + dp_hdr = (T_DP_HEADER*)prim; + else if ( prim->dph_offset != 0 ) + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + else + { + caller = e_running[os_MyHandle()]; + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "SYSTEM WARNING: No root of linked memory in %s", + pf_TaskTable[caller].Name ); + return VSI_ERROR; + } + + size = 0; + do + { + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + caller = e_running[os_MyHandle()]; + vsi_o_assert ( caller, OS_SYST_ERR, __FILE__, __LINE__, + "Magic number in dp_header destroyed, opc: 0x%lx, partition 0x%lx", + prim->opc, prim ); + } + size += (dp_hdr->offset-sizeof(T_DP_HEADER)); + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } while ( (prim = (T_PRIM_HEADER*)dp_hdr) != NULL ); + + *bytes = size; + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_dp_max_size | ++--------------------------------------------------------------------+ + + PURPOSE : get maximum number of bytes available for user data + in dynamic primitive + +*/ +GLOBAL int vsi_dp_max_size ( void ) +{ + return ( (int)(MaxPrimPartSize - sizeof(T_PRIM_HEADER) - sizeof(T_DP_HEADER)) ); +} +#endif + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_pmax_size | ++--------------------------------------------------------------------+ + + PURPOSE : get maximum number of bytes available for user data + in dynamic primitive + +*/ +GLOBAL int vsi_c_pmax_size ( void ) +{ + return ( (int)(MaxPrimPartSize - sizeof(T_DP_HEADER)) ); +} +#endif + +#ifdef _TOOLS_ +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_sync | ++--------------------------------------------------------------------+ + + PURPOSE : check if PS already started + +*/ +GLOBAL int vsi_c_sync ( T_HANDLE caller, T_TIME timeout ) +{ +T_VOID_STRUCT *prim; +T_QMSG Msg; +T_HANDLE tst_q_handle; +char sync_req_name[RESOURCE_NAMELEN]; +char sync_req_time[8]; +static int sync_active = 0; + + + if ( sync_active == FALSE ) + { + sync_active = TRUE; + os_GetTaskName(caller, caller, sync_req_name); + itoa(timeout, sync_req_time,10); + + prim = vsi_c_pnew ( sizeof(T_PRIM_HEADER)+strlen(SYSPRIM_CONFIG_TOKEN)+1 + +strlen(SYSPRIM_TST_SYNC_REQ)+1 + +strlen(sync_req_name)+1 + +strlen(sync_req_time)+1, 0x8000 FILE_LINE ); + strcpy ( (char*)prim, SYSPRIM_CONFIG_TOKEN ); + strcat ( (char*)prim, " " ); + strcat ( (char*)prim, SYSPRIM_TST_SYNC_REQ ); + strcat ( (char*)prim, " " ); + strcat ( (char*)prim, sync_req_name ); + strcat ( (char*)prim, " " ); + strcat ( (char*)prim, sync_req_time ); + + tst_q_handle = vsi_c_open ( caller, FRM_TST_NAME ); + vsi_c_psend ( tst_q_handle, prim ); + + if ( vsi_c_await ( caller, pf_TaskTable[caller].QueueHandle, &Msg, timeout ) == VSI_TIMEOUT ) + { + vsi_o_ttrace (caller, TC_SYSTEM, "timeout - Synchronization with Stack failed" ); + sync_active = FALSE; + return VSI_ERROR; + } + else + { + sync_active = FALSE; + if ( strcmp ((char*)P2D(Msg.Msg.Primitive.Prim), SYSPRIM_TST_SYNC_CNF ) == 0 ) + { + vsi_o_ttrace (caller, TC_SYSTEM, "TST_SYNC_CNF - Synchronization with Stack succeeded" ); + vsi_c_free (caller, &Msg.Msg.Primitive.Prim); + return VSI_OK; + } + else + { + vsi_o_ttrace (caller, TC_SYSTEM, "TST_SYNC_REJ - Synchronization with Stack failed" ); + vsi_c_free (caller, &Msg.Msg.Primitive.Prim); + return VSI_ERROR; + } + } + } + return VSI_OK; +} +#endif + +#ifdef _TOOLS_ +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_c_generic_send | ++--------------------------------------------------------------------+ + + PURPOSE : check if PS already started + +*/ +int vsi_c_alloc_send ( T_HANDLE com_handle, char* dst, char* src, void *prim, char *string ) +{ +int alloc_size; +T_PRIM_HEADER *ptr; +T_S_HEADER *s_hdr; +unsigned int i; +unsigned int size; +int opc; +int s_header_added = 0; +int sh_offset; + + if ( string != NULL ) + { + size = strlen(string); + alloc_size = size + sizeof(T_PRIM_HEADER); + if ( dst != NULL || src != NULL ) + { + sh_offset = ALIGN(alloc_size) / (int)sizeof(ULONG); + alloc_size = ALIGN(alloc_size) + sizeof(T_S_HEADER); + if ( dst != 0 ) + opc = 0; /* to stack -> set to SYS_MASK in tst_pei_primitive() when sh_offset != 0 */ + else + opc = SYS_MASK; /* to tools */ + s_header_added = 1; + } + else + { + opc = SYS_MASK; + sh_offset = 0; + } + ptr = (T_PRIM_HEADER*)vsi_c_new ( 0, alloc_size, opc ); + memcpy ( (char*)P2D(ptr), string, size ); + if ( s_header_added == 1 ) + { + ptr->sh_offset = sh_offset; + s_hdr = (T_S_HEADER*)((int*)ptr+ptr->sh_offset); + ptr->len = size + sizeof(T_PRIM_HEADER); /* exclude S_HEADER */ + } + } + else + { + ptr = D2P(prim); /* work on passed primitive */ + } + if ( dst != NULL ) + { + if ( s_header_added == 0 ) + { + alloc_size = ALIGN(ptr->len) + sizeof(T_S_HEADER); + ptr = (T_PRIM_HEADER*)vsi_c_new ( 0, alloc_size, 0 ); + memcpy((char*)ptr, (char*)D2P(prim), D_LEN(prim)); + ptr->sh_offset = ALIGN(D_LEN(prim)) / sizeof(ULONG); + s_hdr = (T_S_HEADER*)((int*)ptr+ptr->sh_offset); + FREE(prim); + } + else + { + s_hdr = (T_S_HEADER*)((int*)ptr+ptr->sh_offset); + } + /* set org_rcv and rcv */ + for (i = 0; dst[i] && i < sizeof (s_hdr->rcv) && dst[i]!= ';'; i++) + s_hdr->org_rcv[i] = s_hdr->rcv[i] = dst[i]; + if (i < sizeof s_hdr->rcv) + s_hdr->org_rcv[i] = s_hdr->rcv[i] = 0; + + s_hdr->time = 0; + s_header_added = 1; + } + + if ( src != NULL ) + { + if ( s_header_added == 0 ) + { + alloc_size = ALIGN(ptr->len) + sizeof(T_S_HEADER); + ptr = (T_PRIM_HEADER*)vsi_c_new ( 0, alloc_size, 0 ); + memcpy((char*)ptr, (char*)D2P(prim), D_LEN(prim)); + ptr->sh_offset = ALIGN(D_LEN(prim)) / sizeof(ULONG); + s_hdr = (T_S_HEADER*)((int*)ptr+ptr->sh_offset); + FREE(prim); + } + else + { + s_hdr = (T_S_HEADER*)((int*)ptr+ptr->sh_offset); + } + + s_hdr->time = 0; + + /* set snd */ + for (i = 0; src[i] && i < sizeof (s_hdr->snd) && src[i]!= ';'; i++) + s_hdr->snd[i] = src[i]; + if (i < sizeof s_hdr->snd) + s_hdr->snd[i] = 0; + } + + return ( vsi_c_psend (com_handle, (T_VOID_STRUCT*)P2D(ptr)) ); +} +#endif + +#ifdef NU_DEBUG +#ifndef RUN_FLASH +/* ++----------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : check_descriptor_list | ++----------------------------------------------------------------------+ + + PURPOSE : check partitions in descriptor list + +*/ +int check_descriptor_list ( T_HANDLE caller, T_PRIM_HEADER *prim FILE_LINE_TYPE ) +{ +T_DP_HEADER *dp_hdr; +T_M_HEADER *mem; +T_desc *desc; +LONG Status; + + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + /* the presence of the guard pattern at dph_offset is used to distinguish between dynamic primitives + and primitives with descriptor list. If the guard pattern is destroyed, the primitive looks like + having a descriptor list and the frame will probably crash during checking the integrity of the + partitions in the list. This bahavior is prefered to non checking the partitions */ + + if ( *((ULONG*)dp_hdr) == GUARD_PATTERN ) + { + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + while (dp_hdr != NULL) + { + if ( dp_hdr->magic_nr != GUARD_PATTERN ) + { + prim = (T_PRIM_HEADER*)dp_hdr; + vsi_o_assert ( caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Magic number in dp_header destroyed (PSEND) %s , opc: 0x%lx, partition 0x%lx", + pf_TaskTable[caller].Name, prim->opc, prim ); + } + if ( (Status = os_PartitionCheck ( (T_VOID_STRUCT*)dp_hdr)) == OS_PARTITION_GUARD_PATTERN_DESTROYED ) + { + vsi_o_assert ( caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "%s in dynamic primitive (PSEND),entity %s, prim 0x%x, opc 0x%x, bad partition 0x%x", + guard_str, pf_TaskTable[caller].Name, prim, prim->opc, dp_hdr ); + break; + } + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } + } + else + { + if ( caller != TST_Handle ) + { + /* do not check and update the states of the primitives in descriptor lists when called by TST, because + descriptor lists are not routed to TST and will result in the warning generated below */ + desc = (T_desc*)(((T_desc_list*)dp_hdr)->first); + while (desc != NULL) + { + mem = (T_M_HEADER*)(((char*)desc)-sizeof(T_M_HEADER)); + if ( os_is_valid_partition ((T_VOID_STRUCT*)mem) ) + { + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "pointer to non-partition memory in desc list(PSEND), entity %s, prim 0x%x, opc 0x%x", + pf_TaskTable[caller].Name, prim, prim->opc ); + return VSI_ERROR; + } + if ( (Status = os_PartitionCheck ( (T_VOID_STRUCT*)mem)) != OS_OK ) + { + switch ( Status ) + { + case OS_PARTITION_GUARD_PATTERN_DESTROYED: + vsi_o_assert ( caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "%s in desclist (PSEND), entity %s, prim 0x%x, opc 0x%x, bad partition 0x%x", + guard_str, pf_TaskTable[caller].Name, prim, prim->opc, mem ); + break; + case OS_PARTITION_FREE: + vsi_o_assert ( caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "%s in desclist (PSEND), entity %s, prim 0x%x, opc 0x%x, freed partition 0x%x", + freed_sent_str, pf_TaskTable[caller].Name, prim, prim->opc, mem ); + break; + default: + break; + } + } + if ( mem->desc_type == (VSI_DESC_TYPE3 >> 16) ) + { + mem = ((T_M_HEADER*)(((T_desc3*)desc)->buffer)) - 1; + if ( os_is_valid_partition ( (T_VOID_STRUCT*)mem ) ) + { + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "pointer to non-partition memory in desc list type 3 (PSEND), entity %s, prim 0x%x, opc 0x%x, invalid partition 0x%x", + pf_TaskTable[caller].Name, prim, prim->opc, mem ); + return VSI_ERROR; + } + if ( (Status = os_PartitionCheck ( (T_VOID_STRUCT*)mem )) != OS_OK ) + { + switch ( Status ) + { + case OS_PARTITION_GUARD_PATTERN_DESTROYED: + vsi_o_assert ( caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "%s in desclist type 3 (PSEND), entity %s, prim 0x%x, opc 0x%x, bad partition 0x%x", + guard_str, pf_TaskTable[caller].Name, prim, prim->opc, mem ); + break; + case OS_PARTITION_FREE: + vsi_o_assert ( caller, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "%s in desclist type 3 (PSEND), entity %s, prim 0x%x, opc 0x%x, freed partition 0x%x", + freed_sent_str, pf_TaskTable[caller].Name, prim, prim->opc, mem ); + break; + default: + break; + } + } + } + + desc = (T_desc *)desc->next; + } + } + } + return VSI_OK; +} +#endif +#endif + +#if !defined _TARGET_ && !defined _TOOLS_ + +/* ------------------------------------------------------------------------- + check functions +----------------------------------------------------------------------------*/ + +#ifdef TEST_PCHECK + +#ifndef RUN_INT_RAM +ULONG test_pcheck ( ULONG opc, void * decoded_prim ) +{ + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "test_pcheck() called for opc %8x", D_OPC(decoded_prim) ); + return pcheck_func.ret_ok+1; +} +#endif + +#endif /* TEST_PCHECK */ + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : pcheck_register ++------------------------------------------------------------------------------ +| Description : register the pcheck function. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void vsi_pcheck_register ( ULONG (*func)(ULONG, void*), ULONG ret_ok ) +{ + pcheck_func.ret_ok = ret_ok; + pcheck_func.pcheck = func; + pcheck_func.magic_nr = PCHECK_INITIALIZED; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : ext_trace_init ++------------------------------------------------------------------------------ +| Description : initialize external trace function pointer table. +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void vsi_pcheck_init ( void ) +{ +#ifdef TEST_PCHECK + vsi_pcheck_register ( test_pcheck, 0 ); +#endif + if ( pcheck_func.magic_nr != PCHECK_INITIALIZED ) + { + pcheck_func.ret_ok = 0; + pcheck_func.pcheck = NULL; + pcheck_func.magic_nr = 0; + } +} +#endif + +#endif /* !_TARGET_ && !_TOOLS_*/ + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_drv.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,688 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_drv.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for driver access. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_DRV_C__ +#define __VSI_DRV_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "string.h" +#include "stdio.h" +#include "typedefs.h" + +#include "vsi.h" +#include "gdi.h" +#include "os.h" +#ifdef _TOOLS_ + #include "drvconf.h" +#endif +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "frame.h" + +/*==== TYPES ======================================================*/ + + +#ifdef _TOOLS_ +typedef struct +{ + char Name[RESOURCE_NAMELEN]; + char Process[RESOURCE_NAMELEN]; + char DrvConfig[80]; +} _T_DRV_LIST_ENTRY; + +typedef struct +{ + _T_DRV_LIST_ENTRY DrvEntry [ 5 ]; +} _T_DRV_LIST; + +#endif + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +extern T_DRV_TABLE_ENTRY DrvTable []; + +/*==== VARIABLES ==================================================*/ + +#undef EXTR_SEND_CONTROL +#ifndef RUN_INT_RAM +T_DRV_LIST *DriverConfigList; /* pointer to start of driver cinfiguration list */ +static T_DRV_LIST *DriverList; /* pointer to selected driver list */ +#ifdef EXTR_SEND_CONTROL +FILE *fp; +#endif +#endif + +#ifdef _TOOLS_ +_T_DRV_LIST _DrvList={0}; +T_DRV_LIST DrvList={0}; +#endif + +#ifdef _TOOLS_ +#pragma data_seg() +#endif /* _TOOLS_ */ +/* -------------- S H A R E D - END ---------------- */ + + +/*==== FUNCTIONS ==================================================*/ + +void ClearDriverTable ( void ); + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_create | ++--------------------------------------------------------------------+ + + PURPOSE : enter a new driver in the driver list + +*/ +int vsi_d_create ( T_HANDLE caller, T_TST_DRV_ENTRY *drv_info ) +{ +T_HANDLE drv_handle; + + drv_handle = drv_info->drv_pos; + vsi_d_exit ( caller, 0 ); + DriverList->DrvEntry[drv_handle].drv_Init = drv_info->entry.drv_Init; + DriverList->DrvEntry[drv_handle].Name = drv_info->entry.Name; + DriverList->DrvEntry[drv_handle].Process = drv_info->entry.Process; + DriverList->DrvEntry[drv_handle].DrvConfig = drv_info->entry.DrvConfig; + + ClearDriverTable(); + vsi_d_init ( caller ); + vsi_d_setsignal ( caller, 0, DRV_SIGTYPE_READ|DRV_SIGTYPE_CONNECT|DRV_SIGTYPE_DISCONNECT); + vsi_d_setconfig ( caller, 0, NULL ); + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_callback | ++--------------------------------------------------------------------+ + + PURPOSE : callback from a driver + +*/ +void vsi_d_callback ( T_DRV_SIGNAL *Signal ) +{ +T_HANDLE Caller; +T_HANDLE DrvHandle; +int sts; +#ifdef EXTR_SEND_CONTROL +OS_TIME time; +T_PRIM_HEADER *p; +static int cnt = 0; +int bytes; +#endif + + Caller = Signal->DrvHandle; + DrvHandle = DrvTable[Caller].UpperDrv; + if ( DrvHandle ) + { + if ( DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback != NULL ) + { +#if defined _TARGET_ && defined _NUCLEUS_ + if ( DrvTable[Caller].DrvInfo->Flags & CALLED_FROM_ISR ) + os_ExecuteCallback ( Caller, DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback, Signal ); + else +#endif + (DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback)( Signal ); + } + } + else + { + if ( DrvTable[Caller].ProcessHandle ) + { + OS_QDATA Msg; + OS_TIME time; + Msg.data16 = MSG_SIGNAL; + Msg.data32 = Signal->SignalType; + Msg.ptr = Signal->UserData; + os_GetTime ( 0, &time ); + Msg.time = (ULONG)time; + Msg.e_id = DrvTable[Caller].ProcessHandle; +#ifdef EXTR_SEND_CONTROL + if ( Msg.ptr ) + { + os_GetTime(0,&time); + fp = fopen("test.txt", "a"); + p = (T_PRIM_HEADER*)((T_PRIM_X*)Msg.ptr)->prim_ptr; + if ( p->opc == 0x8000 ) + { + printf("EXTR: Start sending %s, time %d, %d\n", (char*)P2D(p),time, cnt & 1023 ); + bytes = fprintf(fp, "EXTR: Start sending %s, time %d, %d\n", (char*)P2D(p),time, cnt & 1023 ); + } + else + { + printf("EXTR: Start sending primitive, time %d, %d\n", time, cnt & 1023); + bytes = fprintf(fp, "EXTR: Start sending primitive, time %d, %d\n", time, cnt & 1023); + } + fclose(fp); + } +#endif +#ifdef _TOOLS_ + sts = os_SendToQueue (NO_TASK, DrvTable[Caller].ProcessHandle, OS_NORMAL, OS_SUSPEND, &Msg ); +#else + sts = os_SendToQueue (NO_TASK, pf_TaskTable[DrvTable[Caller].ProcessHandle].QueueHandle, OS_NORMAL, OS_SUSPEND, &Msg ); +#endif +#ifdef EXTR_SEND_CONTROL + os_GetTime(0,&time); + fp = fopen("test.txt", "a"); + printf("EXTR: Complete sending, time %d %d\n", time, cnt & 1023); + bytes = fprintf(fp,"EXTR: Complete sending, time %d %d\n", time, cnt++ & 1023); + fclose(fp); +#endif + /* + * This is a dirty patch, but due to the missing return value there is no other choice + */ + if ( sts == OS_TIMEOUT || sts == OS_ERROR ) + { + T_PRIM_X *sys_prim; + + sys_prim = (T_PRIM_X*)Signal->UserData; + PFREE(P2D(sys_prim->prim_ptr)); + PFREE(P2D(sys_prim)); + } + } + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_init | ++--------------------------------------------------------------------+ + + PURPOSE : initialize drivers + +*/ +/*lint -esym(644,DrvInfo) */ +int vsi_d_init ( T_HANDLE Caller ) +{ +T_DRV_EXPORT const *DrvInfo; +USHORT i; +SHORT sts; + +#ifdef EXTR_SEND_CONTROL + fp = fopen("test.txt", "a"); + fprintf(fp,"=========================================================\n"); + fclose (fp); +#endif + for ( i = 1; i < MAX_TST_DRV; i++ ) + { + sts = DRV_NOTCONFIGURED; +#ifdef _TOOLS_ + if ( DrvTable[i].DrvInfo ) + sts = (SHORT)(DrvTable[i].DrvInfo->DrvFunc.drv_Init)(i,vsi_d_callback,&DrvInfo); + else +#endif + if ( DriverList->DrvEntry[i].drv_Init ) + sts = (SHORT)(DriverList->DrvEntry[i].drv_Init)(i,vsi_d_callback,&DrvInfo); + if ( sts == DRV_OK ) + { + if ( DriverList->DrvEntry[i].Process ) + DrvTable[i].ProcessHandle = vsi_c_open ( Caller, (char*)DriverList->DrvEntry[i].Process ); + DrvTable[i].UpperDrv = i-1; + DrvTable[i-1].LowerDrv = i; + DrvTable[i].DrvInfo = DrvInfo; +#if defined _TARGET_ && defined _NUCLEUS_ + if ( DrvTable[i].DrvInfo->Flags & CALLED_FROM_ISR ) + if ( os_CreateCallback() == OS_ERROR ) + return VSI_ERROR; +#endif + } + else + { + if ( sts != DRV_NOTCONFIGURED ) + { + return VSI_ERROR; + } + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_exit | ++--------------------------------------------------------------------+ + + PURPOSE : exit drivers + +*/ +int vsi_d_exit ( T_HANDLE Caller, T_HANDLE DrvHandle ) +{ +T_HANDLE Handle; +T_HANDLE min, max; + + if ( DrvHandle ) + { + min = DrvHandle; + max = DrvHandle+1; + } + else + { + min = 1; + max = MAX_TST_DRV; + } + + for ( Handle = min; Handle < max; Handle++ ) + { + if ( DrvTable[Handle].DrvInfo ) + { + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Exit != NULL ) + (DrvTable[Handle].DrvInfo->DrvFunc.drv_Exit)(); + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_open | ++--------------------------------------------------------------------+ + + PURPOSE : open a drivers + +*/ +int vsi_d_open ( T_HANDLE Caller, char *Name ) +{ +int i; + + for ( i = 1; i <= MAX_TST_DRV; i++ ) + { + if ( DrvTable[i].DrvInfo && DrvTable[i].DrvInfo->Name ) + if ( !strcmp ( DrvTable[i].DrvInfo->Name, Name ) ) + return (i); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_close | ++--------------------------------------------------------------------+ + + PURPOSE : close a driver + +*/ +/*lint -esym(715,DrvHandle) suppress Info -- Symbol 'DrvHandle' not referenced */ +int vsi_d_close ( T_HANDLE Caller, T_HANDLE DrvHandle ) +{ + + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_read | ++--------------------------------------------------------------------+ + + PURPOSE : read data from a driver + +*/ +int vsi_d_read ( T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG *Size ) +{ +T_HANDLE Handle; + + if ( DrvHandle ) + Handle = DrvHandle; /* Caller TST: opened driver with vsi_d_open() */ + else + Handle = DrvTable[Caller].LowerDrv; /* Caller drv: handle defined by ConfigSring */ + + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Read != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Read)( (void*)Buffer, Size ) == DRV_OK ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_write | ++--------------------------------------------------------------------+ + + PURPOSE : write data to a driver + +*/ +int vsi_d_write ( T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG Size ) +{ +T_HANDLE Handle; +ULONG TotalBytesToWrite = Size; +ULONG BytesToWrite = Size; +ULONG TotalBytesWritten = 0; +ULONG BytesWritten = 0; +char *ptr = (char*)Buffer; + + if ( DrvHandle ) + Handle = DrvHandle; /* Caller TST: opened driver with vsi_d_open() */ + else + Handle = DrvTable[Caller].LowerDrv; /* Caller drv: handle defined by ConfigSring */ + + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Write != NULL ) + { + while ( TotalBytesWritten < TotalBytesToWrite ) + { + BytesWritten = BytesToWrite; + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Write)( (void*)ptr, &BytesWritten ) != DRV_OK ) + return VSI_ERROR; + ptr += BytesWritten; + TotalBytesWritten += BytesWritten; + BytesToWrite = TotalBytesToWrite - TotalBytesWritten; + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_flush | ++--------------------------------------------------------------------+ + + PURPOSE : flush the internal buffers of a driver + +*/ +int vsi_d_flush ( T_HANDLE Caller, T_HANDLE DrvHandle ) +{ +T_HANDLE Handle; +T_HANDLE min, max; + + if ( DrvHandle ) + { + min = DrvHandle; + max = DrvHandle+1; + } + else + { + min = 1; + max = MAX_TST_DRV; + } + + for ( Handle = min; Handle < max; Handle++ ) + { + if ( DrvTable[Handle].DrvInfo ) + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Flush != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Flush)() != DRV_OK ) + return VSI_ERROR; + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_setsignal | ++--------------------------------------------------------------------+ + + PURPOSE : enable a signal in a driver + +*/ +int vsi_d_setsignal ( T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ) +{ +T_HANDLE Handle; +T_HANDLE min, max; + + if ( DrvHandle ) + { + min = DrvHandle; + max = DrvHandle+1; + } + else + { + min = 1; + max = MAX_TST_DRV; + } + + for ( Handle = min; Handle < max; Handle++ ) + { + if ( DrvTable[Handle].DrvInfo ) + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_SetSignal != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_SetSignal)( SignalType ) != DRV_OK ) + return VSI_ERROR; + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_resetsignal | ++--------------------------------------------------------------------+ + + PURPOSE : disable a signal in a driver + +*/ +int vsi_d_resetsignal ( T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ) +{ +T_HANDLE Handle; +T_HANDLE min, max; + + if ( DrvHandle ) + { + min = DrvHandle; + max = DrvHandle+1; + } + else + { + min = 1; + max = MAX_TST_DRV; + } + + for ( Handle = min; Handle < max; Handle++ ) + { + if ( DrvTable[Handle].DrvInfo ) + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_ResetSignal != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_ResetSignal)( SignalType ) != DRV_OK ) + return VSI_ERROR; + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_setconfig | ++--------------------------------------------------------------------+ + + PURPOSE : configure a driver + +*/ +int vsi_d_setconfig ( T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ) +{ +T_HANDLE Handle; + + if ( Config && DrvHandle != 0) + { + if ( DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_SetConfig != NULL ) + if ( (DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_SetConfig)( Config ) != DRV_OK ) + return VSI_ERROR; + } + else + { + T_HANDLE min, max; + + if ( DrvHandle ) + { + min = DrvHandle; + max = DrvHandle+1; + } + else + { + min = 1; + max = MAX_TST_DRV; + } + + for ( Handle = min; Handle < max; Handle++ ) + { + if ( DriverList->DrvEntry[Handle].DrvConfig ) + { + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_SetConfig != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_SetConfig)( (char*)DriverList->DrvEntry[Handle].DrvConfig ) != DRV_OK ) + return VSI_ERROR; + } + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : vsi_d_getconfig | ++--------------------------------------------------------------------+ + + PURPOSE : read configuration data from a driver + +*/ + +int vsi_d_getconfig ( T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ) +{ +T_HANDLE Handle; +char Buffer[40]; +char *ptr = Config; + + Handle = DrvHandle; + while ( Handle ) + { + if ( DrvTable[Handle].DrvInfo ) + if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_GetConfig != NULL ) + if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_GetConfig)( Buffer ) != DRV_OK ) + return VSI_ERROR; + + sprintf ( ptr, "%s:%s;",DrvTable[Handle].DrvInfo->Name,Buffer ); + ptr = ptr + strlen(DrvTable[Handle].DrvInfo->Name) + strlen(Buffer) + 2; + Handle = DrvTable[Handle].LowerDrv; + } + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : InitializeDriverTable | ++--------------------------------------------------------------------+ + + PURPOSE : Initialize the driver table + +*/ +void InitializeDriverConfig ( void ) +{ +#ifdef _TOOLS_ +USHORT j; + + for ( j = 1; j < MAX_TST_DRV ; j++ ) + { + if ( DriverConfigList->DrvEntry[j].Name ) + { + strcpy ( _DrvList.DrvEntry[j].Name, DriverConfigList->DrvEntry[j].Name ); + DrvList.DrvEntry[j].Name = _DrvList.DrvEntry[j].Name; + } + + if ( DriverConfigList->DrvEntry[j].drv_Init ) + { + DrvList.DrvEntry[j].drv_Init = DriverConfigList->DrvEntry[j].drv_Init; + } + + if ( DriverConfigList->DrvEntry[j].Process ) + { + strcpy ( _DrvList.DrvEntry[j].Process, DriverConfigList->DrvEntry[j].Process ); + DrvList.DrvEntry[j].Process = _DrvList.DrvEntry[j].Process; + } + + if ( DriverConfigList->DrvEntry[j].DrvConfig ) + { + strcpy ( _DrvList.DrvEntry[j].DrvConfig, DriverConfigList->DrvEntry[j].DrvConfig ); + DrvList.DrvEntry[j].DrvConfig = _DrvList.DrvEntry[j].DrvConfig; + } + } + + DriverList = &DrvList; +#else + DriverList = DriverConfigList; +#endif /* _TOOLS_ */ + ClearDriverTable(); +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | +| STATE : code ROUTINE : ClearDriverTable | ++--------------------------------------------------------------------+ + + PURPOSE : Clear the driver table + +*/ +void ClearDriverTable ( void ) +{ +char i; + + for ( i = 1; i <= MAX_TST_DRV; i++ ) + { + memset ( &DrvTable[i], 0, sizeof(T_DRV_TABLE_ENTRY) ); + } + +} +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_mem.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,511 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_mem.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for the dynamic memory pools. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_MEM_C__ +#define __VSI_MEM_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "string.h" + +#include "typedefs.h" +#include "vsi.h" +#include "os.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" + +#ifdef NU_DEBUG + #include "frame.h" +#endif + +#ifdef MEMORY_SUPERVISION + #include "tools.h" +#endif + +/*==== CONSTANTS ==================================================*/ + +#ifndef RUN_INT_RAM +char const *waited_str = "Waited for partition"; +char const *bigger_str = "Bigger partition allocated than requested"; +char const *free_str = "Partition Deallocation failed"; +#else +extern char const *waited_str; +extern char const *bigger_str; +extern char const *free_str; +#endif + +#ifdef NU_DEBUG +extern char const *freed_str; +#endif + +/*==== TYPES ======================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +#if !defined (_TOOLS_) && !defined (_LINUX_) && !defined (_SOLARIS_) +extern const T_FRM_PARTITION_GROUP_CONFIG partition_grp_config[]; +#endif + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM + char init_partition_memory = DISABLE_PARTITON_INIT; + char init_partition_pattern = 0; + T_HANDLE vsi_m_sem_handle = VSI_ERROR; +#else + extern char init_partition_memory; + extern char init_partition_pattern; + extern T_HANDLE vsi_m_sem_handle; +#endif + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_new | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a partition of a pool defined by the parameter type + +*/ + +T_VOID_STRUCT * vsi_m_new (ULONG Size, ULONG type FILE_LINE_TYPE) +{ +LONG Status; +T_VOID_STRUCT *prim; +OS_HANDLE pool; +T_HANDLE Caller; +ULONG flags; +ULONG suspend; + + Caller = 0; + + pool = type & VSI_MEM_POOL_MASK; + flags = type & VSI_MEM_FLAG_MASK; + + if ( flags & VSI_MEM_NON_BLOCKING ) + suspend = OS_NO_SUSPEND; + else + suspend = OS_SUSPEND; + + Status = os_AllocatePartition ( Caller, &prim, Size, suspend, pool ); + + switch ( Status ) + { + case OS_OK: + break; + case OS_WAITED: +#ifdef NU_DEBUG + Caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_WAIT_PARTITION, "%s %s, entity %s, Size %d, %s(%d)", + syst_wrn, waited_str, pf_TaskTable[Caller].Name, Size FILE_LINE_MACRO_PASSED ); +#endif + break; + case OS_ERROR: + case OS_TIMEOUT: + if ( !(flags & VSI_MEM_NON_BLOCKING) ) + { + /* fatal error for blocking allocation and 'HISR' caller */ + Caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR_NO_PARTITION FILE_LINE_MACRO_PASSED, + "No Partition available, entity %s, size %d", + pf_TaskTable[Caller].Name, Size ); + } + return NULL; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + case OS_ALLOCATED_BIGGER: +#ifdef NU_DEBUG + Caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_BIG_PARTITION, "%s %s, entity %s, Size %d, %s(%d)", + syst_wrn, bigger_str, pf_TaskTable[Caller].Name, Size FILE_LINE_MACRO_PASSED ); +#endif + break; + default: + return NULL; + /*lint -e527 suppress Warning -- Unreachable */ + break; + /*lint +e527 */ + } + + prim = prim + PPM_OFFSET; + + if ( init_partition_memory ) + { + memset( (char*)prim, init_partition_pattern, (unsigned int)Size ); + } +#ifdef MEMORY_SUPERVISION + /* + * Pools registered via vsi_m_register_pool() cannot be handle by the partition supervision. The + * id therefor is set to 0, to allow the supervision functions to ignore them. + */ + if ( pool == DmemGroupHandle ) + { + /* for primitive vsi_ppm_new() is called after the opc has been entered in the header */ + Caller = e_running[os_MyHandle()]; + vsi_ppm_new ( Caller, Size, (T_PRIM_HEADER*)prim, file, line ); + } +#endif /* MEMORY_SUPERVISION */ + + return prim; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_new_size | ++--------------------------------------------------------------------+ + + PURPOSE : allocate partition and retern partition size + +*/ +T_VOID_STRUCT *vsi_m_new_size ( ULONG size, ULONG type, + ULONG *partition_size FILE_LINE_TYPE) +{ +T_FRM_PARTITION_POOL_CONFIG * pool_config; +T_VOID_STRUCT *prim; + + if ( ( prim = vsi_m_new ( size, type FILE_LINE ) ) != NULL ) + { +#if defined (_TOOLS_) || defined (_LINUX_) || defined (_SOLARIS_) + *partition_size = size; +#else + pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[PrimGroupHandle].grp_config; + while ( pool_config != NULL ) + { + if ( size <= pool_config->part_size ) + { + *partition_size = pool_config->part_size; + break; + } + else + { + pool_config++; + } + } +#endif + } + return (prim); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_free | ++--------------------------------------------------------------------+ + + PURPOSE : deallocate a partition + +*/ + +int vsi_m_free (T_VOID_STRUCT **Msg FILE_LINE_TYPE) +{ +T_HANDLE Caller; +#ifdef MEMORY_SUPERVISION + Caller = e_running[os_MyHandle()]; + vsi_ppm_free ( Caller, (T_PRIM_HEADER*)*Msg, file, line ); +#endif + + Caller = 0; + if ( os_DeallocatePartition ( Caller, *Msg - PPM_OFFSET ) != OS_ERROR ) + { + *Msg = NULL; + return VSI_OK; + } +#ifdef NU_DEBUG + Caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_FREE_FAILED, "%s %s in %s, %s(%d)", + syst_wrn, free_str, pf_TaskTable[Caller].Name FILE_LINE_MACRO_PASSED ); +#endif + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_cnew | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a memory with reference counter + +*/ + +T_VOID_STRUCT * vsi_m_cnew (ULONG size, ULONG type FILE_LINE_TYPE) +{ +T_M_HEADER *mem; +#ifdef MEMORY_SUPERVISION +T_HANDLE caller; +#endif + + if ( (mem = (T_M_HEADER*)vsi_m_new ( size+sizeof(T_M_HEADER), type FILE_LINE )) != NULL ) + { + /* set reference counter */ + mem->ref_cnt = 1; + /* set descriptor type */ + mem->desc_type = (SHORT)((type & VSI_MEM_DESC_MASK) >> 16); + /* return pointer to user data */ +#ifdef MEMORY_SUPERVISION + caller = e_running[os_MyHandle()]; + vsi_ppm_new ( caller, size+sizeof(T_M_HEADER), (T_PRIM_HEADER*)mem, file, line ); +#endif + return (T_VOID_STRUCT*)(mem + 1); + } + else + { + return NULL; + } + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_cfree | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a memory with reference counter + +*/ + +int vsi_m_cfree (T_VOID_STRUCT **ptr FILE_LINE_TYPE) +{ +T_HANDLE caller = 0; +LONG sts; +T_M_HEADER *mem; + + /* get pointer to start of partition. Here is the reference counter */ + mem = (T_M_HEADER*)*ptr - 1; + +#ifdef NU_DEBUG + if ( os_is_valid_partition ((T_VOID_STRUCT*)mem) ) + { + /* free to non-partition memory */ + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "MFREE to non-partition memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, *ptr ); + return VSI_ERROR; + } +#endif + + sts = os_ObtainSemaphore (caller, vsi_m_sem_handle, OS_SUSPEND); + if ( sts == OS_ERROR || sts == OS_TIMEOUT ) + { + /* Semaphore invalid or overrun */ + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[caller].Name ); + return VSI_ERROR; + } + if ( mem->ref_cnt <= 0 ) + { +#ifdef NU_DEBUG + /* partition already freed */ + caller = e_running[os_MyHandle()]; + pf_handle_warning ( OS_SYST_WRN_MULTIPLE_FREE, "%s %s in %s, %s(%d)", + syst_wrn, freed_str, pf_TaskTable[caller].Name FILE_LINE_MACRO_PASSED ); +#endif + os_ReleaseSemaphore (caller, vsi_m_sem_handle); + return VSI_OK; + } + if ( --(mem->ref_cnt) == 0 ) + { +#ifdef _NUCLEUS_ +#ifdef NU_DEBUG + + if ( os_PartitionCheck( (ULONG*)mem ) == OS_PARTITION_GUARD_PATTERN_DESTROYED ) + { + caller = e_running[os_MyHandle()]; + os_ReleaseSemaphore (caller, vsi_m_sem_handle); + vsi_o_assert ( caller, OS_SYST_ERR_PCB_PATTERN FILE_LINE_MACRO_PASSED, + "Partition Guard Pattern destroyed (MFREE),Task %s,Partition 0x%x", + pf_TaskTable[caller].Name, mem ); + return VSI_ERROR; + } +#endif +#endif + if (vsi_m_free ( (T_VOID_STRUCT**)&mem FILE_LINE ) != VSI_OK) + { + os_ReleaseSemaphore (caller, vsi_m_sem_handle); + return VSI_ERROR; + } + + *ptr=NULL; + } + os_ReleaseSemaphore (caller, vsi_m_sem_handle); + return VSI_OK; + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_cfree | ++--------------------------------------------------------------------+ + + PURPOSE : allocate a memory with reference counter + +*/ + +int vsi_m_attach (T_VOID_STRUCT *ptr FILE_LINE_TYPE) +{ +T_HANDLE caller = 0; +LONG sts; +T_M_HEADER *mem; + + /* get pointer to start of partition. Here is the reference counter */ + mem = (T_M_HEADER*)ptr - 1; + +#ifdef NU_DEBUG + if ( os_is_valid_partition ((T_VOID_STRUCT*)mem) ) + { + /* attach to non-partition memory */ + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "MATTACH to non-partition memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, ptr ); + } +#endif + sts = os_ObtainSemaphore (caller, vsi_m_sem_handle, OS_SUSPEND); + if ( sts == OS_ERROR || sts == OS_TIMEOUT ) + { + /* Semaphore invalid or overrun */ + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "Ref Cnt Semaphore overrun, entity %s", pf_TaskTable[caller].Name ); + } + if ( mem->ref_cnt <= 0 ) + { + /* attach to non allocated memory */ + caller = e_running[os_MyHandle()]; + vsi_o_assert ( NO_TASK, OS_SYST_ERR FILE_LINE_MACRO_PASSED, + "MATTACH to free memory, entity %s, ptr 0x%x", pf_TaskTable[caller].Name, ptr ); + } + else + { + /* increment reference counter */ + mem->ref_cnt++; + } + os_ReleaseSemaphore (caller, vsi_m_sem_handle); + return VSI_OK; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_status | ++--------------------------------------------------------------------+ + + PURPOSE : retrieve number of used/available partitions + +*/ + +GLOBAL int vsi_m_status ( T_HANDLE caller, ULONG size, USHORT type, USHORT *free, USHORT *alloc ) +{ +#ifdef _NUCLEUS_ +OS_HANDLE pool; + + pool = type & VSI_MEM_POOL_MASK; + + if ( os_GetPartitionPoolStatus ( size, pool, free, alloc ) == OS_OK ) + return VSI_OK; + else +#endif + return VSI_ERROR; +} +#endif + +#ifndef _TOOLS_ +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_register_pool | ++--------------------------------------------------------------------+ + + PURPOSE : register a new partition pool group to be accessable via VSI + +*/ + +GLOBAL int vsi_m_register_pool ( char * name, T_HANDLE * pool_gr_id ) +{ +OS_HANDLE pool_gr; + + if ( os_GetPartitionGroupHandle (OS_NOTASK, name, &pool_gr) == OS_OK ) + { + *pool_gr_id = (T_HANDLE)pool_gr; + return VSI_OK; + } + else + { + return VSI_ERROR; + } +} +#endif +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MEM | +| STATE : code ROUTINE : vsi_m_init | ++--------------------------------------------------------------------+ + + PURPOSE : retrieve number of used/available partitions + +*/ + +GLOBAL int vsi_m_init ( char enable_init, char pattern ) +{ + + init_partition_memory = enable_init; + init_partition_pattern = pattern; + os_CreateSemaphore ( 0, (char*)"VSI_MSEM", 1, &vsi_m_sem_handle, 0 ); + + return VSI_OK; +} +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_mis.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,241 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_mis.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for miscellaneous things. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_MIS_C__ +#define __VSI_MIS_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include <string.h> + +#include "typedefs.h" + +#include "vsi.h" +#include "os.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + + +/*==== VARIABLES ==================================================*/ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_gettaskname | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +int vsi_gettaskname (T_HANDLE Caller, T_HANDLE Handle, char *Name) +{ + + if ( os_GetTaskName ( Caller, Handle, Name ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_gettaskhandle | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +T_HANDLE vsi_gettaskhandle (T_HANDLE Caller, char *Name) +{ +OS_HANDLE Handle; + + if (os_GetTaskHandle( Caller, Name, &Handle ) != OS_ERROR ) + { + return Handle; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_gettaskflags | ++--------------------------------------------------------------------+ + + PURPOSE : reads the flags of a task + +*/ + +int vsi_gettaskflags (T_HANDLE Caller, T_HANDLE Handle, U32 *Flags) +{ + + *Flags = pf_TaskTable[Handle].Flags; + return VSI_OK; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_time | ++--------------------------------------------------------------------+ + + PURPOSE : get time + +*/ + +int vsi_t_time (T_HANDLE Caller, T_TIME *Value) +{ + + os_GetTime ( Caller, Value ); + return VSI_OK; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_sleep | ++--------------------------------------------------------------------+ + + PURPOSE : suspend task + +*/ + +int vsi_t_sleep (T_HANDLE Caller, T_TIME Value) +{ + + os_SuspendTask ( Caller, Value ); + return VSI_OK; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_MIS | +| STATE : code ROUTINE : vsi_object_info | ++--------------------------------------------------------------------+ + + PURPOSE : read information about created objects + +*/ +int vsi_object_info (T_HANDLE Caller, USHORT Id, USHORT Index, char *Buffer, USHORT Size) +{ + if ( os_ObjectInformation ( Caller, Id, Index, Size, Buffer ) == OS_OK ) + { + if ( strlen (Buffer) > TTRACE_LEN ) + vsi_o_assert ( NO_TASK, OS_SYST_ERR_STR_TOO_LONG, __FILE__, __LINE__, + "Traced string too long" ); + return VSI_OK; + } + return VSI_ERROR; + +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_name | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +int vsi_e_name (T_HANDLE Caller, T_HANDLE Handle, char *Name) +{ + if ( Handle >= 0 && Handle <= MaxEntities && pf_TaskTable[Handle].Name[0] != 0 ) + { + strcpy ( Name, pf_TaskTable[Handle].Name ); + return VSI_OK; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_handle | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +T_HANDLE vsi_e_handle (T_HANDLE Caller, char *Name) +{ +T_HANDLE e_handle; + + if ( Name == NULL ) + { + return e_running[os_MyHandle()]; + } + else + { + for ( e_handle = MaxEntities; e_handle > 0; e_handle-- ) + { + if ( pf_TaskTable[e_handle].Name[0] != 0 && !strncmp ( pf_TaskTable[e_handle].Name, Name, RESOURCE_NAMELEN-1 ) ) + return e_handle; + } + } + return VSI_ERROR; +} +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_ppm.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,1153 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_ppm.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for the primitive partition pool supervision. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_PPM_C__ +#define __VSI_PPM_C__ +#endif + +#ifdef MEMORY_SUPERVISION + +/*==== INCLUDES ===================================================*/ + +#include "string.h" +#include "typedefs.h" +#include "os.h" +#include "vsi.h" +#include "tools.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" + +/*==== TYPES ======================================================*/ + +typedef struct +{ + USHORT pool_nr; + USHORT group_nr; +} T_POOL_GROUP; + +typedef struct +{ + SHORT state_id; + char const * state_name; +} T_PARTITION_STATE; +/* + * indices to read the stored counters + */ +typedef enum { TOTAL,CURRENT_BYTE,CURRENT_PART,MAX_RANGES,MAX_BYTE_MEM,MAX_PART_MEM } T_COUNTER_READ; + +/* + * indices to update the counters + */ +typedef enum { DECREMENT, INCREMENT, STORE_MAX_BYTE, STORE_MAX_PART } T_COUNTER_UPDATE; + +/*==== CONSTANTS ==================================================*/ + +#define OWNER_IS_COM_HANDLE 0x8000 +/* + * Partition States + */ +#define PARTITION_FREED 0x0001 +#define PARTITION_ALLOCATED 0x0002 +#define PARTITION_RECEIVED 0x0004 +#define PARTITION_SENT 0x0008 +#define PARTITION_REUSED 0x0010 +#define PARTITION_ACCESSED 0x0020 +#define PARTITION_STORED 0x0040 +#define MAX_PARTITION_STATE 7 + +#define ALLOWED_ALLOCATE_STATES (PARTITION_FREED) +#define ALLOWED_RECEIVE_STATES (PARTITION_SENT|PARTITION_RECEIVED) +#define ALLOWED_SEND_STATES (PARTITION_ALLOCATED|PARTITION_REUSED|\ + PARTITION_RECEIVED|PARTITION_ACCESSED|\ + PARTITION_STORED) +#define ALLOWED_REUSE_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\ + PARTITION_STORED|PARTITION_REUSED) +#define ALLOWED_DEALLOCATE_STATES (PARTITION_RECEIVED|PARTITION_ALLOCATED|\ + PARTITION_SENT|PARTITION_REUSED|\ + PARTITION_ACCESSED|PARTITION_STORED) +#define ALLOWED_ACCESS_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\ + PARTITION_REUSED|PARTITION_ACCESSED|\ + PARTITION_STORED) +#define ALLOWED_STORE_STATES (PARTITION_ALLOCATED|PARTITION_RECEIVED|\ + PARTITION_REUSED|PARTITION_ACCESSED|\ + PARTITION_SENT) + +#define FORBIDDEN_ALLOCATE_STATES (0xffff&~ALLOWED_ALLOCATE_STATES) +#define FORBIDDEN_RECEIVE_STATES (0xffff&~ALLOWED_RECEIVE_STATES) +#define FORBIDDEN_SEND_STATES (0xffff&~ALLOWED_SEND_STATES) +#define FORBIDDEN_REUSE_STATES (0xffff&~ALLOWED_REUSE_STATES) +#define FORBIDDEN_DEALLOCATE_STATES (0xffff&~ALLOWED_DEALLOCATE_STATES) +#define FORBIDDEN_ACCESS_STATES (0xffff&~ALLOWED_ACCESS_STATES) +#define FORBIDDEN_STORE_STATES (0xffff&~ALLOWED_STORE_STATES) + +#define PPM_END_MARKER ((char)0xff) + +#define PARTITION_SIZE(g,p) (partition_grp_config[g].grp_config[p].part_size) + +#ifndef RUN_INT_RAM +const T_PARTITION_STATE partition_state[MAX_PARTITION_STATE+1] = +{ + { PARTITION_FREED, "FREED" }, + { PARTITION_ALLOCATED, "ALLOCATED" }, + { PARTITION_RECEIVED, "RECEIVED" }, + { PARTITION_SENT, "SENT" }, + { PARTITION_REUSED, "REUSED" }, + { PARTITION_ACCESSED, "ACCESSED" }, + { PARTITION_STORED, "STORED" }, + { 0, NULL } +}; +#endif + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +extern T_HANDLE TST_Handle; +extern const T_FRM_PARTITION_GROUP_CONFIG partition_grp_config[]; +extern T_HANDLE * PoolGroupHandle []; +extern OS_HANDLE ext_data_pool_handle; +extern USHORT MaxPoolGroups; + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM + +USHORT NumberOfPPMPartitions = 0; +USHORT NumOfPPMPools = 0; +USHORT NumOfPPMGroups; +USHORT NumOfPrimPools; +USHORT NumOfDmemPools; +T_PARTITION_POOL_STATUS PoolStatus; +T_PARTITION_STATUS *PartitionStatus; +T_OVERSIZE_STATUS *PartitionOversize; +T_COUNTER *PartitionCounter; +T_POOL_GROUP *PoolGroup; +#ifdef OPTIMIZE_POOL +T_COUNTER *ByteCounter; +T_COUNTER *RangeCounter; +int *GroupStartRange; +int *GroupStartCnt; +#endif /* OPTIMIZE_POOL */ +int ppm_check_partition_owner; + +#else /* RUN_INT_RAM */ + +extern int ppm_check_partition_owner; +extern T_PARTITION_POOL_STATUS PoolStatus; +extern T_POOL_GROUP * PoolGroup; +extern USHORT NumOfPrimPools; +extern USHORT NumOfDmemPools; +extern int *GroupStartRange; + +#endif /* RUN_INT_RAM */ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + +GLOBAL void SetPartitionStatus ( T_PARTITION_STATUS *pPoolStatus, const char *file, int line, + ULONG opc, USHORT Status, T_HANDLE owner ); + +USHORT update_dyn_state ( T_HANDLE Caller, T_PRIM_HEADER *prim, T_HANDLE owner, USHORT state, const char* file, int line ); +BOOL UpdatePoolCounter ( T_COUNTER *pCounter, T_COUNTER_UPDATE Status, ULONG Value ); +void StoreRangeCounters ( T_PRIM_HEADER *prim, T_COUNTER_UPDATE Status ); +int GetPartitionRange ( ULONG size, USHORT group_nr, USHORT pool_nr ); +LONG get_partition_group ( T_PRIM_HEADER *prim, USHORT *group_nr, USHORT *pool_nr ); +char const *get_partition_state_name ( USHORT partition_state ); + + +#ifndef RUN_FLASH +USHORT update_dyn_state ( T_HANDLE Caller, T_PRIM_HEADER *prim, T_HANDLE owner, USHORT state, const char* file, int line ) +{ +T_desc *desc; +T_desc3 *desc3; +T_M_HEADER *mem; +T_DP_HEADER *dp_hdr; +USHORT ret = TRUE; + + if ( prim->dph_offset != 0 ) + { + dp_hdr = (T_DP_HEADER*)((ULONG*)prim + prim->dph_offset); + if ( *((ULONG*)dp_hdr) == GUARD_PATTERN ) + { + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + while (dp_hdr != NULL) + { + SetPartitionStatus ( &PoolStatus.PartitionStatus [ P_PNR(dp_hdr) ], file, line, P_OPC(prim), state, owner ); + dp_hdr = (T_DP_HEADER*)dp_hdr->next; + } + } + else + { + if ( Caller != TST_Handle ) + { + /* do not check and update the states of the primitives in descriptor lists when called by TST, because + descriptor lists are not routed to TST and will result in the warning generated below */ + desc = (T_desc*)(((T_desc_list*)dp_hdr)->first); + while (desc != NULL) + { +#ifdef _NUCLEUS_ + if ( *(((ULONG*)desc)-4) == 0 ) +#endif + { + mem = ((T_M_HEADER*)desc)-1; + SetPartitionStatus ( &PoolStatus.PartitionStatus [P_PNR(mem)], file, line, P_OPC(prim), state, owner ); + if ( mem->desc_type == (VSI_DESC_TYPE3 >> 16) ) + { + desc3 = (T_desc3*)desc; + mem = ((T_M_HEADER*)desc3->buffer)-1; + SetPartitionStatus ( &PoolStatus.PartitionStatus [P_PNR(mem)], file, line, P_OPC(prim), state, owner ); + } + } +#ifdef _NUCLEUS_ + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: FREED PARTITION 0x%lx IN DESCLIST, %s(%d)", prim,rm_path(file),line ); +#endif + desc = (T_desc *)desc->next; + } + } + } + } + else + ret = FALSE; + return ret; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : get_partition_state_name| ++------------------------------------------------------------------------+ + + PURPOSE : update counter. + +*/ +char const *get_partition_state_name ( USHORT state ) +{ +USHORT i = 0; + + while ( partition_state[i].state_id ) + { + if ( partition_state[i].state_id == state ) + return partition_state[i].state_name; + i++; + } + return NULL; +} +#endif + +#ifndef RUN_FLASH +/* ++----------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : check_partition_group | ++----------------------------------------------------------------------+ + + PURPOSE : update counter. + +*/ +LONG get_partition_group ( T_PRIM_HEADER *prim, USHORT *group_nr, USHORT *pool_nr ) +{ +SHORT invalid_pool = 0; +T_HANDLE Caller; + + *pool_nr = PoolGroup [ (USHORT)(P_PGR(prim)) ].pool_nr; + *group_nr = PoolGroup [ (USHORT)(P_PGR(prim)) ].group_nr; + + if ( *group_nr > MaxPoolGroups ) + invalid_pool = 1; + + if ( *group_nr == PrimGroupHandle ) + { + if ( *pool_nr > NumOfPrimPools ) + invalid_pool = 1; + } + else if ( *group_nr == DmemGroupHandle ) + { + if ( *pool_nr > NumOfDmemPools ) + invalid_pool = 1; + } + + if ( invalid_pool == 1 ) + { + Caller = e_running[os_MyHandle()]; + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: Invalid Partition Pool, group: %d, pool: %d", *group_nr, *pool_nr ); + return VSI_ERROR; + } + + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : GetPartitionRange | ++--------------------------------------------------------------------+ + + PURPOSE : update counter. + +*/ +int GetPartitionRange ( ULONG size, USHORT group_nr, USHORT pool_nr ) +{ +int partition_range; +int size_offset; +int range; + + if ( pool_nr != 0 ) + { + partition_range = (int)(PARTITION_SIZE(group_nr,pool_nr) - PARTITION_SIZE(group_nr,pool_nr-1)); + + size_offset = (int)(size - (USHORT)(PARTITION_SIZE(group_nr,pool_nr-1)) - 1); + if ( size_offset < 0 ) + size_offset = 0; + } + else + { + partition_range = (USHORT)(PARTITION_SIZE(group_nr,pool_nr)); + if ( size == 0 ) + size_offset = 0; + else + size_offset = (int)(size - 1); + } + + range = (USHORT)((size_offset * RANGES_PER_POOL)/partition_range + pool_nr * RANGES_PER_POOL + GroupStartRange[group_nr]); + + return range; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : UpdatePoolCounter | ++--------------------------------------------------------------------+ + + PURPOSE : update counter. + +*/ +BOOL UpdatePoolCounter ( T_COUNTER *pCounter, T_COUNTER_UPDATE Status, ULONG Value ) +{ + + switch ( Status ) + { + case INCREMENT: + pCounter->Total += Value; /* total number */ + pCounter->Current += Value; /* current number */ + if ( pCounter->Current > pCounter->Maximum ) /* current > maximum ? */ + { + pCounter->Maximum = pCounter->Current; /* Maximum = Current */ + return TRUE ; + } + break; + case DECREMENT: + pCounter->Current -= Value; /* current number */ + break; + case STORE_MAX_BYTE: + pCounter->MaxByteMemory = pCounter->Current; /* store current number */ + break; + case STORE_MAX_PART: + pCounter->MaxPartMemory = pCounter->Current; /* store current number */ + break; + } + return FALSE; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : SetPartitionStatus | ++--------------------------------------------------------------------+ + + PURPOSE : update the status of the partition. + +*/ +GLOBAL void SetPartitionStatus ( T_PARTITION_STATUS *pPoolStatus, const char *file, int line, ULONG opc, USHORT Status, T_HANDLE owner ) +{ + + pPoolStatus->Status = Status; + pPoolStatus->PrimOPC = opc; + pPoolStatus->owner = owner; + if ( Status NEQ PARTITION_FREED ) + { + os_GetTime (0,&pPoolStatus->time); + pPoolStatus->Userfile = file; + pPoolStatus->Line = line; + } +} +#endif + +#ifdef OPTIMIZE_POOL +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : StoreRangeCounters | ++--------------------------------------------------------------------+ + + PURPOSE : stores the range counters for a specified partition. + +*/ +void StoreRangeCounters ( T_PRIM_HEADER *prim, T_COUNTER_UPDATE Status ) +{ +USHORT i; + + for ( i=0; i<5; i++ ) + UpdatePoolCounter ( &PoolStatus.RangeCounter [ P_PGR(prim)*5+i ], Status,0 ); +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : TracePoolStatistic | ++--------------------------------------------------------------------+ + + PURPOSE : send the statistic information specified by the parameters + to the tst interface. + +*/ +LOCAL void TracePoolStatistic ( T_HANDLE Caller, USHORT group_nr, USHORT pool_nr, char const *Src, + T_COUNTER_READ Status ) +{ +#define RNG_COUNT_IDX(g,p,i) (GroupStartRange[g]+p*RANGES_PER_POOL+i) +#define COUNT_IDX(g,p) (GroupStartCnt[g]+p) +T_FRM_PARTITION_POOL_CONFIG * pool_config; +ULONG Value1; +ULONG Value2; +char const *Resource; +BOOL TraceRange = FALSE; +BOOL TraceValue = FALSE; +ULONG Value[5]; +int i; + + pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[group_nr].grp_config + pool_nr; + + switch ( Status ) + { + case TOTAL: + TraceRange = TRUE; + for ( i = 0; i < RANGES_PER_POOL; i++ ) + Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].Total; + break; + case CURRENT_BYTE: + TraceValue = TRUE; + Resource = "max bytes "; + Value1 = PoolStatus.ByteCounter [ COUNT_IDX(group_nr,pool_nr) ].Current; + Value2 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Current * pool_config->part_size; + break; + case CURRENT_PART: + TraceValue = TRUE; + Resource = "part"; + Value1 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Current; + Value2 = pool_config->part_num; + + break; + case MAX_RANGES: + TraceRange = TRUE; + for ( i = 0; i < RANGES_PER_POOL; i++ ) + Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].Maximum; + break; + case MAX_BYTE_MEM: + TraceRange = TRUE; + TraceValue = TRUE; + Resource = "bytes "; + Value1 = PoolStatus.ByteCounter [COUNT_IDX(group_nr,pool_nr)].Maximum; + Value2 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].MaxByteMemory * pool_config->part_size; + for ( i = 0; i < RANGES_PER_POOL; i++ ) + Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].MaxByteMemory; + break; + case MAX_PART_MEM: + TraceRange = TRUE; + TraceValue = TRUE; + Resource = "partitions"; + Value1 = PoolStatus.PartitionCounter [COUNT_IDX(group_nr,pool_nr)].Maximum; + Value2 = pool_config->part_num; + for ( i = 0; i < RANGES_PER_POOL; i++ ) + Value[i] = PoolStatus.RangeCounter [ RNG_COUNT_IDX(group_nr,pool_nr,i) ].MaxPartMemory; + break; + default: + break; + } + + /*lint -e644, suppress Warning -- Variable may not have been initialized */ + if ( TraceValue ) + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: %s pool %d:%5d %s =>%3d%%", + Src, pool_nr, Value1, Resource, (Value1*100)/(Value2==0?1:Value2) ); + + if ( TraceRange ) + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: %s partitions pool %d: %3d, %3d, %3d, %3d, %3d",Src, pool_nr, + Value[0],Value[1],Value[2],Value[3],Value[4]); + /*lint +e644 */ + +} +#endif +#endif /* OPTIMIZE_POOL */ + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : TracePoolStatus | ++--------------------------------------------------------------------+ + + PURPOSE : send the statistic information to the test interface. + +*/ +GLOBAL void TracePoolstatus ( T_HANDLE Caller ) +{ +T_PARTITION_STATUS *pPoolStatus; +T_FRM_PARTITION_POOL_CONFIG * pool_config; +USHORT i, m; +USHORT group_nr, pool_nr; +USHORT PartitionError = FALSE, OversizeError = FALSE; +T_OVERSIZE_STATUS *pOversizeStatus; +T_HANDLE owner; +char *opc; + + pOversizeStatus = &PoolStatus.PartitionOversize[0]; + pPoolStatus = &PoolStatus.PartitionStatus [0]; + for ( i = 0; i < NumberOfPPMPartitions; i++ ) + { + if ( pPoolStatus->Status > 0 && pPoolStatus->Status NEQ PARTITION_FREED ) + { + if ( pPoolStatus->owner & OWNER_IS_COM_HANDLE ) + owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE; + else + owner = pPoolStatus->owner; + + if ( pPoolStatus->PrimOPC && ( ((T_PRIM_HEADER*)pPoolStatus->ptr)->opc != pPoolStatus->PrimOPC ) ) + opc = "in desclist of OPC"; + else + opc = "OPC"; + get_partition_group ( pPoolStatus->ptr, &group_nr, &pool_nr ); + + pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[group_nr].grp_config + pool_nr; + + vsi_o_ttrace ( Caller, TC_SYSTEM, "POOL%d%d(%s), PARTITION 0x%lx(%d), %s 0x%lx, \ +%s, %s, TIME %d, %s(%d)", group_nr,pool_nr,partition_grp_config[group_nr].name, pPoolStatus->ptr,pool_config->part_size, + opc, pPoolStatus->PrimOPC, get_partition_state_name(pPoolStatus->Status), pf_TaskTable[owner].Name, pPoolStatus->time, + rm_path(pPoolStatus->Userfile), pPoolStatus->Line); + PartitionError = TRUE; + } + pPoolStatus++; + } + + for (m = 0; partition_grp_config[m].grp_config != NULL; m++ ) + { + if ( strcmp ("TEST", partition_grp_config[m].name ) ) + { + vsi_o_ttrace ( Caller, TC_SYSTEM, "---------------------------------------------------------" ); + vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: POOL NAME: %s", partition_grp_config[m].name ); + pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[m].grp_config; + for ( i = 0; pool_config != NULL; i++) + { + if ( pool_config->part_size ) + { +#ifdef OPTIMIZE_POOL + vsi_o_ttrace ( Caller, TC_SYSTEM, "---------------------------------------------------------" ); + vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: POOL %d (size %d) ",i, pool_config->part_size ); + TracePoolStatistic ( Caller, m, i, "MAXBYTE ", MAX_BYTE_MEM ); + TracePoolStatistic ( Caller, m, i, "MAXPART ", MAX_PART_MEM ); + TracePoolStatistic ( Caller, m, i, "MAXRANGE", MAX_RANGES ); + TracePoolStatistic ( Caller, m, i, "TOTAL ", TOTAL ); +#endif /* OPTIMIZE_POOL */ + if ( pOversizeStatus->PrimOPC ) + { + vsi_o_ttrace ( Caller, TC_SYSTEM, "PPM: PARTITION OF SIZE %d USED BY OVERSIZED \ + PRIMITIVE %lx AT %s(%d)", pool_config->part_size, + pOversizeStatus->PrimOPC, rm_path(pOversizeStatus->Userfile), pPoolStatus->Line); + OversizeError = TRUE; + } + pOversizeStatus++; + } + else + { + break; + } + pool_config++; + } + if ( !PartitionError ) + vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: ALL PARTITIONS FREED" ); + if ( !OversizeError ) + vsi_o_ttrace ( Caller, TC_SYSTEM, "[PPM]: NO OVERSIZE ERRORS OCCURED" ); + } + } + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : InitializePPM | ++--------------------------------------------------------------------+ + + PURPOSE : initialize supervision, write index to each partition. + +*/ +void InitializePPM ( void ) +{ +T_FRM_PARTITION_POOL_CONFIG * pool_config; +ULONG *Prims; +USHORT i,j,k,m,n; +int status; +static int last_range = 0; +static int last_cnt = 0; + + status = os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&Prims, sizeof(int)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PoolGroup, sizeof(T_POOL_GROUP)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionStatus, sizeof(T_PARTITION_STATUS)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionOversize, sizeof(T_OVERSIZE_STATUS)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&PartitionCounter, sizeof(T_COUNTER)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle ); +#ifdef OPTIMIZE_POOL + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&ByteCounter, sizeof(T_COUNTER)*NumOfPPMPools, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&RangeCounter, sizeof(T_COUNTER)*NumberOfPPMPartitions, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&GroupStartRange, sizeof(int)*NumOfPPMGroups, OS_NO_SUSPEND, ext_data_pool_handle ); + status |= os_AllocateMemory (NO_TASK, (T_VOID_STRUCT**)&GroupStartCnt, sizeof(int)*NumOfPPMGroups, OS_NO_SUSPEND, ext_data_pool_handle ); +#endif + if ( status > 0 ) + { + vsi_o_assert ( 0, OS_SYST_ERR, __FILE__, __LINE__, "Memory allocation for partition supervision failed" ); + } + ppm_check_partition_owner = 0; + PoolStatus.PartitionStatus = PartitionStatus; + PoolStatus.PartitionOversize = PartitionOversize; + PoolStatus.PartitionCounter = PartitionCounter; +#ifdef OPTIMIZE_POOL + PoolStatus.ByteCounter = ByteCounter; + PoolStatus.RangeCounter = RangeCounter; +#endif + + for ( j = 0; j<NumberOfPPMPartitions; j++) + Prims[j] = 0; + + for (m = 0, j = 0, i = 0; partition_grp_config[m].grp_config != NULL; m++ ) + { + if ( strcmp ("TEST", partition_grp_config[m].name ) ) + { + pool_config = (T_FRM_PARTITION_POOL_CONFIG*)partition_grp_config[m].grp_config; + + for (n = 0; pool_config != NULL; i++, n++) + { + if ( pool_config->part_size ) + { + PoolGroup[i].group_nr = m; + PoolGroup[i].pool_nr = n; + for (k = 0; k < pool_config->part_num; k++ , j++) + { + if ( os_AllocatePartition ( NO_TASK, (T_VOID_STRUCT**)&Prims[j], pool_config->part_size, + OS_NO_SUSPEND, *PoolGroupHandle[m] ) == OS_OK ) + { + P_IDX((T_PRIM_HEADER*)(Prims[j]+PPM_IDX_OFFSET)) = ( ((USHORT)i<<16) | j ); + } + else + { + P_IDX((T_PRIM_HEADER*)(Prims[j]+PPM_IDX_OFFSET)) = 0; + } + } + } + else + { + break; + } + pool_config++; + } + if ( m == 0 ) + { + GroupStartCnt[m] = 0; + GroupStartRange[m] = 0; + last_cnt = n; + last_range = RANGES_PER_POOL * n; + } + else + { + GroupStartCnt[m] = last_cnt; + GroupStartRange[m] = last_range; + last_cnt = GroupStartCnt[m] + n; + last_range = GroupStartRange[m] + RANGES_PER_POOL * n; + } + + } + } + for ( j = 0; j<NumberOfPPMPartitions; j++) + { + if ( Prims[j] ) + { + os_DeallocatePartition ( NO_TASK, (T_VOID_STRUCT*)Prims[j] ); + PoolStatus.PartitionStatus [ P_PNR(Prims[j]+4) ].Status = PARTITION_FREED; + } + } +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_new | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of allocating a partition. + +*/ +GLOBAL void vsi_ppm_new ( T_HANDLE Caller, ULONG Size, T_PRIM_HEADER *prim, const char* file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + vsi_ppm_setend(prim, Size); + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + pPoolStatus->ptr = prim; + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_ALLOCATE_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_ALLOCATED),rm_path(file),line ); + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_ALLOCATED, Caller ); + +#ifdef OPTIMIZE_POOL + /* + * get primitive size and update range counter + */ + pPoolStatus->UsedSize = Size; + UpdatePoolCounter ( &PoolStatus.RangeCounter [GetPartitionRange(pPoolStatus->UsedSize,group_nr,pool_nr)], INCREMENT,1 ); +#endif /* OPTIMIZE_POOL */ + + /* + * update partition counter, if new maximum and OPTIMIZE_POOL, then + * - store the counters of the ranges within this partition + * - send a message that a new maximum has occurred + */ + if ( UpdatePoolCounter ( &PoolStatus.PartitionCounter [P_PGR(prim)],INCREMENT,1 ) ) +#ifndef OPTIMIZE_POOL + ; +#else + { + StoreRangeCounters ( prim, STORE_MAX_PART ); + } + + /* + * update byte counter, if new maximum, then + * - store the counters of the ranges within this partition + * - store the number of currently allocated partitions + */ + if ( UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],INCREMENT,pPoolStatus->UsedSize ) ) + { + StoreRangeCounters ( prim, STORE_MAX_BYTE ); + UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], STORE_MAX_BYTE,0 ); + } +#endif /* OPTIMIZE_POOL */ + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_rec | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of receiving a partition. + +*/ +GLOBAL void vsi_ppm_rec ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_RECEIVE_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_RECEIVED),rm_path(file),line ); + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_RECEIVED, Caller ); + update_dyn_state ( Caller, prim, Caller, PARTITION_RECEIVED, file, line ); + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_access | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of receiving a partition. + +*/ +GLOBAL void vsi_ppm_access ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_ACCESS_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_ACCESSED),rm_path(file),line ); + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), pPoolStatus->Status, Caller ); + update_dyn_state ( Caller, prim, Caller, PARTITION_ACCESSED, file, line ); + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_send | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of receiving a partition. + +*/ +GLOBAL void vsi_ppm_send ( T_HANDLE Caller, T_HANDLE rcv, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT NewStatus = PARTITION_SENT; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_SEND_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_SENT),rm_path(file),line ); + + /* + * check if more bytes written than requested during allocation + */ + if ( *((char*)prim + pPoolStatus->RequestedSize - 1) != PPM_END_MARKER ) + { + if ( prim->dph_offset == 0 ) + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, "SYSTEM WARNING: Bytes written > requested partition size, %s(%d)", rm_path(file), line ); + } + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), NewStatus, (T_HANDLE)(OWNER_IS_COM_HANDLE|rcv) ); + update_dyn_state ( Caller, prim, rcv, PARTITION_SENT, file, line ); + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_store | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of storing a partition. + +*/ +GLOBAL void vsi_ppm_store ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_STORE_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_STORED),rm_path(file),line ); + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), pPoolStatus->Status, Caller ); + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_reuse | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of reusing a partition. + +*/ +GLOBAL void vsi_ppm_reuse ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +ULONG OldSize, NewSize; +USHORT group_nr, pool_nr; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_REUSE_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_REUSED),rm_path(file),line ); + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, P_OPC(prim), PARTITION_REUSED, Caller ); + update_dyn_state ( Caller, prim, Caller, PARTITION_REUSED, file, line ); + /* + * if the new primitive exceeds the size of the partition, then + * - store file, line and primitive opc + * - send an error message + */ +#if 0 + if ( (ULONG)(P_LEN(prim)) > PoolGroupConfig[PrimGroupHandle]->PoolConfig[P_PGR(prim)].PartitionSize ) + { + PoolStatus.PartitionOversize [P_PGR(prim)].Userfile = file; + PoolStatus.PartitionOversize [P_PGR(prim)].Line = line; + PoolStatus.PartitionOversize [P_PGR(prim)].PrimOPC = P_OPC(prim); + vsi_o_assert (NO_TASK, OS_SYST_ERR_OVERSIZE, file, line, "PREUSE - oversize error in %s", + pf_TaskTable[Caller].Name ); + } +#endif +#ifdef OPTIMIZE_POOL + /* + * if the old and new primitve have different sizes, then + * - decrement byte counter by old size + * - decrement old range counter + * - increment new range counter + * - increment byte counter by new size + */ + if ( (OldSize=pPoolStatus->UsedSize) NEQ (NewSize=P_LEN(prim)) ) + { + UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],DECREMENT,OldSize ); + UpdatePoolCounter ( &PoolStatus.RangeCounter [ GetPartitionRange(OldSize,group_nr,pool_nr) ], DECREMENT, 1 ); + UpdatePoolCounter ( &PoolStatus.RangeCounter [ GetPartitionRange(NewSize,group_nr,pool_nr) ], INCREMENT, 1 ); + pPoolStatus->UsedSize = NewSize; + if ( UpdatePoolCounter ( &PoolStatus.ByteCounter [P_PGR(prim)],INCREMENT,NewSize ) ) + { + StoreRangeCounters ( prim, STORE_MAX_BYTE ); + UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], STORE_MAX_BYTE,0 ); + } + } +#endif /* OPTIMIZE_POOL */ + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PPM | +| STATE : code ROUTINE : vsi_ppm_free | ++--------------------------------------------------------------------+ + + PURPOSE : supervision of deallocating a partition. + +*/ +GLOBAL void vsi_ppm_free ( T_HANDLE Caller, T_PRIM_HEADER *prim, const char *file, int line ) +{ +T_PARTITION_STATUS *pPoolStatus; +USHORT group_nr, pool_nr; +T_HANDLE owner; + + if ( prim != NULL ) + { + if ( get_partition_group ( prim, &group_nr, &pool_nr ) == VSI_OK ) + { + Caller = e_running[os_MyHandle()]; + prim->opc = 0; + /* + * set pointer to status entry of the currently used partition + */ + pPoolStatus = &PoolStatus.PartitionStatus [ P_PNR(prim) ]; + + /* + * send error message in case of an illegal state transition + */ + if ( pPoolStatus->Status & FORBIDDEN_DEALLOCATE_STATES ) + vsi_o_ttrace (Caller, TC_SYSTEM, + "[PPM]: %s->%s: %s(%d)", get_partition_state_name(pPoolStatus->Status), + get_partition_state_name(PARTITION_FREED),file,line ); + + + /* CURRENTLY DISABLED FOR UMTS RELEASE */ + if ( pPoolStatus->owner & OWNER_IS_COM_HANDLE ) + { + owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE; + vsi_o_ttrace (NO_TASK, TC_SYSTEM, + "SYSTEM WARNING: %s freed partition stored in %s queue, %s(%d)", + pf_TaskTable[Caller].Name,pf_TaskTable[owner].Name,rm_path(file),line ); + } + if ( ppm_check_partition_owner == 1 ) + { + if ( (pPoolStatus->owner & ~OWNER_IS_COM_HANDLE) != Caller ) + { + owner = pPoolStatus->owner&~OWNER_IS_COM_HANDLE; + vsi_o_ttrace (NO_TASK, TC_SYSTEM, + "SYSTEM WARNING: %s freed partition belonging to %s, %s(%d)", + pf_TaskTable[Caller].Name,pf_TaskTable[owner].Name,rm_path(file),line ); + } + } + + if ( !(pPoolStatus->Status & PARTITION_FREED) ) + { +#ifdef OPTIMIZE_POOL + /* + * decrement byte counter by primitive size + * decrement range counter + * decrement partition counter + */ + UpdatePoolCounter ( &PoolStatus.ByteCounter [ P_PGR(prim) ], DECREMENT, pPoolStatus->UsedSize ); + UpdatePoolCounter ( &PoolStatus.RangeCounter [GetPartitionRange(pPoolStatus->UsedSize,group_nr,pool_nr)], DECREMENT, 1 ) ; +#endif /* OPTIMIZE_POOL */ + UpdatePoolCounter ( &PoolStatus.PartitionCounter [ P_PGR(prim) ], DECREMENT, 1 ); + } + + /* + * update partition status + */ + SetPartitionStatus ( pPoolStatus, file, line, 0, PARTITION_FREED, 0 ); + } + else + vsi_o_ttrace (Caller, TC_SYSTEM,"[PPM]: Invalid Partition Pool, group: %d, pool: %d", group_nr, pool_nr ); + } +} +#endif + +#ifndef RUN_FLASH +GLOBAL void vsi_ppm_setend ( T_PRIM_HEADER *prim, ULONG size ) +{ + *((char*)prim + size ) = PPM_END_MARKER; + PoolStatus.PartitionStatus[P_PNR(prim)].RequestedSize = size+1; +} +#endif +#endif /* MEMORY_SUPERVISION */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_pro.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,268 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_pro.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| about the processes ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_PRO_C__ +#define __VSI_PRO_C__ +#endif + + +/*==== INCLUDES ===================================================*/ + +#include "string.h" +#include "typedefs.h" +#include "os.h" +#include "vsi.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "frame.h" +#include "route.h" + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +extern void pf_TaskEntry(T_HANDLE, ULONG); + +/*==== VARIABLES ==================================================*/ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_create | ++--------------------------------------------------------------------+ + + PURPOSE : creates a process + +*/ + +T_HANDLE vsi_p_create (T_HANDLE Caller, SHORT (*pei_create)(T_PEI_INFO const ** info), + void (*TaskEntry)(T_HANDLE, ULONG), T_HANDLE MemPoolHandle ) +{ +void (*EntryFunc)(T_HANDLE, ULONG); +T_PEI_INFO const *Info; +T_HANDLE TaskHandle; + + if ( pei_create ( &Info ) == PEI_OK ) + { + if ( TaskEntry == NULL ) + EntryFunc = pf_TaskEntry; + else + EntryFunc = TaskEntry; + + if ( os_CreateTask (NO_TASK, (char*)Info->Name, EntryFunc, Info->StackSize, Info->Priority, + &TaskHandle, MemPoolHandle) == OS_OK ) + { + pf_TaskTable[TaskHandle].Flags = Info->Flags; + pf_TaskTable[TaskHandle].PeiTable = &Info->PeiTable; + pf_TaskTable[TaskHandle].QueueEntries = Info->QueueEntries; + pf_TaskTable[TaskHandle].NumOfTimers = Info->NumOfTimers; + strncpy (pf_TaskTable[TaskHandle].Name, Info->Name, RESOURCE_NAMELEN); + pf_TaskTable[TaskHandle].Name[RESOURCE_NAMELEN-1] = 0; + pf_TaskTable[TaskHandle].TaskHandle = TaskHandle; + + pf_TaskTable[TaskHandle].MemPoolHandle = MemPoolHandle; + return TaskHandle; + } + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_exit | ++--------------------------------------------------------------------+ + + PURPOSE : exits and deletes a process + +*/ +#undef VSI_CALLER +#define VSI_CALLER Caller, +#define VSI_CALLER_SINGLE Caller +int vsi_p_exit (T_HANDLE Caller, T_HANDLE TaskHandle) +{ +ULONG old_mask; +T_PRIM_HEADER *prim; +T_S_HEADER *s_hdr; +ULONG size; +char name[RESOURCE_NAMELEN]; + + size = S_ALLOC_SIZE(strlen(SYSPRIM_EXIT_TOKEN)); +#ifdef MEMORY_SUPERVISION + prim = (T_PRIM_HEADER*)vsi_c_new ( Caller, size, 0, __FILE__, __LINE__ ); +#else + prim = (T_PRIM_HEADER*)vsi_c_new ( Caller, size, 0 ); +#endif + + prim->opc = SYS_MASK; + prim->sh_offset = S_HDR_OFFSET(size - sizeof(T_S_HEADER)); + prim->len = strlen(SYSPRIM_EXIT_TOKEN) + sizeof(T_PRIM_HEADER); + s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); + s_hdr->snd[0] =(char)Caller; + strcpy((char*)P2D(prim),SYSPRIM_EXIT_TOKEN); + + if (vsi_gettaskname(Caller,TaskHandle,name) < VSI_OK) + { + return VSI_ERROR; + } + /* switch off tracing for Caller */ + vsi_gettracemask ( Caller, Caller, &old_mask); + vsi_settracemask ( Caller, Caller, 0); + PSEND(vsi_c_open(Caller,name),P2D(prim)); + /* set tracing to old value for Caller */ + vsi_settracemask ( Caller, Caller, old_mask); + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_delete | ++--------------------------------------------------------------------+ + + PURPOSE : deletes a process + +*/ + +int vsi_p_delete (T_HANDLE Caller, T_HANDLE TaskHandle) +{ + rt_RoutingModify ( TaskHandle, (char*)SYSPRIM_REDIRECT_TOKEN, (char*)SYSPRIM_CLEAR_TOKEN ); + + if ( os_DestroyQueue ( Caller, pf_TaskTable[TaskHandle].QueueHandle ) != OS_OK ) + return VSI_ERROR; + + memset ( &pf_TaskTable[TaskHandle], 0, sizeof (T_FRM_TASK_TABLE_ENTRY) ); + + if ( os_DestroyTask ( Caller, TaskHandle ) != OS_OK ) + return VSI_ERROR; + + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_start | ++--------------------------------------------------------------------+ + + PURPOSE : starts a process + +*/ + +int vsi_p_start (T_HANDLE Caller, T_HANDLE TaskHandle) +{ + + if ( os_StartTask ( Caller, TaskHandle, 0 ) == OS_OK ) + return VSI_OK; + else + return VSI_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_stop | ++--------------------------------------------------------------------+ + + PURPOSE : stops a process + +*/ + +int vsi_p_stop (T_HANDLE Caller, T_HANDLE TaskHandle) +{ + + if ( os_StopTask ( Caller, TaskHandle ) == OS_OK ) + return VSI_OK; + else + return VSI_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_name | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +int vsi_p_name (T_HANDLE Caller, T_HANDLE Handle, char *Name) +{ + + if ( os_GetTaskName ( Caller, Handle, Name ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | +| STATE : code ROUTINE : vsi_p_handle | ++--------------------------------------------------------------------+ + + PURPOSE : reads the name of a task + +*/ + +T_HANDLE vsi_p_handle (T_HANDLE Caller, char *Name) +{ +OS_HANDLE Handle; + + if ( os_GetTaskHandle ( Caller, Name, &Handle ) != OS_ERROR ) + return Handle; + + return VSI_ERROR; +} +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_sem.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,179 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_sem.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for the semaphore handling. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_SEM_C__ +#define __VSI_SEM_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "typedefs.h" +#include "vsi.h" +#include "os.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" + +/*==== TYPES ======================================================*/ + + +/*==== CONSTANTS ==================================================*/ + + +/*==== EXTERNALS ==================================================*/ +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +/*==== VARIABLES ==================================================*/ + + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_SEM | +| STATE : code ROUTINE : vsi_s_open | ++--------------------------------------------------------------------+ + + PURPOSE : opens a semaphore, creates if not exist + +*/ + +T_HANDLE vsi_s_open (T_HANDLE Caller, char *Name, USHORT Count) +{ +OS_HANDLE SemHandle; + + /* + * if semaphore already exists, return handle + */ + if ( os_OpenSemaphore ( Caller, Name, &SemHandle ) != OS_ERROR ) + return SemHandle; + + /* + * if semaphore not exists, create + */ + if ( os_CreateSemaphore ( Caller, Name, Count, &SemHandle, pf_TaskTable[Caller].MemPoolHandle ) != OS_ERROR ) + return SemHandle; + else + vsi_o_assert( Caller, OS_SYST_ERR_MAX_SEMA, __FILE__, __LINE__, + "Number of created semaphores > MAX_SEMAPHORES" ); + + /* + * if semaphore cannot be created, return VSI_ERROR + */ + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_SEM | +| STATE : code ROUTINE : vsi_s_close | ++--------------------------------------------------------------------+ + + PURPOSE : closes a semaphore + +*/ + +int vsi_s_close (T_HANDLE Caller, T_HANDLE SemHandle) +{ + + if ( os_CloseSemaphore ( Caller, SemHandle ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_SEM | +| STATE : code ROUTINE : vsi_s_get | ++--------------------------------------------------------------------+ + + PURPOSE : obtains a semaphore + +*/ + +int vsi_s_get (T_HANDLE Caller, T_HANDLE SemHandle) +{ +LONG Status; + + Status = os_ObtainSemaphore ( Caller, SemHandle, OS_SUSPEND ); + if ( Status == OS_OK || Status == OS_WAITED ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_SEM | +| STATE : code ROUTINE : vsi_s_release | ++--------------------------------------------------------------------+ + + PURPOSE : releases a semaphore + +*/ + +int vsi_s_release (T_HANDLE Caller, T_HANDLE SemHandle) +{ + + if ( os_ReleaseSemaphore ( Caller, SemHandle ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_SEM | +| STATE : code ROUTINE : vsi_s_status | ++--------------------------------------------------------------------+ + + PURPOSE : request the current count of a semaphore + +*/ + +int vsi_s_status (T_HANDLE Caller, T_HANDLE SemHandle, USHORT *Count ) +{ + + if ( os_QuerySemaphore ( Caller, SemHandle, Count ) != OS_ERROR ) + return VSI_OK; + + return VSI_ERROR; +} +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_tim.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,484 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_tim.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for the timer handling. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_TIM_C__ +#define __VSI_TIM_C__ +#endif + +/*==== INCLUDES ===================================================*/ + +#include "typedefs.h" +#include "string.h" + +#include "vsi.h" +#include "os.h" +#include "tools.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "frame.h" + +/*==== TYPES ======================================================*/ + +typedef struct _T_TIMER_CONFIG_ENTRY +{ + T_HANDLE entity; + T_TIME value; + USHORT index; + USHORT mode; + struct _T_TIMER_CONFIG_ENTRY *next; +} T_TIMER_CONFIG_ENTRY; + +/*==== CONSTANTS ==================================================*/ + +LOCAL const T_STR_IND StrInd[] = +{ + "TIMER_SET", TIMER_SET, + "TIMER_RESET", TIMER_RESET, + "TIMER_SPEED_UP", TIMER_SPEED_UP, + "TIMER_SLOW_DOWN", TIMER_SLOW_DOWN, + "TIMER_SUPPRESS", TIMER_SUPPRESS, + "TIMER_CLEAN", TIMER_CLEAN, + NULL, 0 +}; + +/*==== EXTERNALS ==================================================*/ +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +extern OS_HANDLE ext_data_pool_handle; +extern T_HANDLE TimerHandleField[]; + +/*==== VARIABLES ==================================================*/ + +#ifndef RUN_INT_RAM +char timer_configured; +T_TIMER_CONFIG_ENTRY *t_config; +#else +extern char timer_configured; +extern T_TIMER_CONFIG_ENTRY *t_config; +#endif + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== FUNCTIONS ==================================================*/ + +int GetTimerStartValue ( T_HANDLE Caller, USHORT TimerIndex, T_TIME OrgValue, T_TIME *NewValue ); + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : GetTimerStartValue | ++--------------------------------------------------------------------+ + + PURPOSE : get start time modified by dynamic configuration + +*/ + +int GetTimerStartValue ( T_HANDLE caller, USHORT index, T_TIME org_value, T_TIME *new_value ) +{ +T_TIMER_CONFIG_ENTRY *t_config_entry; +int found; + + if ( t_config != NULL ) + { + found = FALSE; + t_config_entry = t_config; + while ( found == FALSE && t_config_entry != NULL ) + { + if ( t_config_entry->entity == caller + && t_config_entry->index == index ) + { + found = TRUE; + switch (t_config_entry->mode) + { + case TIMER_SET: + *new_value = t_config_entry->value; + break; + + case TIMER_RESET: + *new_value = org_value; + break; + + case TIMER_SPEED_UP: + *new_value = org_value / t_config_entry->value; + break; + + case TIMER_SLOW_DOWN: + *new_value = org_value * t_config_entry->value; + break; + + default: + return VSI_ERROR; + } + vsi_o_ttrace ( caller, TC_TIMER, "Timerstart: Index %d, Time %d -> %d",index, org_value, *new_value ); + } + t_config_entry = t_config_entry->next; + } + if ( found == FALSE ) + { + *new_value = org_value; + } + } + else + { + *new_value = org_value; + } + if (*new_value == 0) + { + *new_value = 1; + } + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : vsi_t_start | ++--------------------------------------------------------------------+ + + PURPOSE : start timer that expires only once + +*/ + +int vsi_t_start (T_HANDLE Caller, USHORT TimerIndex, T_TIME Value) +{ +OS_HANDLE TimerHandle; + + vsi_o_ttrace ( Caller, TC_TIMER, "Timerstart: Index %d, Time %d",TimerIndex, Value) ; + + if ( TimerIndex >= pf_TaskTable[Caller].NumOfTimers ) + vsi_o_assert( NO_TASK, OS_SYST_ERR_TASK_TIMER, __FILE__, __LINE__, + "TimerIndex > NumOfTimers for entity %s", pf_TaskTable[Caller].Name ); + + TimerHandle = (*(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) & TIMER_HANDLE_MASK); + + if ( !TimerHandle ) + { + if ( os_CreateTimer ( Caller, pf_Timeout, &TimerHandle, pf_TaskTable[Caller].MemPoolHandle ) == OS_ERROR ) + vsi_o_assert( Caller, OS_SYST_ERR_SIMUL_TIMER, __FILE__, __LINE__, + "Number of started timers > MAX_SIMULTANEOUS_TIMER" ); + } + if ( timer_configured && GetTimerStartValue ( Caller, TimerIndex, Value, &Value ) == VSI_ERROR ) + return VSI_ERROR; + + *(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) = TimerHandle; + + if ( os_StartTimer ( Caller, TimerHandle, TimerIndex, Value, 0 ) == OS_ERROR ) + return VSI_ERROR; + + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : vsi_t_pstart | ++--------------------------------------------------------------------+ + + PURPOSE : start periodic timer + +*/ + +int vsi_t_pstart (T_HANDLE Caller, USHORT TimerIndex, T_TIME Value1, T_TIME Value2 ) +{ +OS_HANDLE TimerHandle; + + vsi_o_ttrace ( Caller, TC_TIMER, "Timerstart: Index %d, ITime %d PTime %d",TimerIndex, Value1, Value2) ; + + if ( TimerIndex >= pf_TaskTable[Caller].NumOfTimers ) + vsi_o_assert( NO_TASK, OS_SYST_ERR_TASK_TIMER, __FILE__, __LINE__, + "TimerIndex > NumOfTimers for entity %s", pf_TaskTable[Caller].Name ); + + TimerHandle = (*(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) & TIMER_HANDLE_MASK); + + if ( !TimerHandle ) + { + if ( os_CreateTimer ( Caller, pf_Timeout, &TimerHandle, pf_TaskTable[Caller].MemPoolHandle ) == OS_ERROR ) + vsi_o_assert( Caller, OS_SYST_ERR_SIMUL_TIMER, __FILE__, __LINE__, + "Number of started timers > MAX_SIMULTANEOUS_TIMER" ); + } + + if ( timer_configured && GetTimerStartValue ( Caller, TimerIndex, Value1, &Value1 ) == VSI_ERROR ) + return VSI_ERROR; + + if ( timer_configured && GetTimerStartValue ( Caller, TimerIndex, Value2, &Value2 ) == VSI_ERROR ) + return VSI_ERROR; + + *(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) = TimerHandle | PERIODIC_TIMER; + + if ( os_StartTimer ( Caller, TimerHandle, TimerIndex, Value1, Value2 ) == OS_ERROR ) + return VSI_ERROR; + + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : vsi_t_stop | ++--------------------------------------------------------------------+ + + PURPOSE : stop timer + +*/ + +int vsi_t_stop (T_HANDLE Caller, USHORT TimerIndex ) +{ +OS_HANDLE TimerHandle; + + vsi_o_ttrace ( Caller, TC_TIMER, "Timerstop: Index %d",TimerIndex) ; + TimerHandle = (*(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) & TIMER_HANDLE_MASK); + if ( TimerHandle && ( (TimerHandle & TIMER_HANDLE_MASK) < MaxTimer ) ) + { +/* + if ( os_StopTimer ( Caller, TimerHandle ) == OS_ERROR ) + return VSI_ERROR; + + if ( os_DestroyTimer ( Caller, TimerHandle ) == OS_ERROR ) + return VSI_ERROR; +*/ + os_StopTimer ( Caller, TimerHandle ); + os_DestroyTimer ( Caller, TimerHandle ); + + *(pf_TaskTable[Caller].FirstTimerEntry + TimerIndex) = 0; + return VSI_OK; + } + return VSI_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : vsi_t_status | ++--------------------------------------------------------------------+ + + PURPOSE : request remaining time + +*/ + +int vsi_t_status (T_HANDLE Caller, USHORT Index, T_TIME *Value ) +{ +OS_HANDLE TimerHandle; + + if ( (TimerHandle = (*(pf_TaskTable[Caller].FirstTimerEntry + Index) & TIMER_HANDLE_MASK) ) < MaxTimer ) + { + if ( TimerHandle == 0 || (*(pf_TaskTable[Caller].FirstTimerEntry + Index) & TIMEOUT_OCCURRED) ) + { + *Value = 0; + vsi_o_ttrace ( Caller, TC_TIMER, "Timerstatus: Index %d, Remaining_time %d",Index, *Value) ; + return VSI_OK; + } + /* + In case the timer interrupt occurrs just after the check 5 lines above, this will be handled by + os_QueryTimer() returning a Value of 0 because thew expired timer can no longer be found in the list. + */ + if ( os_QueryTimer ( Caller, TimerHandle, Value ) == OS_ERROR ) + { + *Value = 0; + return VSI_ERROR; + } + vsi_o_ttrace ( Caller, TC_TIMER, "Timerstatus: Index %d, Remaining time %d",Index, *Value) ; + return VSI_OK; + } + vsi_o_ttrace ( Caller, TC_TIMER, "TimerHandle out of range: Index %d, TimerHandle %d",Index, TimerHandle ) ; + return VSI_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : vsi_t_config | ++--------------------------------------------------------------------+ + + PURPOSE : timer configuration + +*/ +int vsi_t_config (T_HANDLE caller, USHORT index, UBYTE mode, ULONG value ) +{ +T_TIMER_CONFIG_ENTRY *t_config_entry = NULL; +T_TIMER_CONFIG_ENTRY *t_next_entry; +T_TIMER_CONFIG_ENTRY *t_new_entry = NULL; +int found = FALSE; + + if ( index < pf_TaskTable[caller].NumOfTimers ) + { + if ( t_config != NULL ) + { + t_next_entry = t_config; + do + { + t_config_entry = t_next_entry; + if ( t_config_entry->entity == caller + && t_config_entry->index == index ) + { + found = TRUE; + break; + } + t_next_entry = t_config_entry->next; + } while ( t_next_entry != NULL ); + } + + if ( found == FALSE ) + { + if ( os_AllocateMemory ( caller, (T_VOID_STRUCT**)&t_new_entry, sizeof(T_TIMER_CONFIG_ENTRY), OS_NO_SUSPEND, ext_data_pool_handle ) == OS_TIMEOUT ) + return VSI_ERROR; + t_new_entry->next = NULL; + } + + if ( t_config == NULL ) + { + t_config = t_new_entry; + t_config_entry = t_new_entry; + } + else + { + if ( found == FALSE && t_config_entry != NULL ) + { + t_config_entry->next = t_new_entry; + t_config_entry = t_new_entry; + } + } + + if ( t_config_entry != NULL ) + { + t_config_entry->entity = caller; + t_config_entry->index = index; + t_config_entry->mode = mode; + t_config_entry->value = value; + timer_configured = TRUE; + return VSI_OK; + } + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : _vsi_t_config ++------------------------------------------------------------------------------ +| Description : Parse a timer configuration string into the components +| timer index, timer mode, timer value. +| +| Parameters : Caller - calling task +| *CfgString - configuration string +| *pTable - pointer to configuration string table +| +| Return : VSI_OK +| VSI_ERROR ++------------------------------------------------------------------------------ +*/ +int _vsi_t_config ( T_HANDLE Caller, char *CfgString, const T_STR_IND *pTable ) +{ +T_TIMER_CONFIG_ENTRY *t_config_entry; +T_TIMER_CONFIG_ENTRY *t_next; +char token[20]; +unsigned int offset = 0,len; +USHORT Index; +BYTE Mode; +int i = 0; +unsigned int Value; + + if ( pTable != NULL ) + { + len = GetNextToken (CfgString, token, " #"); + offset = offset + len +1; + while ( StrInd[i].Str && strcmp ( token, StrInd[i].Str ) ) + { i++; } + if ( StrInd[i].Str == NULL ) + return VSI_ERROR; + + if ( (Mode = (BYTE)StrInd[i].Ind) == TIMER_CLEAN ) + { + t_config_entry = t_config; + while ( t_config_entry != NULL ) + { + t_next = t_config_entry->next; + os_DeallocateMemory ( Caller, (T_VOID_STRUCT*)t_config_entry ); + t_config_entry = t_next; + } + t_config = NULL; + return VSI_OK; + } + len = GetNextToken (CfgString+offset, token, " #"); + offset = offset + len +1; + while ( pTable->Str && strcmp ( token, pTable->Str ) ) + { pTable++; } + if ( pTable->Str == NULL ) + { + vsi_o_ttrace ( 0, TC_SYSTEM, "Timer not found!") ; + return VSI_OK; /* VSI_OK is returned to avoid creating a new return code */ + } + Index = pTable->Ind; + len = GetNextToken (CfgString+offset, token, " #"); + Value = ASCIIToHex (token, CHARS_FOR_32BIT); + + return ( vsi_t_config ( Caller, Index, Mode, Value ) ); + } + return VSI_ERROR; + +} +#endif + +#ifndef RUN_INT_RAM +/* ++---------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TIM | +| STATE : code ROUTINE : InitializeTimerConfig| ++---------------------------------------------------------------------+ + + PURPOSE : initialize timer configuration + +*/ + +void InitializeTimer ( void ) +{ +int i; + + for ( i = 0; i <= MaxTimer; i++) + { + TimerHandleField[i] = 0; + } + timer_configured = FALSE; + t_config = NULL; +} +#endif + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/vsi_trc.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,1696 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi_trc.c ++------------------------------------------------------------------------------ +| 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 defines the virtual system interface part +| for the tracing functionality. ++----------------------------------------------------------------------------- +*/ + +#ifndef __VSI_TRC_C__ +#define __VSI_TRC_C__ +#endif + +#undef TEST_EXT_TRACE + +/*==== LINT =======================================================*/ + +/*lint -emacro(506,va_start) Constant value Boolean */ +/*lint -emacro(506,va_arg) Constant value Boolean */ +/*lint -emacro(718,va_start) Symbol 'Symbol' undeclared, assumed to return int */ +/*lint -emacro(522,va_arg) Warning -- Expected void type, assignment, increment or decrement */ +/*lint -emacro(10,va_arg) Error -- Expecting '(' */ +/*lint -emacro(516,va_arg) Warning -- 'Symbol _va_argref()' has arg. type conflict (arg. no. 1 -- basic) */ +/*lint -e661 */ +/*lint -e662 */ + +/*==== INCLUDES ===================================================*/ + +#ifndef _VXWORKS_ +#include <stdarg.h> +#endif +#include <stdio.h> +#include <string.h> +#include "typedefs.h" + +#include "vsi.h" +#include "os.h" +#include "tools.h" +#include "frame.h" +#include "frm_defs.h" +#include "frm_types.h" +#include "frm_glob.h" +#include "p_frame.h" +#ifndef _TOOLS_ +#include "tstdriver.h" +#endif + +/*==== TYPES ======================================================*/ + +typedef struct +{ + unsigned int magic_nr; + void (*trace_error)(const char * const format, va_list varpars); + void (*trace_assert)(const char * const format, va_list varpars); +} T_EXT_TRACE; + +/*==== CONSTANTS ==================================================*/ + +#define EXT_TRACE_INITIALIZED 0xaffedead + +/*==== EXTERNALS ==================================================*/ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +/* + * contains the correspnding flags for each task + */ +extern T_HANDLE TestGroupHandle; +extern UBYTE FrameEnv; +extern char TaskName[]; +extern char FRM_TST_NAME[]; + +#ifdef _TOOLS_ + extern char FRM_SYST_NAME[]; +#else + extern OS_HANDLE TST_Handle; + extern OS_HANDLE RCV_Handle; + extern int time_is_tdma_frame; + extern char error_ind_dst[]; + extern T_FRM_ERROR_IND *frm_error_ind; +#endif + +/*==== VARIABLES ==================================================*/ + +/* + this file may be compiled twice for FLASH and RAM, make sure we + get the variable declarations exactly once +*/ + +#ifndef RUN_INT_RAM + /* must be seen only from FLASH */ + GLOBAL char TraceBuffer [ TRACE_TEXT_SIZE ]={0}; + + /* must be seen from RAM and FLASH */ + GLOBAL OS_HANDLE trc_hCommTrace=VSI_ERROR; + GLOBAL BOOL trc_LittleEndian = FALSE; + /* used by the entities */ + GLOBAL char EntityNameBuf[RESOURCE_NAMELEN]; + GLOBAL USHORT emergeny_trace; +#else + /* must be seen from RAM and FLASH */ + extern OS_HANDLE trc_hCommTrace; + extern BOOL trc_LittleEndian; + extern USHORT emergeny_trace; +#endif + +#ifndef RUN_INT_RAM + T_EXT_TRACE ext_trace_func; +#else + extern T_EXT_TRACE ext_trace_func; +#endif + +#ifdef TEST_EXT_TRACE + +void trace_error ( const char * const format, va_list varpars ); +void trace_assert ( const char * const format, va_list varpars ); + +#ifndef RUN_INT_RAM +T_EXT_TRACE_FUNC ext_trace_functions = +{ +trace_error, +trace_assert +}; +#else +extern T_EXT_TRACE_FUNC ext_trace_functions; +#endif + +#endif /* TEST_EXT_TRACE */ + +/*==== VARIABLES ==================================================*/ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +/*==== PROTOTYPES ==================================================*/ + +void ext_trace_init ( void ); +int int_vsi_o_ttrace ( T_HANDLE Caller, ULONG TraceClass, const char * const format, va_list varpars ); +int int_vsi_o_itrace ( T_HANDLE Caller, ULONG TraceClass, ULONG index, const char * const format, va_list varpars ); +int vsi_o_datasend ( T_HANDLE caller, T_HANDLE dst, char *ext_dst, T_PRIM_HEADER *prim FILE_LINE_TYPE ); +U32 int_vsi_tc2trace_opc(ULONG trace_class); + +#ifdef _TARGET_ +SHORT tst_pei_primitive (void *primitive); +#endif + +/*==== FUNCTIONS ==================================================*/ + +#ifndef RUN_FLASH +U32 int_vsi_tc2trace_opc(ULONG trace_class) +{ + switch (trace_class) + { + case TC_FUNC: + return FUNC_TRACE_OPC; + case TC_EVENT: + return EVENT_TRACE_OPC; + case TC_PRIM: + return PRIM_TRACE_OPC; + case TC_STATE: + return STATE_TRACE_OPC; + case TC_SYSTEM: + return SYSTEM_TRACE_OPC; + case TC_ISIG: + return ISIG_TRACE_OPC; + case TC_ERROR: + return ERROR_TRACE_OPC; + case TC_CCD: + return CCD_TRACE_OPC; + case TC_TIMER: + return TIMER_TRACE_OPC; + case TC_PROFILER: + return PROFILER_TRACE_OPC; + + case TC_USER1: + return USER1_TRACE_OPC; + case TC_USER2: + return USER2_TRACE_OPC; + case TC_USER3: + return USER3_TRACE_OPC; + case TC_USER4: + return USER4_TRACE_OPC; + case TC_USER5: + return USER5_TRACE_OPC; + case TC_USER6: + return USER6_TRACE_OPC; + case TC_USER7: + return USER7_TRACE_OPC; + case TC_USER8: + return USER8_TRACE_OPC; + + default: + return TRACE_OPC; + } +} +#endif /* RUN_FLASH */ + +#ifdef _TOOLS_ +/* ++------------------------------------------------------------------------------ +| Function : vsi_o_set_htrace ++------------------------------------------------------------------------------ +| Description : This function sets the module variable trc_hCommTrace +| +| Parameters : comhandle - the new value +| +| Return : none ++------------------------------------------------------------------------------ +*/ +void vsi_o_set_htrace (T_HANDLE comhandle) +{ + trc_hCommTrace = (OS_HANDLE) comhandle; +} +#endif /* _TOOLS_ */ + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_trace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +LOCAL int vsi_o_trace ( T_HANDLE Caller, T_PRIM_HEADER *prim, ULONG suspend ) +{ +T_S_HEADER *s_hdr; +LONG Status; +OS_QDATA QMsg; +BOOL AlarmTrace = FALSE; + + s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); + if ( TracesAborted[Caller] ) + { +#ifdef _TOOLS_ + /* + * Only needed for _TOOLS_ because Nucleus provides at least 52 Bytes in the partition + */ + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + Status = os_AllocatePartition ( Caller, (T_VOID_STRUCT**)&prim, 80, suspend, TestGroupHandle ); +#endif + sprintf ((char*)P2D(prim),"Trc Abort: %d !",TracesAborted[Caller]+1 ); + prim->len = strlen ((char*)P2D(prim)) + sizeof(T_PRIM_HEADER); + prim->sh_offset = S_HDR_OFFSET(prim->len); + s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); + AlarmTrace = TRUE; + } + + s_hdr->snd[0] = (char)Caller; + if ( Caller ) + s_hdr->snd[0] |= (char)HANDLE_BIT; + + s_hdr->org_rcv[0] = 0; + +#ifdef _TOOLS_ + get_local_time (&s_hdr->time); +#else + if ( time_is_tdma_frame == 1 ) + { + os_GetTime(Caller,&s_hdr->time); + s_hdr->time |= TIME_IS_TDMA; + } + else + { + os_GetTime(Caller,&s_hdr->time); + s_hdr->time &= ~TIME_IS_TDMA; + } +#endif + + QMsg.flags = 0; + QMsg.data16 = MSG_PRIMITIVE; + QMsg.data32 = 0; + QMsg.ptr = (T_VOID_STRUCT*)prim; +#ifdef _TOOLS_ + QMsg.len = ALIGN(prim->len) + sizeof(T_S_HEADER); +#endif + os_GetTime ( 0, &QMsg.time ); + +#ifndef _TOOLS_ + if ( trc_hCommTrace == VSI_ERROR ) + if ( (trc_hCommTrace = vsi_c_open ( TST_Handle, FRM_TST_NAME ) ) == OS_ERROR ) + { + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + return VSI_ERROR; + } +#else + if ( trc_hCommTrace == VSI_ERROR ) + { + if ( FrameEnv == ENV_TOOLS ) + { + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + return VSI_ERROR; + } + else + { + if ( os_OpenQueue ( NO_TASK, FRM_TST_NAME, &trc_hCommTrace ) == OS_ERROR ) + { + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + return VSI_ERROR; + } + } + } + if ( FrameEnv == ENV_TOOLS ) + { + s_hdr->snd[0] = '~'; + if ( os_GetTaskName ( Caller, Caller, &s_hdr->snd[1] ) == OS_ERROR ) + { + char Sender[RESOURCE_NAMELEN]; + char *ptr = (char*)P2D(prim); + unsigned int NameLen; + + if ( *ptr == '~') + { + NameLen = GetNextToken ((char*)(ptr), Sender,"~"); + InsertString(Sender, &s_hdr->snd[1], 4); + prim->len -= 2+NameLen; + memcpy ( ptr, ptr+2+NameLen, prim->len-sizeof(T_PRIM_HEADER) ); + QMsg.len = ALIGN(prim->len) + sizeof(T_S_HEADER); + } + else + InsertString(FRM_SYST_NAME, &s_hdr->snd[1], 4); + } + } +#endif /* _TOOLS_ */ + + QMsg.e_id = trc_hCommTrace; + +#ifndef _TOOLS_ + if ( Caller == TST_Handle || Caller == RCV_Handle ) + { + tst_drv_write ( Caller, 0, NULL, (char*)P2D(prim) ); + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + return VSI_OK; + } +#ifndef _TARGET_ + else + /* + * for the PC Simulation SuspendTrace[0] is != 0. To avoid that the system traces + * sent with caller NO_TASK block the system if the caller was TST, the Caller + * is set to the real caller here. This has no consequence on the caller name + * displayed in PCO because this is already formated into the header. + */ + { + if ( Caller == NO_TASK ) + { + Caller = e_running[os_MyHandle()]; + } + } +#endif +#endif + + QMsg.e_id = trc_hCommTrace; +#ifdef _TOOLS_ + Status = os_SendToQueue ( NO_TASK, trc_hCommTrace, MSG_TRACE_PRIO, suspend, &QMsg ); +#else + Status = os_SendToQueue ( NO_TASK, pf_TaskTable[trc_hCommTrace].QueueHandle, MSG_TRACE_PRIO, suspend, &QMsg ); +#endif + if ( Status == OS_OK || Status == OS_WAITED ) + { + TracesAborted[Caller] = 0; + if ( AlarmTrace ) + return VSI_ERROR; + else + return VSI_OK; + } + else + { + /* + * No queue space available -> free partition + */ + os_DeallocatePartition ( Caller, (T_VOID_STRUCT*)prim ); + TracesAborted[Caller]++; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_o_primsend | ++--------------------------------------------------------------------+ + + PURPOSE : traces a data segment as a primitive + +*/ +int vsi_o_primsend ( T_HANDLE caller, unsigned int mask, T_HANDLE dst, char *ext_dst, unsigned int opc, void *ptr, unsigned int len FILE_LINE_TYPE ) +{ +int alloc_size; +T_PRIM_HEADER *prim; +T_HANDLE e_handle; + + if ( caller != 0 ) + e_handle = caller; + else + e_handle = e_running[os_MyHandle()]; + + if ( (e_handle >= 0) && (TraceMask[e_handle] & mask) ) + { + if ( opc != 0 ) + { + alloc_size = len + sizeof(T_PRIM_HEADER); + if ( alloc_size < (int)MaxPrimPartSize ) + { + prim = (T_PRIM_HEADER*)vsi_c_new ( 0, alloc_size, opc FILE_LINE ); + memcpy((char*)P2D(prim), ptr, len); + /* if primitive is FRM_WARNING_IND -> free */ + if ( opc == FRM_WARNING_IND ) + { + PFREE(ptr); + } + } + else + { + vsi_o_ttrace ( caller, TC_SYSTEM, "SYSTEM WARNING: Binary trace too long -> discarded in %s(%d)" FILE_LINE ); + return VSI_ERROR; + } + } + else + { + prim = D2P(ptr); + } + if ( vsi_o_datasend ( e_handle, dst, ext_dst, prim FILE_LINE ) == VSI_ERROR ) + { + vsi_c_free ( 0, (T_VOID_STRUCT**)&prim FILE_LINE ); + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_o_sdusend | ++--------------------------------------------------------------------+ + + PURPOSE : traces an SDU as a primitive + +*/ +int vsi_o_sdusend ( T_HANDLE caller, T_HANDLE dst, char *ext_dst, int opc, char ent, char dir, char type, void *ptr, unsigned int len FILE_LINE_TYPE ) +{ +T_PRIM_HEADER *prim; +T_HANDLE e_handle; +int alloc_size; + + if ( caller != 0 ) + e_handle = caller; + else + e_handle = e_running[os_MyHandle()]; + + if ( (e_handle >= 0) && (TraceMask[e_handle] & TC_SDU) ) + { + if ( opc != 0 ) + { + alloc_size = len + sizeof(T_PRIM_HEADER) + sizeof(T_SDU_TRACE); + if ( alloc_size < (int)MaxPrimPartSize ) + { + prim = (T_PRIM_HEADER*)vsi_c_new ( 0, alloc_size, opc FILE_LINE ); + ((T_SDU_TRACE*)(P2D(prim)))->entity = ent; + ((T_SDU_TRACE*)(P2D(prim)))->dir = dir; + ((T_SDU_TRACE*)(P2D(prim)))->type = type; + ((T_SDU_TRACE*)(P2D(prim)))->align1 = 0; + memcpy(((char*)P2D(prim))+sizeof(T_SDU_TRACE), ptr, len); + if ( vsi_o_datasend ( e_handle, dst, ext_dst, prim FILE_LINE ) == VSI_ERROR ) + { + vsi_c_free ( 0, (T_VOID_STRUCT**)&prim FILE_LINE ); + } + } + else + { + vsi_o_ttrace ( caller, TC_SYSTEM, "SYSTEM WARNING: Binary trace too long -> discarded in %s(%d)" FILE_LINE ); + } + } + } + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_o_datasend | ++--------------------------------------------------------------------+ + + PURPOSE : traces an already allocated primitive + +*/ +int vsi_o_datasend ( T_HANDLE caller, T_HANDLE dst, char *ext_dst, T_PRIM_HEADER *prim FILE_LINE_TYPE ) +{ +int alloc_size; +T_PRIM_HEADER *carrier; +T_S_HEADER *s_hdr; +LONG status; +OS_QDATA DMsg; +unsigned int i; +ULONG suspend; + + suspend = get_suspend_state(caller,CHECK_TRC_SUSPEND); + + /* allocate carrier */ + alloc_size = S_ALLOC_SIZE(4 + 1); + status = os_AllocatePartition ( caller, (T_VOID_STRUCT**)&carrier, alloc_size, suspend, TestGroupHandle ); + if ( status == OS_OK || status == OS_WAITED || status == OS_ALLOCATED_BIGGER ) + { + DMsg.data16 = MSG_PRIMITIVE; + DMsg.data32 = prim->opc; +#ifdef _TOOLS_ + DMsg.len = alloc_size; +#endif + DMsg.ptr = (T_VOID_STRUCT*)carrier; + + carrier->opc = prim->opc; + carrier->len = alloc_size; + carrier->sh_offset = S_HDR_OFFSET(alloc_size - sizeof(T_S_HEADER)); + s_hdr = (T_S_HEADER*)((ULONG*)carrier + carrier->sh_offset); + if ( dst != 0 ) + { + if ( vsi_e_name ( caller, dst, TaskName ) == VSI_OK ) + { + /* set org_rcv */ + for (i = 0; TaskName[i] && i < sizeof (s_hdr->rcv); i++) + s_hdr->org_rcv[i] = TaskName[i]; + if (i < sizeof s_hdr->rcv) + s_hdr->org_rcv[i] = 0; + } + else + { + s_hdr->org_rcv[0] = 0; + } + } + else + { + s_hdr->org_rcv[0] = 0; + } + strncpy (s_hdr->rcv, ext_dst, RESOURCE_NAMELEN); + s_hdr->rcv[RESOURCE_NAMELEN-1] = 0; + if ( caller != 0 ) + { + if ( vsi_e_name ( caller, caller, TaskName ) == VSI_OK ) + { + /* set snd */ + for (i = 0; TaskName[i] && i < sizeof (s_hdr->snd); i++) + s_hdr->snd[i] = TaskName[i]; + if (i < sizeof s_hdr->snd) + s_hdr->snd[i] = 0; + } + } + else + { + if ( pf_TaskTable[caller].Name[0] != 0 ) + { + s_hdr->snd[0] = (char)(caller | HANDLE_BIT); + } + else + { + s_hdr->rcv[0] = 0; + } + } + os_GetTime(0,&s_hdr->time); + + ((T_PRIM_X*)(carrier))->prim_ptr = prim; + DMsg.e_id = trc_hCommTrace; + } + else + { + TracesAborted[caller]++; + return VSI_ERROR; + } + +#ifdef MEMORY_SUPERVISION + vsi_ppm_send ( caller, pf_TaskTable[trc_hCommTrace].QueueHandle, prim FILE_LINE_MACRO ); +#endif /* MEMORY_SUPERVISION */ + if ( os_SendToQueue ( caller, pf_TaskTable[trc_hCommTrace].QueueHandle, OS_NORMAL, suspend, &DMsg ) == OS_TIMEOUT ) + { + os_DeallocatePartition ( caller, (T_VOID_STRUCT*)carrier ); + TracesAborted[caller]++; + return VSI_ERROR; + } + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_COM | +| STATE : code ROUTINE : vsi_o_memtrace | ++--------------------------------------------------------------------+ + + PURPOSE : check if PS already started + +*/ +int vsi_o_memtrace ( T_HANDLE caller, void *ptr, unsigned int len ) +{ +T_PRIM_HEADER *prim; +T_HANDLE e_handle; +LONG status; +unsigned int i; +ULONG suspend; + + if ( caller != 0 ) + e_handle = caller; + else + e_handle = e_running[os_MyHandle()]; + + if ( (e_handle >= 0) && (TraceMask[e_handle] & TC_DATA) ) + { + suspend = get_suspend_state(e_handle,CHECK_TRC_SUSPEND); + status = os_AllocatePartition ( e_handle, (T_VOID_STRUCT**)&prim, S_ALLOC_SIZE(len)*3, suspend, TestGroupHandle ); + if ( status == OS_OK || status == OS_WAITED || status == OS_ALLOCATED_BIGGER ) + { + unsigned char *dst_ptr = (unsigned char*)P2D(prim); + unsigned char *src_ptr = (unsigned char*)ptr; + for ( i = 0; i < len; i++, src_ptr++ ) + { + if (*src_ptr>>4 > 9) + *dst_ptr++ = (*src_ptr>>4) + ('A'-10); + else + *dst_ptr++ = (*src_ptr>>4) +'0'; + if ((*src_ptr&0xf) > 9) + *dst_ptr++ = (*src_ptr&0xf) + ('A'-10); + else + *dst_ptr++ = (*src_ptr&0xf) +'0'; + *dst_ptr++ = 0x20; + } + + prim->opc = int_vsi_tc2trace_opc(TC_DATA); + prim->len = 3*len + sizeof(T_PRIM_HEADER); + prim->sh_offset = S_HDR_OFFSET(prim->len); + + return ( vsi_o_trace ( e_handle, prim, suspend ) ); + } + TracesAborted[e_handle]++; + return VSI_ERROR; + + } + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_func_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a function name + +*/ +int vsi_o_func_ttrace ( const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_FUNC) ) + { + va_start (varpars, format); + return int_vsi_o_ttrace ( Caller, TC_FUNC, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_event_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces an event + +*/ +int vsi_o_event_ttrace ( const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_EVENT) ) + { + va_start (varpars, format); + return int_vsi_o_ttrace ( Caller, TC_EVENT, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_error_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces an error + +*/ +int vsi_o_error_ttrace ( const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_ERROR) ) + { + va_start (varpars, format); + int_vsi_o_ttrace ( Caller, TC_ERROR, format, varpars ); + vsi_o_ttrace ( NO_TASK, TC_ERROR, "TRACE ERROR in %s", pf_TaskTable[Caller].Name ); + if ( ext_trace_func.trace_error != NULL ) + { + ext_trace_func.trace_error ( format, varpars ); + } + return VSI_OK; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_state_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_state_ttrace ( const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_STATE) ) + { + va_start (varpars, format); + return int_vsi_o_ttrace ( Caller, TC_STATE, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_class_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_class_ttrace ( ULONG trace_class, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & trace_class) ) + { + va_start (varpars, format); + return int_vsi_o_ttrace ( Caller, trace_class, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_ttrace ( T_HANDLE Caller, ULONG TraceClass, const char * const format, ... ) +{ +va_list varpars; + + if ( (Caller >= 0) && (TraceMask[Caller] & TraceClass) ) + { + va_start (varpars, format); + return int_vsi_o_ttrace ( Caller, TraceClass, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : int_vsi_o_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int int_vsi_o_ttrace ( T_HANDLE Caller, ULONG TraceClass, const char * const format, va_list varpars ) +{ +T_PRIM_HEADER *prim; +LONG Status; +ULONG suspend; +unsigned int offset = 0; +unsigned int num; + + suspend = get_suspend_state(Caller,CHECK_TRC_SUSPEND); + Status = os_AllocatePartition ( Caller, (T_VOID_STRUCT**)&prim, TextTracePartitionSize, suspend, TestGroupHandle ); + if ( Status == OS_OK || Status == OS_WAITED || Status == OS_ALLOCATED_BIGGER ) + { +#if 0 + /* be activated when PCO can handle this */ + if ( TraceClass == TC_ERROR ) + { + *((char*)(P2D(prim))) = '#'; + offset = 1; + } +#endif +#ifdef _TOOLS_ + int trc_length = TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER) - 1; + trc_length &= ~0x03; + num = offset + (unsigned int)_vsnprintf ((char*)(P2D(prim)) + offset, trc_length, format, varpars) + 1; /* + 1 for terminating 0 */ +#else + num = offset + (unsigned int)vsprintf ((char*)(P2D(prim)) + offset, format, varpars) + 1; /* + 1 for terminating 0 */ +#endif + va_end (varpars); + if ( num + sizeof(T_S_HEADER) + sizeof(T_PRIM_HEADER) >= TextTracePartitionSize ) + { + sprintf ( (char*)(P2D(prim))+60, "... %s trace too long", pf_TaskTable[Caller].Name ); + vsi_o_assert ( NO_TASK, OS_SYST_ERR_STR_TOO_LONG, __FILE__, __LINE__,(char*)(P2D(prim))); + } + prim->opc = int_vsi_tc2trace_opc(TraceClass); + prim->len = strlen((char*)P2D(prim)) + sizeof(T_PRIM_HEADER); + prim->sh_offset = S_HDR_OFFSET(prim->len); + + return ( vsi_o_trace ( Caller, prim, suspend ) ); + } + if ( FrameEnv == ENV_STACK ) + { + TracesAborted[Caller]++; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_func_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a function name + +*/ +int vsi_o_func_itrace ( ULONG index, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_FUNC) ) + { + va_start (varpars, format); + return int_vsi_o_itrace ( Caller, TC_FUNC, index, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_event_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces an event + +*/ +int vsi_o_event_itrace ( ULONG index, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_EVENT) ) + { + va_start (varpars, format); + return int_vsi_o_itrace ( Caller, TC_EVENT, index, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_error_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces an error + +*/ +int vsi_o_error_itrace ( ULONG index, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_ERROR) ) + { + va_start (varpars, format); + int_vsi_o_itrace ( Caller, TC_ERROR, index, format, varpars ); + os_GetTaskName ( Caller, Caller, TaskName ); + vsi_o_ttrace ( NO_TASK, TC_ERROR, "TRACE ERROR in %s", pf_TaskTable[Caller].Name ); + return VSI_OK; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_state_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_state_itrace ( ULONG index, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_STATE) ) + { + va_start (varpars, format); + return int_vsi_o_itrace ( Caller, TC_STATE, index, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_class_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_class_itrace ( ULONG trace_class, ULONG Index, const char * const format, ... ) +{ +va_list varpars; +T_HANDLE Caller; + + Caller = e_running[os_MyHandle()]; + + if ( (Caller >= 0) && (TraceMask[Caller] & trace_class) ) + { + va_start (varpars, format); + return int_vsi_o_itrace ( Caller, trace_class, Index, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_ttrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int vsi_o_itrace ( T_HANDLE Caller, ULONG TraceClass, ULONG Index, const char * const format, ... ) +{ +va_list varpars; + + if ( (Caller >= 0) && (TraceMask[Caller] & TraceClass) ) + { + va_start (varpars, format); + return int_vsi_o_itrace ( Caller, TraceClass, Index, format, varpars ); + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : int_vsi_o_itrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a dynamic string + +*/ +int int_vsi_o_itrace ( T_HANDLE Caller, ULONG TraceClass, ULONG index, const char * const format, + va_list varpars ) +{ +T_PRIM_HEADER *prim; +LONG Status; +ULONG suspend; +unsigned int offset = 0; +unsigned int paramCount; +unsigned int i; + +/* + * the offset is calculated prior to the actual write operation + * to avoid writing beyond the allocated size + * + * all write operation are addressed relatively to the precalculated + * offset e.g. *(&Prim->Data + offset - 5) +*/ + if ( (Caller >= 0) && (TraceMask[Caller] & TraceClass) ) + { + suspend = get_suspend_state(Caller,CHECK_TRC_SUSPEND); + Status = os_AllocatePartition ( Caller, (T_VOID_STRUCT**)&prim, (ULONG)TextTracePartitionSize, suspend, TestGroupHandle ); + if ( Status == OS_OK || Status == OS_WAITED || Status == OS_ALLOCATED_BIGGER ) + { + + /* + * the index preceded by % + */ +#if 0 + /* be activated when PCO can handle this */ + if ( TraceClass == TC_ERROR ) + { + *((char*)(P2D(prim))) = '#'; + offset = 1; + } +#endif + offset += 5; + if(offset <= TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + { + *((char*)(P2D(prim)) + offset - 5) = '%'; + if(trc_LittleEndian) + { + *((char*)(P2D(prim)) + offset - 4) = *((char *)&index); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)&index)+1); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)&index)+2); + *((char*)(P2D(prim)) + offset - 1) = *(((char *)&index)+3); + } + else + { + *((char*)(P2D(prim)) + offset - 4) = *(((char *)&index)+3); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)&index)+2); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)&index)+1); + *((char*)(P2D(prim)) + offset - 1) = *((char *)&index); + } + } + /* + * parse the format string + */ + paramCount = strlen(format); + + for (i=0; i<paramCount; i++) + { + switch(*(format+i)) + { + case 'c': /* one byte */ + offset+=1; + if(offset <= TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + *((char*)(P2D(prim)) + offset - 1) = *((char *)varpars); + + va_arg(varpars, char); + break; + case 'i': /* four bytes */ + case 'p': + case '*': + offset+=4; + if(offset <= TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + { + if(trc_LittleEndian) + { + *((char*)(P2D(prim)) + offset - 4) = *((char *)varpars); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)varpars)+1); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)varpars)+2); + *((char*)(P2D(prim)) + offset - 1) = *(((char *)varpars)+3); + } + else + { + *((char*)(P2D(prim)) + offset - 4) = *(((char *)varpars)+3); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)varpars)+2); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)varpars)+1); + *((char*)(P2D(prim)) + offset - 1) = *((char *)varpars); + } + } + va_arg(varpars, int); + break; + case 'd': /* eigth bytes */ + offset += 8; + + /* + * TI and Microsoft represent double values differently + * + Double Host representation (address incressing from byte 1 to 8) + layout Microsoft TMS470x + + SEEEEEEE byte 8 byte 4 + EEMMMMMM byte 7 byte 3 + MMMMMMMM byte 6 byte 2 + MMMMMMMM byte 5 byte 1 + MMMMMMMM byte 4 byte 8 + MMMMMMMM byte 3 byte 7 + MMMMMMMM byte 2 byte 6 + MMMMMMMM byte 1 byte 5 + + S - sign bit + E - exponent bits + M - mantissa bits + + * + * double + */ + + + if(offset <= TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + { +#ifdef _TARGET_ + /* TI TMS470 Compiler */ + *((char*)(P2D(prim)) + offset - 4) = *((char *)varpars); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)varpars)+1); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)varpars)+2); + *((char*)(P2D(prim)) + offset - 1) = *(((char *)varpars)+3); + *((char*)(P2D(prim)) + offset - 8) = *(((char *)varpars)+4); + *((char*)(P2D(prim)) + offset - 7) = *(((char *)varpars)+5); + *((char*)(P2D(prim)) + offset - 6) = *(((char *)varpars)+6); + *((char*)(P2D(prim)) + offset - 5) = *(((char *)varpars)+7); +#else + /* + * This should work as well, since no reordering is done. + * Don't believe the VC5/6 manual which states a complete + * different byte order :( + * + */ + /* PC- Simulation */ + *((char*)(P2D(prim)) + offset - 8) = *((char *)varpars); + *((char*)(P2D(prim)) + offset - 7) = *(((char *)varpars)+1); + *((char*)(P2D(prim)) + offset - 6) = *(((char *)varpars)+2); + *((char*)(P2D(prim)) + offset - 5) = *(((char *)varpars)+3); + *((char*)(P2D(prim)) + offset - 4) = *(((char *)varpars)+4); + *((char*)(P2D(prim)) + offset - 3) = *(((char *)varpars)+5); + *((char*)(P2D(prim)) + offset - 2) = *(((char *)varpars)+6); + *((char*)(P2D(prim)) + offset - 1) = *(((char *)varpars)+7); +#endif /* _TARGET_ */ + } + + va_arg(varpars, double); + break; + case 's': /* a string of bytes */ + { + /* + * copy the string including the terminating NULL + */ + unsigned int len = strlen(*((char **)varpars)) + 1; + + offset += len; + if(offset <= TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + { + memcpy((char*)(P2D(prim)) + offset - len, *((char **)varpars), len); + } + va_arg(varpars, char **); + } + break; + default: /* unknown type */ + vsi_o_assert ( NO_TASK, OS_SYST_ERR_STR_TOO_LONG, __FILE__, __LINE__, + "Unknown Trace Format" ); + break; + } + } + + va_end (varpars); + /* + * if the amount of trace data was bigger than the allocated + * size - discard the trace and send an error trace instead + */ + if (offset > TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER)) + { + unsigned int n = (unsigned int)sprintf ((char*)P2D(prim),"ERROR: Compressed trace (index %d) too long (%d bytes). Trace discarded !!!",index, offset); + prim->len = n + sizeof(T_PRIM_HEADER); + } + else + { + prim->len = offset + sizeof(T_PRIM_HEADER); + } + + prim->opc = int_vsi_tc2trace_opc(TraceClass); + prim->sh_offset = S_HDR_OFFSET(prim->len); + + return ( vsi_o_trace ( Caller, prim, suspend ) ); + } + if ( FrameEnv == ENV_STACK ) + { + TracesAborted[Caller]++; + } + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_ptrace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a primitive opc and direction + +*/ +int vsi_o_ptrace ( T_HANDLE Caller, ULONG opc, UBYTE dir ) +{ +T_PRIM_HEADER *prim; +ULONG suspend; +LONG Status; +ULONG size; +int opc_len; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_PRIM) +#ifdef _TOOLS_ + && (SAP_NR(opc)!=TRACE_SAP) && (opc!=TRACE_OPC) +#endif + ) + { + suspend = get_suspend_state(Caller,CHECK_TRC_SUSPEND); + size = S_ALLOC_SIZE(PTRACE_LEN_OPC32); + Status = os_AllocatePartition ( Caller, (T_VOID_STRUCT**)&prim, size, suspend, TestGroupHandle ); + if ( Status == OS_OK || Status == OS_WAITED || Status == OS_ALLOCATED_BIGGER ) + { + prim->opc = int_vsi_tc2trace_opc(TC_PRIM); + + if ( dir ) + strcpy ( (char*)P2D(prim),"$---OUT:$p0x123456789" ); + else + strcpy ( (char*)P2D(prim),"$--- IN:$p0x123456789" ); + + if ( OPC32BIT(opc) ) + { + opc_len = CHARS_FOR_32BIT; + prim->len = PTRACE_LEN_OPC32; + } + else + { + opc_len = CHARS_FOR_16BIT; + prim->len = PTRACE_LEN_OPC16; + } + prim->len = prim->len + sizeof(T_PRIM_HEADER); + HexToASCII ( opc, (char*)P2D(prim) + 12, opc_len ); + strcpy (((char*)P2D(prim) + 12 + opc_len), "$" ); + + prim->sh_offset = S_HDR_OFFSET(prim->len); + return ( vsi_o_trace ( Caller, prim, suspend ) ); + } + TracesAborted[Caller]++; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_strace | ++--------------------------------------------------------------------+ + + PURPOSE : traces a state and state transition + +*/ +int vsi_o_strace (T_HANDLE Caller, const char *const machine, + const char *const curstate, + const char *const newstate) +{ +T_PRIM_HEADER *prim; +LONG Status; +ULONG size; +ULONG suspend; + + if ( (Caller >= 0) && (TraceMask[Caller] & TC_STATE) ) + { + suspend = get_suspend_state(Caller,CHECK_TRC_SUSPEND); + size = S_ALLOC_SIZE(STRACE_LEN); + Status = os_AllocatePartition ( Caller, (T_VOID_STRUCT**)&prim, size, suspend, TestGroupHandle ); + if ( Status == OS_OK || Status == OS_WAITED || Status == OS_ALLOCATED_BIGGER ) + { + strcpy ( (char *)P2D(prim), machine ); + strcat ( (char *)P2D(prim), ":" ); + strcat ( (char *)P2D(prim), curstate ); + if ( newstate != NULL ) + { + strcat ( (char *)P2D(prim), " -> " ); + strcat ( (char *)P2D(prim), newstate ); + } + + prim->opc = int_vsi_tc2trace_opc(TC_STATE); + prim->len = strlen((char*)P2D(prim)) + sizeof(T_PRIM_HEADER); + prim->sh_offset = S_HDR_OFFSET(prim->len); + + return ( vsi_o_trace ( Caller, prim, suspend ) ); + } + TracesAborted[Caller]++; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_o_assert | ++--------------------------------------------------------------------+ + + PURPOSE : assert + +*/ +/*lint -esym(715,cause) suppress Info -- Symbol 'cause' not referenced */ +int vsi_o_assert (T_HANDLE Caller, USHORT cause, const char *file, int line, const char * const format,...) +{ +va_list varpars; +#ifdef _TARGET_ +OS_QDATA Msg; + + while ( os_ReceiveFromQueue( Caller, pf_TaskTable[trc_hCommTrace].QueueHandle, &Msg, OS_NO_SUSPEND ) == OS_OK ) + { + tst_pei_primitive (Msg.ptr); + } +#endif + strcpy ( TraceBuffer, "SYSTEM ERROR: " ); + va_start (varpars, format); + vsprintf (TraceBuffer+strlen("SYSTEM ERROR: "), format, varpars); + va_end (varpars); + sprintf (TraceBuffer+strlen(TraceBuffer), ", %s(%d)", file, line ); +#ifdef _TOOLS_ + vsi_o_ttrace ( NO_TASK, TC_SYSTEM, TraceBuffer ); +#else + if ( cause & OS_SYST_ERR ) + emergeny_trace = 1; + tst_drv_write ( NO_TASK, 0, NULL, TraceBuffer ); + + if ( error_ind_dst[0] != 0 ) + { + frm_error_ind->error_code = cause; + strncpy ((char*)frm_error_ind->error_string, TraceBuffer, FRM_PRIM_STR_SIZE); + frm_error_ind->error_string[FRM_PRIM_STR_SIZE-1] = 0; + tst_drv_write ( NO_TASK, FRM_ERROR_IND, error_ind_dst, (char*)frm_error_ind ); + } +#endif +#if defined _NUCLEUS_ && !defined _TARGET_ + printf ("%s\n",TraceBuffer); + printf ( "Task %s suspended\n", pf_TaskTable[Caller].Name ); +#endif + if ( ext_trace_func.trace_assert != NULL ) + { + /* in case of OS_SYST_ERR_QUEUE_FULL we should not to send the trace to ACI, + because ACI will probably no longer be scheduled. + in case of OS_SYST_ERR_NO_PARTITION the PALLOC in ACI fails and will + probably hide the root cause of the problem. + */ + if ( cause != OS_SYST_ERR_QUEUE_FULL && cause != OS_SYST_ERR_NO_PARTITION ) + { + ext_trace_func.trace_assert ( format, varpars ); + os_SuspendTask ( Caller, 1000 ); + } + } +#ifdef _NUCLEUS_ + os_SystemError ( os_MyHandle(), cause, TraceBuffer ); +#endif + return VSI_OK; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_settracemask | ++--------------------------------------------------------------------+ + + PURPOSE : set trace mask + +*/ + +int vsi_settracemask ( T_HANDLE Caller, T_HANDLE Handle, ULONG Mask ) +{ + + if ( Handle == 0 || pf_TaskTable[Handle].Name[0] != 0 ) + { + TraceMask[Handle] = Mask; + TraceMask[0] |= TC_SYSTEM; + return VSI_OK; + } + else + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_gettracemask | ++--------------------------------------------------------------------+ + + PURPOSE : get trace mask + +*/ + +int vsi_gettracemask ( T_HANDLE Caller, T_HANDLE Handle, ULONG *Mask ) +{ + if ( Handle == 0 || pf_TaskTable[Handle].Name[0] != 0 ) + { + *Mask = TraceMask[Handle]; + return VSI_OK; + } + else + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_trcsuspend | ++--------------------------------------------------------------------+ + + PURPOSE : set suspend for traces + +*/ + +int vsi_trcsuspend ( T_HANDLE Caller, T_HANDLE Handle, ULONG Suspend ) +{ + /* SuspendTrace[Handle] = Suspend; */ + return VSI_OK; +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : vsi_trc_free | ++--------------------------------------------------------------------+ + + PURPOSE : monitor test interface partition allocation +*/ + +int vsi_trc_free ( T_HANDLE Caller, T_VOID_STRUCT **Prim ) +{ + if ( os_DeallocatePartition ( Caller, *Prim ) != OS_ERROR ) + { + *Prim = NULL; + return VSI_OK; + } + return VSI_ERROR; +} +#endif + +#ifndef RUN_INT_RAM +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : InitializeTestpools | ++--------------------------------------------------------------------+ + + PURPOSE : initialize supervision, write index to each partition. + +*/ +void InitializeTrace ( void ) +{ +USHORT i; +ULONG ByteOrder; + + /* + * test the byte order + */ + ByteOrder = 0x11223344; + + if(*((char *) &ByteOrder) == 0x44) + trc_LittleEndian = TRUE; + else if (*((char *) &ByteOrder) == 0x11) + trc_LittleEndian = FALSE; + else + vsi_o_assert ( NO_TASK, OS_SYST_ERR_STR_TOO_LONG, __FILE__, __LINE__, + "Unknown Byte Order" ); + emergeny_trace = 0; + trc_hCommTrace = VSI_ERROR;; + for ( i = 0; i <= MaxEntities; i++ ) + { + TracesAborted[i] = 0; +#ifdef _TARGET_ + TraceMask[i] = TC_SYSTEM|TC_ERROR; +#else /* _TARGET_ */ + TraceMask[i] = 0xffffffff & ~TC_CCD; +#endif /* _TARGET_ */ + } +#ifdef _TARGET_ +#endif + ext_trace_func.magic_nr = 0; + ext_trace_init(); +} +#endif + +#ifndef RUN_FLASH +/* ++--------------------------------------------------------------------+ +| PROJECT : GSM-Frame (8415) MODULE : VSI_TRC | +| STATE : code ROUTINE : get_suspend_state | ++--------------------------------------------------------------------+ + + PURPOSE : check if suspend is allowed. + +*/ +ULONG get_suspend_state ( T_HANDLE caller, int type ) +{ + + if ( caller != 0 ) + { +#ifdef _TARGET_ + if ( type == CHECK_TRC_SUSPEND ) + { + if ( pf_TaskTable[caller].Flags & TRC_NO_SUSPEND ) + { + return OS_NO_SUSPEND; + } + else + { + return OS_SUSPEND; + } + } + else if ( type == CHECK_PRIM_SUSPEND ) + { + if ( pf_TaskTable[caller].Flags & PRIM_NO_SUSPEND ) + { + return OS_NO_SUSPEND; + } + else + { + return OS_SUSPEND; + } + } + else + { + return OS_NO_SUSPEND; + } +#else + /* + It is checked if the caller is a SYSTEM_PROCESS to ensure that + TST and RCV do not block while tracing to avoid a deadlock. + */ + if ( pf_TaskTable[caller].Flags & SYSTEM_PROCESS ) + return OS_NO_SUSPEND; + else + return OS_SUSPEND; +#endif + } + else + { +#ifdef _TARGET_ + return OS_NO_SUSPEND; +#else + return OS_SUSPEND; +#endif + } +} +#endif + + +/* ------------------------------------------------------------------------- + External Trace functions +----------------------------------------------------------------------------*/ + +#ifdef TEST_EXT_TRACE + +#ifndef RUN_INT_RAM +void trace_error ( const char * const format, va_list varpars ) +{ +#ifndef _TARGET_ +char buf[99]; + + vsprintf (buf, format, varpars); + printf ("%s\n",buf); +#endif +} +#endif + +#ifndef RUN_INT_RAM +void trace_assert ( const char * const format, va_list varpars ) +{ +#ifndef _TARGET_ +char buf[99]; + + vsprintf (buf, format, varpars); + printf ("%s\n",buf); +#endif +} +#endif + +#endif /* TEST_EXT_TRACE */ + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : ext_trace_register ++------------------------------------------------------------------------------ +| Description : register the external trace functions. +| +| Parameters : func - pointer to API function pointer table +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void vsi_ext_trace_register ( T_EXT_TRACE_FUNC * func ) +{ + ext_trace_func.trace_error = func->trace_error; + ext_trace_func.trace_assert = func->trace_assert; + ext_trace_func.magic_nr = EXT_TRACE_INITIALIZED; +} +#endif + +#ifndef RUN_INT_RAM +/* ++------------------------------------------------------------------------------ +| Function : ext_trace_init ++------------------------------------------------------------------------------ +| Description : initialize external trace function pointer table. +| +| Parameters : void +| +| Return : void ++------------------------------------------------------------------------------ +*/ +void ext_trace_init ( void ) +{ +#ifdef TEST_EXT_TRACE + vsi_ext_trace_register ( &ext_trace_functions ); +#endif + if ( ext_trace_func.magic_nr != EXT_TRACE_INITIALIZED ) + { + ext_trace_func.trace_error = NULL; + ext_trace_func.trace_assert = NULL; + } +} +#endif + + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/frame/xalert.c Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,109 @@ +/* ++------------------------------------------------------------------------------ +| File: xalert.c ++------------------------------------------------------------------------------ +| 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 : ++----------------------------------------------------------------------------- +*/ +/*lint -emacro(718,va_start) Symbol 'Symbol' undeclared, assumed to return int */ + +#include <stdarg.h> +#include <stdio.h> +#include "typedefs.h" +#include "vsi.h" +#include "frm_glob.h" + +/* To store values from _Alert to alert_info */ +T_HANDLE AlertCallerStore; +ULONG AlertClassStore; + +BOOL _Alert(char *msg, T_HANDLE Caller, ULONG alertclass) +{ + int max = TextTracePartitionSize - sizeof(T_S_HEADER) - sizeof(T_PRIM_HEADER); + int len; + int end_filepos=0; + max=80; + while (msg[end_filepos] && msg[end_filepos] != ')') + { + end_filepos++; + } + len = end_filepos; + while (msg[len]) + { + len++; + } + + if ( len < max) + { + /* nice short message */ + vsi_o_ttrace(Caller, alertclass, "%s", msg); + } + else + { + /* if string is to long we need to cut of */ + if (end_filepos < max - 3) + { + /* if there is room for the file location we cut of at the end */ + vsi_o_ttrace(Caller, alertclass, "%.*s...", max - 3, msg); + } + else + { + /* if there is not even room for the file location we cut of as many directories at the start as needed */ + char *separator = NULL; + char *p = msg; + int l = end_filepos; + max -= 6; /* make room for ... at both end */ + /* find filename */ + while (l >= max) + { + separator = p; + while (l > 0 && *p != '/' && *p != '\\') + { + l--; + p++; + } + } + vsi_o_ttrace(Caller, alertclass, "...%.*s...", max - 6, separator); + } + } + + AlertCallerStore = Caller; + AlertClassStore = alertclass; + /* + * Note: this return value controls if alert_info is called, + * i.e. alert_info is not called if FALSE is returned. + */ + return TRUE; +} + +int int_vsi_o_ttrace ( T_HANDLE Caller, ULONG TraceClass, const char * const format, va_list varpars ); + +/* + * Alert Information + */ +BOOL alert_info(char *format, ...) +{ + va_list args; + + if ( (format != NULL) && (format[0] != 0) && (AlertCallerStore >= 0) && (TraceMask[AlertCallerStore] & AlertClassStore)) + { + va_start(args, format); + int_vsi_o_ttrace(AlertCallerStore, AlertClassStore, format, args); + va_end(args); + } + + /* The expression evaluated to FALSE by definition if this was called */ + return FALSE; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/CDG_ENTER.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,232 @@ + +/* ++------------------------------------------------------------------------------ +| File: cdg_enter.h ++------------------------------------------------------------------------------ +| Copyright Texas Instruments AG Berlin 2002-2003, Berlin +| All rights reserved. +| +| This file is confidential and a trade secret of Condat 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 AG Berlin. ++------------------------------------------------------------------------------ +| Purpose: Check the SrcFileTime of the cdginc header files at link time. +| +| The macros in this file help to detect version mismatch between +| header files included for build of different libraries. +| Example of a linker error: +| xx_tdc_3_constraints.obj : error LNK2001: +| unresolved external symbol +| "char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002" +| (?BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002@@3DA) +| \gpf\util\teststack\bin\test_xx_tdc\xx_tdc.dll : +| fatal error LNK1120: 1 unresolved externals +| Error executing link.exe. +| +| The first group of macros (protected by CDG_ENTER) are necessary +| to build the strings of type "BadLibVersionCheck__xxx". +| +| They need in turn other macros which are set in the *.h files of +| cdginc, tdcinc or message_san.h directory. +| (e.g. CDG_ENTER__M_XX_VAL_H__FILE_TYPE) +| +| The check is done only for the header files of TDC, where +| ENABLE__CDG_ENTER__SANITY_CHECK is switched on. +| ++------------------------------------------------------------------------------ +*/ +#ifndef CDG_ENTER +#define CDG_ENTER + +/*------- START <Fix for long identifiers for Arm 7 compiler - LHC> ----------*/ +/* ccdid.h */ +#define CCD_ID_UMTS_AS_ASN1__ho_to_utrancommand_r3_ies__spec_mode__preconf__pre_config_mode__default_config__default_config_mode shortname001 +#define CCD_ID_UMTS_AS_ASN1__ho_to_utrancommand_r3_ies__spec_mode__preconf__pre_config_mode__default_config__default_config_identity shortname002 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__fdd__freq_qual_estimate_quantity_fdd shortname003 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__tdd__freq_qual_estimate_quantity_tdd shortname004 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__body__fdd shortname005 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__body__tdd shortname006 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__body shortname007 +#define CCD_ID_UMTS_AS_ASN1__inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info shortname008 +#define CCD_ID_UMTS_AS_ASN1__meas_results_on_rach__current_cell__mode_specific_info__fdd__meas_quantity__body__cpich_ec_n0 shortname009 +#define CCD_ID_UMTS_AS_ASN1__meas_results_on_rach__current_cell__mode_specific_info__fdd__meas_quantity__body__cpich_rscp shortname010 +#define CCD_ID_UMTS_AS_ASN1__meas_results_on_rach__current_cell__mode_specific_info__fdd__meas_quantity__body__pathloss shortname011 +#define CCD_ID_UMTS_AS_ASN1__meas_results_on_rach__current_cell__mode_specific_info__fdd__meas_quantity__body__spare shortname012 +#define CCD_ID_UMTS_AS_ASN1__meas_results_on_rach__current_cell__mode_specific_info__fdd__meas_quantity__body shortname013 +#define CCD_ID_UMTS_AS_ASN1__monitored_cell_rach_result__mode_specific_info__fdd__meas_quantity__body__cpich_ec_n0 shortname014 +#define CCD_ID_UMTS_AS_ASN1__monitored_cell_rach_result__mode_specific_info__fdd__meas_quantity__body__cpich_rscp shortname015 +#define CCD_ID_UMTS_AS_ASN1__pusch_capacity_alloc_info__pusch_alloc__pusch_alloc_assignment__config__old_config__tfcs_id shortname016 +#define CCD_ID_UMTS_AS_ASN1__pusch_capacity_alloc_info__pusch_alloc__pusch_alloc_assignment__config__old_config__pusch_identity shortname017 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions__meas_control_v_3_a_0_ext shortname018 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions__non_critical_extensions shortname019 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions shortname020 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__meas_control_r3_add_ext shortname021 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname022 +#define CCD_ID_UMTS_AS_ASN1__meas_control__r3__v_390_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname023 + +#define CCD_ID_UMTS_AS_ASN1__ue_positioning_pos_estimate_info__ref_time__cell_timing__mode_specific_info__body__fdd shortname026 +#define CCD_ID_UMTS_AS_ASN1__ue_positioning_pos_estimate_info__ref_time__cell_timing__mode_specific_info__body__tdd shortname027 +#define CCD_ID_UMTS_AS_ASN1__ue_positioning_pos_estimate_info__ref_time__cell_timing__mode_specific_info__body shortname028 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__rrc_connection_setup_complete_v_3_a_0_ext shortname029 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__non_critical_extensions shortname030 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__rrc_connection_setup_complete_v_380_ext shortname031 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions shortname032 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions shortname033 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__rrc_connection_setup_complete_r3_add_ext shortname034 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname035 +#define CCD_ID_UMTS_AS_ASN1__rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname036 +#define CCD_ID_UMTS_AS_ASN1__ue_capab_info__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__ue_capab_info_v_3_a_0_ext shortname037 +#define CCD_ID_UMTS_AS_ASN1__ue_capab_info__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__non_critical_extensions shortname038 +#define CCD_ID_UMTS_AS_ASN1__ue_capab_info__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions shortname039 +#define CCD_ID_UMTS_AS_ASN1__ue_capab_info__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__ue_capab_info_r3_add_ext shortname040 +#define CCD_ID_UMTS_AS_ASN1__ue_capab_info__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname041 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__cpich_ec_n0__intra_freq_meas_sys_info shortname042 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__cpich_ec_n0__inter_freq_meas_sys_info shortname043 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__cpich_rscp__intra_freq_meas_sys_info shortname044 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__cpich_rscp__inter_freq_meas_sys_info shortname045 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__cpich_ec_n0__intra_freq_meas_sys_info shortname046 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__cpich_ec_n0__inter_freq_meas_sys_info shortname047 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__cpich_rscp__intra_freq_meas_sys_info shortname048 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__cpich_rscp__inter_freq_meas_sys_info shortname049 +#define CCD_ID_UMTS_AS_ASN1__pusch_capacity_alloc_info__pusch_alloc__pusch_alloc_assignment__config__new_config__pusch_info shortname050 +#define CCD_ID_UMTS_AS_ASN1__pusch_capacity_alloc_info__pusch_alloc__pusch_alloc_assignment__config__new_config__pusch_identity shortname051 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__body__cpich_rscp shortname052 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__body__cpich_ec_n0 shortname053 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_not_used__cell_select_qual_measure__body shortname054 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__body__cpich_rscp shortname055 +#define CCD_ID_UMTS_AS_ASN1__meas_control_sys_info__use_of_hcs__hcs_used__cell_select_qual_measure__body__cpich_ec_n0 shortname056 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions__inter_rat_ho_info_v_3_a_0_ext shortname057 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions__non_critical_extensions shortname058 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions shortname059 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname060 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions__later_non_critical_extensions__inter_rat_ho_info_v_3_d_0_ext shortname061 +#define CCD_ID_UMTS_AS_ASN1__inter_rat_ho_info__v_390_non_critical_extensions__present__v_3_a_0_non_critical_extensions__later_non_critical_extensions__inter_rat_ho_info_r3_add_ext shortname062 +#define CCD_ID_UMTS_AS_ASN1__assistance_data_delivery__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__assistance_data_delivery_r3_add_ext shortname063 +#define CCD_ID_UMTS_AS_ASN1__assistance_data_delivery__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname064 +#define CCD_ID_UMTS_AS_ASN1__assistance_data_delivery__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname065 +#define CCD_ID_UMTS_AS_ASN1__cell_update_cnf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__cell_update_cnf_r3_add_ext shortname066 +#define CCD_ID_UMTS_AS_ASN1__cell_update_cnf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname067 +#define CCD_ID_UMTS_AS_ASN1__cell_update_cnf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname068 +#define CCD_ID_UMTS_AS_ASN1__initial_direct_transfer__v_3_a_0_non_critical_extensions__later_non_critical_extensions__initial_direct_transfer_r3_add_ext shortname069 +#define CCD_ID_UMTS_AS_ASN1__initial_direct_transfer__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname070 +#define CCD_ID_UMTS_AS_ASN1__initial_direct_transfer__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname071 +#define CCD_ID_UMTS_AS_ASN1__phys_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__phys_ch_reconf_r3_add_ext shortname072 +#define CCD_ID_UMTS_AS_ASN1__phys_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname073 +#define CCD_ID_UMTS_AS_ASN1__phys_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname074 +#define CCD_ID_UMTS_AS_ASN1__rb_release__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__rb_release_r3_add_ext shortname075 +#define CCD_ID_UMTS_AS_ASN1__rb_release__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname076 +#define CCD_ID_UMTS_AS_ASN1__transport_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__transport_ch_reconf_r3_add_ext shortname077 +#define CCD_ID_UMTS_AS_ASN1__transport_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname078 +#define CCD_ID_UMTS_AS_ASN1__transport_ch_reconf__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname079 +#define CCD_ID_UMTS_AS_ASN1__utran_mobility_info__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__utran_mobility_info_r3_add_ext shortname080 +#define CCD_ID_UMTS_AS_ASN1__utran_mobility_info__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions__non_critical_extensions shortname081 +#define CCD_ID_UMTS_AS_ASN1__utran_mobility_info__r3__v_3_a_0_non_critical_extensions__later_non_critical_extensions shortname082 + +/* m_umts_as_asn1_inc.h */ +#define T_UMTS_AS_ASN1_inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__fdd shortname100 +#define T_UMTS_AS_ASN1_inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__tdd shortname101 +#define T_UMTS_AS_ASN1_inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info__body shortname102 +#define T_UMTS_AS_ASN1_inter_freq_meas_quantity__reporting_criteria__inter_freq_reporting_criteria__mode_specific_info shortname103 +#define T_UMTS_AS_ASN1_rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions__v_3_a_0_non_critical_extensions shortname104 +#define T_UMTS_AS_ASN1_rrc_connection_setup_complete__v_370_non_critical_extensions__v_380_non_critical_extensions shortname105 + +/* m_umts_as_asn1_inc.val */ +#define UMTS_AS_ASN1_UL_TIMESLOTS_CODES__MORE_TIMESLOTS__ADDITIONAL_TIMESLOTS__CONSECUTIVE__NUM_ADDITIONAL_TIMESLOTS__RANGE_MIN shortname200 +#define UMTS_AS_ASN1_UL_TIMESLOTS_CODES__MORE_TIMESLOTS__ADDITIONAL_TIMESLOTS__CONSECUTIVE__NUM_ADDITIONAL_TIMESLOTS__RANGE_MAX shortname201 +#define UMTS_AS_ASN1_INTER_FREQ_MEAS_QUANTITY__REPORTING_CRITERIA__INTER_FREQ_REPORTING_CRITERIA__MODE_SPECIFIC_INFO__FDD__TAG shortname202 +#define UMTS_AS_ASN1_INTER_FREQ_MEAS_QUANTITY__REPORTING_CRITERIA__INTER_FREQ_REPORTING_CRITERIA__MODE_SPECIFIC_INFO__TDD__TAG shortname203 +/*------- END <Fix for long identifiers for Arm 7 compiler - LHC>-----------*/ + + + +//Mapping types due to issue/problem with CCDGEN_2.3.6 - KSP +//typedef typename T_TDC_INTERFACE_UMTS_AS_ASN1_uarfcn T_TDC_INTERFACE_GSI_uarfcn +#define T_TDC_INTERFACE_GSI_uarfcn T_TDC_INTERFACE_UMTS_AS_ASN1_uarfcn +#define T_TDC_HANDLE_GSI_uarfcn T_TDC_HANDLE_UMTS_AS_ASN1_uarfcn +#define T_TDC_INTERFACE_GSI_primary_scrambling_code T_TDC_INTERFACE_UMTS_AS_ASN1_primary_scrambling_code +#define T_TDC_HANDLE_GSI_primary_scrambling_code T_TDC_HANDLE_UMTS_AS_ASN1_primary_scrambling_code +#define T_GSI_start_val T_UMTS_AS_ASN1_start_val + + +/* we need a 2 stage approach to expand A and B before concatting them */ +#define CDG_ENTER_CONCATx(A,B) A##B +#define CDG_ENTER_CONCAT(A,B) CDG_ENTER_CONCATx(A,B) +#define CDG_ENTER_CONCAT3x(A,B,C) A##B##C +#define CDG_ENTER_CONCAT3(A,B,C) CDG_ENTER_CONCAT3x(A,B,C) +#define CDG_ENTER_CONCAT4x(A,B,C,D) A##B##C##D +#define CDG_ENTER_CONCAT4(A,B,C,D) CDG_ENTER_CONCAT4x(A,B,C,D) + +/* we need a 2 stage approach to expand A before stringifying it */ +#define CDG_ENTER_STRINGx(A) #A +#define CDG_ENTER_STRING(A) CDG_ENTER_STRINGx(A) + +#define CDG_ENTER_GET_PRAGMA(PRAGMA) CDG_ENTER_CONCAT3(CDG_ENTER_,CDG_ENTER__FILENAME,__##PRAGMA) + +/* CDG_ENTER_GET_FILE_TYPE is on the form: + CDG_ENTER_FILE_TYPE__TDCINC + <-FT-> + + FT = CDG_ENTER_GET_PRAGMA(_FILE_TYPE) = CDG_ENTER__P_XX_CCD_DSC_CPP__FILE_TYPE = TDCINC +*/ +#define CDG_ENTER_GET_FILE_TYPE CDG_ENTER_CONCAT(CDG_ENTER_FILE_TYPE__,CDG_ENTER_GET_PRAGMA(FILE_TYPE)) + +/* CDG_ENTER_SANITY_NAME is on the form: + BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002 + <-- FILENAME --> <-- SRC_FILE_TIME --> +*/ +#if 0 +#define CDG_ENTER_SANITY_NAME CDG_ENTER_CONCAT4(BadLibVersionCheck___,CDG_ENTER__FILENAME,___,CDG_ENTER_GET_PRAGMA(LAST_MODIFIED)) +#else +#define CDG_ENTER_SANITY_NAME CDG_ENTER_CONCAT4(BadLibVersionCheck___,CDG_ENTER__FILENAME,___,CDG_ENTER_GET_PRAGMA(SRC_FILE_TIME)) +#endif + +/* create an enumerate sequence of the known file types so we can test which one we have with a '#if A == B' line */ +#define CDG_ENTER_FILE_TYPE__CDGINC 1 +#define CDG_ENTER_FILE_TYPE__TDCINC 2 +#define CDG_ENTER_FILE_TYPE__TDCINC_DSC 3 +#define CDG_ENTER_FILE_TYPE__TDCINC_MAIN 4 +#endif + +/* + * The check will be done only for TDC files, where + * ENABLE__CDG_ENTER__SANITY_CHECK is switched on. + */ +#if (CDG_ENTER_GET_FILE_TYPE == CDG_ENTER_FILE_TYPE__TDCINC) +#define ENABLE__CDG_ENTER__SANITY_CHECK +#endif + +#ifdef CDG_ENTER_DEBUG +#pragma message (CDG_ENTER_STRING(CDG_ENTER__FILENAME)) +#pragma message (CDG_ENTER_STRING(CDG_ENTER_SANITY_NAME)) +#pragma message (CDG_ENTER_STRING(CDG_ENTER_GET_FILE_TYPE)) +#endif + +#ifdef ENABLE__CDG_ENTER__SANITY_CHECK + #ifdef CDG_ENTER_DEFINE_SANITY + /* this part goes into ccddata.lib and tdcinc.lib */ + char CDG_ENTER_SANITY_NAME; + #else + #ifdef CDG_ENTER_DEBUG + #pragma message (CDG_ENTER_STRING(CDG_ENTER_CONCAT(BadLibVersionCheck___,CDG_ENTER__FILENAME))) + #endif + /* this part goes into + every stack file using a cdginc .h or .val files (ones for every file used) + and similar for tdc + + expands to e.g. + extern char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002 + */ + extern char CDG_ENTER_SANITY_NAME; + /* Originally it was this but since no one actually uses this stuff (we only have + it for the linker to check that versions match) we can save memory by only + storing the 8 lower bits. + + expands to e.g. + static char BadLibVersionCheck____P_XX_TDC_3_VAL_H = (char)(&BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002); + */ + static char CDG_ENTER_CONCAT(BadLibVersionCheck___,CDG_ENTER__FILENAME) = (char)(&CDG_ENTER_SANITY_NAME); + #endif +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/CDG_LEAVE.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,25 @@ +/* ++------------------------------------------------------------------------------ +| File: cdg_leave.h ++------------------------------------------------------------------------------ +| Copyright Texas Instruments AG Berlin 2002-2003, Berlin +| All rights reserved. +| +| This file is confidential and a trade secret of Condat 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 AG Berlin. ++------------------------------------------------------------------------------ +| Purpose: Epilog file for autogenerated files +| + +| +| $Identity:$ ++------------------------------------------------------------------------------ +*/ + +#ifdef CDG_ENTER__WARNING_OFF + #error this stuff has been removed from \gpf\inc\cdg_enter.h +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/Ccdedit.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,364 @@ +/* ++------------------------------------------------------------------------------- +| Project : +| Modul : Ccdedit.h ++------------------------------------------------------------------------------- +| 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 : Coder Decoder Edit functions ++------------------------------------------------------------------------------- +*/ + +#ifndef __CCDEDIT_H__ +#define __CCDEDIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif /*_cplusplus*/ + +/* + * The handle structure for primitives/messages + */ +/* + * level of substructured elements in substructures + */ +#define MAX_LEVELS 20 + +typedef enum +{ + TRAVERSE_ARRAY, + TRAVERSE_STRUCTURE +} T_CTX_STATE; + +typedef enum +{ + NoArray, + FixArray, + VarArray +} T_ATYPE; + +typedef enum +{ + FromMsg, FromPrim +} T_ELM_SRC; + +typedef struct +{ + USHORT structIdx; + USHORT elemIdx; + UBYTE elemType; + T_CTX_STATE state; + USHORT arrayIndex; + USHORT repeats; /* valid repeats */ + USHORT numElems; + U32 levelOffset; + T_ATYPE arrayType; /* elem is an fix or */ + /* variable or no array */ +} T_CCDE_CONTEXT; + +typedef struct +{ + UBYTE level; + BOOL canDescent; + T_ELM_SRC source; + U32 maxCSize; + USHORT lenVarPart; /* length of the variable + part e.g. a SDU */ + T_CCDE_CONTEXT context[MAX_LEVELS]; +} T_CCDE_HANDLE; + +typedef enum +{ + noptr, + usptr, + ctptr +} T_PTRTYPE; + +/* + * The type of the C-structure component + */ +typedef enum +{ + T_none, + T_byte, + T_short, + T_long, + T_buffer, + T_struct, + T_union, + T_issdu, + T_ductrl +} T_BTYPE; + +#define NO_REF 0xffff + +#define SHORT_NAME_LENGTH 256 +#define ALIAS_NAME_LENGTH 256 +#define LONG_NAME_LENGTH 100 +#define SYMBOLIC_VAL_LENGTH 150 + + +typedef struct +{ + T_ELM_SRC esource; /* source of element(MSG/PRIM)*/ + T_BTYPE btype; /* C-type of element */ + T_ATYPE arrayType; /* elem is an fix or */ + T_PTRTYPE ptrtype; /* pointer type */ + BOOL isOptional; + BOOL isValid; + U32 bytelen; /* length in byte */ + U32 offset; /* byteoffs in C-Structure*/ + /* variable or no array */ + USHORT maxRepeat; /* max repeats if isArray */ + USHORT validRepeats; /* valid repeats */ + USHORT index; /* act. idx in array */ + USHORT ccdIndex; + UBYTE level; /* level of descending */ + BOOL u_member; + U32 u_ctrl; /* union tag */ + USHORT elemref; /* elemref from [pm]elem.cdg */ + USHORT bitstring; /* it is an ANS1_BITSTRINGS */ + USHORT issigned; /* it is a signed variable */ + USHORT c_implicit; /* counter c_xxx is generated */ + char sname[SHORT_NAME_LENGTH+1]; + char aname[ALIAS_NAME_LENGTH+1]; + char lname[LONG_NAME_LENGTH+1]; + char symbolicValue[SYMBOLIC_VAL_LENGTH+1]; + int valcheck; /* indicates if value was in range */ +} T_CCDE_ELEM_DESCR; + +/* + * Definitions of returnvalues of the ccd_xxxx functions. + */ + +#define CCDEDIT_OK 0 +#define CCDEDIT_PRIM_NOT_FOUND 1 +#define CCDEDIT_END_OF_PRIM 2 +#define CCDEDIT_PRIMITIVE_ERROR 3 +#define CCDEDIT_MESSAGE_NOT_FOUND 1 +#define CCDEDIT_END_OF_MSG 2 +#define CCDEDIT_MESSAGE_ERROR 3 +#define CCDEDIT_COMP_NOT_FOUND 1 +#define CCDEDIT_END_OF_COMP 2 +#define CCDEDIT_COMP_ERROR 3 +#define CCDEDIT_UTAG_ERROR 1 +#define CCDEDIT_DLL_ERROR 10 +#define CCDEDIT_ERROR -2 + +/* and for the former tdc functions */ +#define NO_ENTRY_FOUND 0xffffffff + +#if !defined (CCDDATA_PREF) +#if defined (_TOOLS_) && defined (CCDDATA_LOAD) +#define CCDDATA_PREF(cde_fun) cddl_##cde_fun +#else +#define CCDDATA_PREF(cde_fun) cde_fun +#endif /* _TOOLS_ && CCDDATA_LOAD */ +#endif /* !CCDDATA_PREF */ + +#ifndef CCDEDIT_C + +/* + * Initialize the internal data of ccdedit. Must be called before any + * of the other functions. + */ +extern void CCDDATA_PREF(cde_init) (void); + +/* + * This function works with similar results like cde_comp_first, + * but not the whole comp table is searched for the name of the + * component. Instead the previous set elemref in the + * parameter edescr is taken to directly jump to the component. + * The component found is compared with the given name in + * edescr. If equal chandle is defined. Otherwise there is an error. + */ +extern USHORT CCDDATA_PREF(cde_get_comp) (T_CCDE_HANDLE* chandle, + T_CCDE_ELEM_DESCR* edescr); + +/* + * Selects the primitive for edit processing. The code of the + * primitive (primcode) must be passed to the function. + * The function returns a State and the primname in (*name) + * and a handle for this edit process (phandle). + * After a successful call the component maxCSize of the + * phandle contains the size of the C-Structure for this primitive. + */ +extern USHORT CCDDATA_PREF(cde_prim_first) (T_CCDE_HANDLE * phandle, + ULONG primcode, + char * name); +/* + * Get the next element of the selected primitive. All informations + * of this element is stored into the element descriptor (pdescr). + */ +extern USHORT CCDDATA_PREF(cde_prim_next) (T_CCDE_HANDLE * phandle, + UBYTE descent, + T_CCDE_ELEM_DESCR * pdescr); + + +/* + * Selects the message for edit processing. The message type (type), + * the (entity) and the (direction) must be passed to this function. + * The function returns a State and the messagename in (*name) + * and a handle for this edit process (mhandle). + * After a successful call the component maxCSize of the + * mhandle contains the size of the C-Structure for this message. + */ +extern USHORT CCDDATA_PREF(cde_msg_first) (T_CCDE_HANDLE * mhandle, + UBYTE type, + UBYTE direction, + UBYTE entity, + char * name); + + +/* + * Get the next element of the selected primitive. All informations + * of this element is stored into the element descriptor (iedescr). + */ +extern USHORT CCDDATA_PREF(cde_msg_next) (T_CCDE_HANDLE * mhandle, + UBYTE descent, + T_CCDE_ELEM_DESCR * iedescr); + +/* + * Selects at COMPOSITION (structure) for edit processing. + * The short name (compname) of this composition must be passed + * to this function. + * The function returns a State and ahandle for this + * edit process (chandle). + * This function may be used for sub-structures (compositions) + * of primitives and messages. + * After a successful call the component maxCSize of the + * chandle contains the size of the C-Structure for this composition. + */ +extern USHORT CCDDATA_PREF(cde_comp_first) (T_CCDE_HANDLE * chandle, + T_ELM_SRC source, + char * compname); + +/* + * Get the next element of the selected composition. All informations + * of this element is stored into the element descriptor (cdescr). + */ +extern USHORT CCDDATA_PREF(cde_comp_next) (T_CCDE_HANDLE * chandle, + UBYTE descent, + T_CCDE_ELEM_DESCR * descr); + +/* + * Add the "Comment" of the SAP-/MSG-catalogues to the member symbolicValue + * of a given T_CCDE_ELEM_DESCR. + * This functionality was part of cde_read_elem and is now extracted + * to a dedicated function. + */ +extern char* CCDDATA_PREF(cde_get_symval) (int elem_value, + T_CCDE_ELEM_DESCR* edescr); + +/* + * Read the value of the element out of the C-Structure (cstruct) + * which containes a primitive or a decoded message. The infomations + * of the element is stored in the input parameter edescr, wich is + * previously assigned by a cde_xxxx_next () call. The value of this + * element is stored in the memory area addressed by (*value). + * After this call, the component symbolicValue of the edescr-struct + * is updated with a symbolic value string, (if any defined). + */ +extern USHORT CCDDATA_PREF(cde_read_elem) (T_CCDE_HANDLE * handle, + void * cstruct, + T_CCDE_ELEM_DESCR * edescr, + UBYTE * value); + + +/* + * prepares the writing of elements, by setting valid flag, + * union controller and length of vaiable arrays if necessary. + * First version: union controller only. + */ +extern void CCDDATA_PREF(cde_write_prepare) (T_CCDE_HANDLE * handle, + void * cstruct, + T_CCDE_ELEM_DESCR * edescr); + +/* + * Store the value from the memory area which is addressed by (*value) + * into the corrensponding position into the C-Structure (cstruct) + * which containes a primitive or a decoded message. The infomations + * of the element is stored in the input parameter edescr, wich is + * previously assigned by a cde_xxxx_next () call. + */ +extern USHORT CCDDATA_PREF(cde_write_elem) (T_CCDE_HANDLE * handle, + void * cstruct, + T_CCDE_ELEM_DESCR * edescr, + UBYTE * value); + + +/* + * This function requests if the given name is the name of + * a primitive or of a message. If the function returns + * CCDEDIT_OK the return parameter source is set to FromPrim + * or to FromMsg. Otherwise CCDEDIT_PRIM_NOT_FOUND/CCD_EDIT_MESSAGE_NOT_FOUND + * is returned. + */ +extern USHORT CCDDATA_PREF(cde_get_type) (char * name, + T_ELM_SRC * source); + +/* + * This function requests the opcode of a primitive. The + * name of the primitive is given by the input paramater name. + * If the function returns CCDEDIT_OK the parameter primcode + * contains the 16 bit opcode. Otherwise CCDEDIT_PRIM_NOT_FOUND + * is returned. + */ +extern USHORT CCDDATA_PREF(cde_get_primcode) (char * name, + ULONG * primcode); + + + +/* + * This function requests the opcode, the direction and the + * entity index of a message. The name of the message is given + * by the input paramater name. + * If the function returns CCDEDIT_OK the return parameters types, + * direction and entity contains the right values. + * Otherwise CCDEDIT_MESSAGE_NOT_FOUND is returned. + */ +extern USHORT CCDDATA_PREF(cde_get_msgcode) (char * name, + UBYTE * type, + UBYTE * direction, + UBYTE * entity); + +/* + * This function finds out if an AIM is a downlink or uplink. + */ +extern int CCDDATA_PREF(cde_get_is_downlink) (ULONG comp_index); + +/* + * This function searches the comp index in either pcomp or mcomp + */ +extern ULONG CCDDATA_PREF(cde_get_comp_index) (CHAR* comp_name, + T_ELM_SRC table); + +/* + * This function gets the element name for a given index + offset. + */ +extern CHAR* CCDDATA_PREF(cde_get_element_name) (ULONG comp_index, + USHORT elem_off, + T_ELM_SRC table); + +/* + * This function gets the array kind - e.g. the cSize of the + * arrays (byte, short og long). + */ +extern ULONG CCDDATA_PREF(cde_get_array_kind) (CHAR* var_name, T_ELM_SRC table); + +#endif /* !CCDEDIT_C */ + +#ifdef __cplusplus +} +#endif /*_cplusplus*/ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/alert.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,53 @@ +/* ++------------------------------------------------------------------------------ +| File: alert.h ++------------------------------------------------------------------------------ +| 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 ALERT macro. ++----------------------------------------------------------------------------- +*/ + +#ifndef ALERT_H +#define ALERT_H + +#undef ALERT +#undef E_ALERT + +#ifndef ALERT_OFF + #include "typedefs.h" + #include "vsi.h" + + extern BOOL _Alert(char *, T_HANDLE, ULONG); + extern BOOL alert_info(char *, ...); + #define NO_ALERT_INFO alert_info("") + + #define _STR(x) _VAL(x) + #define _VAL(x) #x + /* + * The && FALSE in the end is just to notify the reader that + * FALSE is always returned if the predicate evaluates to false. + */ + #define ALERT(expression, alertclass, function) ((expression) ? ((void) 0) : \ + (void) (_Alert(__FILE__ "(" _STR(__LINE__) ") \"" #expression "\"", VSI_CALLER TC_ALERT_##alertclass) && (function))) + + #define E_ALERT(expression, alertclass, function) ((expression) ? (TRUE) : \ + (BOOL) (_Alert(__FILE__ "(" _STR(__LINE__) ") \"" #expression "\"", VSI_CALLER TC_ALERT_##alertclass) && (function) && FALSE)) + +#else /* ALERT_OFF */ + #define NO_ALERT_INFO (0) + #define ALERT(expression, alertclass, function) ((void) 0) + #define E_ALERT(expression, alertclass, function) (expression) +#endif /* ALERT_OFF */ + +#endif /* ALERT_H */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/ccd_codingtypes.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,75 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : ccd_codingtypes.h ++----------------------------------------------------------------------------- +| Copyright 2004 Texas Instruments Deutschland GmbH +| All rights reserved. +| +| This file is confidential and a trade secret of Texas +| Instruments Deutschland GmbH +| 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 Deutschland GmbH. ++----------------------------------------------------------------------------- +| Purpose : Definition of constant numbers for coding types used by CCD and +| CCDDATA ++----------------------------------------------------------------------------- +*/ + +#define MAX_CODEC_ID 0x2f + +/* + * These numbers refer to the place of each used en/decoding function + * in the codec table. The first entry is reserved for cdc_STD_encode and + * cdc_STD_decode. + */ +#define CCDTYPE_GSM1_V 0x1 +#define CCDTYPE_GSM1_TV 0x2 +#define CCDTYPE_GSM2_T 0x3 +#define CCDTYPE_GSM3_V 0x4 +#define CCDTYPE_GSM3_TV 0x5 +#define CCDTYPE_GSM4_LV 0x6 +#define CCDTYPE_GSM4_TLV 0x7 +#define CCDTYPE_GSM5_V 0x8 +#define CCDTYPE_GSM5_TLV 0x9 +#define CCDTYPE_GSM6_TLV 0xa +#define CCDTYPE_GSM7_LV 0xb +#define CCDTYPE_GSM1_ASN 0xc +#define CCDTYPE_BCDODD 0xd +#define CCDTYPE_BCDEVEN 0xe +#define CCDTYPE_BCD_NOFILL 0xf +#define CCDTYPE_BCD_MNC 0x10 +#define CCDTYPE_CSN1_S1 0x11 +#define CCDTYPE_CSN1_SHL 0x12 +#define CCDTYPE_S_PADDING 0x13 +#define CCDTYPE_T30_IDENT 0x14 +#define CCDTYPE_BITSTRING 0x15 +#define CCDTYPE_ASN1_INTEGER 0x16 +#define CCDTYPE_ASN1_SEQUENCE 0x17 +#define CCDTYPE_ASN1_CHOICE 0x18 +#define CCDTYPE_ASN1_OCTET 0x19 +#define CCDTYPE_NO_CODE 0x1a +#define CCDTYPE_ASN1_INTEGER_EXTENSIBLE 0x1b +#define CCDTYPE_ASN1_SEQUENCE_EXTENSIBLE 0x1c +#define CCDTYPE_ASN1_CHOICE_EXTENSIBLE 0x1d +#define CCDTYPE_ASN1_OBJ_ID 0x1e +#define CCDTYPE_ASN1_OPEN_TYPE 0x1f +#define CCDTYPE_NONCRITICAL_EXT 0x20 +#define CCDTYPE_CRITICAL_EXT 0x21 +#define CCDTYPE_S_PADDING_0 0x22 +#define CCDTYPE_CSN1_S0 0x23 +#define CCDTYPE_HL_FLAG 0x24 +#define CCDTYPE_FDD_CI 0x25 +#define CCDTYPE_TDD_CI 0x26 +#define CCDTYPE_FREQ_LIST 0x27 +#define CCDTYPE_CSN1_CONCAT 0x28 +#define CCDTYPE_BREAK_COND 0x29 +#define CCDTYPE_GSM5_TV 0x2a +#define CCDTYPE_CSN1_CHOICE1 0x2b +#define CCDTYPE_CSN1_CHOICE2 0x2c +#define CCDTYPE_CSN1_SHL_OPT 0x2d +#define CCDTYPE_CSN1_S1_OPT 0x2e +#define CCDTYPE_CSN1_S0_OPT 0x2f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/ccdapi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,557 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : ccdapi.h ++----------------------------------------------------------------------------- +| 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 : Condat Coder Decoder Application Interface +| +| Use this header to integrate the condat coder decoder +| in your target system ! +| +| The application must define USE_DRIVER if CCD is +| not linked but used as a driver ++----------------------------------------------------------------------------- +*/ + +#ifndef CCDAPI_H +#define CCDAPI_H + +#ifdef __cplusplus +extern "C" { +#endif /*_cplusplus*/ + +/************************************************************** + Types and constants for CCD + used in application, in stub1 (api) and in driver body + **************************************************************/ + +/*==== CONSTANTS ==================================================*/ +/* + * constants for the direction-parameter for coding/decoding + */ + +#define UPLINK 0 +#define DOWNLINK 1 +#define BOTH UPLINK + + /* ccd Error codes */ +#define ccdOK 0 +#define ccdWarning 1 +#define ccdError 2 +#ifdef _TOOLS_ +#define CCD_DLL_ERROR 23 +#endif /* _TOOLS_ */ + +/* reentrancy */ +#define CCD_REENTRANT 0 + +/* + * Error codes to use with ccd_setError() + */ +#define ERR_NO_MORE_ERROR 0 /* Returned by ccd_getFirst/NextError */ + /* in case of the end of the error list */ + +#define ERR_INVALID_CALC 1 /* Invalid combination of calculations */ + /* Error params: none */ + +#define ERR_PATTERN_MISMATCH 2 /* A spare pattern does not match with */ + /* the specified content */ + /* Error params[0] = bitposition */ + +#define ERR_COMPREH_REQUIRED 3 /* Comprehension of an unknown TAG */ + /* required. */ + /* Error params[0] = TAG */ + /* [1] = bitposition */ + +#define ERR_IE_NOT_EXPECTED 4 /* Unknown or unexpected TAG found */ + /* Error params[0] = TAG */ + /* [1] = bitposition */ + +#define ERR_IE_SEQUENCE 5 /* A valid TAG is found but not in the */ + /* defined sequence. */ + /* Error params[0] = TAG */ + /* [1] = bitposition */ + +#define ERR_MAX_IE_EXCEED 6 /* A repeatable TAG is found but it */ + /* occurs more often than it is defined */ + /* Error params[0] = TAG */ + /* [1] = bitposition */ + +#define ERR_MAND_ELEM_MISS 7 /* A as mandatory defined element is */ + /* not in the message */ + /* Error params: none */ + +#define ERR_EOC_TAG_MISSING 8 /* A indefinite length is specified for */ + /* an ASN.1 element but the correspond. */ + /* End of Component TAG is missing */ + /* Error params[0] = TAG */ + /* [1] = bitposition */ + +#define ERR_INVALID_MID 9 /* The message starts with an undefined */ + /* message identifier; more exactly: */ + /* with the three given parameters mId, */ + /* entity, and direction for the coding */ + /* or decoding of a Message functions */ + /* CCD was not able to identify the */ + /* Message */ + /* Error params[0] = Message ID */ + +#define ERR_INVALID_TYPE 10 /* The actual element has an invalid */ + /* type e.g. S_PADDING without a spare */ + /* Error params[0] = bitposition */ + +#define ERR_MAX_REPEAT 11 /* A repeatable element occurs to often */ + /* in the message */ + +#define ERR_NO_MEM 12 /* Memory allocation failed. May result */ + /* occur when using pointer types. */ + /* (Dynamic array addition) */ + +#define ERR_ADDR_INFO_PART 13 /* CCD recognizes a message with a */ + /* disallowed addressing option */ + +#define ERR_DISTRIB_PART 14 /* CCD recognizes an error during */ + /* decoding of the message distribution */ + /* part */ + +#define ERR_NON_DISTRIB_PART 15 /* CCD recognizes an error during */ + /* decoding of the message non- */ + /* distribution part */ + +#define ERR_MESSAGE_ESCAPE 16 /* CCD detects an unknown message part, */ + /* which is marked whith a message */ + /* escape error label being used to */ + /* provide an escape for, e.g. a future */ + /* modification of the message syntax */ + +#define ERR_IGNORE 17 /* CCD detects a part of the message */ + /* that is syntactically incorrect and */ + /* is allowed to ignore this part */ + +#define ERR_18 18 /* dummy to complete error list - */ + /* may be used in furture enhancement */ + +#define ERR_19 19 /* dummy to complete error list - */ + /* may be used in furture enhancement */ + +#define ERR_INTERNAL_ERROR 20 /* An internal error occured */ + /* (hopefully not!) */ + /* Error params[0] = none */ +#define ERR_DEFECT_CCDDATA 21 /* The value read from a ccd table */ + /* (one of the *.cdg files) is not */ + /* expected by CCD, e.g. extGroup has */ + /* another value than ' ', '+', '-', */ + /* '!' or '#'. */ + /* Error params[0] = bitposition */ + /* this error code is needed only in */ + /* the development phase. */ +#define ERR_END_OF_BUF 22 /* According to the lenght indicator */ + /* there must be more bits to read but */ + /* end of bit buffer is reached */ + +#define ERR_INT_VALUE 23 /* Error on encoding of integer value. */ + /* IE of coding type ASN1_INTEGER is */ + /* out of the given range. */ + +#define ERR_LONG_MSG 24 /* UNUSED error code */ + /* According to l_buf and due to an */ + /* unknown message extension there are */ + /* more bits to be decoded than CCD or */ + /* ccddata expects. */ + +#define ERR_ASN1_ENCODING 25 /* Error on IE in the outermost level. */ +#define ERR_ASN1_MAND_IE 26 /* Error on mandatory IE of type */ + /* ASN1_INTEGER. The decoded value is */ + /* out of the range given by the loaded */ + /* ccd data tables. */ + /* data tables. */ +#define ERR_ASN1_OPT_IE 27 /* Error on optional IE of type. */ + /* ASN1_INTEGER. The decoded value is */ + /* out of the range given by the loaded */ + /* ccd data tables. */ +#define ERR_ASN1_COND_IE 28 /* UNUSED error code */ +#define ERR_COND_ELEM_MISS 29 /* UNUSED error code */ + /* Condition is met but the IE is not */ + /* present in the message. */ +#define ERR_BUFFER_OF 30 /* On coding, more bits were written, */ + /* than the input l_buf suggested. */ + +#define ERR_NONCRITICAL_EXT 31 /* Warning (if decoding) or error (if */ + /* encoding) on inappropriate usage of */ + /* a nonCriticalExtensions element. */ + /* The CCDTYPE_NONCRITICAL_EXTENSIONS */ + /* says the IE is not extended yet from */ + /* a CCD point of view. So it needs */ + /* neither to be encoded nor decoded. */ + /* In the latter case additional parts */ + /* at the end the message will be */ + /* ignored by CCD. Known extensions are */ + /* to be encoded by CCD. */ + +#define ERR_CRITICAL_EXT 32 /* Error on inappropriate usage of a */ + /* nonCriticalExtensions element. The */ + /* CCDTYPE_CRITICAL_EXTENSIONS says */ + /* the IE is not extended yet, from a */ + /* CCD point of view. So it needs not */ + /* to be encoded or decoded. In latter */ + /* case message is not comprehendable */ + /* and must be rejected. */ + +#define ERR_INVALID_CCDID 33 /* The ccd identifier for the element */ + /* to be decoded did not result a valid */ + /* data table entry. */ + +#define ERR_MSG_LEN 34 /* Decoding is just finished. But the */ + /* CCD internal bit pointer is beyond */ + /* the given message length, l_buf e.g. */ + +#define ERR_INVALID_PTR 35 /* Pointer used in C struct for encoding*/ + /* is not valid. */ +#define ERR_PROTOCOL_EXTENSION 36 /* IE of type S_PADDING_0 is preceded */ + /* by 1 instead of 0. */ + /* Error params[0] = CCDID */ + /* [1] = bitposition */ + +#define ERR_BITSTR_COMP 37 /* Length of bit array encoded as */ + /* composition is bigger than expected */ + /* Error params[0] = CCDID */ + /* [1] = addr in C-struct */ + +#define ERR_ELEM_LEN 38 /* The current information element's */ + /* length doesn't match to the length */ + /* required by its nested elements */ + +#define ERR_LEN_MISMATCH 39 /* The length of a superordinated */ + /* doesn't match to read an GSM5_V */ + /* element, which extends to the */ + /* message end. */ + +#define ERR_CONCAT_LEN 40 /* Coding of a truncated concatenation */ + /* doesn't fill the rest of message */ + /* buffer.(length given by l_buf) */ + +#define ERR_UNEXPECT_PAD 41 /* an inchoate byte is filled with */ + /* padding bits which are not expected */ + +#define ERR_CSN1_CHOICE 42 /* the number of CHOICE components */ + /* doesn't match to number of possible */ + /* alternatives */ + +#define MAX_CCD_ERROR 43 + +/* + * max number of parameters per error for parlist + * param ccd_getFirst/NextError + */ +#define MAX_ERR_PAR 3 +#define CCD_ERR_KIND_PARA_LIST 1 +#define CCD_ERR_KIND_IE_TYPE 2 + + +/*==== TYPES ======================================================*/ + +/* + * T_MSGBUF contains the coded message. + * o_buf specified the * offset (in Bits), * where the message + * starts in the buffer. + * l_buf contains the * length (in Bits) of the coded message. + * buf contains the * bitcoded message as an array of Bytes. + * + * (Do not modify this structure !) + */ + +typedef struct +{ + USHORT l_buf; + USHORT o_buf; + UBYTE buf [1]; +} T_MSGBUF; + + +/* + * new style of error information container, used in umts + */ +#ifdef CCD_USE_ENUM_IDS +#include "ccdid.h" /* to get enumeration for fault elements */ +typedef T_CCD_ID T_ERR_INFO; +#else +typedef ULONG T_ERR_INFO; +#endif + +typedef struct +{ + T_ERR_INFO err_info; + ULONG err_IEaddr; +} T_CCD_ERR_TYPE; + +/* + * old style of error information container, used in gsm/gprs + */ +#define MAX_ERR_PAR 3 +typedef struct +{ + UBYTE num_para; + USHORT err_list[MAX_ERR_PAR]; +} T_CCD_PARA_LIST; + +/* + * union supports old and new type of error information container + */ +typedef union +{ + T_CCD_PARA_LIST para_list; + T_CCD_ERR_TYPE err_type; +} T_CCD_ERR_PARA; + +/* + * general structure for error information passed to CCD caller + */ +typedef struct +{ + UBYTE error; + UBYTE kind; + T_CCD_ERR_PARA para; +} T_CCD_ERR_ENTRY; + + +/************************************************************** + function codes for CCD interface functions + used in stub1 (application side) and stub2 (driver side) + **************************************************************/ + +#define CCD_INIT 1 +#define CCD_CODMSG 2 +#define CCD_DECMSG 3 +#define CCD_DECBYTE 4 +#define CCD_CODBYTE 5 +#define CCD_DECLONG 6 +#define CCD_CODLONG 7 +#define CCD_BITCOPY 8 +#define CCD_FIRST_ERR 9 +#define CCD_NEXT_ERR 10 + +#if !defined (CCDDATA_PREF) +#if defined (_TOOLS_) && defined (CCDDATA_LOAD) +#define CCDDATA_PREF(ccd_fun) cddl_##ccd_fun +#else +#define CCDDATA_PREF(ccd_fun) ccd_fun +#endif /* _TOOLS_ && CCDDATA_LOAD */ +#endif /* !CCDDATA_PREF */ + +#if defined _TOOLS_ || defined (CCD_TEST) +/* + * Preparation for issue patching coded bits for generating + * air messages with errors. This feature is not yet supported + * by CCD. + */ +#define CCDP_NO_ERROR 0 +#define CCDP_NOT_FOUND 1 +#define CCDP_VALIDFLAG_SEEN 2 +#define CCDP_UNKNOWN_ERROR 3 +#define MAXREC 50 +typedef struct +{ + U16 elemid[MAXREC]; + U16 numelems; + U16 bitwidth; + U8* bits; + U8 errorcode; +} T_patch_info; +#endif /* _TOOLS_ */ + +/*==================== description ===================================*/ + +/* + * ccd_init + * + * Initializing the ccd-Module, must be called once before + * any encoding/decoding + */ + +/* + * ccd_begin + * + * Returns the address of the CCD buffer for decoded + * messages and locks it until ccd_end() is called + */ + +/* + * ccd_end + * + * Unlocks the CCD buffer for decoded + * messages + */ + +/* + * ccd_codeMsg + * + * layer : <IN> CCDENT_CMCE, CCDENT_MLE .. + * direction: <IN> UPLINK, DOWNLINK + * mBuf : <IN> mBuf.o_buf - Offset in Bits from the + * start of mBuf.buf. + * <OUT> mBuf.l_buf - Contains the length of + * the message in Bits after + * coding. + * <OUT> mBuf.buf - Contains the bitcoded message + * after coding. + * mStruct: <IN> Pointer to the message specific structure. + * The first element must contain the + * message-type (PDU-Type) as a UBYTE value. + * + * pt : <IN> If pt != 0xff the CCD will not decode the + * the PDU-Type from the bitstream. In this + * case pt is the coding of the PDU-Type. + */ + +/* + * ccd_decodeMsg + * + * layer : <IN> CCDENT_CMCE, CCDENT_MLE, ... + * direction: <IN> UPLINK, DOWNLINK + * mBuf : <IN> mBuf.o_buf - Offset in Bits from start + * of mBuf.buf where the + * message starts. + * <IN> mBuf.l_buf - Contains the length of the + * message in Bits. + * <IN> mBuf.buf - Contains the bitcoded message. + * mStruct : <OUT> Pointer to the message specific structure. + * The first element contains the message-type + * (PDU-Type) as a UBYTE value after decoding. + * pt : <IN> If pt != 0xff the CCD will not decode the + * the PDU-Type from the bitstream. In this + * case pt is the coding of the PDU-Type. + */ + +/************************************************************** + function prototypes for CCD interface functions + used in application, stub2 (driver side) and driver body + **************************************************************/ +#ifndef CCD_PATCH_C +#ifdef _TOOLS_ + extern int CCDDATA_PREF(ccd_set_patch_infos) (T_patch_info* pinfo); +#endif /* _TOOLS_ */ +#endif /* CCD_PATCH_C */ + +#ifndef CCD_C + extern BYTE CCDDATA_PREF(ccd_init) (void); + extern int CCDDATA_PREF(ccd_exit) (void); + + extern UBYTE* CCDDATA_PREF(ccd_begin) (void); + + extern void CCDDATA_PREF(ccd_end) (void); + + extern BYTE CCDDATA_PREF(ccd_decodeMsg) (UBYTE entity, + UBYTE direction, + T_MSGBUF *mBuf, + UBYTE *mStruct, + UBYTE pt); + + extern S8 CCDDATA_PREF(ccd_decodeMsgPtr) (U8 entity, + U8 direction, + U16 l_buf, + U16 o_buf, + U8 *buf, + U8 **mStructPtr, + U8 pt); + + extern BYTE CCDDATA_PREF(ccd_codeMsg) (UBYTE entity, + UBYTE direction, + T_MSGBUF *mBuf, + UBYTE *mStruct, + UBYTE pt); + + extern S8 CCDDATA_PREF(ccd_codeMsgPtr) (U8 entity, + U8 direction, + U16 *l_buf, + U16 o_buf, + U8 *buf, + U8 *mStruct, + U8 pt); + + extern UBYTE ccd_setStore (ULONG regNo, + ULONG value); +#ifdef _TOOLS_ + extern ULONG CCDDATA_PREF(ccd_init_ccddata) (void); +#else + extern int ccd_register (int decmsgbuf_size); +#endif /* _TOOLS_ */ +#endif /*! CCD_C */ + +#ifndef CCD_ELEM_C + extern int CCDDATA_PREF(ccd_encodeElem) (ULONG ccdid, + USHORT *l_buf, + USHORT o_buf, + UCHAR *buf, + UCHAR *eStruct); + + extern int CCDDATA_PREF(ccd_decodeElem) (ULONG ccdid, + USHORT l_buf, + USHORT o_buf, + UCHAR *buf, + UCHAR *eStruct); + +#endif /* CCD_ELEM_C */ + +#ifndef CCD_ERR_C + extern UBYTE CCDDATA_PREF(ccd_getFirstError) (UBYTE entity, + USHORT *parlist); + + extern UBYTE CCDDATA_PREF(ccd_getNextError) (UBYTE entity, + USHORT *parlist); + + extern ULONG CCDDATA_PREF(ccd_getFirstFault) + (T_CCD_ERR_ENTRY **ccd_err_entry); + + extern ULONG CCDDATA_PREF(ccd_getNextFault) + (T_CCD_ERR_ENTRY **ccd_err_entry); + + extern void CCDDATA_PREF(ccd_free_faultlist) (void); + + extern int CCDDATA_PREF(ccd_get_numFaults) (void); +#endif /*! CCD_ERR_C */ + +#ifndef CDC_STD_C + extern BYTE CCDDATA_PREF(ccd_decodeByte) (UBYTE *bitstream, + USHORT startbit, + USHORT bitlen, + UBYTE *value); + + extern BYTE CCDDATA_PREF(ccd_codeByte) (UBYTE *bitstream, + USHORT startbit, + USHORT bitlen, + UBYTE val); + + extern BYTE CCDDATA_PREF(ccd_codeLong) (UBYTE *bitstream, + USHORT startbit, + USHORT bitlen, + ULONG value); + + extern BYTE CCDDATA_PREF(ccd_decodeLong) (UBYTE *bitstream, + USHORT startbit, + USHORT bitlen, + ULONG *value); + + extern void CCDDATA_PREF(ccd_bitcopy) (UBYTE *dest, + UBYTE *source, + USHORT bitlen, + USHORT offset); +#endif /*! CCD_STD_C */ + + +#ifdef __cplusplus +} +#endif /*_cplusplus*/ + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/dar_func.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,52 @@ +/* ++------------------------------------------------------------------------------ +| File: dar_func.h ++------------------------------------------------------------------------------ +| 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 : DAR properties. ++----------------------------------------------------------------------------- +*/ + +#ifndef __DAR_FUNC_H__ +#define __DAR_FUNC_H__ + +/*==== CONSTANTS ==================================================*/ + +#define DAR_INITIALIZED 0xAFFEDEAD + +/*==== TYPES ======================================================*/ + +typedef struct +{ + int (*diagnose_swe_filter) (int,char); + int (*diagnose_write)(char*,char,char,int); + int (*diagnose_write_emergency)(char*,char,int,int); + int (*diagnose_generate_emergency)(char*,char,int); + int gpf_use_id; + int new_entry; + char ascii_format; + char warning; + char error; +} T_GPF_DAR_PROPERTIES; + +typedef struct +{ + unsigned int magic_nr; + T_GPF_DAR_PROPERTIES * properties; +} T_GPF_DAR_STRUCT; + +/*==== PROTOTYPES =================================================*/ + + +#endif /* __DAR_FUNC_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/dio.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,578 @@ +/* ++----------------------------------------------------------------------------- +| Copyright 2004 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 : General definitions of DIO driver interface ++----------------------------------------------------------------------------- +*/ + +#ifndef __DIO_H__ +#define __DIO_H__ + +/*==== INCLUDES =============================================================*/ + +#include "gdi.h" + +/*==== DEFINITIONS ==========================================================*/ + +/* + * Device Type + */ +#define DIO_DATA_SER 0x00800000 /* device can transfer serial data */ +#define DIO_DATA_PKT 0x00400000 /* device can transfer packet data */ +#define DIO_DATA_MUX 0x00200000 /* device can start a multiplexer */ +#define DIO_TYPE_ID 0x0000FF00 /* id to separate different capabilities */ + +#define DIO_TYPE_SER (DIO_DATA_SER | 0x00000100) /* serial device */ +#define DIO_TYPE_SER_MUX (DIO_DATA_SER | DIO_DATA_MUX | 0x00000100) /* mux device */ +#define DIO_TYPE_PKT (DIO_DATA_PKT | 0x00000100) /* packet device */ + +/* + * Device Flags + */ +#define DIO_FLAG_SLEEP 0x80000000 /* sleep state allowed */ + +/* + * Baud rates + */ +#define DIO_BAUD_921600 0x00800000 +#define DIO_BAUD_812500 0x00400000 +#define DIO_BAUD_460800 0x00200000 +#define DIO_BAUD_406250 0x00100000 +#define DIO_BAUD_230400 0x00080000 +#define DIO_BAUD_203125 0x00040000 +#define DIO_BAUD_115200 0x00020000 +#define DIO_BAUD_57600 0x00010000 +#define DIO_BAUD_38400 0x00008000 +#define DIO_BAUD_33900 0x00004000 +#define DIO_BAUD_28800 0x00002000 +#define DIO_BAUD_19200 0x00001000 +#define DIO_BAUD_14400 0x00000800 +#define DIO_BAUD_9600 0x00000400 +#define DIO_BAUD_7200 0x00000200 +#define DIO_BAUD_4800 0x00000100 +#define DIO_BAUD_2400 0x00000080 +#define DIO_BAUD_1200 0x00000040 +#define DIO_BAUD_600 0x00000020 +#define DIO_BAUD_300 0x00000010 +#define DIO_BAUD_150 0x00000008 +#define DIO_BAUD_110 0x00000004 +#define DIO_BAUD_75 0x00000002 +#define DIO_BAUD_AUTO 0x00000001 /* automatic baud rate detection */ + +/* + * Character framing + */ +#define DIO_CF_7N1 0x00000800 +#define DIO_CF_7S1 0x00000400 +#define DIO_CF_7M1 0x00000200 +#define DIO_CF_7E1 0x00000100 +#define DIO_CF_7O1 0x00000080 +#define DIO_CF_7N2 0x00000040 +#define DIO_CF_8N1 0x00000020 +#define DIO_CF_8S1 0x00000010 +#define DIO_CF_8M1 0x00000008 +#define DIO_CF_8E1 0x00000004 +#define DIO_CF_8O1 0x00000002 +#define DIO_CF_8N2 0x00000001 + +/* + * Types of flow control + */ +#define DIO_FLOW_XTR_CTS 0x00000800 /* TX= transp. XON/XOFF RX=CTS */ +#define DIO_FLOW_XTR_XOFF 0x00000400 /* TX= transp. XON/XOFF RX=XON/XOFF */ +#define DIO_FLOW_XTR_NO 0x00000200 /* TX= transp. XON/XOFF RX=OFF */ +#define DIO_FLOW_RTS_CTS 0x00000100 /* TX=RTS RX=CTS */ +#define DIO_FLOW_RTS_XOFF 0x00000080 /* TX=RTS RX=XON/XOFF */ +#define DIO_FLOW_RTS_NO 0x00000040 /* TX=RTS RX=OFF */ +#define DIO_FLOW_XON_CTS 0x00000020 /* TX=XON/XOFF RX=CTS */ +#define DIO_FLOW_XON_XOFF 0x00000010 /* TX=XON/XOFF RX=XON/XOFF */ +#define DIO_FLOW_XON_NO 0x00000008 /* TX=XON/XOFF RX=OFF */ +#define DIO_FLOW_NO_CTS 0x00000004 /* TX=OFF RX=CTS */ +#define DIO_FLOW_NO_XOFF 0x00000002 /* TX=OFF RX=XON/XOFF */ +#define DIO_FLOW_NONE 0x00000001 /* TX=OFF RX=OFF */ + +/* + * Serial device flags + */ +#define DIO_FLAG_SER_ESC 0x80000000 /* device supports esc seq detection */ + +/* + * MUX mode + */ +#define DIO_MUX_I 0x00000008 /* advanced option with I frames */ +#define DIO_MUX_UI 0x00000004 /* advanced option with UI frames */ +#define DIO_MUX_UIH 0x00000002 /* advanced option with UIH frames */ +#define DIO_MUX_BASIC 0x00000001 /* basic option */ + +/* + * Sleep Mode + */ +#define DIO_SLEEP_ENABLE 0x01 /* enter sleep mode if possible */ +#define DIO_SLEEP_DISABLE 0x02 /* do not enter sleep mode */ + +/* + * Special Guard Period + */ +#define DIO_ESC_OFF 0x0000 /* turn escape sequence detection off */ + +/* + * Device Mode + */ +#define DIO_MODE_MUX 0x00000002 /* acts as 27.010 multiplexer device */ +#define DIO_MODE_SER 0x00000001 /* acts as serial device */ + +/* + * Control Type + */ +#define DIO_CTRL_LINES 0x0001 /* associated structure is T_DIO_CTRL_LINES */ +#define DIO_CTRL_MUX 0x0002 /* associated structure is T_DIO_CTRL_MUX */ + +/* + * Line State definition & control structure. + */ +#define DIO_SA 0x80000000 /* state: read=DTR write-DSR */ +#define DIO_SB 0x40000000 /* state: read=RTS write=DCD */ +#define DIO_X 0x20000000 /* state: read=RTS write=CTS */ +#define DIO_RING 0x10000000 /* state: ring indicator */ +#define DIO_ESC 0x08000000 /* state: escape sequence detested. */ +#define DIO_MUX_STOPPED 0x04000000 /* multiplexer stopped */ +#define DIO_BRK 0x02000000 /* state: break received/to be sent */ +#define DIO_BRKLEN 0x000000FF /* state: break signal # of characters */ + +/*==== TYPES ================================================================*/ + +/* + * Device Capabilities + */ +typedef struct +{ + U32 device_type; + U32 device_flags; + U16 mtu_control; + U16 mtu_data; + char const *driver_name; +} T_DIO_CAP; + +typedef struct +{ + U32 device_type; + U32 device_flags; + U16 mtu_control; + U16 mtu_data; + char const *driver_name; + U32 baudrate_auto; + U32 baudrate_fixed; + U32 char_frame; + U32 flow_control; + U32 ser_flags; +} T_DIO_CAP_SER; + +typedef struct +{ + U32 device_type; + U32 device_flags; + U16 mtu_control; + U16 mtu_data; + char const *driver_name; + U32 baudrate_auto; + U32 baudrate_fixed; + U32 char_frame; + U32 flow_control; + U32 ser_flags; + U32 mux_mode; +} T_DIO_CAP_SER_MUX; + +typedef struct +{ + U32 device_type; + U32 device_flags; + U16 mtu_control; + U16 mtu_data; + char const *driver_name; +} T_DIO_CAP_PKT; + +/* + * Device Control Block + */ +typedef struct +{ + U32 device_type; /*< 0: 4> device identifier with general capability information */ + U8 sleep_mode; /*< 4: 1> enter sleep mode is possible or not */ + U8 _align0; /*< 5: 1> alignment */ + U8 _align1; /*< 6: 1> alignment */ + U8 _align2; /*< 7: 1> alignment */ +} T_DIO_DCB; + +typedef struct +{ + U32 device_type; /*< 0: 4> device identifier with general capability information */ + U8 sleep_mode; /*< 4: 1> enter sleep mode is possible or not */ + U8 _align0; /*< 5: 1> alignment */ + U8 _align1; /*< 6: 1> alignment */ + U8 _align2; /*< 7: 1> alignment */ + U32 baudrate; /*< 8: 4> user set baudrate */ + U32 char_frame; /*< 12: 4> supported character framing */ + U32 flow_control; /*< 16: 4> supported modes of flow control */ + U8 xon; /*< 20: 1> set/reset XON for flow control */ + U8 xoff; /*< 21: 1> set/reset XOFF for flow control */ + U8 esc_char; /*< 22: 1> ASCII character which is used in an escape sequence */ + U8 _align3; /*< 23: 1> alignment */ + U16 guard_period; /*< 24: 2> duration value for escape sequence */ + U8 _align4; /*< 26: 1> alignment */ + U8 _align5; /*< 27: 1> alignment */ +} T_DIO_DCB_SER; + +typedef struct +{ + U32 device_type; /*< 0: 4> device identifier with general capability information */ + U8 sleep_mode; /*< 4: 1> enter sleep mode is possible or not */ + U8 _align0; /*< 5: 1> alignment */ + U8 _align1; /*< 6: 1> alignment */ + U8 _align2; /*< 7: 1> alignment */ + U32 baudrate; /*< 8: 4> user set baudrate */ + U32 char_frame; /*< 12: 4> supported character framing */ + U32 flow_control; /*< 16: 4> supported modes of flow control */ + U8 xon; /*< 20: 1> set/reset XON for flow control */ + U8 xoff; /*< 21: 1> set/reset XOFF for flow control */ + U8 esc_char; /*< 22: 1> ASCII character which is used in an escape sequence */ + U8 _align3; /*< 23: 1> alignment */ + U16 guard_period; /*< 24: 2> duration value for escape sequence */ + U8 _align4; /*< 26: 1> alignment */ + U8 _align5; /*< 27: 1> alignment */ + U32 device_mode; /*< 28: 4> work mode of device */ + U32 mux_mode; /*< 32: 4> supported multiplexer modes */ + U16 n1; /*< 36: 2> max frame size of mux frame */ + U8 n2; /*< 38: 1> max number of retransmissions */ + U8 t1; /*< 39: 1> acknowledgement timer */ + U8 t2; /*< 40: 1> response timer */ + U8 t3; /*< 41: 1> wake up response timer */ + U8 k; /*< 42: 1> windows size */ + U8 _align6; /*< 43: 1> alignment */ +} T_DIO_DCB_SER_MUX; + +typedef struct +{ + U32 device_type; /*< 0: 4> device identifier with general capability information */ + U8 sleep_mode; /*< 4: 1> enter sleep mode is possible or not */ + U8 _align0; /*< 5: 1> alignment */ + U8 _align1; /*< 6: 1> alignment */ + U8 _align2; /*< 7: 1> alignment */ +} T_DIO_DCB_PKT; + +/* + * Data Control + */ +typedef struct +{ + U16 control_type ; + U16 length ; +}T_DIO_CTRL ; + +typedef struct +{ + U16 control_type; + U16 length; + U32 state; +} T_DIO_CTRL_LINES; + +typedef struct +{ + U16 control_type ; + U16 length ; + U32 state; +}T_DIO_CTRL_MUX ; + +/* + * DIO Data format. + */ +typedef struct +{ + U8 _align0; /*< 0: 1> alignment */ + U8 _align1; /*< 1: 1> alignment */ + U16 c_data; /*< 2: 2> counter */ + U8 *ptr_data; /*< 4: 4> pointer to pointer to the first byte of the data buffer segment */ +} T_dio_segment; + +typedef struct +{ + U16 length; /*< 0: 2> len of dio_ctrl */ + U8 _align0; /*< 2: 1> alignment */ + U8 c_dio_segment; /*< 3: 1> counter */ + T_dio_segment *ptr_dio_segment; /*< 4: 4> pointer to Structured Element */ +} T_dio_buffer; + +/*==== PROTOTYPES ===========================================================*/ + +/* ++------------------------------------------------------------------------------ +| Function : dio_init ++------------------------------------------------------------------------------ +| Description : The function initializes the interface and the drivers. +| +| Parameters : none +| +| Return : DRV_OK - Initialization successful +| DRV_INITIALIZED - Interface already initialized +| DRV_INITFAILURE - Initialization failed +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_init(void); + +/* ++------------------------------------------------------------------------------ +| Function : dio_user_init ++------------------------------------------------------------------------------ +| Description : The function sets the signal callback of a DIO user. +| +| Parameters : user_name - DIO user name +| drv_handle - unique handle for this user +| signal_callback - callback function for this user +| +| Return : DRV_OK - Callback successfully set +| DRV_INVALID_PARAMS - The specified user does not exist +| DRV_INTERNAL_ERROR - Internal error +| DRV_NOTCONFIGURED - DIO interface is not yet initialized. +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_user_init(char const * user_name, + U16 drv_handle, + T_DRV_CB_FUNC signal_callback); + +/* ++------------------------------------------------------------------------------ +| Function : dio_user_exit ++------------------------------------------------------------------------------ +| Description : Termination of User Operation. +| +| Parameters : user_name - DIO user name +| +| Return : DRV_OK - User operation successfully terminated. +| DRV_INVALID_PARAMS - User operation can not be terminated yet. +| DRV_INTERNAL_ERROR - Internal error +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_user_exit(char const * user_name); + +/* ++------------------------------------------------------------------------------ +| Function : dio_exit ++------------------------------------------------------------------------------ +| Description : Termination of the Interface. +| +| Parameters : none +| +| Return : none +| ++------------------------------------------------------------------------------ +*/ +extern void dio_exit(void); + +/* ++------------------------------------------------------------------------------ +| Function : dio_set_rx_buffer ++------------------------------------------------------------------------------ +| Description : This function provides a receive buffer to the driver. +| +| Parameters : device - device number +| buffer - buffer to copy received data in it +| +| Return : DRV_OK - Function successful +| DRV_BUFFER_FULL - Buffer queue full. +| DRV_INVALID_PARAMS - The specified device does not exist or +| the data buffer is not big enough. +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_set_rx_buffer(U32 device, + T_dio_buffer * buffer); + +/* ++------------------------------------------------------------------------------ +| Function : dio_read ++------------------------------------------------------------------------------ +| Description : This function returns a receive buffer and control information. +| +| Parameters : device - device number +| control_info - control information from the driver +| buffer - buffer with received data in it +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_read(U32 device, + T_DIO_CTRL * control_info, + T_dio_buffer ** buffer); + +/* ++------------------------------------------------------------------------------ +| Function : dio_write ++------------------------------------------------------------------------------ +| Description : This function provides a send buffer to the driver which +| contains data to send. +| +| Parameters : device - device number +| control_info - control information for the driver +| buffer - buffer with data to send +| +| Return : DRV_OK - Function successful +| DRV_BUFFER_FULL - Buffer queue full. +| DRV_INVALID_PARAMS - The specified device does not exist or +| the data buffer to big. +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_write(U32 device, + T_DIO_CTRL * control_info, + T_dio_buffer * buffer); + +/* ++------------------------------------------------------------------------------ +| Function : dio_get_tx_buffer ++------------------------------------------------------------------------------ +| Description : This function returns a send buffer provided via dio_write(). +| +| Parameters : device - device number +| buffer - return sent data buffer +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_get_tx_buffer(U32 device, + T_dio_buffer ** buffer); + +/* ++------------------------------------------------------------------------------ +| Function : dio_clear ++------------------------------------------------------------------------------ +| Description : This function is used to clear the hardware send buffer. +| +| Parameters : device - device number +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| DRV_INPROCESS - The driver is busy clearing the buffer +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_clear(U32 device); + +/* ++------------------------------------------------------------------------------ +| Function : dio_flush ++------------------------------------------------------------------------------ +| Description : With this function the driver is requested to inform the +| user, when data of the hardware send buffer have been written +| successfully. +| +| Parameters : device - device number +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| DRV_INPROCESS - The driver is busy flushing the buffer +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_flush(U32 device); + +/* ++------------------------------------------------------------------------------ +| Function : dio_get_capabilities ++------------------------------------------------------------------------------ +| Description : This function is used to retrieve the capabilities of a device. +| +| Parameters : device - device number +| capabilities - Return: Pointer to the device capabilities +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_get_capabilities(U32 device, + T_DIO_CAP ** capabilities); + +/* ++------------------------------------------------------------------------------ +| Function : dio_set_config ++------------------------------------------------------------------------------ +| Description : This function is used to configure a device. +| +| Parameters : device - device number +| dcb - pointer to a device control block +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - parameter invalid or out of range +| DRV_INTERNAL_ERROR - Internal driver error +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_set_config(U32 device, + T_DIO_DCB * dcb); + +/* ++------------------------------------------------------------------------------ +| Function : dio_get_config ++------------------------------------------------------------------------------ +| Description : This function reads the device configuration. +| +| Parameters : device - device number +| dcb - pointer to a device control block +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist or +| wrong Device Control Block provided. +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The device is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_get_config(U32 device, + T_DIO_DCB * dcb); + +/* ++------------------------------------------------------------------------------ +| Function : dio_close_device ++------------------------------------------------------------------------------ +| Description : This function is used to close a device. +| +| Parameters : device - device number +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device can not be closed yet +| DRV_INTERNAL_ERROR - Internal driver error +| ++------------------------------------------------------------------------------ +*/ +extern U16 dio_close_device(U32 device); + +#endif /* __DIO_H__ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/dmi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,283 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : sas_dmi.h ++----------------------------------------------------------------------------- +| 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 : External interface for SAS_DMI support module ++----------------------------------------------------------------------------- +*/ + +#ifndef ANITESAS_DMI__H +#define ANITESAS_DMI__H + +/*==== INCLUDES =============================================================*/ +/*==== CONSTS ===============================================================*/ + +/* +* Nasty Tricks Department +*/ + +#define NULLSTRING \0 + +#define DMIVSI_CALLER proxyVsiCallerId, +#define DMIVSI_CALLER_SINGLE proxyVsiCallerId +#define G23_COMP_REF_TYPE T_HANDLE +#define G23_NULL_COMP_REF (T_HANDLE)(0) + +/* End of N.T.D. */ + +/* +* SAS DMI - Activate / Deactivate Commands +* (commands+values defined in Anite +* DMID spec. I2477D) +*/ + +#define G23_COMP_RR 1 +#define G23_COMP_ALR 2 +#define G23_COMP_PHY 3 +#define G23_COMP_CCD 9 + +#define SASRPT_ON 1 +#define SASRPT_OFF 0 +#define SASRPT_IS_UPLINK 0 +#define SASRPT_IS_DOWNLINK 1 +#define SASRPT_MSGRSP 0 +#define SASRPT_MSGIGN 1 +#define SASRPT_IDLEMODE 1 +#define SASRPT_DEDIMODE 2 + +/* +* SAS DMID - Activation/Deactivation Flags +* (set by corresponding SAS DMID +* commands - see above) +*/ + +#define SAS_RPRT_ACTIVE__IDLEMODE 0x0001 +#define SAS_RPRT_ACTIVE__DEDICATEDMODE 0x0002 +#define SAS_RPRT_ACTIVE__L3MSG 0x0004 +#define SAS_RPRT_ACTIVE__L1MSG 0x0008 +#define SAS_RPRT_ACTIVE__SYNC 0x0010 +#define SAS_RPRT_ACTIVE__SACCH 0x0020 +#define SAS_RPRT_ACTIVE__SACCHCOMPLETE 0x0040 +#define SAS_RPRT_ACTIVE__CHANREQIMMEDASSIGN 0x0080 +#define SAS_RPRT_ACTIVE__BCCH 0x0100 +#define SAS_RPRT_ACTIVE__PAGE 0x0200 + +/* +* extern procedure prototypes +*/ + +#define START_FMT1 1 +#define START_FMT2 2 + +/*==== TYPES ================================================================*/ +typedef struct _start_du +{ + U8 fmtDiscriminator; + union + { + U8 dummyPlaceHolder; +#ifdef __T_start__ + T_start* fmt1_Start; +#endif +#ifdef __T_start_time__ + T_start_time* fmt2_Start; +#endif + } u; +} start_u; + +/*==== EXPORTS ==============================================================*/ +extern void SasDmi( U8 g23Component ); + +extern void Dmi_SendReport_IdleMode( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 Ssf, + U8 Ssr, + U16* Nf, + U8* Nr, + U8* Nb ); +extern void Dmi_SendReport_DedMode( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 Ta, + U8 Pwr, + U8 Rlf, + U8 Rqf, + U8 Rls, + U8 Rqs, + U16* Nf, + U8* Nr, + U8* Nb ); + +extern void Dmi_SendReport_L3( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U8 UlOrDl, + U16 L3MsgLen, + U8* L3Msg, + U8 L3MsgId ); + +extern void Dmi_SendReport_L1( U8 g23Comp, G23_COMP_REF_TYPE g23CompRef ); + +extern void Dmi_SendReport_Sync( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 Fff, + U8 Bsic, + U32 Toffs ); +extern void Dmi_SendReport_Sacch( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U8 Mrltc, + U8 Crltc, + U8 L3SiPdTi, + U8 L3MsgTyp ); + +extern void Dmi_SendReport_SacchCompl( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 MsgLen, + U8 Mrltc, + U8 Crltc, + U8* L2Msg ); + +extern void Dmi_SendReport_ChanReq( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U8 ChanReqData, + U32 ChanReqFrNum ); +extern void Dmi_SendReport_ImmedAssign( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 L3MsgLen, + U8 RspOrIgn, + U8* L3Msg ); +extern void Dmi_SendReport_Bcch( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 L3MsgLen, + U16 BcchFreq, + U8* L3BcchMsg ); +extern void Dmi_SendReport_Page( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 L3MsgLen, + U8 Mdsc, + U8 Cdsc, + U8* L3PageMsg ); + +extern void Dmi_SendReport_IdleChan( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 Fff, + U8 Bsic, + U8 CombFlag, + U8 CchC, + U8 Mfrm, + U8 AgRes, + U8 CchG, + U8 Pmfrm, + U8 Pbi ); + +extern void Dmi_SendReport_DedChan_NonHop( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 ScFreq, + U8 ScBsic, + U8 ChTyp, + U8 Tslot, + U8 SubCh, + U8 Tsc, + U8 GsmBa, + U16 DedFreq ); + +extern void Dmi_SendReport_DedChan_Hop( U8 g23Comp, + G23_COMP_REF_TYPE g23CompRef, + U16 ScFreq, + U8 ScBsic, + U8 ChTyp, + U8 Tslot, + U8 SubCh, + U8 Tsc, + U8 Maio, + U8 Hsn, + U8 GsmBa, + start_u* StartTime, + U8 MaxLenChanList, + U8* BeforeChanList, + U8* AfterChanList ); + +/*---------------------------------------------------*/ + +/*+Obsolete*/ +/* +* Features potentially obsoleted by Issue 1.4 of +* Anite DMI spec. +* +* ** LEAVE IN CODE SINCE REFERENCED IN dmi.c +* +* +*/ + +/* ...continuous reports... */ + +#define SAS_RPRT_START__IDLEMODE '1' +#define SAS_RPRT_STOP__IDLEMODE '6' +#define SAS_RPRT_START__DEDICATEDMODE '2' +#define SAS_RPRT_STOP__DEDICATEDMODE '7' +#define SAS_RPRT_START__L3MSG '3' +#define SAS_RPRT_STOP__L3MSG '8' +#define SAS_RPRT_START__L1MSG '4' +#define SAS_RPRT_STOP__L1MSG '9' +#define SAS_RPRT_START__SYNC 'S' +#define SAS_RPRT_STOP__SYNC 'T' +#define SAS_RPRT_START__SACCH 'A' +#define SAS_RPRT_STOP__SACCH 'B' +#define SAS_RPRT__SACCHCOMPLETE '\\' +#define SAS_RPRT_START__SACCHCOMPLETE 'A' +#define SAS_RPRT_STOP__SACCHCOMPLETE 'B' +#define SAS_RPRT_START__CHANREQIMMEDASSIGN 'C' +#define SAS_RPRT_STOP__CHANREQIMMEDASSIGN 'D' +#define SAS_RPRT_START__BCCH 'E' +#define SAS_RPRT_STOP__BCCH 'F' +#define SAS_RPRT_START__PAGE 'P' +#define SAS_RPRT_STOP__PAGE 'Q' + +/* ...once-off reports... */ + +#define SAS_RPRT_ONCE__IDLECHAN I +#define SAS_RPRT_ONCE__DEDICATEDCHAN J + +/* ...status getters/setters... */ + +extern U16 GetSasRptStatus_IdleMode( void ); +extern U16 GetSasRptStatus_DedMode( void ); +extern U16 GetSasRptStatus_L3( void ); +extern U16 GetSasRptStatus_L1( void ); +extern U16 GetSasRptStatus_Sync( void ); +extern U16 GetSasRptStatus_Sacch( void ); +extern U16 GetSasRptStatus_SacchCompl( void ); +extern U16 GetSasRptStatus_ChanReq( void ); +extern U16 GetSasRptStatus_Bcch( void ); +extern U16 GetSasRptStatus_Page( void ); + +extern U16 HandleSasCmd( U8* SasCmd ); + +extern void SetSasRptStatus_IdleMode( U16 OnOff ); +extern void SetSasRptStatus_DedMode( U16 OnOff ); +extern void SetSasRptStatus_L3( U16 OnOff ); +extern void SetSasRptStatus_L1( U16 OnOff ); +extern void SetSasRptStatus_Sync( U16 OnOff ); +extern void SetSasRptStatus_Sacch( U16 OnOff ); +extern void SetSasRptStatus_SacchCompl( U16 OnOff ); +extern void SetSasRptStatus_ChanReq( U16 OnOff ); +extern void SetSasRptStatus_Bcch( U16 OnOff ); +extern void SetSasRptStatus_Page( U16 OnOff ); + +/*-Obsolete*/ + +/*---------------------------------------------------*/ + + + +#endif /* ANITESAS_DMI__H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/drvconf.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,73 @@ +/* ++------------------------------------------------------------------------------ +| File: drvconf.h ++------------------------------------------------------------------------------ +| 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 dynamic driver configuration. ++----------------------------------------------------------------------------- +*/ + +#ifndef DRVCONF_H +#define DRVCONF_H + +/*==== INCLUDES =============================================================*/ +#include "typedefs.h" +#include "gdi.h" +#include "vsi.h" + +/*==== CONSTS ===============================================================*/ + +#if defined _TARGET_ + #define MAX_AVAILABLE_DRV 1 +#else + #define MAX_AVAILABLE_DRV 6 +#endif + +#define TIF_NAME "TIF" +#define TR_NAME "TR" +#define EMI_NAME "EMI" +#define SOCKET_NAME "SOCKET" +#define MTST_NAME "MTST" +#define SER_NAME "SER" +#define THIF_LINK_NAME "THIFLINK" +#define USERSPACE_LINK_NAME "USSPLINK" +#define TITRC_NAME "TITRC" +#define NODRV_NAME "NODRV" + +#define DRV_DEFAULT "DEFAULT" +#define DRV_TI_MODE "TI_MODE" +#define DRV_RAW_TI_MODE "RAW_TI_MODE" +#define TIF_PCON_ENABLE "ENABLE_PCON" +#define TR_STX_LF "STX_LF" +#define ENABLE_SYNC_MODE "ENA_SYNC_MODE" +#define DISABLE_SYNC_MODE "DIS_SYNC_MODE" + +#define FILTER "FILTER" + +#define DRV_SIGTYPE_READ_L1 0x100 +#define DRV_SIGTYPE_READ_RIV 0x200 + +/*==== TYPES ================================================================*/ + +typedef struct +{ + T_DRV_LIST_ENTRY entry; + USHORT drv_pos; +} T_TST_DRV_ENTRY; + +/*==== EXPORTS ==============================================================*/ + +SHORT tst_drv_open (char *drv_name, T_TST_DRV_ENTRY **drv_info ); + + +#endif /* DRVCONF_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/esf_func.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,46 @@ +/* ++------------------------------------------------------------------------------ +| File: esf_func.h ++------------------------------------------------------------------------------ +| 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 : ESF API and types. ++----------------------------------------------------------------------------- +*/ + +#ifndef __ESF_FUNC_H__ +#define __ESF_FUNC_H__ + +/*==== CONSTANTS ==================================================*/ + +#define ESF_INITIALIZED 0xAFFEDEAD + +/*==== TYPES ======================================================*/ + +typedef struct +{ + unsigned int magic_nr; + void (*init_func1)(void); + void (*init_func2)(void); + void (*send_prim)(T_PRIM_HEADER *); +} T_ESF_FUNC; + +/*==== PROTOTYPES =================================================*/ + +void esf_init ( void ); +void esf_register ( T_ESF_FUNC * func ); +void esf_init_func1 ( void ); +void esf_init_func2 ( void ); +void esf_send_prim ( T_PRIM_HEADER * ); + +#endif /* __ESF_FUNC_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/extdspl.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,80 @@ +#ifndef EXTDSPL_H +#define EXTDSPL_H +/* ++----------------------------------------------------------------------------- +| 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 of the EXTDSPL service access point. ++----------------------------------------------------------------------------- +*/ + + +/* + * Definition of the SAP + */ +#define SAP_EXTDSPL + + +/* + * Mask for Opcodes + */ +#define EXTDSPL_DL 0x7F00 +#define EXTDSPL_UL 0x3F00 + + +/* + * The primitves and their OPC's + */ +typedef struct +{ + U32 dummy; +} T_EXTDSPL_CAP_REQ; + +#define EXTDSPL_CAP_REQ 0x3F00 + + +typedef struct +{ + U32 dummy; +} T_EXTDSPL_DATA_REQ; + +#define EXTDSPL_DATA_REQ 0x3F01 + + +typedef struct +{ + U16 width; + U16 height; + U16 bpp; + U8 _dallign1; + U8 _dallign2; +} T_EXTDSPL_CAP_IND; + +#define EXTDSPL_CAP_IND 0x7F00 + + +typedef struct +{ + U16 col; + U16 row; + U16 width; + U16 height; + T_sdu sdu; +} T_EXTDSPL_DATA_IND; + +#define EXTDSPL_DATA_IND 0x7F01 + + +#endif /* EXTDSPL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/frm_defs.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,32 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_defs.h ++------------------------------------------------------------------------------ +| 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 fixed dimensions of frame. ++----------------------------------------------------------------------------- +*/ + +#ifndef FRM_DEFS_H +#define FRM_DEFS_H + +#include "glob_defs.h" + +#define NUM_OF_COMPONENT_TABLES 2 +#define MAX_TST_DRV 5 /* maximal number of cascaded TST drivers */ +#define MAX_TST_DRV_CONF 3 /* maximal number of cascaded TST driver configurations */ + +#define RANGES_PER_POOL 5 +#define ASSIGNED_BY_TI 0 + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/frm_ext.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,47 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_ext.h ++------------------------------------------------------------------------------ +| Copyright 2005 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 Frame Extension Interface. ++----------------------------------------------------------------------------- +*/ + +#ifndef FRM_EXT_H +#define FRM_EXT_H + +/*==== TYPES ================================================================*/ + +#ifndef _TOOLS_ +typedef struct +{ + unsigned int magic_nr; + int ret_ok; + int (*plemu_SendToQueue)(OS_HANDLE SndComHandle, OS_HANDLE RcvComHandle, + OS_HANDLE RcvQHandle, USHORT Prio, ULONG Suspend, + OS_QDATA *Msg ); +} T_lemu_SendToQueue; +#endif + +/*==== PROTOTYPES ===============================================================*/ + +void fei_lemu_SendToQueue_init ( void ); +void fei_lemu_SendToQueue_register(int(* func)(OS_HANDLE SndComHandle, OS_HANDLE RcvComHandle, + OS_HANDLE RcvQHandle, USHORT Prio, ULONG Suspend, + OS_QDATA *Msg ), ULONG ret_ok); + +/*==== MACROS ================================================================*/ + +#define LEMU_SENDTOQUEUE_INITIALIZED 0xaffedead + +#endif /* FRM_EXT_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/frm_glob.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,118 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_glob.h ++------------------------------------------------------------------------------ +| 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 : Global frame tables ++----------------------------------------------------------------------------- +*/ + +#ifndef FRM_GLOB_H +#define FRM_GLOB_H + +/*==== INCLUDES =============================================================*/ + +#include "frm_types.h" + +/*==== CONSTANTS ============================================================*/ + + +/*==== TYPES ================================================================*/ + +/*==== VARIABLES ================================================================*/ + +#ifndef CONFIG_MODULE +extern USHORT MaxEntities; +extern USHORT MaxCommunications; +extern USHORT MaxSimultaneousTimer; +extern USHORT MaxTimer; +extern USHORT MaxSemaphores; +extern USHORT NumberOfPPMPartitions; +extern ULONG MaxPrimPartSize; +extern USHORT TextTracePartitionSize; +extern T_VOID_STRUCT *processed_prim[]; +extern T_VOID_STRUCT *freed_prim[]; +extern T_HANDLE e_running[]; +extern T_FRM_TASK_TABLE_ENTRY pf_TaskTable[]; +extern ULONG TraceMask[]; +extern char TracesAborted[]; +extern char PrimAborted[]; +extern char route_desclist[]; +extern T_HANDLE TimerHandleField[]; + +#if !defined _TARGET_ && !defined _TOOLS_ +extern char pcheck_active[]; +#endif + + #else /* CONFIG_MODULE */ + +/* -------------- S H A R E D - BEGIN ---------------- */ +#ifdef _TOOLS_ +#pragma data_seg("FRAME_SHARED") +#endif + +#ifndef DATA_INT_RAM + +/* declare on pointer for each entity for ccd error handling */ +struct ccd_task_table; +struct ccd_task_table* ccd_task_list[MAX_ENTITIES+1]; + +USHORT MaxEntities = MAX_ENTITIES; +USHORT MaxTimer = MAX_TIMER; +#ifndef _TOOLS_ +/* + * This way of setting the TST and RCV stacksize is chosen to keep it backwardscompatible, + * i.e. not change the behavior if the stacksizes are not define in the configuration + * file xxxconst.h. + */ +#ifdef TSTSND_STACK_SIZE +const USHORT TST_SndStacksize = TSTSND_STACK_SIZE; +#else +const USHORT TST_SndStacksize = 0; +#endif +#ifdef TSTRCV_STACK_SIZE +const USHORT TST_RcvStacksize = TSTRCV_STACK_SIZE; +#else +const USHORT TST_RcvStacksize = 0; +#endif + +#endif /* _TOOLS_ */ + +T_FRM_TASK_TABLE_ENTRY pf_TaskTable [ MAX_ENTITIES + 1 ]={0}; +ULONG *Routing [ MAX_ENTITIES + 1 ]={0}; +ULONG TraceMask [ MAX_ENTITIES + 1 ]={0}; +char TracesAborted [ MAX_ENTITIES + 1 ]={0}; +char PrimAborted [ MAX_ENTITIES + 1 ]={0}; +#ifdef PRIM_AUTO_FREE +T_VOID_STRUCT *processed_prim [ MAX_ENTITIES + 1 ]={0}; +T_VOID_STRUCT *freed_prim [ MAX_ENTITIES + 1 ]={0}; +#endif +T_HANDLE e_running [ MAX_ENTITIES + 1 ]={0}; +char route_desclist [ MAX_ENTITIES + 1 ]={0}; +T_DRV_TABLE_ENTRY DrvTable [ MAX_TST_DRV + 1 ]={0}; +T_HANDLE TimerHandleField [ MAX_TIMER + 1 ]={0}; + +#if !defined _TARGET_ && !defined _TOOLS_ +char pcheck_active [ MAX_ENTITIES + 1 ]={0}; +#endif + +#endif /* DATA_INT_RAM */ + +#ifdef _TOOLS_ +#pragma data_seg() +#endif +/* -------------- S H A R E D - END ---------------- */ + +#endif /* CONFIG_MODULE */ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/frm_types.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,139 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_types.h ++------------------------------------------------------------------------------ +| 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 Frame ++----------------------------------------------------------------------------- +*/ + +#ifndef FRM_TYPES_H +#define FRM_TYPES_H + +/*==== INCLUDES =============================================================*/ + +#include "pei.h" +#include "gdi.h" + +/*==== CONSTANTS ============================================================*/ + +/*==== TYPES ================================================================*/ + +/* + * Type Definitions for Frame Management + */ + +typedef struct +{ + char Name[RESOURCE_NAMELEN]; /* name of task */ + T_PEI_FUNC const *PeiTable; /* addresses of pei_functions */ + USHORT NumOfTimers; /* timers are created in pf_TaskEntry() */ + USHORT QueueEntries; /* queue is created in pf_TaskEntry() */ + T_HANDLE * FirstTimerEntry; /* first entry in timer handle array */ + T_HANDLE MemPoolHandle; /* handle for memory pool access */ + T_HANDLE QueueHandle; /* own queue handle */ + T_HANDLE TaskHandle; /* own task handle */ + U32 Flags; /* active/passive */ +} T_FRM_TASK_TABLE_ENTRY; + +typedef struct +{ + ULONG TimerValue; /* value of timer */ + ULONG TimerMode; /* mode of timer */ +} T_FRM_TIMCFG_TABLE_ENTRY; + +typedef struct +{ + char *Name; /* name of the driver */ + T_HANDLE ProcessHandle; /* handle of the process to be notified */ + USHORT UpperDrv; /* handle of driver in the upper layer */ + USHORT LowerDrv; /* handle of driver in the lower layer */ + USHORT SignalTo; /* handle of process to be notified at Callback */ + T_DRV_EXPORT const *DrvInfo; +} T_DRV_TABLE_ENTRY; + +typedef struct +{ + unsigned int part_num; + unsigned int part_size; + void * mem; +} T_FRM_PARTITION_POOL_CONFIG; + +typedef struct +{ + char * name; + const T_FRM_PARTITION_POOL_CONFIG * grp_config; +} T_FRM_PARTITION_GROUP_CONFIG; + +typedef struct +{ + char *Name; + ULONG Size; + char *PoolAddress; +} T_MEMORY_POOL_CONFIG; + +typedef SHORT T_PEI_CREATE ( T_PEI_INFO const **Info ); + +typedef struct +{ + T_PEI_CREATE *PeiCreate; + char *Name; + int Priority; +} T_COMPONENT_ADDRESS; + + +#ifdef MEMORY_SUPERVISION + +typedef struct +{ + ULONG Total; /* total number of elements */ + ULONG Current; /* current number of elements */ + ULONG Maximum; /* maximum number of elements */ + ULONG MaxByteMemory; /* number of allocated bytes at maximum of elements */ + ULONG MaxPartMemory; /* number of allocated partitions at maximum of elements */ +} T_COUNTER; + +typedef struct +{ + ULONG UsedSize; /* size of stored primitive */ + ULONG RequestedSize; /* requested size during allocation */ + ULONG time; /* time when partition is touched */ + USHORT Status; /* status of partition */ + T_HANDLE owner; + ULONG PrimOPC; /* opc of primitive that uses this partition */ + void *ptr; + const char *Userfile; /* file that accesses partition */ + int Line; /* line where partition is accessed */ +} T_PARTITION_STATUS; + +typedef struct +{ + ULONG PrimOPC; /* opc of primitive that does not fit in partition */ + const char *Userfile; /* file that access partition */ + int Line; /* line where partition is accessed */ +} T_OVERSIZE_STATUS; + +typedef struct +{ + T_PARTITION_STATUS *PartitionStatus; + T_OVERSIZE_STATUS *PartitionOversize; + T_COUNTER *PartitionCounter; +#ifdef OPTIMIZE_POOL + T_COUNTER *ByteCounter; + T_COUNTER *RangeCounter; +#endif /* OPTIMIZE_POOL */ +} T_PARTITION_POOL_STATUS; + +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/gdi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,146 @@ +/* ++------------------------------------------------------------------------------ +| File: gdi.h ++------------------------------------------------------------------------------ +| Copyright Condat AG 1999-2001, Berlin +| All rights reserved. +| +| This file is confidential and a trade secret of Condat 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 +| Condat AG. ++------------------------------------------------------------------------------ +| Purpose: General Definitions. +| $Identity:$ ++------------------------------------------------------------------------------ +*/ + +#ifndef GDI_H +#define GDI_H + +/*==== INCLUDES =============================================================*/ + +#include "typedefs.h" + +/*==== DEFINITIONS ==========================================================*/ +/*-------------------------------- + Return values + --------------------------------*/ +#ifdef DRV_OK + #undef DRV_OK +#endif +#define DRV_OK 0 +#define DRV_BUFFER_FULL 1 +#define DRV_DISABLED 2 +#define DRV_ENABLED 3 +#define DRV_INITFAILURE 4 +#define DRV_INITIALIZED 5 +#define DRV_INTERNAL_ERROR 6 +#define DRV_INPROCESS 7 +#define DRV_INVALID_PARAMS 8 +#define DRV_NOTCONFIGURED 9 +#define DRV_RETVAL_USER 50 + +/*-------------------------------- + Signal types + --------------------------------*/ +#define DRV_SIGFCT_NOTAVAILABLE 0x01 +#define DRV_SIGTYPE_CLEAR 0x02 +#define DRV_SIGTYPE_FLUSH 0x04 +#define DRV_SIGTYPE_READ 0x08 +#define DRV_SIGTYPE_WRITE 0x10 +#define DRV_SIGTYPE_CONNECT 0x20 +#define DRV_SIGTYPE_DISCONNECT 0x40 + +#define DRV_SIGTYPE_USER 0x80 + +/*-------------------------------- + Flags + --------------------------------*/ +#define CALLED_FROM_ISR 0x01 + +/*-------------------------------- + Buffer Types + --------------------------------*/ +#define DRV_BUFTYPE_READ 0x01 +#define DRV_BUFTYPE_WRITE 0x02 + +/*==== TYPES ================================================================*/ +typedef void * drv_ProcHandle_Type; + +/*------------------------------------------------------------------------ + T_DRV_SIGNAL - driver signal identification + + The type defines the signal information data used to identify a signal. + This data type is used to define and to report a signal. A signal is + defined by a process calling the driver function drv_SetSignal. An + event is signalled by driver by calling the pre-defined signal call- + back function. + -------------------------------------------------------------------------*/ +typedef struct +{ + USHORT SignalType; + USHORT DrvHandle; + ULONG DataLength; + T_VOID_STRUCT *UserData; +} T_DRV_SIGNAL; + +/*------------------------------------------------------------------------ + T_DRV_CB_FUNC - driver signal device control block + + This type defines a call-back function used to signal driver events, + e.g. driver is ready to accept data. The driver calls the signal + call-back function when a specific event occurs and the driver has + been instructed to signal the event to a specific process. A process + can set or reset event signalling by calling one of the driver + functions drv_SetSignal or drv_ResetSignal. Event signalling can only + be performed when a call-back function has been installed at driver + initialization. + -------------------------------------------------------------------------*/ +typedef void (*T_DRV_CB_FUNC ) (T_DRV_SIGNAL * Signal); + +struct _T_DRV_EXPORT; + +typedef struct +{ +#ifdef _TOOLS_ + USHORT (*drv_Init)(USHORT,T_DRV_CB_FUNC,struct _T_DRV_EXPORT const**); +#endif + void (*drv_Exit)(void); + USHORT (*drv_Read)(void*, ULONG*); + USHORT (*drv_Write)(void*, ULONG*); + USHORT (*drv_Look)(void*, ULONG*); + USHORT (*drv_Clear)(USHORT); + USHORT (*drv_Flush)(void); + USHORT (*drv_SetSignal)(USHORT); + USHORT (*drv_ResetSignal)(USHORT); + USHORT (*drv_SetConfig)(char*); + USHORT (*drv_GetConfig)(char*); + void (*drv_Callback)(T_DRV_SIGNAL*); +} T_DRV_FUNC; + +typedef struct _T_DRV_EXPORT +{ + const char *Name; + USHORT Flags; /* Bit (0): CALLED_BY_ISR */ + T_DRV_FUNC DrvFunc; +} T_DRV_EXPORT; + + +typedef struct +{ + char const *Name; + USHORT (*drv_Init)(USHORT, T_DRV_CB_FUNC, T_DRV_EXPORT const **); + char const *Process; + void const *DrvConfig; +} T_DRV_LIST_ENTRY; + +typedef struct +{ + T_DRV_LIST_ENTRY DrvEntry [ 5 ]; +} T_DRV_LIST; + +/*==== END OF FILE ==========================================================*/ +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/glob_defs.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,31 @@ +/* ++------------------------------------------------------------------------------ +| File: glob_defs.h ++------------------------------------------------------------------------------ +| 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 fixed dimensions of frame. ++----------------------------------------------------------------------------- +*/ + +#ifndef GLOB_DEFS_H +#define GLOB_DEFS_H + +#define GUARD_PATTERN 0xAFFEDEAD + +#ifdef _ESF_SUPPORT_ + #define RESOURCE_NAMELEN 16 +#else + #define RESOURCE_NAMELEN 8 +#endif /* _ESF_SUPPORT_ */ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/gsi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,389 @@ +#ifndef GSI_H +#define GSI_H +/* ++----------------------------------------------------------------------------- +| 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 : These definitions provide a driver interface to multiple serial +| ports. ++----------------------------------------------------------------------------- +*/ + + +/*==== INCLUDES =============================================================*/ + +#include <gdi.h> + +/*==== DEFINITIONS ==========================================================*/ + +/* + * Baud rates + */ +#define GSI_BAUD_AUTO ( 1) +#define GSI_BAUD_75 ( 2) +#define GSI_BAUD_150 ( 3) +#define GSI_BAUD_300 ( 4) +#define GSI_BAUD_600 ( 5) +#define GSI_BAUD_1200 ( 6) +#define GSI_BAUD_2400 ( 7) +#define GSI_BAUD_4800 ( 8) +#define GSI_BAUD_7200 ( 9) +#define GSI_BAUD_9600 (10) +#define GSI_BAUD_14400 (11) +#define GSI_BAUD_19200 (12) +#define GSI_BAUD_28800 (13) +#define GSI_BAUD_33900 (14) +#define GSI_BAUD_38400 (15) +#define GSI_BAUD_57600 (16) +#define GSI_BAUD_115200 (17) +#define GSI_BAUD_203125 (18) +#define GSI_BAUD_406250 (19) +#define GSI_BAUD_812500 (20) + +/* + * Bits per character + */ +#define GSI_CHAR5 ( 5) +#define GSI_CHAR6 ( 6) +#define GSI_CHAR7 ( 7) +#define GSI_CHAR8 ( 8) + +/* + * Stop bits + */ +#define GSI_STOP1 ( 1) +#define GSI_STOP15 (15) +#define GSI_STOP2 ( 2) + +/* + * Parity bit + */ +#define GSI_PARITYNO ( 1) +#define GSI_PARITYODD ( 2) +#define GSI_PARITYEVEN ( 3) +#define GSI_PARITYSPACE ( 4) + +/* + * Flow control + */ +#define GSI_FLOWNO ( 1) +#define GSI_FLOWHW ( 2) +#define GSI_FLOWSW ( 3) + +/* + * Bit positions + */ +#define GSI_BRKLEN_POS ( 0) +#define GSI_BRK_POS (25) +#define GSI_DISC_POS (26) +#define GSI_ESC_POS (27) +#define GSI_RING_POS (28) +#define GSI_X_POS (29) +#define GSI_SB_POS (30) +#define GSI_SA_POS (31) + +/* + * Bit masks + */ +#define GSI_BRKLEN_MASK (255UL << GSI_BRKLEN_POS) +#define GSI_BRK_MASK (1UL << GSI_BRK_POS) +#define GSI_DISC_MASK (1UL << GSI_DISC_POS) +#define GSI_ESC_MASK (1UL << GSI_ESC_POS) +#define GSI_RING_MASK (1UL << GSI_RING_POS) +#define GSI_X_MASK (1UL << GSI_X_POS) +#define GSI_SB_MASK (1UL << GSI_SB_POS) +#define GSI_SA_MASK (1UL << GSI_SA_POS) + +/* + * Size of the circular buffers used in the driver. + */ +#define GSI_MAX_BUFFER_SIZE (512) + +/*==== TYPES ================================================================*/ + +/* + * Device Control Block + */ +typedef struct { + USHORT Baud; + UBYTE DataBits; + UBYTE StopBits; + UBYTE Parity; + UBYTE RxFlowControl; + UBYTE TxFlowControl; + USHORT RxBufferSize; + USHORT TxBufferSize; + USHORT RxThreshold; + USHORT TxThreshold; + UBYTE XON; + UBYTE XOFF; + UBYTE EscChar; + USHORT GuardPeriod; +} T_GSI_DCB; + +/*==== FUNCTION PROTOTYPES ==================================================*/ + +#ifdef _TARGET_ +/* ++------------------------------------------------------------------------------ +| Function : GSI_Init ++------------------------------------------------------------------------------ +| Description : The function initializes the module and the connected serial +| device. +| +| Parameters : DeviceNo - serial device number +| DrvHandle - unique handle for this device +| CallbackFunc - callback function for this device +| DrvInfo - pointer to the driver parameters +| +| Return : DRV_OK - Initialization successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_INITIALIZED - Driver already initialized +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Init (UBYTE DeviceNo, + USHORT DrvHANDLE, + T_DRV_CB_FUNC CallbackFunc, + T_DRV_EXPORT **DrvInfo); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Exit ++------------------------------------------------------------------------------ +| Description : The function is called when the driver functionality is no +| longer required. The driver terminates regardless of any +| outstanding data to be sent. +| +| Parameters : DeviceNo - serial device number +| +| Return : no return value +| ++------------------------------------------------------------------------------ +*/ +extern void GSI_Exit (UBYTE DeviceNo); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Read ++------------------------------------------------------------------------------ +| Description : This function copies received data into a caller provided +| buffer and returns the line status. It should always return +| immediately after copying the data, without waiting for any +| more data. +| +| Parameters : DeviceNo - serial device number +| Buffer - buffer to copy the data +| Length - On call: size of Buffer; On return: copied bytes +| State - line states of the serial connection +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The driver is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Read (UBYTE DeviceNo, + void *Buffer, + USHORT *Length, + ULONG *State); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Write ++------------------------------------------------------------------------------ +| Description : This functions copies the provided data into the buffer of the +| driver and sets the line states. This function must return +| immediately after copying, even if there is not enough space in +| the driver buffer to copy all provided data. +| +| Parameters : DeviceNo - serial device number +| Buffer - buffer containing the data +| Length - On call: size of data; On return: copied bytes +| State - line states of the serial connection +| Mask - manipulated State bits +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The driver is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Write (UBYTE DeviceNo, + void *Buffer, + USHORT *Length, + ULONG State, + ULONG Mask); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Look ++------------------------------------------------------------------------------ +| Description : This function copies received data into a caller provided +| buffer without delete the data in the driver buffer. It should +| always return immediately after copying the data, without +| waiting for any more data. +| +| Parameters : DeviceNo - serial device number +| Buffer - buffer to copy the data +| Length - On call: size of Buffer; On return: copied bytes +| State - line states of the serial connection +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The driver is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Look (UBYTE DeviceNo, + void *Buffer, + USHORT *Length, + ULONG *State); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Clear ++------------------------------------------------------------------------------ +| Description : This function is used to clear the device internal buffers. +| +| Parameters : DeviceNo - serial device number +| BufferType - buffer to be cleared +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_INPROCESS - The driver is busy clearing the buffers +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Clear (UBYTE DeviceNo, + USHORT BufferType); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Flush ++------------------------------------------------------------------------------ +| Description : This function is used to flush the device internal transmit +| buffer. +| +| Parameters : DeviceNo - serial device number +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - The specified device does not exist +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_INPROCESS - The driver is busy clearing the buffers +| DRV_NOTCONFIGURED - The driver is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_Flush (UBYTE DeviceNo); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_SetSignal ++------------------------------------------------------------------------------ +| Description : This function enables indication signals from the driver. These +| signals are sent via the device callback function. +| +| Parameters : DeviceNo - serial device number +| SignalType - Signal type to be set +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - parameters out of range +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_SIGFCT_NOTAVAILABLE - no event signaling functionality +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_SetSignal (UBYTE DeviceNo, + USHORT SignalType); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_ResetSignal ++------------------------------------------------------------------------------ +| Description : This function disables indication signals from the driver. +| +| Parameters : DeviceNo - serial device number +| SignalType - Signal type to be reset +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - parameters out of range +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_SIGFCT_NOTAVAILABLE - no event signaling functionality +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_ResetSignal (UBYTE DeviceNo, + USHORT SignalType); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_SetConfig ++------------------------------------------------------------------------------ +| Description : This function configures the serial device. +| +| Parameters : DeviceNo - serial device number +| DCBPtr - pointer to the driver control block +| +| Return : DRV_OK - Function successful +| DRV_INVALID_PARAMS - parameters out of range +| DRV_INTERNAL_ERROR - Internal driver error +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_SetConfig (UBYTE DeviceNo, + T_GSI_DCB *DCBPtr); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_GetConfig ++------------------------------------------------------------------------------ +| Description : This function reads the serial device configuration. +| +| Parameters : DeviceNo - serial device number +| DCBPtr - pointer to the driver control block +| +| Return : DRV_OK - Function successful +| DRV_INTERNAL_ERROR - Internal driver error +| DRV_NOTCONFIGURED - The driver is not yet configured +| ++------------------------------------------------------------------------------ +*/ +extern USHORT GSI_GetConfig (UBYTE DeviceNo, + T_GSI_DCB *DCBPtr); + +/* ++------------------------------------------------------------------------------ +| Function : GSI_Callback ++------------------------------------------------------------------------------ +| Description : This function is needed for cascaded drivers. This function +| must not be confused with the parameter CallbackFunc passed to +| GSI_Init(). +| +| Parameters : Signal - pointer to the signal information data +| +| Return : no return value +| ++------------------------------------------------------------------------------ +*/ +extern void GSI_Callback (T_DRV_SIGNAL *Signal); + +#endif /* _TARGET_ */ +#endif /* !GSI_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/header.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,241 @@ +/* ++------------------------------------------------------------------------------ +| File: header.h ++------------------------------------------------------------------------------ +| 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 : Common header types. ++----------------------------------------------------------------------------- +*/ + +#include "glob_defs.h" + +#ifndef __HEADER_H__ +#define __HEADER_H__ + + +/* + * T_PRIM_HEADER + * + * Description : This type definition defines the custom specific + * part of a primitive. All primitives have the + * general format: header followed by data. The + * header of a primitive is changeable according to + * the requirements of the target system. + * Hints: Only the operation code opc as a USHORT value must + * be present. For multi-instance protocol stacks + * the routing information must be include in the + * header (T_ROUTE route). + */ + +#if !defined (T_SDU_DEFINED) + +#define T_SDU_DEFINED + +typedef struct +{ + USHORT l_buf; + USHORT o_buf; + UBYTE buf[1]; +} T_sdu; + +#endif /* T_SDU_DEFINED */ + +/* + * list of generic data descriptors + */ + +#ifndef __T_desc_list__ +#define __T_desc_list__ + +typedef struct +{ + U16 list_len; /*< 0: 2> length in octets of whole data */ + U8 _align0; /*< 2: 1> alignment */ + U8 _align1; /*< 3: 1> alignment */ + U32 first; /*< 4: 4> pointer to first generic data descriptor */ +} T_desc_list; +#endif + +#ifndef __T_desc_list2__ +#define __T_desc_list2__ + +typedef struct +{ + U16 list_len; /*< 0: 2> length in octets of whole data */ + U8 _align0; /*< 2: 1> alignment */ + U8 _align1; /*< 3: 1> alignment */ + U32 first; /*< 4: 4> pointer to first generic data descriptor */ +} T_desc_list2; +#endif + +#ifndef __T_desc_list3__ +#define __T_desc_list3__ + +typedef struct +{ + U16 list_len; /*< 0: 2> length in octets of whole data */ + U8 _align0; /*< 2: 1> alignment */ + U8 _align1; /*< 3: 1> alignment */ + U32 first; /*< 4: 4> pointer to first generic data descriptor */ +} T_desc_list3; +#endif + +/* + * generic data descriptor + */ +#ifndef __T_desc__ +#define __T_desc__ /* to prevent double include in generated files */ + +typedef struct +{ + ULONG next; /* next generic data descriptor */ + USHORT len; /* length of content in octets */ + UBYTE buffer[1]; /* buffer content */ +} T_desc; +#endif /* __T_desc__ */ + +#ifndef __T_desc2__ +#define __T_desc2__ /* to prevent double include in generated files */ + +typedef struct +{ + U32 next; /*< 0: 4> next generic data descriptor */ + U16 offset; /*< 4: 2> offset in octets */ + U16 len; /*< 6: 2> length of content in octets */ + U16 size; /*< 8: 2> size of buffer in octets */ + U8 buffer[1]; /*< 10: 1> buffer content */ +} T_desc2; +#endif /* __T_desc2__ */ + +#ifndef __T_desc3__ +#define __T_desc3__ + +typedef struct +{ + U32 next; /*< 0: 4> next generic data descriptor */ + U16 offset; /*< 4: 2> offset in octets */ + U16 len; /*< 6: 2> length of content in octets */ + U32 buffer; /*< 8: 4> pointer to buffer */ +} T_desc3; +#endif + +#if !defined (T_FRAME_DESC_DEFINED) + +#define T_FRAME_DESC_DEFINED + +typedef struct +{ + UBYTE *Adr[2]; + USHORT Len[2]; +} T_FRAME_DESC; + +#endif /* T_FRAME_DESC_DEFINED */ + +#ifdef OPTION_MULTI_INSTANCES +typedef struct +{ + USHORT inst_no; + USHORT chan_no; + UBYTE ts_no; +} T_ROUTE; +#endif + +typedef struct +{ + char entity; + char dir; + char type; + char align1; +} T_SDU_TRACE; + +#if !defined (T_PRIM_HEADER_DEFINED) +#define T_PRIM_HEADER_DEFINED + +/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + In the current implementation it is essential that the + T_PRIM_HEADER type has the same size as the T_DP_HEADER + type and that the element use_cnt is at the same position + in both header types! + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ +typedef struct +{ + ULONG opc; /* equal to int SignalCode */ + ULONG len; /* primitive length */ + LONG use_cnt; /* counter indicates cuurent number of users */ + T_sdu *sdu; /* pointer to sdu struct if available */ + ULONG sh_offset; /* offset of system header */ + ULONG dph_offset; /* offset of dynamic prim header */ +} T_PRIM_HEADER; + +#endif /* T_PRIM_HEADER_DEFINED */ + +typedef struct _T_DP_HEADER +{ + ULONG magic_nr; /* magic number is checked at each access */ + ULONG size; /* available bytes in dynamic primitive partition */ + ULONG use_cnt; /* counter indicates current number of users */ + ULONG offset; /* offset from partition begin to next free byte */ + T_VOID_STRUCT** + drp_bound_list; /* pointer to the list of dynamic partitions bound to this partition */ + struct _T_DP_HEADER *next; +} T_DP_HEADER; + +typedef struct +{ + SHORT ref_cnt; /* ref_cnt for MALLOC partitions */ + SHORT desc_type; /* descriptor type */ +} T_M_HEADER; + +/* + * flags in the opc + */ +#define EXTENDED_OPC 0x80000000 +#define VIRTUAL_OPC 0x40000000 +#define DOWNLINK_OPC 0x00004000 +#define UPLINK_OPC 0x00000000 +#define MEMHANDLE_OPC 0x20000000 + +#define SAP32_MASK 0x00007fff /* UL/DL Bit Part of SAP Nr.*/ +#define SAP16_MASK 0x7f00 +#define PRIM32_MASK 0x00ff0000 +#define PRIM16_MASK 0x00ff +#define OPC32BIT(opc) (opc&EXTENDED_OPC) +/* + * for 16bit opcs SAP_NR() returns the same result as (opc & SAP_MASK) in the old style. + * No shift right is done, e.g. 0x4d00 is returned instead of 0x4d. + * Also the UL/DL bit is part of the SAP to be downwards compatible with the + * existing code in the xxx_pei.c modules. + */ +#define SAP_NR(opc) (USHORT)((opc&0x80000000)?(opc&SAP32_MASK):(opc&SAP16_MASK)) +#define PRIM_NR(opc) (USHORT)((opc&0x80000000)?((opc&PRIM32_MASK)>>16):(opc&PRIM16_MASK)) + +#define HANDLE_BIT ((UBYTE)0x80) +#define HANDLE_MASK ((UBYTE)0x7F) + +typedef struct +{ + ULONG magic_nr; + ULONG time; + char snd [RESOURCE_NAMELEN]; + char rcv [RESOURCE_NAMELEN]; + char org_rcv [RESOURCE_NAMELEN]; +} T_S_HEADER; + +typedef struct +{ + T_PRIM_HEADER p_hdr; + T_PRIM_HEADER *prim_ptr; +} T_PRIM_X; + +#endif /* HEADER_H */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/ind2str.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,124 @@ +/* ++----------------------------------------------------------------------------- +| Project : STR2IND +| Modul : ind2str.h ++----------------------------------------------------------------------------- +| 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 defines interface of the ind2str library. The +| main purpose of this library is the translation of an trace +| index to a complete trace string. ++----------------------------------------------------------------------------- +*/ + +#ifndef IND2STR_H +#define IND2STR_H + + +/*==== CONSTANTS ==================================================*/ +#define IND2STR_OK 0 +#define IND2STR_FILE_NOT_FOUND -1 +#define IND2STR_WRONGFILEFORMAT -2 +#define IND2STR_INDEXOUTOFBOUNDS -3 +#define IND2STR_PARAMCOUNTOUTOFBOUNDS -4 +#define IND2STR_NOTINITIALISED -5 +#define IND2STR_ACCESSVIOLATION -6 +#define IND2STR_INTERNAL_ERROR -7 + +#ifdef __cplusplus +extern "C" { +#endif + + + +/*----------------------------------------------------------------------------- +| Function : ind2str_Init() ++------------------------------------------------------------------------------ +| Description : Initialises the library: opens the file containing the trace +| mapping table, build the internal representation , closes the +| the file after reading. +| +| Parameters : tableFile - the mapping table file name +| +| Return : success or failure ++------------------------------------------------------------------------------ +*/ +signed char ind2str_Init(char * tableFile); + + +/*----------------------------------------------------------------------------- +| Function : ind2str_Exit() ++------------------------------------------------------------------------------ +| Description : De-initialises the library: closes the file containing the +| trace mapping table, frees allocated memory. +| +| Parameters : +| +| Return : ++------------------------------------------------------------------------------ +*/ +void ind2str_Exit(void); + + +/*----------------------------------------------------------------------------- +| Function : ind2str_Version() ++------------------------------------------------------------------------------ +| Description : Returns the version (build date) of the table. The table must +| be initialized before. +| +| Parameters : +| +| Return : The version of the table or 0. ++------------------------------------------------------------------------------ +*/ +unsigned long ind2str_Version(void); + + +/*----------------------------------------------------------------------------- +| Function : ind2str_VersionNoInit() ++------------------------------------------------------------------------------ +| Description : Returns the version (build date) of the table. The table does +| not need to be initialized before. +| +| Parameters : fileName - the name of the file, that contains a table +| +| Return : The version of the table or 0. ++------------------------------------------------------------------------------ +*/ +unsigned long ind2str_VersionNoInit(char * fileName); + + +/*----------------------------------------------------------------------------- +| Function : ind2str ++------------------------------------------------------------------------------ +| Description : Transforms a trace index string into a trace string, according +| to the trace mapping table. +| +| Parameters : dst - destination string +| +| src - source string +| +| +| Return : The number of characters printed to the destination string. +| ++------------------------------------------------------------------------------ +*/ +int ind2str(char * dst, char * src); + + +#ifdef __cplusplus +} +#endif + + +#endif /* IND2STR_H */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/ipcapi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,192 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO +| Modul : inc\ipcapi.h ++----------------------------------------------------------------------------- +| 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 : API definition for IPC ++----------------------------------------------------------------------------- +*/ +#ifndef IPCAPI_H +#define IPCAPI_H + +#include "cms.h" + +#undef EXPORT +#include <typedefs.h> + +/* define extra function codes for driver ipc */ +#define IPC_SELF 10 +#define IPC_INITCH 11 +#define IPC_EXITCH 12 +#define IPC_OPENCH 13 +#define IPC_CLOSECH 14 +#define IPC_READCH 15 +#define IPC_WRITECH 16 +#define IPC_CREATEMSG 17 +#define IPC_PARSEMSG 18 +#define IPC_ISMYADDR 19 +#define IPC_GETHANDLE 20 +#define IPC_SETTIME 21 + + +/********************************************************************** + * macros + *********************************************************************/ + +#define MSG_ID( Group, Code ) (((Group) << 8) + ((Code) & 0xFF)) + + +/********************************************************************** + * defines + *********************************************************************/ + +/* return codes */ +#define IPC_OK CMS_OK +#define IPC_ERROR CMS_ERROR +#define IPC_EXIST CMS_EXIST +#define IPC_FULL CMS_FULL +#define IPC_BADHANDLE CMS_BADHANDLE +#define IPC_EMPTY CMS_EMPTY +#define IPC_SIZE CMS_SIZE +#define IPC_TIMEOUT CMS_TIMEOUT +#define IPC_NOMEM CMS_NOMEM +#define IPC_INVALID (-20) +#define IPC_MISALIGNED (-21) + + + +#define IPC_MAX_PATH_SIZE 120 + +/* msg IDs: */ +#define IPC_GENERATED MSG_ID(IPC,1) + +#define ALIGNMENT 1 +#define MSG_MAX_SIZE 512 + +/********************************************************************** + * types + *********************************************************************/ + + +typedef int IPC_HANDLE; + +typedef struct +{ + char *pcSender; + char *pcReceiver; + void *pvBuffer; + U32 ulTime; + U16 uwTenthOfMS; + U16 uwSize; + U16 uwID; +} MSG_HEADER; + + + +#if ALIGNMENT == 1 + typedef U8 MSG_BUFFER [MSG_MAX_SIZE]; +#elif ALIGNMENT == 2 + typedef U16 MSG_BUFFER [(MSG_MAX_SIZE + 1) / 2]; +#elif ALIGNMENT == 4 + typedef U32 MSG_BUFFER [(MSG_MAX_SIZE + 3) / 4]; +#else + #error "invalid alignment" +#endif + + +/* standard funtions: */ + + +/*********************************************************************/ +U16 ipc_createMsg ( /* @func Create a message. */ + void *pvBuffer,/* @parm Buffer for the message to store. */ + U16 uwSize, /* @parm Size of the buffer. */ + MSG_HEADER Msg /* @parm Settings for the message to create. */ + ); /* @returnvalue One of the values below. */ +/*--------------------------------------------------------------------- + * @description The function creates a message out of the settings + * that are stored in the structure. The resulting + * message will be written to the buffer. + * + * Attention: The address of the buffer MUST be + * aligned (multiple of ALIGNMENT) + * + * Sender and Receiver will be inserted in normalized + * form (= absolute address) ! + * + * @tablex Return values: | + * Value Description + * -------------------------------------------------- + * > 0 Size of the message. + * = 0 Buffer too small, invalid settings. + * + * @tablex Content of pHdr: | + * Setting Description + * -------------- ----------------------------------- + * pcSender NULL means that the calling process + * is the sender. Otherwise the string + * will be inserted into the message. + * pcReceiver Name of the receiver (string) + * or IPC_HANDLE of the receiver. + * pvBuffer Pointer to the data to append to + * the message. + * uwSize Size of the data to append to the + * message. + * uwID Message group and code. Use the + * macro MSG_ID(Group,Code) to set the + * value. + * ulTime Automatically set. + * uwTenthOfMS Automatically set. + *********************************************************************/ + + +/*********************************************************************/ +S16 ipc_parseMsg ( /* @func Parse a message. */ + MSG_HEADER *pMsg, /* @parm Structure to store the settings. */ + void *pvBuffer,/* @parm Buffer containing the message. */ + U16 uwSize /* @parm Size of pvBuffer. */ + ); /* @returnvalue One of the values below. */ +/*--------------------------------------------------------------------- + * @description The function parses a buffer that contains a + * a message and writes all settings to the + * structure. + * + * Attention: The address of the buffer MUST be + * aligned (multiple of ALIGNMENT) + * + * @tablex Return values: | + * Value Description + * -------------------------------------------------- + * IPC_INVALID Invalid arguments or message. + * IPC_OK Success. + * + * @tablex Content of pHdr: | + * Setting Description + * -------------- ----------------------------------- + * pcSender Address of the sender. + * pcReceiver Address of the receiver (normally + * the process receiving the message). + * pvBuffer Pointer to the data of the message. + * uwSize Size of the data. + * uwID Message group and code. Use the + * macro MSG_ID(Group,Code) to compare + * the value with other IDs. + * ulTime Time [ms from 01.01.1970 GMT] of + * message's creation. + * uwTenthOfMS The tenth of [ms] of the message's + * creation. + *********************************************************************/ + +#endif /* IPCAPI_H */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/os.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,284 @@ +/* ++------------------------------------------------------------------------------ +| File: os.h ++------------------------------------------------------------------------------ +| 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 OS adaptation layer. ++----------------------------------------------------------------------------- +*/ + +#ifndef __OS_H__ +#define __OS_H__ + +#include "os_const.h" + +/*==== CONSTANTS ===================================================*/ +typedef int OS_HANDLE; +typedef BOOL OS_INT_STATE; +typedef ULONG OS_TIME; +typedef ULONG OS_TICK; + +#define OS_NOTASK 0 + +#define FIRST_ENTRY 0xff +#define NEXT_ENTRY 0xfe + +#define OS_EVENT 0x1 +#define OS_NO_EVENT 0x0 +/* + * pattern to initialize task/osisr stacks + */ +#define INITIAL_STACK_VALUE 0xfe + +/* + * constants to access the object information functions + */ +#define OS_OBJSYS 0 +#define OS_OBJTASK 1 +#define OS_OBJQUEUE 2 +#define OS_OBJPARTITIONGROUP 3 +#define OS_OBJMEMORYPOOL 4 +#define OS_OBJTIMER 5 +#define OS_OBJSEMAPHORE 6 + +/* + * return values + */ +#define OS_OK 0 +#define OS_WAITED 1 +#define OS_NEW_PROCESS 2 +#define OS_PARTITION_FREE 3 +#define OS_ALLOCATED_BIGGER 4 +#define OS_ERROR (-1) +#define OS_TIMEOUT (-2) +#define OS_PARTITION_GUARD_PATTERN_DESTROYED (-3) +#define OS_INVALID_QUEUE (-4) + +/* + * message priorities + */ +#define OS_NORMAL 1 +#define OS_URGENT 2 +#define OS_MIN_PRIORITY OS_NORMAL +#define OS_MAX_PRIORITY OS_URGENT + +/* + * OS ISR priority range + */ +#define OS_ISR_MIN_PRIO 0 +#define OS_ISR_MAX_PRIO 2 + +/* + * flags + */ +#define OS_QFPARTITION 0x01 + +/* + * error codes + */ +#define OS_SYST_ERR 0x8000 +#define OS_SYST_ERR_QUEUE_CREATE 0x8001 +#define OS_SYST_ERR_MAX_TIMER 0x8002 +#define OS_SYST_ERR_MAX_TASK 0x8003 +#define OS_SYST_ERR_STACK_OVERFLOW 0x8004 +#define OS_SYST_ERR_PCB_PATTERN 0x8005 +#define OS_SYST_ERR_NO_PARTITION 0x8006 +#define OS_SYST_ERR_STR_TOO_LONG 0x8007 +#define OS_SYST_ERR_OVERSIZE 0x8008 +#define OS_SYST_ERR_TASK_TIMER 0x8009 +#define OS_SYST_ERR_SIMUL_TIMER 0x800A +#define OS_SYST_ERR_QUEUE_FULL 0x800B +#define OS_SYST_ERR_MAX_SEMA 0x800C +#define OS_SYST_ERR_NO_MEMORY 0x800D +#define OS_SYST_ERR_BIG_PARTITION 0x800E + +/* + * warning codes + */ +#define OS_SYST_WRN 0x0000 +#define OS_SYST_WRN_WAIT_PARTITION 0x0001 +#define OS_SYST_WRN_WAIT_QUEUE 0x0002 +#define OS_SYST_WRN_BIG_PARTITION 0x0003 +#define OS_SYST_WRN_MULTIPLE_FREE 0x0004 +#define OS_SYST_WRN_REQ_TRUNCATED 0x0004 +#define OS_SYST_WRN_FREE_FAILED 0x0005 + +/*==== TYPES =======================================================*/ + +typedef struct +{ + USHORT flags; + USHORT data16; + ULONG data32; +#ifdef _TOOLS_ + ULONG len; +#endif + ULONG time; + LONG e_id; + T_VOID_STRUCT * ptr; +} OS_QDATA; + +/*==== PROTOTYPES ==================================================*/ + +/* Task API */ +GLOBAL LONG os_CreateTask (OS_HANDLE Caller, char *Name, void (*TaskEntry)(OS_HANDLE, ULONG), ULONG StackSize, + USHORT Priority, OS_HANDLE *TaskHandle, OS_HANDLE MemPoolHandle); +GLOBAL LONG os_DestroyTask (OS_HANDLE Caller, OS_HANDLE TaskHandle); +GLOBAL LONG os_StartTask (OS_HANDLE Caller, OS_HANDLE TaskHandle, ULONG Value); +GLOBAL LONG os_StopTask (OS_HANDLE Caller, OS_HANDLE TaskHandle); +GLOBAL LONG os_SuspendTask (OS_HANDLE Caller, ULONG Time); +GLOBAL LONG os_DeferTask (OS_HANDLE task_handle, OS_TIME time); +GLOBAL LONG os_ResumeTask (OS_HANDLE task_handle); +GLOBAL LONG os_Relinquish (void); +GLOBAL LONG os_GetTaskName (OS_HANDLE Caller, OS_HANDLE TaskHandle, char * Name); +GLOBAL LONG os_GetTaskHandle (OS_HANDLE Caller, char * Name, OS_HANDLE *TaskHandle); +GLOBAL LONG os_TaskInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_ProInit (void); +GLOBAL LONG os_ChangePreemption (char preempt); +GLOBAL OS_HANDLE os_MyHandle (void); +#ifdef _NUCLEUS_ +GLOBAL LONG os_CheckTaskStack (OS_HANDLE Handle); +/* Task internal */ +GLOBAL LONG os_GetTaskData (OS_HANDLE Handle, unsigned int **tcb, unsigned char **stackbegin, unsigned char **stackend ); +GLOBAL unsigned char os_GetTaskState (OS_HANDLE Caller, OS_HANDLE Handle); +#endif + +/* Queue API */ +GLOBAL LONG os_CreateQueue (OS_HANDLE Caller, OS_HANDLE ComHandle, char *Name, USHORT Entries, + OS_HANDLE *ActHandle, OS_HANDLE MemPoolHandle ); +GLOBAL LONG os_DestroyQueue (OS_HANDLE Caller, OS_HANDLE ComHandle ); +GLOBAL LONG os_OpenQueue (OS_HANDLE Caller, char *Name, OS_HANDLE *ComHandle); +GLOBAL LONG os_CloseQueue (OS_HANDLE Caller, OS_HANDLE ComHandle); +GLOBAL LONG os_SendToQueue (OS_HANDLE Caller, OS_HANDLE ComHandle, USHORT Priority, + ULONG Suspend, OS_QDATA *Msg ); +GLOBAL LONG os_ReceiveFromQueue (OS_HANDLE Caller, OS_HANDLE ComHandle, OS_QDATA *msg, ULONG Timeout ); +GLOBAL LONG os_GetQueueName (OS_HANDLE Caller, OS_HANDLE ComHandle, char * Name); +GLOBAL LONG os_GetQueueHandle (OS_HANDLE Caller, char *Name, OS_HANDLE *ComHandle); +GLOBAL LONG os_QueueInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_ComInit (void); +/* Queue internal */ +#ifdef _NUCLEUS_ +GLOBAL LONG os_GetQueueState (OS_HANDLE Caller, OS_HANDLE Handle, ULONG *Used, ULONG *Free); +GLOBAL unsigned char *os_FindSuspendingQueue (unsigned int *tcb); +GLOBAL LONG os_GetQueueData (OS_HANDLE Caller, OS_HANDLE Handle, USHORT Index, + USHORT *Type, ULONG *opc, ULONG *ptr, ULONG *time ); +#endif +#ifdef _TOOLS_ +extern LONG os_create_extq (const char* name, OS_HANDLE* comhandle); +extern LONG os_destroy_extq (const char* name); +#endif /* _TOOLS_ */ + +/* Memory API */ +GLOBAL LONG os_CreatePartitionPool (OS_HANDLE Caller, char *GroupName, void *Addr, USHORT Num, ULONG Size, + OS_HANDLE *GroupHandle); +GLOBAL LONG os_CreatePartitionPool_fixed_pool_size (OS_HANDLE TaskHandle, char *GroupName, void *Addr, USHORT PoolSize, + ULONG PartitionSize, OS_HANDLE *GroupHandle, ULONG *NumCreated); +GLOBAL LONG os_AllocatePartition (OS_HANDLE Caller, T_VOID_STRUCT **Buffer, ULONG Size, + ULONG Suspend, OS_HANDLE GroupHandle); +GLOBAL LONG os_DeallocatePartition (OS_HANDLE Caller, T_VOID_STRUCT *Buffer); +GLOBAL LONG os_CreateMemoryPool (OS_HANDLE Caller, char *Name, void *Addr, ULONG PoolSize, + OS_HANDLE *PoolHandle); +GLOBAL LONG os_AllocateMemory (OS_HANDLE Caller, T_VOID_STRUCT **Buffer, ULONG Size, + ULONG Suspend, OS_HANDLE PoolHandle); +GLOBAL LONG os_DeallocateMemory (OS_HANDLE Caller, T_VOID_STRUCT *Buffer); +GLOBAL LONG os_PartitionInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_MemoryInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_MemInit (void); +GLOBAL LONG os_SetPoolHandles (OS_HANDLE ext_pool_handle, OS_HANDLE int_pool_handle); +GLOBAL LONG os_GetPartitionGroupHandle(OS_HANDLE Caller, char *Name, OS_HANDLE *GroupHandle); + +GLOBAL LONG os_GetPartitionPoolStatus (ULONG size, OS_HANDLE gr_hndl, USHORT *free, USHORT *alloc); +/* Memory internal */ +GLOBAL LONG os_is_valid_partition (T_VOID_STRUCT *Buffer); +#ifdef _NUCLEUS_ +GLOBAL LONG os_PartitionCheck (ULONG *ptr); +GLOBAL const ULONG *os_GetPrimpoolCB (int grp,int id); +#endif + +/* Timer API */ +GLOBAL LONG os_CreateTimer (OS_HANDLE TaskHandle, void(*TimeoutProc)(OS_HANDLE,OS_HANDLE,USHORT), + OS_HANDLE *TimerHandle, OS_HANDLE MemPoolHandle); +GLOBAL LONG os_DestroyTimer (OS_HANDLE TaskHandle, OS_HANDLE TimerHandle); +GLOBAL LONG os_StartTimer (OS_HANDLE TaskHandle, OS_HANDLE TimerHandle, USHORT Index, + OS_TIME InitialTime, OS_TIME RescheduleTime ); +GLOBAL LONG os_StopTimer (OS_HANDLE TaskHandle, OS_HANDLE TimerHandle); +GLOBAL LONG os_QueryTimer (OS_HANDLE TaskHandle, OS_HANDLE TimerHandle, OS_TIME *RemainingTime); +GLOBAL LONG os_TimerInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_TimInit (void); +GLOBAL LONG os_set_tick (int os_system_tick); +GLOBAL LONG os_InactivityTicks (int *next_event, OS_TICK *next_event_ticks); +GLOBAL LONG os_IncrementTick (OS_TICK ticks); +GLOBAL LONG os_GetScheduleCount (OS_HANDLE task_handle, int * schedule_count); +GLOBAL LONG os_RecoverTick (OS_TICK ticks); + +/* Semaphore API */ +GLOBAL LONG os_CreateSemaphore (OS_HANDLE TaskHandle, char *Name, USHORT Count, + OS_HANDLE *Semhandle, OS_HANDLE MemPoolHandle); +GLOBAL LONG os_DestroySemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle); +GLOBAL LONG os_ResetSemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle, USHORT Count); +GLOBAL LONG os_OpenSemaphore (OS_HANDLE TaskHandle, char *Name, OS_HANDLE *SemHandle); +GLOBAL LONG os_CloseSemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle); +GLOBAL LONG os_ObtainSemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle, ULONG Timeout); +GLOBAL LONG os_ReleaseSemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle); +GLOBAL LONG os_QuerySemaphore (OS_HANDLE TaskHandle, OS_HANDLE SemHandle, USHORT *Count); +GLOBAL LONG os_SemaphoreInformation (USHORT Handle, char *Buffer); +GLOBAL LONG os_SemInit (void); +/* Semaphore internal */ +#ifdef _NUCLEUS_ +GLOBAL unsigned char *os_FindSuspendingSema (unsigned int *tcb); +#endif + +/* Interrupt API */ +GLOBAL LONG os_CreateOSISR (char *name, void (*OSISR_entry)(void), int stacksize, int priority, + int flags, OS_HANDLE *osisr_handle ); +GLOBAL LONG os_DeleteOSISR (OS_HANDLE osisr_handle); +GLOBAL LONG os_ActivateOSISR (OS_HANDLE osisr_handle); +GLOBAL LONG os_SetInterruptState (OS_INT_STATE new_state, OS_INT_STATE *old_state); +GLOBAL LONG os_EnableInterrupts (OS_INT_STATE *old_state); +GLOBAL LONG os_DisableInterrupts (OS_INT_STATE *old_state); +GLOBAL LONG os_isr_init (void); + +/* Event group API */ +GLOBAL LONG os_CreateEventGroup (char *evt_grp_name, OS_HANDLE *evt_grp_handle); +GLOBAL LONG os_DeleteEventGroup (OS_HANDLE evt_grp_handle); +GLOBAL LONG os_EventGroupInformation (OS_HANDLE evt_grp_handle, char *Name, unsigned* mask_evt, unsigned* tasks_waiting, OS_HANDLE* first_task); +GLOBAL LONG os_SetEvents (OS_HANDLE evt_grp_handle, unsigned event_flags); +GLOBAL LONG os_ClearEvents (OS_HANDLE evt_grp_handle, unsigned event_flags); +GLOBAL LONG os_RetrieveEvents (OS_HANDLE evt_grp_handle, unsigned event_flags, char option, unsigned* retrieved_events, unsigned suspend); +GLOBAL LONG os_EvGrpInit (void); +GLOBAL LONG os_GetEventGroupHandle (char *evt_grp_name, OS_HANDLE *evt_grp_handle); + +/* Miscellaneous */ +GLOBAL LONG os_GetTime (OS_HANDLE TaskHandle, OS_TIME *Time); +GLOBAL LONG os_Initialize (void); +GLOBAL LONG os_ObjectInformation (OS_HANDLE Caller, USHORT Id, USHORT Handle, USHORT len, void *Buffer); +void os_SystemError (OS_HANDLE Caller, USHORT cause, char *buffer ); +LONG os_dar_register (const void *dar_properties); +#ifdef _NUCLEUS_ +LONG os_dar_set_filter (void); +LONG os_read_dar_ffs_data (USHORT entry, char *buffer, USHORT len); +#endif +#if defined (_NUCLEUS_) && defined (_TARGET_) +#include "gdi.h" +GLOBAL LONG os_CreateCallback (void); +GLOBAL LONG os_ExecuteCallback (OS_HANDLE Caller, void (*Callback)(T_DRV_SIGNAL*), T_DRV_SIGNAL *Signal); +#endif +#ifdef CTB +GLOBAL void os_Tick (void); +GLOBAL void os_StartTicking (void); +GLOBAL void os_StopTicking (void); +GLOBAL ULONG os_GetProcessId (void); +#endif + +/*==== END OF OS.H =================================================*/ +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/os_const.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,92 @@ +/* ++------------------------------------------------------------------------------ +| File: os_const.h ++------------------------------------------------------------------------------ +| 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 : Constants for the Nucleus OS-Layer ++----------------------------------------------------------------------------- +*/ + +#ifndef OS_CONST_H +#define OS_CONST_H + +/*==== INCLUDES =============================================================*/ + + +/*==== CONSTS ===============================================================*/ + +#define PTR_OVERHEAD 8 + +#ifdef MEMORY_SUPERVISION + #define PPM_CHKOVERHEAD 4 + #define PPM_OVERHEAD (4+PPM_CHKOVERHEAD) + #define PPM_IDX_OFFSET 0 +#else + #define PPM_CHKOVERHEAD 0 + #define PPM_OVERHEAD 0 +#endif + +#ifdef NU_DEBUG + #define PT_CHKOVERHEAD 4 +#else + #define PT_CHKOVERHEAD 0 +#endif + +#define PT_OVERHEAD (PTR_OVERHEAD+PPM_OVERHEAD) +#define POOL_OVERHEAD 0 + +#define PPM_OFFSET ((PPM_OVERHEAD-PPM_CHKOVERHEAD)/sizeof(ULONG)) + +#define SUSPEND_ONE_TICK 1 +#define TDMA_FRAME_DURATION 4.615 +#define WIN32_TIMER_TICK 50 + +#define NO_WAIT_CHECK 0 +#define WAIT_CHECK 1 + +#define OS_SUSPEND 0xffffffffUL /*NU_SUSPEND*/ +#define OS_NO_SUSPEND 0 /*NU_NO_SUSPEND*/ + +#define OS_FOREVER 0xffffffffUL /*NU_SUSPEND*/ + +#define TIME_TO_TICK_TDMA_FRAME_MULTIPLIER 14199 +#define TICK_TO_TIME_TDMA_FRAME_MULTIPLIER 302483 +#define TIME_TO_TICK_10MS_MULTIPLIER 6554 +#define TICK_TO_TIME_10MS_MULTIPLIER 655319 + +#ifdef _TARGET_ + #define TIME_TO_SYSTEM_TICKS(time) (((((time)&0xffff)*os_time_to_tick_multiplier+0x8000)>>16)\ + +(((time)>>16)*os_time_to_tick_multiplier)) + #define SYSTEM_TICKS_TO_TIME(ticks) (((((ticks)&0xfff)*os_tick_to_time_multiplier+0x8000)>>16)\ + +((((ticks)>>12)*os_tick_to_time_multiplier)>>4)) +#else + #define TIME_TO_SYSTEM_TICKS(Time) ((Time)/WIN32_TIMER_TICK) + #define SYSTEM_TICKS_TO_TIME(Ticks) ((Ticks)*WIN32_TIMER_TICK) +#endif + +#define OS_QUEUE_ENTRY_SIZE(E) (((E)*(sizeof(OS_QDATA)+sizeof(void*)) + (OS_MAX_PRIORITY * (((E)+1)*sizeof(void*))))) + +#define POOL_SIZE(n,s) ((n*(s+PT_CHKOVERHEAD+PT_OVERHEAD))) + +/* to avoid changes in all xxxconst.h files even if they do not use events */ +#ifndef MAX_EVENT_GROUPS + #define MAX_EVENT_GROUPS 1 +#endif + +/*==== TYPES =================================================================*/ + + +/*==== EXPORTS ===============================================================*/ + + +#endif /* OS_CONST_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/os_glob.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,74 @@ +/* ++------------------------------------------------------------------------------ +| File: os_glob.h ++------------------------------------------------------------------------------ +| 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 : Global tabless for the Nucleus OS adaptation layer ++----------------------------------------------------------------------------- +*/ + +#ifndef OS_GLOB_H +#define OS_GLOB_H + +/*==== INCLUDES =============================================================*/ + +#include "os_types.h" + +/*==== CONSTANTS ============================================================*/ + +/*==== TYPES ================================================================*/ + +/*==== VARIABLES ============================================================*/ + +#ifndef CONFIG_MODULE + +extern USHORT MaxTasks; +extern USHORT MaxCommunications; +extern USHORT MaxSimultaneousTimer; +extern USHORT MaxTimer; +extern USHORT MaxSemaphores; +extern USHORT MaxOSISRs; +extern USHORT MaxEventGroups; +extern USHORT MaxPoolGroups; +extern USHORT MaxMemoryPools; +#else + +#ifndef DATA_INT_RAM +USHORT MaxOSISRs = MAX_OSISRS; +USHORT MaxTasks = MAX_OS_TASKS; +USHORT MaxCommunications = MAX_COMMUNICATIONS; +USHORT MaxSimultaneousTimer = MAX_SIMULTANEOUS_TIMER; +USHORT MaxSemaphores = MAX_SEMAPHORES; +USHORT MaxEventGroups = MAX_EVENT_GROUPS; +USHORT MaxPoolGroups = MAX_POOL_GROUPS; +USHORT MaxMemoryPools = MAX_MEMORY_POOLS; + +GLOBAL T_OS_TASK_TABLE_ENTRY TaskTable [ MAX_OS_TASKS + 1 ]; +GLOBAL T_OS_COM_TABLE_ENTRY ComTable [ MAX_COMMUNICATIONS + 1 ]; +GLOBAL T_OS_TIMER_ENTRY TimerTable [ MAX_SIMULTANEOUS_TIMER + 1 ]; +GLOBAL T_OS_SEM_TABLE_ENTRY SemTable [ MAX_SEMAPHORES + 1 ]; +GLOBAL T_OS_OSISR_TABLE_ENTRY OSISRTable [ MAX_OSISRS + 1 ]; +GLOBAL T_OS_PART_GRP_TABLE_ENTRY PartGrpTable [ MAX_POOL_GROUPS + 1 ]; +GLOBAL T_OS_MEM_POOL_TABLE_ENTRY MemPoolTable [ MAX_MEMORY_POOLS + 1 ]; +GLOBAL T_OS_EVTGRP_TABLE_ENTRY EvtGrpTable[ MAX_EVENT_GROUPS + 1 ]; +GLOBAL T_OS_TIMER_TABLE_ENTRY *p_list [ MAX_SIMULTANEOUS_TIMER + 1 ]; +GLOBAL T_OS_POOL_BORDER PoolBorder [ MAX_POOL_GROUPS+1]; + +GLOBAL const char *os_dar_filename = "/var/dbg/dar"; +GLOBAL ULONG os_dar_write_buffer_size = 3000; +#endif /* DATA_INT_RAM */ + + +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/os_types.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,191 @@ +/* ++------------------------------------------------------------------------------ +| File: os_types.h ++------------------------------------------------------------------------------ +| 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 Nucleus OS adaptation layer ++----------------------------------------------------------------------------- +*/ + +#ifndef OS_TYPES_H +#define OS_TYPES_H + +/*==== INCLUDES =============================================================*/ + +#include "nucleus.h" +#include "os.h" +#include "glob_defs.h" + +/*==== CONSTANTS ============================================================*/ + +/*==== TYPES ================================================================*/ + +typedef enum +{ + SYSTEM_TICK_TDMA_FRAME = 1, + SYSTEM_TICK_10_MS +} T_OS_SYSTEM_TICK; + +/* + * Type Definition for Task Management + */ + +typedef struct +{ + NU_TASK TCB; + ULONG magic_nr; + OS_HANDLE handle; +} OS_NU_TASK; + +typedef struct +{ + char Name[RESOURCE_NAMELEN]; /* name of the protocol stack entity */ +#ifdef _ESF_SUPPORT_ + ULONG Value; /* additional parameter */ +#endif + OS_NU_TASK TaskCB; /* control block of the thread */ + void (*TaskEntry)(OS_HANDLE, ULONG); /* NUCLEUS task entry function */ + ULONG *Stack; /* start address of stack memory */ +} T_OS_TASK_TABLE_ENTRY; + +/* + * Type Definition for Queue Management + */ + +typedef struct _T_QDATA_ELEMENT +{ + OS_QDATA Data; + struct _T_QDATA_ELEMENT *pNext; +} T_QDATA_ELEMENT; + +typedef struct +{ + OS_QDATA **pWrite; + OS_QDATA **pRead; + OS_QDATA **pStart; +} T_QUEUE; + +typedef struct +{ + ULONG opc; + ULONG time; + void *ptr; + USHORT type; +} T_QUEUE_MSG; + +typedef struct +{ + char Name [ RESOURCE_NAMELEN ]; /* name of the queue */ + T_QUEUE Queue [ OS_MAX_PRIORITY ]; /* read/write pointers to ringlist */ + T_QDATA_ELEMENT *pQueueMemory; /* pointer to queue memory, used for destroy */ + T_QDATA_ELEMENT *pFreeElement; /* pointer to next free element */ + USHORT Entries; /* queue entries */ + USHORT MaxUsed; + NU_SEMAPHORE FreeSemCB; + NU_SEMAPHORE UsedSemCB; + T_QUEUE_MSG current_msg; + T_VOID_STRUCT *QueueData; +} T_OS_COM_TABLE_ENTRY; + +/* + * Type Definition for Timer Management + */ + +#define TMR_FREE 0 +#define TMR_USED 1 +#define TMR_ACTIVE 2 + +typedef struct _T_OS_TIMER_TABLE_ENTRY +{ + OS_HANDLE t_handle; /* timer handle */ + OS_HANDLE task_handle; /* task that started the timer */ + OS_HANDLE entity_handle; /* entity that started the timer */ + void (*TimeoutProc)(OS_HANDLE,OS_HANDLE,USHORT); /* timeout function */ + ULONG r_ticks; /* remaining ticks */ + ULONG p_ticks; /* periodic expiration ticks */ + USHORT status; /* timer status */ + USHORT t_index; /* index of the timer */ + struct _T_OS_TIMER_TABLE_ENTRY *next; + struct _T_OS_TIMER_TABLE_ENTRY *prev; +} T_OS_TIMER_TABLE_ENTRY; + +typedef struct +{ + OS_HANDLE next_t_handle; /* handle of the next free table entry */ + T_OS_TIMER_TABLE_ENTRY entry; /* pointer to timer table entry */ +} T_OS_TIMER_ENTRY; + +/* + * Type Definition for Semaphore Management + */ + +typedef struct +{ + char Name[ RESOURCE_NAMELEN ]; /* name of the semaphore */ + NU_SEMAPHORE SemCB; /* control block of the semaphore */ +} T_OS_SEM_TABLE_ENTRY; + +/* + * Type Definition for HISR Management + */ + +typedef struct +{ + char name[RESOURCE_NAMELEN]; /* name of the protocol stack entity */ + NU_HISR hisr_cb; /* control block of the HISR */ + ULONG *stack; /* start address of stack memory */ +} T_OS_OSISR_TABLE_ENTRY; + +/* + * Type Definition for Partition Pool Management + */ +typedef struct _T_OS_PART_POOL +{ + struct _T_OS_PART_POOL * next; + unsigned int size; + T_VOID_STRUCT * pool_mem; + NU_PARTITION_POOL pcb; +} T_OS_PART_POOL; + +typedef struct +{ + T_OS_PART_POOL * grp_head; + char name[RESOURCE_NAMELEN]; +} T_OS_PART_GRP_TABLE_ENTRY; + +#ifdef NU_DEBUG +typedef struct +{ + char *Start; + char *End; +} T_OS_POOL_BORDER; +#endif + +/* + * Type Definition for Dynamic Memory Pool Management + */ +typedef struct +{ + char name[RESOURCE_NAMELEN]; + NU_MEMORY_POOL * pcb; +} T_OS_MEM_POOL_TABLE_ENTRY; + + +typedef struct +{ + char Name[ RESOURCE_NAMELEN ]; /* name of the event group */ + NU_EVENT_GROUP EvtGrp; /* control block of the event group */ +} T_OS_EVTGRP_TABLE_ENTRY; + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/p_frame.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,145 @@ +/* ++------------------------------------------------------------------------------ +| File: frm_primitives.h ++------------------------------------------------------------------------------ +| 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 frame primitives. ++----------------------------------------------------------------------------- +*/ + +#ifndef FRM_PRIMITIVES_H +#define FRM_PRIMITIVES_H + +#define FRM_ERROR_IND 0xC000001E /* SAP NR: 30 (0x1e), PRIM NR 0 */ +#define FRM_WARNING_IND 0xC001001E /* SAP NR: 30 (0x1e), PRIM NR 1 */ + +/* maximum length of a string in frame primitives */ +#define FRM_PRIM_STR_SIZE 100 + +/* spontaneuous frame output */ +typedef struct +{ + U32 error_code; + char error_string [ FRM_PRIM_STR_SIZE ]; +} T_FRM_ERROR_IND; + +typedef struct +{ + U32 warning_code; + char warning_string [ FRM_PRIM_STR_SIZE ]; +} T_FRM_WARNING_IND; + +#if 0 +/* frame status requests and confirmations */ + +/* register destination for error/warning indications */ + +typedef struct +{ + char name [ RESOURCE_NAMELEN ]; +} T_FRM_REGISTER_REQ; + +typedef struct +{ + char name [ RESOURCE_NAMELEN ]; +} T_FRM_REGISTER_CNF; + +/* task status */ + +typedef struct +{ + U32 task_id; +} T_FRM_TASK_STATUS_REQ; + +typedef struct +{ + char name [ RESOURCE_NAMELEN ]; + U32 priority; + U32 stacksize; + U32 unused_stack; +} T_FRM_TASK_DATA; + +typedef struct +{ + T_FRM_TASK_DATA task [ MAX_OS_TASKS ];; +} T_FRM_TASK_STATUS_CNF; + +/* partition status */ + +typedef struct +{ + U32 partition_group_id; +} T_FRM_PARTITION_STATUS_REQ; + +typedef struct +{ + T_FRM_PARTITION_DATA p_pool [ MAX_POOL_GROUPS*MAX_POOLS_PER_GROUP ]; +} T_FRM_PARTITION_STATUS_CNF; + +typedef struct +{ + U32 partition_pool_id; + U32 partition_size + U32 available; + U32 allocated; +} T_FRM_PARTITION_DATA; + +/* memory status */ +typedef struct +{ + U32 memory_pool_id; +} T_FRM_MEMORY_STATUS_REQ; + +typedef struct +{ + U32 memory_pool_id; + U32 pool_size + U32 available; + U32 allocated; +} T_FRM_MEMORY_DATA; + +typedef struct +{ + T_FRM_MEMORY_DATA m_pool [ MAX_MEMORY_POOLS }; +} T_FRM_MEMORY_STATUS_CNF; + +/* timer status */ + +typedef struct +{ + U32 timer_id; +} T_FRM_TIMER_STATUS_REQ; + +typedef struct +{ + U32 max_timer; + U32 max_simul_available_timer; + U32 max_simul_running_timer; +} T_FRM_TIMER_STATUS_CNF; + +/* semaphore status */ + +typedef struct +{ + U32 semaphore_id; +} T_FRM_SEMAPHORE_STATUS_REQ; + +typedef struct +{ +} T_FRM_SEMAPHORE_STATUS_CNF; +#endif + +#endif /* FRM_PRIMITIVES_H */ + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/p_mem.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,321 @@ +/* ++------------------------------------------------------------------------------ +| File: mem.h ++------------------------------------------------------------------------------ +| Copyright Condat AG 1999-2000, Berlin +| All rights reserved. +| +| This file is confidential and a trade secret of Condat 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 +| Condat AG. ++------------------------------------------------------------------------------ +| Purpose: Definitions for the entity MEM. +| $Identity:$ ++------------------------------------------------------------------------------ +*/ + +#ifndef MEM_H +#define MEM_H + +/*==== INCLUDES ==============================================================*/ + +#include "typedefs.h" +#include "vsi.h" +#include "pei.h" +#include "tools.h" + +/*==== GENERATED CONTENT ======================================================*/ + +/* ++--------------------------------------------------------------------------+ +| PROJECT : PROTOCOL STACK | +| FILE : p_8010_112_mem_sap.val | +| SOURCE : "s:\g23m\condat\ms\DFILE\PRIM\8010_112_mem_sap.pdf" | +| LastModified : "12 February, 2003 by Gert Z. Srensen (GSO)" | +| IdAndVersion : "8010.112.02.002" | +| SrcFileTime : "Wed Nov 26 14:28:02 2003" | +| Generated by CCDGEN_2.4.11 on Tue Sep 21 10:40:12 2004 | +| !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | ++--------------------------------------------------------------------------+ +*/ + +/* PRAGMAS + * PREFIX : MEM + * COMPATIBILITY_DEFINES : NO + * ALWAYS_ENUM_IN_VAL_FILE: YES + * ENABLE_GROUP: NO + * CAPITALIZE_TYPENAME: NO + */ + + +#ifndef P_8010_112_MEM_SAP_VAL +#define P_8010_112_MEM_SAP_VAL + + +#define CDG_ENTER__P_8010_112_MEM_SAP_VAL + +#define CDG_ENTER__FILENAME _P_8010_112_MEM_SAP_VAL +#define CDG_ENTER__P_8010_112_MEM_SAP_VAL__FILE_TYPE CDGINC +#define CDG_ENTER__P_8010_112_MEM_SAP_VAL__LAST_MODIFIED _12_February_2003_by_Gert_Z_Srensen_GSO +#define CDG_ENTER__P_8010_112_MEM_SAP_VAL__ID_AND_VERSION _8010_112_02_002 + +#define CDG_ENTER__P_8010_112_MEM_SAP_VAL__SRC_FILE_TIME _Wed_Nov_26_14_28_02_2003 + +#include "CDG_ENTER.h" + +#undef CDG_ENTER__P_8010_112_MEM_SAP_VAL + +#undef CDG_ENTER__FILENAME + + +/* + * user defined constants + */ +#define MEM_MAX_NUMBER_OF_BUFFERS (0x40) +#define MEM_MAX_NUMBER_OF_USERS (0x40) +#define MEM_UNORDERED_BUFFER (0x0) +#define MEM_FIFO_BUFFER (0x1) +#define MEM_MAX_RAB_ID (0x10) +#define MEM_MAX_MEMORY_POOL_SIZE (0xffffff) +#define MEM_INVALID_USER_HANDLE (0x0) +#define MEM_INVALID_BUFFER_HANDLE (0x0) +#define MEM_RLC_UL_AM_MODE (0x0) +#define MEM_RLC_UL_UM_MODE (0x1) +#define MEM_RLC_UL_TM_MODE (0x2) +#define MEM_INVALID_MEMORY_HANDLE (0x0) + +#include "CDG_LEAVE.h" + +#endif + + +/* ++--------------------------------------------------------------------------+ +| PROJECT : PROTOCOL STACK | +| FILE : p_8010_112_mem_sap.h | +| SOURCE : "s:\g23m\condat\ms\DFILE\PRIM\8010_112_mem_sap.pdf" | +| LastModified : "12 February, 2003 by Gert Z. Srensen (GSO)" | +| IdAndVersion : "8010.112.02.002" | +| SrcFileTime : "Wed Nov 26 14:28:02 2003" | +| Generated by CCDGEN_2.4.11 on Tue Sep 21 10:40:12 2004 | +| !!DO NOT MODIFY!!DO NOT MODIFY!!DO NOT MODIFY!! | ++--------------------------------------------------------------------------+ +*/ + +/* PRAGMAS + * PREFIX : MEM + * COMPATIBILITY_DEFINES : NO + * ALWAYS_ENUM_IN_VAL_FILE: YES + * ENABLE_GROUP: NO + * CAPITALIZE_TYPENAME: NO + */ + + +#ifndef P_8010_112_MEM_SAP_H +#define P_8010_112_MEM_SAP_H + + +#define CDG_ENTER__P_8010_112_MEM_SAP_H + +#define CDG_ENTER__FILENAME _P_8010_112_MEM_SAP_H +#define CDG_ENTER__P_8010_112_MEM_SAP_H__FILE_TYPE CDGINC +#define CDG_ENTER__P_8010_112_MEM_SAP_H__LAST_MODIFIED _12_February_2003_by_Gert_Z_Srensen_GSO +#define CDG_ENTER__P_8010_112_MEM_SAP_H__ID_AND_VERSION _8010_112_02_002 + +#define CDG_ENTER__P_8010_112_MEM_SAP_H__SRC_FILE_TIME _Wed_Nov_26_14_28_02_2003 + +#include "CDG_ENTER.h" + +#undef CDG_ENTER__P_8010_112_MEM_SAP_H + +#undef CDG_ENTER__FILENAME + + +#ifndef __T_MEM_no_parms__ +#define __T_MEM_no_parms__ +/* + * No parameters. + * CCDGEN:WriteStruct_Count==14836 + */ +typedef struct +{ + U8 none; /*< 0: 1> No parameters */ + U8 zzz_align0; /*< 1: 1> alignment */ + U8 zzz_align1; /*< 2: 1> alignment */ + U8 zzz_align2; /*< 3: 1> alignment */ +} T_MEM_no_parms; +#endif + +#ifndef __T_MEM_uplink_buffer_users_info__ +#define __T_MEM_uplink_buffer_users_info__ +/* + * No parameters. + * CCDGEN:WriteStruct_Count==14839 + */ +typedef struct +{ + U8 rab_id; /*< 0: 1> Radio access identifier */ + U8 rlc_mode; /*< 1: 1> RLC Mode */ + U8 zzz_align0; /*< 2: 1> alignment */ + U8 zzz_align1; /*< 3: 1> alignment */ + U32 bits_per_tti; /*< 4: 4> Bits per TTI */ + U16 rlc_tx_window_size; /*< 8: 2> RLC window size */ + U8 zzz_align2; /*< 10: 1> alignment */ + U8 zzz_align3; /*< 11: 1> alignment */ +} T_MEM_uplink_buffer_users_info; +#endif + + +/* + * End of substructure section, begin of primitive definition section + */ + +#ifndef __T_MEM_READY_IND__ +#define __T_MEM_READY_IND__ +/* + * + * CCDGEN:WriteStruct_Count==14842 + */ +typedef struct +{ + U8 user_handle; /*< 0: 1> User Handle */ + U8 user_parameter; /*< 1: 1> User parameter */ + U8 zzz_align0; /*< 2: 1> alignment */ + U8 zzz_align1; /*< 3: 1> alignment */ +} T_MEM_READY_IND; +#endif + +#ifndef __T_MEM_BUFFER__ +#define __T_MEM_BUFFER__ +/* + * + * CCDGEN:WriteStruct_Count==14845 + */ +typedef struct +{ + U32 memory_pool_size; /*< 0: 4> Memory pool size */ + U32 allocated; /*< 4: 4> Parameter */ + U8 ordering; /*< 8: 1> Ordering */ + U8 delete_pending; /*< 9: 1> Parameter */ + U8 zzz_align0; /*< 10: 1> alignment */ + U8 zzz_align1; /*< 11: 1> alignment */ + U32 max_allocated; /*< 12: 4> Parameter */ + U32 fifo_read_index; /*< 16: 4> Parameter */ + U32 fifo_write_index; /*< 20: 4> Parameter */ +} T_MEM_BUFFER; +#endif + + +#include "CDG_LEAVE.h" + + +#endif + + +/*==== CONSTS ================================================================*/ + +#define MEM_READY_IND (0x8000408b) +#define MEM_BUFFER (0x8001408b) + + +#ifdef ENTITY_MEM + +#define VSI_CALLER mem_handle, +#define VSI_CALLER_SINGLE mem_handle + +#endif + +#define MEM_STATISTICS + +#define MAX_UPLINK_USERS 11 /* Maximum number of uplink buffer users. Corresponds */ + /* maxim number of available rab identifiers */ +#define MAX_RAB_ID 16 /* Maximum RAB identifier. Used in array declarations. 15+1 */ +#define RAB_TRANSMIT_BUFFER_SIZE_BYTES 500000 /* Uplink buffer size */ +#define MAX_SDU_SIZE 1520 + + +/*==== TYPES =================================================================*/ + +typedef struct +{ + T_HANDLE comm_handle; /* Communication handle to user */ + U8 user_parameter; /* User defined parameter */ + U8 buffer_id; /* Id of buffer used by this user */ + + U32 low; /* Flow control low */ + U32 high; /* Flow control high */ + U32 max; /* Flow control max */ + U32 allocated; /* Allocated number of octets */ + +#ifdef MEM_STATISTICS + U32 max_allocated; /* Max number of octets allocated by user */ +#endif /* STATISTICS */ + + U16 space_before; /* Extra space to allocate before user data */ + U8 space_after; /* Extra space to allocate after user data */ + U8 ready; /* TRUE if ready to receive data from this user */ + U8 delete_pending; /* TRUE if user is to be deleted when all freed */ + +} T_MEM_USER; + + +typedef struct +{ + U8* (*get_user_data) (U32 memory_handle, U16 *ptr_length); + U8 (*create_user) (U8 buffer_handle, U8 user_parameter, char *task_name); + U8 (*create_buffer) (U8 ordering, U32 memory_pool_size); + U8* (*alloc) (U8 user_handle, U16 length, U32 *ptr_handle); + void (*dealloc) (U32 memory_handle); + void (*delete_user) (U8 user_handle); + void (*delete_buffer) (U8 buffer_handle); +} T_MEM_PROPERTIES; + +/*==== EXPORTS ===============================================================*/ + +#ifdef MEM_PEI_C + +/* Task handle for MEM */ +T_HANDLE mem_handle; + +/* Semaphore used to guarantee exclusive access at critical points */ +T_HANDLE mem_semaphore_handle; + +/*T_MEM_BUFFER *mem_buffer[MEM_MAX_NUMBER_OF_BUFFERS];*/ +T_MEM_USER *mem_user[MEM_MAX_NUMBER_OF_USERS]; + +#else /* MEM_PEI_C */ + +extern T_HANDLE mem_handle; +extern T_HANDLE mem_semaphore_handle; +extern T_MEM_BUFFER *mem_buffer[MEM_MAX_NUMBER_OF_BUFFERS]; +extern T_MEM_USER *mem_user[MEM_MAX_NUMBER_OF_USERS]; + +#endif /* MEM_PEI_C */ + +extern U8 mem_create_buffer(U8 ordering, U32 memory_pool_size); +extern void mem_delete_buffer(U8 buffer_handle); +extern U8 mem_create_user(U8 buffer_handle, U8 user_parameter, char *task_name); +extern void mem_init(void); +extern void mem_delete_user(U8 user_handle); +extern U8 mem_create_uplink_user(char* task_name, U8 mem_rab_id); +extern void mem_delete_uplink_user(U8 user_handle); +extern void mem_adjust_uplink_users_flow_control(T_MEM_uplink_buffer_users_info *users_info[MEM_MAX_RAB_ID]); +extern void mem_configure_flow_control(U8 user_handle, U32 low, U32 high, U32 max); +extern void mem_configure_extra_space(U8 user_handle, U16 space_before, U8 space_after); +extern BOOL mem_ready(U8 user_handle); +extern U8 *mem_alloc(U8 user_handle, U16 length, U32 *ptr_handle); +extern void mem_dealloc(U32 memory_handle); +extern void mem_realloc(U32 memory_handle, U16 length); +extern U8 *mem_get_user_data(U32 memory_handle, U16 *ptr_length); +extern U16 mem_get_space_before(U32 memory_handle); +extern U8 mem_get_space_after(U32 memory_handle); +extern U8 *mem_decrease_space_before(U32 memory_handle, U16 delta_space_before, U16 *ptr_length); +extern void mem_increase_space_before(U32 memory_handle, U16 delta_space_before); +extern void mem_decrease_space_after(U32 memory_handle, U8 delta_space_after); +extern void mem_increase_space_after(U32 memory_handle, U8 delta_space_after); +extern void mem_send_ready_ind(T_HANDLE com_handle, U8 user_handle, U8 user_paramaeter); + +#endif /* MEM_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_const.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,540 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : inc\pco_const.h ++----------------------------------------------------------------------------- +| 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 header provides defines for all the messages send +| between pco components ++----------------------------------------------------------------------------- +*/ + + +#ifndef _PCO_CONST_H_ +#define _PCO_CONST_H_ + +/*==== INCLUDES ==================================================*/ +#include "ipcapi.h" + +/*==== GENERAL CONSTANTS ==================================================*/ +enum T_PCOSTATUS {PCO_RUNNING,PCO_STOPPED,PCO_LOGFILE}; + +#define PCO_SEND_TIMEOUT 10000 + +#define PCO_TTYPE_UNKNOWN 0 +#define PCO_TTYPE_MS 1 // milliseconds since reset +#define PCO_TTYPE_HMSM 2 // current time of day in ms +#define PCO_TTYPE_FRAME 3 // frame number since reset + +#define CTRL_MSG_MAX_SIZE MSG_MAX_SIZE /* from ipc */ +#define CTRL_DATA_MAX_SIZE CTRL_MSG_MAX_SIZE-sizeof(MSG_HEADER) + +#define DATA_MSG_MAX_SIZE 65535 +#define DATA_MSG_DEF_SIZE 2300 + +#define MAX_QNAME_LEN 50 +#define MAX_PATH_LEN 2300 +#define MAX_ENTITY_NLEN 5 + +#define MAX_PRIM_NAME 30 + +#define PCO_DEF_SRV_NAME "PCOS" + +#ifdef _DEBUG +#define PCO_CFG_PATH "../../cfg/" +#else +#define PCO_CFG_PATH "../cfg/" +#endif + +#ifdef _WIN32 +#define DEF_CCDDATA_PATH "ccddata_dll.dll" +#endif + + +#define PCO_MAX_TRACECLASS 32 +const char PCO_TC_NAME[PCO_MAX_TRACECLASS][MAX_PRIM_NAME]= +{ + "FUNCTION TRACE", + "EVENT TRACE", + "PRIMITIVE TRACE", + "STATE TRACE", + "SYSTEM TRACE", + "INTERRUPT-SIGNAL TRACE", + "ERROR TRACE", + "CCD TRACE", + "TIMER TRACE", + "PROFILER TRACE", + + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + + "USER1 TRACE", + "USER2 TRACE", + "USER3 TRACE", + "USER4 TRACE", + "USER5 TRACE", + "USER6 TRACE", + "USER7 TRACE", + "USER8 TRACE", + + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>", + "<TRACE>" +}; + +/*==== PCO CONTROL MESSAGES ==================================================*/ +#define MSG_ID( Group, Code ) (((Group) << 8) + ((Code) & 0xFF)) + +#define PCO_SRV_GROUP 0x1E +#define PCO_VIEW_GROUP 0x1F + + + +#define PCO_CONNECT MSG_ID(PCO_SRV_GROUP,0x01) /* L3SRV_CONNECT */ +/* +data: +char[] name of CMS-queue in which the viewer wants to receive traces/primitives + (zero terminated) + +purpose: +sent from viewer to server to establish connection, server adds client to its list +*/ + +#define PCO_DISCONNECT MSG_ID(PCO_SRV_GROUP,0x02) /* L3SRV_DISCONNECT */ +/* +data: + +purpose: +sent from viewer to server to disconnect, server removes client from its list +*/ + +#define PCO_SUBSCRIBE MSG_ID(PCO_SRV_GROUP,0x03) /* L3SRV_SUBSCRIBE */ +/* +data: +char[] mobile ID (may be empty) (zero terminated) + +purpose: +sent from viewer to server to receive live data of a dedicated mobile +*/ + + +#define PCO_UNSUBSCRIBE MSG_ID(PCO_SRV_GROUP,0x04) /* L3SRV_UNSUBSCRIBE */ +/* +data: + +purpose: +sent from viewer to server to stop receiving of live data +*/ + + +/* MSG_ID(PCO_SRV_GROUP,0x05) L3SRV_ENABLE_LOGGING */ + + + +#define PCO_OPEN_LOGFILE MSG_ID(PCO_SRV_GROUP,0x06) /* L3SRV_LOAD_LOG_FILE */ +/* +data: +char[] name of sessionfile with full path or just a session name (zero terminated) +LONG first entry to be sent +LONG last entry to be sent + +purpose: +sent from viewer to server to receive logged data of a specified session +sent from controller to open a session logfile -> new state of server: PCO_LOGFILE. +*/ + + +#define PCO_COPY_LOGFILE MSG_ID(PCO_SRV_GROUP,0x07) /* L3SRV_COPY_LOG_FILE */ +/* +data: +char[] name of source sessionfile with full path (zero terminated) +char[] name of destination sessionfile with full path (zero terminated) +LONG first entry to be copied +LONG last entry to be copied + +purpose: +sent from viewer to server to make it copy a specified session into another +sessionsfile while applying the filter currently set +*/ + + +#define PCO_SET_FILTER MSG_ID(PCO_SRV_GROUP,0x08) /* L3SRV_SET_SERVER_FILTER */ +/* +data: +char[] list ... zero separated entity names ("\0\0"==end) + e.g.: "MM\0RR\0SS\0\0" or "+"MM\0RR\0\0" + - first entity=="+" -> only this entities will be forwarded + - default: specified entities will not be forwarded +prim_trace ... optional parameter to disable/enable general forwarding of + primitives/traces: + 0 .. fowarding of everything (default) + 1 .. no primitives + 2 .. no traces + +purpose: +sent from viewer to server to set the entity filter for this viewer +*/ + + +/* MSG_ID(PCO_SRV_GROUP,0x09) L3SRV_SET_MOBILE_FILTER */ + +/* MSG_ID(PCO_SRV_GROUP,0x0A) L3SRV_GET_MOBILE_FILTER */ + + +#define PCO_EXIT MSG_ID(PCO_SRV_GROUP,0x0B) /* L3SRV_EXIT */ +/* +data: + +purpose: +sent to server to make it exit, server will send this message +to all connected viewers before exiting +*/ + + +/* MSG_ID(PCO_SRV_GROUP,0x0C) L3SRV_LOG_FILE */ + + + +#define PCO_DATA MSG_ID(PCO_SRV_GROUP,0x0D) /* L3SRV_DATA */ +/* +data: + rawdata ... depends on server type + +purpose: +sent from some servers to viewers (others send data without header) +contains rawdata which has to be interpreted depending on server type +*/ + + +/* MSG_ID(PCO_SRV_GROUP,0x0E) L3SRV_FILTER */ + + +#define PCO_CONNECTED MSG_ID(PCO_SRV_GROUP,0x0F) /* L3SRV_CONNECTED */ +/* +data: + byte ... server type id (see server types) + +purpose: +sent from server to viewer to inform about an established connection and +to tell its type +*/ + + +#define PCO_OK MSG_ID(PCO_SRV_GROUP,0x10) /* L3SRV_OK */ +/* +data: +U16 ID of message which will be confirmed by this PCO_OK + +purpose: +sent by a receiver to the sender to confirm receiving and correct interpretation of a control message +*/ + + +#define PCO_ERROR MSG_ID(PCO_SRV_GROUP,0x11) /* L3SRV_ERROR */ +/* +data: +U16 ID of message which has produced the error +byte error code (see error codes) + +purpose: +sent by a receiver to the sender to inform about an error a received control message has raised +*/ + + + +#define PCO_STOP_TESTSESSION MSG_ID(PCO_SRV_GROUP,0x12) +/* +data: + +purpose: +sent to the server to stop a running testsession +*/ + +#define PCO_START_TESTSESSION MSG_ID(PCO_SRV_GROUP,0x13) +/* +data: +Char[] session name (zero terminated) +USHORT (optional) + 0 .. don't create dbg-files + 1 .. create dbg-files + +purpose: +sent to the server to start a new testsession +*/ + +#define PCO_CLOSE_LOGFILE MSG_ID(PCO_SRV_GROUP,0x14) +/* +data: + +purpose: +sent to server to disable logfile-mode -> new state PCO_STOPPED. +*/ + +#define PCO_GET_LOGFILE_DATA MSG_ID(PCO_SRV_GROUP,0x15) +/* +data: +ULONG start index +ULONG end index + +purpose: +sent to server (which has to be in PCO_LOGFILE state) to make +him forwarding all logged data from the current session +file (which matches the index constraints) to the sender +(has to be a connected viewer). +*/ + +#define PCO_SEND_PRIM MSG_ID(PCO_SRV_GROUP,0x16) +/* +data: +char[] receiver (zero terminated) +char[] text (zero terminated) + +purpose: +to request server to send a CONFIG-primitive to TST, not supported by all servers (knowledge of FRAME is necessary) +*/ + + +#define PCO_STATUS MSG_ID(PCO_SRV_GROUP,0x17) +/* +data: +<none> .. if sent from controller to server + +T_PCOSTATUS .. current status of server (see T_PCOSTATUS) +Char[] .. name of testsession (can be empty, zero terminated) + +purpose: +sent from controller to server to request its current status, +sent from server to controller to publish its current status +*/ + +#define PCO_GET_TESTSESSIONS MSG_ID(PCO_SRV_GROUP,0x18) +/* +data: + +purpose: +sent from controller to server to acquire a list of available session names (which are stored in current server testsession directory) +*/ + +#define PCO_TESTSESSIONS MSG_ID(PCO_SRV_GROUP,0x19) +/* +data: +char[] .. zero separated testsession names ("\0\0"==end) +USHORT .. 1 - more messages will follow + 0 - last messages with testsessions + +purpose: +reply to PCO_GET_TESTSESSIONS +*/ + + +#define PCO_SET_SESSIONPATH MSG_ID(PCO_SRV_GROUP,0x1A) +/* +data: +char[] .. zero terminated path-string +USHORT .. 1 - store new path in ini-file + 0 - don't store new path + (optional, default is 0) + +purpose: +sent to server to set new session path +*/ + +#define PCO_DISTRIB_LOGFILE MSG_ID(PCO_SRV_GROUP,0x1B) +/* +data: +LONG first entry to be sent +LONG last entry to be sent + +purpose: +sent to server (in logfile mode) to make him send logged data to all clients +*/ + +#define PCO_GET_SESSIONPATH MSG_ID(PCO_SRV_GROUP,0x1C) +/* +data: + +purpose: +sent to server to get its current session path +*/ + +#define PCO_SESSIONPATH MSG_ID(PCO_SRV_GROUP,0x1D) +/* +data: +char[] .. zero terminated path-string + +purpose: +sent from server as reply to PCO_GET_SESSIONPATH +*/ + +#define PCO_SET_TIME_STAMP_PERIOD MSG_ID(PCO_SRV_GROUP,0x1E) +/* +data: +UINT .. new value for time stamp period + 0 ... no time stamps + >0 .. period in minutes + +purpose: +sent to server to set new time stamp period value +*/ + +#define PCO_RENAME_LOGFILE MSG_ID(PCO_SRV_GROUP,0x1F) +/* +data: +char[] original name of sessionfile (evtl. with full path, zero terminated) +char[] new name of sessionfile (evtl. with full path, zero terminated) + +purpose: +sent to server to make it rename a session logfile +*/ + +#define PCO_GET_LOGFILE_INFO MSG_ID(PCO_SRV_GROUP,0x20) +/* +data: +Char[] name of sessionfile with full path or just a session name (zero terminated) + +purpose: +sent to server to request info's (e.g. count of entries) about the specified logfile +*/ + +#define PCO_LOGFILE_INFO MSG_ID(PCO_SRV_GROUP,0x21) +/* +data: +LONG count of entries in logfile specified in last PCO_GET_LOGFILE_INFO +Char[] optional name of ccddata-file used during logging (zero terminated) +ULONG optional str2ind version +Char[] optional name of str2ind-table-file used during logging (zero terminated) + +purpose: +sent from server to a sender of PCO_GET_LOGFILE_INFO +*/ + + +#define PCO_TO_FRONT MSG_ID(PCO_VIEW_GROUP,0x01) /* L3VWR_TO_FRONT */ +/* +data: + +purpose: +sent from GUI-controller to server to indicate activation of ctrl window +sent from server to all viewers to indicate activation of ctrl window +sent from server back to controller to indicate activation of viewers +*/ + +#define PCO_SYNCHRONIZE MSG_ID(PCO_VIEW_GROUP,0x05) +/* +data: +ULONG time in ms + +purpose: +sent from a viewer A to server to indicate change in the view to a new time stamp +sent from server to all viewers except A to synchronize them with A +*/ + +#define PCO_LOGFILE_COMPLETE MSG_ID(PCO_VIEW_GROUP,0x06) +/* +data: + +purpose: +sent from server to a viewers after complete forwarding of a requested logfile +*/ + +#define PCO_INIFILE_CHANGED MSG_ID(PCO_VIEW_GROUP,0x07) +/* +data: + +purpose: +sent from viewer to server and then to all other viewers after an ini-file change +which should be handled immediatly by all viewers +*/ + +#define PCO_CLEAN MSG_ID(PCO_VIEW_GROUP,0x08) +/* +data: + +purpose: +sent from viewer to server and then to all other viewers to inform them that the user +has cleaned the viewer content +*/ + +#define PCO_STOP_LOGFILE MSG_ID(PCO_SRV_GROUP,0x22) +/* +data: +Char[] queue name (zero terminated) + +purpose: +sent to the server to stop logging into the logfile connected with given queue +*/ + +#define PCO_START_LOGFILE MSG_ID(PCO_SRV_GROUP,0x23) +/* +data: +Char[] logfile name (zero terminated) +Char[] queue name (zero terminated) + +purpose: +sent to the server to start logging all data which will be received in the given queue +(the queue will be created by the server) +*/ + +#define PCO_LOAD_CCDDATA MSG_ID(PCO_SRV_GROUP,0x24) +/* +data: +Char[] name of ccddata-file to be loaded (zero terminated) + +purpose: +sent to server to command it to load the specified ccddata-DLL +*/ + + +/*==== PCO ERROR CODES ==================================================*/ + +#define PCO_ERR_NONE 0x00 + +#define PCO_ERR_TOO_MANY_VIEWERS 0x01 +#define PCO_ERR_ALREADY_CONNECTED 0x02 +#define PCO_ERR_ALREADY_SUBSCRIBED 0x03 +#define PCO_ERR_NOT_CONNECTED 0x04 +#define PCO_ERR_NOT_SUBSCRIBED 0x05 +#define PCO_ERR_FILE_OPEN_ERROR 0x06 +//0x07: log file not for this viewer +#define PCO_ERR_FILE_READ_ERROR 0x08 +#define PCO_ERR_FILE_WRITE_ERROR 0x09 + +#define PCO_ERR_TSESSION_NOT_RUNNING 0x10 +#define PCO_ERR_TSESSION_RUNNING 0x11 +#define PCO_ERR_TSFILE_OPEN 0x12 +#define PCO_ERR_TSFILE_NOT_OPEN 0x14 +#define PCO_ERR_WRONG_FILE_TYPE 0x15 +#define PCO_ERR_TSFILE_TOO_NEW 0x16 +#define PCO_ERR_TOO_MANY_LOGGERS 0x17 +#define PCO_ERR_QUEUE_OPEN_ERROR 0x18 +#define PCO_ERR_LOGGER_NOT_FOUND 0x19 + +#define PCO_ERR_TST_NOT_AVAILABLE 0x20 + +/*==== PCO SERVER TYPES ==================================================*/ + +#define PCO_STYPE_NONE 0x00 +#define PCO_STYPE_PCOS 0x23 +#define PCO_STYPE_L3SRV 0x1E + + +#endif /*_PCO_CONST_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_inifile.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,152 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : inc\pco_inifile.h ++----------------------------------------------------------------------------- +| 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 : Contains declarations of the class IniFile. (Based on +| File from Adam Clauss) ++----------------------------------------------------------------------------- +*/ + +#ifndef _PCO_INIFILE_H_ +#define _PCO_INIFILE_H_ + +/*==== INCLUDES ===================================================*/ + +#pragma warning (disable: 4786) /* ignore warning about to long template names */ + +#include <iostream> +#include <string> +#include <vector> +#include "cms.h" + +using namespace std; + +/*==== PROTOTYPES ==================================================*/ + +//all Keys are of this type +struct Key +{ + //list of values in key + vector<string> values; + + //corresponding list of value names + vector<string> names; + + //corresponding list of modified state + vector<bool> modified; +}; + +class IniFile +{ + //all private variables +private: + + //stores pathname of ini file to read/write + string path; + + //list of Keys in ini + vector<Key> keys; + + //corresponding list of Keynames + vector<string> names; + + // semaphore to protect file reading/writing + CMS_HANDLE m_file_sema; + + //all private functions +private: + //overloaded to take string + istream & getline( istream & is, string & str ); + + //returns index of specified value, in the specified Key, or -1 if not found + int FindValue(int Keynum, string valuename) const; + + //returns index of specified Key, or -1 if not found + int FindKey(string Keyname) const; + + + //public variables +public: + + //will contain error info if one occurs + //ended up not using much, just in ReadFile and GetValue + mutable string error; + + //will contain warning info if one occurs + //ended up not using much, just in ReadFile + mutable string warning; + + //public functions +public: + //default constructor + IniFile(); + + //constructor, can specify pathname here instead of using SetPath later + IniFile(string inipath); + + //default destructor + virtual ~IniFile(); + + //sets path of ini file to read and write from + void SetPath(string newpath); + + //returns path of currently selected ini file + const char* GetPath() const { return path.c_str();} + + //reads ini file specified using IniFile::SetPath() + //returns true if successful, false otherwise + //may contain warnings in warning-variable + bool ReadFile(bool refresh=false); + + //writes data stored in class to ini file + bool WriteFile(bool refresh_first=true); + + //deletes all stored ini data + void Reset(); + + //returns number of Keys currently in the ini + int GetNumKeys() const; + + //returns number of values stored for specified Key + int GetNumValues(string Keyname) const; + + //gets value of [Keyname] valuename = + //overloaded to return string, int, and double, + //returns "", or 0 if Key/value not found. Sets error member to show problem + string GetValue(string Keyname, string valuename) const; + int GetValueI(string Keyname, string valuename) const; + double GetValueF(string Keyname, string valuename) const; + + //sets value of [Keyname] valuename =. + //specify the optional paramter as false (0) if you do not want it to create + //the Key if it doesn't exist. Returns true if data entered, false otherwise + //overloaded to accept string, int, and double + bool SetValue(string Key, string valuename, string value, bool create = 1); + bool SetValueI(string Key, string valuename, int value, bool create = 1); + bool SetValueF(string Key, string valuename, double value, bool create = 1); + + bool modified(string keyname, string valuename); + bool set_modified(string keyname, string valuename, bool modified=true); + + //deletes specified value + //returns true if value existed and deleted, false otherwise + bool DeleteValue(string Keyname, string valuename); + + //deletes specified Key and all values contained within + //returns true if Key existed and deleted, false otherwise + bool DeleteKey(string Keyname); +}; + +#endif /* _PCO_INIFILE_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_pdi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,58 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : PCO_PDI ++----------------------------------------------------------------------------- +| 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 header provides functions to read and store data for +| usage with the pdi-module (Primitive Decoding Information). +| Furthermore filter functions are included. (filtering by opc, +| up/downlink and air message id) ++----------------------------------------------------------------------------- +*/ + + +#ifndef _PCO_PDI_H_ +#define _PCO_PDI_H_ + +/*==== INCLUDES ==================================================*/ +#include "ccdapi.h" +extern "C" { +#include "pdi.h" +} + +/*==== GLOABAL FUNCTION DECLARATIONS =============================*/ + +/* ++---------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_PDI | +| STATE : code ROUTINE : pco_pdi_init | ++---------------------------------------------------------------------+ + + PURPOSE : initalized pdi data for pco + + PARAMS: fname .. name of file with pdi data + + RETURNS: 0 .. sucess + -1 .. otherwise + +*/ +int pco_pdi_init(const char* fname); + +int pco_pdi_exit(); + + +T_PDI_CONTEXT* pco_pdi_context(); + + +#endif /*_PCO_PDI_H_*/ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_util.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,195 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : PCO_UTIL ++----------------------------------------------------------------------------- +| 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 Modul provides utillity functions for pco ++----------------------------------------------------------------------------- +*/ + +#ifndef _PCO_UTIL_H_ +#define _PCO_UTIL_H_ + +/*==== INCLUDES ===================================================*/ +#include <stdio.h> +#include "ipcapi.h" +#undef EXPORT +#include "typedefs.h" + +/*==== TYPES ======================================================*/ + +/*==== CONSTANTS ==================================================*/ +#define ZERO_COMPRESS_MIN 8 + +/*==== EXTERNALS ==================================================*/ + +/*==== VARIABLES ==================================================*/ + +/*==== PROTOTYPES =================================================*/ + +/* ++--------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : get_path | ++--------------------------------------------------------------------+ + + PURPOSE : Retrieves the pathname from a path/filename(path\filenames)-string. + + PARAMS: fname ... path/filename + path ... retrieved path string + slash ... 1 -> '/'s are used as separators. + 0 -> '\'s are used as separators +*/ +void get_path(const char* fname, char* path, int slash=1); + + +/* ++------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : read_string | ++------------------------------------------------------+ + + PURPOSE : Reads one line from a text file. + + PARAMS: stream ... stream to read from + buf ... buffer to read into + max_len ... maximum length of line to read into buf + + RETURNS: 0 ... no error + -1 ... buffer to small + +*/ +int read_string (FILE * stream, char * buf, int max_len); + + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : send_ipcmsg | ++-------------------------------------------------------------------------------+ + + PURPOSE : tries to send a message with ipc header to a receiver + + PARAMS: buf ... pointer to buffer + size .. size of buffer + id ... message id + sender .. queuename of sender + receiver .. queuename of receiver + + RETURNS: 0 .. sucess + -1 .. receiver not found + -2 .. error while contacting receiver + +*/ +int send_ipcmsg(void* buf, U16 size, U16 id, const char* sender, + const char* receiver); + + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : send_ipcmsg | ++-------------------------------------------------------------------------------+ + + PURPOSE : tries to send a message with ipc header to a receiver + + PARAMS: buf ... pointer to buffer + size .. size of buffer + id ... message id + sender .. queuename of sender + receiver .. queuename of receiver + rqueue ... handle of receiver queue + + RETURNS: 0 .. sucess + -1 .. error while contacting receiver + +*/ +int send_ipcmsg(void* buf, U16 size, U16 id, const char* sender, + const char* receiver, CMS_HANDLE rqueue); + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_VIEW_STD | +| STATE : code ROUTINE : create_hexdump | ++-------------------------------------------------------------------------------+ + + PURPOSE : creates hexdump string of given data + + PARAMS: data .. the data + dsize .. size of data + dump .. buffer to receive hexdump + size .. size of dump + reverse.. if !=0 the hexdump will represent the reverse data buffer + zero_compress_min .. count of zeros from which on compression will be applied + + RETURNS: 0 .. success + -1 .. dump buffer to small + +*/ +int create_hexdump(const void *data, unsigned dsize, char *dump, unsigned size, + int reverse=0, int zero_compress_min=ZERO_COMPRESS_MIN); + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : interprete_hexdump | ++-------------------------------------------------------------------------------+ + + PURPOSE : tries to interprete a given string hexdump-like + Example: 00 44 (23*00) 47 11 + + PARAMS: dump .. string containing hexdump + buffer .. buffer to receive interpreted data + bsize .. size of buffer + count .. count of bytes writen to buffer + + RETURNS: 0 .. success + -1 .. buffer to small + -2 .. invalid hexdump + +*/ +int interprete_hexdump(const char *dump, void* buffer, unsigned bsize, unsigned& count); + + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : get_time_hmsm | ++-------------------------------------------------------------------------------+ + + PURPOSE : calculates the current time in ms + (hour, minute, second and ms are taken into account) + + RETURNS: current time in milliseconds + +*/ +ULONG get_time_hmsm(); + +/* ++-------------------------------------------------------------------------------+ +| PROJECT : PCO2 MODULE : PCO_UTIL | +| STATE : code ROUTINE : get_dll_size | ++-------------------------------------------------------------------------------+ + + PURPOSE : calculates the actual count of bytes used in a given DLL-file + + PARAMS: dll_fname .. name of dll-file + + RETURNS: count of bytes used, 0 if file is no WIN32-DLL + +*/ +ULONG get_dll_size(const char* dll_fname); + + +#endif /* _PCO_UTIL_H_ */ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_view_core.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,225 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : PCO_VIEW_CORE ++----------------------------------------------------------------------------- +| 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 Modul contains the core viewer class +| with basic functions and handlers for several PCO control +| messages. +| It is intended to be specialized and extended, e.g. in +| GUI-server-applications. +| Some member functions are totally virtual without any +| standard body and have to be provided by the child class ! ++----------------------------------------------------------------------------- +*/ + +#ifndef _PCO_VIEW_CORE_H_ +#define _PCO_VIEW_CORE_H_ + +/*==== INCLUDES ===================================================*/ +#ifndef PCO_VIEW_CORE_CPP +#include "pco_view_templ.h" +#else +#include "view/pco_view_templ.h" +#endif +#include "pco_inifile.h" + +/*==== DEFINES =====================================================*/ + +/*==== PROTOTYPES ==================================================*/ + +/*==== CLASSES =====================================================*/ +class PCOView_core : public PCOView_templ +{ +public: + PCOView_core(const char* ini_file, int& err, + const char* primq_name="", const char* ctrlq_name=""); + virtual ~PCOView_core(); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_CTRL_CORE | + | STATE : code ROUTINE : PCOView_core::dispatch_message | + +-------------------------------------------------------------------------------+ + + PURPOSE : parses a PCO control message + PARAMS: buf ... the data + size .. size of buf + id ... id of the message + sender .. queue name of sender + + RETURNS: 0 .. if message has been handled + -1 .. otherwise + + */ + virtual int dispatch_message(void* buf, U16 size, U16 id, const char* sender); + + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_CTRL_CORE | + | STATE : code ROUTINE : PCOView_core::interpret_message| + +-------------------------------------------------------------------------------+ + + PURPOSE : here interpretation of received raw data takes place + (has to be implemented by derived classes !) + + PARAMS: buffer .. raw data to be interpretated + bufsize .. size of buffer + data .. actual data + size .. size of data + id .. id of data message + index .. index of data message (e.g. in logfile) ... 0 means no index!! + ttype .. type of time stamp - see PCO_TTYPE_XXX constants + time .. time stamp + sender .. name of sender + receiver.. name of original receiver + + RETURNS: 0 .. success + -1 .. interpretation was not possible + + */ + virtual int interpret_message(void* buffer, U16 bufsize, + void* &data, U16 &size, ULONG &id, ULONG& index, ULONG& ttype, U32 &time, + char* &sender, char* &receiver) {return -1;} + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::on_data | + +-------------------------------------------------------------------------------+ + + PURPOSE : here reaction to received data takes place + (has to be implemented by derived classes !) + + PARAMS: data .. the data + size .. size of data + id .. id of data message + index .. index of data message (e.g. in logfile) ... 0 means no index!! + ttype .. type of time stamp - see PCO_TTYPE_XXX constants + time .. time stamp + sender .. name of sender + receiver.. name of original receiver + + */ + virtual void on_data(void* data, U16 size, ULONG id, ULONG index, + ULONG ttype, U32 time, const char* sender, char* receiver) {} + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::on_raw_data | + +-------------------------------------------------------------------------------+ + + PURPOSE : here reaction to the raw data just as received from server takes place + (may be implemented by derived classes) + if interpretation succeeded it will be called AFTER on_data(), otherwise + only on_raw_data() is called + + PARAMS: rawdata .. the data + rawsize .. size of data + + */ + virtual void on_raw_data(void* rawdata, U16 rawsize) {} + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::on_corrupt_data | + +-------------------------------------------------------------------------------+ + + PURPOSE : this function is called if corrupt data has been received + deriving viewers may, e.g., release semaphores + + PARAMS: + */ + virtual void on_corrupt_data() {} + + /* + +----------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::propagate_inichange | + +----------------------------------------------------------------------------------+ + + PURPOSE : saves ini-file and sends an information about important ini-file changes + to the server, which will propagate it to all connected viewers + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + */ + int propagate_inichange(); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::self_trace | + +--------------------------------------------------------------------------------+ + + PURPOSE : adds a new trace string to the queue of this viewer + (has to be implemented by derived classes !) + + PARAMS: + + */ + virtual void self_trace(const char* trace)=0; + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::on_inichange | + +-------------------------------------------------------------------------------+ + + PURPOSE : reloads important changes from ini-file + + PARAMS: + + */ + virtual void on_inichange(); + + bool running() const {return m_running;} + + int dsize() const { return m_dsize;} + int qsize() const { return m_qsize;} + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_CORE | + | STATE : code ROUTINE : PCOView_core::shutdown | + +-------------------------------------------------------------------------------+ + + PURPOSE : exits the viewer threads + + PARAMS: + + */ + void shutdown(); + + virtual IniFile& inifile() { return m_inifile;} + virtual const IniFile& inifile() const { return m_inifile;} + +protected: + CMS_HANDLE m_prim_handle,m_ctrl_handle; + bool m_running; + + IniFile m_inifile; + int m_qsize, m_dsize; + + static void cms_prim_proc(long view); + static void cms_ctrl_proc(long view); +}; + +#endif /* _PCO_VIEW_CORE_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_view_framesupp.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,426 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : PCO_VIEW_FRAMESUPP ++----------------------------------------------------------------------------- +| 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 Modul contains a viewer class derived directly from the +| core. +| It supports decoding of frame SYST_MESSAGEs and of LTS-Header/ +| TIF-ASCII-DATA-messages. +| It is still intended to be specialized and extended, e.g. in +| GUI-server-applications. +| Some member functions are totally virtual without any +| standard body and have to be provided by the child class ! ++----------------------------------------------------------------------------- +*/ + +#ifndef _PCO_VIEW_FRAMESUPP_H_ +#define _PCO_VIEW_FRAMESUPP_H_ + +/*==== INCLUDES ===================================================*/ +#ifndef PCO_VIEW_FRAMESUPP_CPP_CCD +#include "pco_view_core.h" +#else +#include "view/pco_view_core.h" +#endif + +#ifdef USE_CCD +extern "C" +{ +#include "ccdtable.h" +#include "ccddata.h" +} +#include "ccdedit.h" +#include "view/pco_pdi.h" +#endif /* USE_CCD */ + +#include <time.h> + +/*==== DEFINES =====================================================*/ +#define PCO_STR2IND_NOT_LOADED 0 +#define PCO_STR2IND_AUTO_LOADED 1 +#define PCO_STR2IND_MAN_LOADED 2 +#define PCO_STR2IND_SEARCHING 3 + +/*==== PROTOTYPES ==================================================*/ + +/*==== CLASSES =====================================================*/ +class PCOView_frameSupp : public PCOView_core +{ +public: + PCOView_frameSupp(const char* ini_file, int& err, + const char* primq_name="", + const char* ctrlq_name=""); + virtual ~PCOView_frameSupp(); + + /* + +-------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::interpret_message | + +-------------------------------------------------------------------------------------+ + + PURPOSE : here interpretation of received raw data takes place + (has to be implemented by derived classes !) + + PARAMS: buffer .. raw data to be interpretated + bufsize .. size of buffer + data .. actual data + size .. size of data + id .. id of data message + index .. index of data message (e.g. in logfile) ... 0 means no index!! + ttype .. type of time stamp - see PCO_TTYPE_XXX constants + time .. time stamp + sender .. name of sender + receiver.. name of original receiver + + RETURNS: 0 .. success + -1 .. interpretation was not possible + + */ + virtual int interpret_message(void* buffer, U16 bufsize, + void* &data, U16 &size, ULONG &id, ULONG& index, ULONG& ttype, U32 &time, + char* &sender, char* &receiver); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::on_connected | + +--------------------------------------------------------------------------------+ + + PURPOSE : reaction to PCO_CONNECTED from server + + PARAMS: buf .. data containing server type + sender .. server queue name + + RETURNS: 0 .. server type supported + -1 .. server type not supported + + */ + virtual int on_connected(const void *buf,const char* sender); + + /* + +--------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::decode_tracestring | + +--------------------------------------------------------------------------------------+ + + PURPOSE : tries to decode an OPC in the tracestring (e.g. $<OPC>) + + PARAMS: instr .. original tracestring + size .. max size for outstr + + RETURNS: 0 .. success (outstr contains new tracestring) + -1 .. no success while decoding + -2 .. no decoding necessary + + lastOPC .. in case of success contains last opc found in instr + + */ + int decode_tracestring(const char* instr, char* outstr, U16 size, ULONG &lastOPC); + + /* + +-----------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_CTRL_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::check_version | + +-----------------------------------------------------------------------------------+ + + PURPOSE : tries to request the version of a running stack via the server + -> will result in a SYST-trace starting with '&' + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int check_version(); + + /* + +--------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_CTRL_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::check_communication| + +--------------------------------------------------------------------------------------+ + + PURPOSE : tries to send a system primitive to the running stack via the server + -> will result in SYST-traces if communication is ok + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int check_communication(); + + /* + +--------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::decode_ccd_msg | + +--------------------------------------------------------------------------------------+ + + PURPOSE : tries to decode a given encoded air message + + PARAMS: decinfo ... T_PDI_CCDMSG stuct (see pdi.h), + contains the coded sdu and info about, e.g., msg-type + decoded_msg ... buffer which will receive the decoded struct + + RETURNS: ccdOK, ccdWarning .. sucess + ccdError .. error while decoding + + */ + int decode_ccd_msg(const void* decinfo, UBYTE **decoded_msg); + + /* + +------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::free_ccd_msg | + +------------------------------------------------------------------------------------+ + + PURPOSE : frees a msg structure previously allocated using decode_ccd_msg + + PARAMS: decoded_msg ... buffer with decoded air message structure + + RETURNS: + + */ + void free_ccd_msg(void * decoded_msg); + + /* + +--------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::load_str2ind_table | + +--------------------------------------------------------------------------------------+ + + PURPOSE : tries to explicitely load a str2ind-table + + PARAMS: tname ... name of .tab-file + + RETURNS: 0 .. sucess + -1 .. error while loading + + */ + int load_str2ind_table(const char* tname); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::on_inichange | + +--------------------------------------------------------------------------------+ + + PURPOSE : reloads important changes from ini-file + + PARAMS: + + */ + virtual void on_inichange(); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::self_trace | + +--------------------------------------------------------------------------------+ + + PURPOSE : adds a new trace string to the queue of this viewer + + PARAMS: + + */ + virtual void self_trace(const char* trace); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::send_syscmd | + +--------------------------------------------------------------------------------+ + + PURPOSE : tries to send a FRAME system command to the server + who will forward it to a connected protocol stack + + PARAMS: receiver ... receiver of the command + cmd ... the actual command (e.g. "TRACECLASS FF") + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int send_syscmd(const char* receiver, const char* cmd); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::init_ccddata | + +--------------------------------------------------------------------------------+ + + PURPOSE : initialize ccddata from the given path + + PARAMS: ccddata_path ... path of the ccddata library + (if NULL path will be loaded from ini-file) + force ... 0..keep ccddata-lib loaded if there is one + 1..exchange evtl. existing ccddata-lib + write ... 1..write new path to ini file if force is 1 + 0..dont write new path to ini file + + RETURNS: 0 .. success + -1 .. error + + */ + int init_ccddata(const char* ccddata_path=NULL, + int force=0, int write=1); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::exit_ccddata | + +--------------------------------------------------------------------------------+ + + PURPOSE : deinitializied ccddata + + PARAMS: + + RETURNS: 0 .. success + -1 .. error + + */ + int exit_ccddata(); + + /* + +------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::collect_pdi_data | + +------------------------------------------------------------------------------------+ + + PURPOSE : run through primitive top-level elements and call pdi_getDecodeInfo to + collect all potential infos for decoding an evtl. contained aim + + PARAMS: prim_data ... data of primitive + filterinfo_data ... data that holds filter info for the primitive + handle ... open handle for parsing the primitive + + RETURNS: + + */ + void collect_pdi_data(const char* prim_data, const char* filterinfo_data, T_CCDE_HANDLE handle); + + /* + +--------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::elem_present | + +--------------------------------------------------------------------------------+ + + PURPOSE : check if element is present in specified primtive + + PARAMS: filterinfo_data ... data that holds filter info for the primitive + filterinfo_value ... buffer to receive filter info data for current element + handle ... open handle for parsing the primitive + desc ... current descriptor for parsing the primitive + + RETURNS: 1 ... present + 0 ... not present + -1 ... error while calling read_elem + + */ + int elem_present(const char* filterinfo_data, char* filterinfo_value, T_CCDE_HANDLE handle, T_CCDE_ELEM_DESCR desc); + + /* + +------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::decode_pcon_prim | + +------------------------------------------------------------------------------------+ + + PURPOSE : if necessary tries to decode the given primitive using PCON + + PARAMS: opc ... primitive opc + coded_prim ... data of original prim + decoded_prim ... buffer which will point to the decoded prim + decoded_len ... length of decoded_prim buffer (without evtl. pointed to data areas) + filterinfo_prim + ... buffer which will be evtl. filled with a filterinfo shadow prim + containing only 0x00-s or 0xff-s per element + (in default case a NULL pointer is returned) + errstr ... will be filled with an error string in case of PCON error + (if NULL, no string will be written, + otherwise a buffer with min 500 bytes has to be provided!) + + RETURNS: PCON_OK .. PCON sucessfully applied + PCON_NOT_PRES .. PCON was not necessary + PCON_XXX .. error occured during PCON operation (see constants in pcon.h) + + */ + int decode_pcon_prim(ULONG opc, void * coded_prim, void ** decoded_prim, ULONG * decoded_len, + void ** filterinfo_prim, char* errstr=NULL); + + /* + +------------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_FRAMESUPP | + | STATE : code ROUTINE : PCOView_frameSupp::free_pcon_prim | + +------------------------------------------------------------------------------------+ + + PURPOSE : frees a primitive previously allocated using decode_pcon_prim + + PARAMS: decoded_prim ... buffer with decoded prim + + RETURNS: + + */ + void free_pcon_prim(void * decoded_prim); + + int pcon() const { return m_pcon;} + int set_pcon(int pcon); + + bool ccddata_loaded(const char* ccddata_path=NULL); + const char* ccddata_path() const; + + const char* ind2str_dir() const { return m_ind2str_dir;} + void set_ind2str_dir(const char* dir); + + int ind2str_loaded() const { return m_ind2str_loaded;} + int unload_str2ind_table(); + void cancel_str2ind_search() { m_str2ind_continue_search=false;} + + long ind2str_version() const { return m_ind2str_version;} + const char* ind2str_file() const { return m_ind2str_file;} + + static long read_elem_save (T_CCDE_HANDLE * handle, + void * cstruct, + T_CCDE_ELEM_DESCR * edescr, + UBYTE * value); + + static USHORT prim_first_save (T_CCDE_HANDLE * phandle, + ULONG primcode, + char * name); + + static USHORT prim_next_save (T_CCDE_HANDLE *phandle, + UBYTE descent, + T_CCDE_ELEM_DESCR *pdescr); + +protected: + time_t m_str2ind_time; + bool m_show_str2ind_errors; + char m_ind2str_dir[MAX_PATH+1]; + int m_ind2str_loaded; + char m_ind2str_file[MAX_PATH+1]; + long m_ind2str_version; + bool m_ccddata_attached; + char m_tracestr_buf[DATA_MSG_MAX_SIZE+1]; + bool m_str2ind_continue_search; + int m_pcon; + + void (*m_ccddata_init_notify)(void); + void (*m_ccddata_exit_notify)(void); +}; + +#endif /* _PCO_VIEW_FRAMESUPP_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pco_view_templ.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,341 @@ +/* ++----------------------------------------------------------------------------- +| Project : PCO2 +| Modul : PCO_VIEW_TEMPLATE ++----------------------------------------------------------------------------- +| 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 Modul contains a template of a PCO viewer class +| with basic functions for several PCO control messages. +| It can either be used just to connect to a PCO server or +| can be specialized and extended like in PCOView_templ. ++----------------------------------------------------------------------------- +*/ + +#ifndef _PCO_VIEW_TEMPL_H_ +#define _PCO_VIEW_TEMPL_H_ + +/*==== INCLUDES ===================================================*/ +#include "pco_const.h" + +/*==== DEFINES =====================================================*/ + +/*==== PROTOTYPES ==================================================*/ + +/*==== CLASSES =====================================================*/ +class PCOView_templ +{ +public: + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::PCOView_templ | + +-------------------------------------------------------------------------------+ + + PURPOSE : initilizes viewer process + + PARAMS: primq .. name of primitive queue + ctrlq .. name of control queue + + RETURNS: + + */ + PCOView_templ(const char* primq_name="", const char* ctrlq_name=""); + virtual ~PCOView_templ(); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::connect | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to connect with server + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int connect(void); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::subscribe | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to subscribe for live data from server + + PARAMS: mobileId .. name of mobile to receive live data from (may be empty) + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int subscribe(const char* mobileId); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::send2srv | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to send a data buffer to the server + + PARAMS: buf ... pointer to buffer + size .. size of buffer + id ... message id + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int send2srv(void* buf, U16 size, U16 id); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::disconnect | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to disconnect from server + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int disconnect(void); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::unsubscribe | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to unsubscribe from livedata stream from server + + PARAMS: + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int unsubscribe(void); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::on_connected | + +-------------------------------------------------------------------------------+ + + PURPOSE : reaction to PCO_CONNECTED from server + + PARAMS: buf .. data containing server type + sender .. server queue name + + RETURNS: 0 .. server type supported + -1 .. server type not supported + + */ + virtual int on_connected(const void *buf,const char* sender); + + /* + +---------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::req_logfile_info | + +---------------------------------------------------------------------------------+ + + PURPOSE : contacts server to request info about a specified logfile + + PARAMS: fname .. name of logfile (can be full path) + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int req_logfile_info(const char* fname); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::get_logdata | + +-------------------------------------------------------------------------------+ + + PURPOSE : contacts server to request logged data + + PARAMS: begin, end .. index area requested + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int get_logdata(ULONG begin, ULONG end); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::open_logfile | + +-------------------------------------------------------------------------------+ + + PURPOSE : contacts server to request logged data from a specified logfile + + PARAMS: fname .. name of logfile (full path) + begin, end .. index area requested + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int open_logfile(const char* fname, ULONG begin=0, ULONG end=0); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::set_filter | + +-------------------------------------------------------------------------------+ + + PURPOSE : contacts server to change filter settings + + PARAMS: list .. '\0'-separated list of names of entitities + (terminated by "\0\0") + primitives/traces from entities in -list- + should not be forwarded + + prim_trace + .. parameter to disable/enable general forwarding of + primitives/traces: + 0 .. fowarding of everything (default) + 1 .. no primitives + 2 .. no traces + positiv_list + .. if true, only primitives/traces from entities in -list- + will be forwarded + + RETURNS: 0 .. sucess + -1 .. Server not found + -2 .. error while contacting Server + + */ + int set_filter(const char* list, char prim_trace=0, bool positiv_list=false); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::self_send | + +-------------------------------------------------------------------------------+ + + PURPOSE : tries to send a data buffer to the control queue of this viewer + + PARAMS: buf ... pointer to buffer + size .. size of buffer + id ... message id + + RETURNS: 0 .. sucess + -1 .. receiver not found + -2 .. error while contacting receiver + + */ + int self_send(void* buf, U16 size, U16 id); + + const char *primq_name() { return m_primq_name;} + const char *ctrlq_name() { return m_ctrlq_name;} + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::start_logfile | + +-------------------------------------------------------------------------------+ + + PURPOSE : contacts server to start logging data received in the given queue + into the given logfile + + PARAMS: logfile .. name of the logfile + (if no path is given the current server-path is used) + queue .. name of the queue the server shall receive data + (it will be created by the server) + (if no queue is given, m_ctrlq_name+"_LF" is used) + + RETURNS: 0 .. sucess + -1 .. receiver not found + -2 .. error while contacting receiver + */ + int start_logfile(const char* logfile, const char* queue=NULL); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::stop_logfile | + +-------------------------------------------------------------------------------+ + + PURPOSE : contacts server to stop logging data received in the given queue + + PARAMS: queue .. name of the queue the server received data + (if no queue is given, m_ctrlq_name+"_LF" is used) + + RETURNS: 0 .. sucess + -1 .. receiver not found + -2 .. error while contacting receiver + */ + int stop_logfile(const char* queue=NULL); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::send_raw_data | + +-------------------------------------------------------------------------------+ + + PURPOSE : sends raw data to the given queue + + PARAMS: rawdata .. the data + rawsize .. size of rawdata + queue .. name of the queue the data will be sent to + (if no queue is given, m_ctrlq_name+"_LF" is used) + + RETURNS: 0 .. sucess + -1 .. receiver not found + -2 .. error while contacting receiver + */ + int send_raw_data(const void* rawdata, U16 rawsize, const char* queue=NULL); + + /* + +-------------------------------------------------------------------------------+ + | PROJECT : PCO2 MODULE : PCO_VIEW_TEMPL | + | STATE : code ROUTINE : PCOView_templ::set_srv_name | + +-------------------------------------------------------------------------------+ + + PURPOSE : change the name of the server queue + + PARAMS: sname ... new name of server queue + + */ + void set_srv_name(const char* sname); + + U8 srv_type() const { return m_srv_type;} + +protected: + char m_primq_name[MAX_QNAME_LEN+1],m_ctrlq_name[MAX_QNAME_LEN+1]; + char m_srvq_name[MAX_QNAME_LEN+1]; + U8 m_srv_type; +}; + +#endif /* _PCO_VIEW_TEMPL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pcon.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,145 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : pcon.h ++----------------------------------------------------------------------------- +| 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 : Condat Coder Decoder For Primitives +| Global function prototypes ++----------------------------------------------------------------------------- +*/ + + +#ifndef PCON_H +#define PCON_H + +#define PCON_LITTLE 1 +#define PCON_BIG 2 + +#define PCON_OK 0 +#define PCON_INVALID_OPC 1 /* operation code of primitive not defined */ +#define PCON_INVALID_CNT 2 /* wrong number of entries of an variable long array */ +#define PCON_INVALID_OFFS 3 /* wrong sum of l_buf and o_buf of an sdu */ +#define PCON_INVALID_TYPE 4 /* wrong entry in pvar table */ +#define PCON_INVALID_INIT 5 /* wrong initialization */ +#define PCON_INVALID_UTAG 6 /* union controller too large */ +#define PCON_NO_MEM 7 /* out of memory */ +#define PCON_CCDDATA_ERROR 8 /* wrong ccddata format */ +#define PCON_INVALID_PTR 9 /* user supplied null pointer for a + mandatory element */ +#define PCON_INVALID_VALFLAG 10 /* user supplied valid flag that is neither + 1 nor 0 */ +#define PCON_INVALID_VALUE 11 /* user supplied value for basetype not + defined in specification */ +#define PCON_INVALID_PATH 12 /* component path for prim not found */ + +#define PCON_CONFIG_PRIM 23 /* primitive was for internal use of PCON, + * not to be relayed to stack + */ +#ifdef _TOOLS_ +#define PCON_DLLFUNC_ERROR 24 /* could not find a function in pcon.dll */ +#define PCON_STRING_END 25 /* command string end reached */ +#endif /* _TOOLS_ */ + +#define PCON_NOT_PRES 0xFFFF +#define PCON_NOT_INCL 0xFFFE + +#if !defined (CCDDATA_PREF) +#if defined (_TOOLS_) && defined (CCDDATA_LOAD) +#define CCDDATA_PREF(pcon_fun) cddl_##pcon_fun +#else +#define CCDDATA_PREF(pcon_fun) pcon_fun +#endif /* _TOOLS_ && CCDDATA_LOAD */ +#endif /* !CCDDATA_PREF */ + +typedef struct +{ +#ifdef _TOOLS_ + ULONG (*init_prim_coding) (T_HANDLE, UBYTE); + ULONG (*decode_prim) (ULONG, void **, void *, ULONG *, ULONG); + ULONG (*code_prim) (ULONG, void *, void **, ULONG *, ULONG, char*); + ULONG (*make_filter) (char *, void **); +#else + ULONG (*init_prim_coding) (T_HANDLE, UBYTE); + ULONG (*decode_prim) (ULONG, void **, void *, ULONG *, ULONG); + ULONG (*code_prim) (ULONG, void *, void **, ULONG *, ULONG, char*); + ULONG (*pcheck) (ULONG, void *); +#endif + int stack_offset; +} T_PCON_PROPERTIES; + +typedef struct +{ + USHORT struct_level; /* the substructure level within the structure, where + * the counting started from */ + USHORT cnt_sub_elems; /* the counter of structure subelements */ + BOOL count_subs ; /* flag whether sub elements should be counted */ +} T_SUB_ELEM_COUNT; + +#define PCON_STACK_OFFSET 3072 + + +#ifndef PCON_C +/* + * function prototypes + */ +extern ULONG CCDDATA_PREF(pcon_init_prim_coding)(T_HANDLE caller, UBYTE format); + +extern ULONG CCDDATA_PREF(pcon_decodePrim) (ULONG opc, + void ** decoded_prim, + void * coded_prim, + ULONG * length, + ULONG woff); + +extern ULONG CCDDATA_PREF(pcon_codePrim) (ULONG opc, + void * decoded_prim, + void ** coded_prim, + ULONG * length, + ULONG woff, + char* receiver); + +#ifdef _TOOLS_ +extern ULONG CCDDATA_PREF(pcon_init_ccddata)(void); +/* + * The format for the command string in pcon_make_filter is: + * [<receiver> [<opc>|<primname> [+|-<elem_pathnames>]]] + * With <elem_pathnames>: <elem_pathname>[,<elem_pathnames] + * and <elem_pathname> is the unique path of and element in a + * primitive, with the structure member names separated by '.'. + * Examples: + * "TAP ENT_FOO_IND +struct_3.elem_2,struct_1.substruct_0.elem_1" - Set filter + * if primitive ENT_FOO_IND if sent to TAP for the two elements elem_2 in + * struct_3 and elem_1 in substruct_0 in struct_1. + * "TAP 800000AF1 +struct_3.elem_2,struct_1.substruct_0.elem_1" - same for given + * opc instead of prim name. + * "TAP ENT_FOO_IND -struct_3.elem_2,struct_1.substruct_0.elem_1" - Set filter + * for all other elements than two given here + * "TAP ENT_FOO_IND" - Delete filter setting for primitive ENT_FOO_IND + * sent to TAP + * "TAP" - Delete all filter settings for any primitive sent to TAP + * "" - Delete all filter settings + */ +extern ULONG CCDDATA_PREF(pcon_make_filter)(char* string, void** prim); +extern ULONG CCDDATA_PREF(pcon_filter_decode_prim) (ULONG opc, + void** decoded_prim, + void* coded_prim, + ULONG* length, + ULONG woff, + void** shadow_prim); +#else +extern ULONG pcon_pcheck (ULONG opc, void * decoded_prim); +#endif /* _TOOLS_ */ + +#endif /* !PCON_C */ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pdi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,158 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : pdi.h ++----------------------------------------------------------------------------- +| 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 : ++----------------------------------------------------------------------------- +*/ + +#ifndef __PDI_H__ +#define __PDI_H__ + +/*==== INCLUDES =============================================================*/ +#include "typedefs.h" +#include "ccdapi.h" + +/*==== CONSTANTS =============================================================*/ +#define PD_XX 1 +#define PD_CC 3 +#define PD_MM 5 +#define PD_RR 6 +#define PD_GMM 8 +#define PD_SMS 9 +#define PD_SS 11 +#define PD_SM 10 +#define PD_TST 15 + +#define PDI_MAXDECODEINFOATTRIB 128 +#define PDI_MAXDECODEINFOPRIM 128 +#define PDI_MAXDECODEINFOENTITY 128 +#define PDI_MAXPMEMFORMTYPE 23 + +#define PDI_DECODETYPE_L3PDU 0 +#define PDI_DECODETYPE_L3PDU_N 1 +#define PDI_DECODETYPE_SAPI 2 +#define PDI_DECODETYPE_NOPD 3 +#define PDI_DECODETYPE_NOPD_NOTYPE 4 +#define PDI_DECODETYPE_NOPD_N 5 +#define PDI_DECODETYPE_NOPD_NOTYPE_N 6 +#define PDI_DECODETYPE_RR_SHORT 7 +#define PDI_DECODETYPE_MAC_H 8 +#define PDI_DECODETYPE_MAC_H_N 9 +#define PDI_DECODETYPE_MAC_H_CHECK 10 +#define PDI_DECODETYPE_MAC_H_N_CHECK 11 +#define PDI_DECODETYPE_AIM 12 +#define PDI_DECODETYPE_AIM_N 13 +#define PDI_DECODETYPE_AIM_CHECK 14 +#define PDI_DECODETYPE_AIM_N_CHECK 15 + +#define PDI_DLL_ERROR -2 + +/* returned decoding info */ +typedef struct +{ + UBYTE entity; + UBYTE dir; + unsigned char pd; + unsigned char ti; + T_MSGBUF *mbuf; + UBYTE msg_type; +} T_PDI_CCDMSG; + +typedef int (*T_pdi_prepare_ccdmsg)(T_PDI_CCDMSG* ccdmsg, ULONG values[], int len); + +typedef struct +{ + char type; + char attrib[PDI_MAXDECODEINFOATTRIB]; + char prim[PDI_MAXDECODEINFOPRIM]; + char entity[PDI_MAXDECODEINFOENTITY]; + UBYTE msg_type; + T_pdi_prepare_ccdmsg pdi_prepare_ccdmsg; + char** primmbr; +} T_PDI_DECODEINFO; + + +/* + * internal context data + */ +typedef short T_PDI_PdEntityTable[16]; +typedef struct +{ + T_PDI_PdEntityTable PdEntityTable; + T_PDI_DECODEINFO*** PrimDecodeInfo; + + T_PDI_DECODEINFO *dinfo; + USHORT sap; + USHORT opc; + UBYTE dir; + USHORT pmtx; + + unsigned char sapi; + ULONG mtypeval[PDI_MAXPMEMFORMTYPE]; + int mtypenum; + UBYTE* mi_length; +} T_PDI_CONTEXT; + +typedef struct +{ + enum {PDI_NONE, PDI_CCDMSG} decodetype; + union _pdi + { + T_PDI_CCDMSG ccdmsg; + } pdi; +} T_PDI; + + +#if !defined (CCDDATA_PREF) +#if defined (_WIN32_) && defined (CCDDATA_LOAD) +#define CCDDATA_PREF(pdi_fun) cddl_##pdi_fun +#else +#define CCDDATA_PREF(pdi_fun) pdi_fun +#endif /* _WIN32_ && CCDDATA_LOAD */ +#endif /* !CCDDATA_PREF */ + +/* + * create new default context + */ +T_PDI_CONTEXT* CCDDATA_PREF(pdi_createDefContext)(); + +/* + * create new context + */ +T_PDI_CONTEXT* CCDDATA_PREF(pdi_createContext)(const T_PDI_DECODEINFO *dinfop, unsigned int dicount); + +/* + * destroy context + */ +void CCDDATA_PREF(pdi_destroyContext)(T_PDI_CONTEXT *context); + +/* + * mark the begin of a new primitive + */ +void CCDDATA_PREF(pdi_startPrim)(T_PDI_CONTEXT *context, ULONG opc); + +/* + * returns extended decode information for a given + * ccdedit element descriptor + */ +void CCDDATA_PREF(pdi_getDecodeInfo)(T_PDI_CONTEXT *context, const char *ename, + char *evalue, int evlen, T_PDI *decinfo); + +short CCDDATA_PREF(pdi_getEntityByPD)(const T_PDI_CONTEXT *context, unsigned char pd); + +const char* CCDDATA_PREF(pdi_pd2name)(unsigned char pd); + +#endif // __PDI_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pei.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,85 @@ +/* ++------------------------------------------------------------------------------ +| File: pei.h ++------------------------------------------------------------------------------ +| 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 : Protocol Entity Interface exported definitions. ++----------------------------------------------------------------------------- +*/ + + +#ifndef __PEI_H__ +#define __PEI_H__ + +/*==== INCLUDES ============================================================*/ + +#include <stddef.h> + +/*==== CONSTANTS ===========================================================*/ + +#define PEI_OK 0 +#define PEI_ERROR (-1) + +/*==== TYPES ===============================================================*/ + +typedef int T_PEI_RETURN; +typedef char * T_PEI_CONFIG; +typedef void T_PEI_MONITOR; + +/* + * types and macros for pei-jumptable processing + */ + +#define PALLOC_TRANSITION /* to reinsert the sdu pointer in pei_primitive */ +#define NO_COPY_ROUTING /* has to be set for frame version > 2.5.0 */ + + /* + * for definitions of jumptables + */ +typedef void (*T_VOID_FUNC)(); +typedef short (*T_SHORT_FUNC)(); + +typedef struct { T_VOID_FUNC func; size_t size; size_t soff; ULONG opc; } T_FUNC; +#define MAK_FUNC_S(FUNC,OPC) { (T_VOID_FUNC)FUNC, sizeof(T_##OPC), offsetof(T_##OPC,sdu), OPC } +#define MAK_FUNC_0(FUNC,OPC) { (T_VOID_FUNC)FUNC, sizeof(T_##OPC), 0 , OPC } +#define MAK_FUNC_N(FUNC,OPC) { (T_VOID_FUNC)FUNC, 0 , 0 , 0 } + +#define TAB_SIZE(T) (sizeof T / sizeof *T) + +typedef struct +{ + SHORT (*pei_init)(T_HANDLE); + SHORT (*pei_exit)(void); + SHORT (*pei_primitive)(void*); + SHORT (*pei_timeout)(USHORT); + SHORT (*pei_signal)(ULONG,void*); + SHORT (*pei_run)(T_HANDLE,T_HANDLE); + SHORT (*pei_config)(char*); + SHORT (*pei_monitor)(void**); +} T_PEI_FUNC; + + +typedef struct +{ + char const *Name; + T_PEI_FUNC PeiTable; + ULONG StackSize; + USHORT QueueEntries; + USHORT Priority; + USHORT NumOfTimers; + U32 Flags; +} T_PEI_INFO; + + +#endif /* __PEI_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/prf_func.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,53 @@ +/* ++------------------------------------------------------------------------------ +| File: prf_func.h ++------------------------------------------------------------------------------ +| 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 : Profiler API and types. ++----------------------------------------------------------------------------- +*/ + +#ifndef __PRF_FUNC_H__ +#define __PRF_FUNC_H__ + +/*==== CONSTANTS ==================================================*/ + +#define PRF_INITIALIZED 0xAFFEDEAD + +/*==== TYPES ======================================================*/ + +typedef struct +{ + unsigned int magic_nr; + void (*log_entity_create)(void * entity,const char * name); + void (*log_entity_delete)(void * entity); + void (*log_entity_activate)(void * entity); + void (*log_function_entry)(void * function); + void (*log_function_exit)(void * function); + void (*log_point_of_interest)(const char * poi); +} T_PROFILER_FUNC; + +/*==== PROTOTYPES =================================================*/ + +void prf_init ( void ); +void prf_register ( T_PROFILER_FUNC * func ); +void prf_log_entity_create ( void * entity, const char * name ); +void prf_log_entity_delete ( void * entity ); +void prf_log_entity_activate ( void * entity ); +void prf_log_function_entry ( void * function ); +void prf_log_function_exit ( void * function ); +void prf_log_point_of_interest ( const char * poi ); + + +#endif /* __PRF_FUNC_H__ */ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/printtofile.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,40 @@ +/* ++------------------------------------------------------------------------------ +| File: printtofile.h ++------------------------------------------------------------------------------ +| 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 TST internal header ++------------------------------------------------------------------------------ +*/ + +#ifndef PRINTTOFILE_H +#define PRINTTOFILE_H + +/*==== INCLUDES =============================================================*/ + + +/*==== CONSTS ===============================================================*/ + + +/*==== TYPES =================================================================*/ + + + +/*==== EXPORTS ===============================================================*/ + +void initPrintToFile(); +int PrintToFile( const char *format, ... ); + + + +#endif /* !PRINTTOFILE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pub_L1_misc_enter.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,111 @@ +/* ++------------------------------------------------------------------------------ +| File: pub_L1_misc_enter.h ++------------------------------------------------------------------------------ +| Copyright 2004 Texas Instruments Deutschland GmbH +| All rights reserved. +| +| This file is confidential and a trade secret of Texas +| Instruments Deutschland GmbH. +| 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 Deutschland GmbH. ++------------------------------------------------------------------------------ +| Purpose: Check the SrcFileTime of the ccdgen generated header files at link time. +| +| The macros in this file help to detect version mismatch between +| header files included for build of different libraries. +| Example of a linker error: +| xx_tdc_3_constraints.obj : error LNK2001: +| unresolved external symbol +| "char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002" +| (?BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002@@3DA) +| \gpf\util\teststack\bin\test_xx_tdc\xx_tdc.dll : +| fatal error LNK1120: 1 unresolved externals +| Error executing link.exe. +| +| The first group of macros (protected by PUB_L1_MISC_ENTER) are necessary +| to build the strings of type "BadLibVersionCheck__xxx". +| +| They need in turn other macros which are set in the *.h files of +| cdginc, tdcinc or message_san.h directory. +| (e.g. PUB_L1_MISC_ENTER__M_XX_VAL_H__FILE_TYPE) +| +| The check is done only for the header files where +| ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK is switched on. +| ++------------------------------------------------------------------------------ +*/ + +#ifndef PUB_L1_MISC_ENTER +#define PUB_L1_MISC_ENTER + + +/* we need a 2 stage approach to expand A and B before concatting them */ +#define PUB_L1_MISC_ENTER_CONCATx(A,B) A##B +#define PUB_L1_MISC_ENTER_CONCAT(A,B) PUB_L1_MISC_ENTER_CONCATx(A,B) +#define PUB_L1_MISC_ENTER_CONCAT3x(A,B,C) A##B##C +#define PUB_L1_MISC_ENTER_CONCAT3(A,B,C) PUB_L1_MISC_ENTER_CONCAT3x(A,B,C) +#define PUB_L1_MISC_ENTER_CONCAT4x(A,B,C,D) A##B##C##D +#define PUB_L1_MISC_ENTER_CONCAT4(A,B,C,D) PUB_L1_MISC_ENTER_CONCAT4x(A,B,C,D) + +/* we need a 2 stage approach to expand A before stringifying it */ +#define PUB_L1_MISC_ENTER_STRINGx(A) #A +#define PUB_L1_MISC_ENTER_STRING(A) PUB_L1_MISC_ENTER_STRINGx(A) + +#define PUB_L1_MISC_ENTER_GET_PRAGMA(PRAGMA) PUB_L1_MISC_ENTER_CONCAT3(PUB_L1_MISC_ENTER_,PUB_L1_MISC_ENTER__FILENAME,__##PRAGMA) + + +#define PUB_L1_MISC_ENTER_GET_FILE_TYPE PUB_L1_MISC_ENTER_CONCAT(PUB_L1_MISC_ENTER_FILE_TYPE__,PUB_L1_MISC_ENTER_GET_PRAGMA(FILE_TYPE)) + +#define PUB_L1_MISC_ENTER_SANITY_NAME PUB_L1_MISC_ENTER_CONCAT4(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME,___,PUB_L1_MISC_ENTER_GET_PRAGMA(SRC_FILE_TIME)) + + +/* create an enumerate sequence of the known file types so we can test which one we have with a '#if A == B' line */ +#define PUB_L1_MISC_ENTER_FILE_TYPE__CDGINC 1 +#define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC 2 +#define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC_DSC 3 +#define PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC_MAIN 4 +#endif + +/* + * The check will be done only for files where + * ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK is switched on. + */ +#if (PUB_L1_MISC_ENTER_GET_FILE_TYPE == PUB_L1_MISC_ENTER_FILE_TYPE__TDCINC) +#define ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK +#endif + +#ifdef PUB_L1_MISC_ENTER_DEBUG +#pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER__FILENAME)) +#pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_SANITY_NAME)) +#pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_GET_FILE_TYPE)) +#endif + +#ifdef ENABLE__PUB_L1_MISC_ENTER__SANITY_CHECK + #ifdef PUB_L1_MISC_ENTER_DEFINE_SANITY + + char PUB_L1_MISC_ENTER_SANITY_NAME; + #else + #ifdef PUB_L1_MISC_ENTER_DEBUG + #pragma message (PUB_L1_MISC_ENTER_STRING(PUB_L1_MISC_ENTER_CONCAT(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME))) + #endif + /* This part goes into + every stack file using the ccdgen generated files (one for each used file) + + expands to e.g. + extern char BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002 + */ + extern char PUB_L1_MISC_ENTER_SANITY_NAME; + /* Originally it was this but since no one actually uses this stuff (we only have + it for the linker to check that versions match) we can save memory by only + storing the 8 lower bits. + + expands to e.g. + static char BadLibVersionCheck____P_XX_TDC_3_VAL_H = (char)(&BadLibVersionCheck____P_XX_TDC_3_VAL_H____Thu_Dec_12_17_49_56_2002); + */ + static char PUB_L1_MISC_ENTER_CONCAT(BadLibVersionCheck___,PUB_L1_MISC_ENTER__FILENAME) = (char)(&PUB_L1_MISC_ENTER_SANITY_NAME); + #endif +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/pub_L1_misc_leave.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,24 @@ +/* ++------------------------------------------------------------------------------ +| File: pub_L1_misc_leave.h ++------------------------------------------------------------------------------ +| Copyright 2004 Texas Instruments Deutschland GmbH +| All rights reserved. +| +| This file is confidential and a trade secret of Texas +| Instruments Deutschland GmbH. +| 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 Deutschland GmbH. ++------------------------------------------------------------------------------ +| Purpose: Epilog file for autogenerated files +| ++------------------------------------------------------------------------------ +*/ + + +#ifdef PUB_L1_MISC_ENTER__WARNING_OFF + #error this stuff has been removed from \gpf\inc\pub_L1_misc_enter.h +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/remu.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,117 @@ +/* ++------------------------------------------------------------------------------ +| File: rivbridge_api.h ++------------------------------------------------------------------------------ +| Copyright 2003 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 rivbridge api. ++----------------------------------------------------------------------------- +*/ + +#ifndef REMU_H +#define REMU_H + +/*==== CONSTANTS ============================================================*/ + +#define RIV_MEMORY_POOL 1 + +#define rvf_add_to_timer_list gsp_add_to_timer_list +#define rvf_change_callback_func gsp_change_callback_func +#define rvf_count_buf gsp_count_buf +#define rvf_create_legacy_task gsp_create_legacy_task +#define rvf_create_mb gsp_create_mb +#define rvf_create_task gsp_create_task +#define rvf_create_timer gsp_create_timer +#define rvf_disable gsp_disable +#define rvf_delay gsp_delay +#define rvf_delete_mb gsp_delete_mb +#define rvf_delete_mutex gsp_delete_mutex +#define rvf_dequeue gsp_dequeue +#define rvf_dump_mem gsp_dump_mem +#define rvf_dump_pool gsp_dump_pool +#define rvf_dump_tasks gsp_dump_tasks +#define rvf_enable gsp_enable +#define rvf_enqueue gsp_enqueue +#define rvf_enqueue_head gsp_enqueue_head +#define rvf_evt_wait gsp_evt_wait +#define rvf_exit_task gsp_exit_task +#define rvf_free_buf gsp_free_buf +#define rvf_free_msg gsp_free_msg +#define rvf_free_timer_msg gsp_free_timer_msg +#define rvf_get_buf gsp_get_buf +#define rvf_get_buf_size gsp_get_buf_size +#define rvf_get_context gsp_get_context +#define rvf_get_expired_entry gsp_get_expired_entry +#define rvf_get_mb_id gsp_get_mb_id +#define rvf_get_mb_param gsp_get_mb_param +#define rvf_get_mb_status gsp_get_mb_status +#define rvf_get_mb_unused_mem gsp_get_mb_unused_mem +#define rvf_get_msg_buf gsp_get_msg_buf +#define rvf_get_protected_buf gsp_get_protected_buf +#define rvf_get_taskid gsp_get_taskid +#define rvf_get_taskname gsp_get_taskname +#define rvf_get_tick_count gsp_get_tick_count +#define rvf_get_time_stamp gsp_get_time_stamp +#define rvf_init gsp_init +#define rvf_init_timer_list gsp_init_timer_list +#define rvf_init_timer_list_entry gsp_init_timer_list_entry +#define rvf_initialize_mutex gsp_initialize_mutex +//OMAPS72906 +#define rvf_initialize_static_mutex gsp_initialize_static_mutex +#define rvf_lock_mutex gsp_lock_mutex +#define rvf_mb_is_used gsp_mb_is_used +#define rvf_read_addr_mbox gsp_read_addr_mbox +#define rvf_read_mbox gsp_read_mbox +#define rvf_remove_from_queue gsp_remove_from_queue +#define rvf_remove_from_timer_list gsp_remove_from_timer_list +#define rvf_reset_timer gsp_reset_timer +#define rvf_resume_task gsp_resume_task +#define rvf_scan_next gsp_scan_next +#define rvf_send_event gsp_send_event +#define rvf_send_msg gsp_send_msg +//#define rvf_send_trace1 gsp_send_trace1 +#define rvf_set_callback_func gsp_set_callback_func +#define rvf_set_mb_param gsp_set_mb_param +#define rvf_start_timer gsp_start_timer +#define rvf_stop_timer gsp_stop_timer +#define rvf_suspend_task gsp_suspend_task +#define rvf_unlock_mutex gsp_unlock_mutex +#define rvf_update_timer_list gsp_update_timer_list +#define rvf_wait gsp_wait +#define rvf_wait_for_specific_msg gsp_wait_for_specific_msg +#define rvm_error gsp_error +/* not really a riviera frame function, but seems to be needed */ +//#define rvt_set_trace_level gsp_set_trace_level + +/*==== INCLUDES =============================================================*/ + +#include "rvf/rvf_original_api.h" +#define EXT_MEM_POOL 0x0 +#if (LOCOSTO_LITE==1) +#define INT_MEM_POOL EXT_MEM_POOL /* no distinction between internal and external pool. So make it same */ +#else +#define INT_MEM_POOL 0x1 +#endif + +/*==== TYPES ================================================================*/ + +//typedef UINT8 * T_RVT_BUFFER; + +/*==== PROTOTYPES ===========================================================*/ + +extern UINT8 gsp_trace_level; +extern UINT32 gsp_layer_mask; + +/*==== MACROS ===============================================================*/ + + +#endif /* remu_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/stddefs.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,176 @@ +/* ++------------------------------------------------------------------------------ +| File: stddefs.h ++------------------------------------------------------------------------------ +| 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 : Old frame standard definitions. ++----------------------------------------------------------------------------- +*/ + + +#ifndef __STDDEFS_H__ +#define __STDDEFS_H__ + +#ifndef OLD_FRAME + #ifndef NEW_FRAME + #define NEW_FRAME + #endif +#endif + +/*==== CONSTANTS ==================================================*/ + +#define FALSE 0 +#define TRUE 1 + +#define BIT123 0x07 +#define BIT4 0x08 +#define BIT78 0xC0 + +#if defined (USE_DLL) + #ifdef WIN32 + #define EXPORT __declspec (dllexport) + #define IMPORT __declspec (dllimport) + #endif +#else + #define EXPORT GLOBAL + #define IMPORT EXTERN +#endif + +#ifndef __cplusplus + #define EXTERN extern +#else + #define EXTERN extern "C" +#endif + +/* Horrible handling of GLOBAL and MAINFILE macros + Documented in BugTrak#DNCL-3PWCL3 */ +#ifdef L1_LIB + #ifdef L1_COM_C + #define GLOBAL + #define MAINFILE 1 + #else + #ifndef __cplusplus + #define GLOBAL extern + #else + #define GLOBAL extern "C" + #endif + #endif +#else + #define GLOBAL +#endif + +#define LOCAL static + +#define AND && +#define OR || +#define XOR(A,B) ((!(A) AND (B)) OR ((A) AND !(B))) + +#define EQ == +#define NEQ != + +#ifndef NULL +#define NULL 0 +#endif +/*==== TYPES ======================================================*/ +#ifndef WIN32 + typedef char BYTE; +#else + typedef unsigned char BYTE; +#endif + +#if !defined (NUCLEUS) +typedef char CHAR; +#endif + + + +typedef long LONG; +typedef unsigned char UBYTE; +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned long ULONG; +typedef unsigned short UINT16; +typedef unsigned long UINT32; +typedef unsigned short UNSIGNED16; + +typedef unsigned long T_VOID_STRUCT; + +#ifndef L1_LIB +typedef short SHORT; +#ifdef WIN32 + typedef int BOOL; +#else + typedef UBYTE BOOL; +#endif +#endif + +#if !defined (T_SDU_DEFINED) + +#define T_SDU_DEFINED + +typedef struct +{ + USHORT l_buf; + USHORT o_buf; + UBYTE buf[1]; +} T_sdu; + +#endif /* T_SDU_DEFINED */ + + +#if !defined (T_FRAME_DESC_DEFINED) + +#define T_FRAME_DESC_DEFINED + +typedef struct +{ + UBYTE *Adr[2]; + USHORT Len[2]; +} T_FRAME_DESC; + +#endif /* T_FRAME_DESC_DEFINED */ + + +/* + * for definitions of jumptables + */ +#ifndef NEW_ENTITY + typedef void (*T_VOID_FUNC)(); + typedef short (*T_SHORT_FUNC)(); +#endif +typedef USHORT (*T_USHORT_FUNC)(); + +/* SDU_TRAIL denotes the memory size starting at 'buf' to the end of T_sdu */ + +#define SDU_TRAIL ((char*)(((T_sdu*)0)+1)-(char*)(((T_sdu*)0)->buf)) + +/*==== EXPORT =====================================================*/ +#define MAXIMUM(A,B) (((A)>(B))?(A):(B)) + +#define MINIMUM(A,B) (((A)<(B))?(A):(B)) + +#define _STR(x) __STR(x) +#define __STR(x) #x + +#define ALERT(CONDITION,TEXT) \ + { \ + if (!(CONDITION)) \ + ext_abort (#TEXT "\n" __FILE__ ", line " _STR(__LINE__)); \ + } + + +/*==== MISC =======================================================*/ + + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tap.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,45 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : tap.h ++----------------------------------------------------------------------------- +| 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 : Headerfile containing exit codes of Tap. ++----------------------------------------------------------------------------- +*/ + +#ifndef TAP_H +#define TAP_H + +/*==== INCLUDES =============================================================*/ +/*==== CONSTS ===============================================================*/ + +#define TAP_PASSED 0 +#define TAP_CMD_LINE 1 +#define TAP_TC_NOT_FOUND 2 +#define TAP_TC_NO_INIT 3 +#define TAP_TC_VERSION 4 +#define TAP_SUI_CHECK 5 +#define TAP_FAILED 6 +#define TAP_EXCLUDED 7 +#define TAP_STACKSYNC 8 +#define TAP_TDC_SYNTAX 9 +#define TAP_TDC_INTERNAL 10 +#define TAP_CCDDATA_DLL 11 +#define TAP_STACK_ERR 12 +#define TAP_STACK_WARN 13 +#define TAP_TC_CRASH 14 +#define TAP_UNKNOWN 99 +/*==== TYPES ================================================================*/ +/*==== EXPORTS ==============================================================*/ +#endif /* !TAP_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tdc.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,39 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : TDC ++----------------------------------------------------------------------------- +| 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 : ++----------------------------------------------------------------------------- +*/ +#ifdef TDC_H +#error "TDC.H already included, TDC.H must come after all primitives and messages" +#endif + +#include <setjmp.h> + +//namespace tdc { +#include "tdc_prim.h" + +#ifndef TDC_H +#define TDC_H + +#ifndef TDC_DESCRIPTOR +static int tdc_initialized_primitive = T_PRIMITIVE_UNION::call_tdc_initialize_primitive(); +static int tdc_initialized_message = T_MESSAGE_UNION::call_tdc_initialize_message(); +#endif //TDC_DESCRIPTOR + +#endif //TDC_H +//}//namespace tdc +//using namespace tdc;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tdc_base.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,4827 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : TDC ++----------------------------------------------------------------------------- +| 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 : ++----------------------------------------------------------------------------- +*/ + +#if defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H +#pragma message("TDC_BASE.H ENTERING PRECOMPILE MODE") +/* + This code is added to make a prettier and easier to navigate .i-file + Purpose: + A) maintain info of which macro codes come from + B) maintain line breaks from inside macros + + The process include the following steps: + + 1: + Command: + perl tdc_h.pl ..\..\..\..\INC\tdc_base.h >tdc_base.tdc_h + (add TDC_BEGIN_MACRO TDC_NL TDC_MACRO_END TDC_NL macros) + + Example transformation: + Input: (tdc_base.h) +*/ + #define MULTI_LINE_MACRO(A) ... \ + ... \ + ... + #define SINGLE_LINE_MACRO(A) ... +/* + Output: (tdc_base.tdc_h) + #define MULTI_LINE_MACRO(A) TDC_BEGIN_MACRO(MULTI_LINE_MACRO(A)) ... TDC_NL\ + ... TDC_NL\ + ... TDC_MACRO_END() + #define SINGLE_LINE_MACRO(A) TDC_MACRO(SINGLE_LINE_MACRO(A)) ... + 2: + Command: + EDI preprocess .cpp-file with TDC and TDC_PRECOMPILE defined + (as a consequence tdc_base.tdc_h is used instead of tdc_base.h) + + Example transformation: + Input: (use_some_macro.cpp) + MULTI_LINE_MACRO(B) + Output: (use_some_macro.i) + TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... TDC_NL ... TDC_NL ... TDC_MACRO_END() + + 3: + Command: + perl tdc_i.pl .\tdc.i >tdc.tdc_i + (replace TDC_NL with real newline, make pretty indention + + Example transformation: + Input: (use_some_macro.i) + TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... TDC_NL ... TDC_NL ... TDC_MACRO_END + Output: (use_some_macro.tdc_i) + TDC_BEGIN_MACRO("MULTI_LINE_MACRO(B)") ... + ... + ... TDC_MACRO_END() + + */ +#define TDC_BASE_TDC_H +#include "tdc_base.tdc_h" +#endif //defined TDC_PRECOMPILE && !defined TDC_BASE_TDC_H + +#ifndef TDC_BASE_H // stadard h-file guard +#define TDC_BASE_H + +//============================================================================ +/// \defgroup Configuration +//\{ + +///memory leak detection +#define noTDC_USE_ALLOC_DEBUG_COUNTER + +#define TDC_DEBUG + +#define TDC_NO_PROFILING + +///include T_PORT +#define TDC_PORT + +#define noM_TDC_MESSAGE_DEMO + +///typeinfo not needed, everything we need is in cccdgen tables +#define noTDC_TYPEINFO + +///never defined +#define noDOT_COMPLETE + +//\} + +//============================================================================ +// include files +//============================================================================ + +//tdc_test_header_begin +//extern int dummy_to_make_namespace_non_empty; +//} //temporare leave namespace tdc +#ifndef TDC_TEST_I_CPP +#include <setjmp.h> +#include <stddef.h> +#include <typeinfo.h> +#include <malloc.h> +#include <string.h> +#endif +//namespace tdc { // reenter namespace tdc + +//============================================================================ +// controling warning levels from compilers +//============================================================================ + +#pragma warning(disable:4786) +//tdc_test_header_end + +/* + general info members are constructed etc by generic functions so these are normal ok when + arriving inside M_TDC_... : + Warning 1539: member 'T_raw::handle' (line 3242, file M:\gpf\inc\tdc_base.h, module M:\gpf\util\tap\tdc\src\tdc_lib_main.cpp) not assigned by assignment operator + Warning 1401: member 'T_raw::handle' (line 3242, file M:\gpf\inc\tdc_base.h, module M:\gpf\util\tap\tdc\src\tdc_lib_main.cpp) not initialized by constructor + */ + +/*lint -e1717*/ //Info 1717: empty prototype for function declaration, assumed '(void)' +/*lint -e1505*/ //TODO: add access specifier for all base classes +/*lint -DLINT*/ +/*lint -esym(18,BUF_*)*/ //CCDGEN generates surplus typedefs for _dsc.h-files +/*#lint -libdir(M:\gpf\util\teststack\inc\tdcinc)*/ +/*#lint -libh(M:\gpf\util\teststack\inc\tdcinc\p_xx_tdc_1.h)*/ + +/// this lint option is used inside a macro, VA can not handle comments in macros correctly +#define TDC_LINT_UNUSED_MEMBER /*lint -e{754}*/ +#define TDC_LINT_UNASSIGNED_MEMBER /*lint -e{1539}*/ +#define TDC_LINT_UNCOPIED_BASE /*lint -e{1538}*/ +#define TDC_LINT_NO_SELFASSIGN_TEST /*lint -e{1529}*/ +#define TDC_LINT_UNINITIALIZED_MEMBER /*lint -e{1401}*/ +#define TDC_LINT_POSSIBLE_UNHANDLE_POINTER_MEMBER /*lint -e{1740}*/ + +//============================================================================ +/// \defgroup Constants +//============================================================================ +//\{ + +#define FALSE 0 +#define TRUE 1 + +/// TDSConstant comming from macros.h -> used in cc.doc +#define NOT_PRESENT_8BIT 0xff + +/// TDSConstant comming from macros.h -> used in cc.doc +#define NOT_PRESENT_16BIT 0xffff + +/// TDSConstant comming from macros.h -> used in cc.doc +#define NOT_PRESENT_32BIT 0xffffffffL + +//\} + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_0 +{ + int i0; +}; + +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 +{ + int i; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_0 operator->(){} +}; + +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1A() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; +} +#else +#endif + +//============================================================================ +// partial compiling tdcinc\*.cpp +//============================================================================ + +/** VC6 can not handle more than 30000 types per compilation unit, but this + has not so much to do with this, here we are trying to minimize the overall + memory usage during compilation, this is a problem for the umts asn1 file + the big isue is that determin this number is not an excat sicense since + VC give NO hint on whic entry is coursing this problem if it ocour during + pass2 of the compilation + + to overcome this problem CCDGEN generate additional gaurds in tdcinc\*.cpp files + + enum form + + #if TDC_ENUM_PART + #ifndef TDC_SKIP_FORWARD_MENUM_prefix_enumtypename + M_TDC_POST_MENUM (prefix_enumtypename) + #endif + #endif // TDC_ENUM_PART + + other form (example is for MSG but PRIM, STRUCT, UNION etc. use the same layout) + + #if N / TDC_SIZE == TDC_PART + #ifndef TDC_SKIP_FORWARD_msgname + M_TDC_POST_MSG (msgname) + #endif + #endif // N / TDC_SIZE == TDC_PART + + where N is a sequence number running from 0 and onwards, incremented by 1 for + each struct in the file + + by defining TDC_SIZE and TDC_PART the source files can be partial compiled + the default behaviour is to compile the hole file at once + +*/ + +#ifndef TDC_PART +#define TDC_SIZE 99999L // number of structs per compilation +#define TDC_PART 0L // which struct part to compile in this session +#define TDC_ENUM_PART 1 // if enum part is to be compiled in this session +#elif TDC_PART == -1 +#define TDC_ENUM_PART 1 // if enum part is to be compiled in this session +#else +#define TDC_ENUM_PART 0 // if enum part is to be compiled in this session +#endif + +//============================================================================ +// configuration side effects +//============================================================================ + +#ifndef TDC_DESCRIPTOR + +#define NO_TDC_DESCRIPTOR + +#else //TDC_DESCRIPTOR + +#define __T_TDC_INTERFACE_MESSAGE__ +#define __T_TDC_INTERFACE_PRIMITIVE__ + +#endif //TDC_DESCRIPTOR + +//============================================================================ +/// \defgroup dot_complete helper macros +//============================================================================ +//\{ + +#if DOT_COMPLETE +#define TDC_DOT_COMPLETE_HIDE(code) \ + /* nothing */ +struct T_TDC_EMPTY {}; +#else//DOT_COMPLETE +#define TDC_DOT_COMPLETE_HIDE(code) \ + code +#endif//DOT_COMPLETE + +//\} + +//============================================================================ +// +//============================================================================ + +///tdc_test_header_begin +#ifndef M_TDC_DOC +#if DOT_COMPLETE + + void TDC_NOTHING() {} // generate code for breakpoint + size_t TDC_LENGTHOF(array) {} + void TDC_DYNAMIC_DEAD_CODE() {} // program execution is not suposed to reach this point + +#else //DOT_COMPLETE + + void tdc_nothing(); + /** generate code for breakpoint */ + #define TDC_NOTHING() \ + tdc_nothing() + + #define TDC_DYNAMIC_DEAD_CODE() tdc_dynamic_dead_code() // program execution is not suposed to reach this point + + + #define TDC_LENGTHOF(array) (size_t(sizeof array / sizeof *array)) + + #define M_TDC_STRING1(text) #text + /** expand macros before stringify */ + #define M_TDC_STRING(text) M_TDC_STRING1(text) + +#endif //DOT_COMPLETE +#endif //M_TDC_DOC + +// macro to show pragma message with file name and line number when compiling (see M_TDC_MESSAGE_DEMO below) +//#define M_TDC_MESSAGE(text) message(__FILE__ "(" M_TDC_STRING(__LINE__) ") : message: \'" text "\'") +#define M_TDC_MESSAGE(text) message(__FILE__ "(" M_TDC_STRING(__LINE__) ") : message: \'" M_TDC_STRING(text) "\'") +#ifdef M_TDC_MESSAGE_DEMO +// e.g. show how a macro is expanded +#define MY(X) MY_##X +#pragma M_TDC_MESSAGE(M_TDC_STRING(MY(Y))) +// compiler output: \gpf\inc\tdc_base.h(130) : message: 'MY_Y' +#endif + +/// \defgroup IN_CLASS values for IN_CLASS macro argument +//\{ +#define M_TDC_IN_CLASS(code) code +#define M_TDC_NOT_IN_CLASS(code) +#define M_TDC_NOT_M_TDC_IN_CLASS(code) +#define M_TDC_NOT_M_TDC_NOT_IN_CLASS(code) code +//\} + +/// \defgroup WITH_BODY values for WITH_BODY macro argument +//\{ +#define M_TDC_WITH_BODY(code) code +#define M_TDC_WITHOUT_BODY(code) ; +//\} + +/// temporary removed multiline comments in multiline macros +/// <pre>(some compilers have problems with constructions like: +/// #define MY_MACRO() /* \\ +/// my comment */ my_code +/// )</pre> +#define M_TDC_COMMENT(code) ; + + +/// \defgroup MacroTesting +/** for testing macros + * these macros is only used when tdc.dsw has the active project set to "tdc_lib - Win32 Precompile" + */ +//\{ +#define TDC_MACRO_BEGIN_(name,line) +#define TDC_MACRO_(name,line) +#define TDC_MACRO_END_() +//\} + +// /tdc_test_header_end + +#ifndef USE_TDC_TEST_I_II// during testing we see this part in the preprocessed file tdc_test_i.ii + +struct T_TDC_BASE_DOT_COMPLETE_TEST +{ + int i; //HINT +}; + +#define TDC_TBD() tdc_tbd(__FILE__, __LINE__) + +#define TDC_ASSERT(condition) tdc_assert(condition,#condition,__FILE__,__LINE__) + +#ifndef TDC_DEBUG + #define IF_TDC_DEBUG(code) +#else + #define IF_TDC_DEBUG(code) code +#endif + +#ifndef TDC_TEST_PROFILE + + #define TDC_PURE_BODY(code)\ + = 0; + +#else + + #define TDC_PURE_BODY(code)\ + {\ + tdc_pure_body();\ + code\ + }\ + +#endif + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1C() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; +} +#else +#endif + +void tdc_cursor_trace (char* file, int line, char* format, ...); +void tdc_trace (char* format, ...); +void __declspec(noreturn) tdc_trace_fail (char* format, ...); /*lint -sem(tdc_trace_fail,r_no)*/ +extern "C" void tdc_usi_trace (char* format, ...); +void __declspec(noreturn) tdc_internal_error (char* format, ...); /*lint -sem(tdc_internal_error,r_no)*/ +void __declspec(noreturn) tdc_user_error (char* format, ...); /*lint -sem(tdc_user_error,r_no)*/ +void tdc_check_array_assignment(const void* that, const void* address); + +// some error reporting functions, which have no argument becourse they have to be called from a lot of places +void __declspec(noreturn) tdc_tbd(char* file, int line); /*lint -sem(tdc_tbd,r_no)*/// this facility is yet to be defined i.e. implemented +void __declspec(noreturn) tdc_tbd(char* message); /*lint -sem(tdc_tbd,r_no)*/// this facility is yet to be defined i.e. implemented + +void __declspec(noreturn) tdc_tbd_pointer_assignment_error(); +void __declspec(noreturn) tdc_tbd_array_assignment_error(); +void __declspec(noreturn) tdc_tbd_array_assignment_error_T_ARRAY(); +void __declspec(noreturn) tdc_tbd_xxx_constructor_call(char* message); +void __declspec(noreturn) tdc_tbd_constructor_call(char* message); +void __declspec(noreturn) tdc_tbd_primitive_union_constructor_call(); +void __declspec(noreturn) tdc_tbd_message_union_constructor_call(); + +void tdc_pure_body(); +void tdc_dynamic_dead_code(); // program execution is not suposed to reach this point +void tdc_missing_h_file(); // use of AIM/SAP not included +void tdc_assert(int condition, char* message, char* file, int line); + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1D() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; +} +#else +#endif + +//---------------------------------------------------------------------------- + +//tdc_test_header_begin + +//---------------------------------------------------------------------------- +// +//---------------------------------------------------------------------------- +#ifdef M_TDC_DOC +/* + The definitions in this sections is only present to be able to generate call graphs to be used + in documentation (call graphs are generated with SourceInsight 3.5) +*/ +/// \defgroup NamingScheme Naming convention template tree +//\{ +/// \callgraph +#define BASE() MAIN() PART() +#define MAIN() all_unions() PRIM_and_MSG() XXX() +#define all_unions() PRMITIVE_UNION() MESSAGE_UNION() +#define XXX() XXX_PRMITIVE_UNION() XXX_MESSAGE_UNION() +#define PRIM_and_MSG() PRIM() MSG() +#define PART() COMP() VAR() +#define COMP() STRUCT() UNION() +#define VAR() INT() ENUM() +#define ENUM() PENUM() MENM() +#define PRMITIVE_UNION() +#define MESSAGE_UNION() +#define XXX_PRMITIVE_UNION() +#define XXX_MESSAGE_UNION() +#define PRIM() +#define MSG() +#define STRUCT() PSTRUCT() MSTRUCT() +#define UNION() PUNION() PUNION() +#define PSTRUCT() +#define MSTRUCT() +#define PUNION() +#define PUNION() +#define PENUM() +#define MENM() +#define INT() +//\} +// base entries +/* +#define M_TDC_BASE\ + M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\ + M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE_, T_INSTANCE, T_HANDLE_)\ + M_TDC_INTERFACE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE_, T_HANDLE)\ + M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + M_TDC_FORWARD_BASE(SHORT_NAME, T_HANDLE)\ + //*/ +//TDC keywords +void TDC_keywords() +{ + FAIL(); + PASS(); + SEND(primitive); + AWAIT(primitive); + START_TIMEOUT(timeout); + WAIT_TIMEOUT(); + MUTE(timeout); + COMMAND(command); + TIMEOUT(timeout); + PARKING(enable); + ALT() //dummy "()"to force call graph + { + ON(await); + OTHERWISE(); + } + TRAP() //dummy "()"to force call graph + { + } + ONFAIL() //dummy "()"to force call graph + { + } +} +#endif +//---------------------------------------------------------------------------- + +#if DOT_COMPLETE_DEFINES + +#define CCC(COMMENT) + +//---------------------------------------------------------------------------- +// macros to generate dummy functions body +//---------------------------------------------------------------------------- + +#define M_TDC_TYPE_NAME\ + //for(;;); /* no error for missing return */ + +#define T_TDC_TYPE_NAME + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- + +#define M_TDC_FORWARD_PRIM(SAP,SHORT_NAME) +#define M_TDC_FORWARD_PSTRUCT(SHORT_NAME) +#define M_TDC_FORWARD_PUNION(SHORT_NAME) +#define M_TDC_FORWARD_SDU(SHORT_NAME) +#define M_TDC_FORWARD_PENUM(SHORT_NAME) +//----- +#define M_TDC_FORWARD_MSG(SHORT_NAME) +#define M_TDC_FORWARD_MSTRUCT(SHORT_NAME) +#define M_TDC_FORWARD_MUNION(SHORT_NAME) +#define M_TDC_FORWARD_MENUM(SHORT_NAME) +//----- +#define M_TDC_FORWARD_INT(SHORT_NAME) +#define M_TDC_FORWARD_XXX_PRIMITIVE_UNION(SAP) +#define M_TDC_FORWARD_XXX_MESSAGE_UNION(MSG) +#define M_TDC_FORWARD_PRIMITIVE() +#define M_TDC_FORWARD_MESSAGE() + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- + +#define M_TDC_DESCRIPTOR_PRIM_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_PUNION_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_SDU_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_PENUM_ADDITIONAL(SHORT_NAME) +//----- +#define M_TDC_DESCRIPTOR_MSG_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_MUNION_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_MENUM_ADDITIONAL(SHORT_NAME) +//----- +#define M_TDC_DESCRIPTOR_INT_ADDITIONAL(SHORT_NAME) +#define M_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP) +#define M_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_ADDITIONAL(MSG) +#define M_TDC_CREATE_DEFAULT_PRIMITIVE_DESCRIPTOR_CLASS(SAP) +#define M_TDC_DESCRIPTOR_PRIMITIVE_ADDITIONAL() +#define M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG) +#define M_TDC_DESCRIPTOR_MESSAGE_ADDITIONAL() + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many interface classes +//---------------------------------------------------------------------------- + +#ifndef TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST +#define TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST +struct T_TDC_INTERFACE_DOT_COMPLETE_TEST +{ + typedef char T_HANDLE; +}; +#endif //TDC_T_TDC_INTERFACE_DOT_COMPLETE_TEST + +//----- +#define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_SDU_ADDITIONAL(SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +//----- +#define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +//----- +#define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP) /*nothing*/ +#define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG) /*nothing*/ +#define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP) /*nothing*/ +#define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL() /*nothing*/ +#define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG) /*nothing*/ +#define M_TDC_INTERFACE_MESSAGE_ADDITIONAL() /*nothing*/ + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many instance classes +//---------------------------------------------------------------------------- + +#define M_TDC_INSTANCE_PRIM_ADDITIONAL(SAP,SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_SDU_ADDITIONAL(SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +//----- +#define M_TDC_INSTANCE_MSG_ADDITIONAL(MSG,SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME) /*nothing*/ +//----- +#define M_TDC_INSTANCE_INT_ADDITIONAL(SHORT_NAME) /*nothing*/ +#define M_TDC_INSTANCE_XXX_PRIMITIVE_ADDITIONAL(SAP) /*nothing*/ +#define M_TDC_INSTANCE_XXX_MESSAGE_ADDITIONAL(MSG) /*nothing*/ +#define M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL() /*nothing*/ +#define M_TDC_INSTANCE_MESSAGE_ADDITIONAL() /*nothing*/ + +#else +#endif + +//tdc_test_header_end + +#if DOT_COMPLETE_DEFINES +#else //DOT_COMPLETE_DEFINES + +#ifndef TDC_KEEP_CCC +#define CCC(COMMENT) +#endif //TDC_KEEP_CCC + +//---------------------------------------------------------------------------- +// macros to control namespace +//---------------------------------------------------------------------------- + +#define M_TDC_ENTER() //TODO namespace TDC { +#define M_TDC_LEAVE() //TODO } + +//---------------------------------------------------------------------------- +// macros to generate dummy functions body +//---------------------------------------------------------------------------- + +#define M_TDC_TYPE_NAME\ + return T_TDC_TYPE_NAME(); + +//#define T_TDC_TYPE_NAME M_TDC_HIDE(T_TDC_TYPE_NAME) + +//---------------------------------------------------------------------------- +// macros to hide templates from dot-completion +//---------------------------------------------------------------------------- + +typedef char T_TDC_LEVEL; +extern T_TDC_LEVEL tdc_level; + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- + +#ifndef TDC_DESCRIPTOR + + +#define M_TDC_FORWARD_BASE(SHORT_NAME,T_HANDLE)\ + struct T_TDC_INTERFACE_##SHORT_NAME;\ + T_TDC_INTERFACE_BASE* new_T_TDC_INTERFACE_##SHORT_NAME();\ + struct T_HANDLE;\ + T_TDC_HANDLE_BASE* new_##T_HANDLE();\ + +#define M_TDC_FORWARD_COMP(SHORT_NAME,TDC_IS)\ + M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ + +#define M_TDC_FORWARD_VAR(SHORT_NAME)\ + M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ + + +#define M_TDC_POST_BASE(SHORT_NAME,T_HANDLE)\ + M_TDC_INTERFACE_ADDITIONAL_BASE (M_TDC_NOT_IN_CLASS, M_TDC_WITH_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_HANDLE)\ + M_TDC_INSTANCE_ADDITIONAL_BASE (M_TDC_NOT_IN_CLASS, M_TDC_WITH_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_HANDLE)\ + +#define M_TDC_POST_XXX(SHORT_NAME,TDC_IS)\ + M_TDC_POST_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ + +#define M_TDC_POST_COMP(SHORT_NAME,TDC_IS)\ + M_TDC_POST_BASE(SHORT_NAME, T_TDC_HANDLE_##SHORT_NAME)\ + +#define M_TDC_POST_VAR(SHORT_NAME)\ + M_TDC_POST_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ + + +#else //TDC_DESCRIPTOR + + +#define M_TDC_FORWARD_BASE(SHORT_NAME,T_HANDLE)\ + +#define M_TDC_FORWARD_COMP(SHORT_NAME,TDC_IS)\ + M_TDC_FORWARD_DESCRIPTOR_COMP(SHORT_NAME,TDC_IS)\ + +// TODO:eliminate forwards: T_##SHORT_NAME and T_TDC_INTERFACE_##SHORT_NAME +#define M_TDC_FORWARD_VAR(SHORT_NAME)\ + M_TDC_FORWARD_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ + struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ + struct T_##SHORT_NAME;\ + struct T_TDC_INTERFACE_##SHORT_NAME;\ + typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_TDC_HANDLE_##SHORT_NAME;\ + T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME();\ + +#define M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_HANDLE)\ + T_TDC_HANDLE_BASE* new_##T_HANDLE()\ + {\ + return new T_HANDLE;\ + }\ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 +{ + int i6; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; + +inline void dot_complete_test(){ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; + tdc_debug_dot_complete__tdc_h. i6; + tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +#define M_TDC_POST_XXX(SHORT_NAME,TDC_IS)\ + M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ + T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ()\ + {\ + return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ + }\ + +#define M_TDC_POST_COMP(SHORT_NAME, TDC_IS)\ + M_TDC_POST_DESCRIPTOR_COMP(SHORT_NAME, TDC_IS)\ + +#define M_TDC_POST_VAR(SHORT_NAME)\ + M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ + + +#endif //TDC_DESCRIPTOR + + +#define M_TDC_FORWARD_DESCRIPTOR_COMP(SHORT_NAME,TDC_IS)\ + M_TDC_HANDLE(M_TDC_IN_CLASS,M_TDC_WITHOUT_BODY,SHORT_NAME,TDC_IS)\ + +#define M_TDC_POST_DESCRIPTOR_COMP(SHORT_NAME, TDC_IS)\ + M_TDC_POST_DESCRIPTOR_BASE(SHORT_NAME,T_TDC_HANDLE_##SHORT_NAME)\ + T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_##SHORT_NAME::implement_new_descriptor () const\ + {\ + return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ + }\ + M_TDC_HANDLE_ADDITIONAL(M_TDC_NOT_IN_CLASS,M_TDC_WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ + + +/*lint -emacro(1706,M_TDC_HANDLE_ADDITIONAL)*/ //we don't want M_TDC_NOT(IN_CLASS(...)) for all the scope operators +#define M_TDC_HANDLE_ADDITIONAL(IN_CLASS,WITH_BODY,T_HANDLE_,SHORT_NAME,TDC_IS)\ + IN_CLASS(virtual) char* T_HANDLE_::get_name () const\ + WITH_BODY({\ + return #SHORT_NAME;\ + })\ + IN_CLASS(virtual) long T_HANDLE_::get_sizeof ()\ + WITH_BODY({\ + return sizeof *this;\ + })\ + IN_CLASS(virtual) T_TDC_IS_ENUM T_HANDLE_::is ()\ + WITH_BODY({\ + return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS);\ + })\ + IN_CLASS(static) T_TDC_HANDLE_BASE* T_HANDLE_::implement_new_handle ()\ + WITH_BODY({\ + return new T_HANDLE_();\ + })\ + +#define M_TDC_HANDLE(IN_CLASS,WITH_BODY,SHORT_NAME,TDC_IS)\ + struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ + struct T_TDC_HANDLE_##SHORT_NAME:T_TDC_HANDLE_BASE\ + {\ + typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_DESCRIPTOR;\ + M_TDC_HANDLE_ADDITIONAL(IN_CLASS,WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ + M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_TDC_DESCRIPTOR_##SHORT_NAME)\ + protected:\ + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const;\ + };\ + +#if TDC_DEBUG_DOT_COMPLETE +inline void dot_complete_test(){ +T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; +tdc_debug_dot_complete__tdc_h. i6; +tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +//------ + +#define M_TDC_FORWARD_PRIM(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_PRIM) + +#define M_TDC_FORWARD_PSTRUCT(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_STRUCT) + +#define M_TDC_FORWARD_PUNION(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_UNION) + +#define M_TDC_FORWARD_SDU(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_SDU) + +#define M_TDC_FORWARD_TYPEDEF_SDU(BUF)\ + typedef T_TDC_HANDLE_SDU T_TDC_HANDLE_##BUF;\ + typedef T_TDC_DESCRIPTOR_SDU T_TDC_DESCRIPTOR_##BUF;\ + +/**TODO: eliminate this macro*/ +#define M_FORWARD_TYPEDEF_SDU(BUF)\ + M_TDC_FORWARD_TYPEDEF_SDU(BUF)\ + +#define M_TDC_FORWARD_TYPEDEF(BASE,SHORT_NAME)\ + typedef T_TDC_HANDLE_##BASE T_TDC_HANDLE_##SHORT_NAME;\ + typedef T_TDC_DESCRIPTOR_##BASE T_TDC_DESCRIPTOR_##SHORT_NAME;\ + +#define M_TDC_FORWARD_PENUM(SHORT_NAME)\ + M_TDC_FORWARD_VAR (SHORT_NAME) + +#if TDC_DEBUG_DOT_COMPLETE +inline void dot_complete_test(){ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; + tdc_debug_dot_complete__tdc_h. i6; + tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +//------ + +#define M_TDC_FORWARD_MSG(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_MSG) + +#define M_TDC_FORWARD_MSTRUCT(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_STRUCT) + +#define M_TDC_FORWARD_MUNION(SHORT_NAME)\ + M_TDC_FORWARD_COMP (SHORT_NAME,TDC_IS_UNION) + +#define M_TDC_FORWARD_MENUM(SHORT_NAME)\ + M_TDC_FORWARD_VAR (SHORT_NAME) + +//------ + +#define M_TDC_FORWARD_INT(SHORT_NAME)\ + M_TDC_FORWARD_BASE(SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME)\ + struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ + typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_TDC_HANDLE_##SHORT_NAME;\ + typedef T_TDC_INT_##SHORT_NAME SHORT_NAME;\ + T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME();\ + +#if TDC_DEBUG_DOT_COMPLETE +inline void dot_complete_test(){ +T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; +tdc_debug_dot_complete__tdc_h. i6; +tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +#define M_TDC_FORWARD_XXX_PRIMITIVE_UNION(SAP)\ + M_TDC_FORWARD_BASE (SAP, T_TDC_HANDLE_##SAP)\ + +#define M_TDC_FORWARD_XXX_MESSAGE_UNION(MSG)\ + M_TDC_FORWARD_BASE (MSG,T_TDC_HANDLE_##MSG)\ + +#if TDC_DEBUG_DOT_COMPLETE +inline void dot_complete_test(){ +T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; +tdc_debug_dot_complete__tdc_h. i6; +tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- + +#define M_TDC_POST_PRIM(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_PRIM) + +#define M_TDC_POST_PSTRUCT(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_STRUCT) + +#define M_TDC_POST_PUNION(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_UNION) + +#define M_TDC_POST_SDU(SHORT_NAME) + +#define M_TDC_POST_PENUM(SHORT_NAME)\ + M_TDC_POST_VAR (SHORT_NAME) + +#define M_TDC_POST_MSG(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_MSG) + +#define M_TDC_POST_MSTRUCT(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_STRUCT) + +#define M_TDC_POST_MUNION(SHORT_NAME)\ + M_TDC_POST_COMP (SHORT_NAME, TDC_IS_UNION) + +#define M_TDC_POST_MENUM(SHORT_NAME)\ + M_TDC_POST_VAR (SHORT_NAME) + +#define M_TDC_POST_INT(SHORT_NAME) + +#define M_TDC_POST_XXX_PRIMITIVE_UNION(SAP)\ + M_TDC_POST_XXX(SAP,TDC_IS_XXX_PRIMITIE_UNION) + +#define M_TDC_POST_XXX_MESSAGE_UNION(MSG)\ + M_TDC_POST_XXX(MSG,TDC_IS_XXX_MESSAGE_UNION) + +#define M_TDC_POST_PRIMITIVE() + +#define M_TDC_POST_MESSAGE() + +#if TDC_DEBUG_DOT_COMPLETE +inline void dot_complete_test(){ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_6 tdc_debug_dot_complete__tdc_h; + tdc_debug_dot_complete__tdc_h. i6; + tdc_debug_dot_complete__tdc_h-> i; +} + +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_5 +{ + int i5; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; + +inline void dot_complete_test(){ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_5 tdc_debug_dot_complete__tdc_h; + tdc_debug_dot_complete__tdc_h. i4; + tdc_debug_dot_complete__tdc_h-> i; +} +#else +#endif + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F +{ + int i1F; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1F s1F; + s1F-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/// \defgroup M_TDC_DESCRIPTOR M_TDC_DESCRIPTOR +/// macros to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- +//\{ + +/** declare action and description elements that are accessed through typecast to stencil */ +#define M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART(T_DESCRIPTOR)\ + T_TDC_ACTION_ENUM action TDC_LINT_UNUSED_MEMBER;\ + T_DESCRIPTOR* descriptor TDC_LINT_UNUSED_MEMBER;\ + +#define M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + private:\ + virtual long get_sizeof ()\ + {\ + return sizeof *this;\ + }\ + +#define M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + public:\ + int ctrl;\ + virtual int read_ctrl () const\ + {\ + return ctrl;\ + }\ + T_TDC_HANDLE_BASE* get_element (unsigned index)\ + {\ + return implement_get_union_element (index, ctrl);\ + }\ + virtual char* get_name () const\ + {\ + return #SHORT_NAME;\ + }\ + T_TDC_DESCRIPTOR_##SHORT_NAME ():\ + ctrl (0)\ + {\ + }\ + + +#define M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + public:\ + typedef T_TDC_HANDLE_##SHORT_NAME T_HANDLE;\ + virtual char* get_name () const\ + {\ + extern char* TDC_NAME_##SHORT_NAME;\ + return TDC_NAME_##SHORT_NAME;\ + }\ + friend T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ()\ + {\ + return new T_TDC_DESCRIPTOR_##SHORT_NAME;\ + }\ + T_TDC_DESCRIPTOR_##SHORT_NAME ()\ + {\ + }\ + +#define M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE(SHORT_NAME,TABLE_KIND)\ + M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + public:\ + typedef T_TDC_HANDLE_##SHORT_NAME T_HANDLE;\ + int ctrl;\ + virtual int read_ctrl () const\ + {\ + return ctrl;\ + }\ + T_TDC_HANDLE_BASE* get_element (unsigned index)\ + {\ + return implement_get_union_element (index, ctrl);\ + }\ + virtual char* get_name () const\ + {\ + extern char* TDC_NAME_##SHORT_NAME;\ + return TDC_NAME_##SHORT_NAME;\ + }\ + T_TDC_DESCRIPTOR_##SHORT_NAME ():\ + ctrl (0)\ + {\ + }\ + +/** + * \todo move get_tap_handle() to var base class + */ +#define M_TDC_DESCRIPTOR_ADDITIONAL_VAR(T_DESCRIPTOR, T_VAR, SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_BASE(SHORT_NAME)\ + public:\ + typedef T_DESCRIPTOR T_HANDLE;\ + T_TDC_ACTION_ENUM action;\ + union \ + {\ + T_VAR value;\ + T_TDC_BASIC_TYPES value_as_basic_types;\ + };\ + virtual char* get_name () const\ + {\ + extern char* TDC_NAME_##SHORT_NAME;\ + return TDC_NAME_##SHORT_NAME;\ + }\ + T_DESCRIPTOR ():\ + action (TDC_ACTION_DEFAULT)\ + {\ + }\ + virtual unsigned get_sizeof_target ()\ + {\ + return sizeof T_VAR;\ + }\ + static T_TDC_HANDLE_BASE* implement_new_handle ()\ + {\ + return new_##T_DESCRIPTOR();\ + }\ + +//----- + +#define M_TDC_DESCRIPTOR_INT_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_INT_##SHORT_NAME,SHORT_NAME)\ + virtual T_TDC_IS_ENUM is ()\ + {\ + return TDC_IS_VAR;\ + }\ + +//----- + +#define M_TDC_DESCRIPTOR_PRIM_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ + virtual int get_id () const\ + {\ + return SHORT_NAME;\ + }\ + +#define M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ + +#define M_TDC_DESCRIPTOR_PUNION_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_PRIM)\ + +#define M_TDC_DESCRIPTOR_SDU_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_PRIM)\ + +#define M_TDC_DESCRIPTOR_PENUM_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_ENUM_##SHORT_NAME,SHORT_NAME)\ + friend T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ + +//----- + +#define M_TDC_DESCRIPTOR_MSG_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ + virtual int get_id () const\ + {\ + return SHORT_NAME;\ + }\ + +#define M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_STRUCT_BASE (SHORT_NAME)\ + +#define M_TDC_DESCRIPTOR_MUNION_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_UNION_BASE (SHORT_NAME,TDC_TABLE_KIND_MSG)\ + +#define M_TDC_DESCRIPTOR_MENUM_ADDITIONAL(SHORT_NAME)\ + M_TDC_DESCRIPTOR_ADDITIONAL_VAR (T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_ENUM_##SHORT_NAME,SHORT_NAME)\ + friend T_TDC_HANDLE_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ + +//----- + +#define M_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP)\ + M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (SAP)\ + +#define M_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_ADDITIONAL(MSG)\ + M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (MSG)\ + virtual int get_id () const\ + {\ + return CCDENT_##MSG;\ + }\ + +#ifdef TDC_LIB_MAIN_DSC +#define IF_TDC_LIB_MAIN_DSC(code) code +#else +#define IF_TDC_LIB_MAIN_DSC(code) +#endif + +#define M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SHORT_NAME, TDC_IS)\ + struct T_TDC_DESCRIPTOR_##SHORT_NAME;\ + struct T_TDC_HANDLE_##SHORT_NAME:T_TDC_HANDLE_BASE\ + {\ + typedef T_TDC_DESCRIPTOR_##SHORT_NAME T_DESCRIPTOR;\ + M_TDC_HANDLE_ADDITIONAL(M_TDC_IN_CLASS,M_TDC_WITH_BODY,T_TDC_HANDLE_##SHORT_NAME,SHORT_NAME,TDC_IS)\ + M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_TDC_DESCRIPTOR_##SHORT_NAME)\ + protected:\ + static T_TDC_NEW_DESCRIPTOR new_descriptor;\ + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const\ + {\ + return call_implement_new_descriptor(new_descriptor);\ + }\ + friend char set_new_descriptor_T_TDC_HANDLE_##SHORT_NAME()\ + {\ + extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SHORT_NAME ();\ + new_descriptor = new_T_TDC_DESCRIPTOR_##SHORT_NAME;\ + return 1;\ + }\ + };\ + T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_##SHORT_NAME();\ + M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE_1(SHORT_NAME,SHORT_NAME)\ + IF_TDC_LIB_MAIN_DSC(T_TDC_NEW_DESCRIPTOR T_TDC_HANDLE_##SHORT_NAME::new_descriptor;)\ + +#define M_TDC_CREATE_DEFAULT_PRIMITIVE_DESCRIPTOR_CLASS(SAP)\ + M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SAP##_PRIMITIVE_UNION,TDC_IS_XXX_PRIMITIVE_UNION)\ + +#define M_TDC_CREATE_DEFAULT__T_TDC_HANDLE_XXX_PRIMITIVE_UNION(SAP,CCDSAP)\ + M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(SAP##_PRIMITIVE_UNION,TDC_IS_XXX_PRIMITIVE_UNION)\ + +#define M_TDC_DESCRIPTOR_PRIMITIVE_ADDITIONAL()\ + M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (PRIMITIVE_UNION)\ + +#define M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG)\ + M_TDC_CREATE_DEFAULT_DESCRIPTOR_CLASS(MSG##_MESSAGE_UNION,TDC_IS_XXX_MESSAGE_UNION)\ + enum { CCDENT_##MSG##_MESSAGE_UNION = CCDENT_##MSG };\ + +#define M_TDC_CREATE_DEFAULT__T_TDC_HANDLE_XXX_MESSAGE_UNION(MSG,CCDENT)\ + M_TDC_CREATE_DEFAULT_MESSAGE_DESCRIPTOR_CLASS(MSG) + +#define M_TDC_DESCRIPTOR_MESSAGE_ADDITIONAL()\ + M_TDC_DESCRIPTOR_ADDITIONAL_MAIN_BASE (MESSAGE_UNION)\ + +//\} +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H +{ + int i1H; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1H s1H; + s1H-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/// \defgroup M_TDC_INTERFACE +// macros to repeat stuff that is similar in many inteface classes +//---------------------------------------------------------------------------- +//\{ + +/** + * should these functions return T_RETURN / *this instead? + */ +#define M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_SCOPE,T_RETURN,T_ARG)\ + void T_SCOPE::operator = (T_ARG (*f) ())\ + WITH_BODY({\ + T_ARG value_ = f ();\ + set_value (value_);\ + TDC_LINT_UNASSIGNED_MEMBER\ + })\ + void T_SCOPE::operator = (void (*f) (T_ARG))\ + WITH_BODY({\ + T_ARG value_;\ + f (value_);\ + set_value (value_);\ + TDC_LINT_UNASSIGNED_MEMBER\ + })\ + +#define M_TDC_INTERFACE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE_, T_HANDLE)\ + IN_CLASS(typedef T_INSTANCE_ T_INSTANCE;)\ + IN_CLASS(friend struct T_INSTANCE_;)\ + IN_CLASS(private:)\ + void T_INTERFACE::set_value (const T_INSTANCE_& value_)\ + WITH_BODY({\ + copy_instance ((const T_TDC_INSTANCE_BASE*)&value_);\ + })\ + IN_CLASS(explicit) T_INTERFACE::T_INTERFACE (const T_INTERFACE& value_)\ + WITH_BODY({\ + copy_interface (&value_);\ + TDC_LINT_UNCOPIED_BASE\ + })\ + IN_CLASS(public:)\ + void T_INTERFACE::operator = (const T_TDC_ACTION& action_)\ + WITH_BODY({\ + set_action (action_);\ + TDC_LINT_UNASSIGNED_MEMBER\ + })\ + void T_INTERFACE::operator = (const T_INTERFACE& value_)\ + WITH_BODY({\ + copy_interface (&value_);\ + TDC_LINT_NO_SELFASSIGN_TEST\ + TDC_LINT_UNASSIGNED_MEMBER\ + })\ + T_INSTANCE_ T_INTERFACE::operator = (const T_INSTANCE_& value_)\ + WITH_BODY({\ + copy_instance (&value_);\ + return value_;\ + TDC_LINT_UNASSIGNED_MEMBER\ + })\ + IN_CLASS(static) T_TDC_HANDLE_BASE* T_INTERFACE::implement_new_handle ()\ + WITH_BODY({\ + return new_##T_HANDLE();\ + })\ + IN_CLASS(friend) T_TDC_INTERFACE_BASE* new_##T_INTERFACE()\ + WITH_BODY({\ + return new T_INTERFACE;\ + })\ + M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_INTERFACE,T_INSTANCE,T_INSTANCE)\ + +#define M_TDC_INTERFACE_ADDITIONAL_MAIN(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, BASE)\ + public:\ + void operator = (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ + {\ + set_main_value (&value_);\ + }\ + void operator = (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ + {\ + set_main_value (&value_);\ + }\ + T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ + {\ + tdc_level--;\ + }\ + M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_ADDITIONAL_COMP(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ + public:\ + T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ + {\ + tdc_level--;\ + }\ + M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_ADDITIONAL_VAR(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ + public:\ + T_TDC_INTERFACE_##PREFIXED_SHORT_NAME ()\ + {\ + }\ + M_TDC_INTERFACE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME)\ + public:\ + void operator = (int value_)\ + {\ + set_descriptor_value (value_);\ + }\ + M_TDC_INTERFACE_ADDITIONAL_VAR (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME, SHORT_NAME)\ + +#define M_TDC_INTERFACE_ADDITIONAL_ENUM(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ + public:\ + void set_value (int value_)\ + {\ + set_descriptor_value (value_);\ + }\ + void operator = (int value_)\ + {\ + set_descriptor_value (value_);\ + }\ + void set_value (const T_TDC_INSTANCE_INT_BASE &value_)\ + {\ + copy_instance (&value_);\ + }\ + void operator = (const T_TDC_INSTANCE_INT_BASE &value_)\ + {\ + copy_instance (&value_);\ + }\ + M_TDC_INTERFACE_ADDITIONAL_VAR (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME, PREFIXED_SHORT_NAME)\ + +#define M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME,T_ARG)\ + T_##SHORT_NAME operator = (const T_ARG& value_)\ + {\ + set_value (value_);\ + return value_;\ + TDC_LINT_UNASSIGNED_MEMBER\ + }\ + +//----- + +#define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_PRIMITIVE_UNION)\ + +#define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_MESSAGE_UNION)\ + +#define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_PRIM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_PRIMITIVE_UNION)\ + +#define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_PUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_SDU_ADDITIONAL_INLINE(SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,SHORT_NAME) + +#define M_TDC_INTERFACE_PENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_MSG_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, T_MESSAGE_UNION)\ + +#define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_MUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_COMP (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INTERFACE_MENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INTERFACE_ADDITIONAL_ENUM (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX(M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY,XXX,PREFIXED_XXX)\ + private:\ + T_TDC_INTERFACE_##XXX (const T_TDC_INTERFACE_PRIMITIVE_BASE& primitive)\ + {\ + tdc_tbd_xxx_constructor_call(#XXX);\ + }\ + +#define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, T_PRIMITIVE_UNION)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP)\ + public:\ + +#define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, T_PRIMITIVE_UNION)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP)\ + public:\ + +#define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG, PREFIXED_MSG, MESSAGE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG, PREFIXED_MSG, T_MESSAGE_UNION)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG)\ + public:\ + +#define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(MSG,PREFIXED_MSG)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG, PREFIXED_MSG, MESSAGE)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_CALL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG, PREFIXED_MSG, T_MESSAGE_UNION)\ + M_TDC_INTERFACE_ADDITIONAL_MAIN_XXX (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG)\ + public:\ + +#define M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SHORT_NAME)\ + struct T_TDC_INTERFACE_##SHORT_NAME;\ + struct T_TDC_HANDLE_##SHORT_NAME;\ + +#define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP)\ + M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SAP##_PRIMITIVE_UNION)\ + +#define M_TDC_CREATE_DEFAULT__T_TDC_INTERFACE_XXX_PRIMITIVE_UNION(SAP,CCDSAP)\ + enum { CCDSAP_##SAP = CCDSAP };\ + M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(SAP##_PRIMITIVE_UNION)\ + +#define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL()\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, PRIMITIVE_UNION, PRIMITIVE_UNION, PRIMITIVE)\ + private:\ + T_TDC_INTERFACE_PRIMITIVE_UNION (const T_TDC_INTERFACE_PRIMITIVE_BASE& primitive)\ + {\ + tdc_tbd_primitive_union_constructor_call();\ + }\ + public:\ + +#define M_TDC_INTERFACE_PRIMITIVE_ELEMENT_ADDITIONAL(SAP)\ + /*nothing*/ + +#define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG)\ + M_TDC_CREATE_DEFAULT_INTERFACE_CLASS(MSG##_MESSAGE_UNION)\ + +#define M_TDC_CREATE_DEFAULT__T_TDC_INTERFACE_XXX_MESSAGE_UNION(MSG,CCDENT)\ + enum { CCDENT_##MSG = CCDENT };\ + M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG) + +#define M_TDC_INTERFACE_MESSAGE_ADDITIONAL()\ + M_TDC_INTERFACE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MESSAGE_UNION,MESSAGE_UNION, MESSAGE)\ + private:\ + T_TDC_INTERFACE_MESSAGE_UNION (const T_TDC_INTERFACE_MESSAGE_BASE& primitive)\ + {\ + tdc_tbd_message_union_constructor_call();\ + }\ + public:\ + +#define M_TDC_INTERFACE_MESSAGE_ELEMENT_ADDITIONAL(MSG)\ + /*nothing*/ + +//\} + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1I() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/// \defgroup M_TDC_INSTANCE M_TDC_INSTANCE +/// macros to repeat stuff that is similar in many instance classes +//---------------------------------------------------------------------------- +//\{ + +/*lint -emacro(1706,M_TDC_INSTANCE_ADDITIONAL_BASE)*/ //we don't want M_TDC_NOT(IN_CLASS(...)) for all the scope operators +#define M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE_, T_INSTANCE, T_HANDLE_)\ + IN_CLASS(typedef T_INTERFACE_ T_INTERFACE;)\ + IN_CLASS(typedef T_HANDLE_ T_HANDLE;)\ + IN_CLASS(T_HANDLE* handle;)\ + IN_CLASS(static) T_TDC_HANDLE_BASE* T_INSTANCE::implement_new_handle ()\ + WITH_BODY({\ + return new_##T_HANDLE_();\ + })\ + IN_CLASS(virtual) T_TDC_INTERFACE_BASE* T_INSTANCE::new_interface() const\ + WITH_BODY({\ + return new_##T_INTERFACE_();\ + })\ + void T_INSTANCE::construct()\ + WITH_BODY({\ + construct_handle(new_##T_HANDLE_);\ + })\ + T_INSTANCE::T_INSTANCE ()\ + WITH_BODY({\ + construct();\ + TDC_LINT_UNINITIALIZED_MEMBER\ + })\ + T_INSTANCE::~T_INSTANCE ()\ + WITH_BODY({\ + destroy_handle ();\ + TDC_LINT_POSSIBLE_UNHANDLE_POINTER_MEMBER\ + })\ + T_INSTANCE::T_INSTANCE (const T_INTERFACE_& value_)\ + WITH_BODY({\ + construct_from_interface ((T_TDC_INTERFACE_BASE*)&value_, new_##T_HANDLE_); M_TDC_COMMENT(T_INTERFACE not defined yet; means need cast here to the base type pointer)\ + TDC_LINT_UNINITIALIZED_MEMBER\ + })\ + IN_CLASS(explicit) T_INSTANCE::T_INSTANCE (const T_TDC_HANDLE_BASE* value_)\ + WITH_BODY({\ + tdc_tbd_constructor_call(#T_INSTANCE);\ + TDC_LINT_UNINITIALIZED_MEMBER\ + })\ + void T_INSTANCE::operator = (const T_INSTANCE& value_)\ + WITH_BODY({\ + set_value (value_);\ + TDC_LINT_UNASSIGNED_MEMBER\ + TDC_LINT_NO_SELFASSIGN_TEST\ + })\ + M_TDC_NOT_##IN_CLASS(T_INTERFACE_* T_INSTANCE::operator -> ()\ + {\ + return (T_INTERFACE*)get_navigation();\ + })\ + T_INSTANCE::T_INSTANCE (const T_INSTANCE& value_)\ + WITH_BODY({\ + construct_from_instance (value_, new_##T_HANDLE_);\ + TDC_LINT_UNCOPIED_BASE\ + TDC_LINT_UNINITIALIZED_MEMBER\ + })\ + T_INSTANCE::T_INSTANCE (T_INSTANCE (*f) ())\ + WITH_BODY({\ + T_INSTANCE value_ = f ();\ + construct_from_instance (value_, new_##T_HANDLE_);\ + TDC_LINT_UNINITIALIZED_MEMBER\ + })\ + M_TDC_ADDITIONAL_CALL_FUNCTION_BASE(IN_CLASS, WITH_BODY, T_INSTANCE, T_INSTANCE, T_INSTANCE) + +#define M_TDC_INSTANCE_ADDITIONAL_MAIN(IN_CLASS, WITH_BODY, SHORT_NAME, PREFIXED_SHORT_NAME, BASE)\ + public:\ + void operator = (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ + {\ + set_main_value (&value_);\ + }\ + void operator = (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ + {\ + set_main_value (&value_);\ + }\ + T_##SHORT_NAME (const T_TDC_INTERFACE_##BASE##_BASE& value_)\ + {\ + construct_main_value (&value_, new_T_TDC_HANDLE_##PREFIXED_SHORT_NAME);\ + }\ + T_##SHORT_NAME (const T_TDC_INSTANCE_##BASE##_BASE& value_)\ + {\ + construct_main_value (&value_, new_T_TDC_HANDLE_##PREFIXED_SHORT_NAME);\ + }\ + M_TDC_INSTANCE_ADDITIONAL_BASE (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_PART_ADDITIONAL(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE, T_DESCRIPTOR, T_HANDLE)\ + public:\ + T_INSTANCE (const T_TDC_ACTION& action_)\ + {\ + construct_from_action (action_, new_##T_HANDLE);\ + }\ + T_TDC_ACTION operator = (const T_TDC_ACTION& action_)\ + {\ + set_action (action_);\ + return action_;\ + }\ + M_TDC_INSTANCE_ADDITIONAL_BASE(IN_CLASS, WITH_BODY, T_INTERFACE, T_INSTANCE, T_HANDLE) + +#define M_TDC_INSTANCE_COMP_ADDITIONAL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_PART_ADDITIONAL (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME, T_TDC_HANDLE_##PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_ENUM_ADDITIONAL(IN_CLASS, WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME)\ + T_##SHORT_NAME (int value_)\ + {\ + construct_from_number (value_, new_T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME);\ + }\ + void operator = (int value_)\ + {\ + set_descriptor_value (value_);\ + }\ + bool operator == (T_TDC_ENUM_##PREFIXED_SHORT_NAME value_)\ + {\ + return cmp_descriptor_value (value_);\ + }\ + operator T_TDC_ENUM_##PREFIXED_SHORT_NAME ()\ + {\ + return (T_TDC_ENUM_##PREFIXED_SHORT_NAME) get_descriptor_value ();\ + }\ + M_TDC_INSTANCE_PART_ADDITIONAL (IN_CLASS, WITH_BODY, T_TDC_INTERFACE_##PREFIXED_SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME, T_TDC_DESCRIPTOR_##PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_INT_ADDITIONAL(SHORT_NAME)\ + T_##SHORT_NAME (int value_)\ + {\ + construct_from_number (value_, new_T_TDC_DESCRIPTOR_##SHORT_NAME);\ + }\ + void operator = (int value_)\ + {\ + set_descriptor_value (value_);\ + }\ + M_TDC_INSTANCE_PART_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, T_TDC_INTERFACE_##SHORT_NAME, T_##SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME, T_TDC_DESCRIPTOR_##SHORT_NAME) + +//----- + +#define M_TDC_INSTANCE_PRIM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE) + +#define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_PUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_SDU_ADDITIONAL(SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,SHORT_NAME) + +#define M_TDC_INSTANCE_PENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INSTANCE_MSG_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE) + +#define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_MUNION_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_MENUM_ADDITIONAL(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INSTANCE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP,PREFIXED_SAP)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, SAP,PREFIXED_SAP, PRIMITIVE) + +#define M_TDC_INSTANCE_XXX_MESSAGE_UNION_ADDITIONAL(MSG,PREFIXED_MSG)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MSG,PREFIXED_MSG, MESSAGE) + +#define M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL()\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, PRIMITIVE_UNION,PRIMITIVE_UNION, PRIMITIVE)\ + static int call_tdc_initialize_primitive ();\ + +#define M_TDC_INSTANCE_MESSAGE_ADDITIONAL()\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITHOUT_BODY, MESSAGE_UNION,MESSAGE_UNION, MESSAGE)\ + static int call_tdc_initialize_message ();\ + +//----- + +#define M_TDC_INSTANCE_PRIM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, PRIMITIVE) + +#define M_TDC_INSTANCE_PSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_PUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_PENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +#define M_TDC_INSTANCE_MSG_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME, MESSAGE) + +#define M_TDC_INSTANCE_MSTRUCT_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_MUNION_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_COMP_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +#define M_TDC_INSTANCE_MENUM_ADDITIONAL_INLINE(SHORT_NAME,PREFIXED_SHORT_NAME)\ + M_TDC_INSTANCE_ENUM_ADDITIONAL (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SHORT_NAME,PREFIXED_SHORT_NAME) + +//----- + +template<class T_INSTANCE,class T_HANDLE>class T_TDC_FORCE_LINK_INSTANCE_WORKER +{ + T_TDC_FORCE_LINK_INSTANCE_WORKER(){ + T_HANDLE::new_descriptor = T_INSTANCE::get_new_descriptor(); + } +}; + +template<class T_INSTANCE,class T_HANDLE>class T_TDC_FORCE_LINK_INSTANCE +{ + static T_TDC_FORCE_LINK_INSTANCE_WORKER<T_INSTANCE,T_HANDLE> worker; +}; +template<class T_INSTANCE,class T_HANDLE>T_TDC_FORCE_LINK_INSTANCE_WORKER<T_INSTANCE,T_HANDLE> T_TDC_FORCE_LINK_INSTANCE<T_INSTANCE,T_HANDLE>::worker; + +#define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE_1(SAP,PREFIXED_SAP)\ + extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ + static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ + +#define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + +#define M_TDC_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + +/* +#define M_TDC_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ + static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ + +#define M_TDC_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + extern char set_new_descriptor_T_TDC_HANDLE_##SAP();\ + static char init_new_descriptor_T_TDC_HANDLE_##SAP = set_new_descriptor_T_TDC_HANDLE_##SAP();\ +*/ + +#define M_TDC_INSTANCE_XXX_PRIMITIVE_UNION_ADDITIONAL_INLINE(SAP,PREFIXED_SAP)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, SAP,PREFIXED_SAP, PRIMITIVE)\ + T_TDC_NEW_DESCRIPTOR get_new_descriptor()\ + {\ + extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##SAP();\ + return new_T_TDC_DESCRIPTOR_##SAP;\ + }\ + +#define M_TDC_INSTANCE_XXX_MESSAGE_UNION_ADDITIONAL_INLINE(MSG,PREFIXED_MSG)\ + M_TDC_INSTANCE_ADDITIONAL_MAIN (M_TDC_IN_CLASS, M_TDC_WITH_BODY, MSG,PREFIXED_MSG, MESSAGE)\ + T_TDC_NEW_DESCRIPTOR get_new_descriptor()\ + {\ + extern T_TDC_DESCRIPTOR_BASE* new_T_TDC_DESCRIPTOR_##MSG();\ + return new_T_TDC_DESCRIPTOR_##MSG;\ + }\ + +//\} + +//----- + +#ifdef TDC_TYPE_NAME_COMPLETE +#define M_TDC_TYPE_NAME_COMPLETE TDC_DOT_COMPLETE_HIDE({ T_TDC_TYPE_NAME type_name = {0}; return type_name; }) +#else +#define M_TDC_TYPE_NAME_COMPLETE ; +#endif + +#endif //DOT_COMPLETE_DEFINES + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1J() + { + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; +} +#else +#endif + +//============================================================================ +// implementation classes +//============================================================================ + +typedef bool T_TDC_TABLE_KIND; + +enum T_TDC_ACTION_ENUM +{ + TDC_ACTION_UNKNOWN, + // MANDATORY-SEND OPTIONAL-SEND MANDATORY-WAIT OPTIONAL-WAIT + TDC_ACTION_SKIP, // ERROR ABSENT SKIPED SKIPED + TDC_ACTION_SHOW, // ERROR ABSENT SKIPED SKIPED + TDC_ACTION_FORBID, // ERROR ABSENT ERROR CHECKED + TDC_ACTION_REQUIRE, // ERROR ERROR ERROR CHECKED PRESENT + TDC_ACTION_MESSAGE, + TDC_ACTION_DESTROYED, + TDC_ACTION_SKIP_TO_END, + TDC_ACTION_SET = 0x10, // PRESENT PRESENT CHECKED CHECKED VALUE + TDC_ACTION_HAS_VALUE = 0x20, + TDC_ACTION_HAS_REF = 0x40, + TDC_ACTION_IS_IMPLICIT = 0x80, + TDC_ACTION_SET_VALUE = TDC_ACTION_SET + TDC_ACTION_HAS_VALUE, + TDC_ACTION_SET_REF = TDC_ACTION_SET + TDC_ACTION_HAS_REF, + TDC_ACTION_CHILD_TOUCHED = TDC_ACTION_SET + TDC_ACTION_HAS_REF + TDC_ACTION_IS_IMPLICIT, + TDC_ACTION_DEFAULT = TDC_ACTION_UNKNOWN +}; + +/** allow one optional extra set of () on action member functions, first set is suplyed by macro + * second set might be suplyed by the user, this will have no effect on behaviour of code + */ +struct T_TDC_ASSIGN_ACTION +{ + void operator ()(); +}; + +extern T_TDC_ASSIGN_ACTION tdc_assign_action; + +struct T_TDC_ACTION +{ + //create a waper class for T_TDC_ACTION_ENUM so that the action constants can not be converted to integers + T_TDC_ACTION_ENUM action; + T_TDC_ACTION (T_TDC_ACTION_ENUM action_): + action (action_) + { + //nothing + } + T_TDC_ACTION (); +}; + +struct T_TDC_CREATE_ACTION:T_TDC_ACTION +{ + /* This type is returned by constant action function, this allow the user to optional + omit the "()" after the action name + Src code After macro expantion Function returns After implicit type convting + ======== ==================== ======================== ===================== + _skip tdc_skip() SKIP::T_TDC_CREATE_ACTION SKIP::T_TDC_ACTION + _skip() tdc_skip()() SKIP::T_TDC_ACTION SKIP::T_TDC_ACTION + _skip()() tdc_skip()()() <error T_TDC_ACTION have no operator ()> + */ + T_TDC_CREATE_ACTION (); + T_TDC_ACTION operator()(); +}; + +extern T_TDC_CREATE_ACTION SKIP; +extern T_TDC_CREATE_ACTION SHOW; +extern T_TDC_CREATE_ACTION FORBID; +extern T_TDC_CREATE_ACTION REQUIRE; +extern T_TDC_CREATE_ACTION SKIP_TO_END; + +extern T_TDC_CREATE_ACTION tdc_skip(); +extern T_TDC_CREATE_ACTION tdc_show(); +extern T_TDC_CREATE_ACTION tdc_forbid(); +extern T_TDC_CREATE_ACTION tdc_require(); +extern T_TDC_CREATE_ACTION tdc_skip_to_end(); + +//---------------------------------------------------------------------------- + +enum T_TDC_EVENT_ENUM +{ + TDC_EVENT_SEND, + TDC_EVENT_AWAIT +}; + +enum T_TDC_IS_ENUM +{ + TDC_IS_UNKNOWN = 0, + TDC_IS_VAR = 0x001, + TDC_IS_STRUCT = 0x002, + TDC_IS_SDU = 0x004, + TDC_IS_P = 0x008, + TDC_IS_M = 0x010, + TDC_IS_COMP = 0x20, + TDC_IS_ARRAY = 0x40, + TDC_IS_UNION = 0x80, + TDC_IS_MESSAGE_UNION = 0x100, + TDC_IS_PRIMITIVE_UNION = 0x200, + TDC_IS_MSG = 0x400, + TDC_IS_PRIM = 0x800, + TDC_IS_XXX_MESSAGE_UNION = 0x1000, + TDC_IS_XXX_PRIMITIVE_UNION = 0x2000, + TDC_IS_POINTER = 0x4000, + TDC_IS_PVAR = TDC_IS_VAR | TDC_IS_P, + TDC_IS_MVAR = TDC_IS_VAR | TDC_IS_M +}; + +//---------------------------------------------------------------------------- + +struct T_TDC_HANDLE_BASE; +struct T_TDC_DESCRIPTOR_BASE; +struct T_TDC_INSTANCE_MAIN_BASE; +struct T_TDC_INTERFACE_BASE; +struct T_TDC_INSTANCE_BASE; +struct T_TDC_PATH; +struct T_TDC_PATH_TEXT; + +typedef T_TDC_INTERFACE_BASE* (*T_TDC_NEW_INTERFACE)(); +typedef T_TDC_HANDLE_BASE* (*T_TDC_NEW_HANDLE)(); +typedef T_TDC_DESCRIPTOR_BASE* (*T_TDC_NEW_DESCRIPTOR)(); + +struct T_PRIMITIVE_UNION; +struct T_TDC_INTERFACE_PRIMITIVE_UNION; +struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION; + +struct T_MESSAGE_UNION; +struct T_TDC_INTERFACE_MESSAGE_UNION; +struct T_TDC_DESCRIPTOR_MESSAGE_UNION; + +typedef signed long T_TDC_INT_S32; +typedef signed short T_TDC_INT_S16; +typedef signed char T_TDC_INT_S8; +typedef unsigned long T_TDC_INT_U32; +typedef unsigned short T_TDC_INT_U16; +typedef unsigned char T_TDC_INT_U8; +typedef char CHAR; + +//---------------------------------------------------------------------------- +inline unsigned long num_elements(const unsigned char* array) +{ + return strlen((const char*)array); +} + +inline unsigned long num_elements(const signed char* array) +{ + return strlen((const char*)array); +} + + +//---------------------------------------------------------------------------- + +enum T_TDC_RW_MODE +{ + TDC_RW_MODE_READ, + TDC_RW_MODE_WRITE +}; + +struct T_TDC_HANDLE_BASE +{ + friend struct T_TDC_COPY; +protected: + T_TDC_ACTION_ENUM implement_get_action () const; + void implement_set_action (T_TDC_ACTION_ENUM action_); + T_TDC_DESCRIPTOR_BASE* implement_get_descriptor () const; + void implement_set_descriptor (T_TDC_DESCRIPTOR_BASE* descriptor_); + long implement_get_value () const; + void implement_set_value (long value_); + friend void add_name_info (T_TDC_HANDLE_BASE* descriptor_ref, int level, int parent, int index); + T_TDC_PATH_TEXT path_text(); + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; + static T_TDC_DESCRIPTOR_BASE* call_implement_new_descriptor(T_TDC_NEW_DESCRIPTOR new_descriptor); +public: + T_TDC_DESCRIPTOR_BASE* make_descriptor (); + T_TDC_DESCRIPTOR_BASE* make_array_descriptor (T_TDC_NEW_HANDLE new_element_handle); + virtual char* get_name () const + TDC_PURE_BODY({ + //TDC_ERROR(); + return 0; + }) + virtual long get_sizeof () = 0 + { + return sizeof *this; + } + T_TDC_HANDLE_BASE (); + ~T_TDC_HANDLE_BASE (); + T_TDC_HANDLE_BASE* get_element (int index)const; + T_TDC_HANDLE_BASE* get_union_element (); + void destroy (); + T_TDC_DESCRIPTOR_BASE* get_descriptor()const; + T_TDC_ACTION_ENUM get_action()const; + long get_value()const; + int get_ctrl()const; + void clear(); + void set_descriptor_value(long value_); + virtual unsigned get_sizeof_target (); + virtual T_TDC_IS_ENUM is (); +}; + +#ifdef TDC_USE_ALLOC_DEBUG_COUNTER +struct T_TDC_ALLOC_DEBUG_COUNTER +{ + int count; + int max_count; + int alloc_count; + int free_count; + bool alloc[1000]; + T_TDC_ALLOC_DEBUG_COUNTER () + { + /* nothing here should allways be static allocated and there for cleared, + futher more it is used before construction so intializing here will be fatal */ + } + ~T_TDC_ALLOC_DEBUG_COUNTER () + { + for (int first_not_freed = 0; !alloc[first_not_freed]; first_not_freed++) + TDC_ASSERT (first_not_freed < sizeof alloc); + TDC_ASSERT (count==0); // some where we have a leak + } +}; + +template<class T> +struct T_TDC_ALLOC_DEBUG +{ + static T_TDC_ALLOC_DEBUG_COUNTER counter; + int alloc_count; + T_TDC_ALLOC_DEBUG_COUNTER& counter_; + T_TDC_ALLOC_DEBUG (): + counter_ (counter) + { + counter.count++; + alloc_count = counter.alloc_count++; + if (alloc_count < sizeof counter.alloc) + counter.alloc[alloc_count]=true; + if (counter.max_count < counter.count) + counter.max_count = counter.count; + } + ~T_TDC_ALLOC_DEBUG () + { + if (alloc_count < sizeof counter.alloc) + counter.alloc[alloc_count]=false; + TDC_ASSERT (counter.count > 0); // deallocating more than ever allocated + counter.free_count++; + counter.count--; + } +}; + +template<class T>T_TDC_ALLOC_DEBUG_COUNTER T_TDC_ALLOC_DEBUG<T>::counter; +#endif + +enum { + TDC_CTRL_DEFAULT = 0, + TDC_CTRL_NO_DESCRIPTOR = -1, + TDC_CTRL_NOT_AN_UNION = -2, + TDC_REF_COUNT_ELEMENTS_DESTROYED = -2, + TDC_DESCRIPTOR_DESTROYED_VALUE = -4, + TDC_DUMMY_TAP_HANDLE = -16 +}; + +#define TDC_DESCRIPTOR_DESTROYED ((T_TDC_DESCRIPTOR_BASE*)TDC_DESCRIPTOR_DESTROYED_VALUE) + +struct T_TDC_DESCRIPTOR_BASE +#ifdef TDC_USE_ALLOC_DEBUG_COUNTER + :T_TDC_ALLOC_DEBUG<T_TDC_DESCRIPTOR_BASE> +#endif +{ +private: + friend struct T_TDC_COPY; + friend void unsubscribe (T_TDC_DESCRIPTOR_BASE* descriptor); + int ref_count; + virtual long get_sizeof () + TDC_PURE_BODY( + return 0; + ) + + void destroy_elements (); +protected: + T_TDC_HANDLE_BASE* implement_get_element (unsigned index, char *first_element); + T_TDC_HANDLE_BASE* implement_get_union_element (unsigned index, int& ctrl); +public: + void *operator new (size_t size);//TODO: operator new (size_t size); + eliminate T_TDC_HANDLE_BASE::T_TDC_HANDLE_BASE i.e. todo T_TDC_HANDLE_BASE::operator new (size_t size); + T_TDC_PATH_TEXT path_text(); + virtual int read_ctrl () const + { + return TDC_CTRL_NOT_AN_UNION; + } + void set_skip_to_end_from_action (T_TDC_ACTION_ENUM action); + virtual void set_skip_to_end (bool skip_to_end); + virtual bool get_skip_to_end () const; + virtual T_TDC_HANDLE_BASE* make_element (unsigned index); + virtual T_TDC_HANDLE_BASE* get_element (unsigned index); + virtual int get_tap_handle (); + T_TDC_DESCRIPTOR_BASE (); + virtual ~T_TDC_DESCRIPTOR_BASE (); + virtual char* get_name () const + TDC_PURE_BODY( + return 0; + ) + virtual T_TDC_IS_ENUM is () + { + //TODO: TDC_ERROR() here and mov is function to distinct base classes; + return TDC_IS_UNKNOWN; + } +}; + +union T_TDC_BASIC_TYPES +{ + unsigned long u32; + signed long s32; + signed int s16; + signed char s8; + char c[4]; +}; + +//---------------------------------------------------------------------------- + +struct T_TDC_INTERFACE_BASE +{ +private: + void* operator &(); /* this member function is only here to prevent the user from taking the address of + an interface, which make no sence to the user as it gives the address of + some internal tdc navigation data */ +#ifdef LINT //TODO: introduce for VC too + const void* operator &() const; /* but we don't want ripling errors from LINT + the ripling errors comes from the fact that LINT seems to have a more correct + interpretion of where to use the overloaded function and where to truely take + the address*/ +#endif +protected: + T_TDC_LEVEL level[1]; + T_TDC_ASSIGN_ACTION set_action (const T_TDC_ACTION& action_); + T_TDC_INTERFACE_BASE () + { + //nothing + } +public: + T_TDC_PATH* implement_make_descriptor_ref (T_TDC_RW_MODE rw_mode); + T_TDC_PATH* make_descriptor_ref (T_TDC_RW_MODE rw_mode); + const T_TDC_PATH* make_descriptor_ref (T_TDC_RW_MODE rw_mode) const; + void set_descriptor_value (long value_); + //bool cmp_descriptor_value (long value_); + void copy_instance (const T_TDC_INSTANCE_BASE * value_); + void copy_interface (const T_TDC_INTERFACE_BASE * value_); +}; + +struct T_TDC_INTERFACE_MAIN_BASE +#if DOT_COMPLETE_MEMBERS +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) +#endif +{ +#if DOT_COMPLETE_MEMBERS +#else +protected: + void set_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_); + void set_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_); + T_TDC_INTERFACE_BASE* get_element_navigation(T_TDC_NEW_INTERFACE new_element_interface); + /*T_TDC_INTERFACE_MAIN_BASE () + { + tdc_level++; + }*/ +#endif +}; + +struct T_TDC_INTERFACE_REF_BASE +#if DOT_COMPLETE_MEMBERS +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) +#endif +{ +#if DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ + T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ + T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ + T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ +#else//DOT_COMPLETE_MEMBERS + T_TDC_INTERFACE_REF_BASE () + { + level[0] = 'A'+tdc_level; + } + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_skip ();) /* you can use '= SKIP' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_show ();) /* you can use '= SHOW' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_forbid ();) /* you can use '= FORBID' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_require ();) /* you can use '= REQUIRE' as well */ +#endif//DOT_COMPLETE_MEMBERS +}; + +struct T_TDC_INTERFACE_VAR_BASE +#if DOT_COMPLETE_MEMBERS +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INTERFACE_BASE) +#endif +{ +#if DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ + T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ + T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ + T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ +#else//DOT_COMPLETE_MEMBERS + T_TDC_INTERFACE_VAR_BASE () + { + level[0] = 'A'+tdc_level; + } + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_skip ();) /* you can use '= SKIP' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_show ();) /* you can use '= SHOW' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_forbid ();) /* you can use '= FORBID' as well */ + TDC_DOT_COMPLETE_HIDE(T_TDC_ASSIGN_ACTION tdc_require ();) /* you can use '= REQUIRE' as well */ +#endif//DOT_COMPLETE_MEMBERS +}; + +//---------------------------------------------------------------------------- + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1K() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/** \defgroup PATH PATH + * A set of classes and functions that is used for generating the path of + * an element when generating warning or error messages. + * TODO: need more work + */ +//\{ + +struct T_TDC_PATH +#ifdef TDC_USE_ALLOC_DEBUG_COUNTER + :T_TDC_ALLOC_DEBUG<T_TDC_PATH> +#endif +{ + T_TDC_HANDLE_BASE* handle; + T_TDC_DESCRIPTOR_BASE* cahed_descriptor; + int indexes_count; + union{ + int *indexes; + struct T_WATCH_INDEXES{ + int i0,i1,i2,i3,i4,i5,i6,i7,i8,i9; + }*watch_indexes; + }; + T_TDC_INTERFACE_BASE* pattern; + T_TDC_PATH* next; + T_TDC_PATH (T_TDC_HANDLE_BASE* handle_); + ~T_TDC_PATH (); + void add_index(T_TDC_DESCRIPTOR_BASE* descriptor, int index); + void add_to_cashed_path_list (); + T_TDC_HANDLE_BASE* get_leaf(); + T_TDC_PATH_TEXT get_path_text (); + T_TDC_PATH* duplicate()const; +}; + +//---------------------------------------------------------------------------- + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1L() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + +} +#else +#endif + +//---------------------------------------------------------------------------- + +struct const_T_TDC_COPY +{ + T_TDC_HANDLE_BASE* descriptor_ref; + const T_TDC_PATH* path; + const_T_TDC_COPY (const T_TDC_PATH* path_): + descriptor_ref (const_cast<T_TDC_PATH*>(path_)->get_leaf()), + path (path_) + { + } + const_T_TDC_COPY (const T_TDC_HANDLE_BASE* descriptor_ref_): + descriptor_ref (const_cast<T_TDC_HANDLE_BASE*>(descriptor_ref_)), + path (0) + { + } + const_T_TDC_COPY (const const_T_TDC_COPY& src): + descriptor_ref (src.descriptor_ref), + path (0) + { + if (src.path) + path = src.path->duplicate(); + } + void operator = (const const_T_TDC_COPY& src) + { + descriptor_ref = src.descriptor_ref; + if (path) + delete path; + if (src.path) + path = src.path->duplicate(); + else + path = 0; + } + const T_TDC_HANDLE_BASE* operator->() + { + return descriptor_ref; + } + operator const T_TDC_HANDLE_BASE*()const + { + return descriptor_ref; + } + ~const_T_TDC_COPY () + { + if (path) + delete path; + } + T_TDC_PATH_TEXT path_text (); + T_TDC_ACTION_ENUM get_action () const + { + return descriptor_ref->get_action(); + } + bool has_value () const + { + return (descriptor_ref->get_action() & TDC_ACTION_HAS_VALUE) != 0; + } + int get_value () const + { + return descriptor_ref->get_value(); + } +}; + +struct T_TDC_COPY:const_T_TDC_COPY +{ + friend struct T_TDC_COPY; + T_TDC_COPY (T_TDC_PATH* path_): + const_T_TDC_COPY (path_) + { + } + T_TDC_COPY (T_TDC_HANDLE_BASE* descriptor_ref_): + const_T_TDC_COPY (descriptor_ref_) + { + } + T_TDC_HANDLE_BASE* operator->() + { + return descriptor_ref; + } + operator T_TDC_HANDLE_BASE*()const + { + return descriptor_ref; + } + void copy_descriptor_ref (const const_T_TDC_COPY& value_); + void copy_number (long value_); + T_TDC_ASSIGN_ACTION copy_action (T_TDC_ACTION_ENUM action_); +private: + void set_action_and_value (T_TDC_ACTION_ENUM action_, long value_=0xFCFCFCFC); +}; + +//---------------------------------------------------------------------------- + +/** \struct T_TDC_PATH_TEXT + T_TDC_PATH_TEXT is used to return a string on the heap that will auto dealloc + <pre> + e.g. + + T_TDC_PATH_TEXT f() + { + return strdup ("..."); + } + + void g() + { + printf ("%s", f()); // free of string allocated in f() will happen automatic + // when ~T_TDC_PATH_TEXT is called at the end of sentence (at ';') + } + </pre> +*/ +struct T_TDC_PATH_TEXT +{ + char* str; + T_TDC_PATH_TEXT(char* str_); + ~T_TDC_PATH_TEXT(); +}; + +//\} + +//---------------------------------------------------------------------------- + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1N() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + +} +#else +#endif + +//============================================================================ +/// \defgroup T_TDC_INTERFACE +//\{ + +struct T_TDC_INTERFACE_REF:T_TDC_INTERFACE_REF_BASE +{ +#if DOT_COMPLETE_MEMBERS +#else + T_TDC_INTERFACE_REF () + { + tdc_level++; + } +#endif +}; + +struct T_TDC_INTERFACE_VAR:T_TDC_INTERFACE_VAR_BASE +{ +#if DOT_COMPLETE_MEMBERS +#else + T_TDC_INTERFACE_VAR () + { + //nothing + } +#endif +}; + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O +{ + int i1O; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1O s10; + s10-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- + +#if DOT_COMPLETE +#define TDC_HIDDEN_LEVEL_DEF +#define TDC_HIDDEN_LEVEL(T_BASE) +#define TDC_HIDDEN_LEVEL_MAIN_DEF +#define TDC_HIDDEN_LEVEL_MAIN(T_BASE) +struct T_TDC_INTERFACE_POINTER_MAIN_BASE:T_TDC_INTERFACE_REF_BASE +{ +}; +#else +#define TDC_HIDDEN_LEVEL_DEF +#define TDC_HIDDEN_LEVEL +#define TDC_HIDDEN_LEVEL_MAIN_DEF , class T_TDC_INTERFACE_POINTER_MAIN_BASE = T_TDC_INTERFACE_POINTER_MAIN_BASE_DEFAULT +#define TDC_HIDDEN_LEVEL_MAIN(T_BASE) , T_BASE +#endif + +struct T_TDC_INTERFACE_PRIMITIVE_BASE:T_TDC_INTERFACE_MAIN_BASE +{ +}; + +struct T_TDC_INTERFACE_MESSAGE_BASE:T_TDC_INTERFACE_MAIN_BASE +{ +}; + +//template<class T TDC_HIDDEN_LEVEL_MAIN_DEF > struct T_TDC_INTERFACE_POINTER_MAIN:T_TDC_INTERFACE_POINTER_BASE +template<class T TDC_HIDDEN_LEVEL_MAIN_DEF > struct T_TDC_INTERFACE_POINTER_MAIN:T_TDC_INTERFACE_POINTER_MAIN_BASE +{ + T_TDC_INTERFACE_POINTER_MAIN () + { + level[0] = 'A'+tdc_level; + } +#if DOT_COMPLETE_MEMBERS +#else //DOT_COMPLETE_MEMBERS + operator = (const T& t) + { + tdc_tbd_pointer_assignment_error(); + //get_navigation()->_set(t); + return 0; + } +#endif //DOT_COMPLETE_MEMBERS + /*operator = (const T_TDC_INSTANCE& t) + { + get_navigation()->_set(t); + }*/ + T* operator-> (){ + return (T*)get_element_navigation(new_element_interface); + } + /*operator const T&() + { + return *get_navigation(); + }*/ +private: +#if DOT_COMPLETE_MEMBERS +#else //DOT_COMPLETE_MEMBERS + static T_TDC_INTERFACE_BASE* new_element_interface() + { + return new T; + } +#endif //DOT_COMPLETE_MEMBERS +}; + +template<class T> struct T_ARRAY; + +struct T_TDC_INTERFACE_ARRAY_BASE + :T_TDC_INTERFACE_REF_BASE +{ +#if DOT_COMPLETE +#else +protected: + T_TDC_INTERFACE_BASE* get_element_navigation(int index, T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle); + void copy_basic_array (const T_TDC_INT_U8* array, unsigned size, void *address); + void copy_basic_array (const T_TDC_INT_S8* array, unsigned size, void *address); + void copy_basic_array (const T_TDC_INT_U16* array, unsigned size, void *address); + void copy_basic_array (const T_TDC_INT_S16* array, unsigned size, void *address); + void copy_basic_array (const T_TDC_INT_U32* array, unsigned size, void *address); + void copy_basic_array (const T_TDC_INT_S32* array, unsigned size, void *address); +#endif +}; + +/* +** TODO: Function header (this is a comment for an bug fix) +** +** I would expect dropdown to work for this +** template<class T, int MAX_INDEX > struct T_TDC_INTERFACE_ARRAY:T_TDC_INTERFACE_POINTER_BASE_DEFAULT +** ^^ +** and to fail for this +** template<class T, int MAX_INDEX, int DUMMY=0 > struct T_TDC_INTERFACE_ARRAY:T_TDC_INTERFACE_POINTER_BASE_DEFAULT +** ^^^^^^^^^^^^^ +** +** but it seams to be the otherway around (see more info in tcd_test.cpp::test_1000()) +*/ + +#if DOT_COMPLETE +template<class T /*T_INTERFACE*/, int MAX_INDEX = 1, int DUMMY=0> struct T_TDC_INTERFACE_ARRAY +#else +template<class T /*T_INTERFACE*/, int MAX_INDEX = 1> struct T_TDC_INTERFACE_ARRAY +//template<class T /*T_INTERFACE*/> struct T_TDC_INTERFACE_ARRAY +#endif + :T_TDC_INTERFACE_ARRAY_BASE +{ +public: + T& operator [] (int index)//HINT: blah + { + return *(T*)get_element_navigation (index, new_element_interface, T::implement_new_handle); + } + T* operator-> ()//HINT: blah + { + return (T*)get_element_navigation (0, new_element_interface, T::implement_new_handle); + } +#if DOT_COMPLETE_MEMBERS +#else//DOT_COMPLETE_MEMBERS + T_TDC_INTERFACE_ARRAY () + { + //nothing + } + void assign (const T_TDC_INT_U8* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_INT_S8* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_INT_U16* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_INT_S16* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_INT_U32* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_INT_S32* array, unsigned size, void *address) + { + copy_basic_array (array, size, address); + } + void assign (const T_TDC_ACTION& action_, unsigned size, void *address) + { + set_action(action_); + } + /*template <class U> + void assign (const U* u, unsigned size) + { + //TDC_TBD(); + }*/ + template <class U> + void assign (const T_ARRAY<U>& src, unsigned size, void *address) + { + T_TDC_COPY handle = make_descriptor_ref (TDC_RW_MODE_WRITE); + handle.copy_descriptor_ref (src.handle); + } + void assign (const T* t, unsigned size, void *address) + { + //tdc_check_array_assignment(array, address); + tdc_tbd_array_assignment_error(); + } + void assign (const T::T_INSTANCE* array, unsigned size, void *address) + { + tdc_check_array_assignment(array, address); + //copy_instance_array (array, size); + T_TDC_COPY handle = make_descriptor_ref (TDC_RW_MODE_WRITE); + T_TDC_HANDLE_BASE* descriptor_ref = handle.descriptor_ref; + T_TDC_DESCRIPTOR_BASE* descriptor = descriptor_ref->make_descriptor (); + T_TDC_HANDLE_BASE** elements = ((T_TDC_DESCRIPTOR_ARRAY_BASE*)descriptor)->get_elements(); + if (!*elements) + *elements = T::implement_new_handle (); + int count = size / sizeof *array; + + for (int i = 0; i < count; i++) + { + T_TDC_COPY dst_element = descriptor->make_element(i); + const_T_TDC_COPY src_element = (T_TDC_HANDLE_BASE*) array[i].handle; + dst_element.copy_descriptor_ref (src_element); + } + } + template <class U> + T_TDC_INTERFACE_ARRAY& operator = (const U& array) + { + int size = sizeof array; /* if you have error "illegal indirection" here the right hand operator can not be converted to an array + see next error message for the bad assignment */ + assign (array, size, (void*)&array); + return *this; + } +private: + static T_TDC_INTERFACE_BASE* new_element_interface() + { + return new T; + } +#endif//DOT_COMPLETE_MEMBERS +}; + +/* +** TODO: Function header (this is a comment for an bug fix) +** +** When we change T_TDC_INTERFACE_ARRAY we have to change T_TDC_INTERFACE_POINTER too +** template<class T TDC_HIDDEN_LEVEL_DEF > struct T_TDC_INTERFACE_POINTER:T_TDC_INTERFACE_ARRAY<T, 1 TDC_HIDDEN_LEVEL> +*/ + +struct T_TDC_INTERFACE_POINTER_BASE:T_TDC_INTERFACE_REF_BASE +{ +protected: + T_TDC_INTERFACE_BASE* get_navigation(T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle); + T_TDC_INTERFACE_BASE* get_navigation(T_TDC_NEW_INTERFACE new_element_interface, T_TDC_NEW_HANDLE new_handle, int index); +}; + +template<class T_INTERFACE> struct T_TDC_INTERFACE_POINTER +#if DOT_COMPLETE +#else + :T_TDC_INTERFACE_POINTER_BASE +#endif +{ + T_INTERFACE* operator-> () + { + return (T_INTERFACE*)get_navigation (new_element_interface, T_INTERFACE::implement_new_handle); + } +#if DOT_COMPLETE_MEMBERS +#else//DOT_COMPLETE_MEMBERS + T_INTERFACE& operator [] (int index) + { + return *(T_INTERFACE*)get_navigation (new_element_interface, T_INTERFACE::implement_new_handle, index); + } + static T_TDC_INTERFACE_BASE* new_element_interface() + { + return new T_INTERFACE; + } + /*T_TDC_INTERFACE_POINTER () + { + //nothing + }*/ +#endif//DOT_COMPLETE_MEMBERS +}; + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P +{ + int i1P; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1P s1P; + s1P-> + i0; + T_TDC_INTERFACE_ARRAY<int> i; +i.assign(0,0); + T_ARRAY<int> array; + array. + +} +#else +#endif + +//---------------------------------------------------------------------------- +// T_TDC_INTERFACE +//---------------------------------------------------------------------------- + +struct T_TDC_INTERFACE_PRIM_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE +{ + T_TDC_INTERFACE_PRIM_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +#if DOT_COMPLETE_MEMBERS//{{ + T_TDC_ASSIGN_ACTION _require () {} // you can use '= REQUIRE' as well +#else//}DOT_COMPLETE_MEMBERS{ + T_TDC_ASSIGN_ACTION tdc_require() // you can use '= REQUIRE' as well + { + return set_action (REQUIRE); + } +#endif//}}DOT_COMPLETE_MEMBERS +}; + +struct T_TDC_INTERFACE_PSTRUCT_BASE:T_TDC_INTERFACE_REF +{ +}; + +struct T_TDC_INTERFACE_PUNION_BASE:T_TDC_INTERFACE_REF +{ +}; + +struct T_TDC_INTERFACE_SDU_BASE:T_TDC_INTERFACE_REF +{ +}; + +struct T_TDC_INTERFACE_PENUM_BASE:T_TDC_INTERFACE_VAR +{ +}; + +struct T_TDC_INTERFACE_MSG_BASE:T_TDC_INTERFACE_MESSAGE_BASE +{ + T_TDC_INTERFACE_MSG_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +#if DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION _require () {} // you can use '= REQUIRE' as well +#else//DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION tdc_require() // you can use '= REQUIRE' as well + { + return set_action (REQUIRE); + } +#endif//DOT_COMPLETE_MEMBERS +}; + +struct T_TDC_INTERFACE_MSTRUCT_BASE:T_TDC_INTERFACE_REF +{ +}; + +struct T_TDC_INTERFACE_MUNION_BASE:T_TDC_INTERFACE_REF +{ +}; + +struct T_TDC_INTERFACE_MENUM_BASE:T_TDC_INTERFACE_VAR +{ +}; + +struct T_TDC_INTERFACE_INT_BASE:T_TDC_INTERFACE_VAR +{ +}; + +struct T_TDC_INTERFACE_XXX_PRIMITIVE_UNION_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE +{ + T_TDC_INTERFACE_XXX_PRIMITIVE_UNION_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +}; + +struct T_TDC_INTERFACE_XXX_MESSAGE_UNION_BASE:T_TDC_INTERFACE_MESSAGE_BASE +{ + T_TDC_INTERFACE_XXX_MESSAGE_UNION_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +}; + +struct T_TDC_INTERFACE_PRIMITIVE_UNION_BASE:T_TDC_INTERFACE_PRIMITIVE_BASE +{ + T_TDC_INTERFACE_PRIMITIVE_UNION_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +}; + +struct T_TDC_INTERFACE_MESSAGE_UNION_BASE:T_TDC_INTERFACE_MESSAGE_BASE +{ + T_TDC_INTERFACE_MESSAGE_UNION_BASE () + { + level[0] = 'A'+tdc_level; + tdc_level++; + } +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q +{ + int i1Q; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q s1Q; + s1Q-> + i; +} +#else +#endif + +template<class T> struct T_TDC_INTERFACE_XXX_PRIMITIVE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > +{ +}; + +template<class T> struct T_TDC_INTERFACE_XXX_MESSAGE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > +{ +}; + +template<class T> struct T_TDC_INTERFACE_PRIMITIVE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > +{ +}; + +template<class T> struct T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_PRIMITIVE_BASE) > +{ +}; + +template<class T> struct T_TDC_INTERFACE_MESSAGE:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > +{ +}; + +template<class T> struct T_TDC_INTERFACE_MESSAGE_UNION_POINTER:T_TDC_INTERFACE_POINTER_MAIN<T TDC_HIDDEN_LEVEL_MAIN(T_TDC_INTERFACE_MESSAGE_BASE) > +{ +}; + +//\} + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1 +{ + int i1Q1; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1u +{ + int i1Q1u; +}; +template<class T> +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1t1 +{ + int i1Q1t; + //T* operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1 s1Q1; + s1Q1-> + i; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1t1<T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1u> s1Q1t1u; + s1Q1t1u. + i1Q1t; + s1Q1t1u-> + i1Q1u; + /*T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER z1Q1_; + z1Q1_-> + i;*/ + T_TDC_INTERFACE_PRIMITIVE_UNION_POINTER<T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Q1> z1Q1; + z1Q1. + x; + z1Q1-> + i; +} +#else +#endif + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R +{ + int i1R; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1R s1R; + s1R-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/// \defgroup T_TDC_DESCRIPTOR T_TDC_DESCRIPTOR +/// base classes to repeat stuff that is similar in many descriptor classes +//---------------------------------------------------------------------------- +//\{ + +struct T_TDC_DESCRIPTOR_ARRAY_BASE:T_TDC_DESCRIPTOR_BASE +{ + int tap_handle; + int implement_get_tap_array_handle (unsigned c_elements, T_TDC_DESCRIPTOR_BASE* sdu_handle); + int get_tap_array_handle (unsigned c_elements); + bool skip_to_end; + virtual T_TDC_IS_ENUM is (); + virtual void set_skip_to_end (bool skip_to_end_); + virtual bool get_skip_to_end (); + T_TDC_DESCRIPTOR_ARRAY_BASE (); + virtual char* get_name () const; + ~T_TDC_DESCRIPTOR_ARRAY_BASE (); + T_TDC_HANDLE_BASE** get_elements(); + unsigned get_c_elements(); + void set_c_elements(unsigned c_elements); + T_TDC_HANDLE_BASE* make_element (unsigned index); + T_TDC_HANDLE_BASE* get_element (unsigned index); +}; + +template<class T, int MAX_INDEX = 1> +struct T_TDC_DESCRIPTOR_ARRAY:T_TDC_DESCRIPTOR_ARRAY_BASE +{ + typedef T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX> T_DESCRIPTOR_ARRAY; + friend T_TDC_DESCRIPTOR_BASE * new_T_DESCRIPTOR_ARRAY(void) + { + return new T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX>; + } + unsigned c_elements; + typedef T T_ELEMENT; + T_ELEMENT* elements; + T_TDC_DESCRIPTOR_ARRAY() + { + c_elements = 0; + elements = 0; + } + virtual int get_tap_handle () + { + return get_tap_array_handle (c_elements); + } + #ifndef TDC_TEST_PROFILE + virtual long get_sizeof () + { + /* this function should never be called but the base version have no chance of returning a proper value so we keep it just in case */ + TDC_DYNAMIC_DEAD_CODE(); + return sizeof *this; + } + #endif +}; + +struct T_TDC_HANDLE_ARRAY_BASE:T_TDC_HANDLE_BASE +{ + virtual char* get_name () const; + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_ARRAY; + } +}; + +template<class T, int MAX_INDEX = 1> +struct T_TDC_HANDLE_ARRAY:T_TDC_HANDLE_ARRAY_BASE +{ + typedef T_TDC_DESCRIPTOR_ARRAY<T, MAX_INDEX> T_DESCRIPTOR_ARRAY; + virtual long get_sizeof () + { + return sizeof *this; + } + M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_DESCRIPTOR_ARRAY) +protected: + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; +}; + +#if DOT_COMPLETE +#else +// the dot complete compiler can not handle this code +template<class T, int MAX_INDEX> +T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_ARRAY<T, MAX_INDEX>::implement_new_descriptor(void) const +{ + //return new T_DESCRIPTOR_ARRAY; + /*TODO: We don't allways need the element array and the code was once remove + but it seems like there are still problems with code like: + T_ARRAY<T_S8> parray_ps8c; + parray_ps8c[0]. _require; + */ + T_DESCRIPTOR_ARRAY *descriptor = new T_DESCRIPTOR_ARRAY; + /*T_TDC_HANDLE_BASE** elements = ((T_TDC_DESCRIPTOR_ARRAY_BASE*)descriptor)->get_elements(); + if (!*elements) + //*elements = new_handle (); + *elements = T::implement_new_handle();*/ + return descriptor; +} +#endif + +#ifdef TDC_SIMULATE_POINTER +#define T_TDC_DESCRIPTOR_POINTER T_TDC_DESCRIPTOR_ARRAY +#define T_TDC_HANDLE_POINTER T_TDC_HANDLE_ARRAY +#else + +struct T_TDC_DESCRIPTOR_POINTER_BASE:T_TDC_DESCRIPTOR_BASE +{ + virtual T_TDC_IS_ENUM is (); + virtual char* get_name () const; + T_TDC_HANDLE_BASE** get_elements(); + virtual T_TDC_HANDLE_BASE* get_element (unsigned index); + virtual int get_tap_handle (); + //virtual int read_ctrl () const; +}; + +template<class T /*T_HANDLE*/> struct T_TDC_DESCRIPTOR_POINTER:T_TDC_DESCRIPTOR_POINTER_BASE +{ + typedef T_TDC_DESCRIPTOR_POINTER<T> T_DESCRIPTOR_POINTER; + friend T_TDC_DESCRIPTOR_BASE * new_T_DESCRIPTOR_POINTER(void) + { + return new T_TDC_DESCRIPTOR_POINTER<T, MAX_INDEX>; + } + //T::T_DESCRIPTOR element; + T* element; + //T element; + #ifndef TDC_TEST_PROFILE + virtual long get_sizeof () + { + /* this function should never be called but the base version have no chance of returning a proper value so we keep it just in case */ + TDC_DYNAMIC_DEAD_CODE(); + return sizeof *this; + } + #endif +}; + +struct T_TDC_HANDLE_POINTER_BASE:T_TDC_HANDLE_BASE +{ + virtual char* get_name () const; + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_POINTER; + } + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; +}; + +template<class T> struct T_TDC_HANDLE_POINTER:T_TDC_HANDLE_POINTER_BASE +{ + typedef T_TDC_DESCRIPTOR_POINTER<T> T_DESCRIPTOR_POINTER; + virtual long get_sizeof () + { + return sizeof *this; + } + M_TDC_DESCRIPTOR_HANDLE_ADDITIONAL_PART (T_DESCRIPTOR_POINTER) +protected: + virtual T_TDC_DESCRIPTOR_BASE* implement_new_descriptor () const; +}; + +#if DOT_COMPLETE +#else +// the dot complete compiler can not handle this code +template<class T> +T_TDC_DESCRIPTOR_BASE* T_TDC_HANDLE_POINTER<T>::implement_new_descriptor(void) const +{ + return new T_DESCRIPTOR_POINTER; +} +#endif + +#endif + +//---------------------------------------------------------------------------- + +struct T_TDC_DESCRIPTOR_MAIN_BASE:T_TDC_DESCRIPTOR_BASE +{ + virtual int get_id () const + TDC_PURE_BODY( + return 0; + ) + T_TDC_HANDLE_BASE* get_element (unsigned index) + { + char *first_element = (char*) this + sizeof *this; + return implement_get_element (index, first_element); + } +}; + +struct T_TDC_DESCRIPTOR_XSTRUCT_BASE:T_TDC_DESCRIPTOR_BASE +{ + int tap_handle; + int get_tap_xstruct_handle (T_TDC_TABLE_KIND table_kind); + T_TDC_DESCRIPTOR_XSTRUCT_BASE (); + ~T_TDC_DESCRIPTOR_XSTRUCT_BASE (); + T_TDC_HANDLE_BASE* get_element (unsigned index); +}; + +struct T_TDC_DESCRIPTOR_INT_BASE:T_TDC_HANDLE_BASE +{ + virtual int get_tap_handle (); +}; + +//----- + +struct T_TDC_DESCRIPTOR_PRIM_BASE:T_TDC_DESCRIPTOR_MAIN_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS_PRIM); + } +}; + +struct T_TDC_DESCRIPTOR_PSTRUCT_BASE:T_TDC_DESCRIPTOR_XSTRUCT_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_STRUCT; + } + virtual int get_tap_handle (); +}; + +struct T_TDC_DESCRIPTOR_PUNION_BASE:T_TDC_DESCRIPTOR_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_UNION; + } +}; + +struct T_TDC_DESCRIPTOR_SDU_BASE:T_TDC_DESCRIPTOR_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_SDU; + } + virtual int get_tap_handle () + { + return TDC_DUMMY_TAP_HANDLE; + } + void invoke_tap (T_TDC_EVENT_ENUM event) const; +}; + +struct T_TDC_DESCRIPTOR_PENUM_BASE:T_TDC_HANDLE_BASE +{ + virtual int get_tap_handle (); + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_PVAR; + } +}; + +//----- + +struct T_TDC_DESCRIPTOR_MSG_BASE:T_TDC_DESCRIPTOR_MAIN_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return T_TDC_IS_ENUM (TDC_IS_COMP | TDC_IS_MSG); + } +}; + +struct T_TDC_DESCRIPTOR_MSTRUCT_BASE:T_TDC_DESCRIPTOR_XSTRUCT_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_STRUCT; + } + virtual int get_tap_handle (); +}; + +struct T_TDC_DESCRIPTOR_MUNION_BASE:T_TDC_DESCRIPTOR_BASE +{ + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_UNION; + } +}; + +struct T_TDC_DESCRIPTOR_MENUM_BASE:T_TDC_HANDLE_BASE +{ + virtual int get_tap_handle (); + virtual T_TDC_IS_ENUM is () + { + return TDC_IS_MVAR; + } +}; + +//----- + +struct T_TDC_DESCRIPTOR_XXX_PRIMITIVE_UNION_BASE:T_TDC_DESCRIPTOR_BASE +{ +}; + +struct T_TDC_DESCRIPTOR_XXX_MESSAGE_UNION_BASE:T_TDC_DESCRIPTOR_BASE +{ +}; + +struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION_BASE:T_TDC_DESCRIPTOR_BASE +{ +}; + +struct T_TDC_DESCRIPTOR_MESSAGE_UNION_BASE:T_TDC_DESCRIPTOR_BASE +{ + //TODO: construct munions (when called from make_element_info, shold be hamless in get_element_info) +}; + +//\} + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S +{ + int i1S; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1S s1S; + s1S-> + i0; +} +#else +#endif + +//---------------------------------------------------------------------------- +/// \defgroup T_TDC_INSTANCE T_TDC_INSTANCE +/// base classes to repeat stuff that is similar in many instance classes +//---------------------------------------------------------------------------- +///\{ + +struct T_TDC_INSTANCE_BASE +{ +//private: + T_TDC_HANDLE_BASE* implement_get_handle () const; + void implement_set_handle(T_TDC_HANDLE_BASE* handle); +//protected: + virtual T_TDC_INTERFACE_BASE *new_interface () const; +//public: + T_TDC_INTERFACE_BASE *get_navigation () const; +//protected: + T_TDC_INTERFACE_BASE *get_element_navigation (int index) const; +//public: + T_TDC_INTERFACE_BASE *make_element_navigation (int index, T_TDC_NEW_HANDLE new_element_handle); + T_TDC_HANDLE_BASE* get_descriptor_ref () const; + T_TDC_ASSIGN_ACTION set_action(const T_TDC_ACTION& action_); + void set_value (const T_TDC_INSTANCE_BASE& value_); + void copy_instance (const T_TDC_INSTANCE_BASE * value_); + void copy_interface (const T_TDC_INTERFACE_BASE * value_); + T_TDC_ASSIGN_ACTION construct_from_action(const T_TDC_ACTION& action_, T_TDC_NEW_HANDLE new_handle); + void construct_from_instance (const T_TDC_INSTANCE_BASE& value_, T_TDC_NEW_HANDLE new_handle); + void construct_from_interface (const T_TDC_INTERFACE_BASE * value_, T_TDC_NEW_HANDLE new_handle); + void set_descriptor_value (long value_); + long get_descriptor_value (); + bool cmp_descriptor_value (long value_); + void construct_from_number (long value_, T_TDC_NEW_HANDLE new_handle); + void destroy_handle (); + T_TDC_HANDLE_BASE* construct_handle (T_TDC_NEW_HANDLE new_handle); + T_TDC_HANDLE_BASE* construct_array_handle (T_TDC_NEW_HANDLE new_handle,T_TDC_NEW_HANDLE new_element_handle); + T_TDC_DESCRIPTOR_BASE* construct_descriptor (T_TDC_NEW_HANDLE new_handle); + T_TDC_DESCRIPTOR_BASE* construct_array_descriptor (T_TDC_NEW_HANDLE new_handle,T_TDC_NEW_HANDLE new_element_handle); + T_TDC_INSTANCE_BASE(); + ~T_TDC_INSTANCE_BASE(); +private: + ///Check for copy constructor missing in class derived from T_TDC_INSTANCE_BASE + T_TDC_INSTANCE_BASE(const T_TDC_INSTANCE_BASE&); +}; + +struct T_TDC_INSTANCE_MAIN_BASE:T_TDC_INSTANCE_BASE +{ + void set_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_); + void set_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_); + void construct_main_value (const T_TDC_INTERFACE_MAIN_BASE* value_, T_TDC_NEW_HANDLE new_handle); + void construct_main_value (const T_TDC_INSTANCE_MAIN_BASE* value_, T_TDC_NEW_HANDLE new_handle); +}; + +struct T_TDC_INSTANCE_PART_BASE +#if DOT_COMPLETE +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_BASE) +#endif +{ +}; + +struct T_TDC_INSTANCE_PRIMITIVE_BASE +#if DOT_COMPLETE +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_MAIN_BASE) +#endif +{ +#if DOT_COMPLETE +#else + TDC_DOT_COMPLETE_HIDE(void invoke_tap (T_TDC_EVENT_ENUM) const;) +#endif +}; + +struct T_TDC_INSTANCE_MESSAGE_BASE +#if DOT_COMPLETE +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_MAIN_BASE) +#endif +{ +}; + +struct T_TDC_INSTANCE_PRIM_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE +{ +}; + +struct T_TDC_INSTANCE_PSTRUCT_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_PUNION_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_SDU_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_PENUM_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_MSG_BASE:T_TDC_INSTANCE_MESSAGE_BASE +{ +}; + +struct T_TDC_INSTANCE_MSTRUCT_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_MUNION_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_MENUM_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_INT_BASE:T_TDC_INSTANCE_PART_BASE +{ +}; + +struct T_TDC_INSTANCE_XXX_PRIMITIVE_UNION_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE +{ +}; + +struct T_TDC_INSTANCE_XXX_MESSAGE_UNION_BASE:T_TDC_INSTANCE_MESSAGE_BASE +{ +}; + +struct T_TDC_INSTANCE_PRIMITIVE_UNION_BASE:T_TDC_INSTANCE_PRIMITIVE_BASE +{ +}; + +struct T_TDC_INSTANCE_MESSAGE_UNION_BASE:T_TDC_INSTANCE_MESSAGE_BASE +{ +}; + +//---------------------------------------------------------------------------- + +struct T_TDC_INSTANCE_ARRAY_BASE +#if DOT_COMPLETE +#else + TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_BASE) +#endif +{ +#if DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION _skip () {} /* you can use '= SKIP' as well */ + T_TDC_ASSIGN_ACTION _show () {} /* you can use '= SHOW' as well */ + T_TDC_ASSIGN_ACTION _forbid () {} /* you can use '= FORBID' as well */ + T_TDC_ASSIGN_ACTION _require () {} /* you can use '= REQUIRE' as well */ +#else//DOT_COMPLETE_MEMBERS + T_TDC_ASSIGN_ACTION tdc_skip (); /* you can use '= SKIP' as well */ + T_TDC_ASSIGN_ACTION tdc_show (); /* you can use '= SHOW' as well */ + T_TDC_ASSIGN_ACTION tdc_forbid (); /* you can use '= FORBID' as well */ + T_TDC_ASSIGN_ACTION tdc_require (); /* you can use '= REQUIRE' as well */ + /*T_ARRAY operator = (const T_TDC_ACTION& action_) + { + set_action (action_); + return *this; + }*/ +#endif//DOT_COMPLETE_MEMBERS +}; + +#if DOT_COMPLETE +template<class T /*T_INSTANCE*/, int DUMMY> struct T_ARRAY +#else +template<class T /*T_INSTANCE*/> struct T_ARRAY +#endif + :T_TDC_INSTANCE_ARRAY_BASE +{ + T::T_INTERFACE& operator [] (int index_) + { + return *(T::T_INTERFACE*)make_element_navigation(index_,T::implement_new_handle); + } + /* + T::T_INTERFACE& operator -> () + { + return *(T::T_INTERFACE*)get_element_navigation(0); + } + */ +#if DOT_COMPLETE +#else + typedef T_TDC_HANDLE_ARRAY<T::T_HANDLE> T_HANDLE; + T_HANDLE* handle; + friend T_TDC_HANDLE_BASE* new_T_HANDLE()\ + { + return new T_HANDLE;//(T::implement_new_handle); + } + T_ARRAY operator = (const T_ARRAY& value_) + { + set_value (value_); + return *this; + } + T_ARRAY () + { + construct_array_handle(new_T_HANDLE,T::implement_new_handle); + } + ~T_ARRAY () + { + destroy_handle(); + } + // T_ARRAY (const T_ARRAY<T>& u1) => ambiguous call to overloaded function + void assign (const T_ARRAY<T>& array, unsigned size, void* address) + { + construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + T_TDC_COPY(handle).copy_descriptor_ref (array.handle); + } + template<class U1> void assign (const U1* array, unsigned size, void* address) + { + tdc_check_array_assignment(array, address); + int count = size / sizeof *array; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element = descriptor->make_element(i); + element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); + } + } + void assign (const T_TDC_ACTION& action_, unsigned size, void *address) + { + construct_from_action (action_, new_T_HANDLE); + } + /*T_ARRAY (const T_ARRAY& array) //ambiguous call to overloaded function + { + assign (array, sizeof array, (void*)&array); + }*/ + template<class U1> T_ARRAY (const U1& array) + { + assign (array, sizeof array, (void*)&array); + } + template<class U1> T_ARRAY (const U1& u1, T_TDC_ACTION action) + { + const T* array = u1; + int count = sizeof u1 / sizeof *u1; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + descriptor->set_skip_to_end_from_action (action.action); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element = descriptor->make_element(i); + element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); + } + } + template<class U1> T_ARRAY (const U1& u1, T_TDC_CREATE_ACTION action) + { + const T* array = u1; + int count = sizeof u1 / sizeof *u1; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + descriptor->set_skip_to_end_from_action (action.action); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element = descriptor->make_element(i); + element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); + } + } + template<class U1, class U2> T_ARRAY (const U1& u1, const U2& u2) + { + tdc_tbd_array_assignment_error_T_ARRAY(); + } + /* + template<class U1, class U2, class U3> T_ARRAY (U1 u1, U2 u2, U3 u3) + { + TDC_TBD(); + } + template<class U1, class U2, class U3, class U4> T_ARRAY (U1 u1, U2 u2, U3 u3, U4 u4) + { + TDC_TBD(); + } + template<class U1, class U2, class U3, class U4, class U5> T_ARRAY (U1 u1, U2 u2, U3 u3, U4 u4, U5 u5) + { + TDC_TBD(); + } + */ + virtual T_TDC_INTERFACE_BASE *new_interface () const + { + return new T::T_INTERFACE; + } +#endif +}; + + +#define M_TDC_BASIC_ARRAY(T_BASIC)\ + T_ARRAY ()\ + {\ + /*construct_handle(new_T_HANDLE);*/\ + }\ + template<class U1>\ + T_ARRAY (const U1& array, T_TDC_ACTION action)\ + {\ + assign (array, sizeof array, (void*)&array, action);\ + }\ + template<class U1>\ + T_ARRAY (const U1& array)\ + {\ + assign (array, sizeof array, (void*)&array, TDC_ACTION_UNKNOWN);\ + }\ + T_ARRAY operator = (const T_ARRAY& value_)\ + {\ + set_value (value_);\ + return *this;\ + }\ + T_ARRAY operator = (const T_TDC_ACTION& action_)\ + {\ + construct_from_action (action_,new_T_HANDLE);\ + return *this;\ + }\ + +template<class T, class T_BASIC> struct T_TDC_INSTANCE_BASIC_ARRAY:T_TDC_INSTANCE_ARRAY_BASE +{ + typedef T_TDC_HANDLE_ARRAY<T::T_HANDLE> T_HANDLE; + T_HANDLE* handle; + static T_TDC_HANDLE_BASE* new_T_HANDLE()\ + { + return new T_HANDLE;//(T::implement_new_handle); + } + T_TDC_INSTANCE_BASIC_ARRAY () + { + construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + } + void assign (const T_BASIC* array, unsigned size, void* address, T_TDC_ACTION action) + { + tdc_check_array_assignment(array, address); + unsigned count = size / sizeof T_BASIC; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + descriptor->set_skip_to_end_from_action (action.action); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element= descriptor->make_element(i); + element.copy_number (array[i]); + } + } + void assign (const T_BASIC* array, unsigned size, void* address, T_TDC_CREATE_ACTION action) + { + tdc_check_array_assignment(array, address); + unsigned count = size / sizeof T_BASIC; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + descriptor->set_skip_to_end_from_action (action.action); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element= descriptor->make_element(i); + element.copy_number (array[i]); + } + } + void assign (const T_ARRAY<T>& array, unsigned size, void* address) + { + construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + T_TDC_COPY(handle).copy_descriptor_ref (array.handle); + } + template<class U1> void assign (const U1* array, unsigned size, void* address) + { + tdc_check_array_assignment(array, address); + int count = size / sizeof *array; + T_TDC_DESCRIPTOR_BASE* descriptor = construct_array_descriptor(new_T_HANDLE,T::implement_new_handle); + for (int i = 0; i < count; i++) + { + T_TDC_COPY element = descriptor->make_element(i); + element.copy_descriptor_ref ((T_TDC_HANDLE_BASE*) array[i].handle); + } + } + void assign (const T_TDC_ACTION& action_, unsigned size, void *address) + { + construct_from_action (action_, new_T_HANDLE); + } + void assign (const T_ARRAY<T_BASIC>& array, unsigned size, void* address, T_TDC_ACTION action) + { + construct_from_instance(array,new_T_HANDLE); + } + T::T_INTERFACE& operator [] (int index_) + { + return *(T::T_INTERFACE*)get_element_navigation(index_); + } + virtual T_TDC_INTERFACE_BASE *new_interface () const + { + return new T::T_INTERFACE; + } +}; + +//\} + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W +{ + int i1W; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W s1W; + s1W-> + i0; +} +#else +#endif + +//============================================================================ +/// \defgroup BuildInTypes build in types +//============================================================================ +//\{ + +//#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_FORWARD_INT (U8))) +M_TDC_FORWARD_INT (U8) +M_TDC_FORWARD_INT (S8) +M_TDC_FORWARD_INT (U16) +M_TDC_FORWARD_INT (S16) +M_TDC_FORWARD_INT (U32) +M_TDC_FORWARD_INT (S32) + +M_TDC_FORWARD_PSTRUCT (raw) +M_TDC_FORWARD_PSTRUCT (aim) +M_TDC_FORWARD_COMP (MESSAGE_UNION,TDC_IS_MESSAGE_UNION) + +//M_TDC_FORWARD_MSTRUCT(COMP_STENCIL) +M_TDC_FORWARD_BASE(COMP_STENCIL, T_TDC_HANDLE_COMP_STENCIL) +M_TDC_HANDLE(M_TDC_IN_CLASS,M_TDC_WITHOUT_BODY,COMP_STENCIL,TDC_IS_COMP) + +#ifndef TDC_DOT_COMPLETE_HIDE_PROTOTYPES +struct T_PRIMITIVE_UNION; +struct T_TDC_INTERFACE_PRIMITIVE_UNION; +struct T_TDC_DESCRIPTOR_PRIMITIVE_UNION; +struct T_TDC_HANDLE_PRIMITIVE_UNION; +T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_PRIMITIVE_UNION(); + +struct T_MESSAGE_UNION; +struct T_TDC_INTERFACE_MESSAGE_UNION; +struct T_TDC_DESCRIPTOR_MESSAGE_UNION; +struct T_TDC_HANDLE_MESSAGE_UNION; +T_TDC_HANDLE_BASE* new_T_TDC_HANDLE_MESSAGE_UNION(); +#endif + +struct T_TDC_DESCRIPTOR_S8:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (S8) +}; + +struct T_TDC_DESCRIPTOR_U8:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (U8) +}; + +struct T_TDC_DESCRIPTOR_S16:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (S16) +}; + +struct T_TDC_DESCRIPTOR_U16:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (U16) +}; + +struct T_TDC_DESCRIPTOR_S32:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (S32) +}; + +struct T_TDC_DESCRIPTOR_U32:T_TDC_DESCRIPTOR_INT_BASE +{ + M_TDC_DESCRIPTOR_INT_ADDITIONAL (U32) +}; + +struct T_TDC_DESCRIPTOR_raw:T_TDC_DESCRIPTOR_PSTRUCT_BASE +{ + M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL (raw) + T_TDC_HANDLE_U16 l_buf; + T_TDC_HANDLE_U16 o_buf; + T_TDC_HANDLE_ARRAY<T_TDC_DESCRIPTOR_U8> buf; + virtual int get_tap_handle (); +}; + +struct T_TDC_DESCRIPTOR_COMP_STENCIL:T_TDC_DESCRIPTOR_MSTRUCT_BASE +{ + M_TDC_DESCRIPTOR_MSTRUCT_ADDITIONAL (COMP_STENCIL) +}; + +struct T_TDC_DESCRIPTOR_VAR_STENCIL:T_TDC_DESCRIPTOR_MENUM_BASE +{ + typedef long T_TDC_ENUM_VAR_STENCIL; + M_TDC_DESCRIPTOR_MENUM_ADDITIONAL (VAR_STENCIL) +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1 +{ + int i1W1; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W1 s1W1; + s1W1-> + i0; +} +#else +#endif + + +typedef T_TDC_DESCRIPTOR_ARRAY<T_TDC_HANDLE_COMP_STENCIL> T_TDC_DESCRIPTOR_ARRAY_STENCIL; +typedef T_TDC_DESCRIPTOR_POINTER<T_TDC_HANDLE_COMP_STENCIL> T_TDC_DESCRIPTOR_POINTER_STENCIL; +typedef T_TDC_HANDLE_POINTER<T_TDC_HANDLE_COMP_STENCIL> T_TDC_HANDLE_POINTER_STENCIL; + + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4 +{ + int i1W4; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W4 s1W4; + s1W4-> + i0; +} +#else +#endif + +#if !defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5 +{ + int i1W5; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W5 s1W5; + s1W5-> + i0; +} +#else +#endif + +struct T_U8:T_TDC_INSTANCE_INT_BASE +{ +//enable pragma line to see expanded version of macro in list file +//#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_INSTANCE_INT_ADDITIONAL (U8))) + M_TDC_INSTANCE_INT_ADDITIONAL (U8) + T_TDC_INTERFACE_U8* operator-> (); +}; +struct T_TDC_INTERFACE_U8:T_TDC_INTERFACE_INT_BASE +{ +//enable pragma line to see expanded version of macro in list file +//#pragma M_TDC_MESSAGE (M_TDC_STRING(M_TDC_INTERFACE_INT_ADDITIONAL (U8))) + M_TDC_INTERFACE_INT_ADDITIONAL (U8) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_U8, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6 +{ + int i1W6; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W6 s1W6; + s1W6-> + i0; +} +#else +#endif + +struct T_S8:T_TDC_INSTANCE_INT_BASE +{ + M_TDC_INSTANCE_INT_ADDITIONAL (S8) + T_TDC_INTERFACE_S8* operator-> (); +}; +struct T_TDC_INTERFACE_S8:T_TDC_INTERFACE_INT_BASE +{ + M_TDC_INTERFACE_INT_ADDITIONAL (S8) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_S8, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +struct T_U16:T_TDC_INSTANCE_INT_BASE +{ + M_TDC_INSTANCE_INT_ADDITIONAL (U16) + T_TDC_INTERFACE_U16* operator-> (); +}; +struct T_TDC_INTERFACE_U16:T_TDC_INTERFACE_INT_BASE +{ + M_TDC_INTERFACE_INT_ADDITIONAL (U16) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_U16, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +struct T_S16:T_TDC_INSTANCE_INT_BASE +{ + M_TDC_INSTANCE_INT_ADDITIONAL (S16) + T_TDC_INTERFACE_S16* operator-> (); +}; +struct T_TDC_INTERFACE_S16:T_TDC_INTERFACE_INT_BASE +{ + M_TDC_INTERFACE_INT_ADDITIONAL (S16) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_S16, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +struct T_U32:T_TDC_INSTANCE_INT_BASE +{ + M_TDC_INSTANCE_INT_ADDITIONAL (U32) + T_TDC_INTERFACE_U32* operator-> (); +}; +struct T_TDC_INTERFACE_U32:T_TDC_INTERFACE_INT_BASE +{ + M_TDC_INTERFACE_INT_ADDITIONAL (U32) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_U32, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +struct T_S32:T_TDC_INSTANCE_INT_BASE +{ + M_TDC_INSTANCE_INT_ADDITIONAL (S32) + T_TDC_INTERFACE_S32* operator-> (); +}; +struct T_TDC_INTERFACE_S32:T_TDC_INTERFACE_INT_BASE +{ + M_TDC_INTERFACE_INT_ADDITIONAL (S32) +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_S32, ___dummy__basic_type_have_no_members; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +struct T_raw:T_TDC_INSTANCE_PSTRUCT_BASE +{ + M_TDC_INSTANCE_PSTRUCT_ADDITIONAL (raw,raw) + T_TDC_INTERFACE_raw* operator-> (); +}; +struct T_TDC_INTERFACE_raw:T_TDC_INTERFACE_PSTRUCT_BASE +{ + M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (raw,raw) + T_TDC_INTERFACE_U16 l_buf; //number of valid bits + T_TDC_INTERFACE_U16 o_buf; //offset of first valid bit + T_TDC_INTERFACE_ARRAY<T_TDC_INTERFACE_U8> buf; //array size = (o_buf + l_buf + 7) /8 +#ifdef TDC_TYPE_NAME_COMPLETE + struct T_TDC_TYPE_NAME { char T_raw, ___l_buf___o_buf___buf; } _type_name () M_TDC_TYPE_NAME_COMPLETE //HINT: ??? press CTRL + SHIFT + Q to create a reference to this variable +#endif +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9 +{ + int i1W9; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9 s1W9; + s1W9-> + i0; +} +#else +#endif + +struct T_COMP_STENCIL:T_TDC_INSTANCE_MSTRUCT_BASE +{ + /*void copy_instance (const T_TDC_INSTANCE_BASE * value_) + { + TDC_INTERNAL_ERROR(); + }*/ + M_TDC_INSTANCE_MSTRUCT_ADDITIONAL (COMP_STENCIL,COMP_STENCIL) +}; +struct T_TDC_INTERFACE_COMP_STENCIL:T_TDC_INTERFACE_MSTRUCT_BASE +{ + M_TDC_INTERFACE_MSTRUCT_ADDITIONAL (COMP_STENCIL,COMP_STENCIL) +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9 +{ + int i1W9A9; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9A9 s1W9A9; + s1W9A9-> + i0; +} +#else +#endif + +#ifndef TDC_DOT_COMPLETE_SOURCE_INSIGHT +/** + allocation call tree: + function defined in + T_PRIMITIVE_UNION() tdc_base.h + T_PRIMITIVE_UNION + M_TDC_INSTANCE_ADDITIONAL_BASE + construct_handle(new_T_TDC_HANDLE_PRIMITIVE_UNION) tdc.cpp + T_TDC_INSTANCE_BASE + new_T_TDC_HANDLE_PRIMITIVE_UNION ??? global + ??? + implement_new_handle () tdc_lib_main_dsc.cpp virtual in T_TDC_HANDLE_PRIMITIVE_UNION + M_TDC_POST_COMP + M_TDC_POST_DESCRIPTOR_COMP + M_TDC_HANDLE_ADDITIONAL + new T_TDC_HANDLE_PRIMITIVE_UNION() not explicit declared + T_TDC_HANDLE_BASE () tdc_dsc.cpp + implement_set_action(TDC_ACTION_DEFAULT) tdc_dsc.cpp + + T_PRIMITIVE_UNION + + make_descriptor() tdc.cpp + implement_new_descriptor () tdc.cpp + new T_TDC_DESCRIPTOR_PRIMITIVE_UNION tdc_lib_main_dsc.cpp + M_TDC_POST_COMP + M_TDC_POST_DESCRIPTOR_COMP + + + */ +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B +{ + int i1W9B; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s-> + i0; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B s1W9B; + s1W9B-> + i0; +} +#else +#endif + +struct T_PRIMITIVE_UNION + TDC_DOT_COMPLETE_HIDE(:T_TDC_INSTANCE_PRIMITIVE_UNION_BASE) +{ + TDC_DOT_COMPLETE_HIDE(M_TDC_INSTANCE_PRIMITIVE_ADDITIONAL ()) + T_TDC_INTERFACE_PRIMITIVE_UNION* operator-> (); +}; + +struct T_MESSAGE_UNION:T_TDC_INSTANCE_MESSAGE_UNION_BASE +{ + TDC_DOT_COMPLETE_HIDE(M_TDC_INSTANCE_MESSAGE_ADDITIONAL ()) + T_TDC_INTERFACE_MESSAGE_UNION* operator-> (); +}; + +#if TDC_DEBUG_DOT_COMPLETE +struct T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B +{ + int i1W9B; + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 operator->(){return 0;} +}; +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1W9B() +{ + T_PRIMITIVE_UNION primitive_union; + primitive_union-> XX_TDC_1; +} +#else +#endif + +#else +typedef T_TDC_INTERFACE_PRIMITIVE_UNION* T_PRIMITIVE_UNION; +typedef T_TDC_INTERFACE_MESSAGE_UNION* T_MESSAGE_UNION; +#endif + +//---------------------------------------------------------------------------- + +//#if TDC_DOT_COMPLETE +//#else +template<> struct T_ARRAY<U8>:T_TDC_INSTANCE_BASIC_ARRAY<T_U8, U8> +{ + M_TDC_BASIC_ARRAY(U8) +}; + +template<> struct T_ARRAY<S8>:T_TDC_INSTANCE_BASIC_ARRAY<T_S8, S8> +{ + M_TDC_BASIC_ARRAY(S8) +}; + +template<> struct T_ARRAY<U16>:T_TDC_INSTANCE_BASIC_ARRAY<T_U16, U16> +{ + M_TDC_BASIC_ARRAY(U16) +}; + +template<> struct T_ARRAY<S16>:T_TDC_INSTANCE_BASIC_ARRAY<T_S16, S16> +{ + M_TDC_BASIC_ARRAY(S16) +}; + +template<> struct T_ARRAY<U32>:T_TDC_INSTANCE_BASIC_ARRAY<T_U32, U32> +{ + M_TDC_BASIC_ARRAY(U32) +}; + +template<> struct T_ARRAY<S32>:T_TDC_INSTANCE_BASIC_ARRAY<T_S32, S32> +{ + M_TDC_BASIC_ARRAY(S32) +}; +//#endif + +#endif //!defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE + +//\} + +//============================================================================ +// types used by dynamic part +//============================================================================ + +struct T_TDC_AWAIT_CONTEXT; +struct T_TDC_SEND_CONTEXT; +struct T_TDC_AWAIT; + +#ifdef DOT_COMPLETE +struct T_ON{}; +#endif + +//============================================================================ + +enum T_TDC_JMPRET +{ + TDC_JMPRET_SETJMP = 0, //setjmp is hard coded to return 0 + TDC_JMPRET_INITIAL = 1, + TDC_JMPRET_FAIL = 2, + TDC_JMPRET_PASS = 3, + TDC_JMPRET_BAD_BREAK = 4, + TDC_JMPRET_CASE_PASS = 5, + TDC_JMPRET_STEP_PASS = 6, + TDC_JMPRET_ON_PASS = 7, + TDC_JMPRET_ON_TEST = 8, + TDC_JMPRET_ALT_ENTER = 9, + TDC_JMPRET_OTHERWISE_PASS = 10, + TDC_JMPRET_OTHERWISE_PARK = 11, + TDC_JMPRET_TRAP_PASS = 12, + TDC_JMPRET_POPED = 13, + TDC_JMPRET_USER_ERROR = 14, + TDC_JMPRET_INTERNAL_ERROR = 15, + TDC_JMPRET_TAP_EXCLUDED = 16 +}; + +enum T_TDC_CONTEXT +{ + TDC_CONTEXT_UNKNOWN, + TDC_CONTEXT_FUNCTION, + TDC_CONTEXT_CASE, + TDC_CONTEXT_STEP, + TDC_CONTEXT_ALT, + TDC_CONTEXT_ON, + TDC_CONTEXT_OTHERWISE, + TDC_CONTEXT_TRAP +}; + +struct T_TDC_DYNAMIC_CONTEXT_DATA +{ + T_TDC_DYNAMIC_CONTEXT_DATA* parent; + jmp_buf mark; + T_TDC_DYNAMIC_CONTEXT_DATA* prev; + T_TDC_JMPRET jmpret; + char* file; + int line; + int event; + bool testing; + char *text; + int destroy_on_fail_handles_count; + T_TDC_CONTEXT context; + T_TDC_HANDLE_BASE** destroy_on_fail_handles; + void add_destroy_on_fail (T_TDC_HANDLE_BASE* handle); + void remove_destroy_on_fail (T_TDC_HANDLE_BASE* handle); + T_TDC_DYNAMIC_CONTEXT_DATA* pop (); + T_TDC_DYNAMIC_CONTEXT_DATA (T_TDC_CONTEXT + context_, T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); + ~T_TDC_DYNAMIC_CONTEXT_DATA(); + void jmp(T_TDC_JMPRET jmpret_); +}; + +struct T_TDC_CONTEXT_BASE +{ +}; + +struct T_TDC_FUNCTION_CONTEXT:T_TDC_CONTEXT_BASE //the name of this type is contructed to give more info from error message +{ + /* + Got this error? + error C2039: 'tdc_alt_context' : is not a member of 'T_TDC_FUNCTION_CONTEXT' + you are violating the following rules: + + "ON(...)...;" and "OTHERWISE()...;" must be inside an "ALT{...}" + + TODO: test above statement + */ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_function_context; //this member name is contructed to give more info from error message + T_TDC_FUNCTION_CONTEXT (char* file_, int line_); +}; + +struct T_TDC_USER_ERROR_CASE_BASE +{ + // for testing TDC only + unsigned int failed; +}; + +struct T_TDC_CASE +{ + /** \struct T_TDC_CASE + this type can not have constructor or member functions as it virolate 'extern "C"' in T_CASE macro + + this type should only contain one member so that if returned from a function with '__declspec(dllexport)' + it will be returned in the same way as if such a function returned int, returning an int is what tap2.exe + expect + + from an internal tdc point of view there is no difference between a function of type T_CASE and one of + type T_TDC_CASE, this is used in some tdc_test test cases + + founctions of type T_CASE (T_TDC_CASE) should not have explicit returns instead they should contain + a BEGIN_CASE(...) which will make an implicit return (return is hidden inside macro); + */ + unsigned int passed; +}; + +struct T_TDC_CASE_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; + T_TDC_CASE_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); + void tdc_end_for (); + bool tdc_do_return (); + void prepare_exit (int exit_code, char *message); + T_TDC_CASE tdc_return_value (); + T_TDC_USER_ERROR_CASE_BASE tdc_user_error_return_value (); +}; + +struct T_TDC_only_one__BEGIN_CASE__allowed_per_function:T_TDC_CONTEXT_BASE +{ + /* TODO: wrong text type name should say it all + Got this error? + error C2039: 'tdc_alt_context' : is not a member of 'T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT' + + you are violating one of the following rules: + A) + "ON(...)...;" cannot follow "OTHERWISE()...;" + + B) + "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" + e.g. ALT{... ON(AWAIT(...))...; ...} + C) + "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be + inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" + + remember to use curly parantheses "{...}" when the body contain more than one command + */ + T_TDC_DYNAMIC_CONTEXT_DATA* parent; + T_TDC_only_one__BEGIN_CASE__allowed_per_function (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); +}; + +/// return of a step +struct T_STEP +{ + T_STEP () + { + //nothing + } +}; + +struct T_TDC_STEP_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; + T_TDC_STEP_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_, char* text_); + void tdc_end_for (); + bool tdc_do_return (); + T_STEP tdc_return_value (); +}; + +struct T_TDC_only_one__BEGIN_STEP__allowed_per_function:T_TDC_CONTEXT_BASE +{ + /* TODO: wrong text type name should say it all + Got this error? + error C2039: 'tdc_alt_context' : is not a member of 'T_TDC_only_one__BEGIN_STEP__allowed_per_function' + + you are violating one of the following rules: + A) + "ON(...)...;" cannot follow "OTHERWISE()...;" + + B) + "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" + e.g. ALT{... ON(AWAIT(...))...; ...} + C) + "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be + inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" + + remember to use curly parantheses "{...}" when the body contain more than one command + */ + T_TDC_DYNAMIC_CONTEXT_DATA* parent; + T_TDC_only_one__BEGIN_STEP__allowed_per_function (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); +}; + +struct T_TDC_ALT_CONTEXT:T_TDC_CONTEXT_BASE +{ + /* + Got this error? + error C2039: 'tdc_not_alt_context' : is not a member of 'T_TDC_ALT_CONTEXT' + + you are violating one of the following rules: + A) + "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" + e.g. ALT{... ON(AWAIT(...))...; ...} + B) + "FAIL()", "PASS()", "SEND(...)", "ALT{...}" are not allowed inside "ALT{...}" they must be + inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" + + remember to use curly parantheses "{...}" when the body contain more than one command + */ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_alt_context; + T_TDC_ALT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_); + void tdc_end_for(); + bool tdc_enter_for(); +}; + +struct T_TDC_ON_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; + T_TDC_ON_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_, char* text_); + void tdc_end_for (); + bool tdc_enter_for(); + bool tdc_on_expects_await(T_TDC_AWAIT& await_); +}; + +struct T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT:T_TDC_CONTEXT_BASE +{ + /* + Got this error? + error C2039: 'tdc_alt_context' : is not a member of 'T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT' + + you are violating one of the following rules: + A) + "ON(...)...;" cannot follow "OTHERWISE()...;" + + B) + "AWAIT(...)" is not allow in side "ALT{...}" enclose it with an "ON(...)" + e.g. ALT{... ON(AWAIT(...))...; ...} + C) + "FAIL()", "PASS()", "SEND(...)" are not allowed inside "ALT{...}" they must be + inside the body of an "ON(AWAIT(something))...;" or "OTHERWISE()...;" + + remember to use curly parantheses "{...}" when the body contain more than one command + */ + T_TDC_DYNAMIC_CONTEXT_DATA* parent; + T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_); +}; + +struct T_TDC_OTHERWISE_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; + T_TDC_OTHERWISE_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA* parent_, char* file_, int line_); + void tdc_end_for (); + bool tdc_enter_for (); +}; + +struct T_TDC_TRAP_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_DYNAMIC_CONTEXT_DATA tdc_not_alt_context; + T_TDC_TRAP_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent_, char* file_, int line_); + void tdc_end_for (); + bool tdc_trap_testing (); + bool tdc_initial (); + bool tdc_enter_for (); +}; + +struct T_TDC_EVENT_CONTEXT:T_TDC_CONTEXT_BASE +{ + T_TDC_EVENT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* text_, char* primitive_); + T_TDC_EVENT_CONTEXT (); +}; + +//============================================================================ + +#ifdef TDC_PORT +struct T_PORT +{ + T_PORT operator +(T_PORT& port); // be aware: ("x->y","z") + ("a->b","c") != ("x;a->y;b","z;c") +#if DOT_COMPLETE + T_ON AWAIT (T_PRIMITIVE_UNION primitive){} + void SEND (T_PRIMITIVE_UNION primitive){} +#else//DOT_COMPLETE + char* src_list; + char* dst_list; + char* sap_list; + bool is_send_port; // -> or <-> was specified + bool is_await_port;// <- or <-> was specified + T_PORT* next; // used when 2 or more ports have been linked together with operator + + void construct(char* src_and_dst_list, char* sap_list_); + T_PORT (char* src_and_dst_list, char* sap_list_); + T_PORT (char* src_and_dst_list); + T_PORT (T_PORT& port,T_PORT* port2=0); + ~T_PORT (); + T_TDC_AWAIT_CONTEXT tdc_await_context(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); + T_TDC_SEND_CONTEXT tdc_send_context(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#endif//DOT_COMPLETE +}; + +extern T_PORT DEFAULT_PORT; +#endif + +//============================================================================ +/// \defgroup AWAIT +//\{ + +/// Special values that can be awaited for the sake of testing TDC +enum T_TDC_AWAIT_TESTING { + TDC_AWAIT_FAIL, /// Hardcode AWAIT to fail + TDC_AWAIT_PASS, /// Hardcode AWAIT to pass + TDC_AWAIT_FORCE_PASS, +}; + +#if DOT_COMPLETE +int TDC_AWAIT_FAIL; +int TDC_AWAIT_PASS; +int TDC_AWAIT_FORCE_PASS; +#endif + +///What an AWAIT returns +struct T_TDC_AWAIT +{ + T_TDC_AWAIT(); +private: + template<class T> T_TDC_AWAIT operator, (T) + { + tdc_user_error ("AWAIT can not be part of a comma expression"); // should be courth compiletime as this function is private + return T_TDC_AWAIT (); + } +}; + +struct T_TDC_AWAIT_CONTEXT:T_TDC_EVENT_CONTEXT +{ + friend T_TDC_AWAIT_CONTEXT tdc_await_context (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#ifdef TDC_PORT + T_TDC_AWAIT_CONTEXT (T_PORT* port_, T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#else + T_TDC_AWAIT_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#endif + ~T_TDC_AWAIT_CONTEXT (); + T_TDC_AWAIT tdc_implement_await (T_TDC_AWAIT_TESTING pass_or_fail); + T_TDC_AWAIT tdc_implement_await (const T_TDC_INSTANCE_PRIMITIVE_BASE& primitive); + template<class T> T_TDC_AWAIT tdc_implement_await (T (*f) ()) + { + T primitive = f (); + return tdc_implement_await (primitive); + } + template<class T> T_TDC_AWAIT tdc_implement_await (void (*f) (T)) + { + T primitive; + f (primitive); + return tdc_implement_await (primitive); + } +}; + +//\} + +//---------------------------------------------------------------------------- +/// \defgroup SEND +//\{ + +struct T_TDC_SEND_CONTEXT + :T_TDC_EVENT_CONTEXT +{ + friend T_TDC_SEND_CONTEXT tdc_send_context (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#ifdef TDC_PORT + T_TDC_SEND_CONTEXT (T_PORT* port_, T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#else + T_TDC_SEND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_, char* primitive_); +#endif + ~T_TDC_SEND_CONTEXT (); + void tdc_implement_send (T_TDC_AWAIT_TESTING pass_or_fail); + void tdc_implement_send (const T_TDC_INSTANCE_PRIMITIVE_BASE& primitive); + template<class T>void tdc_implement_send (T (*f) ()) + { + T primitive = f (); + return tdc_implement_send (primitive); + } + template<class T>void tdc_implement_send (void (*f) (T)) + { + T primitive; + f (primitive); + return tdc_implement_send (primitive); + } +}; + +//\} + +//---------------------------------------------------------------------------- +/// \defgroup COMMAND COMMAND +//\{ + +///What a COMMAND returns +struct T_TDC_COMMAND +{ + T_TDC_COMMAND (); +private: + ///Hides ',' operator for COMMANDS + template<class T> + T_TDC_COMMAND operator, (T) + { + tdc_user_error ("COMMAND can not be part of comma expression"); // should be courth compiletime as this function is private + return T_TDC_COMMAND(); + } +}; + +struct T_TDC_COMMAND_CONTEXT:T_TDC_EVENT_CONTEXT +{ + T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_); + T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_, char* command_); + T_TDC_COMMAND_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* text_, char* value_text_, long value_); + T_TDC_COMMAND operator || (T_TDC_COMMAND& command_); +}; + +//\} + +/// \defgroup PARKING PARKING Command +//\{ + +enum T_TDC_PARKING_ENUM /// Values should be indentical to those defined in tap_int.h +{ + DISABLE = 0, + SHORT_TERM = 1, + LONG_TERM = 2, + SHORT_TERM_FAIL = 3, + LONG_TERM_FAIL = 4 +}; + +struct T_TDC_PARKING_CONTEXT:private T_TDC_COMMAND_CONTEXT +{ + T_TDC_PARKING_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* value_text_, T_TDC_PARKING_ENUM value_); + T_TDC_PARKING_CONTEXT (T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_,int line_, char* value_text_, bool value_); + T_TDC_PARKING_ENUM operator || (T_TDC_PARKING_ENUM value_); +}; + +//\} + +//============================================================================ + +extern T_TDC_FUNCTION_CONTEXT tdc_syntax_context; + +extern T_TDC_DYNAMIC_CONTEXT_DATA* tdc_dynamic_context; + +//---------------------------------------------------------------------------- + +extern void tdc_implement_fail(T_TDC_JMPRET jmpret); + +extern void tdc_implement_user_fail(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_); + +extern void tdc_implement_pass(); + +extern void tdc_implement_user_pass(T_TDC_DYNAMIC_CONTEXT_DATA& parent, char* file_, int line_); + +//---------------------------------------------------------------------------- + +extern T_TDC_COMMAND tdc_implement_command (const char* text); + +extern T_TDC_COMMAND tdc_implement_timeout (int time); + +extern T_TDC_COMMAND tdc_implement_mute (int time); + +extern T_TDC_COMMAND tdc_implement_start_timeout (int time); + +extern T_TDC_COMMAND tdc_implement_wait_timeout (); + +extern T_TDC_PARKING_ENUM tdc_implement_parking (T_TDC_PARKING_ENUM enabled); +extern T_TDC_PARKING_ENUM tdc_implement_parking (bool enabled); + +//============================================================================ + +#endif //TDC_TESTING + +//============================================================================ +/// \defgroup TryCatchProtection +//\{ + +/** + map try, catch and throw to our version that prevent the user from using them + by having both a plain and a "tdc_implement_..." version it is faily simple + temporary to disable the mapping through #undef when need be + this is some thing that the user should never do, but tdc have to, so the debugger + see our longjmps as exceptions + + //TODO: do this stuff debugger see longjumps as exceptions +*/ + +/// try, catch and throw conflicts with longjmp in vc6, use TRAP +#define try tdc_implement_try +/// try, catch and throw conflicts with longjmp in vc6, use ELSE +#define catch(exception) tdc_implement_catch(exception) +/// try, catch and throw conflicts with longjmp in vc6, use FAIL or PASS +#define throw tdc_implement_throw + +/// try, catch and throw conflicts with longjmp in vc6, use TRAP +#define tdc_implement_try while(tdc_try_disabled) +/// try, catch and throw conflicts with longjmp in vc6, use ELSE +#define tdc_implement_catch(exception) while(tdc_catch_disabled) +/// try, catch and throw conflicts with longjmp in vc6, use FAIL or PASS +#define tdc_implement_throw while(tdc_throw_disabled)throw + +//\} +//---------------------------------------------------------------------------- + +#if DOT_COMPLETE //DOT_COMPLETE_PROTOTYPES +#ifndef M_TDC_DOC //we don't want theses to occour twice in the call graph + +// dummy functions to generate hint in dot-complete (e.g. when pressing <ctrl-shift-space> ) +// remember that functions must have a body to be considered for dot-completion by Visual Studio + +void FAIL (void){} + +void PASS (void){} + +void SEND (T_PRIMITIVE_UNION primitive){} + +T_ON AWAIT (T_PRIMITIVE_UNION primitive){} + +void COMMAND (char* command_string){} + +void TIMEOUT (int timeout){} + +void START_TIMEOUT (int timeout){} + +void WAIT_TIMEOUT (){} + +void MUTE (int timeout){} + +T_TDC_PARKING_ENUM PARKING (T_TDC_PARKING_ENUM enable){} + +T_similar_syntax_as_while_statement BEGIN_CASE (char* trace_comment){} + +T_similar_syntax_as_while_statement BEGIN_STEP (char* trace_comment){} + +T_similar_syntax_as_while_statement ON (T_AWAIT){} + +T_similar_syntax_as_while_statement OTHERWISE (){} + +#endif//M_TDC_DOC +#else//DOT_COMPLETE_PROTOTYPES + +// real implementation + +/* + special constructions used in these macros: + + ensure that only a ; is allowed after this macro + do {...} while(0) + + make variable declared in for(...) private to the statements ({...} or ...;) after this macro + if(0);else + + make implicit return at exit of loop (x might be replace by more code in the actual macros) + for (int x=0;;x=1) if (x) return ...; else +*/ + +#define FAIL() do {tdc_implement_user_fail (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__); } while (0) + +#define PASS() do {tdc_implement_user_pass (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__); } while (0) + +#define SEND(primitive) tdc_send_context(tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #primitive).tdc_implement_send(T_PRIMITIVE_UNION(primitive)) + +#define AWAIT(primitive) tdc_await_context(tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #primitive).tdc_implement_await(T_PRIMITIVE_UNION(primitive)) + +#define START_TIMEOUT(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "START_TIMEOUT", #timeout, timeout) || tdc_implement_start_timeout(timeout)) + +#ifdef WAIT_TIMEOUT +#undef WAIT_TIMEOUT /* To avoid class with defined macro in winbase.h */ +#endif +#define WAIT_TIMEOUT() (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "WAIT_TIMEOUT") || tdc_implement_wait_timeout()) + +#define MUTE(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, "MUTE", #timeout, timeout) || tdc_implement_mute(timeout)) + +#define COMMAND(command) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #command) || tdc_implement_command(command)) + +#define TIMEOUT(timeout) (T_TDC_COMMAND_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #timeout) || tdc_implement_timeout(timeout)) + +#define PARKING(enable) (T_TDC_PARKING_CONTEXT (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__, #enable, enable) || tdc_implement_parking(enable)) + +// some short cuts where user forgot '()' after '_skip' etc. + +#define _skip tdc_skip() +#define _show tdc_show() +#define _forbid tdc_forbid() +#define _require tdc_require() +#define _skip_to_end tdc_skip_to_end() + +#define _SKIP tdc_skip() +#define _SHOW tdc_show() +#define _FORBID tdc_forbid() +#define _REQUIRE tdc_require() +#define _SKIP_TO_END tdc_skip_to_end() + +#endif//DOT_COMPLETE_PROTOTYPES + +#define M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE true + +/** \defgroup BEGIN_CASE BEGIN_CASE(){} + Usage: + <pre> + T_CASE casename () + { + BEGIN_CASE ("trace_comment") + { + ... + } + } + </pre> +*/ +//\{ + +/// return type for a test CASE +#define T_CASE \ + extern "C" __declspec(dllexport) T_TDC_CASE + +/** \def T_TDC_USER_ERROR_CASE + Test cases defined with T_TDC_USER_ERROR_CASE + are cases that passes when they fail and fails when they passes, + this is only intended for testing TDC it self. + T_TDC_USER_ERROR_CASE will not reverse the result of a syntax error. + + <pre> + Usage: + T_TDC_USER_ERROR_CASE casename () + { + TDC_BEGIN_USER_ERROR_CASE ("trace_comment") + { + ... + } + } + </pre> +*/ + +/// return type for a test USER ERROR CASE +#define T_TDC_USER_ERROR_CASE\ + extern "C" __declspec(dllexport) T_TDC_USER_ERROR_CASE_BASE + +/// stuff common to BEGIN_CASE and TDC_BEGIN_USER_ERROR_CASE +#define M_TDC_BEGIN_CASE_BASE(trace_comment,return_value)\ + T_TDC_only_one__BEGIN_CASE__allowed_per_function tdc_begin_case (tdc_syntax_context.tdc_function_context);\ + if(0);else/*hide tdc_syntax_context after for body*/\ + for (T_TDC_CASE_CONTEXT tdc_context (tdc_begin_case.parent,__FILE__,__LINE__,trace_comment),\ + &tdc_syntax_context = ((tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark))),tdc_context);\ + M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE;\ + tdc_context.tdc_end_for ())\ + if (tdc_context.tdc_do_return ())\ + return tdc_context.return_value ();\ + else + +/// BEGIN_CASE should be the outermost scope in a CASE +#define BEGIN_CASE(trace_comment)\ + M_TDC_BEGIN_CASE_BASE(trace_comment,tdc_return_value) + +/// TDC_BEGIN_USER_ERROR_CASE a BEGIN_CASE for T_TDC_USER_ERROR_CASE +#define TDC_BEGIN_USER_ERROR_CASE(trace_comment)\ + M_TDC_BEGIN_CASE_BASE(trace_comment,tdc_user_error_return_value) + +//\} + +/** \defgroup BEGIN_STEP BEGIN_STEP(){} +<pre> + Usage: + T_STEP stepname (...) + { + BEGIN_STEP ("trace_comment") + { + ... + } + } +</pre> +*/ +//\{ + +//TODO: move functionality from tdc_context to tdc_begin_step and delete tdc_context +#define BEGIN_STEP(trace_comment)\ + T_TDC_only_one__BEGIN_STEP__allowed_per_function tdc_begin_step (tdc_syntax_context.tdc_function_context), &tdc_syntax_context = tdc_begin_step;\ + if (0); else\ + for (T_TDC_STEP_CONTEXT tdc_context (tdc_begin_step.parent,__FILE__,__LINE__,trace_comment),\ + &tdc_syntax_context = ((tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark))),tdc_context);\ + M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE;\ + tdc_context.tdc_end_for ())\ + if (tdc_context.tdc_do_return ())\ + return tdc_context.tdc_return_value ();\ + else + +//\} + +/** \defgroup TRAP_ONFAIL TRAP{} & ONFAIL{} +<pre> + Usage: + TRAP + { + ... + FAIL(); + } + ONFAIL + { + ... + } +</pre> +*/ +//\{ + +#define TRAP\ + if (0); else\ + for (T_TDC_TRAP_CONTEXT tdc_context (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__);\ + tdc_context.tdc_initial () && \ + (tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark)),\ + tdc_context.tdc_enter_for ());\ + )\ + if (tdc_context.tdc_trap_testing ())\ + for (T_TDC_TRAP_CONTEXT &tdc_syntax_context = tdc_context; ; tdc_syntax_context.tdc_end_for()) + +#ifdef M_TDC_DOC +#define ONFAIL() //Soure Insight will only draw call gaphs if "()" is present +#else +#define ONFAIL else // we don't want to do something special here, as we can't ensure warning on a plain else +#endif + +//\} + +/** \defgroup ALT_ON_OTHERWISE ALT{}, ON() & OTHERWISE() +<pre> + Usage: + ALT + { + ON (AWAIT (...)) ...; + ON (AWAIT (...)) ...; + ON (AWAIT (...)) ...; + OTHERWISE () ...; + } +</pre> +*/ +//\{ + +#define ALT\ + if (0); else\ + for (T_TDC_ALT_CONTEXT tdc_context (tdc_syntax_context.tdc_not_alt_context, __FILE__, __LINE__), &tdc_syntax_context = tdc_context;\ + tdc_context.tdc_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_alt_context.mark)),\ + tdc_context.tdc_enter_for ();\ + tdc_context.tdc_end_for ()) + +#define ON(await)\ + if (0); else\ + for (T_TDC_ON_CONTEXT tdc_context (tdc_syntax_context.tdc_alt_context,__FILE__,__LINE__,#await), &tdc_syntax_context = tdc_context;\ + tdc_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_context.tdc_not_alt_context.mark)),\ + tdc_context.tdc_enter_for () && tdc_context.tdc_on_expects_await (await);\ + tdc_context.tdc_end_for ()) + +#define OTHERWISE()\ + T_TDC__OTHERWISE__MUST_BE_LAST_IN_ALT tdc_otherwise (tdc_syntax_context.tdc_alt_context), &tdc_syntax_context = tdc_otherwise;\ + if (0); else\ + for (T_TDC_OTHERWISE_CONTEXT tdc_syntax_context (tdc_otherwise.parent, __FILE__, __LINE__);\ + tdc_syntax_context.tdc_not_alt_context.jmpret = T_TDC_JMPRET (setjmp (tdc_syntax_context.tdc_not_alt_context.mark)),\ + tdc_syntax_context.tdc_enter_for (), M_TDC_COMMAND_MUST_BE_LAST_IN_SCOPE ;\ + tdc_syntax_context.tdc_end_for ()) + +//\} + +//============================================================================ + +#if TDC_DEBUG_DOT_COMPLETE +void F_TDC_DEBUG_DOT_COMPLETE__TDC_H_1Z() +{ + T_TDC_DEBUG_DOT_COMPLETE__TDC_H_1 s; + s. + i; + s->i0; + T_TDC_INTERFACE_ARRAY<int> i; + i. +} +#else +#endif + +//============================================================================ + +#endif //TDC_BASE_H + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tdc_msg.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,357 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : TDC ++----------------------------------------------------------------------------- +| 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 : ++----------------------------------------------------------------------------- +*/ + +#ifdef TDC_H +#error "TDC.H already included, TDC.H must come after all primitives and messages" +#endif + +#ifndef TDC_MSG_H +#define TDC_MSG_H + +#if DOT_COMPLETE_DEFINES + +//---------------------------------------------------------------------------- +// macros to repeat stuff that is similar in many interface classes +//---------------------------------------------------------------------------- + +#define M_TDC_INTERFACE_PRIM_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_PSTRUCT_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_PUNION_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_SDU_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_PENUM_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_PINT_ADDITIONAL(INT_NAME, SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_MSG_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_MSTRUCT_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_MUNION_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_MENUM_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_MINT_ADDITIONAL(INT_NAME, SHORT_NAME) + +//----- + +#define M_TDC_INTERFACE_INT_ADDITIONAL(SHORT_NAME) + +#define M_TDC_INTERFACE_XXX_PRIMITIVE_UNION_ADDITIONAL(SAP) + +#define M_TDC_INTERFACE_XXX_MESSAGE_UNION_ADDITIONAL(MSG) + +#define M_TDC_CREATE_DEFAULT_PRIMITIVE_INTERFACE_CLASS(SAP) + +#define M_TDC_INTERFACE_PRIMITIVE_ADDITIONAL() + +#define M_TDC_INTERFACE_PRIMITIVE_ELEMENT_ADDITIONAL(SAP) + +#define M_TDC_CREATE_DEFAULT_MESSAGE_INTERFACE_CLASS(MSG) + +#define M_TDC_INTERFACE_MESSAGE_ADDITIONAL() + +#define M_TDC_INTERFACE_MESSAGE_ELEMENT_ADDITIONAL(MSG) + +#else +#endif + +#include "tdc_base.h" + +#ifndef TDC_DESCRIPTOR +#include "message.h" +#include "primitive.h" +#else +#include "message_dsc.h" +#include "primitive_dsc.h" +#endif + +struct T_TDC_INTERFACE_U8; + +//TODO: eliminate need for these types used by M_RR (this is a bug work around) +typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_AVG_W; +typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_AVG_T; +typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_AVG_W; +typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_AVG_T; +//TODO: eliminate need for these types used by M_GRR (this is a bug work around) +typedef T_TDC_HANDLE_U8 T_TDC_HANDLE_RESEL; +typedef T_TDC_INTERFACE_U8 T_TDC_INTERFACE_RESEL; + +typedef struct T_TDC_HANDLE_TEST_var4 T_TDC_HANDLE_TEST_var4T; +typedef struct T_TDC_HANDLE_TEST_enum4 T_TDC_HANDLE_TEST_enum4T; + +M_TDC_FORWARD_SDU (sdu) +struct T_TDC_DESCRIPTOR_sdu; +struct T_TDC_HANDLE_sdu; +struct T_TDC_INTERFACE_sdu; +struct T_sdu; +typedef T_TDC_HANDLE_sdu T_TDC_HANDLE_SDU; +typedef T_TDC_DESCRIPTOR_sdu T_TDC_DESCRIPTOR_SDU; +typedef T_TDC_INTERFACE_sdu T_TDC_INTERFACE_SDU; +typedef T_sdu T_TDC_INSTANCE_SDU; + + + +///\todo make some sencible stuff here +struct T_TDC_HANDLE_desc_list +{ + int dummy_to_keep_doxygen_happy; +}; + +///\todo make some sencible stuff here +struct T_TDC_HANDLE_desc +{ + int dummy_to_keep_doxygen_happy; +}; + +///\todo make some sencible stuff here +struct T_TDC_INTERFACE_desc_list +{ + int dummy_to_keep_doxygen_happy; +}; + +///\todo make some sencible stuff here +struct T_TDC_INTERFACE_desc +{ + int dummy_to_keep_doxygen_happy; +}; + + + +#ifdef TDC_DESCRIPTOR + +/*M_TDC_FORWARD_PSTRUCT(raw) +M_TDC_FORWARD_PSTRUCT(aim) +M_TDC_FORWARD_PSTRUCT(sdu)*/ + +struct T_TDC_DESCRIPTOR_aim:T_TDC_DESCRIPTOR_PSTRUCT_BASE +{ + M_TDC_DESCRIPTOR_PSTRUCT_ADDITIONAL (aim) + T_TDC_HANDLE_U8 ti; + T_TDC_HANDLE_U8 tie; + T_TDC_HANDLE_U8 nsd; + T_TDC_HANDLE_MESSAGE_UNION entity; +}; + +struct T_TDC_DESCRIPTOR_sdu:T_TDC_DESCRIPTOR_SDU_BASE +{ + M_TDC_DESCRIPTOR_SDU_ADDITIONAL (sdu) + T_TDC_HANDLE_raw raw; //manual sdu + T_TDC_HANDLE_aim aim; //coded sdu +}; + +#endif + +#if !defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE + +struct T_aim:T_TDC_INSTANCE_PSTRUCT_BASE +{ + M_TDC_INSTANCE_PSTRUCT_ADDITIONAL (aim,aim) + T_TDC_INTERFACE_aim* operator-> (); +}; +struct T_TDC_INTERFACE_aim:T_TDC_INTERFACE_PSTRUCT_BASE +{ + M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (aim,aim) + T_TDC_INTERFACE_U8 ti; + T_TDC_INTERFACE_U8 tie; + T_TDC_INTERFACE_U8 nsd; + T_TDC_INTERFACE_MESSAGE_UNION entity; +#ifdef TDC_TYPE_NAME_COMPLETE + struct { char T_aim, ___ti___tie___nsd___entiy; } _type_name (); +#endif +}; + +struct T_sdu:T_TDC_INSTANCE_SDU_BASE +{ + M_TDC_INSTANCE_SDU_ADDITIONAL (sdu) + T_sdu(const T_MESSAGE_UNION& msg); + T_sdu(const T_TDC_INSTANCE_MSG_BASE& msg); + T_TDC_INTERFACE_sdu* operator-> (); +}; +struct T_TDC_INTERFACE_sdu:T_TDC_INTERFACE_SDU_BASE +{ + M_TDC_INTERFACE_PSTRUCT_ADDITIONAL (sdu,sdu) + T_TDC_INTERFACE_raw raw; //manual sdu + T_TDC_INTERFACE_aim aim; //coded sdu +#ifdef TDC_TYPE_NAME_COMPLETE + struct { char T_sdu, ___raw___aim; } _type_name (); +#endif +}; +inline T_sdu::T_sdu(const T_MESSAGE_UNION& msg) +{ + construct(); + (*this)->aim.entity=msg; +} +inline T_sdu::T_sdu(const T_TDC_INSTANCE_MSG_BASE& msg) +{ + construct(); + (*this)->aim.entity=msg; +} + + +#endif //!defined TDC_DESCRIPTOR || defined TDC_PRECOMPILE + +//============================================================================ +template <class T> +T_sdu tds_array_to_sdu(const T& U8array) +//This function is a temporary solution to help the convertion from TDS U8 arrays to TDC SDU's. +{ + T_sdu sdu; + sdu->raw.l_buf = U8array[0] + U8array[1] * 256; + sdu->raw.o_buf = U8array[2] + U8array[3] * 256; + if (sizeof(U8array)>4) + { + for (int i = 4; i < sizeof(U8array);i++) + { + sdu->raw.buf[i-4] = U8array[i]; + } + } + else + { + sdu->raw.buf = T_ARRAY<U8>(); + } + return sdu; +} +//============================================================================ +template <class T> +T_sdu BIN(const T& U8array) +{ + T_sdu sdu; + int i=0,bit=0,l_buf=0; + U8 temp=0; + + while(U8array[i] != '\0') + { + if(U8array[i] == 0x20) //(0x20 is space) + { + if(bit != 0) + tdc_user_error("BIN(): There is not 8 bits between spaces!"); + } + else + { + switch(U8array[i]) + { + case 0x31: //(0x31 ascii code for 1) + temp += 1<<(7-bit); + break; + + case 0x30: //(0x30 ascii code for 0) + break; + + default: + tdc_user_error("BIN(): string character neither '0' or '1': %c",U8array[i]); + break; + } + bit ++; + if(bit == 8) + { + sdu->raw.buf[l_buf/8] = temp; + temp = 0; + bit=0; + } + l_buf++; + } + i++; + } + if(bit != 0) //if the number of bits is not a multiplum of 8 the last few bits will be assigned here + { + sdu->raw.buf[l_buf/8] = temp; + } + + sdu->raw.l_buf=l_buf; + sdu->raw.o_buf=0; + return sdu; +} + +template <class T> +T_sdu HEX(const T& U8array) +{ + T_sdu sdu; + int i = 0, nibble = 0, l_buf = 0; + U8 temp = 0; + + while(U8array[i] != '\0') + { + if(U8array[i] == 0x20) //(0x20 is space) + { + if(nibble != 0) + tdc_user_error("HEX(): There is not 2 nibbles between spaces!"); + } + else + { + if(('0' <= U8array[i]) && (U8array[i] <= '9')) + { + temp += (U8array[i] - 0x30) << (4*(1-nibble)); + } + else if(('A' <= U8array[i]) && (U8array[i] <= 'F')) + { + temp += (U8array[i] - 0x37) << (4*(1-nibble)); + } + else if(('a' <= U8array[i]) && (U8array[i] <= 'f')) + { + temp += (U8array[i] - 0x57) << (4*(1-nibble)); + } + else + { + tdc_user_error("HEX(): String character not a HEX number: %c",U8array[i]); + } + nibble ++; + if(nibble == 2) + { + sdu->raw.buf[l_buf/8] = temp; + temp = 0; + nibble = 0; + } + l_buf += 4; + } + i++; + } + + if(nibble != 0) //checks whether the number of nibbles are odd. IF THIS SHOULD BE MADE LEGAL + { //remove the '//' in front of the line above and comment out the error function call! + tdc_user_error("HEX(): Odd number of nibbles (hex numbers)"); + //sdu->raw.buf[l_buf/8]=temp; + } + sdu->raw.l_buf = l_buf; + sdu->raw.o_buf = 0; + return sdu; +} + +template <class T> +T_sdu CHR(const T& U8array) +{ + T_sdu sdu; + int i=0; + while(U8array[i] != '\0') + { + sdu->raw.buf[i]= (U8)U8array[i]; + i++; + } + sdu->raw.l_buf=8*i; + sdu->raw.o_buf=0; + return sdu; +} + +#endif //TDC_MSG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tdc_prim.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,34 @@ +/* ++----------------------------------------------------------------------------- +| Project : +| Modul : TDC ++----------------------------------------------------------------------------- +| 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 : ++----------------------------------------------------------------------------- +*/ + +#ifdef TDC_H +#error "TDC.H already included, TDC.H must come after all primitives and messages" +#endif + +#ifndef TDC_PRIM_H +#define TDC_PRIM_H + +#include "tdc_base.h" +#include "tdc_msg.h" + +#define TDC_PRIM_H_BODY + +#endif //TDC_PRIM_H +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tok.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,53 @@ +/* ++------------------------------------------------------------------------------ +| File: tok.h ++------------------------------------------------------------------------------ +| 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 configuration string functions. ++------------------------------------------------------------------------------ +*/ + + +#ifndef __TOK_H__ +#define __TOK_H__ + +/*==== CONSTANTS ==================================================*/ + +#define TOK_ERRBASE (-300) +#define TOK_OK (0) +#define TOK_EOCS (TOK_ERRBASE - 1) +#define TOK_NOT_FOUND (TOK_ERRBASE - 2) + +/*==== TYPES ======================================================*/ + +typedef struct KW_DATA +{ + const char * const keyword; + const SHORT code; +} KW_DATA; + +typedef struct TOK_DCB +{ + char * tokbuf; + char * nexttok; + char lastchar; +} TOK_DCB; + +/*==== EXPORT =====================================================*/ + +void tok_init (char *); +SHORT tok_next (char **, char **); +SHORT tok_key (KW_DATA *, char *); + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tools.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,43 @@ +/* ++------------------------------------------------------------------------------ +| File: tools.h ++------------------------------------------------------------------------------ +| 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 and prototypes. ++----------------------------------------------------------------------------- +*/ + +#ifndef __TOOLS_H__ +#define __TOOLS_H__ + +/*==== INCLUDES =============================================================*/ + +/*==== CONSTS ===============================================================*/ + +#define CHARS_FOR_8BIT 2 +#define CHARS_FOR_16BIT 4 +#define CHARS_FOR_32BIT 8 + +/*==== TYPES ================================================================*/ + + +/*==== PROTOTYPES ===========================================================*/ + +unsigned int GetNextToken (char *source, char *token, char const *seperators); +char *HexToASCII (ULONG value, char *ptr, int num); +unsigned int ASCIIToHex (char *p, int num); +char* InsertString (char *string, char *p, int num); +char *rm_path ( const char *file ); + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tst_mux.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,53 @@ +/* ++------------------------------------------------------------------------------ +| File: tst_mux.h ++------------------------------------------------------------------------------ +| 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 : Prototypes for TST multiplexer access ++----------------------------------------------------------------------------- +*/ + +#ifndef TST_MUX_H +#define TST_MUX_H + +/*==== INCLUDES =============================================================*/ + + +/*==== CONSTS ===============================================================*/ + +/* channels for ETM */ +#define MAX_TST_CHANNEL 2 + +#define MAX_TST_MUX_CMD_LEN 512 + +/*==== TYPES ================================================================*/ + +typedef struct +{ + U8 channel_id; + void * rcv_data_ptr; + int rcv_data_size; + void (*rcv_callback)(void *,int); + T_HANDLE drv_handle; + void * send_data; +} T_TST_MUX_CHANNEL; + +/*==== PROTOTYPES ===========================================================*/ + +int tst_mux_send ( U8 id, void * buffer, int size ); +int tst_mux_register ( U8 id, void (*callback)(void * buffer, int size)); +int tst_mux_init ( void ); +void tst_mux_callback( U8 id, void * buffer, int size ); + + +#endif /* !TST_MUX_H.H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/tstheader.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,150 @@ +/* ++------------------------------------------------------------------------------ +| File: tstheader.h ++------------------------------------------------------------------------------ +| 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 TST internal header ++----------------------------------------------------------------------------- +*/ + +#ifndef TSTHEADER_H +#define TSTHEADER_H + +/*==== INCLUDES =============================================================*/ + +#include "tools.h" + +/*==== CONSTS ===============================================================*/ + +#ifdef CONNECT_2_PS +#define TOOLSIDE +#else +#define STACKSIDE +#endif + +#if defined STACKSIDE && defined _TARGET_ +#define TARGET_STACK +#endif + +#if defined STACKSIDE && !defined _TARGET_ +#define EMULATED_STACK +#endif + + +#define ID_OFFSET 0 +#define TIMESTAMP_OFFSET 1 +#define LENGTH_OFFSET 5 +#define SENDER_OFFSET 9 +#define RECEIVER_OFFSET 13 +#define DATA_OFFSET 17 + +#define ID_SUBTRACT 17 +#define TIMESTAMP_SUBTRACT 16 +#define LENGTH_SUBTRACT 12 +#define SENDER_SUBTRACT 8 +#define RECEIVER_SUBTRACT 4 +#define OPC_SUBTRACT 4 +#define DATA_SUBTRACT 0 + +#define PROT_PRIM_ID 'P' +#define PROT_PRIM_ID_32BIT 'Q' +#define SYS_PRIM_ID 'S' +#define TRACE_ID 'T' + +#define IDENT_PS_PRIM 0x10 /* former 'P' */ +#define IDENT_SYS_PRIM 0x30 /* former 'S' */ +#define IDENT_ABORT 0x00 /* former 'A' */ +#define IDENT_TRACE 0x20 /* former 'T' */ + + +#define HDR_VALID_VERSION_0 0x40 /* 01 OLD TST Header */ +#define HDR_VALID_VERSION_1 0x80 /* 10 NEW TST Header */ +#define HDR_VALID_VERSION_2 0x00 /* 00 reserved */ +#define HDR_VALID_VERSION_3 0xC0 /* 11 reserved */ + +#define HDR_TIME_MS 0x04 /* 01 ms Time Frame */ +#define HDR_TIME_TDMA 0x08 /* 10 TDMA Time Frame */ + +#define HDR_VERSION_MASK 0xc0 +#define HDR_IDENT_MASK 0x30 +#define HDR_TIME_MASK 0x0c +#define HDR_RESERVED_MASK 0x03 + +#define LOW_MASK 0xFF + +#define EMPTY_BYTE 0 +#define INFO_BYTE 1 +#define FIRST_BYTE 2 +#define SECOND_BYTE 3 + +#define TST_HEADER_LEADING_FIELDS 3 /* .info + .size */ +#define TST_HEADER_TRAILING_FIELDS 12 /* .time + .sender + .receiver */ +/* the .orgreceiver field will be added dynamically, if used */ + +/*==== TYPES =================================================================*/ +typedef struct +{ + UBYTE combined [4]; + unsigned long time; + char sender[4]; + char receiver[4]; +} TST_SMALL_HEADER; + +typedef struct +{ + UBYTE combined [4]; + unsigned long time; + char sender[4]; + char receiver[4]; + UCHAR trace_opc; +} TST_MED_HEADER; + +typedef struct +{ + UBYTE combined [4]; + unsigned long time; + char sender[4]; + char receiver[4]; + char orgreceiver[4]; + int opc; +} TST_BIG_HEADER; + +#define TST_SMALL_HEADER_SIZE (sizeof(TST_SMALL_HEADER) -1) +#define TST_BIG_HEADER_SIZE (sizeof(TST_BIG_HEADER) -1) + +#if defined (_LINUX_) || defined (_SOLARIS_) +#define PRIM_HEADER_FLAG 0x00000000 +#define PRIM_DATA_FLAG 0x00000000 +#define PRIM_FLAG_MASK 0x00000000 + +#define EXCHANGE_4BYTES_ENDIANESS(val_ptr) {\ + char c;\ + char *p = (char*) val_ptr;\ + c = p[0];\ + p[0] = p[3];\ + p[3] = c;\ + c = p[1];\ + p[1] = p[2];\ + p[2] = c;\ + } +#else +#define PRIM_HEADER_FLAG 0x40000000 +#define PRIM_DATA_FLAG 0x80000000 +#define PRIM_FLAG_MASK 0xc0000000 + +#define EXCHANGE_4BYTES_ENDIANESS(val_ptr) +#endif + +/*==== EXPORTS ===============================================================*/ + +#endif /* !TSTHEADER.H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/typedefs.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,160 @@ +/* ++------------------------------------------------------------------------------ +| File: typedefs.h ++------------------------------------------------------------------------------ +| 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 : Standard definitions. ++----------------------------------------------------------------------------- +*/ + +#ifndef __TYPEDEFS_H__ +#define __TYPEDEFS_H__ + +/*===== Include operating system specific type definitions ========*/ +#ifdef _VXWORKS_ + #include <vxWorks.h> +#endif + +#ifdef PSOS + #include <stdio.h> +#endif + +/*==== CONSTANTS ==================================================*/ + +#ifndef __INCvxWorksh +#define IMPORT EXTERN +#endif + +#ifndef __cplusplus + #define EXTERN extern +#else + #define EXTERN extern "C" +#endif +#define LOCAL static +#define GLOBAL +#define EXPORT GLOBAL + +/*lint -e723 supress Info -- Suspicious use of = */ +#define EQ == +/*lint +e723 */ +#define NEQ != +#define AND && +#define OR || +#define XOR(A,B) ((!(A) AND (B)) OR ((A) AND !(B))) + +#ifndef FALSE + #define FALSE 0 +#endif + +#ifndef TRUE + #define TRUE 1 +#endif + +#ifndef NULL + #define NULL 0 +#endif + +/*==== TYPES ======================================================*/ +#ifndef STDDEFS_H + typedef unsigned char U8; + typedef signed char S8; + typedef unsigned short U16; + typedef signed short S16; + typedef unsigned long U32; + typedef signed long S32; + typedef U32 MEMHANDLE; +/* + * UINT16 added for TI include files, to be removed ASAP + */ + +#ifndef GENERAL_H /* rivera include definitions are as ours */ +#ifndef __INCvxTypesOldh + #if !defined NUCLEUS || !defined PLUS_VERSION_COMP + /* UINT16 is already defined in the nucleus.h for the arm9 */ + typedef unsigned short UINT16; + #endif +#endif + + + typedef unsigned char UBYTE; + typedef short SHORT; + typedef UBYTE BYTE; + + #if !defined (NUCLEUS) + typedef char CHAR; + #endif + + /* the following construction assumes that we are on I86 using Windows. + It is introduced to avoid using WIN32 in GPF but keeping the compatibility with the + protocol stack + */ + #if defined WIN32 || defined _WIN32 + typedef int BOOL; + #else + #ifdef _VXWORKS_ + #ifndef __INCvxTypesOldh + typedef int BOOL; + #endif + #else + typedef UBYTE BOOL; + #endif + #endif + + + #ifndef _TYPES_H + #ifndef __INCvxTypesOldh + typedef unsigned char UCHAR; + typedef unsigned short USHORT; + typedef unsigned long ULONG; + typedef unsigned int UINT; + #endif + #endif + +#endif /* rivera include definitions are as ours */ + + typedef long LONG; + + typedef unsigned long T_VOID_STRUCT; + + typedef unsigned long T_ENUM; + +#endif + + +/*==== EXPORT =====================================================*/ + +#define MAXIMUM(A,B) (((A)>(B))?(A):(B)) + +#define MINIMUM(A,B) (((A)<(B))?(A):(B)) + +/* + * NOTE: This is necessary until all occurences of Sprintf() in the + * protocol stack (GSM and GPRS) have been replaced with sprintf(). + */ +#define Sprintf sprintf + + +/* + * NOTE: The following macros redefine the predefined macros of + * the TMS470 compiler. This is usefull for creating binary + * equivalent object files. These files can be used for the + * comparison of to builds e.g. BUSYB and g23.pl. + * + * This approach may not work with other compilers. + */ +#define TMS470_CDS "__NO_DATE__" +#define TMS470_CTS "__NO_TIME__" +#define TMS470_CFS "__NO_FILE__" + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gsm-fw/gpf/inc/vsi.h Thu Apr 10 04:06:05 2014 +0000 @@ -0,0 +1,839 @@ +/* ++------------------------------------------------------------------------------ +| File: vsi.h ++------------------------------------------------------------------------------ +| 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 Virtual System Interface. ++----------------------------------------------------------------------------- +*/ + +#ifndef VSI_H +#define VSI_H + +/*==== INCLUDES =============================================================*/ + +#include <stddef.h> +#include "header.h" +#include "gdi.h" +#include "drvconf.h" +#include "prf_func.h" + +/*==== CONSTANTS ===============================================================*/ + +#ifdef _TOOLS_ + #ifdef FRAME_DLL + #define DLL_IMPORT_DATA extern + #else /* FRAME_DLL*/ + #define DLL_IMPORT_DATA __declspec( dllimport ) + #endif /* FRAME_DLL*/ +#endif /* _TOOLS_ */ + +#ifdef MEMORY_SUPERVISION + #define FILE_LINE ,file,line + #define FILE_LINE_TYPE ,const char *file, int line + #define FILE_LINE_MACRO ,__FILE__,__LINE__ + #define FILE_LINE_MACRO_PASSED ,rm_path(file),line +#else + #define FILE_LINE + #define FILE_LINE_TYPE + #define FILE_LINE_MACRO + #define FILE_LINE_MACRO_PASSED ,__FILE__,__LINE__ +#endif + +#define NO_TASK 0 + +/* + * defines if the frame is controlling a protocol stack or a tools application (TAP,PCO,...) + */ +#define ENV_STACK 0 +#define ENV_TOOLS 1 + +#define PASSIVE_BODY 0x00000001 /* main loop in the frame compared to ACTIVE_BODY with main loop in pei_run() */ +#define COPY_BY_REF 0x00000002 /* only pointers to message are exchanged between the entities */ +#define SYSTEM_PROCESS 0x00000004 /* currently used to have a non-blocking tracing behavior for TST and RCV */ +#define TRC_NO_SUSPEND 0x00000008 /* discard traces, if no memory available or test interface queue full */ +#define PARTITION_AUTO_FREE 0x00000010 /* automatically free memory after primitive processing */ +#define PRIM_NO_SUSPEND 0x00000020 /* drop duplicated prim, if no memory available or test interface queue full */ +#define INT_DATA_TASK 0x00000040 /* allocate task stack and queue memory from internal memory */ +#define ADD_QUEUE_SIZES 0x00000080 /* add queue size for grouped entities (default is to take biggest value) */ +#define USE_LEMU_QUEUE 0x00000100 /* use registered "os_sendtoqueue" function instead of standard function */ + +/* + * return values + */ +#define VSI_OK 0 +#define VSI_TIMEOUT 1 +#define VSI_ERROR (-1) + +/* + * message types + */ +#define MSG_PRIMITIVE 1 +#define MSG_SIGNAL 2 +#define MSG_TIMEOUT 3 + +/* + * definitions for dynamic primitive allocation + */ +#define DP_FRAME_GUESS 0xffffffff +#define DP_NO_FRAME_GUESS 0 + + +#ifndef NTRACE + #ifndef NTRACE_FUNC + #define TRACE_FUNC + #endif + #define TRACE_EVE + #define TRACE_ERR + #define TRACE_PRIM + #ifndef NTRACE_GET_STATE + #define TRACE_GET_STATE + #endif + #ifndef NTRACE_SET_STATE + #define TRACE_SET_STATE + #endif + #define TRACE_IS /* entity internal signals */ + #define TRACE_BIN + #define TRACE_PRF +#endif + +/* + * trace bit masks + */ +#define TC_FUNC 0x00000001 +#define TC_EVENT 0x00000002 +#define TC_PRIM 0x00000004 +#define TC_STATE 0x00000008 +#define TC_SYSTEM 0x00000010 +#define TC_ISIG 0x00000020 +#define TC_ERROR 0x00000040 +#define TC_CCD 0x00000080 +#define TC_TIMER 0x00000100 +#define TC_DATA 0x00000200 +#define TC_SDU 0x00000400 +#define TC_PROFILER 0x00000800 +#define TC_ALERT_HINT 0x00001000 +#define TC_ALERT_WARNING 0x00002000 +#define TC_ALERT_ERROR TC_ERROR +#define TC_ALERT_FATAL 0x00004000 + +#define TC_USER1 0x00010000 +#define TC_USER2 0x00020000 +#define TC_USER3 0x00040000 +#define TC_USER4 0x00080000 +#define TC_USER5 0x00100000 +#define TC_USER6 0x00200000 +#define TC_USER7 0x00400000 +#define TC_USER8 0x00800000 + +/* + * TC_ENABLE is use for sending primitives from target to tools. + * In case these do not need to be dependent on trace filter + * settings, TC_ENABLE must be passed to vsi_o_primsend resp. the + * macros calling vsi_o_primsend. + */ +#define TC_ENABLE 0xffffffff + +/* + * trace opc's + */ +#define TRACE_OPC 0x00000000 + +#define BIN_TRACE_OPC 0xC7654321 + +#define IP_TRACE_OPC 0xC0000800 +#define HEX_TRACE_OPC 0xC0010800 +#define SDU_TRACE_OPC 0xC0020800 + +#define TRACE_SAP 0x00000801 + +#define FUNC_TRACE_OPC 0xC0010801 +#define EVENT_TRACE_OPC 0xC0020801 +#define PRIM_TRACE_OPC 0xC0030801 +#define STATE_TRACE_OPC 0xC0040801 +#define SYSTEM_TRACE_OPC 0xC0050801 +#define ISIG_TRACE_OPC 0xC0060801 +#define ERROR_TRACE_OPC 0xC0070801 +#define CCD_TRACE_OPC 0xC0080801 +#define TIMER_TRACE_OPC 0xC0090801 +#define PROFILER_TRACE_OPC 0xC00A0801 + +#define USER1_TRACE_OPC 0xC00F0801 +#define USER2_TRACE_OPC 0xC0100801 +#define USER3_TRACE_OPC 0xC0110801 +#define USER4_TRACE_OPC 0xC0120801 +#define USER5_TRACE_OPC 0xC0130801 +#define USER6_TRACE_OPC 0xC0140801 +#define USER7_TRACE_OPC 0xC0150801 +#define USER8_TRACE_OPC 0xC0160801 + +/* system primitive mask */ +#define SYS_MASK 0x8000 + +/* declare trace queue names */ +#ifdef _TOOLS_ +#ifdef FRAME_DLL + extern UBYTE SuppressOK; + extern char FRM_SYST_NAME[RESOURCE_NAMELEN]; + extern char FRM_TST_NAME[RESOURCE_NAMELEN]; + extern char FRM_RCV_NAME[RESOURCE_NAMELEN]; + extern char FRM_PCO_NAME[RESOURCE_NAMELEN]; +#else /* FRAME_DLL */ + __declspec (dllimport) char FRM_SYST_NAME[RESOURCE_NAMELEN]; + __declspec (dllimport) char FRM_TST_NAME[RESOURCE_NAMELEN]; + __declspec (dllimport) char FRM_RCV_NAME[RESOURCE_NAMELEN]; + __declspec (dllimport) char FRM_PCO_NAME[RESOURCE_NAMELEN]; +#endif /* FRAME_DLL */ +#else /* _TOOLS_ */ + extern char FRM_SYST_NAME[]; + extern char FRM_TST_NAME[]; + extern char FRM_RCV_NAME[]; + extern char FRM_PCO_NAME[]; +#endif /* _TOOLS_ */ + +/* + * masks for different kind of info passed to the type parameter at memory allocation + */ +#define VSI_MEM_POOL_MASK 0x000000ff +#define VSI_MEM_FLAG_MASK 0x0000ff00 +#define VSI_MEM_DESC_MASK 0x00ff0000 + +/* + * types of partition pools to allocate from + */ +#define PRIM_POOL_PARTITION PrimGroupHandle +#define DMEM_POOL_PARTITION DmemGroupHandle + +/* + * flags to determine allocation behavior + */ +#define VSI_MEM_NON_BLOCKING 0x00000100 + +/* + * descriptor types for allocation + */ +#define VSI_DESC_TYPE0 0x00000000 +#define VSI_DESC_TYPE1 0x00010000 +#define VSI_DESC_TYPE2 0x00020000 +#define VSI_DESC_TYPE3 0x00030000 + +/* + * definitions for dynamic timer configuration + */ +#define TIMER_SET 1 +#define TIMER_RESET 2 +#define TIMER_SPEED_UP 3 +#define TIMER_SLOW_DOWN 4 +#define TIMER_SUPPRESS 5 +#define TIMER_CLEAN 6 + +/* + * maximum length for a text trace + */ +#define TTRACE_LEN 100 + +/* + * values do be passed to vsi_m_init() to define if the allocated + * partitions shall be initialized with a predefined value. + */ +#define DISABLE_PARTITON_INIT 0 +#define ENABLE_PARTITON_INIT 1 + +#define TIME_MODE_MASK 0xc0000000 +#define TIME_IS_TDMA 0x80000000 + +#define CHECK_TRC_SUSPEND 1 +#define CHECK_PRIM_SUSPEND 2 + +/*==== TYPES ================================================================*/ + +typedef ULONG T_TIME; +typedef int T_HANDLE; + +#include "pei.h" +#include "alert.h" + +union T_MSG +{ + struct T_Prim + { + T_VOID_STRUCT *Prim; + ULONG PrimLen; + } Primitive; + struct Sig + { + ULONG SigOPC; + T_VOID_STRUCT *SigBuffer; + ULONG SigLen; + } Signal; + struct Tim + { + ULONG Index; + } Timer; +}; + +typedef struct +{ + USHORT MsgType; + union T_MSG Msg; +} T_QMSG; + +typedef struct +{ + char const *Str; + USHORT Ind; +} T_STR_IND; + +#include <stdarg.h> + +typedef struct +{ + void (*trace_error)(const char * const format, va_list varpars); + void (*trace_assert)(const char * const format, va_list varpars); +} T_EXT_TRACE_FUNC; + +/*==== EXTERNALS ===============================================================*/ + +extern T_HANDLE PrimGroupHandle; +extern T_HANDLE DmemGroupHandle; +#ifdef FF_FAST_MEMORY +extern T_HANDLE FastGroupHandle; +#endif + +/*==== PROTOTYPES ===============================================================*/ +//TISH modified for MSIM +#ifndef FRAME_DLL + +T_HANDLE vsi_p_create (T_HANDLE Caller, + SHORT (*pei_create)(T_PEI_INFO const ** info), + void (*TaskEntry)(T_HANDLE, ULONG), + T_HANDLE MemPoolHandle ); +int vsi_p_exit (T_HANDLE Caller, T_HANDLE TaskHandle); +int vsi_p_delete (T_HANDLE Caller, T_HANDLE TaskHandle); +int vsi_p_start (T_HANDLE Caller, T_HANDLE TaskHandle); +int vsi_p_stop (T_HANDLE Caller, T_HANDLE TaskHandle); +int vsi_p_name (T_HANDLE Caller, T_HANDLE Handle, char *Name); +T_HANDLE vsi_p_handle (T_HANDLE Caller, char *Name); +void vsi_o_set_htrace (T_HANDLE comhandle); + +T_VOID_STRUCT * vsi_m_new (ULONG Size, ULONG type FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_m_new_size (ULONG size, ULONG type, + ULONG *partition_size FILE_LINE_TYPE); +int vsi_m_free (T_VOID_STRUCT **Addr FILE_LINE_TYPE); +int vsi_m_status (T_HANDLE caller, ULONG size, USHORT type, USHORT *free, USHORT *alloc); +int vsi_m_init (char enable_init, char pattern); +T_VOID_STRUCT * vsi_m_cnew (ULONG size, ULONG type FILE_LINE_TYPE); +int vsi_m_cfree (T_VOID_STRUCT **ptr FILE_LINE_TYPE); +int vsi_m_attach (T_VOID_STRUCT *ptr FILE_LINE_TYPE); +int vsi_m_register_pool(char * name, T_HANDLE *pool_gr_id); + + +char * vsi_c_init_com_matrix (int max_entities); +int vsi_c_get_com_matrix_entry (int entry, char *dst); +int vsi_c_get_entity_com_entry (int entry, T_HANDLE rcv, T_HANDLE *snd); +T_HANDLE vsi_c_open (T_HANDLE Caller, char *Name); +int vsi_c_close (T_HANDLE Caller, T_HANDLE ComHandle); +int vsi_c_clear (T_HANDLE Caller, T_HANDLE ComHandle); +T_VOID_STRUCT * vsi_c_pnew_generic(T_HANDLE Caller, ULONG Size, ULONG opc, ULONG flags FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_pnew (ULONG Size, ULONG opc FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_pnew_nb (ULONG Size, ULONG opc FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_new_sdu (ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_new_sdu_generic(ULONG Size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset, ULONG flags FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_ppass (T_VOID_STRUCT *prim, ULONG opc FILE_LINE_TYPE); +void vsi_c_pstore (T_VOID_STRUCT *prim FILE_LINE_TYPE); +int vsi_c_pattach (T_VOID_STRUCT *prim FILE_LINE_TYPE); +int vsi_c_pfree (T_VOID_STRUCT **Msg FILE_LINE_TYPE); +int vsi_c_ssend (T_HANDLE ComHandle, ULONG opc, + T_VOID_STRUCT *ptr, ULONG MsgLen FILE_LINE_TYPE); +int vsi_c_psend (T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE); +int vsi_c_psend_caller(T_HANDLE caller, T_HANDLE ComHandle, T_VOID_STRUCT *ptr FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_reuse (T_PRIM_HEADER *ptr, ULONG Size, + ULONG opc, USHORT sdu_len, USHORT sdu_offset, + USHORT encode_offset FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_c_new (T_HANDLE Caller, ULONG Size, ULONG opc FILE_LINE_TYPE); +int vsi_c_send (T_HANDLE Caller, T_HANDLE ComHandle, + T_QMSG *Msg FILE_LINE_TYPE); +int vsi_c_free (T_HANDLE Caller, T_VOID_STRUCT **Msg FILE_LINE_TYPE); +int vsi_c_pmax_size (void); +int vsi_c_sync (T_HANDLE Caller, T_TIME timeout); +int vsi_c_alloc_send (T_HANDLE com_handle, char* rcv, char* snd, void *prim, char* string); +T_VOID_STRUCT * vsi_drpo_new (ULONG size, ULONG opc, ULONG guess FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_drpo_new_sdu (ULONG size, ULONG opc, USHORT sdu_len, USHORT sdu_offset, USHORT encode_offset, ULONG guess FILE_LINE_TYPE ); +T_VOID_STRUCT * vsi_drp_new (ULONG size, ULONG guess FILE_LINE_TYPE); +T_VOID_STRUCT * vsi_dp_new (ULONG size, T_VOID_STRUCT *addr, ULONG guess FILE_LINE_TYPE); +int vsi_drp_bind (T_VOID_STRUCT *child, T_VOID_STRUCT *parent FILE_LINE_TYPE); +int vsi_free (T_VOID_STRUCT **Msg FILE_LINE_TYPE); +int vsi_dp_sum (T_VOID_STRUCT *addr, ULONG *size); +int vsi_dp_max_size (void); +int vsi_c_await (T_HANDLE Caller, T_HANDLE ComHandle, T_QMSG *Msg, + ULONG Timeout); +int vsi_c_primitive (T_HANDLE Caller, void *Prim); +int vsi_c_awake (T_HANDLE caller ); +int vsi_c_status (T_HANDLE q_handle, unsigned int *used, unsigned int *free); + +int vsi_t_start (T_HANDLE Caller, USHORT Index, T_TIME Value); +int vsi_t_pstart (T_HANDLE Caller, USHORT Index, T_TIME Value1, T_TIME Value2 ); +int vsi_t_stop (T_HANDLE Caller, USHORT Index ); +int vsi_t_status (T_HANDLE Caller, USHORT Index, T_TIME *Value ); +int vsi_t_config (T_HANDLE Caller, USHORT Index, UBYTE Mode, ULONG Value ); +int _vsi_t_config (T_HANDLE Caller, char *CfgString, const T_STR_IND *pTable ); + +T_HANDLE vsi_s_open (T_HANDLE Caller, char *Name, USHORT Count); +int vsi_s_close (T_HANDLE Caller, T_HANDLE SemHandle); +int vsi_s_get (T_HANDLE Caller, T_HANDLE SemHandle); +int vsi_s_release (T_HANDLE Caller, T_HANDLE SemHandle); +int vsi_s_status (T_HANDLE Caller, T_HANDLE SemHandle, USHORT *Count); + +/* *** ATTENTION START: A modification of the prototypes below requires a modification of STR2IND *** */ +int vsi_o_func_ttrace (const char * const format, ... ); +int vsi_o_event_ttrace(const char * const format, ... ); +int vsi_o_error_ttrace(const char * const format, ... ); +int vsi_o_state_ttrace(const char * const format, ... ); +int vsi_o_class_ttrace(ULONG TraceClass, const char * const format, ... ); +int vsi_o_func_itrace (ULONG index, const char * const format, ... ); +int vsi_o_event_itrace(ULONG index, const char * const format, ... ); +int vsi_o_error_itrace(ULONG index, const char * const format, ... ); +int vsi_o_state_itrace(ULONG index, const char * const format, ... ); +int vsi_o_class_itrace(ULONG TraceClass, ULONG index, const char * const format, ... ); +/* *** ATTENTION END: A modification of the prototypes above requires a modification of STR2IND *** */ + +int vsi_o_ttrace (T_HANDLE Caller, ULONG TraceClass, const char * const format, ... ); +int vsi_o_itrace (T_HANDLE Caller, ULONG TraceClass, ULONG index, const char * const format, ... ); +int vsi_o_ptrace (T_HANDLE Caller, ULONG opc, UBYTE dir ); +int vsi_o_strace (T_HANDLE Caller, const char *const machine, + const char *const curstate, + const char *const newstate); +void vsi_ext_trace_register (T_EXT_TRACE_FUNC * func); +int vsi_o_memtrace (T_HANDLE Caller, void *ptr, unsigned int len); +int vsi_o_primsend (T_HANDLE Caller, unsigned int mask, T_HANDLE dst, char *ext_dst, unsigned int opc, void *ptr, unsigned int len FILE_LINE_TYPE); +int vsi_o_sdusend (T_HANDLE caller, T_HANDLE dst, char *ext_dst, int opc, char ent, char dir, char type, void *ptr, unsigned int len FILE_LINE_TYPE); +int vsi_o_assert (T_HANDLE Caller, USHORT cause, const char *file, int line, const char * const format, ...); +int vsi_settracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG Mask ); +int vsi_gettracemask (T_HANDLE Caller, T_HANDLE Handle, ULONG *Mask ); +int vsi_trcsuspend (T_HANDLE Caller, T_HANDLE Handle, ULONG Suspend ); +int vsi_trc_free (T_HANDLE Caller, T_VOID_STRUCT **Msg); +ULONG get_suspend_state (T_HANDLE caller, int type); + + +void vsi_ppm_new (T_HANDLE Caller, ULONG Size, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_rec (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_access (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_store (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_send (T_HANDLE Caller, T_HANDLE rcv, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_reuse (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_free (T_HANDLE Caller, T_PRIM_HEADER *prim, const char* file, int line ); +void vsi_ppm_setend (T_PRIM_HEADER *Prim, ULONG Size ); + +int vsi_gettaskname (T_HANDLE Caller, T_HANDLE Handle, char *Name); +T_HANDLE vsi_gettaskhandle (T_HANDLE Caller, char *Name); +int vsi_e_name (T_HANDLE Caller, T_HANDLE Handle, char *Name); +T_HANDLE vsi_e_handle (T_HANDLE Caller, char *Name); +int vsi_gettaskflags (T_HANDLE Caller, T_HANDLE Handle, U32 *Flags); +int vsi_t_time (T_HANDLE Caller, T_TIME *Value); +int vsi_t_sleep (T_HANDLE Caller, T_TIME Value); +int vsi_object_info (T_HANDLE caller, USHORT Id, USHORT Index, char *Buffer, USHORT Size); + +void vsi_d_callback (T_DRV_SIGNAL *Signal ); +int vsi_d_create (T_HANDLE Caller, T_TST_DRV_ENTRY *drv_info ); +int vsi_d_init (T_HANDLE Caller ); +int vsi_d_exit (T_HANDLE Caller, T_HANDLE DrvHandle ); +int vsi_d_open (T_HANDLE Caller, char *Name ); +int vsi_d_close (T_HANDLE Caller, T_HANDLE DrvHandle ); +int vsi_d_read (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG *Size ); +int vsi_d_write (T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG Size ); +int vsi_d_flush (T_HANDLE Caller, T_HANDLE DrvHandle ); +int vsi_d_setsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ); +int vsi_d_resetsignal (T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ); +int vsi_d_setconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ); +int vsi_d_getconfig (T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ); + +void vsi_pcheck_init (void); +void vsi_pcheck_register(ULONG (*func)(ULONG, void*), ULONG ret_ok); +//TISH modified for MSIM +#endif //#ifdef FRAME_DLL + +/*==== MACROS ================================================================*/ + +#define ConfigTimer _vsi_t_config + +#ifdef MEMORY_SUPERVISION + #define VSI_PPM_REC(B,F,L) + #define VSI_PPM_RCV(B) vsi_ppm_rec (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); + #define VSI_PPM_NEW(B,S) vsi_ppm_new (VSI_CALLER S,((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); + #define VSI_PPM_FREE(B) vsi_ppm_free (VSI_CALLER ((T_PRIM_HEADER*)(B)),__FILE__, __LINE__); + #define VSI_PPM_REUSE(B) vsi_ppm_reuse (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__); + #define VSI_PPM_ACCESS(B) vsi_ppm_access (VSI_CALLER (T_PRIM_HEADER*)B,__FILE__,__LINE__); + #define VSI_PPM_SEND(B,D) vsi_ppm_send (VSI_CALLER D,(T_PRIM_HEADER*)B,__FILE__,__LINE__); +#else + #define VSI_PPM_REC(B,F,L) + #define VSI_PPM_RCV(B) + #define VSI_PPM_NEW(B) + #define VSI_PPM_FREE(B) + #define VSI_PPM_REUSE(B) + #define VSI_PPM_ACCESS(B) + #define VSI_PPM_SEND(B,D) +#endif /* MEMORY_SUPERVISION */ + +#define ALIGN(S) (((S)+3)&~0x03) +#define ALIGN_SIZE(S) (((S)+sizeof(int)-1)&~(sizeof(int)-1)) +#define S_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_S_HEADER))) +#define S_HDR_OFFSET(S) (ALIGN(S)>>2) +#define D_ALLOC_SIZE(S) (ALIGN((S)+sizeof(T_PRIM_HEADER)+sizeof(T_DP_HEADER))) +#define D_HDR_OFFSET(S) (ALIGN((S)-sizeof(T_DP_HEADER))>>2) + +#define P2D(P) ((T_PRIM_HEADER*)(P)+1) +#define D2P(D) ((T_PRIM_HEADER*)(D)-1) + +#define P2D_AC(P,T) P2D(P) + +#define P_OPC(P) (((T_PRIM_HEADER*)(P))->opc) +#define P_OPC2(P) (((T_PRIM_HEADER*)(P))->opc2) +#define P_LEN(P) (((T_PRIM_HEADER*)(P))->len) +#define P_TID(P) (((T_PRIM_HEADER*)(P))->tid) +#define P_SDU(P) (((T_PRIM_HEADER*)(P))->sdu) +#define P_CNT(P) (((T_PRIM_HEADER*)(P))->use_cnt) +#define P_IDX(P) (*(ULONG*)(P)) +#define P_PPM_IDX(P) (*((ULONG*)(P)-PPM_OFFSET)) +#define P_PNR(P) (*((ULONG*)(P)-PPM_OFFSET) & 0xffff) +#define P_PGR(P) ((*((ULONG*)(P)-PPM_OFFSET) >> 16) & 0xffff) +#define P_SHDR(P) ((T_S_HEADER*)((ULONG*)(P)+((T_PRIM_HEADER*)(P))->sh_offset)) +#define P_RCV(P) (((T_S_HEADER*)P_SHDR(P))->rcv) +#define P_SND(P) (((T_S_HEADER*)P_SHDR(P))->snd) +#define P_TIME(P) (((T_S_HEADER*)P_SHDR(P))->time) +#define P_SHO(P) (((T_PRIM_HEADER*)(P))->sh_offset) +#define P_DPHO(P) (((T_PRIM_HEADER*)(P))->dph_offset) +#define P_MEMHANDLE(P) (*(U32*)P2D(P)) +#define P_MEMHANDLE_SDU(P) (*(((U32*)P2D(P))+1)) + +#define D_OPC(D) P_OPC(D2P(D)) +#define D_OPC2(D) P_OPC2(D2P(D)) +#define D_LEN(D) P_LEN(D2P(D)) +#define D_CNT(D) P_CNT(D2P(D)) +#define D_TID(D) P_TID(D2P(D)) +#define D_SDU(D) P_SDU(D2P(D)) + +#define D_SDU_LEN(D) (D_SDU(D)->l_buf) +#define D_SDU_OFF(D) (D_SDU(D)->o_buf) + +#define BITS_PER_BYTE 8 +#define BYTELEN(BITLEN) ((BITLEN)<=0?0:((((BITLEN)-1)/BITS_PER_BYTE)+1)) +#define BYTELEN_POS(BITLEN) (((BITLEN)+7)/BITS_PER_BYTE) + +#define SDU_TRAIL ((char*)(((T_sdu*)0)+1)-(char*)(((T_sdu*)0)->buf)) +#define PSIZE(D) D_LEN(D) + +#define SIZ(T) ((ULONG)(sizeof(T_PRIM_HEADER)+sizeof(T))) +#define SIZ_SDU(T,M) ((ULONG)(SIZ(T)+BYTELEN((M)+ENCODE_OFFSET)-SDU_TRAIL)) +/* NOTE : received SDUs may have a different ENCODE_OFFSET */ + +#ifndef ADD_BSIZE +#define ADD_BSIZE 0 +#endif + +#define NO_SDU 0xffff + +/*lint -e773 Info 773: Expression-like macro '...' not parenthesized + this message has to be disabled to avoid LINT complaining about missing parentesis in the macros + that create a pointer and initialize it. Here we cannot set paranthesis because in this case the + existing entity code will not compile without ';'. To disable this message is safe for these macros */ + +#define DRPO_ALLOC(T,G) (T_##T*)vsi_drpo_new(sizeof(T_##T),T,G FILE_LINE_MACRO) +#define DRPO_ALLOC_SDU(T,N,G) (T_##T*)vsi_drpo_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,G FILE_LINE_MACRO) +#define DRP_ALLOC(S,G) (T_VOID_STRUCT*)vsi_drp_new(S,G FILE_LINE_MACRO) +#define DRP_BIND(C,P) vsi_drp_bind((T_VOID_STRUCT*)C,(T_VOID_STRUCT*)P FILE_LINE_MACRO) +#define DP_ALLOC(S,P,G) (T_VOID_STRUCT*)vsi_dp_new(S,(T_VOID_STRUCT*)P,G FILE_LINE_MACRO) +#define FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ + vsi_free((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} +#define MALLOC(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) +#define M_ALLOC(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) + +#ifdef FF_FAST_MEMORY +#define FMALLOC(P,S) P = (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) +#define FM_ALLOC(S) (void*)vsi_m_cnew(S,(FastGroupHandle|VSI_DESC_TYPE0) FILE_LINE_MACRO) +#else +#define FMALLOC(P,S) MALLOC(P,S) +#define FM_ALLOC(S) M_ALLOC(S) +#endif + +#define MALLOC_GENERIC(P,S,G,F) P = (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO) +#define M_ALLOC_GENERIC(S,G,F) (void*)vsi_m_cnew(S,(G|(F)) FILE_LINE_MACRO) + +#define MALLOC_DESC1(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO) +#define M_ALLOC_DESC1(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1) FILE_LINE_MACRO) + +#define MALLOC_DESC2(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO) +#define M_ALLOC_DESC2(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2) FILE_LINE_MACRO) + +#define MALLOC_DESC3(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO) +#define M_ALLOC_DESC3(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3) FILE_LINE_MACRO) + +#define MALLOC_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) +#define M_ALLOC_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE0|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) + +#define MALLOC_DESC1_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) +#define M_ALLOC_DESC1_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE1|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) + +#define MALLOC_DESC2_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) +#define M_ALLOC_DESC2_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE2|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) + +#define MALLOC_DESC3_NB(P,S) P = (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) +#define M_ALLOC_DESC3_NB(S) (void*)vsi_m_cnew(S,(PrimGroupHandle|VSI_DESC_TYPE3|VSI_MEM_NON_BLOCKING) FILE_LINE_MACRO) + +#define MATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO) +#define M_ATTACH(M) vsi_m_attach((T_VOID_STRUCT*)M FILE_LINE_MACRO) + +#define DMALLOC(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO) +#define D_ALLOC(S) (void*)vsi_m_new(S,DmemGroupHandle FILE_LINE_MACRO) + +#define DMALLOC_NB(P,S) P = (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO) +#define D_ALLOC_NB(S) (void*)vsi_m_new(S,DmemGroupHandle|VSI_MEM_NON_BLOCKING FILE_LINE_MACRO) + +#define PALLOC_GENERIC(D,T,G,F) T_##T *D = (T_##T*)vsi_c_pnew_generic(0,sizeof(T_##T),T,(G|(F)) FILE_LINE_MACRO) +#define P_ALLOC_GENERIC(T,G,F) (T_##T*)vsi_c_pnew_generic(0,sizeof(T_##T),T,(G|(F)) FILE_LINE_MACRO ) + +#define PALLOC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO) +#define P_ALLOC(T) (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO ) + +#define PALLOC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO) +#define P_ALLOC_NB(T) (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO ) + +#define PALLOC_MSG(D,T,M) T_##T *D = (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) +#define P_ALLOC_MSG(T,M) (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) + +#define PALLOC_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) +#define P_ALLOC_SDU(T,N) (T_##T*)vsi_c_new_sdu(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) + +#ifdef FF_FAST_MEMORY +#define FPALLOC_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_new_sdu_generic(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,FastGroupHandle FILE_LINE_MACRO) +#define FP_ALLOC_SDU(T,N) (T_##T*)vsi_c_new_sdu_generic(sizeof(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET,FastGroupHandle FILE_LINE_MACRO) +#else +#define FPALLOC_SDU(D,T,N) PALLOC_SDU(D,T,N) +#define FP_ALLOC_SDU(T,N) P_ALLOC_SDU(T,N) +#endif + +#define PALLOC_DESC(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2)); + +#define PALLOC_DESC2(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2)); + +#define PALLOC_DESC3(D,T) T_##T *D = (T_##T*)vsi_c_pnew(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2)); + +#define PALLOC_DESC_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list)+sizeof(T_PRIM_HEADER))>>2)); + +#define PALLOC_DESC2_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list2)+sizeof(T_PRIM_HEADER))>>2)); + +#define PALLOC_DESC3_NB(D,T) T_##T *D = (T_##T*)vsi_c_pnew_nb(sizeof(T_##T),T FILE_LINE_MACRO);\ + ((T_PRIM_HEADER*)D2P(D))->dph_offset = (ULONG)(((offsetof(T_##T,desc_list3)+sizeof(T_PRIM_HEADER))>>2)); + +#define PATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO) +#define P_ATTACH(D) vsi_c_pattach((T_VOID_STRUCT*)D FILE_LINE_MACRO) + +#define PREUSE(D0,D,T) T_##T *D = (T_##T*)vsi_c_reuse((T_PRIM_HEADER*)D0,SIZ(T_##T),T,0,NO_SDU,0 FILE_LINE_MACRO) +#define P_REUSE(D0,T) (T_##T*)vsi_c_reuse((T_PRIM_HEADER*)D0,SIZ(T_##T),T,0,NO_SDU,0 FILE_LINE_MACRO) + +#define PREUSE_MSG(D,T,M) T_##T *D = (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) +#define P_REUSE_MSG(T,M) (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,BSIZE_##M+ADD_BSIZE,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) + +#define PREUSE_SDU(D,T,N) T_##T *D = (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) +#define P_REUSE_SDU(T,N) (T_##T*)vsi_c_reuse(D0,SIZ(T_##T),T,N,offsetof(T_##T,sdu),ENCODE_OFFSET FILE_LINE_MACRO) + +#define PSEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) +#define P_SEND(E,D) vsi_c_psend ( E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) + +#define PSEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) +#define P_SEND_CALLER(C,E,D) vsi_c_psend_caller ( C, E ,(T_VOID_STRUCT*)D FILE_LINE_MACRO ) + +#define PSIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO ) +#define P_SIGNAL(E,O,D) vsi_c_ssend ( E ,O,(T_VOID_STRUCT*)D,SIZ(T_##O) FILE_LINE_MACRO ) + +#define PRIM_SEND_TO_PC(S,R,P) vsi_o_primsend(S,TC_ENABLE,0,R,0,P,0 FILE_LINE_MACRO) +#define DATA_SEND_TO_PC(S,F,R,O,P,L) vsi_o_primsend(S,F,0,R,O,P,L FILE_LINE_MACRO) + +#define PFREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ + vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} +#define P_FREE(D) { T_VOID_STRUCT *z=(T_VOID_STRUCT*)D;\ + vsi_c_pfree((T_VOID_STRUCT **)&z FILE_LINE_MACRO);} + +#define PPASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO ) +#define P_PASS(D0,D,T) T_##T *D = (T_##T*)vsi_c_ppass ( (T_VOID_STRUCT*)D0, T FILE_LINE_MACRO ) + +#define PACCESS(D) VSI_PPM_ACCESS(D2P(D)) +#define P_ACCESS(D) VSI_PPM_ACCESS(D2P(D)) + +#define PSTORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO) +#define P_STORE(D) vsi_c_pstore ((T_VOID_STRUCT*)D FILE_LINE_MACRO) + +#define MFREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO) +#define M_FREE(P) vsi_m_cfree((T_VOID_STRUCT **)&P FILE_LINE_MACRO) + +#define D_FREE(P) vsi_m_free((T_VOID_STRUCT **)&P FILE_LINE_MACRO) + +/*lint +e773 */ + +#ifdef TRACE_FUNC + #define TRACE_FUNCTION(a) vsi_o_func_ttrace(a) + #define TRACE_FUNCTION_P1(f,a1) vsi_o_func_ttrace(f,a1) + #define TRACE_FUNCTION_P2(f,a1,a2) vsi_o_func_ttrace(f,a1,a2) + #define TRACE_FUNCTION_P3(f,a1,a2,a3) vsi_o_func_ttrace(f,a1,a2,a3) + #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) vsi_o_func_ttrace(f,a1,a2,a3,a4) + #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5) + #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6) + #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7) + #define TRACE_FUNCTION_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8) + #define TRACE_FUNCTION_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_func_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) +#else + #define TRACE_FUNCTION(a) ((void)(0)) + #define TRACE_FUNCTION_P1(f,a1) ((void)(0)) + #define TRACE_FUNCTION_P2(f,a1,a2) ((void)(0)) + #define TRACE_FUNCTION_P3(f,a1,a2,a3) ((void)(0)) + #define TRACE_FUNCTION_P4(f,a1,a2,a3,a4) ((void)(0)) + #define TRACE_FUNCTION_P5(f,a1,a2,a3,a4,a5) ((void)(0)) + #define TRACE_FUNCTION_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0)) + #define TRACE_FUNCTION_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) + #define TRACE_FUNCTION_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) + #define TRACE_FUNCTION_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) +#endif + +#ifdef TRACE_EVE + #define TRACE_EVENT(a) vsi_o_event_ttrace(a) + #define TRACE_EVENT_P1(f,a1) vsi_o_event_ttrace(f,a1) + #define TRACE_EVENT_P2(f,a1,a2) vsi_o_event_ttrace(f,a1,a2) + #define TRACE_EVENT_P3(f,a1,a2,a3) vsi_o_event_ttrace(f,a1,a2,a3) + #define TRACE_EVENT_P4(f,a1,a2,a3,a4) vsi_o_event_ttrace(f,a1,a2,a3,a4) + #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5) + #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6) + #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7) + #define TRACE_EVENT_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8) + #define TRACE_EVENT_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_event_ttrace(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) + #define TRACE_USER_CLASS(c,a) vsi_o_class_ttrace(c,a) + #define TRACE_USER_CLASS_P1(c,f,a1) vsi_o_class_ttrace(c,f,a1) + #define TRACE_USER_CLASS_P2(c,f,a1,a2) vsi_o_class_ttrace(c,f,a1,a2) + #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) vsi_o_class_ttrace(c,f,a1,a2,a3) + #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) vsi_o_class_ttrace(c,f,a1,a2,a3,a4) + #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5) + #define TRACE_USER_CLASS_P6(c,f,a1,a2,a3,a4,a5,a6) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6) + #define TRACE_USER_CLASS_P7(c,f,a1,a2,a3,a4,a5,a6,a7) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7) + #define TRACE_USER_CLASS_P8(c,f,a1,a2,a3,a4,a5,a6,a7,a8) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7,a8) + #define TRACE_USER_CLASS_P9(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) vsi_o_class_ttrace(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) +#else + #define TRACE_EVENT(a) ((void)(0)) + #define TRACE_EVENT_P1(f,a1) ((void)(0)) + #define TRACE_EVENT_P2(f,a1,a2) ((void)(0)) + #define TRACE_EVENT_P3(f,a1,a2,a3) ((void)(0)) + #define TRACE_EVENT_P4(f,a1,a2,a3,a4) ((void)(0)) + #define TRACE_EVENT_P5(f,a1,a2,a3,a4,a5) ((void)(0)) + #define TRACE_EVENT_P6(f,a1,a2,a3,a4,a5,a6) ((void)(0)) + #define TRACE_EVENT_P7(f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) + #define TRACE_EVENT_P8(f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) + #define TRACE_EVENT_P9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) + #define TRACE_USER_CLASS(c,a) ((void)(0)) + #define TRACE_USER_CLASS_P1(c,f,a1) ((void)(0)) + #define TRACE_USER_CLASS_P2(c,f,a1,a2) ((void)(0)) + #define TRACE_USER_CLASS_P3(c,f,a1,a2,a3) ((void)(0)) + #define TRACE_USER_CLASS_P4(c,f,a1,a2,a3,a4) ((void)(0)) + #define TRACE_USER_CLASS_P5(c,f,a1,a2,a3,a4,a5) ((void)(0)) + #define TRACE_USER_CLASS_P6(c,f,a1,a2,a3,a4,a5,a6) ((void)(0)) + #define TRACE_USER_CLASS_P7(c,f,a1,a2,a3,a4,a5,a6,a7) ((void)(0)) + #define TRACE_USER_CLASS_P8(c,f,a1,a2,a3,a4,a5,a6,a7,a8) ((void)(0)) + #define TRACE_USER_CLASS_P9(c,f,a1,a2,a3,a4,a5,a6,a7,a8,a9) ((void)(0)) +#endif + +#ifdef TRACE_BIN + #define TRACE_MEMORY(s,p,l) vsi_o_memtrace(s,p,l) + #define TRACE_MEMORY_PRIM(s,r,o,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO) + #define TRACE_USER_CLASS_MEMORY_PRIM(s,m,r,o,p,l) vsi_o_primsend(s,m,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO) + #define TRACE_BINDUMP(s,m,d,p,l) {vsi_o_ttrace(s,m,d);vsi_o_primsend(s,m,0,FRM_PCO_NAME,BIN_TRACE_OPC,p,l FILE_LINE_MACRO);} + #define TRACE_HEXDUMP(s,p,l) vsi_o_primsend(s,TC_DATA,0,FRM_PCO_NAME,HEX_TRACE_OPC,p,l FILE_LINE_MACRO); + #define TRACE_SDU(s,r,e,d,t,p,l) vsi_o_sdusend(s,r,FRM_PCO_NAME,SDU_TRACE_OPC,e,d,t,p,l FILE_LINE_MACRO) + #define TRACE_IP(s,r,u,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,(IP_TRACE_OPC|u),p,l FILE_LINE_MACRO) + #define TRACE_PRIMDUMP(s,r,o,p,l) vsi_o_primsend(s,TC_DATA,r,FRM_PCO_NAME,o,p,l FILE_LINE_MACRO) +#else + #define TRACE_MEMORY(s,p,l) ((void)(0)) + #define TRACE_MEMORY_PRIM(s,r,o,p,l) ((void)(0)) + #define TRACE_USER_CLASS_MEMORY_PRIM(s,r,o,p,l) ((void)(0)) + #define TRACE_BINDUMP(s,m,d,p,l) ((void)(0)) + #define TRACE_HEXDUMP(s,p,l) ((void)(0)) + #define TRACE_SDU(s,r,e,d,t,p,l) ((void)(0)) + #define TRACE_IP(s,r,u,p,l) ((void)(0)) + #define TRACE_PRIMDUMP(s,r,o,p,l) ((void)(0)) +#endif + +#ifdef TRACE_ERR + #define TRACE_ERROR(a) vsi_o_error_ttrace(a) +#else + #define TRACE_ERROR(a) ((void)(0)) +#endif + +#ifdef TRACE_IS /* entity internal signals */ + #define TRACE_ISIG(a) vsi_o_class_ttrace( TC_ISIG,a) +#else + #define TRACE_ISIG(a) ((void)(0)) +#endif + +#ifdef TRACE_PRIM + #define PTRACE_IN(OPC) vsi_o_ptrace (VSI_CALLER OPC, 0) + #define PTRACE_OUT(OPC) vsi_o_ptrace (VSI_CALLER OPC, 1) +#else + #define PTRACE_IN(OPC) ((void)(0)) + #define PTRACE_OUT(OPC) ((void)(0)) +#endif + +#ifdef TRACE_PRF + #define PRF_LOG_FUNC_ENTRY(F) prf_log_function_entry(F) + #define PRF_LOG_FUNC_EXIT(F) prf_log_function_exit(F) + #define PRF_LOG_POI(P) prf_log_point_of_interest(P) +#else + #define PRF_LOG_FUNC_ENTRY(F) ((void)(0)) + #define PRF_LOG_FUNC_EXIT(F) ((void)(0)) + #define PRF_LOG_POI(P) ((void)(0)) +#endif + +#undef TRACE_ASSERT +#if defined NDEBUG + #define TRACE_ASSERT(e) ((void)(0)) +#else + #define _TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,#e))) + #define TRACE_ASSERT(e) ((void)((e)?0:vsi_o_assert(0,0x8000,__FILE__,__LINE__,"Assertion failed:" #e))) +#endif + +#ifdef assert + #undef assert +#endif + + #define assert TRACE_ASSERT + +#ifdef TRACE_SET_STATE + #define SET_STATE(PROCESS,STATE)\ + { vsi_o_state_ttrace ( #PROCESS ":%s -> " #STATE,\ + PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]);\ + ENTITY_DATA->state[PROCESS] = STATE;} +#else /* TRACE_SET_STATE */ + #define SET_STATE(PROCESS,STATE) (ENTITY_DATA->state[PROCESS] = STATE) +#endif /* TRACE_SET_STATE */ + +#ifdef TRACE_GET_STATE + #define GET_STATE(PROCESS)\ + (vsi_o_state_ttrace (#PROCESS ":%s",\ + PROCESS##_NAME [ ENTITY_DATA->state[PROCESS] ]),\ + ENTITY_DATA->state[PROCESS] ) +#else /* TRACE_GET_STATE */ + #define GET_STATE(PROCESS) ENTITY_DATA->state[PROCESS] +#endif /* TRACE_GET_STATE */ + + +#endif /* VSI_H */ +