//.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtuEventsInit -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- // // Initialised the events structure and mark the event as Initialised/InUse. // DtStatus DtuEventsInit(DtuDeviceData* pDvcData) { Int i; for (i=0; i<MAX_NUM_FILE_HANDLES; i++) { pDvcData->m_Events[i].m_RefCount = 0; // Initialize spinlock DtSpinLockInit(&pDvcData->m_Events[i].m_Lock); DtEventInit(&pDvcData->m_Events[i].m_PendingEvent, FALSE); } return DT_STATUS_OK; }
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaEnDecInit -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- // DtStatus DtaEnDecInit(DtaNonIpPort* pNonIpPort) { DtaEnDecPort* pEnDec = &pNonIpPort->m_EnDec; // Initialize common data first pEnDec->m_ExclAccess = FALSE; DtSpinLockInit(&pEnDec->m_ExclAccessLock); // Defer to encoder/decoder specific implementation if (pNonIpPort->m_pDvcData->m_DevInfo.m_TypeNumber == 2180 || pNonIpPort->m_pDvcData->m_DevInfo.m_TypeNumber == 2182) return DtaEncD7ProInit(pNonIpPort, DtaEnDecExclusiveAccess); return DT_STATUS_NOT_SUPPORTED; }
//.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaEventsAllocEventsObject -.-.-.-.-.-.-.-.-.-.-.-.-.-.-. // static DtaEvents* DtaEventsAllocEventsObject( DtaDeviceData* pDvcData, DtFileObject* pFileHandle, UInt EventTypeMask) { DtaEvents* pDtaEvents; pDtaEvents = (DtaEvents*)DtMemAllocPool(DtPoolNonPaged, sizeof(DtaEvents), DTA_TAG); if (pDtaEvents == NULL) { DtDbgOut(ERR, EVENTS, "Out of memory allocating DtaEvents struct"); return NULL; } DtAtomicSet(&pDtaEvents->m_RefCount, 1); pDtaEvents->m_File = *pFileHandle; pDtaEvents->m_EventTypeMask = EventTypeMask; pDtaEvents->m_CancelInProgress = FALSE; pDtaEvents->m_NumPendingEvents = 0; DtEventInit(&pDtaEvents->m_PendingEvent, FALSE); DtSpinLockInit(&pDtaEvents->m_Lock); memset(&pDtaEvents->m_PendingEvents, 0, sizeof(pDtaEvents->m_PendingEvents)); // Insert at start of list DtSpinLockAcquire(&pDvcData->m_EventsSpinlock); pDtaEvents->m_pPrev = NULL; pDtaEvents->m_pNext = NULL; if (pDvcData->m_pEvents != NULL) { pDtaEvents->m_pNext = pDvcData->m_pEvents; pDtaEvents->m_pNext->m_pPrev = pDtaEvents; } pDvcData->m_pEvents = pDtaEvents; DtSpinLockRelease(&pDvcData->m_EventsSpinlock); return pDtaEvents; }
//.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- DtaEventsInit -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- // // Initialised the events structure and mark the event as Initialised/InUse. // DtStatus DtaEventsInit(DtaDeviceData* pDvcData) { DtSpinLockInit(&pDvcData->m_EventsSpinlock); pDvcData->m_pEvents = NULL; return DT_STATUS_OK; }