]> git.sesse.net Git - vlc/blob - modules/access/linsys/linsys_sdi.h
Add support for Linear Systems (HD-)SDI cards
[vlc] / modules / access / linsys / linsys_sdi.h
1 /* sdi.h
2  *
3  * Shared header file for the Linux user-space API for
4  * Linear Systems Ltd. SMPTE 259M-C interface boards.
5  *
6  * Copyright (C) 2004-2010 Linear Systems Ltd.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  *   1. Redistributions of source code must retain the above copyright notice,
12  *      this list of conditions and the following disclaimer.
13  *
14  *   2. Redistributions in binary form must reproduce the above copyright
15  *      notice, this list of conditions and the following disclaimer in the
16  *      documentation and/or other materials provided with the distribution.
17  *
18  *   3. Neither the name of Linear Systems Ltd. nor the names of its
19  *      contributors may be used to endorse or promote products derived from
20  *      this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY LINEAR SYSTEMS LTD. "AS IS" AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL LINEAR SYSTEMS LTD. OR CONTRIBUTORS
26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * Linear Systems can be contacted at <http://www.linsys.ca/>.
35  *
36  */
37
38 #ifndef _SDI_H
39 #define _SDI_H
40
41 /* Driver info */
42 #define SDI_DRIVER_NAME "sdi"
43
44 #define SDI_MAJOR 121   /* Set to 0 for dynamic allocation.
45                          * Otherwise, 121 is available.
46                          * See /usr/src/linux/Documentation/devices.txt */
47
48 #define SDI_TX_BUFFERS_MIN 2 /* This must be at least 2 */
49 /* The minimum transmit buffer size must be positive, divisible by 4,
50  * and large enough that the buffers aren't transferred to the onboard FIFOs
51  * too quickly for the machine to handle the interrupts.
52  * This is especially a problem at startup, when the FIFOs are empty.
53  * Relevant factors include onboard FIFO size, PCI bus throughput,
54  * processor speed, and interrupt latency. */
55 #define SDI_TX_BUFSIZE_MIN 1024
56 #define SDI_RX_BUFFERS_MIN 2 /* This must be at least 2 */
57 #define SDI_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */
58
59 #define SDI_TX_BUFFERS 25 /* This must be at least 2 */
60 #define SDI_TX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */
61 #define SDI_RX_BUFFERS 25 /* This must be at least 2 */
62 #define SDI_RX_BUFSIZE 1235520 /* This must be positive and divisible by 4 */
63
64 /* Ioctl () definitions */
65 #define SDI_IOC_MAGIC '=' /* This ioctl magic number is currently free. See
66                            * /usr/src/linux/Documentation/ioctl-number.txt */
67
68 #define SDI_IOC_TXGETCAP        _IOR(SDI_IOC_MAGIC, 1, unsigned int)
69 #define SDI_IOC_TXGETEVENTS     _IOR(SDI_IOC_MAGIC, 2, unsigned int)
70 #define SDI_IOC_TXGETBUFLEVEL   _IOR(SDI_IOC_MAGIC, 3, unsigned int)
71 #define SDI_IOC_TXGETTXD        _IOR(SDI_IOC_MAGIC, 4, int)
72
73 #define SDI_IOC_RXGETCAP        _IOR(SDI_IOC_MAGIC, 65, unsigned int)
74 #define SDI_IOC_RXGETEVENTS     _IOR(SDI_IOC_MAGIC, 66, unsigned int)
75 #define SDI_IOC_RXGETBUFLEVEL   _IOR(SDI_IOC_MAGIC, 67, unsigned int)
76 #define SDI_IOC_RXGETCARRIER    _IOR(SDI_IOC_MAGIC, 68, int)
77 #define SDI_IOC_RXGETSTATUS     _IOR(SDI_IOC_MAGIC, 69, int)
78
79 #define SDI_IOC_GETID           _IOR(SDI_IOC_MAGIC, 129, unsigned int)
80 #define SDI_IOC_GETVERSION      _IOR(SDI_IOC_MAGIC, 130, unsigned int)
81 /* Provide compatibility with applications compiled for older API */
82 #define SDI_IOC_QBUF_DEPRECATED         _IOR(SDI_IOC_MAGIC, 131, unsigned int)
83 #define SDI_IOC_QBUF_DEPRECATED2        _IOW(SDI_IOC_MAGIC, 131, unsigned int)
84 #define SDI_IOC_QBUF            _IO(SDI_IOC_MAGIC, 131)
85 /* Provide compatibility with applications compiled for older API */
86 #define SDI_IOC_DQBUF_DEPRECATED        _IOR(SDI_IOC_MAGIC, 132, unsigned int)
87 #define SDI_IOC_DQBUF_DEPRECATED2       _IOW(SDI_IOC_MAGIC, 132, unsigned int)
88 #define SDI_IOC_DQBUF           _IO(SDI_IOC_MAGIC, 132)
89
90 /* Transmitter event flag bit locations */
91 #define SDI_EVENT_TX_BUFFER_ORDER       0
92 #define SDI_EVENT_TX_BUFFER             (1 << SDI_EVENT_TX_BUFFER_ORDER)
93 #define SDI_EVENT_TX_FIFO_ORDER         1
94 #define SDI_EVENT_TX_FIFO               (1 << SDI_EVENT_TX_FIFO_ORDER)
95 #define SDI_EVENT_TX_DATA_ORDER         2
96 #define SDI_EVENT_TX_DATA               (1 << SDI_EVENT_TX_DATA_ORDER)
97
98 /* Receiver event flag bit locations */
99 #define SDI_EVENT_RX_BUFFER_ORDER       0
100 #define SDI_EVENT_RX_BUFFER             (1 << SDI_EVENT_RX_BUFFER_ORDER)
101 #define SDI_EVENT_RX_FIFO_ORDER         1
102 #define SDI_EVENT_RX_FIFO               (1 << SDI_EVENT_RX_FIFO_ORDER)
103 #define SDI_EVENT_RX_CARRIER_ORDER      2
104 #define SDI_EVENT_RX_CARRIER            (1 << SDI_EVENT_RX_CARRIER_ORDER)
105
106 /* Interface capabilities */
107 #define SDI_CAP_TX_RXCLKSRC     0x00000001
108
109 /* Transmitter clock source settings */
110 #define SDI_CTL_TX_CLKSRC_ONBOARD       0
111 #define SDI_CTL_TX_CLKSRC_EXT           1
112 #define SDI_CTL_TX_CLKSRC_RX            2
113
114 /* Mode settings */
115 #define SDI_CTL_MODE_8BIT       0
116 #define SDI_CTL_MODE_10BIT      1
117
118 #endif
119