Changeset 233 in xtideuniversalbios for trunk/Serial_Server/library
- Timestamp:
- Feb 4, 2012, 6:21:22 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/Serial_Server/library
- Files:
-
- 4 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
Note:
See TracChangeset
for help on using the changeset viewer.