1 /*****************************************************************************/ 2 /* 3 * auerchar.h -- Auerswald PBX/System Telephone character interface. 4 * 5 * Copyright (C) 2002 Wolfgang M�es (wolfgang@iksw-muees.de) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 */ 21 /*****************************************************************************/ 22 23 #ifndef AUERCHAR_H 24 #define AUERCHAR_H 25 26 #include "auerchain.h" 27 #include "auerbuf.h" 28 #include "auerserv.h" 29 30 /* External data structures / Interface */ 31 struct audevinfo { 32 char *buf; /* return buffer for string contents */ 33 unsigned int bsize; /* size of return buffer */ 34 }; 35 36 /* IO controls */ 37 #define IOCTL_AU_SLEN _IOR( 'U', 0xF0, int) /* return the max. string descriptor length */ 38 #define IOCTL_AU_DEVINFO _IOWR('U', 0xF1, struct audevinfo) /* get name of a specific device */ 39 #define IOCTL_AU_SERVREQ _IOW( 'U', 0xF2, int) /* request a service channel */ 40 #define IOCTL_AU_BUFLEN _IOR( 'U', 0xF3, int) /* return the max. buffer length for the device */ 41 #define IOCTL_AU_RXAVAIL _IOR( 'U', 0xF4, int) /* return != 0 if Receive Data available */ 42 #define IOCTL_AU_CONNECT _IOR( 'U', 0xF5, int) /* return != 0 if connected to a service channel */ 43 #define IOCTL_AU_TXREADY _IOR( 'U', 0xF6, int) /* return != 0 if Transmitt channel ready to send */ 44 /* 'U' 0xF7..0xFF reserved */ 45 46 /* character device context */ 47 struct auerswald; 48 struct auerchar { 49 struct semaphore mutex; /* protection in user context */ 50 struct auerswald *auerdev; /* context pointer of assigned device */ 51 struct auerbufctl bufctl; /* controls the buffer chain */ 52 struct auerscon scontext; /* service context */ 53 wait_queue_head_t readwait; /* for synchronous reading */ 54 struct semaphore readmutex; /* protection against multiple reads */ 55 struct auerbuf *readbuf; /* buffer held for partial reading */ 56 unsigned int readoffset; /* current offset in readbuf */ 57 unsigned int removed; /* is != 0 if device is removed */ 58 }; 59 60 /* Function prototypes */ 61 void auerchar_delete(struct auerchar *ccp); 62 63 int auerchar_open(struct inode *inode, struct file *file); 64 65 int auerchar_ioctl(struct inode *inode, struct file *file, 66 unsigned int cmd, unsigned long arg); 67 68 loff_t auerchar_llseek(struct file *file, loff_t offset, int origin); 69 70 ssize_t auerchar_read(struct file *file, char *buf, size_t count, 71 loff_t * ppos); 72 73 ssize_t auerchar_write(struct file *file, const char *buf, size_t len, 74 loff_t * ppos); 75 76 int auerchar_release(struct inode *inode, struct file *file); 77 78 79 #endif /* AUERCHAR_H */ 80