Annotation of ntddk/src/scsi/qic117/pgmfdc.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:     pgmfdc.c
                      9: 
                     10: Abstract:
                     11: 
                     12:     FDC program logic.
                     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: Q117iProgramFDC(
                     37:     IN PTAPE_EXTENSION TapeExtension,
                     38:     IN OUT UCHAR *Command,
                     39:     IN SHORT Length,
                     40:     IN BOOLEAN Result
                     41:     )
                     42: 
                     43: /*++
                     44: 
                     45: Routine Description:
                     46: 
                     47: Send a command to the Floppy Disk Controller.  Commands are of
                     48: various lengths as defined by the FDC spec (NEC uPD765A).
                     49: 
                     50: For each byte in the command string, program_nec must wait for the
                     51: FDC to become ready to read command data.  Program_nec will wait
                     52: up to approx. 3 msecs before giving up and declaring an error.
                     53: 
                     54: Arguments:
                     55: 
                     56: TapeExtension -
                     57: 
                     58: Command -
                     59: 
                     60: Length -
                     61: 
                     62: Result -
                     63: 
                     64: Return Value:
                     65: 
                     66: 
                     67: 
                     68: --*/
                     69: 
                     70: {
                     71:     SHORT i;
                     72:     SHORT waitCount;
                     73: 
                     74:     TapeExtension->QControllerData->CommandHasResultPhase = Result;
                     75: 
                     76:     DbgAddEntry(0x12345678);
                     77: 
                     78:     for (i = 0; i < Length; i++) {
                     79: 
                     80:         waitCount = FDC_MSR_RETRIES;
                     81: 
                     82:         do {
                     83: 
                     84:             if ((READ_CONTROLLER(
                     85:                     &TapeExtension->QControllerData->FDC_Addr->MSDSR.msr) &
                     86:                 (MSR_RQM | MSR_DIO)) == MSR_RQM) {
                     87: 
                     88:                 break;
                     89: 
                     90:             }
                     91: 
                     92:             Q117iShortTimer(t0012us);
                     93: 
                     94:         } while (--waitCount > 0);
                     95: 
                     96:         if (waitCount == 0) {
                     97: 
                     98:             return(NECFlt);
                     99: 
                    100:         }
                    101: 
                    102:         WRITE_CONTROLLER(
                    103:             &TapeExtension->QControllerData->FDC_Addr->dr,
                    104:             (SHORT)Command[i]);
                    105: 
                    106:         DbgAddEntry(Command[i]);
                    107: 
                    108:         Q117iShortTimer(t0012us);
                    109:     }
                    110: 
                    111:     return(NoErr);
                    112: }

unix.superglobalmegacorp.com

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