1/********************************************************************* 2 * 3 * Filename: timer.h 4 * Version: 5 * Description: 6 * Status: Experimental. 7 * Author: Dag Brattli <dagb@cs.uit.no> 8 * Created at: Sat Aug 16 00:59:29 1997 9 * Modified at: Thu Oct 7 12:25:24 1999 10 * Modified by: Dag Brattli <dagb@cs.uit.no> 11 * 12 * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>, 13 * All Rights Reserved. 14 * Copyright (c) 2000-2001 Jean Tourrilhes <jt@hpl.hp.com> 15 * 16 * This program is free software; you can redistribute it and/or 17 * modify it under the terms of the GNU General Public License as 18 * published by the Free Software Foundation; either version 2 of 19 * the License, or (at your option) any later version. 20 * 21 * Neither Dag Brattli nor University of Troms� admit liability nor 22 * provide warranty for any of this software. This material is 23 * provided "AS-IS" and at no charge. 24 * 25 ********************************************************************/ 26 27#ifndef TIMER_H 28#define TIMER_H 29 30#include <linux/netdevice.h> 31 32#include <asm/param.h> /* for HZ */ 33 34#include <net/irda/irda.h> 35#include <net/irda/irmod.h> 36#include <net/irda/irlap.h> 37#include <net/irda/irlmp.h> 38#include <net/irda/irda_device.h> 39 40/* 41 * Timeout definitions, some defined in IrLAP p. 92 42 */ 43#define POLL_TIMEOUT (450*HZ/1000) /* Must never exceed 500 ms */ 44#define FINAL_TIMEOUT (500*HZ/1000) /* Must never exceed 500 ms */ 45 46/* 47 * Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice 48 * duration of the P-timer. 49 */ 50#define WD_TIMEOUT (POLL_TIMEOUT*2) 51 52#define MEDIABUSY_TIMEOUT (500*HZ/1000) /* 500 msec */ 53#define SMALLBUSY_TIMEOUT (100*HZ/1000) /* 100 msec - IrLAP 6.13.4 */ 54 55/* 56 * Slot timer must never exceed 85 ms, and must always be at least 25 ms, 57 * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of 58 * devices, and other stackes uses a lot more, so it's best we do it as well 59 */ 60#define SLOT_TIMEOUT (90*HZ/1000) 61 62/* 63 * We set the query timeout to 100 ms and then expect the value to be 64 * multiplied with the number of slots to product the actual timeout value 65 */ 66#define QUERY_TIMEOUT (HZ/10) 67 68#define WATCHDOG_TIMEOUT (20*HZ) /* 20 sec */ 69 70typedef void (*TIMER_CALLBACK)(void *); 71 72void irda_start_timer(struct timer_list *ptimer, int timeout, void* data, 73 TIMER_CALLBACK callback); 74 75inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout); 76inline void irlap_start_query_timer(struct irlap_cb *self, int timeout); 77inline void irlap_start_final_timer(struct irlap_cb *self, int timeout); 78inline void irlap_start_wd_timer(struct irlap_cb *self, int timeout); 79inline void irlap_start_backoff_timer(struct irlap_cb *self, int timeout); 80 81void irlap_start_mbusy_timer(struct irlap_cb *self, int timeout); 82void irlap_stop_mbusy_timer(struct irlap_cb *); 83 84struct lsap_cb; 85struct lap_cb; 86inline void irlmp_start_watchdog_timer(struct lsap_cb *, int timeout); 87inline void irlmp_start_discovery_timer(struct irlmp_cb *, int timeout); 88inline void irlmp_start_idle_timer(struct lap_cb *, int timeout); 89inline void irlmp_stop_idle_timer(struct lap_cb *self); 90 91#endif 92 93