| 1 | |
| 2 | * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $
|
| 3 | *
|
| 4 | * Kernel CAPI 2.0 Interface for Linux
|
| 5 | *
|
| 6 | * (c) Copyright 1997 by Carsten Paeth ([email protected])
|
| 7 | *
|
| 8 |
|
| 9 |
|
| 10 | #ifndef __KERNELCAPI_H__
|
| 11 | #define __KERNELCAPI_H__
|
| 12 |
|
| 13 | #define CAPI_MAXAPPL 240
|
| 14 | #define CAPI_MAXCONTR 32
|
| 15 | #define CAPI_MAXDATAWINDOW 8
|
| 16 |
|
| 17 |
|
| 18 | typedef struct kcapi_flagdef {
|
| 19 | int contr;
|
| 20 | int flag;
|
| 21 | } kcapi_flagdef;
|
| 22 |
|
| 23 | typedef struct kcapi_carddef {
|
| 24 | char driver[32];
|
| 25 | unsigned int port;
|
| 26 | unsigned irq;
|
| 27 | unsigned int membase;
|
| 28 | int cardnr;
|
| 29 | } kcapi_carddef;
|
| 30 |
|
| 31 |
|
| 32 | #define KCAPI_CMD_TRACE 10
|
| 33 | #define KCAPI_CMD_ADDCARD 11
|
| 34 |
|
| 35 | |
| 36 | * flag > 2 => trace also data
|
| 37 | * flag & 1 => show trace
|
| 38 |
|
| 39 | #define KCAPI_TRACE_OFF 0
|
| 40 | #define KCAPI_TRACE_SHORT_NO_DATA 1
|
| 41 | #define KCAPI_TRACE_FULL_NO_DATA 2
|
| 42 | #define KCAPI_TRACE_SHORT 3
|
| 43 | #define KCAPI_TRACE_FULL 4
|
| 44 |
|
| 45 |
|
| 46 | #ifdef __KERNEL__
|
| 47 |
|
| 48 | #include <linux/list.h>
|
| 49 | #include <linux/skbuff.h>
|
| 50 |
|
| 51 | #define KCI_CONTRUP 0
|
| 52 | #define KCI_CONTRDOWN 1
|
| 53 |
|
| 54 | struct capi20_appl {
|
| 55 | u16 applid;
|
| 56 | capi_register_params rparam;
|
| 57 | void (*recv_message)(struct capi20_appl *ap, struct sk_buff *skb);
|
| 58 | void *private;
|
| 59 |
|
| 60 |
|
| 61 | unsigned long nrecvctlpkt;
|
| 62 | unsigned long nrecvdatapkt;
|
| 63 | unsigned long nsentctlpkt;
|
| 64 | unsigned long nsentdatapkt;
|
| 65 | struct semaphore recv_sem;
|
| 66 | struct sk_buff_head recv_queue;
|
| 67 | struct work_struct recv_work;
|
| 68 | int release_in_progress;
|
| 69 |
|
| 70 | |
| 71 | * controllers. The Right Way (tm) is known. XXX
|
| 72 |
|
| 73 | void (*callback) (unsigned int cmd, __u32 contr, void *data);
|
| 74 | };
|
| 75 |
|
| 76 | u16 capi20_isinstalled(void);
|
| 77 | u16 capi20_register(struct capi20_appl *ap);
|
| 78 | u16 capi20_release(struct capi20_appl *ap);
|
| 79 | u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb);
|
| 80 | u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
|
| 81 | u16 capi20_get_version(u32 contr, struct capi_version *verp);
|
| 82 | u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
|
| 83 | u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
|
| 84 | int capi20_manufacturer(unsigned int cmd, void __user *data);
|
| 85 |
|
| 86 |
|
| 87 | void capi20_set_callback(struct capi20_appl *ap,
|
| 88 | void (*callback) (unsigned int cmd, __u32 contr, void *data));
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 | #define CAPI_NOERROR 0x0000
|
| 93 |
|
| 94 | #define CAPI_TOOMANYAPPLS 0x1001
|
| 95 | #define CAPI_LOGBLKSIZETOSMALL 0x1002
|
| 96 | #define CAPI_BUFFEXECEEDS64K 0x1003
|
| 97 | #define CAPI_MSGBUFSIZETOOSMALL 0x1004
|
| 98 | #define CAPI_ANZLOGCONNNOTSUPPORTED 0x1005
|
| 99 | #define CAPI_REGRESERVED 0x1006
|
| 100 | #define CAPI_REGBUSY 0x1007
|
| 101 | #define CAPI_REGOSRESOURCEERR 0x1008
|
| 102 | #define CAPI_REGNOTINSTALLED 0x1009
|
| 103 | #define CAPI_REGCTRLERNOTSUPPORTEXTEQUIP 0x100a
|
| 104 | #define CAPI_REGCTRLERONLYSUPPORTEXTEQUIP 0x100b
|
| 105 |
|
| 106 | #define CAPI_ILLAPPNR 0x1101
|
| 107 | #define CAPI_ILLCMDORSUBCMDORMSGTOSMALL 0x1102
|
| 108 | #define CAPI_SENDQUEUEFULL 0x1103
|
| 109 | #define CAPI_RECEIVEQUEUEEMPTY 0x1104
|
| 110 | #define CAPI_RECEIVEOVERFLOW 0x1105
|
| 111 | #define CAPI_UNKNOWNNOTPAR 0x1106
|
| 112 | #define CAPI_MSGBUSY 0x1107
|
| 113 | #define CAPI_MSGOSRESOURCEERR 0x1108
|
| 114 | #define CAPI_MSGNOTINSTALLED 0x1109
|
| 115 | #define CAPI_MSGCTRLERNOTSUPPORTEXTEQUIP 0x110a
|
| 116 | #define CAPI_MSGCTRLERONLYSUPPORTEXTEQUIP 0x110b
|
| 117 |
|
| 118 | typedef enum {
|
| 119 | CapiMessageNotSupportedInCurrentState = 0x2001,
|
| 120 | CapiIllContrPlciNcci = 0x2002,
|
| 121 | CapiNoPlciAvailable = 0x2003,
|
| 122 | CapiNoNcciAvailable = 0x2004,
|
| 123 | CapiNoListenResourcesAvailable = 0x2005,
|
| 124 | CapiNoFaxResourcesAvailable = 0x2006,
|
| 125 | CapiIllMessageParmCoding = 0x2007,
|
| 126 | } RESOURCE_CODING_PROBLEM;
|
| 127 |
|
| 128 | typedef enum {
|
| 129 | CapiB1ProtocolNotSupported = 0x3001,
|
| 130 | CapiB2ProtocolNotSupported = 0x3002,
|
| 131 | CapiB3ProtocolNotSupported = 0x3003,
|
| 132 | CapiB1ProtocolParameterNotSupported = 0x3004,
|
| 133 | CapiB2ProtocolParameterNotSupported = 0x3005,
|
| 134 | CapiB3ProtocolParameterNotSupported = 0x3006,
|
| 135 | CapiBProtocolCombinationNotSupported = 0x3007,
|
| 136 | CapiNcpiNotSupported = 0x3008,
|
| 137 | CapiCipValueUnknown = 0x3009,
|
| 138 | CapiFlagsNotSupported = 0x300a,
|
| 139 | CapiFacilityNotSupported = 0x300b,
|
| 140 | CapiDataLengthNotSupportedByCurrentProtocol = 0x300c,
|
| 141 | CapiResetProcedureNotSupportedByCurrentProtocol = 0x300d,
|
| 142 | CapiTeiAssignmentFailed = 0x300e,
|
| 143 | } REQUESTED_SERVICES_PROBLEM;
|
| 144 |
|
| 145 | typedef enum {
|
| 146 | CapiSuccess = 0x0000,
|
| 147 | CapiSupplementaryServiceNotSupported = 0x300e,
|
| 148 | CapiRequestNotAllowedInThisState = 0x3010,
|
| 149 | } SUPPLEMENTARY_SERVICE_INFO;
|
| 150 |
|
| 151 | typedef enum {
|
| 152 | CapiProtocolErrorLayer1 = 0x3301,
|
| 153 | CapiProtocolErrorLayer2 = 0x3302,
|
| 154 | CapiProtocolErrorLayer3 = 0x3303,
|
| 155 | CapiTimeOut = 0x3303, |
| 156 | CapiCallGivenToOtherApplication = 0x3304,
|
| 157 | } CAPI_REASON;
|
| 158 |
|
| 159 | #endif
|
| 160 |
|
| 161 | #endif
|