1 /*********************************************************************
2 *
3 * Filename: irmod.h
4 * Version: 0.3
5 * Description: IrDA module and utilities functions
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Mon Dec 15 13:58:52 1997
9 * Modified at: Fri Jan 28 13:15:24 2000
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 *
12 * Copyright (c) 1998-2000 Dag Brattli, All Rights Reserved.
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
18 *
19 * Neither Dag Brattli nor University of Tromsų admit liability nor
20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charg.
22 *
23 ********************************************************************/
24
25 #ifndef IRMOD_H
26 #define IRMOD_H
27
28 #include <linux/skbuff.h>
29 #include <linux/miscdevice.h>
30
31 #include <net/irda/irqueue.h>
32
33 #define IRMGR_IOC_MAGIC 'm'
34 #define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1)
35 #define IRMGR_IOC_MAXNR 1
36
37 /*
38 * Events that we pass to the user space manager
39 */
40 typedef enum {
41 EVENT_DEVICE_DISCOVERED = 0,
42 EVENT_REQUEST_MODULE,
43 EVENT_IRLAN_START,
44 EVENT_IRLAN_STOP,
45 EVENT_IRLPT_START, /* Obsolete */
46 EVENT_IRLPT_STOP, /* Obsolete */
47 EVENT_IROBEX_START, /* Obsolete */
48 EVENT_IROBEX_STOP, /* Obsolete */
49 EVENT_IRDA_STOP,
50 EVENT_NEED_PROCESS_CONTEXT,
51 } IRMGR_EVENT;
52
53 /*
54 * Event information passed to the IrManager daemon process
55 */
56 struct irmanager_event {
57 IRMGR_EVENT event;
58 char devname[10];
59 char info[32];
60 int service;
61 __u32 saddr;
62 __u32 daddr;
63 };
64
65 typedef void (*TODO_CALLBACK)( void *self, __u32 param);
66
67 /*
68 * Same as irmanager_event but this one can be queued and inclueds some
69 * addtional information
70 */
71 struct irda_event {
72 irda_queue_t q; /* Must be first */
73
74 struct irmanager_event event;
75 };
76
77 /*
78 * Funtions with needs to be called with a process context
79 */
80 struct irda_todo {
81 irda_queue_t q; /* Must be first */
82
83 void *self;
84 TODO_CALLBACK callback;
85 __u32 param;
86 };
87
88 /*
89 * Main structure for the IrDA device (not much here :-)
90 */
91 struct irda_cb {
92 struct miscdevice dev;
93 wait_queue_head_t wait_queue;
94
95 int in_use;
96
97 irda_queue_t *event_queue; /* Events queued for the irmanager */
98 irda_queue_t *todo_queue; /* Todo list */
99 };
100
101 int irmod_init_module(void);
102 void irmod_cleanup_module(void);
103
104 /*
105 * Function irda_lock (lock)
106 *
107 * Lock variable. Returns false if the lock is already set.
108 *
109 */
110 static inline int irda_lock(int *lock)
111 {
112 if (test_and_set_bit( 0, (void *) lock)) {
113 IRDA_DEBUG(3, __FUNCTION__
114 "(), Trying to lock, already locked variable!\n");
115 return FALSE;
116 }
117 return TRUE;
118 }
119
120 inline int irda_unlock(int *lock);
121
122 void irda_notify_init(notify_t *notify);
123
124 void irda_execute_as_process(void *self, TODO_CALLBACK callback, __u32 param);
125 void irmanager_notify(struct irmanager_event *event);
126
127 extern void irda_proc_modcount(struct inode *, int);
128 void irda_mod_inc_use_count(void);
129 void irda_mod_dec_use_count(void);
130
131 #endif /* IRMOD_H */
132
133
134
135
136
137
138
139
140
141
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.