2 * Copyright (C) 2005-2008 by Daniel Wagner
3 * Copyright (C) 2005-2008 by Jonathan Woithe
4 * Copyright (C) 2005-2008 by Pieter Palmers
6 * This file is part of FFADO
7 * FFADO = Free Firewire (pro-)audio drivers for linux
9 * FFADO is based upon FreeBoB
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or
14 * (at your option) version 3 of the License.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 #include "libutil/serialize.h"
33 #include "debugmodule/debugmodule.h"
35 #include "libcontrol/Element.h"
39 class Ieee1394Service
;
42 : public Control::Element
45 ConfigRom( Ieee1394Service
& ieee1394service
, fb_nodeid_t nodeId
);
46 virtual ~ConfigRom() {};
48 Ieee1394Service
& get1394Service();
52 bool operator == ( const ConfigRom
& rhs
);
54 const fb_nodeid_t
getNodeId() const;
55 const fb_octlet_t
getGuid() const;
56 const std::string
getGuidString() const;
57 const std::string
getModelName() const;
58 const std::string
getVendorName() const;
60 const unsigned int getModelId() const;
61 // FIXME: isn't this the same as getNodeVendorId?
62 const unsigned int getVendorId() const;
63 const unsigned int getUnitSpecifierId() const;
64 const unsigned int getUnitVersion() const;
66 bool isIsoResourseManager() const
67 { return m_isIsoResourceManager
; }
68 bool isCycleMasterCapable() const
69 { return m_isCycleMasterCapable
; }
70 bool isSupportsIsoOperations() const
71 { return m_isSupportIsoOperations
; }
72 bool isBusManagerCapable() const
73 { return m_isBusManagerCapable
; }
74 fb_byte_t
getCycleClockAccurancy() const
75 { return m_cycleClkAcc
; }
76 fb_byte_t
getMaxRec() const
78 unsigned short getAsyMaxPayload() const;
80 fb_quadlet_t
getNodeVendorId() const
81 { return m_nodeVendorId
; }
84 bool setNodeId( fb_nodeid_t nodeId
);
87 * @brief Compares the GUID of two ConfigRom's
89 * This function compares the GUID of two ConfigRom objects and returns true
90 * if the GUID of @ref a is larger than the GUID of @ref b . This is intended
91 * to be used with the STL sort() algorithm.
93 * Note that GUID's are converted to integers for this.
95 * @param a pointer to first ConfigRom
96 * @param b pointer to second ConfigRom
98 * @returns true if the GUID of @ref a is larger than the GUID of @ref b .
100 static bool compareGUID( const ConfigRom
& a
, const ConfigRom
& b
);
102 bool serialize( std::string path
, Util::IOSerialize
& ser
);
103 static ConfigRom
* deserialize( std::string path
,
104 Util::IODeserialize
& deser
,
105 Ieee1394Service
& ieee1394Service
);
107 void printConfigRomDebug() const;
108 void printConfigRom() const;
109 void setVerboseLevel(int level
) {
110 setDebugLevel(level
);
111 Element::setVerboseLevel(level
);
114 bool isPresentOnBus() {
115 return m_nodeId
!= INVALID_NODE_ID
;
118 void processUnitDirectory( struct csr1212_csr
* csr
,
119 struct csr1212_keyval
* ud_kv
,
122 void processRootDirectory( struct csr1212_csr
* csr
);
124 Ieee1394Service
& m_1394Service
;
125 fb_nodeid_t m_nodeId
;
128 std::string m_vendorName
;
129 std::string m_modelName
;
130 unsigned int m_vendorId
;
131 unsigned int m_modelId
;
132 unsigned int m_unit_specifier_id
;
133 unsigned int m_unit_version
;
134 bool m_isIsoResourceManager
;
135 bool m_isCycleMasterCapable
;
136 bool m_isSupportIsoOperations
;
137 bool m_isBusManagerCapable
;
138 fb_byte_t m_cycleClkAcc
;
140 fb_quadlet_t m_nodeVendorId
;
141 fb_byte_t m_chipIdHi
;
142 fb_quadlet_t m_chipIdLow
;
144 /* only used during parsing */
145 struct csr1212_keyval
* m_vendorNameKv
;
146 struct csr1212_keyval
* m_modelNameKv
;
147 struct csr1212_csr
* m_csr
;
150 ConfigRom( const ConfigRom
& ); // do not allow copy ctor
151 ConfigRom(); // ctor for deserialition
153 DECLARE_DEBUG_MODULE
;
156 #endif /* CONFIGROM_H */