1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */ 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 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 */ 50 51 struct ca_slot_info { 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 59 60 unsigned int flags; 61 #define CA_CI_MODULE_PRESENT 1 62 #define CA_CI_MODULE_READY 2 63 }; 64 65 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 */ 80 struct ca_descr_info { 81 unsigned int num; 82 unsigned int type; 83 #define CA_ECD 1 84 #define CA_NDS 2 85 #define CA_DSS 4 86 }; 87 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 */ 98 struct ca_caps { 99 unsigned int slot_num; 100 unsigned int slot_type; 101 unsigned int descr_num; 102 unsigned int descr_type; 103 }; 104 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 */ 115 struct ca_msg { 116 unsigned int index; 117 unsigned int type; 118 unsigned int length; 119 unsigned char msg[256]; 120 }; 121 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 */ 129 struct ca_descr { 130 unsigned int index; 131 unsigned int parity; 132 unsigned char cw[8]; 133 }; 134 135 #define CA_RESET _IO('o', 128) 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) 142 143 #if !defined(__KERNEL__) 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; 151 152 #endif 153 154 155 #endif