Changeset 199 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS


Ignore:
Timestamp:
Nov 21, 2011, 11:01:08 AM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Adding proper serial port support to the Configurator, which required some minor changes elsewhere. Also added an option, off by default, to automatically scan for serial drives at the end of normal drive detection (no ALT key required, although that is still available if the option is off).

Location:
trunk/XTIDE_Universal_BIOS
Files:
5 edited

Legend:

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

    r196 r199  
    3434
    3535; Bit defines for ROMVARS.wFlags
    36 FLG_ROMVARS_FULLMODE        EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
    37 FLG_ROMVARS_DRVXLAT         EQU (1<<2)  ; Enable drive number translation
    38 FLG_ROMVARS_MODULE_SERIAL   EQU (1<<3)
    39 FLG_ROMVARS_MODULE_EBIOS    EQU (1<<4)
     36FLG_ROMVARS_FULLMODE                EQU (1<<0)  ; Full operating mode (steals base RAM, supports EBIOS etc.)
     37FLG_ROMVARS_DRVXLAT                 EQU (1<<2)  ; Enable drive number translation
     38FLG_ROMVARS_SERIAL_SCANDETECT       EQU (1<<3)  ; Scan COM ports at the end of drive detection.  Can also be invoked
     39                                                ; by holding down the ALT key at the end of drive detection.
     40                                                ; (Conveniently, this is 8, a fact we exploit when testing the bit)
     41FLG_ROMVARS_MODULE_SERIAL           EQU (1<<6)  ; Here in case the configuration needs to know functionality is present
     42FLG_ROMVARS_MODULE_EBIOS            EQU (1<<7)  ; Here in case the configuration needs to know functionality is present
    4043
    4144; Boot Menu Display Modes (see Assembly Library Display.inc for standard modes)
     
    5861endstruc
    5962
     63; Default values for Port and PortCtrl, shared with the configurator
     64;
     65DEVICE_XTIDE_DEFAULT_PORT               EQU     300h
     66DEVICE_XTIDE_DEFAULT_PORTCTRL           EQU     308h
     67DEVICE_ATA_DEFAULT_PORT                 EQU     1F0h
     68DEVICE_ATA_DEFAULT_PORTCTRL             EQU     3F0h
     69DEVICE_SERIAL_DEFAULT_COM               EQU     0       ; COM1
     70DEVICE_SERIAL_DEFAULT_BAUD              EQU     1       ; 9600
     71
    6072; Device types for IDEVARS.bDevice
     73;
    6174DEVICE_8BIT_DUAL_PORT_XTIDE             EQU (0<<1)
    6275DEVICE_XTIDE_WITH_REVERSED_A3_AND_A0    EQU (1<<1)
     
    6578DEVICE_32BIT_ATA                        EQU (4<<1)
    6679DEVICE_SERIAL_PORT                      EQU (5<<1)
     80
    6781
    6882; Master/Slave drive specific parameters
     
    8094
    8195
     96; Defines for IDEVARS.bSerialPackedPortAndBaud (same format used by DPT.bSerialPortAndBaud)
     97;
     98; pppp ppbb
     99;   i/o port address = p * 2 + 240h
     100;   baud rate = b, where 00 = 2400, 01 = 9600, 10 = 38.4K, 11 = 115.2K
     101;
     102DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK        EQU     0fch
     103DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTBITS        EQU     03fh
     104DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT    EQU     240h
     105DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK        EQU     3h
     106DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDBITS        EQU     3h
     107
     108; Defines for IDEVARS.wSerialPrintBaud
     109;
     110; pppp ppnn nnnn nnnn
     111;   unsigned number to output = n
     112;   postfix character = p + '0' (designed for '0' and 'K', although other values are possible)
     113;
     114; Note that the contents of this word is only used for printing by the BIOS when a drive is detected. 
     115; It is not used for any other purpose, and so long as it conforms to the structure, any values can be used.
     116;
     117DEVICE_SERIAL_PRINTBAUD_NUMBERMASK      EQU     003ffh
     118DEVICE_SERIAL_PRINTBAUD_POSTCHARMASK    EQU     0fc00h
     119DEVICE_SERIAL_PRINTBAUD_POSTCHARADD     EQU     '0'
     120;
     121; These are defined here (instead of in the configurator) for consistency since they could also be used
     122; in main.asm as a default for an IDEVARS structure.
     123;
     124DEVICE_SERIAL_PRINTBAUD_2400  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 240)       ; Prints "2400"
     125DEVICE_SERIAL_PRINTBAUD_9600  EQU ((('0'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 960)       ; Prints "9600"
     126DEVICE_SERIAL_PRINTBAUD_38_4  EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 38)        ; Prints "38K"
     127DEVICE_SERIAL_PRINTBAUD_115_2 EQU ((('K'-DEVICE_SERIAL_PRINTBAUD_POSTCHARADD)<<10) | 115)       ; Prints "115K"
     128
     129;
     130; COM Number to I/O Port Address Mapping
     131;
     132; COM Number:                               1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12     
     133; Corresponds to I/O port:                3f8,  2f8,  3e8,  2e8,  2f0,  3e0,  2e0,  260,  368,  268,  360,  270
     134; Corresponds to Packed I/O port (hex):    37,   17,   35,   15,   16,   34,   14,    4,   25,    5,   24,    6
     135;
     136DEVICE_SERIAL_COM1  EQU     3f8h
     137DEVICE_SERIAL_COM2  EQU     2f8h
     138DEVICE_SERIAL_COM3  EQU     3e8h
     139DEVICE_SERIAL_COM4  EQU     2e8h
     140DEVICE_SERIAL_COM5  EQU     2f0h
     141DEVICE_SERIAL_COM6  EQU     3e0h
     142DEVICE_SERIAL_COM7  EQU     2e0h
     143DEVICE_SERIAL_COM8  EQU     260h
     144DEVICE_SERIAL_COM9  EQU     368h
     145DEVICE_SERIAL_COMA  EQU     268h
     146DEVICE_SERIAL_COMB  EQU     360h
     147DEVICE_SERIAL_COMC  EQU     270h
     148
     149
    82150%endif ; ROMVARS_INC
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r196 r199  
    119119        mov     cl, dl
    120120
    121         and     cl, SerialCommand_PackedPortAndBaud_BaudMask
     121        and     cl, DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK
    122122        shl     cl, 1
    123123        mov     ch, SerialCommand_UART_divisorLow_startingBaud
     
    125125        adc     ch, 0
    126126
    127         and     dl, SerialCommand_PackedPortAndBaud_PortMask
     127        and     dl, DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK
    128128        mov     dh, 0
    129129        shl     dx, 1           ; port offset already x4, needs one more shift to be x8
    130         add     dx, SerialCommand_PackedPortAndBaud_StartingPort
     130        add     dx, DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT
    131131
    132132;
     
    501501SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH:
    502502
    503         mov     dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud]
     503        mov     dx,[cs:bp+IDEVARS.bSerialCOMDigit]
    504504        test    dl,dl
    505505        jz      SerialCommand_AutoSerial
    506506
     507        xchg    dh,dl           ; dh (the COM character to print) will be transmitted to the server,
     508                                ; so we know this is not an auto detect
     509       
    507510; fall-through
    508511SerialCommand_IdentifyDeviceInDL_DriveInBH:
     
    543546;
    544547
    545 SerialCommand_ScanPortAddresses:     db  0b8h, 0f8h, 0bch, 0bah, 0fah, 0beh, 0feh, 0
    546 ; Corresponds to I/O port:                3f8,  2f8,  3e8,  2e8,  2f0,  3e0,  2e0,  260,  368,  268,  360,  270
    547 ; COM Assignments:                          1,    2,    3,    4,    5,    6,    7,    8,    9,   10,   11,   12
    548 ; Corresponds to Packed I/O port (hex):    37,   17,   35,   15,   16,   34,   14,    4,   25,    5,   24,    6     
     548SerialCommand_ScanPortAddresses:    db  DEVICE_SERIAL_COM7 >> 2
     549                                    db  DEVICE_SERIAL_COM6 >> 2
     550                                    db  DEVICE_SERIAL_COM5 >> 2
     551                                    db  DEVICE_SERIAL_COM4 >> 2
     552                                    db  DEVICE_SERIAL_COM3 >> 2
     553                                    db  DEVICE_SERIAL_COM2 >> 2
     554                                    db  DEVICE_SERIAL_COM1 >> 2
     555                                    db  0
    549556
    550557ALIGN JUMP_ALIGN
     
    581588; Pack into dl, baud rate starts at 0
    582589;
    583         add     dx,-(SerialCommand_PackedPortAndBaud_StartingPort)
    584         shr     dx,1
     590        add     dx,-(DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT)
     591        shr     dx,1            ; dh is zero at this point, and will be sent to the server,
     592                                ; so we know this is an auto detect
    585593
    586594        jmp     .testFirstBaud
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectDrives.asm

    r196 r199  
    3131    add     bp, BYTE IDEVARS_size           ; Point to next IDEVARS
    3232    loop    .DriveDetectLoop
    33 
    3433%ifdef MODULE_SERIAL
    35     test    BYTE [es:BDA.bKBFlgs1], 8       ; alt key depressed
    36     jz      .done
     34    mov     al,[cs:ROMVARS.wFlags]
     35    or      al,[es:BDA.bKBFlgs1]
     36    and     al,8        ; 8 = alt key depressed, same as FLG_ROMVARS_SERIAL_ALWAYSDETECT
     37    jz      .done
    3738    mov     bp, ROMVARS.ideVarsSerialAuto
    3839    mov     si, g_szDetectCOMAuto
    39 ;;; fall-through       
     40;;; fall-through                   
    4041%else
    4142    ret
     43%endif
     44
     45%if FLG_ROMVARS_SERIAL_SCANDETECT != 8
     46%error "DetectDrives is currently coded to assume that FLG_ROMVARS_SERIAL_ALWAYSDETECT is the same bit as the ALT key code in the BDA.  Changes in the code will be needed if these values are no longer the same."
    4247%endif
    4348
  • trunk/XTIDE_Universal_BIOS/Src/Initialization/DetectPrint.asm

    r196 r199  
    5353%ifdef MODULE_SERIAL
    5454;
    55 ; Baud rate is packed into one word:
    56 ;    High order 6 bits: number to add to '0' to get postfix character ('0' or 'K')
    57 ;    Low order 10 bits: binary number to display (960, 240, 38, or 115)
    58 ;          To get 9600: '0'<<10 + 960
    59 ;          To get 2400: '0'<<10 + 240
    60 ;          To get 38K:  ('K'-'0')<<10 + 38
    61 ;          To get 115K: ('K'-'0')<<10 + 115
    62 ;
     55; Print baud rate from .wSerialPackedPrintBaud, in two parts - %u and then %c
     56;
    6357    mov     ax,cx                       ; Unpack baud rate number
    64     and     ax,03ffh
     58    and     ax,DEVICE_SERIAL_PRINTBAUD_NUMBERMASK
    6559    push    ax
    6660
    6761    mov     al,ch                       ; Unpack baud rate postfix ('0' or 'K')
    68     eSHR_IM al,2
    69     add     al,'0'
     62    eSHR_IM al,2                        ; also effectively masks off the postfix
     63    add     al,DEVICE_SERIAL_PRINTBAUD_POSTCHARADD
    7064    push    ax
    7165%endif
  • trunk/XTIDE_Universal_BIOS/Src/Main.asm

    r192 r199  
    8282    at  ROMVARS.bStealSize,     db  1                       ; Steal 1kB from base memory
    8383
    84     at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  1F0h            ; Controller Command Block base port
    85     at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  3F0h            ; Controller Control Block base port
     84    at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  DEVICE_ATA_DEFAULT_PORT         ; Controller Command Block base port
     85    at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  DEVICE_ATA_DEFAULT_PORTCTRL     ; Controller Control Block base port
    8686    at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_16BIT_ATA
    8787    at  ROMVARS.ideVars0+IDEVARS.bIRQ,          db  0
     
    9696    at  ROMVARS.ideVars1+IDEVARS.drvParamsSlave+DRVPARAMS.wFlags,   db  FLG_DRVPARAMS_BLOCKMODE
    9797
    98     at  ROMVARS.ideVars2+IDEVARS.wPort,         dw  300h            ; Controller Command Block base port
    99     at  ROMVARS.ideVars2+IDEVARS.wPortCtrl,     dw  308h            ; Controller Control Block base port
     98    at  ROMVARS.ideVars2+IDEVARS.wPort,         dw  DEVICE_XTIDE_DEFAULT_PORT           ; Controller Command Block base port
     99    at  ROMVARS.ideVars2+IDEVARS.wPortCtrl,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL       ; Controller Control Block base port
    100100    at  ROMVARS.ideVars2+IDEVARS.bDevice,       db  DEVICE_8BIT_DUAL_PORT_XTIDE
    101101    at  ROMVARS.ideVars2+IDEVARS.bIRQ,          db  0
     
    127127    at  ROMVARS.bStealSize,     db  1                       ; Steal 1kB from base memory in full mode
    128128
    129     at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  300h            ; Controller Command Block base port
    130     at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  308h            ; Controller Control Block base port
     129    at  ROMVARS.ideVars0+IDEVARS.wPort,         dw  DEVICE_XTIDE_DEFAULT_PORT           ; Controller Command Block base port
     130    at  ROMVARS.ideVars0+IDEVARS.wPortCtrl,     dw  DEVICE_XTIDE_DEFAULT_PORTCTRL       ; Controller Control Block base port
    131131    at  ROMVARS.ideVars0+IDEVARS.bDevice,       db  DEVICE_8BIT_DUAL_PORT_XTIDE
    132132    at  ROMVARS.ideVars0+IDEVARS.bIRQ,          db  0               ; IRQ
Note: See TracChangeset for help on using the changeset viewer.