1 /* $Id: capi.h,v 1.1.4.1 2001/11/20 14:19:38 kai Exp $
2  *
3  * CAPI 2.0 Interface for Linux
4  *
5  * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.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 __LINUX_CAPI_H__
13 #define __LINUX_CAPI_H__
14 
15 #include <asm/types.h>
16 #include <linux/ioctl.h>
17 #ifndef __KERNEL__
18 #include <linux/kernelcapi.h>
19 #endif
20 
21 /*
22  * CAPI_REGISTER
23  */
24 
25 typedef struct capi_register_params {	/* CAPI_REGISTER */
26 	__u32 level3cnt;	/* No. of simulatneous user data connections */
27 	__u32 datablkcnt;	/* No. of buffered data messages */
28 	__u32 datablklen;	/* Size of buffered data messages */
29 } capi_register_params;
30 
31 #define	CAPI_REGISTER	_IOW('C',0x01,struct capi_register_params)
32 
33 /*
34  * CAPI_GET_MANUFACTURER
35  */
36 
37 #define CAPI_MANUFACTURER_LEN		64
38 
39 #define	CAPI_GET_MANUFACTURER	_IOWR('C',0x06,CAPI_MANUFACTURER_LEN)
40 
41 /*
42  * CAPI_GET_VERSION
43  */
44 
45 typedef struct capi_version {
46 	__u32 majorversion;
47 	__u32 minorversion;
48 	__u32 majormanuversion;
49 	__u32 minormanuversion;
50 } capi_version;
51 
52 #define CAPI_GET_VERSION	_IOWR('C',0x07,struct capi_version)
53 
54 /*
55  * CAPI_GET_SERIAL
56  */
57 
58 #define CAPI_SERIAL_LEN		8
59 #define CAPI_GET_SERIAL		_IOWR('C',0x08, CAPI_SERIAL_LEN)
60 
61 /*
62  * CAPI_GET_PROFILE
63  */
64 
65 typedef struct capi_profile {
66 	__u16 ncontroller;	/* number of installed controller */
67 	__u16 nbchannel;	/* number of B-Channels */
68 	__u32 goptions;		/* global options */
69 	__u32 support1;		/* B1 protocols support */
70 	__u32 support2;		/* B2 protocols support */
71 	__u32 support3;		/* B3 protocols support */
72 	__u32 reserved[6];	/* reserved */
73 	__u32 manu[5];		/* manufacturer specific information */
74 } capi_profile;
75 
76 #define CAPI_GET_PROFILE	_IOWR('C',0x09,struct capi_profile)
77 
78 typedef struct capi_manufacturer_cmd {
79 	unsigned long cmd;
80 	void *data;
81 } capi_manufacturer_cmd;
82 
83 /*
84  * CAPI_MANUFACTURER_CMD
85  */
86 
87 #define CAPI_MANUFACTURER_CMD	_IOWR('C',0x20, struct capi_manufacturer_cmd)
88 
89 /*
90  * CAPI_GET_ERRCODE
91  * capi errcode is set, * if read, write, or ioctl returns EIO,
92  * ioctl returns errcode directly, and in arg, if != 0
93  */
94 
95 #define CAPI_GET_ERRCODE	_IOR('C',0x21, __u16)
96 
97 /*
98  * CAPI_INSTALLED
99  */
100 #define CAPI_INSTALLED		_IOR('C',0x22, __u16)
101 
102 
103 /*
104  * member contr is input for
105  * CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL
106  * and CAPI_GET_PROFILE
107  */
108 typedef union capi_ioctl_struct {
109 	__u32 contr;
110 	capi_register_params rparams;
111 	__u8 manufacturer[CAPI_MANUFACTURER_LEN];
112 	capi_version version;
113 	__u8 serial[CAPI_SERIAL_LEN];
114 	capi_profile profile;
115 	capi_manufacturer_cmd cmd;
116 	__u16 errcode;
117 } capi_ioctl_struct;
118 
119 /*
120  * Middleware extension
121  */
122 
123 #define CAPIFLAG_HIGHJACKING	0x0001
124 
125 #define CAPI_GET_FLAGS		_IOR('C',0x23, unsigned)
126 #define CAPI_SET_FLAGS		_IOR('C',0x24, unsigned)
127 #define CAPI_CLR_FLAGS		_IOR('C',0x25, unsigned)
128 
129 #define CAPI_NCCI_OPENCOUNT	_IOR('C',0x26, unsigned)
130 
131 #define CAPI_NCCI_GETUNIT	_IOR('C',0x27, unsigned)
132 
133 #endif				/* __LINUX_CAPI_H__ */
134