amacros.inc

Warning: This file has been marked up for HTML

;*****************************************************************************
; AMACROS.INC
;
; 5 May 1995 10:32   DGM
;   Removed code pertaining to conditionals AdapterProcessesRx,
;   AdapterProcessesTx, CatchIncomplete, Channel0, AddPolling, 
;   TxQueue and BusMaster, and left code with the setting according 
;   to those conditionals at this point in time, ie. clean-up.
;
;*****************************************************************************

; 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