|
|
1.1 ! root 1: /*++ ! 2: ! 3: Copyright (c) 1993 - Colorado Memory Systems, Inc. ! 4: All Rights Reserved ! 5: ! 6: Module Name: ! 7: ! 8: select.c ! 9: ! 10: Abstract: ! 11: ! 12: Code to select the tape drive (using one of many different schemes ! 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: Q117iSelectDrive( ! 37: IN PTAPE_EXTENSION TapeExtension ! 38: ) ! 39: ! 40: /*++ ! 41: ! 42: Routine Description: ! 43: ! 44: Select the tape drive by making the select line active (low). ! 45: ! 46: Agruments: ! 47: ! 48: TapeExtension - ! 49: ! 50: Return Value: ! 51: ! 52: ! 53: ! 54: --*/ ! 55: ! 56: { ! 57: STATUS retval = NoErr; ! 58: ! 59: if (TapeExtension->QControllerData->DriveSelect.Selected == FALSE) { ! 60: ! 61: WRITE_CONTROLLER(&TapeExtension->QControllerData->FDC_Addr->dor,TapeExtension->QControllerData->DriveSelect.SelectByte); ! 62: ! 63: if ((TapeExtension->QControllerData->DriveSelect.SelectByte == selu || ! 64: TapeExtension->QControllerData->DriveSelect.SelectByte == selub) && ! 65: TapeExtension->DriveParms.DriveSelect != curb) { ! 66: ! 67: if (TapeExtension->DriveParms.Flavor == CMS) { ! 68: ! 69: if ((retval = Q117iSendByte(TapeExtension, Select_Drive)) == NoErr) { ! 70: ! 71: Q117iSleep(TapeExtension, mt_wt2ticks, FALSE); ! 72: retval = Q117iSendByte(TapeExtension, 2); ! 73: ! 74: } ! 75: ! 76: } ! 77: ! 78: if ((retval == NoErr) && (TapeExtension->DriveParms.Flavor == SUMMIT || ! 79: TapeExtension->DriveParms.Flavor == ARCHIVE || ! 80: TapeExtension->DriveParms.Flavor == CORE)) { ! 81: ! 82: retval = Q117iMtnPreamble(TapeExtension, TRUE); ! 83: ! 84: } ! 85: ! 86: } ! 87: if (retval == NoErr) { ! 88: ! 89: TapeExtension->QControllerData->DriveSelect.Selected = TRUE; ! 90: ! 91: } ! 92: ! 93: Q117iSleep(TapeExtension, mt_wt2ticks, FALSE); ! 94: } ! 95: ! 96: return(retval); ! 97: } ! 98: ! 99: ! 100: STATUS ! 101: Q117iDeselectDrive( ! 102: IN PTAPE_EXTENSION TapeExtension ! 103: ) ! 104: ! 105: /*++ ! 106: ! 107: Routine Description: ! 108: ! 109: Deselect the tape drive by making the select line inactive (high). ! 110: ! 111: Arguments: ! 112: ! 113: TapeExtension - ! 114: ! 115: Return Value: ! 116: ! 117: ! 118: ! 119: --*/ ! 120: ! 121: { ! 122: STATUS retval = NoErr; ! 123: ! 124: if (TapeExtension->QControllerData->DriveSelect.Selected == TRUE) { ! 125: ! 126: if ((TapeExtension->QControllerData->DriveSelect.SelectByte == selu || ! 127: TapeExtension->QControllerData->DriveSelect.SelectByte == selub) && ! 128: TapeExtension->DriveParms.DriveSelect != curb) { ! 129: ! 130: if (TapeExtension->DriveParms.Flavor == CMS || ! 131: TapeExtension->DriveParms.Flavor == UNKNOWN) { ! 132: ! 133: retval = Q117iSendByte(TapeExtension, Deselect_Drive); ! 134: ! 135: } ! 136: ! 137: if ((retval == NoErr) && ! 138: (TapeExtension->DriveParms.Flavor == SUMMIT || ! 139: TapeExtension->DriveParms.Flavor == ARCHIVE || ! 140: TapeExtension->DriveParms.Flavor == CORE)) { ! 141: ! 142: retval = Q117iMtnPreamble(TapeExtension, FALSE); ! 143: ! 144: } ! 145: ! 146: } ! 147: ! 148: WRITE_CONTROLLER( ! 149: &TapeExtension->QControllerData->FDC_Addr->dor, ! 150: TapeExtension->QControllerData->DriveSelect.DeselectByte); ! 151: TapeExtension->QControllerData->DriveSelect.Selected = FALSE; ! 152: Q117iSleep(TapeExtension, mt_wt2ticks, FALSE); ! 153: } ! 154: ! 155: return(retval); ! 156: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.