Annotation of ntddk/src/scsi/qic117/resetfdc.c, revision 1.1

1.1     ! root        1: /*++
        !             2: 
        !             3: Copyright (c) 1993 - Colorado Memory Systems,  Inc.
        !             4: All Rights Reserved
        !             5: 
        !             6: Module Name:
        !             7: 
        !             8:     resetfdc.c
        !             9: 
        !            10: Abstract:
        !            11: 
        !            12:     Resets the FDC and cleans up the sense status.
        !            13: 
        !            14: Revision History:
        !            15: 
        !            16: 
        !            17: 
        !            18: 
        !            19: --*/
        !            20: 
        !            21: //
        !            22: // include files
        !            23: //
        !            24: 
        !            25: #include <ntddk.h>                        // various NT definitions
        !            26: #include <ntdddisk.h>                    // disk device driver I/O control codes
        !            27: #include <ntiologc.h>
        !            28: #include "common.h"
        !            29: #include "drvtask.h"                     // this driver's data declarations
        !            30: #include "mt1defs.h"                     // this driver's data declarations
        !            31: #include "mt1strc.h"                     // this driver's data declarations
        !            32: #include "q117data.h"                    // this driver's data declarations
        !            33: 
        !            34: 
        !            35: VOID
        !            36: Q117iResetFDC(
        !            37:     IN PTAPE_EXTENSION TapeExtension
        !            38:     )
        !            39: 
        !            40: /*++
        !            41: 
        !            42: Routine Description:
        !            43: 
        !            44:     To reset the floppy controller chip.
        !            45: 
        !            46: Arguments:
        !            47: 
        !            48:     TapeExtension -
        !            49: 
        !            50: Return Value -
        !            51: 
        !            52:     None.
        !            53: 
        !            54: --*/
        !            55: 
        !            56: {
        !            57:     UCHAR resetByte;
        !            58:     SHORT statLength;
        !            59:     struct sns_int_cmd senseInt;
        !            60:     FDC_STATUS rStat;
        !            61:     SHORT resetRetry = 5;
        !            62: 
        !            63:     senseInt.command = FDC_SNS_INT;
        !            64: 
        !            65:     TapeExtension->QControllerData->CommandHasResultPhase = FALSE;
        !            66:     (VOID) Q117iResetInterruptEvent(TapeExtension);
        !            67: 
        !            68:     if (!TapeExtension->Found) {
        !            69: 
        !            70:         TapeExtension->QControllerData->DriveSelect.Selected = FALSE;
        !            71: 
        !            72:         WRITE_CONTROLLER(
        !            73:             &TapeExtension->QControllerData->FDC_Addr->dor, alloff);
        !            74:         Q117iShortTimer(t0010us);
        !            75:         WRITE_CONTROLLER(
        !            76:             &TapeExtension->QControllerData->FDC_Addr->dor,dselb);
        !            77: 
        !            78:     } else {
        !            79: 
        !            80:         if (TapeExtension->QControllerData->DriveSelect.Selected == TRUE) {
        !            81: 
        !            82:             resetByte =
        !            83:                 TapeExtension->QControllerData->DriveSelect.SelectByte;
        !            84: 
        !            85:         } else {
        !            86: 
        !            87:             resetByte =
        !            88:                 TapeExtension->QControllerData->DriveSelect.DeselectByte;
        !            89: 
        !            90:         }
        !            91: 
        !            92:         resetByte &= 0xfb;
        !            93:         WRITE_CONTROLLER(&TapeExtension->QControllerData->FDC_Addr->dor,
        !            94:                         (SHORT)resetByte);
        !            95:         Q117iShortTimer(t0010us);
        !            96:         resetByte |= 0x0c;
        !            97:         WRITE_CONTROLLER(&TapeExtension->QControllerData->FDC_Addr->dor,
        !            98:                         (SHORT)resetByte);
        !            99: 
        !           100:     }
        !           101: 
        !           102:     if (Q117iSleep(TapeExtension, mt_wt500ms, TRUE) == NoErr) {
        !           103: 
        !           104:         Q117iReadFDC(TapeExtension, (CHAR *)&rStat, (SHORT *)&statLength);
        !           105:         --resetRetry;
        !           106: 
        !           107:     }
        !           108: 
        !           109:     do {
        !           110: 
        !           111:         if (Q117iProgramFDC(TapeExtension,
        !           112:                             (CHAR *)&senseInt,
        !           113:                             sizeof(senseInt),
        !           114:                             FALSE) != NoErr) {
        !           115: 
        !           116:             TapeExtension->QControllerData->FDC_Pcn = 0;
        !           117:             return;
        !           118: 
        !           119:         }
        !           120: 
        !           121:         Q117iReadFDC(TapeExtension, (CHAR *)&rStat, (SHORT *)&statLength);
        !           122:         --resetRetry;
        !           123:         Q117iSleep(TapeExtension, mt_wt2ticks, FALSE);
        !           124: 
        !           125:     } while (((rStat.ST0 & ST0_US) < 3) && resetRetry);
        !           126: 
        !           127:     Q117iConfigureFDC(TapeExtension);
        !           128:     TapeExtension->QControllerData->FDC_Pcn = 0;
        !           129:     TapeExtension->QControllerData->PerpendicularMode = FALSE;
        !           130: }
        !           131: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.