root/trunk/libffado/src/libavc/general/avc_extended_cmd_generic.h

Revision 618, 9.1 kB (checked in by ppalmers, 13 years ago)

move serialization routines to libutil such that they can be used for non-AVC stuff too (fireworks EFC)

  • 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 namespace AVC {
30
31 ////////////////////////////////////////////////////////////
32
33 class PlugAddressData : public IBusData {
34 };
35
36 ////////////////////////////////////////////////////////////
37
38 class UnitPlugAddress : public PlugAddressData
39 {
40 public:
41     enum EPlugType {
42         ePT_PCR              = 0x00,
43         ePT_ExternalPlug     = 0x01,
44         ePT_AsynchronousPlug = 0x02,
45     ePT_Unknown          = 0xff,
46     };
47
48     UnitPlugAddress( EPlugType plugType,  plug_type_t plugId );
49     virtual ~UnitPlugAddress();
50
51     virtual bool serialize( Util::IOSSerialize& se );
52     virtual bool deserialize( Util::IISDeserialize& de );
53     virtual UnitPlugAddress* clone() const;
54
55     plug_id_t   m_plugType;
56     plug_type_t m_plugId;
57     reserved_t  m_reserved;
58 };
59
60 ////////////////////////////////////////////////////////////
61
62 class SubunitPlugAddress : public PlugAddressData
63 {
64 public:
65     SubunitPlugAddress( plug_id_t plugId );
66     virtual ~SubunitPlugAddress();
67
68     virtual bool serialize( Util::IOSSerialize& se );
69     virtual bool deserialize( Util::IISDeserialize& de );
70     virtual SubunitPlugAddress* clone() const;
71
72     plug_id_t m_plugId;
73     reserved_t m_reserved0;
74     reserved_t m_reserved1;
75 };
76
77
78 ////////////////////////////////////////////////////////////
79
80 class FunctionBlockPlugAddress : public PlugAddressData
81 {
82 public:
83     FunctionBlockPlugAddress( function_block_type_t functionBlockType,
84                               function_block_id_t functionBlockId,
85                               plug_id_t plugId );
86     virtual ~FunctionBlockPlugAddress();
87
88     virtual bool serialize( Util::IOSSerialize& se );
89     virtual bool deserialize( Util::IISDeserialize& de );
90     virtual FunctionBlockPlugAddress* clone() const;
91
92     function_block_type_t m_functionBlockType;
93     function_block_id_t   m_functionBlockId;
94     plug_id_t             m_plugId;
95 };
96
97 ////////////////////////////////////////////////////////////
98
99 class UndefinedPlugAddress : public PlugAddressData
100 {
101 public:
102     UndefinedPlugAddress();
103     virtual ~UndefinedPlugAddress();
104
105     virtual bool serialize( Util::IOSSerialize& se );
106     virtual bool deserialize( Util::IISDeserialize& de );
107     virtual UndefinedPlugAddress* clone() const;
108
109     reserved_t m_reserved0;
110     reserved_t m_reserved1;
111     reserved_t m_reserved2;
112 };
113
114 ////////////////////////////////////////////////////////////
115 ////////////////////////////////////////////////////////////
116
117 class UnitPlugSpecificDataPlugAddress : public PlugAddressData
118 {
119 public:
120     enum EPlugType {
121         ePT_PCR              = 0x00,
122         ePT_ExternalPlug     = 0x01,
123         ePT_AsynchronousPlug = 0x02,
124     };
125
126     UnitPlugSpecificDataPlugAddress( EPlugType plugType,
127                                      plug_type_t plugId );
128     virtual ~UnitPlugSpecificDataPlugAddress();
129
130     virtual bool serialize( Util::IOSSerialize& se );
131     virtual bool deserialize( Util::IISDeserialize& de );
132     virtual UnitPlugSpecificDataPlugAddress* clone() const;
133
134     plug_type_t m_plugType;
135     plug_id_t   m_plugId;
136     reserved_t  m_reserved0;
137     reserved_t  m_reserved1;
138     reserved_t  m_reserved2;
139 };
140
141 ////////////////////////////////////////////////////////////
142
143 class SubunitPlugSpecificDataPlugAddress : public PlugAddressData
144 {
145 public:
146     SubunitPlugSpecificDataPlugAddress( ESubunitType subunitType,
147                                         subunit_id_t subunitId,
148                                         plug_id_t plugId );
149     virtual ~SubunitPlugSpecificDataPlugAddress();
150
151     virtual bool serialize( Util::IOSSerialize& se );
152     virtual bool deserialize( Util::IISDeserialize& de );
153     virtual SubunitPlugSpecificDataPlugAddress* clone() const;
154
155     subunit_type_t m_subunitType;
156     subunit_id_t   m_subunitId;
157     plug_id_t      m_plugId;
158     reserved_t     m_reserved0;
159     reserved_t     m_reserved1;
160 };
161
162 ////////////////////////////////////////////////////////////
163
164 class FunctionBlockPlugSpecificDataPlugAddress : public PlugAddressData
165 {
166 public:
167     FunctionBlockPlugSpecificDataPlugAddress( ESubunitType subunitType,
168                                               subunit_id_t subunitId,
169                                               function_block_type_t functionBlockType,
170                                               function_block_id_t functionBlockId,
171                                               plug_id_t plugId);
172     virtual ~FunctionBlockPlugSpecificDataPlugAddress();
173
174     virtual bool serialize( Util::IOSSerialize& se );
175     virtual bool deserialize( Util::IISDeserialize& de );
176     virtual FunctionBlockPlugSpecificDataPlugAddress* clone() const;
177
178     subunit_type_t        m_subunitType;
179     subunit_id_t          m_subunitId;
180     function_block_type_t m_functionBlockType;
181     function_block_id_t   m_functionBlockId;
182     plug_id_t             m_plugId;
183 };
184
185 ////////////////////////////////////////////////////////////
186
187 class UndefinedPlugSpecificDataPlugAddress : public PlugAddressData
188 {
189 public:
190     UndefinedPlugSpecificDataPlugAddress();
191     virtual ~UndefinedPlugSpecificDataPlugAddress();
192
193     virtual bool serialize( Util::IOSSerialize& se );
194     virtual bool deserialize( Util::IISDeserialize& de );
195     virtual UndefinedPlugSpecificDataPlugAddress* clone() const;
196
197     reserved_t m_reserved0;
198     reserved_t m_reserved1;
199     reserved_t m_reserved2;
200     reserved_t m_reserved3;
201     reserved_t m_reserved4;
202 };
203
204 ////////////////////////////////////////////////////////////
205 ////////////////////////////////////////////////////////////
206
207 class PlugAddress : public IBusData {
208 public:
209     enum EPlugDirection {
210         ePD_Input     = 0x00,
211         ePD_Output    = 0x01,
212     ePD_Undefined = 0xff,
213     };
214
215     enum EPlugAddressMode {
216         ePAM_Unit          = 0x00,
217         ePAM_Subunit       = 0x01,
218         ePAM_FunctionBlock = 0x02,
219     ePAM_Undefined     = 0xff,
220     };
221
222     PlugAddress( EPlugDirection plugDirection,
223                  EPlugAddressMode plugAddressMode,
224                  UnitPlugAddress& unitPlugAddress );
225     PlugAddress( EPlugDirection plugDirection,
226                  EPlugAddressMode plugAddressMode,
227                  SubunitPlugAddress& subUnitPlugAddress );
228     PlugAddress( EPlugDirection plugDirection,
229                  EPlugAddressMode plugAddressMode,
230                  FunctionBlockPlugAddress& functionBlockPlugAddress );
231     PlugAddress( ); // undefined plug address
232     PlugAddress( const PlugAddress& pa );
233
234     virtual ~PlugAddress();
235
236     virtual bool serialize( Util::IOSSerialize& se );
237     virtual bool deserialize( Util::IISDeserialize& de );
238
239     virtual PlugAddress* clone() const;
240
241     plug_direction_t    m_plugDirection;
242     plug_address_mode_t m_addressMode;
243     PlugAddressData*    m_plugAddressData;
244 };
245
246 const char* plugAddressPlugDirectionToString( PlugAddress::EPlugDirection direction  );
247 const char* plugAddressAddressModeToString( PlugAddress::EPlugAddressMode mode );
248
249 ////////////////////////////////////////////////////////////
250
251 class PlugAddressSpecificData : public IBusData {
252 public:
253     enum EPlugDirection {
254         ePD_Input  = 0x00,
255         ePD_Output = 0x01,
256     };
257
258     enum EPlugAddressMode {
259         ePAM_Unit          = 0x00,
260         ePAM_Subunit       = 0x01,
261         ePAM_FunctionBlock = 0x02,
262         ePAM_Undefined     = 0xff,
263     };
264
265     PlugAddressSpecificData( EPlugDirection plugDirection,
266                  EPlugAddressMode plugAddressMode,
267                  UnitPlugSpecificDataPlugAddress& unitPlugAddress );
268     PlugAddressSpecificData( EPlugDirection plugDirection,
269                  EPlugAddressMode plugAddressMode,
270                  SubunitPlugSpecificDataPlugAddress& subUnitPlugAddress );
271     PlugAddressSpecificData( EPlugDirection plugDirection,
272                  EPlugAddressMode plugAddressMode,
273                  FunctionBlockPlugSpecificDataPlugAddress& functionBlockPlugAddress );
274     PlugAddressSpecificData( EPlugDirection plugDirection,
275                  EPlugAddressMode plugAddressMode );
276     PlugAddressSpecificData( const  PlugAddressSpecificData& pa );
277
278     virtual ~PlugAddressSpecificData();
279
280     virtual bool serialize( Util::IOSSerialize& se );
281     virtual bool deserialize( Util::IISDeserialize& de );
282
283     virtual PlugAddressSpecificData* clone() const;
284
285     plug_direction_t    m_plugDirection;
286     plug_address_mode_t m_addressMode;
287     PlugAddressData*    m_plugAddressData;
288 };
289
290 }
291
292 #endif
Note: See TracBrowser for help on using the browser.