xref: /linux-6.15/include/uapi/linux/dvb/ca.h (revision fed7c4fe)
1 /*
2  * ca.h
3  *
4  * Copyright (C) 2000 Ralph  Metzler <[email protected]>
5  *                  & Marcus Metzler <[email protected]>
6  *                    for convergence integrated media GmbH
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Lesser Public License
10  * as published by the Free Software Foundation; either version 2.1
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  *
22  */
23 
24 #ifndef _DVBCA_H_
25 #define _DVBCA_H_
26 
27 /**
28  * struct ca_slot_info - CA slot interface types and info.
29  *
30  * @num:	slot number.
31  * @type:	slot type.
32  * @flags:	flags applicable to the slot.
33  *
34  * This struct stores the CA slot information.
35  *
36  * @type can be:
37  *
38  *	- %CA_CI - CI high level interface;
39  *	- %CA_CI_LINK - CI link layer level interface;
40  *	- %CA_CI_PHYS - CI physical layer level interface;
41  *	- %CA_DESCR - built-in descrambler;
42  *	- %CA_SC -simple smart card interface.
43  *
44  * @flags can be:
45  *
46  *	- %CA_CI_MODULE_PRESENT - module (or card) inserted;
47  *	- %CA_CI_MODULE_READY - module is ready for usage.
48  */
49 
50 struct ca_slot_info {
51 	int num;
52 	int type;
53 #define CA_CI            1
54 #define CA_CI_LINK       2
55 #define CA_CI_PHYS       4
56 #define CA_DESCR         8
57 #define CA_SC          128
58 
59 	unsigned int flags;
60 #define CA_CI_MODULE_PRESENT 1
61 #define CA_CI_MODULE_READY   2
62 };
63 
64 
65 /**
66  * struct ca_descr_info - descrambler types and info.
67  *
68  * @num:	number of available descramblers (keys).
69  * @type:	type of supported scrambling system.
70  *
71  * Identifies the number of descramblers and their type.
72  *
73  * @type can be:
74  *
75  *	- %CA_ECD - European Common Descrambler (ECD) hardware;
76  *	- %CA_NDS - Videoguard (NDS) hardware;
77  *	- %CA_DSS - Distributed Sample Scrambling (DSS) hardware.
78  */
79 struct ca_descr_info {
80 	unsigned int num;
81 	unsigned int type;
82 #define CA_ECD           1
83 #define CA_NDS           2
84 #define CA_DSS           4
85 };
86 
87 /**
88  * struct ca_caps - CA slot interface capabilities.
89  *
90  * @slot_num:	total number of CA card and module slots.
91  * @slot_type:	bitmap with all supported types as defined at
92  *		&struct ca_slot_info (e. g. %CA_CI, %CA_CI_LINK, etc).
93  * @descr_num:	total number of descrambler slots (keys)
94  * @descr_type:	bitmap with all supported types as defined at
95  *		&struct ca_descr_info (e. g. %CA_ECD, %CA_NDS, etc).
96  */
97 struct ca_caps {
98 	unsigned int slot_num;
99 	unsigned int slot_type;
100 	unsigned int descr_num;
101 	unsigned int descr_type;
102 };
103 
104 /* a message to/from a CI-CAM */
105 struct ca_msg {
106 	unsigned int index;
107 	unsigned int type;
108 	unsigned int length;
109 	unsigned char msg[256];
110 };
111 
112 struct ca_descr {
113 	unsigned int index;
114 	unsigned int parity;	/* 0 == even, 1 == odd */
115 	unsigned char cw[8];
116 };
117 
118 #define CA_RESET          _IO('o', 128)
119 #define CA_GET_CAP        _IOR('o', 129, struct ca_caps)
120 #define CA_GET_SLOT_INFO  _IOR('o', 130, struct ca_slot_info)
121 #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info)
122 #define CA_GET_MSG        _IOR('o', 132, struct ca_msg)
123 #define CA_SEND_MSG       _IOW('o', 133, struct ca_msg)
124 #define CA_SET_DESCR      _IOW('o', 134, struct ca_descr)
125 
126 #if !defined (__KERNEL__)
127 
128 /* This is needed for legacy userspace support */
129 typedef struct ca_slot_info ca_slot_info_t;
130 typedef struct ca_descr_info  ca_descr_info_t;
131 typedef struct ca_caps  ca_caps_t;
132 typedef struct ca_msg ca_msg_t;
133 typedef struct ca_descr ca_descr_t;
134 
135 #endif
136 
137 
138 #endif
139