Changeset 233 in xtideuniversalbios for trunk/Serial_Server
- Timestamp:
- Feb 4, 2012, 6:21:22 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/Serial_Server
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/Image.cpp
r219 r233 137 137 #define ATA_dwLBACnt 60 138 138 139 #define ATA_ VendorSpecific_ReturnPortBaud 158139 #define ATA_wVendor 159 140 140 141 141 #define ATA_wCaps_LBA 0x200 … … 164 164 }; 165 165 166 void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned char portAndBaud ) 167 { 168 unsigned short comPort = 0; 169 struct comPorts *cp; 170 171 if( portAndBaud ) 172 { 173 for( cp = supportedComPorts; cp->port && cp->port != ((portAndBaud << 3) + 0x260); cp++ ) ; 174 if( cp->port ) 175 comPort = cp->com; 176 } 177 166 void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan ) 167 { 178 168 memset( &buff[0], 0, 514 ); 179 169 180 if( comPort ) 181 sprintf( (char *) &buff[ATA_strModel], "%.20s (COM%d/%s)", shortFileName, comPort, baudRate->display ); 182 else 183 sprintf( (char *) &buff[ATA_strModel], "%.30s (%s baud)", shortFileName, baudRate->display ); 184 185 // strncpy( (char *) &buff[ATA_strModel], img->shortFileName, 40 ); 170 if( scan ) 171 { 172 unsigned short comPort = 0; 173 struct comPorts *cp; 174 175 if( port ) 176 { 177 for( cp = supportedComPorts; cp->port && cp->port != port; cp++ ) ; 178 if( cp->port ) 179 comPort = cp->com; 180 } 181 182 if( comPort ) 183 sprintf( (char *) &buff[ATA_strModel], "%.15s (COM%c/%s)", shortFileName, comPort, baudRate->display ); 184 else 185 sprintf( (char *) &buff[ATA_strModel], "%.25s (%s baud)", shortFileName, baudRate->display ); 186 } 187 else 188 sprintf( (char *) &buff[ATA_strModel], "%.30s", shortFileName ); 186 189 187 190 strncpy( (char *) &buff[ATA_strSerial], "serial", 20 ); -
trunk/Serial_Server/library/Library.h
r223 r233 42 42 static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect ); 43 43 44 void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned char portAndBaud);44 void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan ); 45 45 46 46 void init( char *name, int p_readOnly, int p_drive, unsigned long p_cyl, unsigned long p_head, unsigned long p_sect, int p_useCHS ); -
trunk/Serial_Server/library/Process.cpp
r219 r233 31 31 unsigned char driveAndHead; 32 32 unsigned char count; 33 unsigned char undefined1;34 unsigned char port AndBaud;35 unsigned char undefined2;33 unsigned char scan; 34 unsigned char port; 35 unsigned char baud; 36 36 } inquire; 37 37 unsigned char b[514]; … … 48 48 #define SERIAL_COMMAND_MASK 0xe3 49 49 #define SERIAL_COMMAND_HEADERMASK 0xe0 50 51 #define SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK 352 #define SERIAL_INQUIRE_PORTANDBAUD_PORTMASK 0xfc53 #define SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT 0x24054 55 #define SERIAL_INQUIRE_PORTANDBAUD_PORTTRANSLATE( a ) ( ((a) & SERIAL_INQUIRE_PORTANDBAUD_PORT) << 1 | SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT )56 50 57 51 #define ATA_COMMAND_LBA 0x40 … … 96 90 unsigned long cyl, sect, head; 97 91 unsigned long perfTimer; 92 unsigned char lastScan; 98 93 99 94 GetTime_Timeout_Local = GetTime_Timeout(); … … 102 97 readto = 0; 103 98 workCount = workOffset = workCommand = 0; 99 lastScan = 0; 104 100 105 101 lasttick = GetTime(); … … 282 278 if( workCommand == SERIAL_COMMAND_INQUIRE ) 283 279 log( 1, "Inquire %d: Client Port=0x%x, Client Baud=%s", img == image0 ? 0 : 1, 284 ((buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_PORTMASK) << 1) 285 + SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT, 286 baudRateMatchDivisor( buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK )->display ); 280 ((unsigned short) buff.inquire.port) << 2, 281 baudRateMatchDivisor( buff.inquire.baud )->display ); 287 282 else if( buff.chs.driveAndHead & ATA_COMMAND_LBA ) 288 283 log( 1, "%s %d: LBA=%u, Count=%u", comStr, img == image0 ? 0 : 1, … … 325 320 if( workCommand == SERIAL_COMMAND_INQUIRE ) 326 321 { 322 unsigned char localScan; 323 327 324 if( serial->speedEmulation && 328 (buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK)!= serial->baudRate->divisor )325 buff.inquire.baud != serial->baudRate->divisor ) 329 326 { 330 327 log( 1, " Ignoring Inquire with wrong baud rate" ); … … 333 330 } 334 331 335 img->respondInquire( &buff.w[0], serial->baudRate, buff.inquire.portAndBaud ); 332 localScan = buff.inquire.scan; // need to do this before the call to 333 // img->respondInquire, as it will clear the buff 334 img->respondInquire( &buff.w[0], serial->baudRate, 335 ((unsigned short) buff.inquire.port) << 2, 336 (img == image1 && lastScan) || buff.inquire.scan ); 337 lastScan = localScan; 336 338 } 337 339 // … … 342 344 img->seekSector( mylba + workOffset ); 343 345 img->readSector( &buff.w[0] ); 346 lastScan = 0; 344 347 } 345 348 -
trunk/Serial_Server/library/Serial.cpp
r215 r233 12 12 struct baudRate supportedBaudRates[] = 13 13 { 14 { 2400, 0x0, "2400" }, 15 { 4800, 0xff, "4800" }, 16 { 9600, 0x1, "9600" }, 17 { 19200, 0xff, "19.2K" }, 18 { 38400, 0x2, "38.4K" }, 19 { 76800, 0xff, "76.8K" }, 20 { 115200, 0x3, "115.2K" }, 21 { 153600, 0xff, "153.6K" }, 22 { 230400, 0xff, "230.4K" }, 23 { 460800, 0xff, "460.8K" }, 24 { 0, 0, NULL } 14 { 2400, 0x30, "2400" }, 15 { 4800, 0x18, "4800" }, 16 { 9600, 0xc, "9600" }, 17 { 19200, 0xff, "19.2K" }, 18 { 28800, 0x4, "28.8K" }, 19 { 38400, 0xff, "38.4K" }, 20 { 57600, 0x2, "57.6K" }, 21 { 76800, 0xff, "76.8K" }, 22 { 115200, 0x1, "115.2K" }, 23 { 153600, 0xff, "153.6K" }, 24 { 230400, 0xff, "230.4K" }, 25 { 460800, 0xff, "460.8K" }, 26 { 0, 0, "Unknown" }, 25 27 }; 26 28 … … 37 39 } 38 40 39 return( NULL);41 return( b ); 40 42 } 41 43 … … 47 49 ; 48 50 49 return( b ->rate ? b : NULL);51 return( b ); 50 52 } 51 53 -
trunk/Serial_Server/win32/Win32.cpp
r225 r233 32 32 " (default is a 32 MB disk, with CHS geometry 65:63:16)", 33 33 "", 34 " -p Named Pipe mode for emulators (pipe is '" PIPENAME "')",34 " -p Named Pipe mode for emulators (pipe is \"" PIPENAME "\")", 35 35 "", 36 36 " -c COMPortNumber COM Port to use (default is first found)", 37 37 "", 38 " -b BaudRate Baud rate to use on the COM port ", 39 " Without a rate multiplier: 2400, 9600, 38400, 115200", 40 " With a 2x rate multiplier: 4800, 19200, 76800, 230400", 41 " With a 4x rate multiplier: 9600, 38400, 153600, 460800", 42 " Abbreviations also accepted (ie, '460K', '38.4K', etc)", 43 " (default is 38400, 115200 in named pipe mode)", 38 " -b BaudRate Baud rate to use on the COM port, with client machine", 39 " rate multiplier in effect:", 40 " None: 2400, 4800, 9600, 28.8K, 57.6K, 115.2K", 41 " 2x: 4800, 9600, 19200, 57.6K, 115.2K, 230.4K", 42 " 4x: 9600, 19200, 38400, 115.2K, 230.4K, 460.8K", 43 " and for completeness: 76.8K, 153.6K", 44 " (default is 9600, 115.2K when in named pipe mode)", 44 45 "", 45 46 " -t Disable timeout, useful for long delays when debugging", … … 148 149 break; 149 150 case 'b': case 'B': 150 if( !(baudRate = baudRateMatchString( argv[++t] )) ) 151 { 152 fprintf( stderr, "Unknown Baud Rate %s\n\n", argv[t] ); 153 usage(); 154 } 151 if( !(baudRate = baudRateMatchString( argv[++t] )) || !baudRate->rate ) 152 log( -2, "Unknown Baud Rate \"%s\"", argv[t] ); 155 153 break; 156 154 default: 157 fprintf( stderr, "Unknown Option: %s\n\n", argv[t] ); 158 usage(); 155 log( -2, "Unknown Option: \"%s\"", argv[t] ); 159 156 } 160 157 } … … 179 176 180 177 if( !baudRate ) 181 baudRate = baudRateMatchString( " 38400" );178 baudRate = baudRateMatchString( "9600" ); 182 179 183 180 do … … 206 203 vfprintf( stderr, message, args ); 207 204 fprintf( stderr, "\n" ); 205 if( level < -1 ) 206 { 207 fprintf( stderr, "\n" ); 208 usage(); 209 } 208 210 exit( 1 ); 209 211 } -
trunk/Serial_Server/win32/Win32Serial.h
r225 r233 37 37 if( !strcmp( name, "PIPE" ) ) 38 38 { 39 log( 0, "Opening named pipe %s (simulating % lu baud)", PIPENAME, baudRate->rate);39 log( 0, "Opening named pipe %s (simulating %s baud)", PIPENAME, baudRate->display ); 40 40 41 41 pipe = CreateNamedPipeA( PIPENAME, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE|PIPE_REJECT_REMOTE_CLIENTS, 2, 1024, 1024, 0, NULL );
Note:
See TracChangeset
for help on using the changeset viewer.