00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef IRMOD_H
00026 #define IRMOD_H
00027
00028 #include <linux/skbuff.h>
00029 #include <linux/miscdevice.h>
00030
00031 #include <net/irda/irqueue.h>
00032
00033 #define IRMGR_IOC_MAGIC 'm'
00034 #define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1)
00035 #define IRMGR_IOC_MAXNR 1
00036
00037
00038
00039
00040 typedef enum {
00041 EVENT_DEVICE_DISCOVERED = 0,
00042 EVENT_REQUEST_MODULE,
00043 EVENT_IRLAN_START,
00044 EVENT_IRLAN_STOP,
00045 EVENT_IRLPT_START,
00046 EVENT_IRLPT_STOP,
00047 EVENT_IROBEX_START,
00048 EVENT_IROBEX_STOP,
00049 EVENT_IRDA_STOP,
00050 EVENT_NEED_PROCESS_CONTEXT,
00051 } IRMGR_EVENT;
00052
00053
00054
00055
00056 struct irmanager_event {
00057 IRMGR_EVENT event;
00058 char devname[10];
00059 char info[32];
00060 int service;
00061 __u32 saddr;
00062 __u32 daddr;
00063 };
00064
00065 typedef void (*TODO_CALLBACK)( void *self, __u32 param);
00066
00067
00068
00069
00070
00071 struct irda_event {
00072 queue_t q;
00073
00074 struct irmanager_event event;
00075 };
00076
00077
00078
00079
00080 struct irda_todo {
00081 queue_t q;
00082
00083 void *self;
00084 TODO_CALLBACK callback;
00085 __u32 param;
00086 };
00087
00088
00089
00090
00091 struct irda_cb {
00092 struct miscdevice dev;
00093 struct wait_queue *wait_queue;
00094
00095 int in_use;
00096
00097 queue_t *event_queue;
00098 queue_t *todo_queue;
00099 };
00100
00101 int irmod_init_module(void);
00102 void irmod_cleanup_module(void);
00103
00104
00105
00106
00107
00108
00109
00110 static inline int irda_lock(int *lock)
00111 {
00112 if (test_and_set_bit( 0, (void *) lock)) {
00113 IRDA_DEBUG(3, __FUNCTION__
00114 "(), Trying to lock, already locked variable!\n");
00115 return FALSE;
00116 }
00117 return TRUE;
00118 }
00119
00120 inline int irda_unlock(int *lock);
00121
00122 void irda_notify_init(notify_t *notify);
00123
00124 void irda_execute_as_process(void *self, TODO_CALLBACK callback, __u32 param);
00125 void irmanager_notify(struct irmanager_event *event);
00126
00127 extern void irda_proc_modcount(struct inode *, int);
00128 void irda_mod_inc_use_count(void);
00129 void irda_mod_dec_use_count(void);
00130
00131 #endif
00132
00133
00134
00135
00136
00137
00138
00139
00140