changeset 447:b55882290007

os_sem_fl.c: os_FindSuspendingSema() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 01:55:31 +0000
parents 57f8e2b747c4
children fd1729fd979e
files gsm-fw/gpf/osl/os_sem_fl.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 01:31:11 2014 +0000
+++ b/gsm-fw/gpf/osl/os_sem_fl.c	Mon Jun 23 01:55:31 2014 +0000
@@ -128,3 +128,26 @@
 	}
 	return(OS_ERROR);
 }
+
+GLOBAL unsigned char *
+os_FindSuspendingSema(unsigned int *tcb)
+{
+	USHORT i;
+	SM_SUSPEND *susp, *susp_loopchk;
+
+	for (i = 1; i <= MaxSemaphores; i++) {
+		if (!SemTable[i].Name[0])
+			continue;
+		susp = SemTable[i].SemCB.sm_suspension_list;
+		if (!susp)
+			continue;
+		if (susp->sm_suspended_task == (NU_TASK *)tcb)
+			return(SemTable[i].SemCB.sm_name);
+		susp = (SM_SUSPEND *)susp->sm_suspend_link.cs_next;
+		for (susp_loopchk = susp; susp != susp_loopchk;
+		     susp = (SM_SUSPEND *)susp->sm_suspend_link.cs_next)
+			if (susp->sm_suspended_task == (NU_TASK *)tcb)
+				return(SemTable[i].SemCB.sm_name);
+	}
+	return(0);
+}