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

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

?? ide.c

?? 硬盤驅(qū)動(dòng)的例子
?? C
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):

                //
                // Hmmm.  Nothing to do here but plow ahead...
                //
#if DBG
                DbgPrint("***Controller NOT READY on WRITE!\n");
#endif

            } 

            //
            // Get the controller status after the Wait
            //
            controllerStatus =
                 READ_PORT_UCHAR(devExt->ControllerData->ControllerAddress + 
                                                STATUS_REGISTER);

            //
            // As a sanity check, get it 1 more time, just in case
            //
            if (!(controllerStatus & DATA_REQUEST_STATUS)) {
                
                controllerStatus =
                  READ_PORT_UCHAR(devExt->ControllerData->ControllerAddress + 
                                                   STATUS_REGISTER);
            }

            //
            // If the controller's ready, start slamming data to it
            //
            if (controllerStatus & DATA_REQUEST_STATUS) {

                PVOID buffer;

                buffer = devExt->CurrentAddress;

                //
                // Update the address and lengths now because the
                // numbers mean "the number of bytes left to go".
                // Thus, when the interrupt occurs to signal the end
                // of this write, the bytes have "already gone".  This
                // is necessary to keep the arithmetic straight.
                //
                devExt->CurrentAddress += devExt->BytesPerInterrupt;
                devExt->RemainingTransferLength -= devExt->BytesPerInterrupt;

                //
                // Write the first buffer (which will cause an interrupt
                // when the write has been compelted and it's time for us
                // to send it another sector)
                //
                WRITE_PORT_BUFFER_USHORT(
                    (PUSHORT)(controllerData->ControllerAddress + DATA_REGISTER),
                    buffer,
                    devExt->BytesPerInterrupt/2);

            }

            break;

        default:

            //
            // We should never get here; READ or WRITE or VERIFY (via the
            // ioctl interface) should be the only possibilities.
            //
#if DBG
            DbgPrint("IdeStartThisRequestOnDevice: Invalid operation type %x\n",
                devExt->OperationType);
#endif

            break;
    }

    return(TRUE);
}


///////////////////////////////////////////////////////////////////////////////
//
//  IdeISR
//
//    This routine is the Interrupt Service Routine (ISR)
//
//  INPUTS:
//
//    Interrupt         - pointer to the interrupt object
//    Context           - the controller data structure
//
//  OUTPUTS:
//  
//    None.
//
//  RETURNS:
//
//    TRUE if it is our interrupt, otherwise FALSE
//
//      IRQL:
//
//    DIRQL
//
//  NOTES:
//
//    All read and write I/O is done in this ISR as oppoosed to the DPC.
//    The DPC is really used to do cleanup activity and error recovery.
//    Note that sucessful I/O transfer is indicated by a zero for the 
//    devExt->RemainingTransferLength.
//
///////////////////////////////////////////////////////////////////////////////


BOOLEAN
IdeISR(IN PKINTERRUPT Interrupt,
       IN OUT PVOID Context)
{
    PDEVICE_OBJECT deviceObject;
    PCONTROLLER_DATA controllerData = (PCONTROLLER_DATA)Context;
    PIDE_DEV_EXT devExt;
    PIO_STACK_LOCATION ioStack;
    UCHAR controllerStatus;

    //
    // Get the controller status.  Note that this will STOP all interrupts
    // on the controller.
    //
    controllerStatus =
           READ_PORT_UCHAR(controllerData->ControllerAddress + STATUS_REGISTER);

    // 
    // Check if this is an interrupt that we should service.
    //
    // We should service this interrupt if the IDE controller is not busy (i.e.
    // he's waiting for US to do something) and the driver has had a chance to
    // fully initialize (i.e. the controller data structure is set up)
    //
    if ( (controllerStatus & BUSY_STATUS) || (!controllerData->DeviceObject) ) {

        return(FALSE);
    }

    //
    // Get pointer to our device object and device extension
    //
    deviceObject = controllerData->DeviceObject;

    devExt = deviceObject->DeviceExtension;

    //
    // If the controller is not indicating an error, check to see if
    // there's anything to do...
    //
    if (!(controllerStatus & ERROR_STATUS)) {

        //
        // If there's data remaining to move, do it right here.
        //
        if (devExt->RemainingTransferLength) {

            //
            // if we're not ready, do 1 ping and try again
            //
            if (!(controllerStatus & DATA_REQUEST_STATUS)) {

                controllerStatus = READ_PORT_UCHAR(
                          controllerData->ControllerAddress + STATUS_REGISTER);
            }

            //
            // Check to be sure the device is ready
            //
            if (controllerStatus & DATA_REQUEST_STATUS) {

                PVOID buffer;

                //
                // Update the controller with the next chunk of data
                //

                //
                // Save the requestor's buffer address
                //
                buffer = devExt->CurrentAddress;

                //
                // adjust the address and counts in expectation
                // that this I/O will complete
                //
                devExt->RemainingTransferLength -= devExt->BytesPerInterrupt;
                devExt->CurrentAddress += devExt->BytesPerInterrupt;


                //
                // If this is not the last transfer, don't
                // request a DPC yet.
                //
                if ( (devExt->RemainingTransferLength) > 0) {

                    controllerData->InterruptRequiresDpc = FALSE;

                } else {

                    controllerData->InterruptRequiresDpc = TRUE;

                }

                //
                // Move the data
                //
                if (devExt->OperationType == IRP_MJ_READ)  {
                    
                    //
                    // Move the data from the controller to the Requestor's
                    // data buffer
                    //
                    READ_PORT_BUFFER_USHORT(
                        (PUSHORT)(controllerData->ControllerAddress + DATA_REGISTER),
                        buffer,
                        devExt->BytesPerInterrupt/2);

#if DBG
                    DbgPrint("IdeISR: READ performed ISR at addr %x for %x\n",
                                        buffer,devExt->BytesPerInterrupt);
#endif
                        
                } else  {

                    //
                    // It's a WRITE
                    // Move the data from the requestor's data buffer to 
                    // the controller
                    //
                    WRITE_PORT_BUFFER_USHORT(
                        (PUSHORT)(controllerData->ControllerAddress + DATA_REGISTER),
                        buffer,
                        devExt->BytesPerInterrupt/2);

#if DBG
                    DbgPrint("IdeISR: WRITe performed ISR at addr %x for %x\n",
                                    buffer,
                                    devExt->BytesPerInterrupt);
#endif
                }


            } else {

#if DBG
                DbgPrint("IdeISR: Unable to complete operation %x controllerStatus %x irp %x\n",
                                devExt->OperationType,
                                controllerStatus,deviceObject->CurrentIrp);
#endif
            }
            
        }

    }

    //
    // Request the DpcForIsr
    //
    if (controllerData->InterruptRequiresDpc) {

        controllerData->InterruptRequiresDpc = FALSE;

        IoRequestDpc(deviceObject,
                     deviceObject->CurrentIrp,
                     (PVOID)controllerStatus);
    }

    return(TRUE);
}




///////////////////////////////////////////////////////////////////////////////
//
//  IdeDPC
//
//    This routine is the Deferred Procedure Call (DPC), invoked indirectly 
//    by the ISR (IdeISR) via IoRequestDpc()
//
//  INPUTS:
//
//    Dpc               - pointer to the DPC object
//    DeferredContext   - device object
//    SystemArgument1   - current IRP - UNUSED
//    SystemArgument2   - controller status (as setup in IdeISR)
//
//  OUTPUTS:
//  
//    None.
//
//  RETURNS:
//
//    STATUS_SUCCESS
//
//      IRQL:
//
//    IRQL_DISPATCH_LEVEL
//
//  NOTES:
//
//    When this is invoked for a read or write operation, the operation
//    should have been completed by the ISR.  The DPC's job is to cleanup
//    and do any error recovery (if possible) and then tell the IO
//    Manager that:
//
//      a) it's time to start the next packet (via IoStartNextPacketByKey)
//      b) this IRP is complete (via IoCompleteRequest).
//
//    Note that both a) and b) are actually done in the routine FinishIrp()
//
//    Since we are at IRQL_DISPATCH_LEVEL < DIRQL, we shouldn't access
//    the HW registers. However, since we are doing system queuing, the
//    requests are searailized.  Therefore, when the ISR is done, we  know
//    that either the request has completed, sucessfully or not.  In either
//    case, there should be no other interrupts pending on the device.
//    Thus, we are able to read the controllerStatus on the device to check
//    if the device is ready for the next operation.  Also, note that we
//    take advantage of the fact that the device is not busy if we get into
//    the situation where we have to reset the disk (and we have to touch
//    the HW registers again).
//
///////////////////////////////////////////////////////////////////////////////
VOID
IdeDPC(IN PKDPC Dpc,
       IN PVOID DeferredContext,
       IN PVOID SystemArgument1,
       IN PVOID SystemArgument2)
{
    PDEVICE_OBJECT deviceObject;
    PIDE_DEV_EXT devExt;
    PCONTROLLER_DATA controllerData;
    PIRP irp;
    PIO_STACK_LOCATION ioStack;
    NTSTATUS returnStatus;
    ULONG controllerStatus;
    UCHAR codeValue;
    UCHAR errorReg, driveHead, cylHigh, cylLow, sectorNumber, sectorCount;
    NTSTATUS ntStatus;

    //
    // setup locals
    //
    deviceObject = (PDEVICE_OBJECT)DeferredContext;
    devExt = deviceObject->DeviceExtension;
    controllerData = devExt->ControllerData;

    //
    // Default to completing the IRP with success
    //
    returnStatus = STATUS_SUCCESS;

    //
    // Get the controller status.  Note that since this device only has
    // one operation in progress at a time, passing back the controller
    // status this way from the ISR presents no problem.
    //
    controllerStatus = (ULONG)SystemArgument2;

    //
    // If there is some kind of error (or correctable error) then capture the
    // register state of the controller
    //
    if (controllerStatus & ERROR_STATUS) {

        errorReg = READ_PORT_UCHAR(controllerData->ControllerAddress + ERROR_REGISTER);
        driveHead = READ_PORT_UCHAR(controllerData->ControllerAddress + DRIVE_HEAD_REGISTER);
        cylHigh = READ_PORT_UCHAR(controllerData->ControllerAddress + CYLINDER_HIGH_REGISTER);
        cylLow = READ_PORT_UCHAR(controllerData->ControllerAddress + CYLINDER_LOW_REGISTER),
        sectorNumber = READ_PORT_UCHAR(controllerData->ControllerAddress + SECTOR_NUMBER_REGISTER);
        sectorCount = READ_PORT_UCHAR(controllerData->ControllerAddress + SECTOR_COUNT_REGISTER);

#if DBG
        DbgPrint(
            "IdeDPC: Transaction error - ErrorReg %x cylinder High %x Low %x Sector Number %x sector Count %x driveHead %x controllerStatus %x\n",
            errorReg,cylHigh, cylLow,sectorNumber, sectorCount, 
            controllerStatus);
#endif

    }

    //
    // get some IRP context
    //
    irp = deviceObject->CurrentIrp;

    ASSERT(irp);

    ioStack = IoGetCurrentIrpStackLocation(irp);

    //
    // Before doing anything else, service a controller reset that may
    // have been in progress.
    //
    // Note that if there was no reset pending, the state will be set to
    // "RESET_NOT_RESTTING"
    //
    // If we ARE resetting, then we complete the operation and return
    // right within the following switch statement.
    //
    switch (controllerData->ResettingController) {

        //
        // No reset presently in progress, thank you.
        //
        case RESET_NOT_RESETTING: 
            break;

        //
        // Drive has been reset.
        //
        case RESET_DRIVE_SET: 

#if DBG
            DbgPrint("IdeDPC: Reset the drive\n");
#endif

            //
            // Nothing should have failed at this point but it
            // doesn't hurt to check.
            //

            if (controllerStatus & ERROR_STATUS) {

#if DBG
                DbgPrint("IdeDPC: Error on RESET_DRIVE - status %x\n",controllerStatus);
#endif

                goto RetryIrp;

            }

            //
            // stall out to give the disk some time to catch up
            //
            KeStallExecutionProcessor(25);

            //
            // Request a recalibration of the drive
            //
            controllerData->ResettingController = RESET_DRIVE_RECALIBRATED;
            controllerData->InterruptRequiresDpc = TRUE;
            controllerData->DeviceObject = devExt->DeviceObject;

#if DBG
            DbgPrint("IdeDPC: About to recalibrate controller for ext: %x\n"
                            "        with a device unit of: %x\n",
                            devExt, devExt->DeviceUnit);
#endif
            //
            // make sure we're ready -- LOOOOONG delay possible here
            //
            (VOID)IdeWaitControllerReady(controllerData, 20, 150000);

            //
            // issue the reset (and generate a new interrupt)
            //
            WRITE_PORT_UCHAR(controllerData->ControllerAddress + DRIVE_HEAD_REGISTER,
                            devExt->DeviceUnit);

            WRITE_PORT_UCHAR(controllerData->ControllerAddress + COMMAND_REGISTER,
                            RECALIBRATE_COMMAND);

            //
            // We're done with the reset... NEXT, we do a drive RECAL (below).
            // RETURN for now
            //
            return;

        //
        // Drive being recalibrated
        //
        case RESET_DRIVE_RECALIBRATED: 

#if DBG
            DbgPrint("IdeDPC: Recalibrated drive\n");
#endif

            //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日日夜夜一区二区| 国产三级久久久| 亚洲a一区二区| 欧美片在线播放| 久久精品国产亚洲5555| 精品久久久久久综合日本欧美| 精品国免费一区二区三区| 美女视频黄久久| 久久精品免费在线观看| 成人教育av在线| 精品91自产拍在线观看一区| 国产成人免费视频网站| 91精品国模一区二区三区| 精品中文字幕一区二区小辣椒| 欧美日韩精品福利| 伦理电影国产精品| 91 com成人网| 亚洲一区二区三区四区在线| 欧美一区二区三区四区高清| 国产高清成人在线| 一区二区三区在线视频观看| 在线成人高清不卡| 高清久久久久久| 久久免费的精品国产v∧| 91网上在线视频| 国产精品亲子乱子伦xxxx裸| 91国模大尺度私拍在线视频| 久久国产精品99精品国产| 国产精品乱码人人做人人爱| 欧美日韩国产小视频| 国产高清在线观看免费不卡| 亚洲国产一区二区三区| 久久中文字幕电影| 在线观看免费一区| 亚洲小说欧美激情另类| 精品国产91九色蝌蚪| 在线观看亚洲精品视频| 亚洲一区二区三区影院| 欧美sm美女调教| 欧美影视一区二区三区| 高清免费成人av| 久久精工是国产品牌吗| 一区二区三区四区不卡视频| 久久一二三国产| 777亚洲妇女| 91浏览器在线视频| 国产美女精品人人做人人爽 | 91在线免费视频观看| 视频一区欧美精品| 精品三级av在线| 欧美日韩在线亚洲一区蜜芽| 成人黄色免费短视频| 久久机这里只有精品| 亚洲无人区一区| 自拍偷在线精品自拍偷无码专区| 91蝌蚪porny九色| 国产成人啪免费观看软件| 免费成人小视频| 亚洲国产成人av网| 亚洲免费av在线| 中文字幕制服丝袜成人av | 久久精品国产一区二区| 国产欧美中文在线| 亚洲精品一区二区三区精华液| 国产东北露脸精品视频| 精品一区二区三区不卡| 日韩二区三区四区| 国产视频在线观看一区二区三区| 成人av免费观看| 成人深夜视频在线观看| 国产jizzjizz一区二区| 亚洲国产精品久久艾草纯爱| 久久麻豆一区二区| 国产日韩高清在线| 久久久久国产精品麻豆| 精品国产一区二区精华| 欧美第一区第二区| 欧美三级中文字| 欧美亚一区二区| 欧美写真视频网站| 欧美日韩精品是欧美日韩精品| 国产成人无遮挡在线视频| 国产精品一区二区91| 国产麻豆精品在线| 亚洲最大成人综合| 国产欧美一区二区精品忘忧草| 欧洲av在线精品| 国产成人午夜电影网| 国产91精品在线观看| 亚洲小少妇裸体bbw| 亚洲成av人片在线观看无码| 亚洲成人精品一区二区| 午夜精品aaa| 美女网站视频久久| 成人综合在线网站| 在线看国产一区二区| 欧美丰满少妇xxxxx高潮对白| 99精品久久久久久| 91福利在线免费观看| 91麻豆精品国产91久久久久久| 91亚洲精品久久久蜜桃| 欧美三级电影一区| 日韩欧美国产电影| 在线播放中文一区| 337p粉嫩大胆噜噜噜噜噜91av | 国产成人精品综合在线观看| 水蜜桃久久夜色精品一区的特点| 日韩美女精品在线| 午夜精品福利一区二区蜜股av | 欧美美女激情18p| 精品国产乱码久久久久久久久| 欧美群妇大交群的观看方式 | 在线观看日韩一区| 精品久久国产字幕高潮| 国产精品国产成人国产三级| 日韩国产精品91| 成熟亚洲日本毛茸茸凸凹| 欧美日韩精品一区二区天天拍小说| 色婷婷国产精品| 日韩欧美第一区| 日韩欧美激情在线| 综合欧美亚洲日本| 亚洲v中文字幕| 粉嫩aⅴ一区二区三区四区| 欧美日韩国产一级| 中文字幕日韩欧美一区二区三区| 国产欧美1区2区3区| 欧美国产国产综合| 日本特黄久久久高潮| 成人免费高清在线| 91美女蜜桃在线| 欧美精品一区二区三区四区| 久久久蜜桃精品| 午夜久久久影院| 卡一卡二国产精品 | 国产91露脸合集magnet | 最好看的中文字幕久久| 久久国产精品第一页| 一本色道久久综合亚洲aⅴ蜜桃| 91亚洲精品一区二区乱码| 91在线看国产| 91国偷自产一区二区三区观看| 欧美性做爰猛烈叫床潮| 中文字幕乱码一区二区免费| 亚洲视频免费看| 丁香一区二区三区| 91成人免费电影| 亚洲狠狠丁香婷婷综合久久久| 日韩精品成人一区二区三区| 激情综合网激情| 日韩一本二本av| 国产精品久久久久久户外露出| 亚洲狠狠丁香婷婷综合久久久| 首页国产欧美日韩丝袜| 久久精品国产一区二区三 | 欧美日韩一区二区在线视频| 欧美电影免费观看高清完整版 | 久久99精品国产麻豆不卡| 欧美日韩一区高清| 午夜视黄欧洲亚洲| 国产一区二区精品久久91| 日韩午夜在线播放| 免费一区二区视频| 欧美一区二区三区精品| 天天操天天色综合| fc2成人免费人成在线观看播放| 欧美在线一区二区三区| 亚洲天堂久久久久久久| 色综合久久久久| 一区二区三区在线观看网站| 91香蕉视频污在线| 亚洲精品第1页| 91国产丝袜在线播放| 欧美一区二区三区的| 免费日韩伦理电影| 精品人在线二区三区| 亚洲另类春色国产| 欧美日韩国产美| 免费不卡在线观看| 欧洲一区二区三区在线| 午夜欧美在线一二页| 91在线porny国产在线看| 一区二区三区在线播放| 欧美日本在线看| 日本不卡的三区四区五区| 精品国产伦一区二区三区免费| 国产精品国产三级国产专播品爱网| 亚洲亚洲精品在线观看| 欧美一区二区女人| 国产一区二区三区国产| 国产精品久久久久久久浪潮网站| 欧美aaa在线| 久久夜色精品国产噜噜av| 日韩在线a电影| 久久精品欧美日韩| 91成人免费在线视频| 美脚の诱脚舐め脚责91 | 日韩一区二区在线观看视频播放| 久久精品人人做人人综合| 日产国产高清一区二区三区|