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 /** 105 * struct ca_msg - a message to/from a CI-CAM 106 * 107 * @index: unused 108 * @type: unused 109 * @length: length of the message 110 * @msg: message 111 * 112 * This struct carries a message to be send/received from a CI CA module. 113 */ 114 struct ca_msg { 115 unsigned int index; 116 unsigned int type; 117 unsigned int length; 118 unsigned char msg[256]; 119 }; 120 121 /** 122 * struct ca_descr - CA descrambler control words info 123 * 124 * @index: CA Descrambler slot 125 * @parity: control words parity, where 0 means even and 1 means odd 126 * @cw: CA Descrambler control words 127 */ 128 struct ca_descr { 129 unsigned int index; 130 unsigned int parity; 131 unsigned char cw[8]; 132 }; 133 134 #define CA_RESET _IO('o', 128) 135 #define CA_GET_CAP _IOR('o', 129, struct ca_caps) 136 #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info) 137 #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) 138 #define CA_GET_MSG _IOR('o', 132, struct ca_msg) 139 #define CA_SEND_MSG _IOW('o', 133, struct ca_msg) 140 #define CA_SET_DESCR _IOW('o', 134, struct ca_descr) 141 142 #if !defined(__KERNEL__) 143 144 /* This is needed for legacy userspace support */ 145 typedef struct ca_slot_info ca_slot_info_t; 146 typedef struct ca_descr_info ca_descr_info_t; 147 typedef struct ca_caps ca_caps_t; 148 typedef struct ca_msg ca_msg_t; 149 typedef struct ca_descr ca_descr_t; 150 151 #endif 152 153 154 #endif 155