1 /* $Id: capilli.h,v 1.1.4.1 2001/11/20 14:19:34 kai Exp $ 2 * 3 * Kernel CAPI 2.0 Driver Interface for Linux 4 * 5 * Copyright 1999 by Carsten Paeth <calle@calle.de> 6 * 7 * This software may be used and distributed according to the terms 8 * of the GNU General Public License, incorporated herein by reference. 9 * 10 */ 11 12 #ifndef __CAPILLI_H__ 13 #define __CAPILLI_H__ 14 15 typedef struct capiloaddatapart { 16 int user; /* data in userspace ? */ 17 int len; 18 unsigned char *data; 19 } capiloaddatapart; 20 21 typedef struct capiloaddata { 22 capiloaddatapart firmware; 23 capiloaddatapart configuration; 24 } capiloaddata; 25 26 typedef struct capicardparams { 27 unsigned int port; 28 unsigned irq; 29 int cardtype; 30 int cardnr; 31 unsigned int membase; 32 } capicardparams; 33 34 struct capi_driver; 35 36 struct capi_ctr { 37 struct capi_ctr *next; /* next ctr of same driver */ 38 struct capi_driver *driver; 39 int cnr; /* controller number */ 40 char name[32]; /* name of controller */ 41 volatile unsigned short cardstate; /* controller state */ 42 volatile int blocked; /* output blocked */ 43 int traceflag; /* capi trace */ 44 45 void *driverdata; /* driver specific */ 46 47 /* filled before calling ready callback */ 48 __u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ 49 capi_version version; /* CAPI_GET_VERSION */ 50 capi_profile profile; /* CAPI_GET_PROFILE */ 51 __u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ 52 53 /* functions */ 54 void (*ready)(struct capi_ctr * card); 55 void (*reseted)(struct capi_ctr * card); 56 void (*suspend_output)(struct capi_ctr * card); 57 void (*resume_output)(struct capi_ctr * card); 58 void (*handle_capimsg)(struct capi_ctr * card, 59 __u16 appl, struct sk_buff *skb); 60 void (*appl_registered)(struct capi_ctr * card, __u16 appl); 61 void (*appl_released)(struct capi_ctr * card, __u16 appl); 62 63 void (*new_ncci)(struct capi_ctr * card, 64 __u16 appl, __u32 ncci, __u32 winsize); 65 void (*free_ncci)(struct capi_ctr * card, __u16 appl, __u32 ncci); 66 67 /* management information for kcapi */ 68 69 unsigned long nrecvctlpkt; 70 unsigned long nrecvdatapkt; 71 unsigned long nsentctlpkt; 72 unsigned long nsentdatapkt; 73 74 struct proc_dir_entry *procent; 75 char procfn[128]; 76 }; 77 78 struct capi_driver_interface { 79 struct capi_ctr *(*attach_ctr)(struct capi_driver *driver, char *name, void *data); 80 int (*detach_ctr)(struct capi_ctr *); 81 }; 82 83 struct capi_driver { 84 char name[32]; /* driver name */ 85 char revision[32]; 86 int (*load_firmware)(struct capi_ctr *, capiloaddata *); 87 void (*reset_ctr)(struct capi_ctr *); 88 void (*remove_ctr)(struct capi_ctr *); 89 void (*register_appl)(struct capi_ctr *, __u16 appl, 90 capi_register_params *); 91 void (*release_appl)(struct capi_ctr *, __u16 appl); 92 void (*send_message)(struct capi_ctr *, struct sk_buff *skb); 93 94 char *(*procinfo)(struct capi_ctr *); 95 int (*ctr_read_proc)(char *page, char **start, off_t off, 96 int count, int *eof, struct capi_ctr *card); 97 int (*driver_read_proc)(char *page, char **start, off_t off, 98 int count, int *eof, struct capi_driver *driver); 99 100 int (*add_card)(struct capi_driver *driver, capicardparams *data); 101 102 /* intitialized by kcapi */ 103 struct capi_ctr *controller; /* list of controllers */ 104 struct capi_driver *next; 105 int ncontroller; 106 struct proc_dir_entry *procent; 107 char procfn[128]; 108 }; 109 110 struct capi_driver_interface *attach_capi_driver(struct capi_driver *driver); 111 void detach_capi_driver(struct capi_driver *driver); 112 113 #endif /* __CAPILLI_H__ */ 114