root/branches/libffado-2.0/src/libavc/avc_definitions.h

Revision 1371, 4.5 kB (checked in by ppalmers, 14 years ago)

* implement our own code to do FCP transactions. the code from libavc had too much side-effects.
* remove libavc1394 as a dependency
* set the SPLIT_TIMEOUT value for the host controller such that late responses by the DM1x00 based devices are not discarded. Should fix the issues with FA-101 discovery. (re:
#155, #162)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef AVCDEFINITIONS_H
25 #define AVCDEFINITIONS_H
26
27 #include <cstring>
28 #include <cstdlib>
29 #include <ostream>
30 #include <libraw1394/raw1394.h>
31
32 namespace AVC {
33
34 typedef byte_t ctype_t;
35 typedef byte_t unit_t;
36 typedef byte_t unit_type_t;
37 typedef byte_t subunit_t;
38 typedef byte_t opcode_t;
39 typedef byte_t plug_type_t;
40 typedef byte_t plug_id_t;
41 typedef byte_t reserved_t;
42 typedef byte_t function_block_type_t;
43 typedef byte_t function_block_id_t;
44 typedef byte_t control_attribute_t;
45 typedef byte_t plug_direction_t;
46 typedef byte_t plug_address_mode_t;
47 typedef byte_t status_t;
48 typedef byte_t number_of_channels_t;
49 typedef byte_t stream_format_t;
50 typedef byte_t sampling_frequency_t;
51 typedef byte_t rate_control_t;
52 typedef byte_t number_of_stream_format_infos_t;
53 typedef byte_t nr_of_plugs_t;
54 typedef byte_t subunit_id_t;
55 typedef byte_t subfunction_t;
56 typedef byte_t opcode_t;
57 typedef byte_t page_t;
58 typedef byte_t extension_code_t;
59 typedef byte_t subunit_type_t;
60 typedef byte_t max_subunit_id_t;
61 typedef byte_t nr_of_channels_t;
62 typedef byte_t stream_position_t;
63 typedef byte_t stream_position_location_t;
64 typedef byte_t nr_of_clusters_t;
65 typedef byte_t string_length_t;
66 typedef byte_t cluster_index_t;
67 typedef byte_t port_type_t;
68 typedef byte_t number_of_output_plugs_t;
69 typedef byte_t function_block_type_t;
70 typedef byte_t function_block_id_t;
71 typedef byte_t function_block_special_purpose_t;
72 typedef byte_t no_of_input_plugs_t;
73 typedef byte_t no_of_output_plugs_t;
74 typedef byte_t info_type_t;
75 typedef byte_t audio_channel_number_t;
76 typedef byte_t selector_length_t;
77 typedef byte_t control_selector_t;
78 typedef byte_t control_data_length_t;
79 typedef uint16_t control_data_ext_length_t;
80 typedef uint16_t mixer_level_t;
81 typedef byte_t mixer_programmable_state_t;
82 typedef byte_t input_fb_plug_number_t;
83 typedef byte_t input_audio_channel_number_t;
84 typedef byte_t output_audio_channel_number_t;
85 typedef byte_t status_selector_t;
86
87 typedef quadlet_t company_id_t;
88
89 enum ESubunitType {
90     eST_Monitor       = 0x00,
91     eST_Audio         = 0x01,
92     eST_Printer       = 0x02,
93     eST_Disc          = 0x03,
94     eST_VCR           = 0x04,
95     eST_Tuner         = 0x05,
96     eST_CA            = 0x06,
97     eST_Camera        = 0x07,
98     eST_Panel         = 0x09,
99     eST_BulltinBoard  = 0x0A,
100     eST_CameraStorage = 0x0B,
101     eST_Music         = 0x0C,
102     eST_VendorUnique  = 0x1C,
103     eST_Reserved      = 0x1D,
104     eST_Extended      = 0x1E,
105     eST_Unit          = 0x1F,
106 };
107
108 #define AVC1394_SUBUNIT_ID_RESERVED 0x06
109
110 enum ESubunitType byteToSubunitType(byte_t s);
111
112 /**
113  * \brief the possible sampling frequencies
114  */
115 enum ESamplingFrequency {
116     eSF_22050Hz = 0x00,
117     eSF_24000Hz = 0x01,
118     eSF_32000Hz = 0x02,
119     eSF_44100Hz = 0x03,
120     eSF_48000Hz = 0x04,
121     eSF_88200Hz = 0x0A,
122     eSF_96000Hz = 0x05,
123     eSF_176400Hz = 0x06,
124     eSF_192000Hz = 0x07,
125     eSF_AnyLow   = 0x0B,
126     eSF_AnyMid   = 0x0C,
127     eSF_AnyHigh  = 0x0D,
128     eSF_None     = 0x0E,
129     eSF_DontCare = 0x0F,
130 };
131
132 /**
133  * \brief Convert from ESamplingFrequency to an integer
134  * @param freq
135  * @return
136  */
137 int convertESamplingFrequency(ESamplingFrequency freq);
138 /**
139  * \brief Convert from integer to ESamplingFrequency
140  * @param sampleRate
141  * @return
142  */
143 ESamplingFrequency parseSampleRate( int sampleRate );
144
145 std::ostream& operator<<( std::ostream& stream, ESamplingFrequency samplingFrequency );
146
147 /**
148  * \brief Convert from a FDF SFC field value to an integer sample rate
149  * @param fdf fdf sfc field value
150  * @return sample rate
151  */
152 unsigned int fdfSfcToSampleRate(byte_t fdf);
153
154 /**
155  * \brief Convert from an integer sample rate to a78 FDF SFC field value
156  * @param rate integer sample rate
157  * @return fdf sfc field value
158  */
159 byte_t sampleRateToFdfSfc(unsigned int rate);
160
161 }
162
163 #endif // AVCDEFINITIONS_H
Note: See TracBrowser for help on using the browser.