comparison gsm-fw/gpf/osl/os_sem_fl.c @ 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
comparison
equal deleted inserted replaced
448:fd1729fd979e 449:03b6377d61db
168 SemTable[SemHandle].Name[0] = 0; 168 SemTable[SemHandle].Name[0] = 0;
169 if (sts == NU_SUCCESS) 169 if (sts == NU_SUCCESS)
170 NU_Release_Semaphore(&SemSemCB); 170 NU_Release_Semaphore(&SemSemCB);
171 return(OS_OK); 171 return(OS_OK);
172 } 172 }
173
174 GLOBAL LONG
175 os_CreateSemaphore(OS_HANDLE TaskHandle, char *Name, USHORT Count,
176 OS_HANDLE *SemHandle, OS_HANDLE MemPoolHandle)
177 {
178 USHORT i;
179 STATUS sts;
180
181 if (os_OpenSemaphore(TaskHandle, Name, SemHandle) == OS_OK)
182 return(OS_ERROR);
183 sts = NU_Obtain_Semaphore(&SemSemCB, NU_SUSPEND);
184 for (i = 1; i <= MaxSemaphores; i++) {
185 if (SemTable[i].Name[0])
186 continue;
187 if (NU_Create_Semaphore(&SemTable[i].SemCB, Name, Count,
188 NU_PRIORITY) != NU_SUCCESS)
189 break;
190 strncpy(SemTable[i].Name, Name, RESOURCE_NAMELEN);
191 SemTable[i].Name[RESOURCE_NAMELEN-1] = 0;
192 *SemHandle = i;
193 if (sts == NU_SUCCESS)
194 NU_Release_Semaphore(&SemSemCB);
195 return(OS_OK);
196 }
197 if (sts == NU_SUCCESS)
198 NU_Release_Semaphore(&SemSemCB);
199 return(OS_ERROR);
200 }
201
202 GLOBAL LONG
203 os_CloseSemaphore(OS_HANDLE TaskHandle, OS_HANDLE SemHandle)
204 {
205 return(OS_OK);
206 }