root/branches/echoaudio/src/libavc/avc_extended_cmd_generic.h

Revision 499, 8.9 kB (checked in by ppalmers, 17 years ago)

- implement AV/C descriptor and infoblock parsing
- implement AV/C music subunit status descriptor and related infoblocks

- small changes and generalizations

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library 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 GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
22  */
23
24 #ifndef AVCEXTENDEDCMDGENERIC_H
25 #define AVCEXTENDEDCMDGENERIC_H
26
27 #include "avc_generic.h"
28
29 ////////////////////////////////////////////////////////////
30
31 class PlugAddressData : public IBusData {
32 };
33
34 ////////////////////////////////////////////////////////////
35
36 class UnitPlugAddress : public PlugAddressData
37 {
38 public:
39     enum EPlugType {
40         ePT_PCR              = 0x00,
41         ePT_ExternalPlug     = 0x01,
42         ePT_AsynchronousPlug = 0x02,
43     ePT_Unknown          = 0xff,
44     };
45
46     UnitPlugAddress( EPlugType plugType,  plug_type_t plugId );
47     virtual ~UnitPlugAddress();
48
49     virtual bool serialize( IOSSerialize& se );
50     virtual bool deserialize( IISDeserialize& de );
51     virtual UnitPlugAddress* clone() const;
52
53     plug_id_t   m_plugType;
54     plug_type_t m_plugId;
55     reserved_t  m_reserved;
56 };
57
58 ////////////////////////////////////////////////////////////
59
60 class SubunitPlugAddress : public PlugAddressData
61 {
62 public:
63     SubunitPlugAddress( plug_id_t plugId );
64     virtual ~SubunitPlugAddress();
65
66     virtual bool serialize( IOSSerialize& se );
67     virtual bool deserialize( IISDeserialize& de );
68     virtual SubunitPlugAddress* clone() const;
69
70     plug_id_t m_plugId;
71     reserved_t m_reserved0;
72     reserved_t m_reserved1;
73 };
74
75
76 ////////////////////////////////////////////////////////////
77
78 class FunctionBlockPlugAddress : public PlugAddressData
79 {
80 public:
81     FunctionBlockPlugAddress( function_block_type_t functionBlockType,
82                               function_block_id_t functionBlockId,
83                               plug_id_t plugId );
84     virtual ~FunctionBlockPlugAddress();
85
86     virtual bool serialize( IOSSerialize& se );
87     virtual bool deserialize( IISDeserialize& de );
88     virtual FunctionBlockPlugAddress* clone() const;
89
90     function_block_type_t m_functionBlockType;
91     function_block_id_t   m_functionBlockId;
92     plug_id_t             m_plugId;
93 };
94
95 ////////////////////////////////////////////////////////////
96
97 class UndefinedPlugAddress : public PlugAddressData
98 {
99 public:
100     UndefinedPlugAddress();
101     virtual ~UndefinedPlugAddress();
102
103     virtual bool serialize( IOSSerialize& se );
104     virtual bool deserialize( IISDeserialize& de );
105     virtual UndefinedPlugAddress* clone() const;
106
107     reserved_t m_reserved0;
108     reserved_t m_reserved1;
109     reserved_t m_reserved2;
110 };
111
112 ////////////////////////////////////////////////////////////
113 ////////////////////////////////////////////////////////////
114
115 class UnitPlugSpecificDataPlugAddress : public PlugAddressData
116 {
117 public:
118     enum EPlugType {
119         ePT_PCR              = 0x00,
120         ePT_ExternalPlug     = 0x01,
121         ePT_AsynchronousPlug = 0x02,
122     };
123
124     UnitPlugSpecificDataPlugAddress( EPlugType plugType,
125                                      plug_type_t plugId );
126     virtual ~UnitPlugSpecificDataPlugAddress();
127
128     virtual bool serialize( IOSSerialize& se );
129     virtual bool deserialize( IISDeserialize& de );
130     virtual UnitPlugSpecificDataPlugAddress* clone() const;
131
132     plug_type_t m_plugType;
133     plug_id_t   m_plugId;
134     reserved_t  m_reserved0;
135     reserved_t  m_reserved1;
136     reserved_t  m_reserved2;
137 };
138
139 ////////////////////////////////////////////////////////////
140
141 class SubunitPlugSpecificDataPlugAddress : public PlugAddressData
142 {
143 public:
144     SubunitPlugSpecificDataPlugAddress( ESubunitType subunitType,
145                                         subunit_id_t subunitId,
146                                         plug_id_t plugId );
147     virtual ~SubunitPlugSpecificDataPlugAddress();
148
149     virtual bool serialize( IOSSerialize& se );
150     virtual bool deserialize( IISDeserialize& de );
151     virtual SubunitPlugSpecificDataPlugAddress* clone() const;
152
153     subunit_type_t m_subunitType;
154     subunit_id_t   m_subunitId;
155     plug_id_t      m_plugId;
156     reserved_t     m_reserved0;
157     reserved_t     m_reserved1;
158 };
159
160 ////////////////////////////////////////////////////////////
161
162 class FunctionBlockPlugSpecificDataPlugAddress : public PlugAddressData
163 {
164 public:
165     FunctionBlockPlugSpecificDataPlugAddress( ESubunitType subunitType,
166                                               subunit_id_t subunitId,
167                                               function_block_type_t functionBlockType,
168                                               function_block_id_t functionBlockId,
169                                               plug_id_t plugId);
170     virtual ~FunctionBlockPlugSpecificDataPlugAddress();
171
172     virtual bool serialize( IOSSerialize& se );
173     virtual bool deserialize( IISDeserialize& de );
174     virtual FunctionBlockPlugSpecificDataPlugAddress* clone() const;
175
176     subunit_type_t        m_subunitType;
177     subunit_id_t          m_subunitId;
178     function_block_type_t m_functionBlockType;
179     function_block_id_t   m_functionBlockId;
180     plug_id_t             m_plugId;
181 };
182
183 ////////////////////////////////////////////////////////////
184
185 class UndefinedPlugSpecificDataPlugAddress : public PlugAddressData
186 {
187 public:
188     UndefinedPlugSpecificDataPlugAddress();
189     virtual ~UndefinedPlugSpecificDataPlugAddress();
190
191     virtual bool serialize( IOSSerialize& se );
192     virtual bool deserialize( IISDeserialize& de );
193     virtual UndefinedPlugSpecificDataPlugAddress* clone() const;
194
195     reserved_t m_reserved0;
196     reserved_t m_reserved1;
197     reserved_t m_reserved2;
198     reserved_t m_reserved3;
199     reserved_t m_reserved4;
200 };
201
202 ////////////////////////////////////////////////////////////
203 ////////////////////////////////////////////////////////////
204
205 class PlugAddress : public IBusData {
206 public:
207     enum EPlugDirection {
208         ePD_Input     = 0x00,
209         ePD_Output    = 0x01,
210     ePD_Undefined = 0xff,
211     };
212
213     enum EPlugAddressMode {
214         ePAM_Unit          = 0x00,
215         ePAM_Subunit       = 0x01,
216         ePAM_FunctionBlock = 0x02,
217     ePAM_Undefined     = 0xff,
218     };
219
220     PlugAddress( EPlugDirection plugDirection,
221                  EPlugAddressMode plugAddressMode,
222                  UnitPlugAddress& unitPlugAddress );
223     PlugAddress( EPlugDirection plugDirection,
224                  EPlugAddressMode plugAddressMode,
225                  SubunitPlugAddress& subUnitPlugAddress );
226     PlugAddress( EPlugDirection plugDirection,
227                  EPlugAddressMode plugAddressMode,
228                  FunctionBlockPlugAddress& functionBlockPlugAddress );
229     PlugAddress( ); // undefined plug address
230     PlugAddress( const PlugAddress& pa );
231
232     virtual ~PlugAddress();
233
234     virtual bool serialize( IOSSerialize& se );
235     virtual bool deserialize( IISDeserialize& de );
236
237     virtual PlugAddress* clone() const;
238
239     plug_direction_t    m_plugDirection;
240     plug_address_mode_t m_addressMode;
241     PlugAddressData*    m_plugAddressData;
242 };
243
244 const char* plugAddressPlugDirectionToString( PlugAddress::EPlugDirection direction  );
245 const char* plugAddressAddressModeToString( PlugAddress::EPlugAddressMode mode );
246
247 ////////////////////////////////////////////////////////////
248
249 class PlugAddressSpecificData : public IBusData {
250 public:
251     enum EPlugDirection {
252         ePD_Input  = 0x00,
253         ePD_Output = 0x01,
254     };
255
256     enum EPlugAddressMode {
257         ePAM_Unit          = 0x00,
258         ePAM_Subunit       = 0x01,
259         ePAM_FunctionBlock = 0x02,
260         ePAM_Undefined     = 0xff,
261     };
262
263     PlugAddressSpecificData( EPlugDirection plugDirection,
264                  EPlugAddressMode plugAddressMode,
265                  UnitPlugSpecificDataPlugAddress& unitPlugAddress );
266     PlugAddressSpecificData( EPlugDirection plugDirection,
267                  EPlugAddressMode plugAddressMode,
268                  SubunitPlugSpecificDataPlugAddress& subUnitPlugAddress );
269     PlugAddressSpecificData( EPlugDirection plugDirection,
270                  EPlugAddressMode plugAddressMode,
271                  FunctionBlockPlugSpecificDataPlugAddress& functionBlockPlugAddress );
272     PlugAddressSpecificData( EPlugDirection plugDirection,
273                  EPlugAddressMode plugAddressMode );
274     PlugAddressSpecificData( const  PlugAddressSpecificData& pa );
275
276     virtual ~PlugAddressSpecificData();
277
278     virtual bool serialize( IOSSerialize& se );
279     virtual bool deserialize( IISDeserialize& de );
280
281     virtual PlugAddressSpecificData* clone() const;
282
283     plug_direction_t    m_plugDirection;
284     plug_address_mode_t m_addressMode;
285     PlugAddressData*    m_plugAddressData;
286 };
287
288
289 #endif
Note: See TracBrowser for help on using the browser.