| 1 | /* |
|---|
| 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 | #include <asm/types.h> |
|---|
| 16 | |
|---|
| 17 | #include <linux/kernel.h> |
|---|
| 18 | #include <linux/capi.h> |
|---|
| 19 | #include <linux/kernelcapi.h> |
|---|
| 20 | |
|---|
| 21 | typedef struct capiloaddatapart { |
|---|
| 22 | int user; /* data in userspace ? */ |
|---|
| 23 | int len; |
|---|
| 24 | unsigned char *data; |
|---|
| 25 | } capiloaddatapart; |
|---|
| 26 | |
|---|
| 27 | typedef struct capiloaddata { |
|---|
| 28 | capiloaddatapart firmware; |
|---|
| 29 | capiloaddatapart configuration; |
|---|
| 30 | } capiloaddata; |
|---|
| 31 | |
|---|
| 32 | typedef struct capicardparams { |
|---|
| 33 | unsigned int port; |
|---|
| 34 | unsigned irq; |
|---|
| 35 | int cardtype; |
|---|
| 36 | int cardnr; |
|---|
| 37 | unsigned int membase; |
|---|
| 38 | } capicardparams; |
|---|
| 39 | |
|---|
| 40 | struct capi_ctr { |
|---|
| 41 | /* filled in before calling attach_capi_ctr */ |
|---|
| 42 | struct module *owner; |
|---|
| 43 | void *driverdata; /* driver specific */ |
|---|
| 44 | char name[32]; /* name of controller */ |
|---|
| 45 | char *driver_name; /* name of driver */ |
|---|
| 46 | int (*load_firmware)(struct capi_ctr *, capiloaddata *); |
|---|
| 47 | void (*reset_ctr)(struct capi_ctr *); |
|---|
| 48 | void (*register_appl)(struct capi_ctr *, __u16 appl, |
|---|
| 49 | capi_register_params *); |
|---|
| 50 | void (*release_appl)(struct capi_ctr *, __u16 appl); |
|---|
| 51 | __u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); |
|---|
| 52 | |
|---|
| 53 | char *(*procinfo)(struct capi_ctr *); |
|---|
| 54 | int (*ctr_read_proc)(char *page, char **start, off_t off, |
|---|
| 55 | int count, int *eof, struct capi_ctr *card); |
|---|
| 56 | |
|---|
| 57 | /* filled in before calling ready callback */ |
|---|
| 58 | __u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ |
|---|
| 59 | capi_version version; /* CAPI_GET_VERSION */ |
|---|
| 60 | capi_profile profile; /* CAPI_GET_PROFILE */ |
|---|
| 61 | __u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ |
|---|
| 62 | |
|---|
| 63 | /* management information for kcapi */ |
|---|
| 64 | |
|---|
| 65 | unsigned long nrecvctlpkt; |
|---|
| 66 | unsigned long nrecvdatapkt; |
|---|
| 67 | unsigned long nsentctlpkt; |
|---|
| 68 | unsigned long nsentdatapkt; |
|---|
| 69 | |
|---|
| 70 | int cnr; /* controller number */ |
|---|
| 71 | volatile unsigned short cardstate; /* controller state */ |
|---|
| 72 | volatile int blocked; /* output blocked */ |
|---|
| 73 | int traceflag; /* capi trace */ |
|---|
| 74 | |
|---|
| 75 | struct proc_dir_entry *procent; |
|---|
| 76 | char procfn[128]; |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | int attach_capi_ctr(struct capi_ctr *); |
|---|
| 80 | int detach_capi_ctr(struct capi_ctr *); |
|---|
| 81 | |
|---|
| 82 | void capi_ctr_ready(struct capi_ctr * card); |
|---|
| 83 | void capi_ctr_reseted(struct capi_ctr * card); |
|---|
| 84 | void capi_ctr_suspend_output(struct capi_ctr * card); |
|---|
| 85 | void capi_ctr_resume_output(struct capi_ctr * card); |
|---|
| 86 | void capi_ctr_handle_message(struct capi_ctr * card, __u16 appl, struct sk_buff *skb); |
|---|
| 87 | |
|---|
| 88 | // --------------------------------------------------------------------------- |
|---|
| 89 | // needed for AVM capi drivers |
|---|
| 90 | |
|---|
| 91 | struct capi_driver { |
|---|
| 92 | char name[32]; /* driver name */ |
|---|
| 93 | char revision[32]; |
|---|
| 94 | |
|---|
| 95 | int (*add_card)(struct capi_driver *driver, capicardparams *data); |
|---|
| 96 | |
|---|
| 97 | /* management information for kcapi */ |
|---|
| 98 | struct list_head list; |
|---|
| 99 | }; |
|---|
| 100 | |
|---|
| 101 | void register_capi_driver(struct capi_driver *driver); |
|---|
| 102 | void unregister_capi_driver(struct capi_driver *driver); |
|---|
| 103 | |
|---|
| 104 | // --------------------------------------------------------------------------- |
|---|
| 105 | // library functions for use by hardware controller drivers |
|---|
| 106 | |
|---|
| 107 | void capilib_new_ncci(struct list_head *head, __u16 applid, __u32 ncci, __u32 winsize); |
|---|
| 108 | void capilib_free_ncci(struct list_head *head, __u16 applid, __u32 ncci); |
|---|
| 109 | void capilib_release_appl(struct list_head *head, __u16 applid); |
|---|
| 110 | void capilib_release(struct list_head *head); |
|---|
| 111 | void capilib_data_b3_conf(struct list_head *head, __u16 applid, __u32 ncci, __u16 msgid); |
|---|
| 112 | __u16 capilib_data_b3_req(struct list_head *head, __u16 applid, __u32 ncci, __u16 msgid); |
|---|
| 113 | |
|---|
| 114 | #endif /* __CAPILLI_H__ */ |
|---|