Changeset 233 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Inc/RomVars.inc


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/XTIDE_Universal_BIOS/Inc/RomVars.inc

    r227 r233  
    4848; Controller specific variables
    4949struc IDEVARS
     50;;; Word 0
     51    .wSerialPortAndBaud:                    ; Serial connection port (low, divided by 4) and baud rate divisor (high)
    5052    .wPort:                                 ; IDE Base Port for Command Block (usual) Registers
    51     .bSerialCOMDigit            resb    1   ; Serial Device COM Port digit
    52     .bSerialPackedPortAndBaud   resb    1   ; Serial Device packed port and baud
     53    .bSerialPort                resb    1
     54    .bSerialBaud                resb    1
    5355
    54     .wPortCtrl:                             ; IDE Base Port for Control Block Registers
    55     .wSerialPackedPrintBaud     resb    2   ; Serial Device packed baud rate for printing
     56;;; Word 1
     57    .wPortCtrl:
     58    .bSerialUnused              resb    1   ; IDE Base Port for Control Block Registers
    5659
     60    .wSerialCOMPortCharAndDevice:           ; In DetectPrint, we grab the COM Port char and Device at the same time
     61    .bSerialCOMPortChar         resb    1   ; Serial connection COM port number/letter
     62
     63;;; Word 2
    5764    .bDevice                    resb    1   ; Device type
     65
    5866    .bIRQ                       resb    1   ; Interrupt Request Number
     67
     68;;; And more...
    5969    .drvParamsMaster            resb    DRVPARAMS_size
    6070    .drvParamsSlave             resb    DRVPARAMS_size
    6171endstruc
     72
     73%if IDEVARS.bSerialCOMPortChar+1 != IDEVARS.bDevice
     74%erorr "IDEVARS.bSerialCOMPortChar needs to come immediately before IDEVARS.bDevice so that both bytes can be fetched at the same time inside DetectPrint.asm"
     75%endif
    6276
    6377; Default values for Port and PortCtrl, shared with the configurator
     
    6781DEVICE_ATA_DEFAULT_PORT                 EQU     1F0h
    6882DEVICE_ATA_DEFAULT_PORTCTRL             EQU     3F0h
    69 DEVICE_SERIAL_DEFAULT_COM               EQU     0       ; COM1
    70 DEVICE_SERIAL_DEFAULT_BAUD              EQU     1       ; 9600
    7183
    7284; Device types for IDEVARS.bDevice
     
    7789DEVICE_16BIT_ATA                        EQU (3<<1)
    7890DEVICE_32BIT_ATA                        EQU (4<<1)
    79 DEVICE_SERIAL_PORT                      EQU (5<<1)
     91DEVICE_SERIAL_PORT                      EQU (5<<1)      ; must be last entry, or remove optimization in DetectPrint
    8092
    8193
     
    94106FLG_DRVPARAMS_BLOCKMODE EQU (1<<1)  ; Enable Block mode transfers
    95107FLG_DRVPARAMS_USERLBA   EQU (1<<2)  ; User specified LBA values
    96 
    97 
    98 ; Defines for IDEVARS.bSerialPackedPortAndBaud (same format used by DPT.bSerialPortAndBaud)
    99 ;
    100 ; pppp ppbb
    101 ;   i/o port address = p * 2 + 240h
    102 ;   baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K
    103 ;
    104 ; 240h/2400baud corresponds to 0 for a PackedPortAndBaud value, which triggers auto detect code.
    105 ; Which means 240h is not usable, and is why ..._MINPORT is 248h.  A value is reserved at the upper
    106 ; end of the spectrum in case it is needed (whcih is why it is 430h instead of 438h).
    107 ;
    108 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK            EQU     0fch
    109 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS            EQU     03fh
    110 DEVICE_SERIAL_PACKEDPORTANDBAUD_PORT_FIELD_POSITION EQU     2
    111 DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT        EQU     240h
    112 DEVICE_SERIAL_PACKEDPORTANDBAUD_MINPORT             EQU     248h    ; minimum port value that the user can set
    113 DEVICE_SERIAL_PACKEDPORTANDBAUD_MAXPORT             EQU     430h    ; or ((..._PORTMASK-1) << 1) + ..._STARTINGPORT
    114 
    115 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK            EQU     3h
    116 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS            EQU     3h
    117 DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUD_FIELD_POSITION EQU     0
    118 
    119 ; Defines for IDEVARS.wSerialPrintBaud
    120 ;
    121 ; pppp ppnn nnnn nnnn
    122 ;   unsigned number to output = n
    123 ;   postfix character = p + '0' (designed for '0' and 'K', although other values are possible)
    124 ;
    125 ; Note that the contents of this word is only used for printing by the BIOS when a drive is detected. 
    126 ; It is not used for any other purpose, and so long as it conforms to the structure, any values can be used.
    127 ;
    128 DEVICE_SERIAL_PRINTBAUD_NUMBERMASK      EQU     003ffh
    129 DEVICE_SERIAL_PRINTBAUD_POSTCHARMASK    EQU     0fc00h
    130 DEVICE_SERIAL_PRINTBAUD_POSTCHARADD     EQU     '0'
    131 ;
    132 ; These are defined here (instead of in the configurator) for consistency since they could also be used
    133 ; in main.asm as a default for an IDEVARS structure.
    134 ;
    135 DEVICE_SERIAL_PRINTBAUD_2400  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 240)       ; Prints "2400"
    136 DEVICE_SERIAL_PRINTBAUD_9600  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 960)       ; Prints "9600"
    137 DEVICE_SERIAL_PRINTBAUD_38_4  EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 38)        ; Prints "38K"
    138 DEVICE_SERIAL_PRINTBAUD_115_2 EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 115)       ; Prints "115K"
    139108
    140109;
Note: See TracChangeset for help on using the changeset viewer.