home *** CD-ROM | disk | FTP | other *** search
- page 60,132
-
- ;
- ; The Greenleaf Comm Library
- ;
- ; Copyright (C) 1984-90 Greenleaf Software Inc. All Rights Reserved.
- ;
-
-
- ;/*
- ; * MODIFICATIONS
- ; * "" 06-MAY-1986 01:10:42.28
- ; * Modified shutdown 8259 sequence to correctly restore state
- ; * of interrupt enable bit to pre-asifirst() state.
- ; * Code changed is bracketed with "Start [06-May-86] Modification" and
- ; * "End [06-May-86] Modification"
- ; */
-
- include model.h
- include prologue.h
- include asiports.equ
-
- pseg _asiquit
-
- ;==>-- void _asiquit(latch,p)
- ; int latch;
- ; struct PORT_TABLE *p;
- ;
- cproc _asiquit
- push ds
- push es
- if _LDATA
- lds bx,parm2_
- else
- mov bx,parm2_
- endif
- mov ax,ds
- mov es,ax ;es=ds
- mov cx,[bx+base_8250] ;
- mov dx,INTER ;shut down 8250 interrupts
- add dx,cx
- xor al,al
- out dx,al
- KILL_TIME
- mov al,DLAB ;set baud rate first
- mov dx,LCREG
- add dx,cx
- out dx,al
- KILL_TIME
- mov ax,[bx+p_8250ldl] ;get least significant baud rate
- mov dx,cx
- out dx,al ;set least significant baud rate
- KILL_TIME
- mov ax,[bx+p_8250mdl] ;get most significant baud rate
- inc dx
- out dx,al ;and set in 8250
- KILL_TIME
- mov ax,[bx+p_8250lcr] ;read line control register
- mov dx,LCREG
- add dx,cx
- out dx,al
- KILL_TIME
- mov ax,[bx+p_8250mcr] ;read modem control register
- mov dx,MCREG
- add dx,cx
- out dx,al
- KILL_TIME
- test byte ptr parm1_,1
- jz no8259
- mov ax,[bx+intrpt_num]
- or al,al ;see if we have one
- jz novect
- push ds
- lds dx,[bx+p_vector] ;get previous one
- mov ah,25h ;set interrupt vector function
- int 21h
- pop ds
- novect: mov cx,[bx+irq_8259] ;reset 8259 to previous condition
- or cx,cx ;check for 0
- jz no8259
- mov ax,1 ;Start [06-May-86] Modification
- shl al,cl
- mov cx,ax ;cx=mask for bit in 8259
- mov dx,[bx+port_8259] ;i/o address for 8259
- inc dx
- in al,dx
- KILL_TIME
- or al,cl ;assume previously disabled
- test [bx+p_8259],cx ;check assumption
- jnz rs8259 ;jump if assumption correct
- xor al,cl ;else reverse assumption
- rs8259: out dx,al ;restore 8259 to previous state
- KILL_TIME
- ;End [06-May-86] Modification
-
- no8259: mov ax,[bx+p_8250ier] ;now enable 8250 interrupt register
- mov dx,[bx+base_8250]
- add dx,INTER
- out dx,al
- KILL_TIME
- xor ax,ax
- pop es
- pop ds
- cproce
-
-
-
- endps
- end
-