changeset 449:03b6377d61db

OSL: os_sem_fl.c done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 02:36:51 +0000
parents fd1729fd979e
children 8768b9f28073
files gsm-fw/gpf/osl/os_sem_fl.c
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 02:13:02 2014 +0000
+++ b/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 02:36:51 2014 +0000
@@ -170,3 +170,37 @@
 		NU_Release_Semaphore(&SemSemCB);
 	return(OS_OK);
 }
+
+GLOBAL LONG
+os_CreateSemaphore(OS_HANDLE TaskHandle, char *Name, USHORT Count,
+		   OS_HANDLE *SemHandle, OS_HANDLE MemPoolHandle)
+{
+	USHORT i;
+	STATUS sts;
+
+	if (os_OpenSemaphore(TaskHandle, Name, SemHandle) == OS_OK)
+		return(OS_ERROR);
+	sts = NU_Obtain_Semaphore(&SemSemCB, NU_SUSPEND);
+	for (i = 1; i <= MaxSemaphores; i++) {
+		if (SemTable[i].Name[0])
+			continue;
+		if (NU_Create_Semaphore(&SemTable[i].SemCB, Name, Count,
+					NU_PRIORITY) != NU_SUCCESS)
+			break;
+		strncpy(SemTable[i].Name, Name, RESOURCE_NAMELEN);
+		SemTable[i].Name[RESOURCE_NAMELEN-1] = 0;
+		*SemHandle = i;
+		if (sts == NU_SUCCESS)
+			NU_Release_Semaphore(&SemSemCB);
+		return(OS_OK);
+	}
+	if (sts == NU_SUCCESS)
+		NU_Release_Semaphore(&SemSemCB);
+	return(OS_ERROR);
+}
+
+GLOBAL LONG
+os_CloseSemaphore(OS_HANDLE TaskHandle, OS_HANDLE SemHandle)
+{
+	return(OS_OK);
+}