Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
0002 /*
0003  * ca.h
0004  *
0005  * Copyright (C) 2000 Ralph  Metzler <ralph@convergence.de>
0006  *                  & Marcus Metzler <marcus@convergence.de>
0007  *                    for convergence integrated media GmbH
0008  *
0009  * This program is free software; you can redistribute it and/or
0010  * modify it under the terms of the GNU General Lesser Public License
0011  * as published by the Free Software Foundation; either version 2.1
0012  * of the License, or (at your option) any later version.
0013  *
0014  * This program is distributed in the hope that it will be useful,
0015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  * GNU General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU Lesser General Public License
0020  * along with this program; if not, write to the Free Software
0021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0022  *
0023  */
0024 
0025 #ifndef _DVBCA_H_
0026 #define _DVBCA_H_
0027 
0028 /**
0029  * struct ca_slot_info - CA slot interface types and info.
0030  *
0031  * @num:    slot number.
0032  * @type:   slot type.
0033  * @flags:  flags applicable to the slot.
0034  *
0035  * This struct stores the CA slot information.
0036  *
0037  * @type can be:
0038  *
0039  *  - %CA_CI - CI high level interface;
0040  *  - %CA_CI_LINK - CI link layer level interface;
0041  *  - %CA_CI_PHYS - CI physical layer level interface;
0042  *  - %CA_DESCR - built-in descrambler;
0043  *  - %CA_SC -simple smart card interface.
0044  *
0045  * @flags can be:
0046  *
0047  *  - %CA_CI_MODULE_PRESENT - module (or card) inserted;
0048  *  - %CA_CI_MODULE_READY - module is ready for usage.
0049  */
0050 
0051 struct ca_slot_info {
0052     int num;
0053     int type;
0054 #define CA_CI            1
0055 #define CA_CI_LINK       2
0056 #define CA_CI_PHYS       4
0057 #define CA_DESCR         8
0058 #define CA_SC          128
0059 
0060     unsigned int flags;
0061 #define CA_CI_MODULE_PRESENT 1
0062 #define CA_CI_MODULE_READY   2
0063 };
0064 
0065 
0066 /**
0067  * struct ca_descr_info - descrambler types and info.
0068  *
0069  * @num:    number of available descramblers (keys).
0070  * @type:   type of supported scrambling system.
0071  *
0072  * Identifies the number of descramblers and their type.
0073  *
0074  * @type can be:
0075  *
0076  *  - %CA_ECD - European Common Descrambler (ECD) hardware;
0077  *  - %CA_NDS - Videoguard (NDS) hardware;
0078  *  - %CA_DSS - Distributed Sample Scrambling (DSS) hardware.
0079  */
0080 struct ca_descr_info {
0081     unsigned int num;
0082     unsigned int type;
0083 #define CA_ECD           1
0084 #define CA_NDS           2
0085 #define CA_DSS           4
0086 };
0087 
0088 /**
0089  * struct ca_caps - CA slot interface capabilities.
0090  *
0091  * @slot_num:   total number of CA card and module slots.
0092  * @slot_type:  bitmap with all supported types as defined at
0093  *      &struct ca_slot_info (e. g. %CA_CI, %CA_CI_LINK, etc).
0094  * @descr_num:  total number of descrambler slots (keys)
0095  * @descr_type: bitmap with all supported types as defined at
0096  *      &struct ca_descr_info (e. g. %CA_ECD, %CA_NDS, etc).
0097  */
0098 struct ca_caps {
0099     unsigned int slot_num;
0100     unsigned int slot_type;
0101     unsigned int descr_num;
0102     unsigned int descr_type;
0103 };
0104 
0105 /**
0106  * struct ca_msg - a message to/from a CI-CAM
0107  *
0108  * @index:  unused
0109  * @type:   unused
0110  * @length: length of the message
0111  * @msg:    message
0112  *
0113  * This struct carries a message to be send/received from a CI CA module.
0114  */
0115 struct ca_msg {
0116     unsigned int index;
0117     unsigned int type;
0118     unsigned int length;
0119     unsigned char msg[256];
0120 };
0121 
0122 /**
0123  * struct ca_descr - CA descrambler control words info
0124  *
0125  * @index: CA Descrambler slot
0126  * @parity: control words parity, where 0 means even and 1 means odd
0127  * @cw: CA Descrambler control words
0128  */
0129 struct ca_descr {
0130     unsigned int index;
0131     unsigned int parity;
0132     unsigned char cw[8];
0133 };
0134 
0135 #define CA_RESET          _IO('o', 128)
0136 #define CA_GET_CAP        _IOR('o', 129, struct ca_caps)
0137 #define CA_GET_SLOT_INFO  _IOR('o', 130, struct ca_slot_info)
0138 #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info)
0139 #define CA_GET_MSG        _IOR('o', 132, struct ca_msg)
0140 #define CA_SEND_MSG       _IOW('o', 133, struct ca_msg)
0141 #define CA_SET_DESCR      _IOW('o', 134, struct ca_descr)
0142 
0143 #if !defined(__KERNEL__)
0144 
0145 /* This is needed for legacy userspace support */
0146 typedef struct ca_slot_info ca_slot_info_t;
0147 typedef struct ca_descr_info  ca_descr_info_t;
0148 typedef struct ca_caps  ca_caps_t;
0149 typedef struct ca_msg ca_msg_t;
0150 typedef struct ca_descr ca_descr_t;
0151 
0152 #endif
0153 
0154 
0155 #endif