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