Merge branch 'sh-latest' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
[pandora-kernel.git] / Documentation / DocBook / media / dvb / ca.xml
1 <title>DVB CA Device</title>
2 <para>The DVB CA device controls the conditional access hardware. It can be accessed through
3 <emphasis role="tt">/dev/dvb/adapter0/ca0</emphasis>. Data types and and ioctl definitions can be accessed by
4 including <emphasis role="tt">linux/dvb/ca.h</emphasis> in your application.
5 </para>
6
7 <section id="ca_data_types">
8 <title>CA Data Types</title>
9
10
11 <section id="ca-slot-info">
12 <title>ca_slot_info_t</title>
13  <programlisting>
14 typedef struct ca_slot_info {
15         int num;               /&#x22C6; slot number &#x22C6;/
16
17         int type;              /&#x22C6; CA interface this slot supports &#x22C6;/
18 #define CA_CI            1     /&#x22C6; CI high level interface &#x22C6;/
19 #define CA_CI_LINK       2     /&#x22C6; CI link layer level interface &#x22C6;/
20 #define CA_CI_PHYS       4     /&#x22C6; CI physical layer level interface &#x22C6;/
21 #define CA_DESCR         8     /&#x22C6; built-in descrambler &#x22C6;/
22 #define CA_SC          128     /&#x22C6; simple smart card interface &#x22C6;/
23
24         unsigned int flags;
25 #define CA_CI_MODULE_PRESENT 1 /&#x22C6; module (or card) inserted &#x22C6;/
26 #define CA_CI_MODULE_READY   2
27 } ca_slot_info_t;
28 </programlisting>
29
30 </section>
31 <section id="ca-descr-info">
32 <title>ca_descr_info_t</title>
33 <programlisting>
34 typedef struct ca_descr_info {
35         unsigned int num;  /&#x22C6; number of available descramblers (keys) &#x22C6;/
36         unsigned int type; /&#x22C6; type of supported scrambling system &#x22C6;/
37 #define CA_ECD           1
38 #define CA_NDS           2
39 #define CA_DSS           4
40 } ca_descr_info_t;
41 </programlisting>
42
43 </section>
44 <section id="ca-caps">
45 <title>ca_caps_t</title>
46 <programlisting>
47 typedef struct ca_caps {
48         unsigned int slot_num;  /&#x22C6; total number of CA card and module slots &#x22C6;/
49         unsigned int slot_type; /&#x22C6; OR of all supported types &#x22C6;/
50         unsigned int descr_num; /&#x22C6; total number of descrambler slots (keys) &#x22C6;/
51         unsigned int descr_type;/&#x22C6; OR of all supported types &#x22C6;/
52  } ca_cap_t;
53 </programlisting>
54
55 </section>
56 <section id="ca-msg">
57 <title>ca_msg_t</title>
58 <programlisting>
59 /&#x22C6; a message to/from a CI-CAM &#x22C6;/
60 typedef struct ca_msg {
61         unsigned int index;
62         unsigned int type;
63         unsigned int length;
64         unsigned char msg[256];
65 } ca_msg_t;
66 </programlisting>
67
68 </section>
69 <section id="ca-descr">
70 <title>ca_descr_t</title>
71 <programlisting>
72 typedef struct ca_descr {
73         unsigned int index;
74         unsigned int parity;
75         unsigned char cw[8];
76 } ca_descr_t;
77 </programlisting>
78 </section>
79
80 <section id="ca-pid">
81 <title>ca-pid</title>
82 <programlisting>
83 typedef struct ca_pid {
84         unsigned int pid;
85         int index;              /&#x22C6; -1 == disable&#x22C6;/
86 } ca_pid_t;
87 </programlisting>
88 </section></section>
89
90 <section id="ca_function_calls">
91 <title>CA Function Calls</title>
92
93
94 <section id="ca_fopen">
95 <title>open()</title>
96 <para>DESCRIPTION
97 </para>
98 <informaltable><tgroup cols="1"><tbody><row><entry
99  align="char">
100 <para>This system call opens a named ca device (e.g. /dev/ost/ca) for subsequent use.</para>
101 <para>When an open() call has succeeded, the device will be ready for use.
102  The significance of blocking or non-blocking mode is described in the
103  documentation for functions where there is a difference. It does not affect the
104  semantics of the open() call itself. A device opened in blocking mode can later
105  be put into non-blocking mode (and vice versa) using the F_SETFL command
106  of the fcntl system call. This is a standard system call, documented in the Linux
107  manual page for fcntl. Only one user can open the CA Device in O_RDWR
108  mode. All other attempts to open the device in this mode will fail, and an error
109  code will be returned.</para>
110 </entry>
111  </row></tbody></tgroup></informaltable>
112 <para>SYNOPSIS
113 </para>
114 <informaltable><tgroup cols="1"><tbody><row><entry
115  align="char">
116 <para>int open(const char &#x22C6;deviceName, int flags);</para>
117 </entry>
118  </row></tbody></tgroup></informaltable>
119 <para>PARAMETERS
120 </para>
121 <informaltable><tgroup cols="2"><tbody><row><entry
122  align="char">
123 <para>const char
124  *deviceName</para>
125 </entry><entry
126  align="char">
127 <para>Name of specific video device.</para>
128 </entry>
129  </row><row><entry
130  align="char">
131 <para>int flags</para>
132 </entry><entry
133  align="char">
134 <para>A bit-wise OR of the following flags:</para>
135 </entry>
136  </row><row><entry
137  align="char">
138 </entry><entry
139  align="char">
140 <para>O_RDONLY read-only access</para>
141 </entry>
142  </row><row><entry
143  align="char">
144 </entry><entry
145  align="char">
146 <para>O_RDWR read/write access</para>
147 </entry>
148  </row><row><entry
149  align="char">
150 </entry><entry
151  align="char">
152 <para>O_NONBLOCK open in non-blocking mode</para>
153 </entry>
154  </row><row><entry
155  align="char">
156 </entry><entry
157  align="char">
158 <para>(blocking mode is the default)</para>
159 </entry>
160  </row></tbody></tgroup></informaltable>
161 <para>RETURN VALUE</para>
162 <informaltable><tgroup cols="2"><tbody><row><entry
163  align="char">
164 <para>ENODEV</para>
165 </entry><entry
166  align="char">
167 <para>Device driver not loaded/available.</para>
168 </entry>
169  </row><row><entry
170  align="char">
171 <para>EINTERNAL</para>
172 </entry><entry
173  align="char">
174 <para>Internal error.</para>
175 </entry>
176  </row><row><entry
177  align="char">
178 <para>EBUSY</para>
179 </entry><entry
180  align="char">
181 <para>Device or resource busy.</para>
182 </entry>
183  </row><row><entry
184  align="char">
185 <para>EINVAL</para>
186 </entry><entry
187  align="char">
188 <para>Invalid argument.</para>
189 </entry>
190  </row></tbody></tgroup></informaltable>
191
192 </section>
193 <section id="ca_fclose">
194 <title>close()</title>
195 <para>DESCRIPTION
196 </para>
197 <informaltable><tgroup cols="1"><tbody><row><entry
198  align="char">
199 <para>This system call closes a previously opened audio device.</para>
200 </entry>
201  </row></tbody></tgroup></informaltable>
202 <para>SYNOPSIS
203 </para>
204 <informaltable><tgroup cols="1"><tbody><row><entry
205  align="char">
206 <para>int close(int fd);</para>
207 </entry>
208  </row></tbody></tgroup></informaltable>
209 <para>PARAMETERS
210 </para>
211 <informaltable><tgroup cols="2"><tbody><row><entry
212  align="char">
213 <para>int fd</para>
214 </entry><entry
215  align="char">
216 <para>File descriptor returned by a previous call to open().</para>
217 </entry>
218  </row></tbody></tgroup></informaltable>
219 <para>RETURN VALUE</para>
220 <informaltable><tgroup cols="2"><tbody><row><entry
221  align="char">
222 <para>EBADF</para>
223 </entry><entry
224  align="char">
225 <para>fd is not a valid open file descriptor.</para>
226 </entry>
227  </row></tbody></tgroup></informaltable>
228  </section>
229 </section>