2.2.0-final
[davej-history.git] / include / net / irda / irda_device.h
blobd8e546bb5adadf9c118da7494f4338af2d0bb94f
1 /*********************************************************************
2 *
3 * Filename: irda_device.h
4 * Version:
5 * Description:
6 * Status: Experimental.
7 * Author: Haris Zukanovic <haris@stud.cs.uit.no>
8 * Created at: Tue Apr 14 12:41:42 1998
9 * Modified at: Mon Jan 18 10:52:10 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
12 * Copyright (c) 1998 Haris Zukanovic, <haris@stud.cs.uit.no>
13 * Copyright (c) 1998 Dag Brattli, <dagb@cs.uit.no>
14 * Copyright (c) 1998 Thomas Davis, <ratbert@radiks.net>,
15 * All Rights Reserved.
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License as
19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version.
22 * Neither Haris Zukanovic nor University of Tromsø admit liability nor
23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge.
26 ********************************************************************/
28 #ifndef IRDA_DEVICE_H
29 #define IRDA_DEVICE_H
31 #include <linux/tty.h>
32 #include <linux/netdevice.h>
34 #include <net/irda/irda.h>
35 #include <net/irda/qos.h>
36 #include <net/irda/irqueue.h>
38 #define SIR_MODE 0x01
39 #define MIR_MODE 0x02
40 #define FIR_MODE 0x04
41 #define IO_PIO 0x08
42 #define IO_DMA 0x10
44 #define IO_XMIT 0x01
45 #define IO_RECV 0x02
47 /* Chip specific info */
48 struct chipio_t {
49 int iobase, iobase2; /* IO base */
50 int io_ext, io_ext2; /* Length of iobase */
51 int irq, irq2; /* Interrupts used */
52 int fifo_size; /* FIFO size */
54 int dma, dma2; /* DMA channel used */
55 int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */
56 int direction; /* Used by some FIR drivers */
58 int baudrate; /* Currently used baudrate */
59 int dongle_id; /* Dongle or transceiver currently used */
62 /* Buffer specific info */
63 struct iobuff_t {
64 int state; /* Receiving state (transmit state not used) */
65 int in_frame; /* True if receiving frame */
67 __u8 *data; /* the buffer */
68 __u8 *head; /* start of data in buffer */
69 __u8 *tail; /* end of data in buffer */
71 int offset; /* Usually data + offset = head */
72 int len; /* currently used bytes in buffer */
73 int truesize; /* total size of the data area */
74 __u16 fcs;
76 int flags; /* Allocation flags (GFP_KERNEL | GFP_DMA ) */
79 /*
80 * This structure contains data that _we_ would have liked to be in the device
81 * structure, but we don't want to mess it up more than it is already. Better
82 * to keep the data in separate structures! This structure abstracts common
83 * stuff from IrDA port implementations.
85 struct irda_device {
86 QUEUE q; /* Must be first */
88 int magic; /* Our magic bullet */
89 char name[16]; /* Name of device "irda0" */
90 char description[32]; /* Something like "irda0 <-> ttyS0" */
92 struct irlap_cb *irlap; /* The link layer we are connected to */
93 struct device netdev; /* Yes! we are some kind of netdevice */
94 struct enet_statistics stats;
96 /* int flags; */
98 void *priv; /* Pointer to low level implementation */
100 struct qos_info qos; /* QoS capabilities for this device */
102 struct chipio_t io;
103 struct iobuff_t tx_buff;
104 struct iobuff_t rx_buff;
106 int media_busy;
108 /* Media busy stuff */
109 struct timer_list media_busy_timer;
110 struct timer_list todo_timer;
112 int (*hard_xmit)( struct sk_buff *skb, struct device *dev);
113 void (*change_speed)( struct irda_device *driver, int baud);
115 int (*is_receiving)(struct irda_device *); /* receiving? */
116 /* int (*is_tbusy)(struct irda_device *); */ /* transmitting? */
117 void (*wait_until_sent)(struct irda_device *);
119 int new_speed; /* Will be removed in future */
122 extern hashbin_t *irda_device;
124 /* Function prototypes */
125 int irda_device_init( void);
126 void irda_device_cleanup( void);
128 int irda_device_open( struct irda_device *, char *name, void *priv);
129 void irda_device_close( struct irda_device *);
131 /* Interface to be uses by IrLAP */
132 inline void irda_device_set_media_busy( struct irda_device *, int status);
133 inline int irda_device_is_media_busy( struct irda_device *);
134 inline int irda_device_is_receiving( struct irda_device *);
135 inline void irda_device_change_speed( struct irda_device *, int);
137 inline struct qos_info *irda_device_get_qos( struct irda_device *self);
138 int irda_device_txqueue_empty( struct irda_device *self);
140 int irda_device_setup( struct device *dev);
142 __inline__ int irda_get_mtt( struct sk_buff *skb);
144 void setup_dma( int channel, char *buffer, int count, int mode);
146 #endif