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 | |
| 27 | /* slot interface types and info */ |
| 28 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 29 | struct ca_slot_info { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 30 | int num; /* slot number */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 32 | int type; /* CA interface this slot supports */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | #define CA_CI 1 /* CI high level interface */ |
| 34 | #define CA_CI_LINK 2 /* CI link layer level interface */ |
| 35 | #define CA_CI_PHYS 4 /* CI physical layer level interface */ |
| 36 | #define CA_DESCR 8 /* built-in descrambler */ |
| 37 | #define CA_SC 128 /* simple smart card interface */ |
| 38 | |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 39 | unsigned int flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */ |
| 41 | #define CA_CI_MODULE_READY 2 |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 42 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 44 | |
| 45 | /* descrambler types and info */ |
| 46 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 47 | struct ca_descr_info { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 48 | unsigned int num; /* number of available descramblers (keys) */ |
| 49 | unsigned int type; /* type of supported scrambling system */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #define CA_ECD 1 |
| 51 | #define CA_NDS 2 |
| 52 | #define CA_DSS 4 |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 53 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 55 | struct ca_caps { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 56 | unsigned int slot_num; /* total number of CA card and module slots */ |
| 57 | unsigned int slot_type; /* OR of all supported types */ |
| 58 | unsigned int descr_num; /* total number of descrambler slots (keys) */ |
| 59 | unsigned int descr_type; /* OR of all supported types */ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 60 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
| 62 | /* a message to/from a CI-CAM */ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 63 | struct ca_msg { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 64 | unsigned int index; |
| 65 | unsigned int type; |
| 66 | unsigned int length; |
| 67 | unsigned char msg[256]; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 68 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 70 | struct ca_descr { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 71 | unsigned int index; |
| 72 | unsigned int parity; /* 0 == even, 1 == odd */ |
| 73 | unsigned char cw[8]; |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 74 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 76 | struct ca_pid { |
Mauro Carvalho Chehab | afd1a0c | 2005-12-12 00:37:27 -0800 | [diff] [blame] | 77 | unsigned int pid; |
| 78 | int index; /* -1 == disable*/ |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 79 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | #define CA_RESET _IO('o', 128) |
Mauro Carvalho Chehab | c93022a | 2017-09-01 05:43:39 -0400 | [diff] [blame^] | 82 | #define CA_GET_CAP _IOR('o', 129, struct ca_caps) |
| 83 | #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info) |
| 84 | #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info) |
| 85 | #define CA_GET_MSG _IOR('o', 132, struct ca_msg) |
| 86 | #define CA_SEND_MSG _IOW('o', 133, struct ca_msg) |
| 87 | #define CA_SET_DESCR _IOW('o', 134, struct ca_descr) |
| 88 | #define CA_SET_PID _IOW('o', 135, struct ca_pid) |
| 89 | |
| 90 | #if !defined (__KERNEL__) |
| 91 | |
| 92 | /* This is needed for legacy userspace support */ |
| 93 | typedef struct ca_slot_info ca_slot_info_t; |
| 94 | typedef struct ca_descr_info ca_descr_info_t; |
| 95 | typedef struct ca_caps ca_caps_t; |
| 96 | typedef struct ca_msg ca_msg_t; |
| 97 | typedef struct ca_descr ca_descr_t; |
| 98 | typedef struct ca_pid ca_pid_t; |
| 99 | |
| 100 | #endif |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | #endif |