# HG changeset patch # User Michael Spacefalcon # Date 1399535706 0 # Node ID 5bc6a8f8b4a8bfbacae41eb1067e779f864176a4 # Parent a163da322bc5f13d0077970220d0381e059d6a7b OSL: os_com_fl.c: reconstructed up to os_GetQueueData() diff -r a163da322bc5 -r 5bc6a8f8b4a8 gsm-fw/gpf/osl/os_com_fl.c --- a/gsm-fw/gpf/osl/os_com_fl.c Thu May 08 05:47:38 2014 +0000 +++ b/gsm-fw/gpf/osl/os_com_fl.c Thu May 08 07:55:06 2014 +0000 @@ -19,7 +19,6 @@ extern T_OS_COM_TABLE_ENTRY ComTable[]; static NU_SEMAPHORE ComSemCB; -static USHORT entry = 0; static int os_GetQueueEntry(USHORT Index, OS_HANDLE *Handle) @@ -62,3 +61,84 @@ ent->MaxUsed); return(OS_OK); } + +GLOBAL LONG +os_OpenQueue(OS_HANDLE TaskHandle, char *Name, OS_HANDLE *ComHandle) +{ + USHORT i; + + if (!Name) + return(OS_ERROR); + for (i = 1; i <= MaxCommunications; i++) + if (ComTable[i].Name[0] && + !strncmp(ComTable[i].Name, Name, RESOURCE_NAMELEN - 1)) { + *ComHandle = i; + return(OS_OK); + } + return(OS_ERROR); +} + +GLOBAL LONG +os_GetQueueState(OS_HANDLE Caller, OS_HANDLE Handle, ULONG *Used, ULONG *Free) +{ + if (ComTable[Handle].Name[0]) { + *Used = ComTable[Handle].UsedSemCB.sm_semaphore_count; + *Free = ComTable[Handle].FreeSemCB.sm_semaphore_count; + return(OS_OK); + } else + return(OS_ERROR); +} + +GLOBAL LONG +os_GetQueueName(OS_HANDLE Caller, OS_HANDLE ComHandle, char *Name) +{ + if (ComHandle > MaxCommunications) + return(OS_ERROR); + if (!ComTable[ComHandle].Name[0]) + return(OS_ERROR); + strcpy(Name, ComTable[ComHandle].Name); + return(OS_OK); +} + +GLOBAL LONG +os_GetQueueHandle(OS_HANDLE Caller, char *Name, OS_HANDLE *ComHandle) +{ + USHORT i; + + for (i = 1; i <= MaxCommunications; i++) + if (ComTable[i].Name[0] && + !strncmp(Name, ComTable[i].Name, RESOURCE_NAMELEN - 1)) { + *ComHandle = i; + return(OS_OK); + } + return(OS_ERROR); +} + +GLOBAL LONG +os_GetQueueData(OS_HANDLE Caller, OS_HANDLE Handle, USHORT Index, USHORT *Type, + ULONG *opc, ULONG *ptr, ULONG *time) +{ + static USHORT entry; + static T_QDATA_ELEMENT *p; + + if (!ComTable[Handle].Name[0]) + return(OS_ERROR); + if (Index == FIRST_ENTRY) { + *Type = ComTable[Handle].current_msg.type; + *opc = ComTable[Handle].current_msg.opc; + *time = ComTable[Handle].current_msg.time; + *ptr = (ULONG) ComTable[Handle].current_msg.ptr; + p = ComTable[Handle].pQueueMemory; + entry = 0; + return(OS_OK); + } + if (entry >= ComTable[Handle].Entries) + return(OS_ERROR); + entry++; + *Type = p->Data.data16; + *ptr = (ULONG) p->Data.ptr; + *opc = p->Data.data32; + *time = p->Data.time; + p++; + return(OS_OK); +}