Import 2.3.10pre5
[davej-history.git] / drivers / net / irda / esi.c
blob930abe63e9983813ce6bba5ec60137ecd9307b28
1 /*********************************************************************
2 *
3 * Filename: esi.c
4 * Version: 1.4
5 * Description: Driver for the Extended Systems JetEye PC dongle
6 * Status: Experimental.
7 * Author: Thomas Davis, <ratbert@radiks.net>
8 * Created at: Sat Feb 21 18:54:38 1998
9 * Modified at: Sun May 16 14:35:21 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Sources: esi.c
13 * Copyright (c) 1998-1999, 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 * I, Thomas Davis, provide no warranty for any of this software.
23 * This material is provided "AS-IS" and at no charge.
25 ********************************************************************/
27 #include <linux/module.h>
29 #include <linux/delay.h>
30 #include <linux/tty.h>
31 #include <linux/sched.h>
32 #include <linux/init.h>
34 #include <net/irda/irda.h>
35 #include <net/irda/irmod.h>
36 #include <net/irda/irda_device.h>
37 #include <net/irda/irtty.h>
38 #include <net/irda/dongle.h>
40 static void esi_open(struct irda_device *idev, int type);
41 static void esi_close(struct irda_device *driver);
42 static void esi_change_speed(struct irda_device *idev, int baud);
43 static void esi_reset(struct irda_device *idev);
44 static void esi_qos_init(struct irda_device *idev, struct qos_info *qos);
46 static struct dongle dongle = {
47 ESI_DONGLE,
48 esi_open,
49 esi_close,
50 esi_reset,
51 esi_change_speed,
52 esi_qos_init,
55 int __init esi_init(void)
57 return irda_device_register_dongle(&dongle);
60 void esi_cleanup(void)
62 irda_device_unregister_dongle(&dongle);
65 static void esi_open(struct irda_device *idev, int type)
67 strcat(idev->description, " <-> esi");
69 idev->io.dongle_id = type;
70 idev->flags |= IFF_DONGLE;
72 MOD_INC_USE_COUNT;
75 static void esi_close(struct irda_device *idev)
77 /* Power off dongle */
78 irda_device_set_dtr_rts(idev, FALSE, FALSE);
80 MOD_DEC_USE_COUNT;
84 * Function esi_change_speed (tty, baud)
86 * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
89 static void esi_change_speed(struct irda_device *idev, int baud)
91 int dtr, rts;
93 ASSERT(idev != NULL, return;);
94 ASSERT(idev->magic == IRDA_DEVICE_MAGIC, return;);
96 switch (baud) {
97 case 19200:
98 dtr = TRUE;
99 rts = FALSE;
100 break;
101 case 115200:
102 dtr = rts = TRUE;
103 break;
104 case 9600:
105 default:
106 dtr = FALSE;
107 rts = TRUE;
108 break;
111 /* Change speed of dongle */
112 irda_device_set_dtr_rts(idev, dtr, rts);
115 static void esi_reset( struct irda_device *idev)
117 /* Empty */
121 * Function esi_qos_init (qos)
123 * Init QoS capabilities for the dongle
126 static void esi_qos_init(struct irda_device *idev, struct qos_info *qos)
128 qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
129 qos->min_turn_time.bits &= 0x01; /* Needs at least 10 ms */
132 #ifdef MODULE
134 MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
135 MODULE_DESCRIPTION("Extended Systems JetEye PC dongle driver");
138 * Function init_module (void)
140 * Initialize ESI module
143 int init_module(void)
145 return esi_init();
149 * Function cleanup_module (void)
151 * Cleanup ESI module
154 void cleanup_module(void)
156 esi_cleanup();
159 #endif