changeset 444:caeff442faf1

os_sem_fl.c: os_ResetSemaphore() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 01:10:51 +0000
parents 42f9e12a9ced
children 9eeeef3ff7db
files gsm-fw/gpf/osl/os_sem_fl.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 00:55:22 2014 +0000
+++ b/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 01:10:51 2014 +0000
@@ -76,3 +76,23 @@
 		bzero(&SemTable[i], sizeof(T_OS_SEM_TABLE_ENTRY));
 	return(OS_OK);
 }
+
+GLOBAL LONG
+os_ResetSemaphore(OS_HANDLE TaskHandle, OS_HANDLE SemHandle,
+		  USHORT init_counter)
+{
+	STATUS sts;
+
+	sts = NU_Obtain_Semaphore(&SemSemCB, NU_SUSPEND);
+	if (!SemTable[SemHandle].Name[0]) {
+error_out:	if (sts == NU_SUCCESS)
+			NU_Release_Semaphore(&SemSemCB);
+		return(OS_ERROR);
+	}
+	if (NU_Reset_Semaphore(&SemTable[SemHandle].SemCB, init_counter)
+			!= NU_SUCCESS)
+		goto error_out;
+	if (sts == NU_SUCCESS)
+		NU_Release_Semaphore(&SemSemCB);
+	return(OS_OK);
+}