Пример #1
0
CSerialPDD::~CSerialPDD()
{   
    InitialEnableInterrupt(FALSE); 
    if (m_PowerHelperHandle != INVALID_HANDLE_VALUE )
        DDKPwr_Deinitialize(m_PowerHelperHandle);
    if (m_hParent)
        CloseBusAccessHandle(m_hParent);
    if (m_PowerCallbackThread)
        delete m_PowerCallbackThread;
    InitialPower(FALSE);
}
Пример #2
0
extern BOOL HcdPdd_Deinit(DWORD hDeviceContext)
{
	SOhcdPdd * pPddObject = (SOhcdPdd *)hDeviceContext;

	USBH_MSG((_T("[USBH] HcdPdd_Deinit()\n\r")));

	if(pPddObject->lpvOhcdMddObject)
	{
		HcdMdd_DestroyHcdObject(pPddObject->lpvOhcdMddObject);
	}

	if(pPddObject->lpvMemoryObject)
	{
		HcdMdd_DestroyMemoryObject(pPddObject->lpvMemoryObject);
	}

	if(pPddObject->pvVirtualAddress)
	{
		HalFreeCommonBuffer(&pPddObject->AdapterObject, pPddObject->dwPhysicalMemSize, pPddObject->LogicalAddress, pPddObject->pvVirtualAddress, FALSE);
	}

	if (pPddObject->IsrHandle)
	{
		FreeIntChainHandler(pPddObject->IsrHandle);
		pPddObject->IsrHandle = NULL;
	}

	if (pPddObject->hParentBusHandle)
	{
		CloseBusAccessHandle(pPddObject->hParentBusHandle);
	}

	free(pPddObject);

	if (g_pSysConReg)
	{
		//-----------------------
		// Deitialize Clock
		// HCLK, SCLK gate Mask
		//-----------------------
		g_pSysConReg->HCLK_GATE &= ~(0x1<<29);		// HCLK_UHOST Mask (EVT1)
		g_pSysConReg->SCLK_GATE &= ~(0x1<<30);		// SCLK_UHOST Mask

		DrvLib_UnmapIoSpace((PVOID)g_pSysConReg);
		g_pSysConReg = NULL;
	}

	return TRUE;
}
Пример #3
0
//------------------------------------------------------------------------------
// Puts CAudioManager in an initialized state
//
BOOL
CAudioManager::deinitialize()
{
    DEBUGMSG(ZONE_FUNCTION, (L"WAV:+deinitialize()\r\n"));

    if (m_hParentBus)
    {
        SetDevicePowerState(m_hParentBus, D4 , NULL);
        CloseBusAccessHandle(m_hParentBus);
        m_hParentBus = NULL;
    }

    DEBUGMSG(ZONE_FUNCTION, (L"WAV:-deinitialize()\r\n"));

    return TRUE;
}
Пример #4
0
CSDHCBase::~CSDHCBase(
                      )
{
    // We call PreDeinit just in case we are not being destroyed by
    // a call to SHC_PreDeinit.
    PreDeinit();

    if (m_fHardwareInitialized) {
        DeinitializeHardware();
    }

    if (m_pHCDContext) {
        // Cleanup the host context
        SDHCDDeleteContext(m_pHCDContext);
    }

    if (m_pSlots) delete [] m_pSlots;
    if (m_pSlotInfos) LocalFree(m_pSlotInfos);
    if (m_hBusAccess) CloseBusAccessHandle(m_hBusAccess);
}
Пример #5
0
//------------------------------------------------------------------------------
// central routine which ensures all resources are freed for the class
//
void
CAudioManager::InternalCleanUp()
{
    DEBUGMSG(ZONE_FUNCTION, (L"WAV:+InternalCleanUp()\r\n"));

    if (m_state != kUninitialized)
    {
        // clean-up some resources
        //
        if (m_hParentBus)
        {
            SetDevicePowerState(m_hParentBus, D4 , NULL);
            CloseBusAccessHandle(m_hParentBus) ;
        }

        m_state = kUninitialized;
    }

    DEBUGMSG(ZONE_FUNCTION, (L"WAV:-InternalCleanUp()\r\n"));
}
Пример #6
0
/* HcdPdd_Init
 *
 *   PDD Entry point - called at system init to detect and configure OHCI card.
 *
 * Return Value:
 *   Return pointer to PDD specific data structure, or NULL if error.
 */
extern DWORD
HcdPdd_Init(
	DWORD dwContext)	// IN - Pointer to context value. For device.exe, this is a string
						// indicating our active registry key.
{
	SOhcdPdd *  pPddObject = malloc(sizeof(SOhcdPdd));
	BOOL        fRet = FALSE;

	USBH_MSG((_T("[USBH] HcdPdd_Init()\n\r")));

	if (pPddObject)
	{
		pPddObject->pvVirtualAddress = NULL;
		InitializeCriticalSection(&pPddObject->csPdd);
		pPddObject->IsrHandle = NULL;
		pPddObject->hParentBusHandle = CreateBusAccessHandle((LPCWSTR)g_dwContext);

		if (pPddObject->hParentBusHandle)
		{
			fRet = InitializeOHCI(pPddObject, (LPCWSTR)dwContext);
		}

		if(!fRet)
		{
			if (pPddObject->hParentBusHandle)
			{
				CloseBusAccessHandle(pPddObject->hParentBusHandle);
			}

			DeleteCriticalSection(&pPddObject->csPdd);
			free(pPddObject);
			pPddObject = NULL;
		}
	}

	return (DWORD)pPddObject;
}