/********************************************************* Create semaphores for this module */ HRESULT briCreateSemaphores(void) { HRESULT hResult = NO_ERROR; // bus reset indication check semaphore hResult = TCSemaphoreOpen(&briIndicationSemID, 0); if (hResult != NO_ERROR) return hResult; // exclusive exclusive access for briIndicationWaitingTasks (mutex) hResult = TCMutexOpen(&briIndicationMutexSemID); if (hResult != NO_ERROR) return hResult; // bus reset completion check semaphore hResult = TCSemaphoreOpen(&briCompletionSemID, 0); if (hResult != NO_ERROR) return hResult; // exclusive exclusive access for briCompletionWaitingTasks (mutex) hResult = TCMutexOpen(&briCompletionMutexSemID); if (hResult != NO_ERROR) return hResult; #ifdef _BRI_PRE_COMPLETION // bus reset pre completion check semaphore hResult = TCSemaphoreOpen(&briPreCompletionSemID, 0); if (hResult != NO_ERROR) return hResult; // exclusive exclusive access for briPreCompletionWaitingTasks (mutex) hResult = TCMutexOpen(&briPreCompletionMutexSemID); if (hResult != NO_ERROR) return hResult; #endif //_BRI_PRE_COMPLETION return hResult; }
/********************************************************* Create semaphores for this module */ HRESULT avrDrdCreateSemaphores(void) { HRESULT hResult = NO_ERROR; #if 0 //LM??? not used hResult = TCMutexOpen(&avrDrdHandlerSemID); if (hResult != NO_ERROR) return hResult; #endif return hResult; }
HRESULT lmCreateList(LM_CONTEXT* newlist, uint32 list_sizeinbytes, uint32 elem_sizeinbyte, uint32* elementcount) { HRESULT hResult = NO_ERROR; uint32 internalelementsize = 0; uint32 myelemcount = 0; uint32 counter = 0; LM_ELEMENT *curelem = NULL; if (!newlist || list_sizeinbytes < sizeof(LM_CONTEXT)) { hResult = E_BAD_INPUT_PARAMETERS; sysLogError(hResult, __LINE__, moduleName); return hResult; } memset(newlist, 0, list_sizeinbytes); internalelementsize = elem_sizeinbyte + sizeof(LM_ELEMENT); myelemcount = (list_sizeinbytes - sizeof(LM_CONTEXT)) / internalelementsize; if (elementcount) { *elementcount = myelemcount; } curelem = (LM_ELEMENT*) &(newlist->elements); while (counter++ < myelemcount) { if (curelem == NULL) { hResult = E_NULL_PTR; sysLogError(hResult, __LINE__, moduleName); return hResult; } curelem->flags += ELEMFLAG_AVAILABLE; lmMoveAheadElementSize(elem_sizeinbyte, &curelem); } newlist->listsize = list_sizeinbytes; newlist->nextfree = 0; newlist->elemsize = elem_sizeinbyte; newlist->elemcount = myelemcount; // Number of allocated elements newlist->mode = LM_LISTMODE_EXCLUSIVEACCESS; // setup semaphores for the list (mutex) hResult = TCMutexOpen(&(newlist->lmMutexSemID)); return hResult; }
HRESULT crInitialize(void) { HRESULT hResult = NO_ERROR; // exclusive access for the cr list (mutex) hResult = TCMutexOpen(&crListMutexSemID); if (hResult != NO_ERROR) return hResult; #ifdef _CLI_TOOL_AVC_CR crCliInstallTools(); #endif //_CLI_TOOL_AVC_CR return hResult; }
/********************************************************* Create semaphores for this module */ HRESULT lhlStatusQueueCreateSemaphores(void) { HRESULT hResult = NO_ERROR; uint32 index; for (index = 0; index < STATUS_INFO_ITEMS; index++) { // status info synchronization semaphore // handling multiple... requests/responses read, write, lock, error hResult = TCSemaphoreOpen(&statusInfoQueue.statusInfo[index].semID, 0); if (hResult != NO_ERROR) return hResult; } // exclusive access for the statusInfoQueue (mutex) hResult = TCMutexOpen(&lhlStatusQueueMutexSemID); if (hResult != NO_ERROR) return hResult; return hResult; }