Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

include/net/irda/timer.h

Go to the documentation of this file.
00001 /*********************************************************************
00002  *                
00003  * Filename:      timer.h
00004  * Version:       
00005  * Description:   
00006  * Status:        Experimental.
00007  * Author:        Dag Brattli <dagb@cs.uit.no>
00008  * Created at:    Sat Aug 16 00:59:29 1997
00009  * Modified at:   Thu Oct  7 12:25:24 1999
00010  * Modified by:   Dag Brattli <dagb@cs.uit.no>
00011  * 
00012  *     Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>, 
00013  *     All Rights Reserved.
00014  *     
00015  *     This program is free software; you can redistribute it and/or 
00016  *     modify it under the terms of the GNU General Public License as 
00017  *     published by the Free Software Foundation; either version 2 of 
00018  *     the License, or (at your option) any later version.
00019  *
00020  *     Neither Dag Brattli nor University of Tromsų admit liability nor
00021  *     provide warranty for any of this software. This material is 
00022  *     provided "AS-IS" and at no charge.
00023  *
00024  ********************************************************************/
00025 
00026 #ifndef TIMER_H
00027 #define TIMER_H
00028 
00029 #include <linux/netdevice.h>
00030 
00031 #include <asm/param.h>  /* for HZ */
00032 
00033 #include <net/irda/irda.h>
00034 #include <net/irda/irmod.h>
00035 #include <net/irda/irlap.h>
00036 #include <net/irda/irlmp.h>
00037 #include <net/irda/irda_device.h>
00038 
00039 /* 
00040  *  Timeout definitions, some defined in IrLAP p. 92
00041  */
00042 #define POLL_TIMEOUT        (450*HZ/1000)    /* Must never exceed 500 ms */
00043 #define FINAL_TIMEOUT       (500*HZ/1000)    /* Must never exceed 500 ms */
00044 
00045 /* 
00046  *  Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice 
00047  *  duration of the P-timer.
00048  */
00049 #define WD_TIMEOUT          (POLL_TIMEOUT*2)
00050 #define MEDIABUSY_TIMEOUT   (500*HZ/1000)    /* 500 msec */
00051 
00052 /*
00053  *  Slot timer must never exceed 85 ms, and must always be at least 25 ms, 
00054  *  suggested to  75-85 msec by IrDA lite. This doesn't work with a lot of
00055  *  devices, and other stackes uses a lot more, so it's best we do it as well
00056  */
00057 #define SLOT_TIMEOUT            (90*HZ/1000)
00058 
00059 /* 
00060  *  We set the query timeout to 100 ms and then expect the value to be 
00061  *  multiplied with the number of slots to product the actual timeout value
00062  */
00063 #define QUERY_TIMEOUT           (HZ/10)       
00064 
00065 #define WATCHDOG_TIMEOUT        (20*HZ)       /* 20 sec */
00066 
00067 typedef void (*TIMER_CALLBACK)(void *);
00068 
00069 void irda_start_timer(struct timer_list *ptimer, int timeout, void* data,
00070                       TIMER_CALLBACK callback);
00071 
00072 inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout);
00073 inline void irlap_start_query_timer(struct irlap_cb *self, int timeout);
00074 inline void irlap_start_final_timer(struct irlap_cb *self, int timeout);
00075 inline void irlap_start_wd_timer(struct irlap_cb *self, int timeout);
00076 inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout);
00077 
00078 void irlap_start_mbusy_timer(struct irlap_cb *);
00079 
00080 struct lsap_cb;
00081 struct lap_cb;
00082 inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout);
00083 inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout);
00084 inline void irlmp_start_idle_timer(struct lap_cb *, int timeout);
00085 
00086 #endif
00087