Even more tweaks at flow control support
authorhpa <hpa>
Tue, 20 Nov 2001 22:42:11 +0000 (22:42 +0000)
committerhpa <hpa>
Tue, 20 Nov 2001 22:42:11 +0000 (22:42 +0000)
isolinux.asm
ldlinux.asm
pxelinux.asm
syslinux.doc

index 33903d2..e88d52e 100644 (file)
@@ -351,6 +351,7 @@ VidRows         resb 1                      ; Rows on screen-1
 FlowControl    equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
+FlowIgnore     resb 1                  ; Ignore input unless these bits set
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -1197,8 +1198,11 @@ pc_serial:       call getint                     ; "serial" command
                call ungetc
                call getint                     ; Hardware flow control?
                jnc .valid_flow
-               xor bl,bl                       ; Default -> no flow control
+               xor bx,bx                       ; Default -> no flow control
 .valid_flow:
+               and bh,0Fh                      ; FlowIgnore
+               shl bh,4
+               mov [FlowIgnore],bh
                mov bh,bl
                and bx,0F003h                   ; Valid bits
                mov [FlowControl],bx
@@ -1237,8 +1241,7 @@ pc_serial:        call getint                     ; "serial" command
 
                add dx,byte 3                   ; DX -> MCR
                in al,dx
-               mov ah,[FlowOutput]             ; DTR and RTS control
-               or al,ah                        ; Assert bits
+               or al,[FlowOutput]              ; Assert bits
                call slow_out
 
                ; Show some life
@@ -3463,6 +3466,14 @@ pollchar:
                add dx,byte 5           ; DX -> LSR
                in al,dx
                test al,1               ; ZF = 0 if data pending
+               jz .done
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]     ; Required status bits
+               in al,dx
+               and al,ah
+               cmp al,ah
+               setne al
+               dec al                  ; Set ZF = 0 if equal
 .done:         popad
                ret
 
@@ -3476,10 +3487,16 @@ getchar:
                mov bx,[SerialPort]
                and bx,bx
                jz .again
-               lea dx,[bx+5]           ; Serial status register
+               lea dx,[bx+5]           ; DX -> LSR
                in al,dx
                test al,1
                jz .again
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]
+               in al,dx
+               and al,ah
+               cmp al,ah
+               jne .again
 .serial:       xor ah,ah               ; Avoid confusion
                xchg dx,bx              ; Data port
                in al,dx
index c9b723b..722e748 100644 (file)
@@ -326,6 +326,7 @@ VidRows         resb 1                      ; Rows on screen-1
 FlowControl    equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
+FlowIgnore     resb 1                  ; Ignore input unless these bits set
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -1295,8 +1296,11 @@ pc_serial:       call getint                     ; "serial" command
                call ungetc
                call getint                     ; Hardware flow control?
                jnc .valid_flow
-               xor bl,bl                       ; Default -> no flow control
+               xor bx,bx                       ; Default -> no flow control
 .valid_flow:
+               and bh,0Fh                      ; FlowIgnore
+               shl bh,4
+               mov [FlowIgnore],bh
                mov bh,bl
                and bx,0F003h                   ; Valid bits
                mov [FlowControl],bx
@@ -1335,8 +1339,7 @@ pc_serial:        call getint                     ; "serial" command
 
                add dx,byte 3                   ; DX -> MCR
                in al,dx
-               mov ah,[FlowOutput]             ; DTR and RTS control
-               or al,ah                        ; Assert bits
+               or al,[FlowOutput]              ; Assert bits
                call slow_out
 
                ; Show some life
@@ -3415,6 +3418,14 @@ pollchar:
                add dx,byte 5           ; DX -> LSR
                in al,dx
                test al,1               ; ZF = 0 if data pending
+               jz .done
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]     ; Required status bits
+               in al,dx
+               and al,ah
+               cmp al,ah
+               setne al
+               dec al                  ; Set ZF = 0 if equal
 .done:         popad
                ret
 
@@ -3428,10 +3439,16 @@ getchar:
                mov bx,[SerialPort]
                and bx,bx
                jz .again
-               lea dx,[bx+5]           ; Serial status register
+               lea dx,[bx+5]           ; DX -> LSR
                in al,dx
                test al,1
                jz .again
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]
+               in al,dx
+               and al,ah
+               cmp al,ah
+               jne .again
 .serial:       xor ah,ah               ; Avoid confusion
                xchg dx,bx              ; Data port
                in al,dx
index a2b6a3c..efcec2c 100644 (file)
@@ -386,6 +386,7 @@ VidRows         resb 1                      ; Rows on screen-1
 FlowControl    equ $
 FlowOutput     resb 1                  ; Outputs to assert for serial flow
 FlowInput      resb 1                  ; Input bits for serial flow
+FlowIgnore     resb 1                  ; Ignore input unless these bits set
 RetryCount      resb 1                 ; Used for disk access retries
 KbdFlags       resb 1                  ; Check for keyboard escapes
 LoadFlags      resb 1                  ; Loadflags from kernel
@@ -1012,8 +1013,11 @@ pc_serial:       call getint                     ; "serial" command
                call ungetc
                call getint                     ; Hardware flow control?
                jnc .valid_flow
-               xor bl,bl                       ; Default -> no flow control
+               xor bx,bx                       ; Default -> no flow control
 .valid_flow:
+               and bh,0Fh                      ; FlowIgnore
+               shl bh,4
+               mov [FlowIgnore],bh
                mov bh,bl
                and bx,0F003h                   ; Valid bits
                mov [FlowControl],bx
@@ -1052,8 +1056,7 @@ pc_serial:        call getint                     ; "serial" command
 
                add dx,byte 3                   ; DX -> MCR
                in al,dx
-               mov ah,[FlowOutput]             ; DTR and RTS control
-               or al,ah                        ; Assert bits
+               or al,[FlowOutput]              ; Assert bits
                call slow_out
 
                ; Show some life
@@ -3516,6 +3519,14 @@ pollchar:
                add dx,byte 5           ; DX -> LSR
                in al,dx
                test al,1               ; ZF = 0 if data pending
+               jz .done
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]     ; Required status bits
+               in al,dx
+               and al,ah
+               cmp al,ah
+               setne al
+               dec al                  ; Set ZF = 0 if equal
 .done:         popad
                ret
 
@@ -3529,10 +3540,16 @@ getchar:
                mov bx,[SerialPort]
                and bx,bx
                jz .again
-               lea dx,[bx+5]           ; Serial status register
+               lea dx,[bx+5]           ; DX -> LSR
                in al,dx
                test al,1
                jz .again
+               inc dx                  ; DX -> MSR
+               mov ah,[FlowIgnore]
+               in al,dx
+               and al,ah
+               cmp al,ah
+               jne .again
 .serial:       xor ah,ah               ; Avoid confusion
                xchg dx,bx              ; Data port
                in al,dx
index ce6c023..ffa3884 100644 (file)
@@ -209,23 +209,28 @@ SERIAL port [[baudrate] flowcontrol]
        bits, no parity, 1 stop bit.
 
        "flowcontrol" is a combination of the following bits:
-         1 - Assert DTR
-         2 - Assert RTS
-        16 - Wait for CTS assertion
-        32 - Wait for DSR assertion
-        64 - Wait for RI assertion
-       128 - Wait for DCD assertion
+       0x001 - Assert DTR
+       0x002 - Assert RTS
+       0x010 - Wait for CTS assertion
+       0x020 - Wait for DSR assertion
+       0x040 - Wait for RI assertion
+       0x080 - Wait for DCD assertion
+       0x100 - Ignore input unless CTS asserted
+       0x200 - Ignore input unless DSR asserted
+       0x400 - Ignore input unless RI asserted
+       0x800 - Ignore input unless DCD asserted
+
+       All other bits are reserved.
 
        Typical values are:
 
-         0 - No flow control (default)
-        19 - RTS/CTS flow control
-        35 - DTR/DSR flow control
-       131 - DTR/DCD flow control
+           0 - No flow control (default)
+       0x013 - RTS/CTS flow control
+       0x813 - RTS/CTS flow control, modem input
+       0x023 - DTR/DSR flow control
+       0x083 - DTR/DCD flow control
 
-       All other values are reserved.
-
-       For this directive to be guaranteed to work properly, it
+       For the SERIAL directive to be guaranteed to work properly, it
        should be the first directive in the configuration file.
 
 FONT filename