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