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

Revision 1498, 3.5 kB (checked in by ppalmers, 15 years ago)

Merge all changes from 2.0 branch into trunk (since r1361). This _should_ contain all forward merges done in the mean time. At this moment in time both branches should be in sync.

  • 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 AVCGENERIC_H
25 #define AVCGENERIC_H
26
27 #include "../avc_definitions.h"
28 #include "debugmodule/debugmodule.h"
29
30 #include "fbtypes.h"
31
32 class Ieee1394Service;
33
34 namespace Util {
35         namespace Cmd {
36                 class IOSSerialize;
37                 class IISDeserialize;
38         }
39 };
40
41 namespace AVC {
42
43 const int fcpFrameMaxLength = 512;
44 typedef unsigned char fcp_frame_t[fcpFrameMaxLength];
45
46 enum EAVCDiscoveryMode {
47     eDM_BeBoB        = 0x00,
48     eDM_GenericAVC   = 0x01,
49     eDM_Invalid      = 0xFF,
50 };
51
52 class IBusData {
53 public:
54     IBusData() {}
55     virtual ~IBusData() {}
56
57     virtual bool serialize( Util::Cmd::IOSSerialize& se ) = 0;
58     virtual bool deserialize( Util::Cmd::IISDeserialize& de ) = 0;
59
60     virtual IBusData* clone() const = 0;
61
62 protected:
63     DECLARE_DEBUG_MODULE;
64 };
65
66 class AVCCommand
67 {
68 public:
69     enum EResponse {
70         eR_Unknown        = 0xff,
71         eR_NotImplemented = 0x08,
72         eR_Accepted       = 0x09,
73         eR_Rejected       = 0x0A,
74         eR_InTransition   = 0x0B,
75         eR_Implemented    = 0x0C,
76         eR_Changed        = 0x0D,
77         eR_Interim        = 0x0F,
78     };
79
80     enum ECommandType {
81         eCT_Control         = 0x00,
82         eCT_Status          = 0x01,
83         eCT_SpecificInquiry = 0x02,
84         eCT_Notify          = 0x03,
85         eCT_GeneralInquiry  = 0x04,
86         eCT_Unknown         = 0xff,
87     };
88
89     virtual bool serialize( Util::Cmd::IOSSerialize& se );
90     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
91
92     virtual bool setCommandType( ECommandType commandType );
93     virtual bool fire();
94
95     EResponse getResponse();
96
97     bool setNodeId( fb_nodeid_t nodeId );
98     bool setSubunitType( ESubunitType subunitType );
99     bool setSubunitId( subunit_id_t subunitId );
100
101     ESubunitType getSubunitType();
102     subunit_id_t getSubunitId();
103
104     bool setVerbose( int verboseLevel );
105     bool setVerboseLevel( int verboseLevel )
106         { return setVerbose(verboseLevel);};
107
108     int getVerboseLevel();
109
110     virtual const char* getCmdName() const = 0;
111
112 protected:
113     void showFcpFrame( const unsigned char* buf,
114                unsigned short frameSize ) const;
115
116 protected:
117     AVCCommand( Ieee1394Service& ieee1394service, opcode_t opcode );
118     virtual ~AVCCommand() {}
119
120     ECommandType getCommandType();
121
122     Ieee1394Service* m_p1394Service;
123     fb_nodeid_t      m_nodeId;
124
125     fcp_frame_t      m_fcpFrame;
126
127 private:
128     ctype_t      m_ctype;
129     subunit_t    m_subunit;
130     opcode_t     m_opcode;
131     EResponse    m_eResponse;
132     ECommandType m_commandType;
133
134 protected:
135     DECLARE_DEBUG_MODULE;
136 };
137
138
139 const char* subunitTypeToString( subunit_type_t subunitType );
140 const char* responseToString( AVCCommand::EResponse eResponse );
141
142 }
143
144 #endif // AVCGENERIC_H
Note: See TracBrowser for help on using the browser.