Changeset 601 in xtideuniversalbios for trunk/Assembly_Library/Src/Serial/SerialServerScan.asm
- Timestamp:
- Feb 14, 2019, 7:38:08 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Src/Serial/SerialServerScan.asm
r589 r601 1 1 ; Project name : Assembly Library 2 2 ; Description : Serial Server Support, Scan for Server 3 3 4 ; 4 5 ; This functionality is broken out from SerialServer as it may only be needed during … … 43 44 ;-------------------------------------------------------------------- 44 45 SerialServerScan_ScanForServer: 45 46 mov cx, 1 ; one sector, not scanning (default) 46 47 47 48 48 test dx, dx 49 jnz SHORT SerialServerScan_CheckForServer_PortAndBaudInDX 49 50 50 51 51 mov di, .scanPortAddresses-1 52 mov ch, 1 ; tell server that we are scanning 52 53 53 54 .nextPort: 54 55 56 57 58 55 inc di ; load next port address 56 mov dh, 40h ; Clear DH and make sure CF is set if error 57 mov dl, [cs:di] 58 eSHL_IM dx, 2 ; shift from one byte to two 59 jz SHORT .error 59 60 60 61 ; 61 62 ; Test for COM port presence, write to and read from registers 62 63 ; 63 64 65 66 67 68 69 70 64 push dx 65 add dl, Serial_UART_lineControl 66 mov al, 9Ah 67 out dx, al 68 in al, dx 69 pop dx 70 cmp al, 9Ah 71 jne SHORT .nextPort 71 72 72 73 74 75 76 73 mov al, 0Ch 74 out dx, al 75 in al, dx 76 cmp al, 0Ch 77 jne SHORT .nextPort 77 78 78 79 ; … … 88 89 ; Note: hardware baud multipliers (2x, 4x, 8x) will impact the final baud rate and are not known at this level 89 90 ; 90 91 91 mov dh, 30h * 2 ; multiply by 2 since we are about to divide by 2 92 mov dl, [cs:di] ; restore single byte port address for scan 92 93 93 94 .nextBaud: 94 95 96 97 98 95 shr dh, 1 96 jz SHORT .nextPort 97 cmp dh, 6 ; skip from 6 to 4, to move from the top of the 9600 baud range 98 jne SHORT .testBaud ; to the bottom of the 115200 baud range 99 mov dh, 4 99 100 100 101 .testBaud: 101 102 102 call SerialServerScan_CheckForServer_PortAndBaudInDX 103 jc SHORT .nextBaud 103 104 104 105 .error: 105 106 ret 106 107 107 .scanPortAddresses: db SERIAL_COM7_IOADDRESS >> 2 108 db SERIAL_COM6_IOADDRESS >> 2 109 db SERIAL_COM5_IOADDRESS >> 2 110 db SERIAL_COM4_IOADDRESS >> 2 111 db SERIAL_COM3_IOADDRESS >> 2 112 db SERIAL_COM2_IOADDRESS >> 2 113 db SERIAL_COM1_IOADDRESS >> 2 114 db 0 108 .scanPortAddresses: 109 db SERIAL_COM7_IOADDRESS >> 2 110 db SERIAL_COM6_IOADDRESS >> 2 111 db SERIAL_COM5_IOADDRESS >> 2 112 db SERIAL_COM4_IOADDRESS >> 2 113 db SERIAL_COM3_IOADDRESS >> 2 114 db SERIAL_COM2_IOADDRESS >> 2 115 db SERIAL_COM1_IOADDRESS >> 2 116 db 0 115 117 116 118 … … 133 135 ;-------------------------------------------------------------------- 134 136 SerialServerScan_CheckForServer_PortAndBaudInDX: 135 136 137 138 139 140 137 push bp ; setup fake SerialServer_Command 138 push dx ; send port baud and rate, returned in inquire packet 139 ; (and possibly returned in the drive identification string) 140 push cx ; send number of sectors, and if it is on a scan or not 141 mov bl, SerialServer_Command_Inquire ; protocol command onto stack with bh 142 push bx 141 143 142 143 144 mov bp, sp 145 call SerialServer_SendReceive 144 146 145 146 147 148 147 pop bx 148 pop cx 149 pop dx 150 pop bp 149 151 150 152 ret 151 153
Note:
See TracChangeset
for help on using the changeset viewer.