Changeset 233 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS/Src/Device/Serial
- Timestamp:
- Feb 4, 2012, 6:21:22 PM (13 years ago)
- google:author:
- gregli@hotmail.com
- Location:
- trunk/XTIDE_Universal_BIOS/Src/Device/Serial
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm
r226 r233 17 17 ; 18 18 ; Values for UART_divisorLow: 19 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 3 = 38400, 2 = 57600, 1 = 11520019 ; 60h = 1200, 30h = 2400, 18h = 4800, 0ch = 9600, 6 = 19200, 4 = 28800, 3 = 38400, 2 = 57600, 1 = 115200 20 20 ; 21 21 SerialCommand_UART_divisorLow EQU 0 22 23 ;24 ; We support 4 baud rates, starting here going higher and skipping every other baud rate25 ; Starting with 30h, that means 30h (1200 baud), 0ch (9600 baud), 3 (38400 baud), and 1 (115200 baud)26 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level27 ;28 SerialCommand_UART_divisorLow_startingBaud EQU 030h29 30 SerialCommand_UART_interruptEnable EQU 131 22 32 23 ; … … 91 82 mov [bp+IDEPACK.bFeatures],ah ; store protocol command 92 83 93 mov d l, byte [di+DPT_SERIAL.bSerialPortAndBaud]84 mov dx, [di+DPT_SERIAL.wSerialPortAndBaud] 94 85 95 86 ; fall-through 96 87 97 88 ;-------------------------------------------------------------------- 98 ; SerialCommand_OutputWithParameters_DeviceInD L89 ; SerialCommand_OutputWithParameters_DeviceInDX 99 90 ; Parameters: 100 91 ; AH: Protocol Command 101 ; D L: Packed I/O port and baud rate92 ; DX: Packed I/O port and baud rate 102 93 ; ES:SI: Ptr to buffer (for data transfer commands) 103 94 ; SS:BP: Ptr to IDEREGS_AND_INTPACK … … 108 99 ; AL, BX, CX, DX, (ES:SI for data transfer commands) 109 100 ;-------------------------------------------------------------------- 110 SerialCommand_OutputWithParameters_DeviceInD L:101 SerialCommand_OutputWithParameters_DeviceInDX: 111 102 112 103 push si … … 116 107 ; 117 108 ; Unpack I/O port and baud from DPT 118 ; Port to DX more or less for the remainder of the routine109 ; Port to DX for the remainder of the routine (+/- different register offsets) 119 110 ; Baud in CH until UART initialization is complete 120 111 ; 121 mov dh, ((DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT & 0f00h) >> (8+1)) 122 shl dx, 1 ; port offset already x4, needs one more shift to be x8 123 mov cl, dl 124 125 and cl, (DEVICE_SERIAL_PACKEDPORTANDBAUD_BAUDMASK << 1) 126 mov ch, SerialCommand_UART_divisorLow_startingBaud 127 shr ch, cl 128 adc ch, 0 129 130 and dl, ((DEVICE_SERIAL_PACKEDPORTANDBAUD_PORTMASK << 1) & 0ffh) 131 add dx, byte (DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT & 0ffh) 132 112 mov ch,dh 113 xor dh,dh 114 eSHL_IM dx, 2 ; shift from one byte to two 115 133 116 mov al,[bp+IDEPACK.bSectorCount] 134 117 … … 414 397 ; taken care of this, but I have seen cases where this is not true. 415 398 ; 399 xor cx,cx ; timeout this clearing routine, in case the UART isn't there 416 400 .clearBuffer: 417 401 mov dl,bh … … 420 404 test al,08fh 421 405 jz .clearBufferComplete 422 shral,1406 test al,1 423 407 in al,dx 424 jc .clearBuffer ; note CF from shrabove408 loopnz .clearBuffer ; note ZF from test above 425 409 426 410 .clearBufferComplete: … … 641 625 ; master scan. 642 626 ; 643 mov dl,[cs:bp+IDEVARS.bSerialPackedPortAndBaud] 644 mov al, byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial] 627 mov cx,1 ; 1 sector to move, 0 for non-scan 628 mov dx,[cs:bp+IDEVARS.wSerialPortAndBaud] 629 xor ax,ax 630 push si 631 call FindDPT_ToDSDIforSerialDevice 632 pop si 633 jnc .notfounddpt 634 mov ax,[ds:di+DPT_SERIAL.wSerialPortAndBaud] 635 .notfounddpt: 645 636 646 637 test bh, FLG_DRVNHEAD_DRV 647 638 jz .master 648 639 649 test a l,al; Take care of the case that is different between master and slave.640 test ax,ax ; Take care of the case that is different between master and slave. 650 641 jz .error ; Because we do this here, the jz after the "or" below will not be taken 651 642 652 643 ; fall-through 653 644 .master: 654 test d l,dl655 jnz .identifyDeviceInD L656 657 or d l,al; Move bLast into position in dl, as well as test for zero645 test dx,dx 646 jnz .identifyDeviceInDX 647 648 or dx,ax ; Move bLast into position in dl, as well as test for zero 658 649 jz .scanSerial 659 650 660 651 ; fall-through 661 .identifyDeviceInD L:652 .identifyDeviceInDX: 662 653 663 654 push bp ; setup fake IDEREGS_AND_INTPACK … … 665 656 push dx 666 657 667 mov cl,1 ; 1 sector to move668 658 push cx 669 659 … … 674 664 675 665 mov bp,sp 676 call SerialCommand_OutputWithParameters_DeviceInD L666 call SerialCommand_OutputWithParameters_DeviceInDX 677 667 678 668 pop bx … … 680 670 pop cx 681 671 pop dx 682 672 683 673 pop bp 684 674 ; 685 675 ; place packed port/baud in RAMVARS, read by FinalizeDPT and DetectDrives 686 676 ; 687 ; Note that this will be set during an int13h/25h call as well. Which is OK since it is only used (at the 688 ; top of this routine) for drives found during a COM scan, and we only COM scan if there were no other 689 ; COM drives found. So we will only reaffirm the port/baud for the one COM port/baud that has a drive. 690 ; 691 jc .notFound ; only store bLastSerial if success 692 mov byte [RAMVARS.xlateVars+XLATEVARS.bLastSerial], dl 677 mov [es:si+ATA6.wVendor],dx 693 678 694 679 .notFound: … … 714 699 .scanSerial: 715 700 mov di,.scanPortAddresses-1 701 mov ch,1 ; tell server that we are scanning 716 702 717 703 .nextPort: … … 741 727 742 728 ; 743 ; Pack into dl, baud rate starts at 0 744 ; 745 add dx,-(DEVICE_SERIAL_PACKEDPORTANDBAUD_STARTINGPORT) 746 shr dx,1 ; dh is zero at this point, and will be sent to the server, 747 ; so we know this is an auto detect 748 749 jmp .testFirstBaud 750 751 ; 752 ; Walk through 4 possible baud rates 753 ; 729 ; Begin baud rate scan on this port... 730 ; 731 ; On a scan, we support 6 baud rates, starting here and going higher by a factor of two each step, with a 732 ; small jump between 9600 and 38800. These 6 were selected since we wanted to support 9600 baud and 115200, 733 ; *on the server side* if the client side had a 4x clock multiplier, a 2x clock multiplier, or no clock multiplier. 734 ; 735 ; Starting with 30h, that means 30h (2400 baud), 18h (4800 baud), 0ch (9600 baud), and 736 ; 04h (28800 baud), 02h (57600 baud), 01h (115200 baud) 737 ; 738 ; Note: hardware baud multipliers (2x, 4x) will impact the final baud rate and are not known at this level 739 ; 740 mov dh,030h * 2 ; multiply by 2 since we are about to divide by 2 741 mov dl,[cs:di] ; restore single byte port address for scan 742 754 743 .nextBaud: 755 inc dx 756 test dl,3 744 shr dh,1 757 745 jz .nextPort 758 759 .testFirstBaud: 760 call .identifyDeviceInDL 746 cmp dh,6 ; skip from 6 to 4, to move from the top of the 9600 baud range 747 jnz .testBaud ; to the bottom of the 115200 baud range 748 mov dh,4 749 750 .testBaud: 751 call .identifyDeviceInDX 761 752 jc .nextBaud 762 753 -
trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialDPT.asm
r226 r233 17 17 SerialDPT_Finalize: 18 18 or byte [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE 19 mov a l, [RAMVARS.xlateVars+XLATEVARS.bLastSerial]20 mov byte [di+DPT_SERIAL.bSerialPortAndBaud], al19 mov ax, [es:si+ATA6.wVendor] 20 mov word [di+DPT_SERIAL.wSerialPortAndBaud], ax 21 21 ret 22 22
Note:
See TracChangeset
for help on using the changeset viewer.