Пример #1
0
//------------------------------------------------------------------------------
// Puts CAudioManager in an initialized state
//
BOOL
CAudioManager::initialize(
    LPCWSTR szContext,
    LPCVOID pBusContext
)
{
    UNREFERENCED_PARAMETER(pBusContext);
    UNREFERENCED_PARAMETER(szContext);

    DEBUGMSG(ZONE_FUNCTION, (L"WAV:+initialize(szContext=%d)\r\n", szContext));

    m_hParentBus = CreateBusAccessHandle((LPCTSTR) szContext);
    m_CurPowerState = PwrDeviceUnspecified;
    m_bSuspend = FALSE;

    m_DriverIndex = 0;
    m_counterForcedQuality = 0;

    // default input and output profiles are the handset
    //
    m_ffOutputAudioProfile = AUDIO_PROFILE_OUT_HANDSET;
    m_ffInputAudioProfile = AUDIO_PROFILE_IN_HANDSET_MIC;

    m_dwStreamAttenMax = kMaximumAudioAttenuation;
    m_dwDeviceAttenMax = kMaximumAudioAttenuation;
    m_dwClassAttenMax  = kMaximumAudioAttenuation;

    m_state = kInitialized;

    InitializeMixers(this);

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

    return TRUE;
}
Пример #2
0
CSerialPDD::CSerialPDD(LPTSTR lpActivePath, PVOID pMdd,  PHWOBJ pHwObj  )
:   CRegistryEdit(lpActivePath)
,   m_pMdd(pMdd)
,   m_pHwObj(pHwObj)
{

    m_hParent = CreateBusAccessHandle(lpActivePath);
    m_PowerHelperHandle = INVALID_HANDLE_VALUE;
    m_hPowerLock = NULL;
    // Initial Open Count.
    m_lOpenCount = 0;
    m_ulCommErrors = 0;
    m_PowerCallbackThread = NULL;
    m_ulRxBufferSize = 0;
    memset(&m_PowerCapabilities,0,sizeof(m_PowerCapabilities));
    if (!GetRegValue(PC_REG_SERIALPRIORITY_VAL_NAME,(LPBYTE)&m_dwPriority256,sizeof(DWORD))) {
        m_dwPriority256 = DEFAULT_CE_THREAD_PRIORITY+55;
    }
}
Пример #3
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;
}
Пример #4
0
BOOL
CSDHCBase::Init(
                LPCTSTR pszActiveKey
                )
{
    BOOL fRet = FALSE;
    SD_API_STATUS status;
    HKEY    hkDevice = NULL;

    hkDevice = OpenDeviceKey(pszActiveKey);
    if (!hkDevice || !m_regDevice.Open(hkDevice, _T(""))) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC: Failed to open device key\n")));
        goto EXIT;
    }

    // Get a handle to our parent bus.
    m_hBusAccess = CreateBusAccessHandle(pszActiveKey);
    if (m_hBusAccess == NULL) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC: Could not get handle to parent\n")));
        goto EXIT;
    }

    m_cSlots = DetermineSlotCount();
    if (m_cSlots == 0) {
        goto EXIT;
    }

    ValidateSlotCount();
	RETAILMSG(0,(TEXT("CSDHCBase::Init  m_cSlots=%d\n"),m_cSlots)); // jylee
    m_pSlotInfos = (PSDHC_SLOT_INFO) LocalAlloc(LPTR, 
        sizeof(SDHC_SLOT_INFO) * m_cSlots);
    if (m_pSlotInfos == NULL) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC Failed to allocate slot info objects\n")));
        goto EXIT;
    }

    status = SDHCDAllocateContext(m_cSlots, &m_pHCDContext);
    if (!SD_API_SUCCESS(status)) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC Failed to allocate context : 0x%08X \n"),
            status));
        goto EXIT;
    }
    
    // Set our extension 
    m_pHCDContext->pHCSpecificContext = this;

    if (!InitializeHardware()) {
        goto EXIT;
    }
	RETAILMSG(0,(TEXT("AllocateSlotObjects\n")));
    // Allocate slot objects
    m_pSlots = AllocateSlotObjects(m_cSlots);
    if (m_pSlots == NULL) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC Failed to allocate slot objects\n")));
        goto EXIT;
    }

    // Initialize the slots
    for (DWORD dwSlot = 0; dwSlot < m_cSlots; ++dwSlot) {
        PSDHC_SLOT_INFO pSlotInfo = &m_pSlotInfos[dwSlot];
        PCSDHCSlotBase pSlot = GetSlot(dwSlot);

		RETAILMSG(0,(TEXT("pSlot->Init\n")));
        RETAILMSG(0,(TEXT("pSlotInfo->pucRegisters : 0x%x\r\n"),pSlotInfo->pucRegisters));
        if (!pSlot->Init(dwSlot, pSlotInfo->pucRegisters, m_pHCDContext, 
            m_dwSysIntr, m_hBusAccess, m_interfaceType, m_dwBusNumber, &m_regDevice)) {
                goto EXIT;
            }
    }

    // set the host controller name
    SDHCDSetHCName(m_pHCDContext, TEXT("HSMMC"));

    // set init handler
    SDHCDSetControllerInitHandler(m_pHCDContext, CSDHCBase::SDHCInitialize);
    // set deinit handler    
    SDHCDSetControllerDeinitHandler(m_pHCDContext, CSDHCBase::SDHCDeinitialize);
    // set the Send packet handler
    SDHCDSetBusRequestHandler(m_pHCDContext, CSDHCBase::SDHCBusRequestHandler);   
    // set the cancel I/O handler
    SDHCDSetCancelIOHandler(m_pHCDContext, CSDHCBase::SDHCCancelIoHandler);   
    // set the slot option handler
    SDHCDSetSlotOptionHandler(m_pHCDContext, CSDHCBase::SDHCSlotOptionHandler);

    // These values must be set before calling SDHCDRegisterHostController()
    // because they are used during that call.
    m_dwPriority = m_regDevice.ValueDW(SDHC_PRIORITY_KEY, SDHC_CARD_CONTROLLER_PRIORITY);
	RETAILMSG(0,(TEXT("SDHCDRegisterHostController\n"))); // jylee
    // now register the host controller 
    status = SDHCDRegisterHostController(m_pHCDContext);

    if (!SD_API_SUCCESS(status)) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHC Failed to register host controller: %0x08X \n"), 
            status));
        goto EXIT;
    }

    m_fRegisteredWithBusDriver = TRUE;
    fRet = TRUE;
	RETAILMSG(0,(TEXT("CSDHCBase::Init Finished.\n"))); // jylee
EXIT:
    if (hkDevice) RegCloseKey(hkDevice);

    return fRet;
}
Пример #5
0
///////////////////////////////////////////////////////////////////////////////
//  SDH_Init - the init entry point 
//  Input:  dwContext - the context for this init
//  Output: 
//  Return: returns instance context
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
DWORD SDH_Init(DWORD dwContext)
{
    PSDCARD_HC_CONTEXT      pHostContext;   // new HC context
    SD_API_STATUS           status;         // SD status
    PSDH_HARDWARE_CONTEXT pController;    // new instance
    HKEY hKeyDevice;
    LPCTSTR pszActiveKey;

    DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDH: +SDH_Init\n")));    

    DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDH: Active RegPath: %s \n"),
        (PTSTR)dwContext));

    pController = NULL;

    // allocate the context
    status = SDHCDAllocateContext(SDH_SLOTS, 
                                  &pHostContext);

    if (!SD_API_SUCCESS(status)) {
        DbgPrintZo(SDCARD_ZONE_ERROR, 
            (TEXT("SDH: Failed to allocate context : 0x%08X \n"), status));
        return 0;
    }

    // create our extension 
    pController = (PSDH_HARDWARE_CONTEXT)malloc( sizeof(SDH_HARDWARE_CONTEXT) );
    if( pController == NULL )
    {
        DbgPrintZo(SDCARD_ZONE_ERROR, 
            (TEXT("SDH: Failed to allocate extension\n")));
        return 0;
    }
    memset( pController, 0, sizeof(SDH_HARDWARE_CONTEXT) );

    // Set our extension
    pHostContext->pHCSpecificContext = pController;

    pController = GetExtensionFromHCDContext(PSDH_HARDWARE_CONTEXT, pHostContext);

    pszActiveKey = (LPCTSTR) dwContext;
    
    pController->pszActiveKey = pszActiveKey;
    pController->hBusAccessHandle = CreateBusAccessHandle( pszActiveKey );

    hKeyDevice = OpenDeviceKey(pszActiveKey);
    if (!hKeyDevice || !LoadRegistrySettings(hKeyDevice, pController) ) {
        DbgPrintZo(SDCARD_ZONE_ERROR, 
        (TEXT("SDH: Failed load the registry settings\n")));
        return 0;
    }
    RegCloseKey( hKeyDevice );

    DbgPrintZo(SDCARD_ZONE_INIT, 
               (TEXT("SDH: Real RegPath: %s \n"),pController->RegPath));
   
    // save off the host context
    pController->pHCContext = pHostContext;

    // set the name
    SDHCDSetHCName(pHostContext, TEXT("Lubbock"));

    // set init handler
    SDHCDSetControllerInitHandler(pHostContext,SDInitialize);  
    // set deinit handler    
    SDHCDSetControllerDeinitHandler(pHostContext, SDDeinitialize);
    // set the bus request handler
    SDHCDSetBusRequestHandler(pHostContext,SDHBusRequestHandler);   
    // set the cancel I/O handler
    SDHCDSetCancelIOHandler(pHostContext, SDHCancelIoHandler);   
    // set the slot option handler
    SDHCDSetSlotOptionHandler(pHostContext, SDHSlotOptionHandler); 
    

    // now register the host controller 
    status = SDHCDRegisterHostController(pHostContext);

    if (!SD_API_SUCCESS(status)) {
        if( pController )
        {
            free( pController );
        }
        SDHCDDeleteContext(pHostContext);
        DbgPrintZo(SDCARD_ZONE_ERROR, 
                (TEXT("SDH: Failed to register host controller: %0x08X \n"),status));
        return 0;
    }

    DbgPrintZo(SDCARD_ZONE_INIT, (TEXT("SDH: -SDH_Init\n")));

    // return the Host Controller context
    return (DWORD)pHostContext;
}