1 /********************************************************************* 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 Apr 9 11:13:39 1999 10 * Modified by: Dag Brattli <dagb@cs.uit.no> 12 * Copyright (c) 1998 Dag Brattli, All Rights Reserved. 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. 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. 23 ********************************************************************/ 28 #include <linux/skbuff.h> 29 #include <linux/miscdevice.h> 31 #include <net/irda/irqueue.h> 33 #define IRMGR_IOC_MAGIC'm' 34 #define IRMGR_IOCTNPC _IO(IRMGR_IOC_MAGIC, 1) 35 #define IRMGR_IOC_MAXNR 1 38 * Events that we pass to the user space manager 41 EVENT_DEVICE_DISCOVERED
=0, 50 EVENT_NEED_PROCESS_CONTEXT
, 54 * Event information passed to the IrManager daemon process 56 struct irmanager_event
{ 65 typedefvoid(*TODO_CALLBACK
)(void*self
, __u32 param
); 68 * Same as irmanager_event but this one can be queued and inclueds some 69 * addtional information 72 QUEUE q
;/* Must be first */ 74 struct irmanager_event event
; 78 * Funtions with needs to be called with a process context 81 QUEUE q
;/* Must be first */ 84 TODO_CALLBACK callback
; 89 * Main structure for the IrDA device (not much here :-) 92 struct miscdevice dev
; 93 wait_queue_head_t wait_queue
; 97 QUEUE
*event_queue
;/* Events queued for the irmanager */ 98 QUEUE
*todo_queue
;/* Todo list */ 101 intirmod_init_module(void); 102 voidirmod_cleanup_module(void); 105 * Function irda_lock (lock) 107 * Lock variable. Returns false if the lock is already set. 110 staticinlineintirda_lock(int*lock
) 112 if(test_and_set_bit(0, (void*) lock
)) { 113 DEBUG(3, __FUNCTION__
114 "(), Trying to lock, already locked variable!\n"); 120 inlineintirda_unlock(int*lock
); 122 voidirda_notify_init(notify_t
*notify
); 124 voidirda_execute_as_process(void*self
, TODO_CALLBACK callback
, __u32 param
); 125 voidirmanager_notify(struct irmanager_event
*event
); 127 externvoidirda_proc_modcount(struct inode
*,int); 128 voidirda_mod_inc_use_count(void); 129 voidirda_mod_dec_use_count(void);