source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Device/Device.asm@ 175

Last change on this file since 175 was 175, checked in by gregli@…, 13 years ago

ifdef of existing serial code, in preperation for checkin

File size: 3.8 KB
RevLine 
[150]1; Project name : XTIDE Universal BIOS
2; Description : Command and port direction functions for different device types.
3
4; Section containing code
5SECTION .text
6
7;--------------------------------------------------------------------
8; Device_FinalizeDPT
9; Parameters:
10; DS:DI: Ptr to Disk Parameter Table
11; ES:SI: Ptr to 512-byte ATA information read from the drive
[160]12; CS:BP: Ptr to IDEVARS for the controller
[150]13; Returns:
14; Nothing
15; Corrupts registers:
16; AX, BX, CX, DX
17;--------------------------------------------------------------------
18Device_FinalizeDPT:
[175]19%ifdef MODULE_SERIAL
[158]20 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[175]21 jnz SHORT .FinalizeDptForSerialPortDevice
22%endif
[150]23 jmp IdeDPT_Finalize
[175]24%ifdef MODULE_SERIAL
25.FinalizeDptForSerialPortDevice:
26 jmp SerialDPT_Finalize
27%endif
[150]28
29;--------------------------------------------------------------------
30; Device_ResetMasterAndSlaveController
31; Parameters:
32; DS:DI: Ptr to DPT (in RAMVARS segment)
33; Returns:
34; AH: INT 13h Error Code
35; CF: Cleared if success, Set if error
36; Corrupts registers:
37; AL, BX, CX, DX
38;--------------------------------------------------------------------
39Device_ResetMasterAndSlaveController:
[175]40%ifdef MODULE_SERIAL
[158]41 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]42 jnz SHORT ReturnSuccessForSerialPort
[175]43%endif
[150]44 jmp IdeCommand_ResetMasterAndSlaveController
45
46
47;--------------------------------------------------------------------
48; Device_IdentifyToBufferInESSIwithDriveSelectByteInBH
49; Parameters:
50; BH: Drive Select byte for Drive and Head Select Register
51; DS: Segment to RAMVARS
52; ES:SI: Ptr to buffer to receive 512-byte IDE Information
53; CS:BP: Ptr to IDEVARS
54; Returns:
55; AH: INT 13h Error Code
56; CF: Cleared if success, Set if error
57; Corrupts registers:
58; AL, BL, CX, DX, SI, DI, ES
59;--------------------------------------------------------------------
60Device_IdentifyToBufferInESSIwithDriveSelectByteInBH:
[175]61%ifdef MODULE_SERIAL
[150]62 cmp BYTE [cs:bp+IDEVARS.bDevice], DEVICE_SERIAL_PORT
63 je SHORT .IdentifyDriveFromSerialPort
[175]64%endif
[150]65 jmp IdeCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
[175]66%ifdef MODULE_SERIAL
[150]67.IdentifyDriveFromSerialPort:
68 jmp SerialCommand_IdentifyDeviceToBufferInESSIwithDriveSelectByteInBH
[175]69%endif
[150]70
71;--------------------------------------------------------------------
72; Device_OutputCommandWithParameters
73; Parameters:
74; BH: Default system timer ticks for timeout (can be ignored)
75; BL: IDE Status Register bit to poll after command
76; ES:SI: Ptr to buffer (for data transfer commands)
77; DS:DI: Ptr to DPT (in RAMVARS segment)
78; SS:BP: Ptr to IDEPACK
79; Returns:
80; AH: INT 13h Error Code
81; CF: Cleared if success, Set if error
82; Corrupts registers:
83; AL, BX, CX, DX, (ES:SI for data transfer commands)
84;--------------------------------------------------------------------
85ALIGN JUMP_ALIGN
86Device_OutputCommandWithParameters:
[175]87%ifdef MODULE_SERIAL
[158]88 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]89 jnz SHORT .OutputCommandToSerialPort
[175]90%endif
[150]91 jmp IdeCommand_OutputWithParameters
[175]92%ifdef MODULE_SERIAL
[150]93ALIGN JUMP_ALIGN
94.OutputCommandToSerialPort:
95 jmp SerialCommand_OutputWithParameters
[175]96%endif
[150]97
98;--------------------------------------------------------------------
99; Device_SelectDrive
100; Parameters:
101; DS:DI: Ptr to DPT (in RAMVARS segment)
102; SS:BP: Ptr to IDEPACK
103; Returns:
104; AH: INT 13h Error Code
105; CF: Cleared if success, Set if error
106; Corrupts registers:
107; AL, BX, CX, DX
108;--------------------------------------------------------------------
109ALIGN JUMP_ALIGN
110Device_SelectDrive:
[175]111%ifdef MODULE_SERIAL
[158]112 test BYTE [di+DPT.bFlagsHigh], FLGH_DPT_SERIAL_DEVICE
[150]113 jnz SHORT ReturnSuccessForSerialPort
[175]114%endif
[150]115 jmp IdeCommand_SelectDrive
[175]116%ifdef MODULE_SERIAL
[150]117ReturnSuccessForSerialPort:
118 xor ax, ax
119 ret
[175]120%endif
Note: See TracBrowser for help on using the repository browser.