Changeset 233 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/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.

Location:
trunk/XTIDE_Universal_BIOS/Inc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Inc/ATA_ID.inc

    r3 r233  
    254254    .wRMSN      resw 1  ; 127F, Removable Media Status Notification feature set support
    255255    .wSecurity  resw 1  ; 128FV, Security Status
    256                 resw 160-129    ; 129...159X
     256                resw 159-129    ; 129...158X, Vendor Specific
     257    .wVendor    resw 1  ; 159X, Vendor Specific - picking one word for use by the Serial Port code
    257258    .wCFAPower  resw 1  ; 160FV, CFA Power Mode 1
    258259                resw 176-161    ; 161...175R, Reserved for assignment by the CompactFlash Association
  • trunk/XTIDE_Universal_BIOS/Inc/CustomDPT.inc

    r232 r233  
    2828    .dpt                        resb    DPT_size
    2929
    30     ; Block size is specified in sectors (1, 2, 4, 8, 16, 32, 64 or 128)
     30    ; Block size is specified in sectors (1, 2, 4, 8, 16, 32 or 64).
     31    ; 128 is not allowed to prevent offset overflow during data transfer.
    3132    .wSetAndMaxBlock:
    3233    .bSetBlock                  resb    1   ; Current block size (at least 1)
     
    3940    .dpt                        resb    DPT_size
    4041
    41     .bSerialPortAndBaud         resb    1   ; Packed I/O port and baud rate for serial drives
    42                                 resb    1   ; unused alignment
     42    .wSerialPortAndBaud:
     43    .bSerialPort                resb    1   ; Serial connection I/O port address, divided by 4
     44    .bSerialBaud                resb    1   ; Serial connection baud rate divisor
    4345endstruc
    4446%endif
  • trunk/XTIDE_Universal_BIOS/Inc/RamVars.inc

    r218 r233  
    1313    .bHDSwap        resb    1   ; Hard Drive to swap to 80h and vice versa
    1414    .bXlatedDrv     resb    1   ; Drive number after translation
    15 %ifdef MODULE_SERIAL
    16     .bLastSerial    resb    1   ; Packed Port and Baud for last serial drive detected
    17                                 ; (using space of an alignment byte,
    18                                 ; used during and after boot (int13/25h case))
    19 %else
    2015                    resb    1   ; alignment
    21 %endif
    2216endstruc
    2317
  • 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.