Annotation of ntddk/src/scsi/qic117/readfdc.c, revision 1.1.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:     readfdc.c
                      9: 
                     10: Abstract:
                     11: 
                     12:     Read FDC result bytes.
                     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: STATUS
                     36: Q117iReadFDC(
                     37:     IN PTAPE_EXTENSION TapeExtension,
                     38:     OUT UCHAR *Status,
                     39:     OUT SHORT *Length
                     40:     )
                     41: 
                     42: /*++
                     43: 
                     44: Routine Description:
                     45: 
                     46:     Read result data from the Floppy Disk Controller.  The result data
                     47:     is read during the result phase of the FDC command sequence.
                     48: n
                     49:         For each byte of response data, wait up to 3 msecs for the FDC to
                     50:         become ready.
                     51: 
                     52:         Read result data until the FDC is no longer sending data or until
                     53:         more than 7 result bytes have been read.  Seven is the maximum
                     54:         legal number of result bytes that the FDC is specified to send.
                     55: 
                     56: Arguments:
                     57: 
                     58:     TapeExtension -
                     59: 
                     60:     Status -
                     61: 
                     62:     Length -
                     63: 
                     64: Return Value:
                     65: 
                     66: 
                     67: 
                     68: --*/
                     69: 
                     70: {
                     71: 
                     72:     SHORT mainStatusRegister;
                     73:     SHORT waitCount;
                     74: 
                     75:     *Length = 0;
                     76: 
                     77:     DbgAddEntry(0x12345679);
                     78: 
                     79:     if (TapeExtension->QControllerData->CommandHasResultPhase) {
                     80: 
                     81:         *Status++ = TapeExtension->QControllerData->FifoByte;
                     82:         DbgAddEntry(TapeExtension->QControllerData->FifoByte);
                     83:         ++*Length;
                     84: 
                     85:     }
                     86: 
                     87: 
                     88:     do {
                     89: 
                     90:         waitCount = FDC_MSR_RETRIES;
                     91: 
                     92:         do {
                     93: 
                     94:             if ((mainStatusRegister =
                     95:                 READ_CONTROLLER(
                     96:                     &TapeExtension->QControllerData->FDC_Addr->MSDSR.msr )) &
                     97:                 MSR_RQM) {
                     98: 
                     99:                 break;
                    100: 
                    101:             }
                    102: 
                    103:             Q117iShortTimer(t0012us);
                    104: 
                    105:         } while (--waitCount > 0);
                    106: 
                    107:         if (waitCount == 0) {
                    108: 
                    109:             return(NECFlt);
                    110: 
                    111:         }
                    112: 
                    113:         if (!(mainStatusRegister & MSR_DIO)) {
                    114: 
                    115:             break;
                    116: 
                    117:         }
                    118: 
                    119:         *Status = (CHAR)READ_CONTROLLER(
                    120:                             &TapeExtension->QControllerData->FDC_Addr->dr);
                    121: 
                    122: 
                    123:         DbgAddEntry(*Status);
                    124: 
                    125:         ++Status;
                    126: 
                    127:         if (++*Length > 7) {
                    128:             *Length = -1;
                    129:             break;
                    130: 
                    131:         }
                    132: 
                    133:         Q117iShortTimer(t0012us);
                    134: 
                    135:     } while (TRUE);
                    136: 
                    137:     return(NoErr);
                    138: }
                    139: 

unix.superglobalmegacorp.com

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