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

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

?? ide.c

?? 硬盤驅動程序, 硬盤驅動程序,硬盤驅動程序
?? C
?? 第 1 頁 / 共 4 頁
字號:

                //
                // 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

            //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色av电影| 国产精品高潮呻吟久久| 欧美一区二区免费| 日韩一区二区三区在线观看| 日韩色视频在线观看| 日韩欧美在线观看一区二区三区| 欧美一区二区免费观在线| 亚洲精品一区二区三区在线观看 | 精品国产a毛片| 精品处破学生在线二十三| 国产精品毛片久久久久久久| 一区二区三区四区在线| 免费看黄色91| 日韩高清国产一区在线| 国产成人精品影院| 日本黄色一区二区| 91精品国产欧美一区二区18| 国产蜜臀av在线一区二区三区| 中文字幕欧美区| 亚洲高清免费视频| 高潮精品一区videoshd| 色成人在线视频| 337p亚洲精品色噜噜狠狠| 欧美zozozo| 亚洲精品高清视频在线观看| 日韩电影在线看| 国产成人亚洲综合a∨婷婷图片| 在线国产电影不卡| 日韩一区二区三区电影在线观看 | 日韩高清一区在线| 成人午夜av电影| 欧美三级中文字幕| 欧美va亚洲va国产综合| 依依成人综合视频| 激情小说亚洲一区| 日本一区二区视频在线| 国产精品久久久久影视| 日日摸夜夜添夜夜添亚洲女人| 国产成人亚洲精品青草天美| 欧美一区二区三区影视| 国产人伦精品一区二区| 午夜精品久久久久久久蜜桃app| 国产大片一区二区| 欧美电影影音先锋| 综合激情成人伊人| 日韩精品一二三四| 色婷婷激情一区二区三区| 精品播放一区二区| 亚洲综合色婷婷| av一区二区久久| 精品国产百合女同互慰| 亚洲午夜免费电影| 91影院在线免费观看| 精品理论电影在线观看| 亚洲一二三四久久| 97久久超碰精品国产| xvideos.蜜桃一区二区| 亚洲成人资源在线| 粉嫩aⅴ一区二区三区四区五区 | 日韩高清在线电影| 99精品在线免费| 久久亚洲精精品中文字幕早川悠里 | 在线国产亚洲欧美| 国产精品美女久久久久av爽李琼 | 亚洲成人自拍一区| 99久久婷婷国产综合精品电影 | 亚洲男人的天堂在线观看| 久久97超碰国产精品超碰| 欧美日韩在线三区| 艳妇臀荡乳欲伦亚洲一区| 99久久亚洲一区二区三区青草| 久久久午夜精品理论片中文字幕| 久久精品国产99| 欧美美女一区二区| 一区二区三区四区蜜桃| 国产精品亚洲视频| 国产欧美一区视频| 国内不卡的二区三区中文字幕 | 亚洲天堂免费看| av高清久久久| 国产精品视频线看| 国产精品一区二区久激情瑜伽| 精品国产乱码久久久久久久| 91麻豆精品国产自产在线观看一区 | 欧美男生操女生| 亚洲成av人片一区二区梦乃 | 一区二区三区欧美日| 日本福利一区二区| 亚洲免费观看视频| 91女人视频在线观看| 欧美国产禁国产网站cc| 91亚洲精品久久久蜜桃| 亚洲人妖av一区二区| jlzzjlzz欧美大全| 日韩美女视频19| 91视频国产资源| 亚洲欧美福利一区二区| 欧美区在线观看| 日韩国产高清在线| 精品国产一区二区三区忘忧草| 婷婷久久综合九色综合绿巨人 | 一区二区在线观看免费视频播放| 91免费观看视频在线| 午夜日韩在线观看| 日韩一区二区三区四区五区六区| 免费观看在线综合色| 久久综合色播五月| 成人午夜在线免费| 亚洲色图色小说| 91亚洲永久精品| 首页国产丝袜综合| 欧美mv和日韩mv国产网站| 国产综合久久久久久久久久久久| 久久伊99综合婷婷久久伊| 岛国av在线一区| 亚洲免费av高清| 91精品国产一区二区三区| 国产成人丝袜美腿| 亚洲欧美另类久久久精品| 欧美视频精品在线| 亚洲欧美福利一区二区| 91精品国产品国语在线不卡| 国产在线精品免费| 国产精品久久免费看| 欧美日本一区二区| 国产精品一区专区| 亚洲免费观看高清完整版在线| 色综合久久中文综合久久97 | 在线中文字幕一区| 精品在线一区二区| 国产精品国模大尺度视频| 亚洲欧美色综合| 欧美视频日韩视频| 国产成人三级在线观看| 视频一区欧美精品| 亚洲视频在线一区观看| 精品国产电影一区二区| 欧美系列日韩一区| 国产成人在线网站| 日本免费新一区视频| **性色生活片久久毛片| 精品国产污污免费网站入口| 91久久精品国产91性色tv| 国产风韵犹存在线视精品| 日韩电影在线一区| 亚洲精品一卡二卡| 亚洲国产精品成人综合| 日韩色在线观看| 欧美日韩国产色站一区二区三区| 丁香网亚洲国际| 美腿丝袜亚洲色图| 亚洲午夜成aⅴ人片| 综合欧美一区二区三区| 国产日产欧美一区| 欧美电影免费观看高清完整版| 在线日韩av片| 91丨porny丨中文| 国产99精品在线观看| 久久99精品久久久久久动态图| 午夜激情综合网| 一区二区三区色| 国产欧美一区视频| 国产视频视频一区| 久久久99免费| 精品91自产拍在线观看一区| 67194成人在线观看| 欧美区在线观看| 欧美视频精品在线观看| 欧洲一区在线电影| 972aa.com艺术欧美| 成人黄色在线视频| 成人久久18免费网站麻豆| 国产成人在线观看| 国产精品一二三四五| 精品午夜久久福利影院| 免费观看30秒视频久久| 免费不卡在线视频| 热久久国产精品| 日韩1区2区3区| 奇米影视在线99精品| 日日摸夜夜添夜夜添国产精品| 天天影视网天天综合色在线播放| 亚洲午夜国产一区99re久久| 亚洲第一狼人社区| 日韩精品亚洲一区| 日韩电影在线免费看| 久久精品999| 精品一区二区三区影院在线午夜 | 在线不卡一区二区| 51精品秘密在线观看| 欧美一区二视频| 亚洲精品一区二区在线观看| 久久久夜色精品亚洲| 国产欧美一区二区精品忘忧草| 国产日韩欧美精品电影三级在线| 中文字幕免费在线观看视频一区| 国产精品卡一卡二| 亚洲精品自拍动漫在线| 亚洲18女电影在线观看| 美女爽到高潮91|