Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 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 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 50 | struct ca_slot_info { |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 59 | unsigned int flags; |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 60 | #define CA_CI_MODULE_PRESENT 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | #define CA_CI_MODULE_READY 2 |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 62 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | |
| 64 | |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 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 | */ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 79 | struct ca_descr_info { |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 80 | unsigned int num; |
| 81 | unsigned int type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #define CA_ECD 1 |
| 83 | #define CA_NDS 2 |
| 84 | #define CA_DSS 4 |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 85 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 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 | */ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 97 | struct ca_caps { |
Mauro Carvalho Chehab | fed7c4f | 2017-09-01 07:48:02 -0400 | [diff] [blame^] | 98 | unsigned int slot_num; |
| 99 | unsigned int slot_type; |
| 100 | unsigned int descr_num; |
| 101 | unsigned int descr_type; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 102 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
| 104 | /* a message to/from a CI-CAM */ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 105 | struct ca_msg { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 106 | unsigned int index; |
| 107 | unsigned int type; |
| 108 | unsigned int length; |
| 109 | unsigned char msg[256]; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 110 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 112 | struct ca_descr { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 113 | unsigned int index; |
| 114 | unsigned int parity; /* 0 == even, 1 == odd */ |
| 115 | unsigned char cw[8]; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 116 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | #define CA_RESET _IO('o', 128) |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 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) |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 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; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame] | 134 | |
| 135 | #endif |
| 136 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | |
| 138 | #endif |