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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sdio.c

?? linux下SDIO的驅(qū)動,請查看具體代碼內(nèi)容.
?? C
?? 第 1 頁 / 共 5 頁
字號:
    pController->hGPIO = GPIO_Init();

    if (INVALID_HANDLE_VALUE == pController->hGPIO) {
        DEBUGMSG(SDCARD_ZONE_ERROR,(TEXT("SDIO: Unable to opne GPIO device\r\n")));
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

	status = SDIOPlatInit(pController);

	if (SD_API_STATUS_SUCCESS != status) {
		goto exitInit;
	}

        // allocate the controller interrupt event
    pController->hControllerInterruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    
    if (NULL == pController->hControllerInterruptEvent) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

        // initialize the controller interrupt event
    if (!InterruptInitialize (pController->SysIntr,
                              pController->hControllerInterruptEvent,
                              NULL,
                              0)) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

    pController->ControllerIstThreadPriority = SDIO_CARD_CONTROLLER_IST_PRIORITY;
    
        // create the interrupt thread for controller interrupts
    pController->hControllerInterruptThread = CreateThread(NULL,
                                                      0,
                                                      (LPTHREAD_START_ROUTINE)SDIOControllerIstThread,
                                                      pController,
                                                      0,
                                                      &threadID);

    if (NULL == pController->hControllerInterruptThread) {
        status = SD_API_STATUS_INSUFFICIENT_RESOURCES;
        goto exitInit;
    }

		// initialize the slots
	for (i=0;i<SDIOPlatNumSlots();i++) {
		status = SDIOInitializeSlot(&pController->Slots[i]);
		if (SD_API_STATUS_SUCCESS != status) {
			goto exitInit;
		}
	}

    pController->Initialized = TRUE;

        // wake up the interrupt thread to check the slot
    SetEvent(pController->hControllerInterruptEvent);

		// initialize the slots
	for (i=0;i<SDIOPlatNumSlots();i++) {
		SetEvent(pController->Slots[i].hInsertionInterruptEvent);
	}

exitInit:

    if (!SD_API_SUCCESS(status)) {
            // just call the deinit handler directly to cleanup
        SDIODeinitialize(pHCContext);
    }

    DumpController(pController);

    return status;

}

///////////////////////////////////////////////////////////////////////////////
//  SDIODeInitialize - De-Initialize the SDIO Controller
//  Input:  pHCContext - HC context
//  Output: 
//  Return: SD_API_STATUS
//  Notes:  
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS SDIODeinitialize(PSDCARD_HC_CONTEXT pHCContext)
{
    PSDIO_HW_CONTEXT pController;    // the controller
	int i;

    pController = GetExtensionFromHCDContext(PSDIO_HW_CONTEXT, pHCContext);

#ifdef DEBUG
    DumpController(pController);
#endif
        // mark for shutdown
        // this will cause all IST to terminate when signalled
    pController->DriverShutdown = TRUE;

    if (pController->Initialized) {
            // disable interrupts
        InterruptDisable(pController->SysIntr);

            // clean up controller IST
        if (NULL != pController->hControllerInterruptThread) {
                // wake up the IST
            SetEvent(pController->hControllerInterruptEvent);
                // wait for the thread to exit
            WaitForSingleObject(pController->hControllerInterruptThread, INFINITE); 
            CloseHandle(pController->hControllerInterruptThread);
            pController->hControllerInterruptThread = NULL;
        }
        
            // free controller interrupt event
        if (NULL != pController->hControllerInterruptEvent) {
            CloseHandle(pController->hControllerInterruptEvent);
            pController->hControllerInterruptEvent = NULL;
        }

            // close GPIO handle
        CloseHandle(pController->hGPIO);

            // delete the critical sections
        DeleteCriticalSection(&(pController->CriticalSection));

		SDIOPlatDeinit(pController);

            // deinitialize each slot
        for (i=0;i<SDIOPlatNumSlots();i++) {
			SDIODeinitializeSlot(&pController->Slots[i]);
		}
    }

    return SD_API_STATUS_SUCCESS;
}

///////////////////////////////////////////////////////////////////////////////
//  SDIOBusRequestHandler - bus request handler 
//  Input:  pHostContext - host controller context
//          Slot - slot the request is going on
//          pRequest - the request
//  Output: 
//  Return: SD_API_STATUS
//  Notes:  The request passed in is marked as uncancelable, this function
//          has the option of making the outstanding request cancelable    
//          returns status pending if request submitted successfully
///////////////////////////////////////////////////////////////////////////////
SD_API_STATUS SDIOBusRequestHandler(PSDCARD_HC_CONTEXT pHCContext, DWORD Slot, PSD_BUS_REQUEST pRequest) {

    PSDIO_HW_CONTEXT pController;            // the controller
    PSDIO_SLOT       pSlot;                  // the slot
    ULONG            commandRegister;        // SD_CMD register control value
    ULONG            blkSizeRegister;        // SD_BLKSIZE register value
    BOOL             IOAbort = FALSE;        // request is an IO Abort
    static BOOL lastCmd53 = FALSE;
	ULONG            tmp;

        // check slot number is in range
    if (Slot >= (DWORD)SDIOPlatNumSlots()) {
        DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDIOSDSendHandler - Slot %d outside valid range 0-%d\n"),
                   Slot,
                   SDIOPlatNumSlots()));
        return SD_API_STATUS_INVALID_PARAMETER;
    }

    DEBUGMSG(SDIO_SEND_ZONE,(TEXT("SDIOBusRequestHandler: Sending CMD%d (%d blocks) Size %d Arg=%08X Read=%d\r\n"),pRequest->CommandCode,pRequest->NumBlocks,pRequest->BlockSize,pRequest->CommandArgument,TRANSFER_IS_READ(pRequest)));
    
        // get our extension 
    pController = GetExtensionFromHCDContext(PSDIO_HW_CONTEXT, pHCContext);
        // get pointer to slot context
    pSlot = &pController->Slots[Slot];
    pSlot->pCurrentRequest = pRequest;
        // set block/byte count to zero
	pRequest->HCParam = (DWORD)&HCParams;

    HCParams.BytesCopied = 0;
	HCParams.BlocksCopied = 0;
	HCParams.BuffersOutstanding = 0;

        // initialize command register with command code
    commandRegister = SD_CMD_CI_N(pRequest->CommandCode);
        // set GO bit
    commandRegister |= SD_CMD_GO;
    
        // setup for response type
    switch (pRequest->CommandResponse.ResponseType) {
        case NoResponse:  commandRegister |= SD_CMD_RT_NONE; break;
        case ResponseR1:  commandRegister |= SD_CMD_RT_R1;   break;
        case ResponseR1b: commandRegister |= SD_CMD_RT_R1b;  break;
        case ResponseR2:  commandRegister |= SD_CMD_RT_R2;   break;
        case ResponseR3:  commandRegister |= SD_CMD_RT_R3;   break;
        case ResponseR4:  commandRegister |= SD_CMD_RT_R4;   break;
        case ResponseR5:  commandRegister |= SD_CMD_RT_R5;   break;
        case ResponseR6:  commandRegister |= SD_CMD_RT_R6;   break;
        default: return SD_API_STATUS_INVALID_PARAMETER;
    }

		// set the command type field of the command register
	if (TRANSFER_HAS_DATA_PHASE(pRequest)) {
            // check for various flavours of IO_RW_EXTENDED
		if (SD_CMD_IO_RW_EXTENDED == pRequest->CommandCode) {
                // are we in block mode ?
            if (IO_RW_EXTENDED_BLOCK_MODE(pRequest->CommandArgument)) {
                    // is the block count infinite ?
                if (0 == IO_RW_EXTENDED_COUNT(pRequest->CommandArgument)) {
                    if (TRANSFER_IS_READ(pRequest)) {
                        commandRegister |= SD_CMD_CT_MBR;
                    } else {
                        commandRegister |= SD_CMD_CT_MBW;
                    }
                } else {
			        if (TRANSFER_IS_READ(pRequest)) {
				        commandRegister |= SD_CMD_CT_MBIOR;
			        } else {
				        commandRegister |= SD_CMD_CT_MBIOW;
			        }
                }
            } else {
                if (TRANSFER_IS_READ(pRequest)) {
                    commandRegister |= SD_CMD_CT_SBR;
                } else {
                    commandRegister |= SD_CMD_CT_SBW;
                }
            }
        } else {
            if (TRANSFER_IS_READ(pRequest)) {
                if (SD_CMD_READ_MULTIPLE_BLOCK == pRequest->CommandCode) {
                    commandRegister |= SD_CMD_CT_MBR;
                } else {
                    commandRegister |= SD_CMD_CT_SBR;
                }
            } else {
                if (SD_CMD_WRITE_MULTIPLE_BLOCK == pRequest->CommandCode) {
                    commandRegister |= SD_CMD_CT_MBW;
                } else {
                    commandRegister |= SD_CMD_CT_SBW;
                }
            }
		}
	    // check for Stop Transmission command
    } else if (SD_CMD_STOP_TRANSMISSION == pRequest->CommandCode) {
            // set for CMD12 stop transmission
        commandRegister |= SD_CMD_CT_TERM;
        // check for an IO Abort
    } else if ((SD_CMD_IO_RW_DIRECT == pRequest->CommandCode) &&
               (SD_IO_REG_IO_ABORT == IO_RW_DIRECT_ADDR_ARG(pRequest->CommandArgument))) {
        commandRegister |= SD_CMD_CT_TERMIO;
        IOAbort = TRUE;
    } 

    if (!pSlot->CardInitialised) {
            // Send at least 80 clocks to the card before 1st command is sent
        Sleep(2);
        pSlot->CardInitialised = TRUE;
    }

        // wait for data busy bit to be clear, unless this
        // is a STOP TRANSMISSION or IO ABORT
    if (SD_CMD_STOP_TRANSMISSION != pRequest->CommandCode && !IOAbort) {
           // if the previous command is command 53 and the data busy bit is on,
	       // there is a chance that the clock may be frozen.  Set DF to 1 to get
           // the clock back.
		if (lastCmd53 && (READ_REGISTER_ULONG((PULONG)&pSlot->pSD->status) & SD_STATUS_DB )) {
			tmp = READ_REGISTER_ULONG((PULONG)&pSlot->pSD->config2);
			tmp |= SD_CONFIG2_DF;
			WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->config2, tmp);
		}
        while( READ_REGISTER_ULONG((PULONG)&pSlot->pSD->status) & SD_STATUS_DB) {
            ; // do nothing
        }
    }

		// handle setting for data transfers
	if (TRANSFER_HAS_DATA_PHASE(pRequest)) {

		   // Ensure the block count & block size are both within the range.
		if (pRequest->NumBlocks > SD_MAX_BLOCK_COUNT ||
			pRequest->BlockSize > SD_MAX_BLOCK_SIZE) {
			return SD_API_STATUS_INVALID_PARAMETER;
		}

            // Set block size and count
        blkSizeRegister =  SD_BLKSIZE_BC_N(pRequest->NumBlocks);	// Macro does -1 for us
        blkSizeRegister |= SD_BLKSIZE_BS_N(pRequest->BlockSize);	// Macro does -1 for us
        WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->blksize, blkSizeRegister);

            // enable clock freezing
		tmp = READ_REGISTER_ULONG((PULONG)&pSlot->pSD->config2);
		tmp &= ~SD_CONFIG2_DF;
		tmp |= SD_CONFIG2_FF;
		WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->config2, tmp);
    }

	// work out if we want to fall back to PIO rather than DMA
	// right now we can only handle DMA for transfer that are a multiple
	// of four bytes
	if (pSlot->UsingDma) {
		if ( TRANSFER_HAS_DATA_PHASE(pRequest) && (pRequest->BlockSize & 0x3)) {
			pSlot->UsingDmaThisCmd = FALSE;
		} else {
			pSlot->UsingDmaThisCmd = TRUE;
		}
	} else {
		pSlot->UsingDmaThisCmd = FALSE;
	}

#ifdef USE_DMA
        // handle data phase transfer, we actually start the DMA
        // transfers in HandleResponseDone
    if (pSlot->UsingDmaThisCmd && TRANSFER_HAS_DATA_PHASE(pRequest)) {

        if (TRANSFER_IS_READ(pRequest)) {
			PULONG pDmaBuffer;
			ULONG  bufferSize;

			bufferSize = min((pRequest->NumBlocks*pRequest->BlockSize),pSlot->DmaBufferSize);

                // enable both buffers
			HalStopDMA(pSlot->RxDmaChannel);

			pDmaBuffer = HalGetNextDMABuffer(pSlot->RxDmaChannel);
			HalActivateDMABuffer(pSlot->RxDmaChannel,pDmaBuffer,bufferSize);

			pDmaBuffer = HalGetNextDMABuffer(pSlot->RxDmaChannel);
			HalActivateDMABuffer(pSlot->RxDmaChannel,pDmaBuffer,bufferSize);
        } else if (TRANSFER_IS_WRITE(pRequest)) {
			PULONG pDmaBuffer;
			ULONG  copySize;
			HalStopDMA(pSlot->TxDmaChannel);
                // fill next buffer
			pDmaBuffer = HalGetNextDMABuffer(pSlot->TxDmaChannel);
            copySize = CopyToDmaBuffer(pRequest,pDmaBuffer);
            HalActivateDMABuffer(pSlot->TxDmaChannel,pDmaBuffer,copySize);
                // fill other buffer if more than 1 block to write
            if (pRequest->NumBlocks > ((PHC_PARAMS)pRequest->HCParam)->BlocksCopied) {
				pDmaBuffer = HalGetNextDMABuffer(pSlot->TxDmaChannel);
				copySize = CopyToDmaBuffer(pRequest,pDmaBuffer);
				HalActivateDMABuffer(pSlot->TxDmaChannel,pDmaBuffer,copySize);
            }
        }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
777色狠狠一区二区三区| 亚洲一区中文在线| 久久久99精品免费观看不卡| 制服丝袜激情欧洲亚洲| 欧美久久久久久久久| 欧美日韩国产首页| 欧美精品日韩一本| 欧美精品v国产精品v日韩精品| 91国偷自产一区二区三区成为亚洲经典| 9i在线看片成人免费| proumb性欧美在线观看| 91在线观看美女| 99国产一区二区三精品乱码| 91麻豆国产在线观看| 色婷婷综合久色| 欧美日韩视频在线一区二区| 欧美另类高清zo欧美| 91精品黄色片免费大全| 日韩精品一区二区三区三区免费 | 欧美国产精品专区| 日本一区二区电影| 亚洲精品高清视频在线观看| 亚洲bt欧美bt精品777| 日韩电影一二三区| 国产自产2019最新不卡| 国产精品1区二区.| thepron国产精品| 欧美日韩免费视频| 欧美成人三级电影在线| 日本一区二区免费在线 | 日产精品久久久久久久性色| 经典三级一区二区| 99久久99久久精品国产片果冻 | 久久综合久久综合久久| 国产婷婷一区二区| 一级中文字幕一区二区| 蜜桃精品视频在线| 成人av在线资源网站| 91行情网站电视在线观看高清版| 欧美一级高清大全免费观看| 国产天堂亚洲国产碰碰| 亚洲综合成人在线| 国精品**一区二区三区在线蜜桃| 波多野结衣精品在线| 欧美精品久久99久久在免费线 | 精品在线观看免费| 91亚洲国产成人精品一区二区三| 欧美三级电影在线看| 精品国产污污免费网站入口 | 婷婷中文字幕综合| 国产不卡视频在线播放| 欧美精品第1页| 中文字幕日韩av资源站| 日韩国产欧美在线播放| 99久久综合精品| 日韩欧美在线1卡| 亚洲情趣在线观看| 国产精品一区二区三区乱码| 欧美日韩成人高清| 国产农村妇女毛片精品久久麻豆 | 国产日韩欧美亚洲| 亚洲成人一区二区| 波多野结衣欧美| 精品久久久久99| 亚洲一区二区三区四区在线观看 | 97久久超碰国产精品| 日韩午夜精品电影| 一区二区三区免费网站| 国产99久久久国产精品免费看| 欧美日韩精品一区二区三区四区| 中文av一区二区| 久久99精品国产.久久久久| 欧美午夜不卡视频| 最新久久zyz资源站| 狠狠色丁香婷婷综合| 欧美日韩一级片在线观看| 最新热久久免费视频| 国产成人精品免费看| 日韩美女天天操| 肉色丝袜一区二区| 欧美午夜一区二区三区免费大片| 国产精品不卡视频| 国产成人av影院| 26uuu亚洲| 精品一区二区在线观看| 欧美精三区欧美精三区| 亚洲综合色视频| 色综合中文字幕| 国产精品你懂的在线| 国产乱国产乱300精品| 日韩免费看的电影| 免费成人av资源网| 欧美一区二区三区视频在线| 日韩精品一卡二卡三卡四卡无卡| 欧美色精品在线视频| 亚洲一区二区三区美女| 91福利在线观看| 一区二区三区在线视频观看58| 91蝌蚪porny| 亚洲精品五月天| 欧美性猛交xxxx乱大交退制版| 亚洲女人的天堂| 在线视频国内一区二区| 一区二区三区在线视频免费| 欧美午夜精品久久久久久孕妇| 亚洲一区二区视频| 欧美精品在线一区二区| 奇米色一区二区| 欧美不卡一区二区三区| 九九精品一区二区| 国产亚洲欧美一级| 岛国av在线一区| 成人免费在线播放视频| 成人av网在线| 一区二区三区欧美| 欧美老年两性高潮| 精品系列免费在线观看| 国产欧美综合在线观看第十页| 成人一区二区三区视频| 亚洲精品成a人| 欧美一二三区在线| 国产麻豆午夜三级精品| 国产精品免费观看视频| 91美女片黄在线| 亚洲成人av福利| 日韩免费福利电影在线观看| 国产成人免费在线观看不卡| 日韩美女视频19| 欧美肥妇bbw| 狠狠v欧美v日韩v亚洲ⅴ| 国产精品美女久久久久高潮| 91九色最新地址| 日韩激情视频网站| 国产亚洲午夜高清国产拍精品| 成人免费毛片app| 午夜欧美在线一二页| 欧美精品一区二区三区蜜桃| www.日韩精品| 日本亚洲三级在线| 欧美激情一区二区三区蜜桃视频 | 欧美成人bangbros| 成人av高清在线| 偷拍亚洲欧洲综合| 国产拍欧美日韩视频二区| 欧美在线视频不卡| 国产一区二三区| 一级做a爱片久久| 久久在线观看免费| 一本久道中文字幕精品亚洲嫩| 日本vs亚洲vs韩国一区三区二区| 国产欧美精品一区| 欧美三级电影在线看| 国产成人精品三级| 日韩国产一区二| **欧美大码日韩| 精品国产乱码久久久久久牛牛 | 精品日韩一区二区三区| 91麻豆123| 国产成a人亚洲精| 青椒成人免费视频| 一区二区三区四区激情| 久久精品欧美日韩| 欧美精品aⅴ在线视频| 成人涩涩免费视频| 蜜臀av一区二区在线观看| 亚洲欧美日韩电影| 久久久综合九色合综国产精品| 欧美综合久久久| 成人少妇影院yyyy| 久久av资源网| 日日夜夜一区二区| 一区二区三区四区视频精品免费| 久久免费看少妇高潮| 7777精品伊人久久久大香线蕉| 白白色亚洲国产精品| 国产在线一区观看| 奇米一区二区三区av| 亚洲制服丝袜一区| 国产精品传媒入口麻豆| 久久亚洲私人国产精品va媚药| 这里只有精品免费| 欧美亚洲综合网| aaa国产一区| 成人精品亚洲人成在线| 国产毛片精品一区| 久久国产精品色婷婷| 日韩国产一区二| 午夜精品视频一区| 亚洲美女免费在线| 亚洲天堂av老司机| 国产精品福利一区二区三区| 国产片一区二区| 欧美经典一区二区三区| 久久网这里都是精品| 精品日韩av一区二区| 日韩精品中文字幕在线一区| 91精品国产色综合久久ai换脸 | 欧美精品一级二级三级| 欧美亚洲综合久久| 欧美三级电影一区|