亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sdio.c

?? linux下SDIO的驅動,請查看具體代碼內容.
?? C
?? 第 1 頁 / 共 5 頁
字號:

	// Initialize channels
	HalInitDmaChannel(pSlot->TxDmaChannel,
	                  AuSdConfig[pSlot->SlotNumber].TxDmaDeviceId,
	                  pSlot->DmaBufferSize,
					  TRUE);

	// Initialize channels
	HalInitDmaChannel(pSlot->RxDmaChannel,
	                  AuSdConfig[pSlot->SlotNumber].RxDmaDeviceId,
	                  pSlot->DmaBufferSize,
					  TRUE);

	HalSetDMAForReceive(pSlot->RxDmaChannel);

	// set up DMA interrupt
	hwIntr = HalGetDMAHwIntr(pSlot->TxDmaChannel);
	hwIntr |= (HalGetDMAHwIntr(pSlot->RxDmaChannel) << 8);

	RETAILMSG(1,(TEXT("SDIO Hooking HWINTR %08X\r\n"),hwIntr));

    pSlot->DmaSysIntr = InterruptConnect(Internal, 0, hwIntr, 0);
        
    if (SYSINTR_NOP==pSlot->DmaSysIntr) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIO[%d]: Can't allocate DMA SYSINTR\r\n"),
                   pSlot->SlotNumber));
        goto ErrorReturn;
    }

	RETAILMSG(1,(TEXT("DmaSysIntr = %X\r\n"),pSlot->DmaSysIntr));

        // allocate the dma interrupt event
    pSlot->hDmaInterruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

    if (NULL == pSlot->hDmaInterruptEvent) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIO[%d]: Can't create DMA interrupt event\r\n"),
                   pSlot->SlotNumber));
        goto ErrorReturn;
    }

    if (!InterruptInitialize(pSlot->DmaSysIntr,
                             pSlot->hDmaInterruptEvent,
                             NULL,
                             0)) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIO[%d]: Call to InterruptInitialize failed\r\n"),
                   pSlot->SlotNumber));
    }

    pSlot->DmaIstThreadPriority = SDIO_CARD_CONTROLLER_IST_PRIORITY;

        // create the interrupt thread for controller interrupts
    pSlot->hDmaInterruptThread = CreateThread(NULL,
                                              0,
                                              (LPTHREAD_START_ROUTINE)SDIODmaIstThread,
                                              pSlot,
                                              0,
                                              &threadID);

    if (NULL == pSlot->hDmaInterruptThread) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIO[%d]: Can't create DMA interrupt thread\r\n"),
                   pSlot->SlotNumber));
        goto ErrorReturn;
    }

    return TRUE;
     
        // post error clean-up from here on...
ErrorReturn:
    SDIODeinitializeDMA(pSlot);

    return FALSE;
}

///////////////////////////////////////////////////////////////////////////////
//  SDIODeinitializeDMA - De-Initialize the DMA channel
//  Input:  pSlot - slot context
//  Output: 
//  Return: 
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
VOID SDIODeinitializeDMA(PSDIO_SLOT pSlot)
{
    InterruptDisable(pSlot->DmaSysIntr);

        // free the Tx Channel
    if (NULL!=pSlot->TxDmaChannel) {
        HalFreeDMAChannel(pSlot->TxDmaChannel);
        pSlot->TxDmaChannel = NULL;
    }
                              
        // free the Rx Channel
    if (NULL!=pSlot->RxDmaChannel) {
        HalFreeDMAChannel(pSlot->RxDmaChannel);
        pSlot->RxDmaChannel = NULL;
    }
                              
        // clean up DMA IST
    if (NULL != pSlot->hDmaInterruptThread) {
            // wake up the IST
        SetEvent(pSlot->hDmaInterruptEvent);
            // wait for the thread to exit
        WaitForSingleObject(pSlot->hDmaInterruptThread, INFINITE); 
        CloseHandle(pSlot->hDmaInterruptThread);
        pSlot->hDmaInterruptThread = NULL;
    }
        
        // free DMA interrupt event
    if (NULL != pSlot->hDmaInterruptEvent) {
        CloseHandle(pSlot->hDmaInterruptEvent);
        pSlot->hDmaInterruptEvent = NULL;
    }
}

#endif // #ifdef USE_DMA

///////////////////////////////////////////////////////////////////////////////
//  SendStopTransmission - sends a CMD12 to terminate a write transaction
//  Input:  pSlot -   slot context
//  Output: 
//  Return: 
//  Notes:  This needs to be called in the event of a CRC failure during a
//          multiblock write. The Bus Driver will resend the write request
//          but the controller state machine needs to receive a CMD12 to
//          get it out of the data write state.
///////////////////////////////////////////////////////////////////////////////
VOID SendStopTransmission(PSDIO_SLOT pSlot)
{
	ULONG tmp;

        // check that data busy is active
    if (!(READ_REGISTER_ULONG((PULONG)&pSlot->pSD->status)&SD_STATUS_DB)) {
        return;
    }
    
    SD_INTERRUPTS_DISABLE(pSlot,SD_Int_Response_Done );

        // disable clock freezing
	tmp = READ_REGISTER_ULONG((PULONG)&pSlot->pSD->config2);
	tmp |= SD_CONFIG2_DF;
	WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->config2,tmp);
        // write stop transmission command
    WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->cmd, 0x00810C71);
        // wait for response ready
    while(!(READ_REGISTER_ULONG((PULONG)&pSlot->pSD->cmd)&SD_CMD_RY)) {};
        // read response registers
    (void) READ_REGISTER_ULONG((PULONG)&pSlot->pSD->resp0);
    (void) READ_REGISTER_ULONG((PULONG)&pSlot->pSD->resp1);
    (void) READ_REGISTER_ULONG((PULONG)&pSlot->pSD->resp2);
    (void) READ_REGISTER_ULONG((PULONG)&pSlot->pSD->resp3);
}

///////////////////////////////////////////////////////////////////////////////
//  CompleteRequest - complete a bus reqeust
//  Input:  pSlot -   slot context
//          CompletionStatus - status of completing request
//  Output: 
//  Return: 
//  Notes:
///////////////////////////////////////////////////////////////////////////////
VOID CompleteRequest(PSDIO_SLOT    pSlot,
                     SD_API_STATUS CompletionStatus)
{
    PSD_BUS_REQUEST pRequest;   // the completed request

    pRequest = pSlot->pCurrentRequest;

    if (NULL==pRequest) {
        return;
    }

    pSlot->pCurrentRequest = NULL;
            // turn the clock off
    SDIOClockOff(pSlot);
        // complete the request
    SDHCDIndicateBusRequestComplete(pSlot->pController->pHCContext,
                                    pRequest,
                                    CompletionStatus);
}

///////////////////////////////////////////////////////////////////////////////
//  SDIOInitializeSlot - Initialize SD slot
//  Input:  pSlot - slot context
//  Output: 
//  Return: SD_API_STATUS
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS SDIOInitializeSlot(PSDIO_SLOT pSlot)
{
    SD_API_STATUS status = SD_API_STATUS_SUCCESS;   // intermediate status
    DWORD         threadID;                         // thread ID
	PHYSICAL_ADDRESS PhysAddr;

		// enable slot power
	SDIOPlatPower(pSlot->pController,
	              TRUE,
				  pSlot->SlotNumber);
	
        // allocate the interrupt event for the slot
    pSlot->hInsertionInterruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    
    if (NULL == pSlot->hInsertionInterruptEvent) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

        // initialize the interrupt event for the slot
    if (!InterruptInitialize (pSlot->InsertionSysIntr,
                              pSlot->hInsertionInterruptEvent,
                              NULL,
                              0)) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

    pSlot->InsertionIstThreadPriority = SDIO_CARD_CONTROLLER_IST_PRIORITY;
    
        // create the interrupt thread for insertion interrupts
    pSlot->hInsertionInterruptThread = CreateThread(NULL,
                                                      0,
                                                      (LPTHREAD_START_ROUTINE)SDIOInsertionIstThread,
                                                      pSlot,
                                                      0,
                                                      &threadID);

    if (NULL == pSlot->hInsertionInterruptThread) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

	PhysAddr.HighPart = 0;
	PhysAddr.LowPart = AuSdConfig[pSlot->SlotNumber].SDPhysAddr;

        // map the controller registers
    pSlot->pSD = MmMapIoSpace(PhysAddr,
                              sizeof(*pSlot->pSD),
                              FALSE);

    if (NULL == pSlot->pSD) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIOInitialize - failed to map registers\n")));
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;    
        goto exitInit;
    }

#ifdef USE_DMA
       // do the dma...
    if (pSlot->UsingDma) {
        pSlot->DmaBufferSize = DMA_BUFFER_SIZE;
        if (!SDIOInitializeDMA(pSlot)) {
			pSlot->UsingDma = FALSE;
		}
    }
#endif

        // set the slot to its initial SW state
    pSlot->CardPresent = FALSE;
    pSlot->pCurrentRequest = NULL;

        // reset the slot to its initial state
	ResetSlot(pSlot, TRUE);

exitInit:
	return status;
}

///////////////////////////////////////////////////////////////////////////////
//  SDIODeInitializeSlot - De-Initialize SD slot
//  Input:  pSlot - slot context
//  Output: 
//  Return: 
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
VOID SDIODeinitializeSlot(PSDIO_SLOT pSlot)
{
    InterruptDisable(pSlot->InsertionSysIntr);

        // check for cards in slots
    if (pSlot->CardPresent) {
        pSlot->CardPresent = FALSE;
            // handle remove device
        RemoveDevice(pSlot);
     }

        // clean up insertion IST
    if (NULL != pSlot->hInsertionInterruptThread) {
            // wake up the IST
        SetEvent(pSlot->hInsertionInterruptEvent);
            // wait for the thread to exit
        WaitForSingleObject(pSlot->hInsertionInterruptThread, INFINITE); 
        CloseHandle(pSlot->hInsertionInterruptThread);
        pSlot->hInsertionInterruptThread = NULL;
    }
        
        // free insertion interrupt event
    if (NULL != pSlot->hInsertionInterruptEvent) {
        CloseHandle(pSlot->hInsertionInterruptEvent);
        pSlot->hInsertionInterruptEvent = NULL;
    }

        // unmap registers
    if (NULL != pSlot->pSD) {
        MmUnmapIoSpace((PVOID)pSlot->pSD, SD_CONTROL_REGISTERS_LENGTH);
        pSlot->pSD = NULL;
    }

#ifdef USE_DMA
        // deinitialize DMA stuff
    if (pSlot->UsingDma) {
        SDIODeinitializeDMA(pSlot);
    }
#endif
}

///////////////////////////////////////////////////////////////////////////////
//  SDIOInitialize - Initialize the controller
//  Input:  pHCContext -  host controller context
//  Output: 
//  Return: SD_API_STATUS
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS SDIOInitialize(PSDCARD_HC_CONTEXT pHCContext)
{
    SD_API_STATUS status = SD_API_STATUS_SUCCESS;   // intermediate status
    DWORD         threadID;                         // thread ID
    PSDIO_HW_CONTEXT pController;                   // hardware instance
	int           i;

    pController = GetExtensionFromHCDContext(PSDIO_HW_CONTEXT, pHCContext);

    pController->DriverShutdown = FALSE;

    pController->Slots[0].pController = pController;
    pController->Slots[0].SlotNumber = 0;
    pController->Slots[1].pController = pController;
    pController->Slots[1].SlotNumber = 1;

        // initialize the critical section
    InitializeCriticalSection(&(pController->CriticalSection));

        // initialize the GPIO driver

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米精品一区二区三区在线观看| 亚洲精品视频自拍| 日本道在线观看一区二区| 三级在线观看一区二区| 中文字幕在线一区二区三区| 国产成人免费在线观看| 国产大陆精品国产| 日产精品久久久久久久性色| 自拍偷在线精品自拍偷无码专区 | 91精品国产麻豆国产自产在线 | 色视频一区二区| 国产精品一区二区x88av| 日本系列欧美系列| 一区二区高清在线| 国产精品美女久久久久aⅴ国产馆| 宅男噜噜噜66一区二区66| 色欧美片视频在线观看| 成人激情av网| 国产成人精品免费| 蜜桃精品视频在线观看| 午夜av一区二区| 一区二区三区不卡在线观看 | 欧美精选在线播放| 色婷婷国产精品久久包臀 | 欧美日韩在线免费视频| 99精品一区二区三区| 国产**成人网毛片九色| 国产精品77777竹菊影视小说| 美女精品一区二区| 麻豆一区二区三| 五月天一区二区| 午夜精品一区在线观看| 亚洲一区二区三区不卡国产欧美| 亚洲精品国产第一综合99久久| 国产精品久久久久aaaa樱花 | 亚洲欧美在线视频| 国产精品传媒在线| 中文字幕亚洲一区二区av在线| 国产精品免费av| 亚洲人亚洲人成电影网站色| 亚洲视频免费看| 亚洲一区二区三区四区在线| 一级日本不卡的影视| 亚洲成人免费电影| 日韩精品一二三四| 裸体健美xxxx欧美裸体表演| 毛片av中文字幕一区二区| 麻豆一区二区三| 国产毛片一区二区| av电影在线不卡| 欧洲精品在线观看| 91精品国产综合久久福利软件| 在线综合亚洲欧美在线视频| 久久综合久久久久88| 国产精品久久毛片a| 亚洲黄色性网站| 日韩av一区二区三区四区| 精品综合免费视频观看| 成人丝袜18视频在线观看| 色先锋aa成人| 欧美日韩国产经典色站一区二区三区| 6080国产精品一区二区| 精品国产百合女同互慰| 国产精品三级视频| 亚洲激情自拍偷拍| 另类小说图片综合网| 国产成人av福利| 欧美午夜免费电影| 精品国产免费一区二区三区香蕉| 国产精品美女久久久久久久久久久| 一区二区三区四区中文字幕| 日韩高清不卡一区| 国产91精品久久久久久久网曝门| 色综合色狠狠综合色| 日韩一区二区三区观看| 亚洲欧洲日韩在线| 日本欧美加勒比视频| www.日韩精品| 日韩欧美电影一区| 亚洲欧洲日韩综合一区二区| 免费观看日韩电影| 色综合久久久久久久| 日韩一级在线观看| 亚洲三级免费电影| 精品午夜久久福利影院| 欧美亚洲禁片免费| 日本一区二区在线不卡| 日韩精品成人一区二区在线| www.66久久| 精品国产一区二区三区不卡 | 成人黄色在线视频| 欧美一级免费大片| 亚洲欧美偷拍另类a∨色屁股| 久久99精品久久久| 欧美三电影在线| 亚洲国产精品99久久久久久久久| 日本午夜精品一区二区三区电影 | 久久婷婷国产综合精品青草| 亚洲一级二级在线| 不卡的av网站| 久久在线免费观看| 日韩成人dvd| 91国偷自产一区二区三区成为亚洲经典 | 蜜臀久久99精品久久久久久9| 色婷婷久久久久swag精品 | 久久免费看少妇高潮| 日日夜夜精品免费视频| 色88888久久久久久影院野外| 久久久综合视频| 久久精品国产亚洲一区二区三区| 欧美午夜精品理论片a级按摩| 国产精品美女久久久久久久久 | 911精品产国品一二三产区| 亚洲精品大片www| 91美女片黄在线观看| 国产女同性恋一区二区| 韩国v欧美v亚洲v日本v| 欧美一二三四在线| 全国精品久久少妇| 6080午夜不卡| 日韩精彩视频在线观看| 欧美日韩三级视频| 香蕉成人啪国产精品视频综合网| 色综合中文字幕国产 | 欧洲人成人精品| 亚洲男人天堂一区| 成人av电影观看| 成人欧美一区二区三区黑人麻豆 | 久久影院视频免费| 精品一区二区三区在线播放| 精品国产伦一区二区三区观看方式 | 蜜臀va亚洲va欧美va天堂| 91精品免费观看| 日韩二区三区四区| 日韩欧美精品三级| 久久av资源站| 久久久91精品国产一区二区三区| 韩国一区二区三区| 欧美精品一区二区三| 国产乱子伦视频一区二区三区| 久久新电视剧免费观看| 高清免费成人av| 国产精品久久久久一区| 91尤物视频在线观看| 一区二区三区在线观看网站| 欧美系列在线观看| 蜜臀久久99精品久久久久宅男| 精品电影一区二区三区| 国产成人av影院| 亚洲乱码一区二区三区在线观看| 91黄色小视频| 免费成人美女在线观看.| 久久亚洲私人国产精品va媚药| 国产精品一二三在| 亚洲视频免费看| 6080日韩午夜伦伦午夜伦| 国产综合色产在线精品| 国产精品素人一区二区| 日本韩国精品一区二区在线观看| 亚洲第一激情av| 精品捆绑美女sm三区| aaa欧美日韩| 亚洲成国产人片在线观看| 亚洲精品一区二区三区99| a在线播放不卡| 亚洲成av人片在线| 久久亚洲一区二区三区四区| 99精品欧美一区二区三区小说| 午夜久久电影网| 国产亚洲欧洲一区高清在线观看| 色婷婷国产精品综合在线观看| 免费成人深夜小野草| 中文字幕一区二区三区视频| 欧美精品一级二级| 国产精品影视在线观看| 一区二区免费看| 精品国产sm最大网站免费看| 91小宝寻花一区二区三区| 青青国产91久久久久久| 亚洲色大成网站www久久九九| 欧美一区二区啪啪| 95精品视频在线| 久久精品国产亚洲5555| 亚洲尤物视频在线| 久久精品一区二区三区不卡| 欧美视频一区在线| 成人一级片网址| 美女视频黄a大片欧美| 亚洲女女做受ⅹxx高潮| 久久久不卡影院| 日韩免费高清av| 欧美三级蜜桃2在线观看| 懂色av一区二区三区蜜臀| 日韩中文字幕91| 亚洲伦理在线精品| 国产精品卡一卡二卡三| 精品欧美一区二区久久| 欧美裸体bbwbbwbbw| 色婷婷综合视频在线观看| 国产盗摄一区二区|