📄 ri61fca.asm
字号:
; Output: Nothing ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
InitBufferPrfFailSafe proc near private
ret
InitBufferPrfFailSafe endp
;---------------------------------------;
; GetHardwareConfig ;
;---------------------------------------;-------------------------------------;
; This routine determines the current configuration of the peripheral device ;
; by reading directly from its registers. The value returned is an entry ;
; number in the DeviceConfigTable. ;
; ;
; Value Read Value Read Entry # in Config ;
; From CR30 From CR60/CR61 DeviceConfigTable Setting ;
; ------------ ------------ ----------------- -------- ;
; 0 XX / XX 0 Disabled ;
; 1 03 / F8 1 3F8 ;
; 1 02 / F8 2 2F8 ;
; 1 03 / E8 3 3E8 ;
; 1 02 / E8 4 2E8 ;
; ;
; Input: Nothing ;
; Stack available ;
; ;
; Output: AL = Entry number in DeviceConfigTable that represents the current ;
; configuration of the peripheral device. ;
; ;
; Destroys: AX ;
;-----------------------------------------------------------------------------;
GetHardwareConfig proc near private
push bx
mov al, 30h ;Read register CR30
mov bl, 01h ;Select Logical Device 1 (COMA)
call IT8661FReadIO ;AL = Register value
or al, al
jz GetCfgDone ;COMA disabled, done return 0
mov bl, 01h ;Select Logical Device 1 (COMA)
call IT8661FRead6061 ;AX = COMA base address
xor bx, bx
MatchingConfigEntry:
cmp ax, cs:IT8661SerialConfigTable[bx] ;AX = COMA base address
;BX = Index into config table
je ConfigTableEntryFound
add bx, 2 ;Next config entry index
cmp bx, 8
jle MatchingConfigEntry
xor bl, bl ;Invalid config, force to zero
ConfigTableEntryFound:
mov al, bl ;AL = 2 * Entry number in DeviceConfigTable
GetCfgDone:
shr al, 1 ;AL = Entry number in DeviceConfigTable
pop bx
ret
GetHardwareConfig endp
;---------------------------------------;
; SetHardwareConfig ;
;---------------------------------------;-------------------------------------;
; This routine sets the current configuration of the peripheral device by ;
; writing directly to its registers. ;
; ;
; Entry # in Value Written Value Written Value Written Config ;
; DeviceConfigTable To CR30-0 To CR60 To CR61 Setting ;
; ----------------- ------------ ------------ ------------ -------- ;
; 0 0 XX XX Disabled ;
; 1 1 03 F8 3F8 ;
; 2 1 02 F8 2F8 ;
; 3 1 03 E8 3E8 ;
; 4 1 02 E8 2E8 ;
; ;
; Input: AL = Entry number in DeviceConfigTable ;
; Stack available ;
; ;
; Output: Nothing ;
; ;
; Destroys: AX ;
;-----------------------------------------------------------------------------;
SetHardwareConfig proc near private
push bx
push ax
mov bl, 01h ;Select Logical Device 1 (COMA)
mov ax, 0030h ;Disable COMA
call IT8661FWriteIO
mov ax, 0000h ;Clear Addess
call IT8661FWrite6061
mov ax, 0070h ;Clear IRQ
call IT8661FWriteIO
pop ax
movzx bx, al
shl bx, 1 ;BX = Index into translation table
jz SetHwCfgDone ;Br if COMA is to be disabled
mov ax, cs:IT8661SerialConfigTable[bx] ;AX = value to write to register CR60/61
mov bl, 01h ;Select Logical Device 1 (COMA)
call IT8661FWrite6061 ;Write COMA address to register CR60/61
mov ax, (DevNodeDataBlock ptr [si]).ComIrq.ides_irq_mask
bsf ax, ax
mov ah, al
mov al, 70h ;Select IRQ Register
mov bl, 01h ;Select Logical Device 1 (COMA)
call IT8661FWriteIO ;Set H/W IRQ
mov ax, 0130h ;Enable COMA
mov bl, 01h ;Select Logical Device 1 (COMA)
call IT8661FWriteIO
SetHwCfgDone:
pop bx
ret
SetHardwareConfig endp
;---------------------------------------;
; ConfigNumberToNodeData ;
;---------------------------------------;-------------------------------------;
; This routine copies data from the given ConfigTableEntry into the proper ;
; fields in the node's resource descriptors. ;
; ;
; Input: AL = Entry number in DeviceConfigTable ;
; DS:SI = Pointer to buffer containing node structure ;
; Stack available ;
; ;
; Output: Nothing ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
ConfigNumberToNodeData proc near private
push ax
push bx
mov bl, size ConfigTableEntry
mul bl ;AX = <entry # (AL)> * <entry size>
mov bx, offset DeviceConfigTable
add bx, ax ;BX = proper ConfigTableEntry
; Copy fields from the given ConfigTableEntry into the device node
; before it is returned to the caller.
mov ax, (ConfigTableEntry ptr cs:[bx]).PortAddress
mov (DevNodeDataBlock ptr [si]).ComPort.pdes_min_base, ax
mov (DevNodeDataBlock ptr [si]).ComPort.pdes_max_base, ax
mov al, (ConfigTableEntry ptr cs:[bx]).PortSize
mov (DevNodeDataBlock ptr [si]).ComPort.pdes_length, al
mov ax, (ConfigTableEntry ptr cs:[bx]).IrqMask
mov (DevNodeDataBlock ptr [si]).ComIrq.ides_irq_mask, ax
pop bx
pop ax
ret
ConfigNumberToNodeData endp
;---------------------------------------;
; NodeDataToConfigNumber ;
;---------------------------------------;-------------------------------------;
; This routine examines the node data and determines which ConfigTableEntry ;
; corresponds to the current configuration of the node. ;
; ;
; Input: AL = Node number ;
; DS:SI = Pointer to the node data ;
; Stack available ;
; ;
; Output: CF = Clear if a ConfigTableEntry matching the node data was found ;
; Set if no ConfigTableEntry matches the node data (node data ;
; contains an invalid configuration) ;
; AL = Entry number in DeviceConfigTable ;
; ;
; Destroys: BX, CX, DX ;
;-----------------------------------------------------------------------------;
NodeDataToConfigNumber proc near private
mov cx, (offset DeviceConfigTableEnd - offset DeviceConfigTable)/size ConfigTableEntry
mov bx, offset DeviceConfigTable
mov dx, (DevNodeDataBlock ptr [si]).ComPort.pdes_min_base
xor al, al ;AL will count entry number
ConfigNumberNext:
cmp (ConfigTableEntry ptr cs:[bx]).PortAddress, dx
;clc
je ConfigNumberFound ;Br if port found in DeviceConfigTable
add bx, size ConfigTableEntry ;Point to next entry
inc al ;Keep track of which entry we are on
loop ConfigNumberNext ;Try all entries in DeviceConfigTable
stc ;Indicate error, invalid configuration
ConfigNumberFound:
ret
NodeDataToConfigNumber endp
;---------------------------------------;
; DummyReturn ;
;---------------------------------------;-------------------------------------;
; Input: Nothing ;
; ;
; Output: Nothing ;
; ;
; Destroys: Nothing ;
;-----------------------------------------------------------------------------;
DummyReturn proc near private
ret
DummyReturn endp
;*****************************************************************;
;*****************************************************************;
;** **;
;** (C)Copyright 1985-1998, American Megatrends, Inc. **;
;** **;
;** All Rights Reserved. **;
;** **;
;** 6145-F Northbelt Pkwy, Norcross, GA 30071 **;
;** **;
;** Phone (770)-246-8600 **;
;** **;
;*****************************************************************;
;*****************************************************************;
_text ends
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -