1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Daniel Wagner |
---|
3 |
* Copyright (C) 2005-2007 by Jonathan Woithe |
---|
4 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
5 |
* |
---|
6 |
* This file is part of FFADO |
---|
7 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
8 |
* |
---|
9 |
* FFADO is based upon FreeBoB |
---|
10 |
* |
---|
11 |
* This library is free software; you can redistribute it and/or |
---|
12 |
* modify it under the terms of the GNU Lesser General Public |
---|
13 |
* License version 2.1, as published by the Free Software Foundation; |
---|
14 |
* |
---|
15 |
* This library is distributed in the hope that it will be useful, |
---|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
18 |
* Lesser General Public License for more details. |
---|
19 |
* |
---|
20 |
* You should have received a copy of the GNU Lesser General Public |
---|
21 |
* License along with this library; if not, write to the Free Software |
---|
22 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
23 |
* MA 02110-1301 USA |
---|
24 |
*/ |
---|
25 |
|
---|
26 |
#ifndef CONFIGROM_H |
---|
27 |
#define CONFIGROM_H |
---|
28 |
|
---|
29 |
#include "fbtypes.h" |
---|
30 |
#include "csr1212.h" |
---|
31 |
|
---|
32 |
#include "libutil/serialize.h" |
---|
33 |
#include "debugmodule/debugmodule.h" |
---|
34 |
|
---|
35 |
#include "libcontrol/Element.h" |
---|
36 |
|
---|
37 |
#include <string> |
---|
38 |
|
---|
39 |
class Ieee1394Service; |
---|
40 |
|
---|
41 |
class ConfigRom |
---|
42 |
: public Control::Element |
---|
43 |
{ |
---|
44 |
public: |
---|
45 |
ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ); |
---|
46 |
virtual ~ConfigRom() {}; |
---|
47 |
|
---|
48 |
Ieee1394Service& get1394Service(); |
---|
49 |
|
---|
50 |
bool initialize(); |
---|
51 |
|
---|
52 |
bool operator == ( const ConfigRom& rhs ); |
---|
53 |
|
---|
54 |
const fb_nodeid_t getNodeId() const; |
---|
55 |
const fb_octlet_t getGuid() const; |
---|
56 |
const Glib::ustring getGuidString() const; |
---|
57 |
const Glib::ustring getModelName() const; |
---|
58 |
const Glib::ustring getVendorName() const; |
---|
59 |
|
---|
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; |
---|
65 |
|
---|
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 |
---|
77 |
{ return m_maxRec; } |
---|
78 |
unsigned short getAsyMaxPayload() const; |
---|
79 |
|
---|
80 |
fb_quadlet_t getNodeVendorId() const |
---|
81 |
{ return m_nodeVendorId; } |
---|
82 |
|
---|
83 |
bool updatedNodeId(); |
---|
84 |
bool setNodeId( fb_nodeid_t nodeId ); |
---|
85 |
|
---|
86 |
/** |
---|
87 |
* @brief Compares the GUID of two ConfigRom's |
---|
88 |
* |
---|
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. |
---|
92 |
* |
---|
93 |
* Note that GUID's are converted to integers for this. |
---|
94 |
* |
---|
95 |
* @param a pointer to first ConfigRom |
---|
96 |
* @param b pointer to second ConfigRom |
---|
97 |
* |
---|
98 |
* @returns true if the GUID of @ref a is larger than the GUID of @ref b . |
---|
99 |
*/ |
---|
100 |
static bool compareGUID( const ConfigRom& a, const ConfigRom& b ); |
---|
101 |
|
---|
102 |
bool serialize( Glib::ustring path, Util::IOSerialize& ser ); |
---|
103 |
static ConfigRom* deserialize( Glib::ustring path, |
---|
104 |
Util::IODeserialize& deser, |
---|
105 |
Ieee1394Service& ieee1394Service ); |
---|
106 |
|
---|
107 |
void printConfigRom() const; |
---|
108 |
void setVerboseLevel(int level) { |
---|
109 |
setDebugLevel(level); |
---|
110 |
Element::setVerboseLevel(level); |
---|
111 |
} |
---|
112 |
|
---|
113 |
protected: |
---|
114 |
void processUnitDirectory( struct csr1212_csr* csr, |
---|
115 |
struct csr1212_keyval* ud_kv, |
---|
116 |
unsigned int* id ); |
---|
117 |
|
---|
118 |
void processRootDirectory( struct csr1212_csr* csr ); |
---|
119 |
|
---|
120 |
Ieee1394Service& m_1394Service; |
---|
121 |
fb_nodeid_t m_nodeId; |
---|
122 |
bool m_avcDevice; |
---|
123 |
fb_octlet_t m_guid; |
---|
124 |
Glib::ustring m_vendorName; |
---|
125 |
Glib::ustring m_modelName; |
---|
126 |
unsigned int m_vendorId; |
---|
127 |
unsigned int m_modelId; |
---|
128 |
unsigned int m_unit_specifier_id; |
---|
129 |
unsigned int m_unit_version; |
---|
130 |
bool m_isIsoResourceManager; |
---|
131 |
bool m_isCycleMasterCapable; |
---|
132 |
bool m_isSupportIsoOperations; |
---|
133 |
bool m_isBusManagerCapable; |
---|
134 |
fb_byte_t m_cycleClkAcc; |
---|
135 |
fb_byte_t m_maxRec; |
---|
136 |
fb_quadlet_t m_nodeVendorId; |
---|
137 |
fb_byte_t m_chipIdHi; |
---|
138 |
fb_quadlet_t m_chipIdLow; |
---|
139 |
|
---|
140 |
/* only used during parsing */ |
---|
141 |
struct csr1212_keyval* m_vendorNameKv; |
---|
142 |
struct csr1212_keyval* m_modelNameKv; |
---|
143 |
struct csr1212_csr* m_csr; |
---|
144 |
|
---|
145 |
private: |
---|
146 |
ConfigRom( const ConfigRom& ); // do not allow copy ctor |
---|
147 |
ConfigRom(); // ctor for deserialition |
---|
148 |
|
---|
149 |
DECLARE_DEBUG_MODULE; |
---|
150 |
}; |
---|
151 |
|
---|
152 |
#endif /* CONFIGROM_H */ |
---|