amacros.inc
Warning: This file has been marked up for HTML
;***********************************************************************
; $name: Amacros.inc
; $version: 4
; $date_modified: 121898
; $description:C NE3200 Header file for macros
; $owner: ODI LAN Driver Manager
; Copyright (c) 1996, 1997, 1998 Novell, Inc. All Rights Reserved.
;
; THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
; USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT
; ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK.
; PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A
; ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS
; PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET,
; DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S
; PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S
; CUSTOMERS WITH RESPECT TO THIS CODE.
;***********************************************************************
;
; Title: C NE3200 Header file for macros
;
; Filename: amacros.inc
;
; ODI Spec Ver: 1.11
;
; Description: structures and equates used by firmware
;
; Modification History:
;
; ??-??-?? ??? ? (this is the format please replace with first entry)
;
;***********************************************************************/
; On Entry: SI -> 7 byte Host Count/Direction/Address.
; DI -> local address.
BMICTransfer macro
local WaitForTransferToHost
mov dx, BMIC_INDEX ; Set index to Transfer
mov al, CH1_TBI_BASE_ADDR OR AUTO_INC ; Buffer Interface channel 0.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data port.
mov ax, di ; AX -> Source.
shr ax, 1 ; AX = Source Address/2.
out dx, al ; Set Source LSB.
mov al, ah ; AL = Source MSB.
out dx, al ; Set Source MSB.
mov dx, BMIC_INDEX ; Set index to channel 0
mov al, CH1_BASE_COUNT OR AUTO_INC ; Base count.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data port.
mov cx, 7 ; Copy 7 bytes.
rep outsb
mov dx, BMIC_INDEX ; Set index to Channel 0
mov al, CH1_STROBE ; Strobe register.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
out dx, al ; No data required for strobe.
mov dx, BMIC_INDEX ; Set index to Channel 0
mov al, CH1_STATUS ; Status.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
WaitForTransferToHost:
in al, dx ; AL = current status.
test al, TRANSFER_ENABLED OR TRANSFER_IN_PROGRESS
jnz short WaitForTransferToHost
and al, 00000011b ;# Mask out reserved bits.
out dx, al ; Reset Transfer Complete bit.
endm
; On Entry: SI -> 9 byte LocalAddress/Count/Direction/HostAddress.
BMICTransferWithLocal macro
local WaitForTransferComplete
mov dx, BMIC_INDEX ; Set index to Transfer
mov al, CH1_TBI_BASE_ADDR OR AUTO_INC ; Buffer Interface channel 0.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data port.
mov cx, 2 ; Copy 2 bytes.
rep outsb
mov dx, BMIC_INDEX ; Set index to channel 0
mov al, CH1_BASE_COUNT OR AUTO_INC ; Base count.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data port.
mov cx, 7 ; Copy 7 bytes.
rep outsb
mov dx, BMIC_INDEX ; Set index to Channel 0
mov al, CH1_STROBE ; Strobe register.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
out dx, al ; No data required for strobe.
mov dx, BMIC_INDEX ; Set index to Channel 0
mov al, CH1_STATUS ; Status.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
WaitForTransferComplete:
in al, dx ; AL = current status.
test al, TRANSFER_ENABLED OR TRANSFER_IN_PROGRESS
jnz short WaitForTransferComplete
and al, 00000011b ;# Mask out reserved bits.
out dx, al ; Reset Transfer Complete bit.
endm
PeekFromHost macro
local WaitForPeek
mov dx, BMIC_INDEX ; Set index to Peek Poke
mov al, PEEK_POKE_ADDR OR AUTO_INC ; address.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
mov cx, 4 ; Write four bytes.
rep outsb
mov dx, BMIC_INDEX ; Set index to Peek Poke
mov al, PEEK_POKE_CONTROL ; control register.
out dx, al
mov dx, BMIC_DATA ; Set to peek from memory.
mov al, 01011111b
out dx, al
mov dx, BMIC_STATUS ; DX = BMIC Status/Control.
WaitForPeek:
in al, dx ; AL = current status.
test al, PEEK_POKE_PENDING ; Peek in process?
jnz WaitForPeek ; Jump if so.
mov dx, BMIC_INDEX ; Set index to peek/poke
mov al, PEEK_POKE_DATA OR AUTO_INC ; data register.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
mov cx, 4 ; Read four bytes.
rep insb
endm
InterruptTheHost macro
mov dx, BMIC_INDEX ; Set index to EISA Doorbell
mov al, EISA_DOORBELL_STATUS ; interrupt status register.
out dx, al
mov dx, BMIC_DATA ; DX = BMIC Data Port.
mov al, TX_COMPLETE_BIT ; Set interrupt bit.
out dx, al
endm
ResetThe82586 macro
mov dx, 0FFA4h ; Configure to 3 wait states.
mov ax, 003Fh
out dx, ax
mov dx, RESET_PORT ; Reset 82586.
in al, dx
mov dx, 0FFA4h ; Configure to 0 wait states.
mov ax, 0038h
out dx, ax
endm
Attention macro
mov dx, CA_PORT
out dx, al
endm
StatisticsUpdate macro CounterOffset
add word ptr StatisticCounters.&CounterOffset, 1
adc word ptr StatisticCounters.&CounterOffset+2, 0
endm