Changeset 233 in xtideuniversalbios for trunk/Serial_Server/library/Process.cpp


Ignore:
Timestamp:
Feb 4, 2012, 6:21:22 PM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Serial Port: split single byte port and baud into two bytes, taking advantage of the two bytes in DPT_SERIAL, which supports more serial baud rates and in particular fixed a bug where a 4x client machine couldn't talk to a 115.2K server machine. This is a wide change, touching lots of files, but most are shallow changes. DetectPrint.asm took the most significant changes, now it calculates the baud rate to display instead of using characters provided by the Configurator. The Configurator now has a new menu flag, FLG_MENUITEM_CHOICESTRINGS, for specifying that values are not linear and they should be lookedup rather than indexed. Finally, another important bug fixed here is that in some error cases, the serial port code could get into an infinite loop waiting ont the hardware; now it has a timeout.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Serial_Server/library/Process.cpp

    r219 r233  
    3131        unsigned char driveAndHead;
    3232        unsigned char count;
    33         unsigned char undefined1;
    34         unsigned char portAndBaud;
    35         unsigned char undefined2;
     33        unsigned char scan;
     34        unsigned char port;
     35        unsigned char baud;
    3636    } inquire;
    3737    unsigned char b[514];
     
    4848#define SERIAL_COMMAND_MASK 0xe3
    4949#define SERIAL_COMMAND_HEADERMASK 0xe0
    50 
    51 #define SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK 3
    52 #define SERIAL_INQUIRE_PORTANDBAUD_PORTMASK 0xfc
    53 #define SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT 0x240
    54 
    55 #define SERIAL_INQUIRE_PORTANDBAUD_PORTTRANSLATE( a ) ( ((a) & SERIAL_INQUIRE_PORTANDBAUD_PORT) << 1 | SERIAL_INQUIRE_PORTANDBAUD_STARTINGPORT )
    5650
    5751#define ATA_COMMAND_LBA 0x40
     
    9690    unsigned long cyl, sect, head;
    9791    unsigned long perfTimer;
     92    unsigned char lastScan;
    9893
    9994    GetTime_Timeout_Local = GetTime_Timeout();
     
    10297    readto = 0;
    10398    workCount = workOffset = workCommand = 0;
     99    lastScan = 0;
    104100
    105101    lasttick = GetTime();
     
    282278                    if( workCommand == SERIAL_COMMAND_INQUIRE )
    283279                        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 );
    287282                    else if( buff.chs.driveAndHead & ATA_COMMAND_LBA )
    288283                        log( 1, "%s %d: LBA=%u, Count=%u", comStr, img == image0 ? 0 : 1,
     
    325320                if( workCommand == SERIAL_COMMAND_INQUIRE )
    326321                {
     322                    unsigned char localScan;
     323
    327324                    if( serial->speedEmulation &&
    328                         (buff.inquire.portAndBaud & SERIAL_INQUIRE_PORTANDBAUD_BAUDMASK) != serial->baudRate->divisor )
     325                        buff.inquire.baud != serial->baudRate->divisor )
    329326                    {
    330327                        log( 1, "    Ignoring Inquire with wrong baud rate" );
     
    333330                    }
    334331
    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;
    336338                }
    337339                //
     
    342344                    img->seekSector( mylba + workOffset );
    343345                    img->readSector( &buff.w[0] );
     346                    lastScan = 0;
    344347                }
    345348
Note: See TracChangeset for help on using the changeset viewer.