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