Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / sys / linsys / include / sdiaudio.h
1 /* sdiaudio.h
2  *
3  * Shared header file for the Linux user-space API for
4  * Linear Systems Ltd. SMPTE 292M and SMPTE 259M-C Audio interface boards.
5  *
6  * Copyright (C) 2009 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 _SDIAUDIO_H
39 #define _SDIAUDIO_H
40
41 /* Driver info */
42 #define SDIAUDIO_DRIVER_NAME "sdiaudio"
43
44 #define SDIAUDIO_MAJOR 0        /* Set to 0 for dynamic allocation.
45                          * See /usr/src/linux/Documentation/devices.txt */
46
47 #define SDIAUDIO_TX_BUFFERS_MIN 2 /* This must be at least 2 */
48 /* The minimum transmit buffer size must be positive, divisible by 4,
49  * and large enough that the buffers aren't transferred to the onboard FIFOs
50  * too quickly for the machine to handle the interrupts.
51  * This is especially a problem at startup, when the FIFOs are empty.
52  * Relevant factors include onboard FIFO size, PCI bus throughput,
53  * processor speed, and interrupt latency. */
54 #define SDIAUDIO_TX_BUFSIZE_MIN 1024
55 #define SDIAUDIO_RX_BUFFERS_MIN 2 /* This must be at least 2 */
56 #define SDIAUDIO_RX_BUFSIZE_MIN 8 /* This must be positive and divisible by 4 */
57
58 #define SDIAUDIO_TX_BUFFERS 30 /* This must be at least 2 */
59 #define SDIAUDIO_TX_BUFSIZE 6400 /* This must be positive and divisible by 4 */
60 #define SDIAUDIO_RX_BUFFERS 30 /* This must be at least 2 */
61 #define SDIAUDIO_RX_BUFSIZE 6400 /* This must be positive and divisible by 4 */
62
63 /* Ioctl () definitions */
64 #define SDIAUDIO_IOC_MAGIC '~' /* This ioctl magic number is currently free. See
65                            * /usr/src/linux/Documentation/ioctl-number.txt */
66
67 #define SDIAUDIO_IOC_TXGETCAP                   _IOR(SDIAUDIO_IOC_MAGIC, 1, unsigned int)
68 #define SDIAUDIO_IOC_TXGETEVENTS                _IOR(SDIAUDIO_IOC_MAGIC, 2, unsigned int)
69 #define SDIAUDIO_IOC_TXGETBUFLEVEL              _IOR(SDIAUDIO_IOC_MAGIC, 3, unsigned int)
70 #define SDIAUDIO_IOC_TXGETTXD                   _IOR(SDIAUDIO_IOC_MAGIC, 4, int)
71
72 #define SDIAUDIO_IOC_RXGETCAP                   _IOR(SDIAUDIO_IOC_MAGIC, 65, unsigned int)
73 #define SDIAUDIO_IOC_RXGETEVENTS                _IOR(SDIAUDIO_IOC_MAGIC, 66, unsigned int)
74 #define SDIAUDIO_IOC_RXGETBUFLEVEL              _IOR(SDIAUDIO_IOC_MAGIC, 67, unsigned int)
75 #define SDIAUDIO_IOC_RXGETCARRIER               _IOR(SDIAUDIO_IOC_MAGIC, 68, int)
76 #define SDIAUDIO_IOC_RXGETSTATUS                _IOR(SDIAUDIO_IOC_MAGIC, 69, int)
77 #define SDIAUDIO_IOC_RXGETAUDIOGR0ERROR         _IOR(SDIAUDIO_IOC_MAGIC, 70, unsigned int)
78 #define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYA        _IOR(SDIAUDIO_IOC_MAGIC, 71, unsigned int)
79 #define SDIAUDIO_IOC_RXGETAUDIOGR0DELAYB        _IOR(SDIAUDIO_IOC_MAGIC, 72, unsigned int)
80 #define SDIAUDIO_IOC_RXGETNONAUDIO              _IOR(SDIAUDIO_IOC_MAGIC, 73, unsigned int)
81 #define SDIAUDIO_IOC_RXGETAUDSTAT               _IOR(SDIAUDIO_IOC_MAGIC, 74, unsigned int)
82 #define SDIAUDIO_IOC_RXGETAUDRATE               _IOR(SDIAUDIO_IOC_MAGIC, 75, unsigned int)
83
84 #define SDIAUDIO_IOC_GETID                      _IOR(SDIAUDIO_IOC_MAGIC, 129, unsigned int)
85 #define SDIAUDIO_IOC_GETVERSION                 _IOR(SDIAUDIO_IOC_MAGIC, 130, unsigned int)
86 #define SDIAUDIO_IOC_QBUF                       _IOW(SDIAUDIO_IOC_MAGIC, 131, unsigned int)
87 #define SDIAUDIO_IOC_DQBUF                      _IOW(SDIAUDIO_IOC_MAGIC, 132, unsigned int)
88
89 /* Transmitter event flag bit locations */
90 #define SDIAUDIO_EVENT_TX_BUFFER_ORDER  0
91 #define SDIAUDIO_EVENT_TX_BUFFER        (1 << SDIAUDIO_EVENT_TX_BUFFER_ORDER)
92 #define SDIAUDIO_EVENT_TX_FIFO_ORDER    1
93 #define SDIAUDIO_EVENT_TX_FIFO          (1 << SDIAUDIO_EVENT_TX_FIFO_ORDER)
94 #define SDIAUDIO_EVENT_TX_DATA_ORDER    2
95 #define SDIAUDIO_EVENT_TX_DATA          (1 << SDIAUDIO_EVENT_TX_DATA_ORDER)
96
97 /* Receiver event flag bit locations */
98 #define SDIAUDIO_EVENT_RX_BUFFER_ORDER  0
99 #define SDIAUDIO_EVENT_RX_BUFFER        (1 << SDIAUDIO_EVENT_RX_BUFFER_ORDER)
100 #define SDIAUDIO_EVENT_RX_FIFO_ORDER    1
101 #define SDIAUDIO_EVENT_RX_FIFO          (1 << SDIAUDIO_EVENT_RX_FIFO_ORDER)
102 #define SDIAUDIO_EVENT_RX_CARRIER_ORDER 2
103 #define SDIAUDIO_EVENT_RX_CARRIER       (1 << SDIAUDIO_EVENT_RX_CARRIER_ORDER)
104 #define SDIAUDIO_EVENT_RX_DATA_ORDER    3
105 #define SDIAUDIO_EVENT_RX_DATA          (1 << SDIAUDIO_EVENT_RX_DATA_ORDER)
106
107 /* Interface capabilities */
108 #define SDIAUDIO_CAP_RX_CD              0x00000001
109 #define SDIAUDIO_CAP_RX_DATA            0x00000002
110 #define SDIAUDIO_CAP_RX_STATS           0x00000004
111 #define SDIAUDIO_CAP_RX_NONAUDIO        0x00000008
112 #define SDIAUDIO_CAP_RX_24BIT           0x00000010
113
114 /* Audio sample size */
115 #define SDIAUDIO_CTL_AUDSAMP_SZ_16      16 /* 16 bit */
116 #define SDIAUDIO_CTL_AUDSAMP_SZ_24      24 /* 24 bit */
117 #define SDIAUDIO_CTL_AUDSAMP_SZ_32      32 /* 32 bit */
118
119 /* Audio channel enable */
120 #define SDIAUDIO_CTL_AUDCH_EN_0         0 /* 0 channel/disable audio */
121 #define SDIAUDIO_CTL_AUDCH_EN_2         2 /* 2 channel */
122 #define SDIAUDIO_CTL_AUDCH_EN_4         4 /* 4 channel */
123 #define SDIAUDIO_CTL_AUDCH_EN_6         6 /* 6 channel */
124 #define SDIAUDIO_CTL_AUDCH_EN_8         8 /* 8 channel */
125
126 #define SDIAUDIO_CTL_PCM_ALLCHANNEL             0x00000000 /* PCM for channel 1 - 8 */
127 #define SDIAUDIO_CTL_NONAUDIO_ALLCHANNEL        0x000000ff /* No audio for channel 1 - 8 */
128
129 /* Active audio channels status */
130 #define SDIAUDIO_CTL_ACT_CHAN_0         0x00 /* no audio control packets */
131 #define SDIAUDIO_CTL_ACT_CHAN_2         0x03 /* 2 channels */
132 #define SDIAUDIO_CTL_ACT_CHAN_4         0x0f /* 4 channels */
133 #define SDIAUDIO_CTL_ACT_CHAN_6         0x3f /* 6 channels */
134 #define SDIAUDIO_CTL_ACT_CHAN_8         0xff /* 8 channels */
135
136 /* Audio rate */
137 #define SDIAUDIO_CTL_SYNC_48_KHZ        0 /* Synchronous, 48 kHz */
138 #define SDIAUDIO_CTL_SYNC_44_1_KHZ      2 /* Synchronous, 44.1 kHz */
139 #define SDIAUDIO_CTL_SYNC_32_KHZ        4 /* Synchronous, 32 kHz */
140 #define SDIAUDIO_CTL_SYNC_96_KHZ        8 /* Synchronous, 96 kHz */
141 #define SDIAUDIO_CTL_SYNC_FREE_RUNNING  14 /* Synchronous, free running */
142 #define SDIAUDIO_CTL_ASYNC_48_KHZ       1 /* Asynchronous, 48 kHz */
143 #define SDIAUDIO_CTL_ASYNC_44_1_KHZ     3 /* Asynchronous, 44.1 kHz */
144 #define SDIAUDIO_CTL_ASYNC_32_KHZ       5 /* Asynchronous, 32 kHz */
145 #define SDIAUDIO_CTL_ASYNC_96_KHZ       9 /* Asynchronous, 96 kHz */
146 #define SDIAUDIO_CTL_ASYNC_FREE_RUNNING 15 /* Asynchronous, free running */
147
148 #endif
149