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

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

?? sdio.c

?? AU1100嵌入式處理器SD卡驅動程序源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
                                                      &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()) {
        DbgPrintZo(SDCARD_ZONE_ERROR, (TEXT("SDIOSDSendHandler - Slot %d outside valid range 0-%d\n"),
                   Slot,
                   SDIOPlatNumSlots()));
        return SD_API_STATUS_INVALID_PARAMETER;
    }

    DbgPrintZo(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 = 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);
        blkSizeRegister |= SD_BLKSIZE_BS_N(pRequest->BlockSize-1);
        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
    if (pSlot->UsingDmaThisCmd && TRANSFER_HAS_DATA_PHASE(pRequest)) {

        if (TRANSFER_IS_READ(pRequest)) {
			PULONG pDmaBuffer;
                // enable both buffers
				// IMR, is this necessary ?
			HalStopDMA(pSlot->RxDmaChannel);

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

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

			HalStartDMA(pSlot->RxDmaChannel);

        } else if (TRANSFER_IS_WRITE(pRequest)) {
			PULONG pDmaBuffer;
			HalStopDMA(pSlot->TxDmaChannel);
                // fill next buffer
			pDmaBuffer = HalGetNextDMABuffer(pSlot->TxDmaChannel);
            CopyToDmaBuffer(pRequest,pDmaBuffer);
            HalActivateDMABuffer(pSlot->TxDmaChannel,pDmaBuffer,pRequest->BlockSize);
                // fill other buffer if more than 1 block to write
            if (pRequest->NumBlocks > 1) {
				pDmaBuffer = HalGetNextDMABuffer(pSlot->TxDmaChannel);
				CopyToDmaBuffer(pRequest,pDmaBuffer);
				HalActivateDMABuffer(pSlot->TxDmaChannel,pDmaBuffer,pRequest->BlockSize);
            }
			HalStartDMA(pSlot->TxDmaChannel);
        }
    }
#endif //#ifdef USE_DMA

        // turn on the clock 
//    SDIOClockOn(pSlot);

    SD_INTERRUPTS_CLEAR(pSlot,SD_Int_CRC_Errors | 
                              SD_Int_Response_Timeout | 
                              SD_Int_Response_Done );

        // enable response done and response timeout interrupts
    SD_INTERRUPTS_ENABLE(pSlot, SD_Int_Response_Done | SD_Int_Response_Timeout );


        // for Stop Transmission and IO Abort disable clock freezing to
        // get the state machine running again to send command
	if ((SD_CMD_STOP_TRANSMISSION == pRequest->CommandCode) ||
        (SD_CMD_IO_RW_DIRECT == pRequest->CommandCode && SD_IO_REG_IO_ABORT == IO_RW_DIRECT_ADDR_ARG(pRequest->CommandArgument))) {
		tmp = READ_REGISTER_ULONG((PULONG)&pSlot->pSD->config2);
		tmp |= SD_CONFIG2_DF;
		WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->config2, tmp);
    }         

        // remember whether the last command is CMD53 or not.
    lastCmd53 = ( SD_CMD_IO_RW_EXTENDED == pRequest->CommandCode );

        // write the 32 bit command argument
    WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->cmdarg, pRequest->CommandArgument );
        // write the completed command register - this will issue the command
    WRITE_REGISTER_ULONG((PULONG)&pSlot->pSD->cmd, commandRegister );

    DbgPrintZo(SDIO_SEND_ZONE,(TEXT("Send Command - CMD register = 0x%08X\r\n"),commandRegister));

    return SD_API_STATUS_PENDING;
}

///////////////////////////////////////////////////////////////////////////////
//  SDIOSDCancelIoHandler - io cancel handler 
//  Input:  pHostContext - host controller context
//          Slot - slot the request is going on
//          pRequest - the request to be cancelled
//  Output: 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本大道久久a久久综合| 国产女同互慰高潮91漫画| 日韩欧美国产精品一区| 成人免费一区二区三区视频| 日韩电影在线免费看| av电影在线不卡| 精品国内二区三区| 天堂成人国产精品一区| 99视频热这里只有精品免费| 久久青草国产手机看片福利盒子 | 国产亚洲污的网站| 亚洲一区在线观看免费| 成人91在线观看| 国产拍欧美日韩视频二区| 蜜桃视频一区二区三区在线观看| 欧美日韩精品一区二区| 亚洲激情在线激情| av一区二区三区在线| 国产蜜臀97一区二区三区| 精品亚洲国产成人av制服丝袜| 欧美色综合网站| 亚洲福利一二三区| 色综合久久综合| 中文字幕一区二区视频| 大白屁股一区二区视频| 久久免费的精品国产v∧| 激情文学综合插| 精品美女在线观看| 国内欧美视频一区二区| 精品乱人伦小说| 激情图片小说一区| 国产丝袜欧美中文另类| 国产一区二区久久| 国产欧美一二三区| 国产成人av电影免费在线观看| 亚洲精品一区二区三区蜜桃下载| 国产综合久久久久影院| 久久蜜桃av一区二区天堂| 国产一区二区三区视频在线播放| 欧美精品一区二区在线观看| 国产一区欧美二区| 国产农村妇女精品| 成人免费毛片高清视频| 国产精品理论在线观看| 日本韩国一区二区| 亚洲h在线观看| 日韩区在线观看| 国产激情91久久精品导航| 国产欧美一区二区精品性色 | 人妖欧美一区二区| 欧美大度的电影原声| 精品一区二区三区免费视频| 日韩美女视频一区二区在线观看| 国产一区二区网址| 成人免费在线视频| 欧美日韩一级二级三级| 经典三级一区二区| 国产精品久久久久久一区二区三区| 99国产精品久久久久久久久久久| 亚洲图片欧美色图| 欧美本精品男人aⅴ天堂| 成人一区二区三区视频在线观看 | 国产婷婷色一区二区三区四区| 99久久精品国产一区二区三区| 亚洲国产综合色| 精品国产sm最大网站免费看| 91网站在线观看视频| 日韩制服丝袜av| 国产精品久久毛片av大全日韩| 欧美视频你懂的| 国产一区二区不卡老阿姨| 亚洲欧美一区二区久久| 日韩欧美一区电影| 91在线云播放| 另类综合日韩欧美亚洲| 国产精品久久久久久久久免费丝袜 | 91麻豆精品秘密| 美女视频网站黄色亚洲| 中文字幕一区二区视频| 精品日韩av一区二区| 日本高清不卡aⅴ免费网站| 久久99九九99精品| 亚洲高清免费一级二级三级| 国产女人18毛片水真多成人如厕| 欧美日韩激情一区二区三区| 成人免费视频免费观看| 久久爱另类一区二区小说| 亚洲精品国产一区二区精华液 | 一级日本不卡的影视| 久久久久久久久久看片| 欧美日韩精品福利| 99久久精品情趣| 国产精品自拍av| 另类小说一区二区三区| 亚洲国产中文字幕| 亚洲另类一区二区| 日本一区二区三区电影| 精品日韩一区二区| 91精品国产高清一区二区三区 | 成人性生交大片免费| 激情成人综合网| 免费看精品久久片| 免费视频最近日韩| 丝袜脚交一区二区| 丝袜亚洲另类丝袜在线| 亚洲小说欧美激情另类| 亚洲女人****多毛耸耸8| 国产欧美日韩不卡| 久久蜜臀中文字幕| 久久亚洲一级片| 精品国产乱码久久久久久久久| 欧美日本乱大交xxxxx| 欧美日韩视频一区二区| 欧美视频精品在线观看| 欧美日韩一区二区三区在线看| 在线观看免费一区| 欧美自拍偷拍午夜视频| 日本乱人伦aⅴ精品| 在线观看日韩电影| 欧美精品视频www在线观看| 欧美日韩在线播放三区| 在线播放中文一区| 制服丝袜亚洲色图| 日韩欧美综合一区| 久久这里只精品最新地址| 国产午夜三级一区二区三| 国产欧美精品在线观看| 欧美高清在线一区| 亚洲精品欧美在线| 亚洲成av人在线观看| 麻豆国产一区二区| 国产精品亚洲视频| 91亚洲午夜精品久久久久久| 91久久人澡人人添人人爽欧美| 欧美写真视频网站| 日韩三级在线观看| 日本一区二区三区四区| 亚洲欧洲精品一区二区精品久久久| 亚洲视频资源在线| 亚洲aaa精品| 狠狠色丁香婷综合久久| 成人h动漫精品| 欧美日韩一级二级三级| 久久综合九色综合97_久久久| 国产精品免费看片| 性久久久久久久| 韩国精品在线观看| 一本久久a久久免费精品不卡| 欧美美女bb生活片| 久久精品一区蜜桃臀影院| 亚洲欧美日韩中文播放| 久久精品99久久久| 色激情天天射综合网| 欧美变态tickling挠脚心| 亚洲欧美成aⅴ人在线观看| 蜜桃av一区二区三区电影| 99re这里只有精品首页| 9191精品国产综合久久久久久| 久久免费视频一区| 亚洲永久免费视频| 国产成人精品一区二区三区四区| 欧美性感一类影片在线播放| 久久久精品免费网站| 五月激情综合婷婷| av在线这里只有精品| 日韩三级视频中文字幕| 亚洲精品视频自拍| 成人综合婷婷国产精品久久蜜臀| 欧美剧情电影在线观看完整版免费励志电影 | 国产视频一区在线观看| 五月天精品一区二区三区| 成人高清免费观看| 精品国产一区二区精华| 午夜精品成人在线| 99vv1com这只有精品| 久久久精品2019中文字幕之3| 亚洲一卡二卡三卡四卡五卡| 不卡一区二区在线| 精品国产一区二区国模嫣然| 视频一区视频二区中文字幕| 在线精品视频一区二区三四| 国产精品久久免费看| 国产一区二区三区美女| 欧美日韩一区二区欧美激情| 最新国产精品久久精品| 国产麻豆精品视频| 日韩午夜在线观看| 婷婷久久综合九色综合绿巨人| 一本久久综合亚洲鲁鲁五月天| 国产精品欧美综合在线| 精久久久久久久久久久| 精品国产a毛片| 激情欧美一区二区| 欧美xxx久久| 激情丁香综合五月| 337p日本欧洲亚洲大胆色噜噜| 美日韩黄色大片| 日韩色视频在线观看| 久久国产精品免费| 日韩一卡二卡三卡四卡|