Changeset 277 in xtideuniversalbios for trunk/Serial_Server/library
- Timestamp:
- Feb 28, 2012, 2:45:48 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/Serial_Server/library
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Serial_Server/library/Image.cpp
r259 r277 38 38 39 39 return( fi ); 40 } 41 42 void flipEndian( unsigned short *buff, unsigned int len ) 43 { 44 for( unsigned int t = 0; t < len/2; t++ ) 45 buff[t] = (buff[t] & 0xff) << 8 | (buff[t] & 0xff00) >> 8; 40 46 } 41 47 … … 178 184 #define ATA_wBpSect 5 179 185 #define ATA_wSPT 6 186 180 187 #define ATA_strSerial 10 188 #define ATA_strSerial_Length 20 189 181 190 #define ATA_strFirmware 23 191 #define ATA_strFirmware_Length 8 192 182 193 #define ATA_strModel 27 194 #define ATA_strModel_Length 40 195 183 196 #define ATA_wCaps 49 184 197 #define ATA_wCurCyls 54 … … 190 203 // Words carved out of the vendor specific area for our use 191 204 // 205 #define ATA_wSerialServerVersion 157 192 206 #define ATA_wSerialFloppyFlagAndType 158 193 207 #define ATA_wSerialPortAndBaud 159 … … 223 237 }; 224 238 225 void Image::respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan ) 226 { 239 void Image::respondInquire( unsigned short *buff, unsigned short originalPortAndBaud, struct baudRate *baudRate, unsigned short port, unsigned char scan ) 240 { 241 char formatBuff[ 128 ]; 242 227 243 memset( &buff[0], 0, 514 ); 228 244 … … 240 256 241 257 if( comPort ) 242 sprintf( (char *) &buff[ATA_strModel], "%.15s (COM%c/%s)", shortFileName, comPort, baudRate->display );258 sprintf( formatBuff, "%.15s (COM%c/%s) ", shortFileName, comPort, baudRate->display ); 243 259 else 244 sprintf( (char *) &buff[ATA_strModel], "%.25s (%s baud)", shortFileName, baudRate->display );260 sprintf( formatBuff, "%.25s (%s baud) ", shortFileName, baudRate->display ); 245 261 } 246 262 else 247 sprintf( (char *) &buff[ATA_strModel], "%.30s", shortFileName ); 248 249 strncpy( (char *) &buff[ATA_strSerial], "serial", 20 ); 250 strncpy( (char *) &buff[ATA_strFirmware], "firmw", 8 ); 251 252 for( int t = ATA_strModel; t < ATA_strModel+40; t++ ) 253 buff[t] = (buff[t] >> 8) | (buff[t] << 8); 263 sprintf( formatBuff, "%.30s ", shortFileName ); 264 strncpy( (char *) &buff[ATA_strModel], formatBuff, ATA_strModel_Length ); 265 flipEndian( &buff[ATA_strModel], ATA_strModel_Length ); 266 267 strncpy( (char *) &buff[ATA_strSerial], "SerialDrive ", ATA_strSerial_Length ); 268 flipEndian( &buff[ATA_strSerial], ATA_strSerial_Length ); 269 270 sprintf( formatBuff, "%d.%d ", SERIAL_SERVER_MAJORVERSION, SERIAL_SERVER_MINORVERSION ); 271 strncpy( (char *) &buff[ATA_strFirmware], formatBuff, ATA_strFirmware_Length ); 272 flipEndian( &buff[ATA_strFirmware], ATA_strFirmware_Length ); 254 273 255 274 if( useCHS ) … … 266 285 } 267 286 287 // We echo back the port and baud that we were called on from the client, 288 // the client then uses this value to finalize the DPT. 289 // 290 buff[ ATA_wSerialPortAndBaud ] = originalPortAndBaud; 291 292 // In case the client requires a specific server version... 293 // 294 buff[ ATA_wSerialServerVersion ] = (SERIAL_SERVER_MAJORVERSION << 8) | SERIAL_SERVER_MINORVERSION; 295 268 296 if( floppy ) 269 buff[ ATA_wSerialFloppyFlagAndType ] = ATA_wSerialFloppyFlagAndType_Flag | (floppyType << ATA_wSerialFloppyFlagAndType_TypePosition); 297 buff[ ATA_wSerialFloppyFlagAndType ] = 298 ATA_wSerialFloppyFlagAndType_Flag | (floppyType << ATA_wSerialFloppyFlagAndType_TypePosition); 270 299 271 300 // we always set this, so that the bulk of the BIOS will consider this disk as a hard disk -
trunk/Serial_Server/library/Library.h
r259 r277 8 8 #ifndef LIBRARY_H_INCLUDED 9 9 #define LIBRARY_H_INCLUDED 10 11 #define SERIAL_SERVER_MAJORVERSION 1 12 #define SERIAL_SERVER_MINORVERSION 0 10 13 11 14 void log( int level, char *message, ... ); … … 54 57 static int parseGeometry( char *str, unsigned long *p_cyl, unsigned long *p_head, unsigned long *p_sect ); 55 58 56 void respondInquire( unsigned short *buff, struct baudRate *baudRate, unsigned short port, unsigned char scan );59 void respondInquire( unsigned short *buff, unsigned short originalPortAndBaud, struct baudRate *baudRate, unsigned short port, unsigned char scan ); 57 60 58 61 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
r258 r277 35 35 unsigned char baud; 36 36 } inquire; 37 struct { 38 unsigned char command; 39 unsigned char driveAndHead; 40 unsigned char count; 41 unsigned char scan; 42 unsigned short PackedPortAndBaud; 43 } inquirePacked; 37 44 unsigned char b[514]; 38 45 unsigned short w[257]; … … 342 349 localScan = buff.inquire.scan; // need to do this before the call to 343 350 // img->respondInquire, as it will clear the buff 344 img->respondInquire( &buff.w[0], serial->baudRate, 351 img->respondInquire( &buff.w[0], buff.inquirePacked.PackedPortAndBaud, 352 serial->baudRate, 345 353 ((unsigned short) buff.inquire.port) << 2, 346 354 (img == image1 && lastScan) || buff.inquire.scan );
Note:
See TracChangeset
for help on using the changeset viewer.