blob: 7ee641b4124cd17b445834b872a2a2437bc156fe [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * ca.h
3 *
4 * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de>
5 * & Marcus Metzler <marcus@convergence.de>
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
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040027/**
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -040050struct ca_slot_info {
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040051 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -080059 unsigned int flags;
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040060#define CA_CI_MODULE_PRESENT 1
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#define CA_CI_MODULE_READY 2
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -040062};
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
64
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040065/**
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 */
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -040079struct ca_descr_info {
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040080 unsigned int num;
81 unsigned int type;
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#define CA_ECD 1
83#define CA_NDS 2
84#define CA_DSS 4
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -040085};
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040087/**
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 */
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -040097struct ca_caps {
Mauro Carvalho Chehabfed7c4f2017-09-01 07:48:02 -040098 unsigned int slot_num;
99 unsigned int slot_type;
100 unsigned int descr_num;
101 unsigned int descr_type;
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400102};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
104/* a message to/from a CI-CAM */
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400105struct ca_msg {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800106 unsigned int index;
107 unsigned int type;
108 unsigned int length;
109 unsigned char msg[256];
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400110};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400112struct ca_descr {
Mauro Carvalho Chehabafd1a0c2005-12-12 00:37:27 -0800113 unsigned int index;
114 unsigned int parity; /* 0 == even, 1 == odd */
115 unsigned char cw[8];
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400116};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118#define CA_RESET _IO('o', 128)
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400119#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)
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400125
126#if !defined (__KERNEL__)
127
128/* This is needed for legacy userspace support */
129typedef struct ca_slot_info ca_slot_info_t;
130typedef struct ca_descr_info ca_descr_info_t;
131typedef struct ca_caps ca_caps_t;
132typedef struct ca_msg ca_msg_t;
133typedef struct ca_descr ca_descr_t;
Mauro Carvalho Chehabc93022a2017-09-01 05:43:39 -0400134
135#endif
136
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
138#endif