* Copyright (c) University of British Columbia, 1984
* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* the Laboratory for Computation Vision and the Computer Science Department
* of the University of British Columbia.
* %sccs.include.redist.c%
* @(#)hd_timer.c 7.4 (Berkeley) %G%
* these can be patched with adb if the
* default values are inappropriate
* This routine is called every 500ms by the kernel. Decrement timer by this
* amount - if expired then process the event.
register struct hdcb
*hdp
;
register int s
= splimp ();
for (hdp
= hdcbhead
; hdp
; hdp
= hdp
->hd_next
) {
if (hdp
->hd_rrtimer
&& (--hdp
->hd_rrtimer
== 0)) {
if (hdp
->hd_lasttxnr
!= hdp
->hd_vr
)
hd_writeinternal (hdp
, RR
, POLLOFF
);
if (!(hdp
->hd_timer
&& --hdp
->hd_timer
== 0))
hd_writeinternal (hdp
, DISC
, POLLON
);
if (hdp
->hd_lastrxnr
!= hdp
->hd_vs
) { /* XXX */
hd_writeinternal (hdp
, FRMR
, POLLOFF
);
if (++hdp
->hd_retxcnt
== hd_n2
) {
hd_writeinternal (hdp
, SABM
, POLLOFF
);
if (++hdp
->hd_retxcnt
== hd_n2
) {
/* Notify the packet level. */
(void) pk_ctlinput (PRC_LINKDOWN
, hdp
->hd_pkp
);
hdp
->hd_state
= SABM_SENT
;
hd_writeinternal (hdp
, SABM
, POLLOFF
);
hd_writeinternal (hdp
, DM
, POLLOFF
);
if (++hdp
->hd_retxcnt
== hd_n2
) {
hd_writeinternal (hdp
, DM
, POLLOFF
);
hd_writeinternal (hdp
, SABM
, POLLOFF
);
/* Do this indefinitely. */
hd_writeinternal (hdp
, SABM
, POLLON
);
* Poll the interface driver flags waiting
* for the IFF_UP bit to come on.
if (hdp
->hd_ifp
->if_flags
& IFF_UP
)