Changeset 277 in xtideuniversalbios for trunk/Serial_Server/library/Image.cpp
- Timestamp:
- Feb 28, 2012, 2:45:48 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.