root/trunk/libffado/src/libieee1394/configrom.cpp

Revision 1073, 21.5 kB (checked in by ppalmers, 13 years ago)

workaround MOTU not setting a vendor/model name

  • 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  * Copyright (C) 2005-2008 by Jonathan Woithe
4  * Copyright (C) 2005-2008 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 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.
15  *
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.
20  *
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/>.
23  *
24  */
25
26 #include "configrom.h"
27 #include "ieee1394service.h"
28
29 #include "vendor_model_ids.h"
30
31 #include <stdio.h>
32 #include <string.h>
33
34 #include <iostream>
35 #include <iomanip>
36
37 using namespace std;
38
39 IMPL_DEBUG_MODULE( ConfigRom, ConfigRom, DEBUG_LEVEL_NORMAL );
40
41 static int busRead( struct csr1212_csr* csr,
42                     u_int64_t addr,
43                     u_int16_t length,
44                     void* buffer,
45                     void* private_data );
46
47 static int getMaxRom( u_int32_t* bus_info_data,
48                       void* private_data );
49
50 static struct csr1212_bus_ops configrom_csr1212_ops = {
51     busRead,
52     0,
53     0,
54     getMaxRom
55 };
56
57 struct config_csr_info {
58     Ieee1394Service* service;
59     fb_nodeid_t      nodeId;
60 };
61
62 //-------------------------------------------------------------
63
64 ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId )
65     : Control::Element("ConfigRom")
66     , m_1394Service( ieee1394service )
67     , m_nodeId( nodeId )
68     , m_avcDevice( false ) // FIXME: this does not seem veryu
69     , m_guid( 0 )
70     , m_vendorName( "" )
71     , m_modelName( "" )
72     , m_vendorId( 0 )
73     , m_modelId( 0 )
74     , m_unit_specifier_id( 0 )
75     , m_unit_version( 0 )
76     , m_isIsoResourceManager( false )
77     , m_isCycleMasterCapable( false )
78     , m_isSupportIsoOperations( false )
79     , m_isBusManagerCapable( false )
80     , m_cycleClkAcc( 0 )
81     , m_maxRec( 0 )
82     , m_nodeVendorId( 0 )
83     , m_chipIdHi( 0 )
84     , m_chipIdLow( 0 )
85     , m_vendorNameKv( 0 )
86     , m_modelNameKv( 0 )
87     , m_csr( 0 )
88 {
89 }
90
91 ConfigRom::ConfigRom()
92     : Control::Element("ConfigRom")
93     , m_1394Service( *(new Ieee1394Service()) )
94     , m_nodeId( -1 )
95     , m_avcDevice( false ) // FIXME: this does not seem veryu
96     , m_guid( 0 )
97     , m_vendorName( "" )
98     , m_modelName( "" )
99     , m_vendorId( 0 )
100     , m_modelId( 0 )
101     , m_unit_specifier_id( 0 )
102     , m_unit_version( 0 )
103     , m_isIsoResourceManager( false )
104     , m_isCycleMasterCapable( false )
105     , m_isSupportIsoOperations( false )
106     , m_isBusManagerCapable( false )
107     , m_cycleClkAcc( 0 )
108     , m_maxRec( 0 )
109     , m_nodeVendorId( 0 )
110     , m_chipIdHi( 0 )
111     , m_chipIdLow( 0 )
112     , m_vendorNameKv( 0 )
113     , m_modelNameKv( 0 )
114     , m_csr( 0 )
115 {
116 }
117
118 Ieee1394Service&
119 ConfigRom::get1394Service()
120 {
121     return m_1394Service;
122 }
123
124 bool
125 ConfigRom::operator == ( const ConfigRom& rhs )
126 {
127     return m_guid == rhs.m_guid;
128 }
129
130 bool
131 ConfigRom::compareGUID( const ConfigRom& a, const ConfigRom& b ) {
132     return a.getGuid() > b.getGuid();
133 }
134
135 bool
136 ConfigRom::initialize()
137 {
138      struct config_csr_info csr_info;
139      csr_info.service = &m_1394Service;
140      csr_info.nodeId = 0xffc0 | m_nodeId;
141
142      m_csr = csr1212_create_csr( &configrom_csr1212_ops,
143                                  5 * sizeof(fb_quadlet_t),   // XXX Why 5 ?!?
144                                  &csr_info );
145     if (!m_csr || csr1212_parse_csr( m_csr ) != CSR1212_SUCCESS) {
146         debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service.getPort() );
147         if (m_csr) {
148             csr1212_destroy_csr(m_csr);
149             m_csr = 0;
150         }
151         return false;
152     }
153
154     // Process Bus_Info_Block
155     m_isIsoResourceManager = CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 31;
156     m_isCycleMasterCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 30 ) & 0x1;
157     m_isSupportIsoOperations = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 29 ) & 0x1;
158     m_isBusManagerCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 28 ) & 0x1;
159     m_cycleClkAcc = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 16 ) & 0xff;
160     m_maxRec = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[2] ) >> 12 ) & 0xf;
161     m_nodeVendorId = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) >> 8 );
162     m_chipIdHi = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) ) & 0xff;
163     m_chipIdLow = CSR1212_BE32_TO_CPU( m_csr->bus_info_data[4] );
164
165     // Process Root Directory
166     processRootDirectory(m_csr);
167
168     if ( m_vendorNameKv ) {
169         int len = ( m_vendorNameKv->value.leaf.len - 2) * sizeof( quadlet_t );
170         char* buf = new char[len+2];
171         memcpy( buf,
172                 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_vendorNameKv ),
173                 len );
174
175     while ((buf + len - 1) == '\0') {
176             len--;
177         }
178         // \todo XXX seems a bit strage to do this but the nodemgr.c code does
179         // it. try to figure out why this is needed (or not)
180     buf[len++] = ' ';
181     buf[len] = '\0';
182
183
184         debugOutput( DEBUG_LEVEL_VERBOSE, "Vendor name: '%s'\n", buf );
185         m_vendorName = buf;
186         delete[] buf;
187     }
188     if ( m_modelNameKv ) {
189         int len = ( m_modelNameKv->value.leaf.len - 2) * sizeof( quadlet_t );
190         char* buf = new char[len+2];
191         memcpy( buf,
192                 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_modelNameKv ),
193                 len );
194     while ((buf + len - 1) == '\0') {
195             len--;
196         }
197         // \todo XXX for edirol fa-66 it seems somehow broken. see above
198         // todo as well.
199     buf[len++] = ' ';
200     buf[len] = '\0';
201
202         debugOutput( DEBUG_LEVEL_VERBOSE, "Model name: '%s'\n", buf);
203         m_modelName = buf;
204         delete[] buf;
205     }
206
207     m_guid = ((u_int64_t)CSR1212_BE32_TO_CPU(m_csr->bus_info_data[3]) << 32)
208              | CSR1212_BE32_TO_CPU(m_csr->bus_info_data[4]);
209
210     if ( m_vendorNameKv ) {
211         csr1212_release_keyval( m_vendorNameKv );
212         m_vendorNameKv = 0;
213     }
214     if ( m_modelNameKv ) {
215         csr1212_release_keyval( m_modelNameKv );
216         m_modelNameKv = 0;
217     }
218     if ( m_csr ) {
219         csr1212_destroy_csr(m_csr);
220         m_csr = 0;
221     }
222     return true;
223 }
224
225 static int
226 busRead( struct csr1212_csr* csr,
227          u_int64_t addr,
228          u_int16_t length,
229          void* buffer,
230          void* private_data )
231 {
232     struct config_csr_info* csr_info = (struct config_csr_info*) private_data;
233
234     int nb_retries = 5;
235
236     while ( nb_retries--
237             && !csr_info->service->read( csr_info->nodeId,
238                                          addr,
239                                          (size_t)length/4,
240                                          ( quadlet_t* )buffer)  )
241     {// failed, retry
242     }
243
244     if (nb_retries > -1) return 0; // success
245     else return -1; // failure
246 }
247
248 static int
249 getMaxRom( u_int32_t* bus_info_data,
250            void* /*private_data*/)
251 {
252     return (CSR1212_BE32_TO_CPU( bus_info_data[2] ) >> 8) & 0x3;
253 }
254
255
256 void
257 ConfigRom::processUnitDirectory( struct csr1212_csr* csr,
258                                  struct csr1212_keyval* ud_kv,
259                                  unsigned int *id )
260 {
261     struct csr1212_dentry *dentry;
262     struct csr1212_keyval *kv;
263     unsigned int last_key_id = 0;
264
265     debugOutput( DEBUG_LEVEL_VERBOSE, "process unit directory:\n" );
266     csr1212_for_each_dir_entry(csr, kv, ud_kv, dentry) {
267     switch (kv->key.id) {
268         case CSR1212_KV_ID_VENDOR:
269         if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
270                     debugOutput( DEBUG_LEVEL_VERBOSE,
271                                  "\tvendor_id = 0x%08x\n",
272                                  kv->value.immediate);
273                     m_vendorId = kv->value.immediate;
274         }
275         break;
276
277         case CSR1212_KV_ID_MODEL:
278                 debugOutput( DEBUG_LEVEL_VERBOSE,
279                              "\tmodel_id = 0x%08x\n",
280                              kv->value.immediate);
281                 m_modelId = kv->value.immediate;
282         break;
283
284         case CSR1212_KV_ID_SPECIFIER_ID:
285                 debugOutput( DEBUG_LEVEL_VERBOSE,
286                              "\tspecifier_id = 0x%08x\n",
287                              kv->value.immediate);
288                 m_unit_specifier_id = kv->value.immediate;
289         break;
290
291         case CSR1212_KV_ID_VERSION:
292                 debugOutput( DEBUG_LEVEL_VERBOSE,
293                              "\tversion = 0x%08x\n",
294                              kv->value.immediate);
295                 m_unit_version = kv->value.immediate;
296                 if ( m_unit_specifier_id == 0x0000a02d ) // XXX
297                 {
298                     m_avcDevice = true; // FIXME: disable this check for the moment
299                     if ( kv->value.immediate == 0x14001 ) {
300                         m_avcDevice = true;
301                     }
302                 }
303         break;
304
305         case CSR1212_KV_ID_DESCRIPTOR:
306         if (kv->key.type == CSR1212_KV_TYPE_LEAF &&
307             CSR1212_DESCRIPTOR_LEAF_TYPE(kv) == 0 &&
308             CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) == 0 &&
309             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) == 0 &&
310             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) == 0 &&
311             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) == 0)
312         {
313             switch (last_key_id) {
314             case CSR1212_KV_ID_VENDOR:
315                 csr1212_keep_keyval(kv);
316                             m_vendorNameKv = kv;
317                 break;
318
319             case CSR1212_KV_ID_MODEL:
320                             m_modelNameKv = kv;
321                 csr1212_keep_keyval(kv);
322                 break;
323
324             }
325         } /* else if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) ... */
326         break;
327
328         case CSR1212_KV_ID_DEPENDENT_INFO:
329         if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
330             /* This should really be done in SBP2 as this is
331              * doing SBP2 specific parsing. */
332             processUnitDirectory(csr, kv, id);
333         }
334
335         break;
336
337         default:
338         break;
339     }
340     last_key_id = kv->key.id;
341     }
342 }
343
344 void
345 ConfigRom::processRootDirectory(struct csr1212_csr* csr)
346 {
347     unsigned int ud_id = 0;
348     struct csr1212_dentry *dentry;
349     struct csr1212_keyval *kv;
350     unsigned int last_key_id = 0;
351
352     csr1212_for_each_dir_entry(csr, kv, csr->root_kv, dentry) {
353     switch (kv->key.id) {
354         case CSR1212_KV_ID_VENDOR:
355                 debugOutput( DEBUG_LEVEL_VERBOSE,
356                              "vendor id = 0x%08x\n", kv->value.immediate);
357         break;
358
359         case CSR1212_KV_ID_NODE_CAPABILITIES:
360                 debugOutput( DEBUG_LEVEL_VERBOSE,
361                              "capabilities = 0x%08x\n", kv->value.immediate);
362         break;
363
364         case CSR1212_KV_ID_UNIT:
365         processUnitDirectory(csr, kv, &ud_id);
366         break;
367
368         case CSR1212_KV_ID_DESCRIPTOR:
369         if (last_key_id == CSR1212_KV_ID_VENDOR) {
370             if (kv->key.type == CSR1212_KV_TYPE_LEAF &&
371             CSR1212_DESCRIPTOR_LEAF_TYPE(kv) == 0 &&
372             CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) == 0 &&
373             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) == 0 &&
374             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) == 0 &&
375             CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) == 0)
376                     {
377                         m_vendorNameKv = kv;
378             csr1212_keep_keyval(kv);
379             }
380         }
381         break;
382     }
383     last_key_id = kv->key.id;
384     }
385
386 }
387
388 const fb_nodeid_t
389 ConfigRom::getNodeId() const
390 {
391     return m_nodeId;
392 }
393
394 const fb_octlet_t
395 ConfigRom::getGuid() const
396 {
397     return m_guid;
398 }
399
400 const Glib::ustring
401 ConfigRom::getGuidString() const
402 {
403     char* buf;
404     asprintf( &buf, "%08x%08x",
405               ( unsigned int ) ( getGuid() >> 32 ),
406               ( unsigned int ) ( getGuid() & 0xffffffff ) );
407     Glib::ustring result = buf;
408     free( buf );
409     return result;
410 }
411  
412 const Glib::ustring
413 ConfigRom::getModelName() const
414 {
415     // HACK:
416     // workarounds for devices that don't fill a correct model name
417     switch(m_vendorId) {
418         case FW_VENDORID_MOTU:
419             switch(m_unit_specifier_id) {
420                 case 0x00000003:
421                     return "828MkII";
422                 case 0x00000009:
423                     return "Traveler";
424                 case 0x0000000d:
425                     return "UltraLite";
426                 case 0x0000000f:
427                     return "8pre";
428                 case 0x00000001:
429                     return "828MkI";
430                 case 0x00000005:
431                     return "896HD";
432                 default:
433                     return "unknown";
434             }
435             break;
436         default:
437             return m_modelName;
438     }
439 }
440
441 const Glib::ustring
442 ConfigRom::getVendorName() const
443 {
444     // HACK:
445     // workarounds for devices that don't fill a correct vendor name
446     switch(m_vendorId) {
447         case FW_VENDORID_MOTU:
448             return "MOTU";
449         default:
450             return m_vendorName;
451     }
452 }
453
454 const unsigned int
455 ConfigRom::getModelId() const
456 {
457     return m_modelId;
458 }
459
460 const unsigned int
461 ConfigRom::getVendorId() const
462 {
463     return m_vendorId;
464 }
465
466 const unsigned int
467 ConfigRom::getUnitSpecifierId() const
468 {
469     return m_unit_specifier_id;
470 }
471
472 const unsigned int
473 ConfigRom::getUnitVersion() const
474 {
475     return m_unit_version;
476 }
477
478 bool
479 ConfigRom::updatedNodeId()
480 {
481     debugOutput( DEBUG_LEVEL_VERBOSE,
482                  "Checking for updated node id for device with GUID 0x%016llX...\n",
483                  getGuid());
484
485     struct csr1212_csr* csr = NULL;
486     for ( fb_nodeid_t nodeId = 0;
487           nodeId < m_1394Service.getNodeCount();
488           ++nodeId )
489     {
490         struct config_csr_info csr_info;
491         csr_info.service = &m_1394Service;
492         csr_info.nodeId = 0xffc0 | nodeId;
493         debugOutput( DEBUG_LEVEL_VERBOSE, "Looking at node %d...\n", nodeId);
494
495         csr = csr1212_create_csr( &configrom_csr1212_ops,
496                                   5 * sizeof(fb_quadlet_t),   // XXX Why 5 ?!?
497                                   &csr_info );
498
499         if (!csr || csr1212_parse_csr( csr ) != CSR1212_SUCCESS) {
500             debugWarning( "Failed to get/parse CSR\n");
501             if (csr) {
502                 csr1212_destroy_csr(csr);
503                 csr = NULL;
504             }
505             continue;
506         }
507
508         octlet_t guid =
509             ((u_int64_t)CSR1212_BE32_TO_CPU(csr->bus_info_data[3]) << 32)
510             | CSR1212_BE32_TO_CPU(csr->bus_info_data[4]);
511
512         debugOutput( DEBUG_LEVEL_VERBOSE,
513                         " Node has GUID 0x%016llX\n",
514                         guid);
515
516         if ( guid == getGuid() ) {
517             debugOutput( DEBUG_LEVEL_VERBOSE, "GUID matches ours\n");
518             if ( nodeId != getNodeId() ) {
519                 debugOutput( DEBUG_LEVEL_VERBOSE,
520                              "Device with GUID 0x%016llX changed node id "
521                              "from %d to %d\n",
522                              getGuid(),
523                              getNodeId(),
524                              nodeId );
525                 m_nodeId = nodeId;
526             } else {
527                 debugOutput( DEBUG_LEVEL_VERBOSE,
528                              "Device with GUID 0x%016llX kept node id %d\n",
529                              getGuid(),
530                              getNodeId());
531             }
532             if (csr) {
533                 csr1212_destroy_csr(csr);
534                 csr = NULL;
535             }
536             return true;
537         }
538     }
539
540     if (csr) {
541         csr1212_destroy_csr(csr);
542     }
543
544     debugOutput( DEBUG_LEVEL_NORMAL,
545                  "Device with GUID 0x%08x%08x could not be found on "
546                  "the bus anymore (removed?)\n",
547                  m_guid >> 32,
548                  m_guid & 0xffffffff );
549     return false;
550 }
551
552 void
553 ConfigRom::printConfigRomDebug() const
554 {
555     using namespace std;
556     debugOutput(DEBUG_LEVEL_NORMAL, "Config ROM\n" );
557     debugOutput(DEBUG_LEVEL_NORMAL, "\tCurrent Node Id:\t%d\n",       getNodeId() );
558     debugOutput(DEBUG_LEVEL_NORMAL, "\tGUID:\t\t\t0x%016llX\n",       getGuid());
559     debugOutput(DEBUG_LEVEL_NORMAL, "\tVendor Name:\t\t%s\n",         getVendorName().c_str() );
560     debugOutput(DEBUG_LEVEL_NORMAL, "\tModel Name:\t\t%s\n",          getModelName().c_str() );
561     debugOutput(DEBUG_LEVEL_NORMAL, "\tNode Vendor ID:\t\t0x%06x\n",  getNodeVendorId() );
562     debugOutput(DEBUG_LEVEL_NORMAL, "\tModel Id:\t\t0x%08x\n",        getModelId() );
563     debugOutput(DEBUG_LEVEL_NORMAL, "\tUnit Specifier ID:\t0x%06x\n", getUnitSpecifierId() );
564     debugOutput(DEBUG_LEVEL_NORMAL, "\tUnit version:\t\t0x%08x\n",    getUnitVersion() );
565     debugOutput(DEBUG_LEVEL_NORMAL, "\tISO resource manager:\t%d\n",  isIsoResourseManager() );
566     debugOutput(DEBUG_LEVEL_NORMAL, "\tCycle master capable:\t%d\n",  isSupportsIsoOperations() );
567     debugOutput(DEBUG_LEVEL_NORMAL, "\tBus manager capable:\t%d\n",   isBusManagerCapable() );
568     debugOutput(DEBUG_LEVEL_NORMAL, "\tCycle clock accuracy:\t%d\n",  getCycleClockAccurancy() );
569     debugOutput(DEBUG_LEVEL_NORMAL, "\tMax rec:\t\t%d (max asy payload: %d bytes)\n",
570             getMaxRec(), getAsyMaxPayload() );
571 }
572
573 void
574 ConfigRom::printConfigRom() const
575 {
576     using namespace std;
577     printMessage("Config ROM\n" );
578     printMessage("\tCurrent Node Id:\t%d\n",       getNodeId() );
579     printMessage("\tGUID:\t\t\t0x%016llX\n",       getGuid());
580     printMessage("\tVendor Name:\t\t%s\n",         getVendorName().c_str() );
581     printMessage("\tModel Name:\t\t%s\n",          getModelName().c_str() );
582     printMessage("\tNode Vendor ID:\t\t0x%06x\n",  getNodeVendorId() );
583     printMessage("\tModel Id:\t\t0x%08x\n",        getModelId() );
584     printMessage("\tUnit Specifier ID:\t0x%06x\n", getUnitSpecifierId() );
585     printMessage("\tUnit version:\t\t0x%08x\n",    getUnitVersion() );
586     printMessage("\tISO resource manager:\t%d\n",  isIsoResourseManager() );
587     printMessage("\tCycle master capable:\t%d\n",  isSupportsIsoOperations() );
588     printMessage("\tBus manager capable:\t%d\n",   isBusManagerCapable() );
589     printMessage("\tCycle clock accuracy:\t%d\n",  getCycleClockAccurancy() );
590     printMessage("\tMax rec:\t\t%d (max asy payload: %d bytes)\n", getMaxRec(), getAsyMaxPayload() );
591 }
592
593 unsigned short
594 ConfigRom::getAsyMaxPayload() const
595 {
596     // XXX use pow instead?
597     return 1 << ( m_maxRec + 1 );
598 }
599
600 bool
601 ConfigRom::serialize( Glib::ustring path, Util::IOSerialize& ser )
602 {
603     bool result;
604     result  = ser.write( path + "m_nodeId", m_nodeId );
605     result &= ser.write( path + "m_avcDevice",  m_avcDevice );
606     result &= ser.write( path + "m_guid", m_guid );
607     result &= ser.write( path + "m_vendorName", Glib::ustring( m_vendorName ) );
608     result &= ser.write( path + "m_modelName", Glib::ustring( m_modelName ) );
609     result &= ser.write( path + "m_vendorId", m_vendorId );
610     result &= ser.write( path + "m_modelId", m_modelId );
611     result &= ser.write( path + "m_unit_specifier_id", m_unit_specifier_id );
612     result &= ser.write( path + "m_unit_version",  m_unit_version );
613     result &= ser.write( path + "m_isIsoResourceManager", m_isIsoResourceManager );
614     result &= ser.write( path + "m_isCycleMasterCapable", m_isCycleMasterCapable );
615     result &= ser.write( path + "m_isSupportIsoOperations", m_isSupportIsoOperations );
616     result &= ser.write( path + "m_isBusManagerCapable", m_isBusManagerCapable );
617     result &= ser.write( path + "m_cycleClkAcc", m_cycleClkAcc );
618     result &= ser.write( path + "m_maxRec", m_maxRec );
619     result &= ser.write( path + "m_nodeVendorId", m_nodeVendorId );
620     result &= ser.write( path + "m_chipIdHi", m_chipIdHi );
621     result &= ser.write( path + "m_chipIdLow", m_chipIdLow );
622     return result;
623 }
624
625 ConfigRom*
626 ConfigRom::deserialize( Glib::ustring path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service )
627 {
628     ConfigRom* pConfigRom = new ConfigRom;
629     if ( !pConfigRom ) {
630         return 0;
631     }
632
633     pConfigRom->m_1394Service = ieee1394Service;
634
635     bool result;
636     result  = deser.read( path + "m_nodeId", pConfigRom->m_nodeId );
637     result &= deser.read( path + "m_avcDevice", pConfigRom->m_avcDevice );
638     result &= deser.read( path + "m_guid", pConfigRom->m_guid );
639     result &= deser.read( path + "m_vendorName", pConfigRom->m_vendorName );
640     result &= deser.read( path + "m_modelName", pConfigRom->m_modelName );
641     result &= deser.read( path + "m_vendorId", pConfigRom->m_vendorId );
642     result &= deser.read( path + "m_modelId", pConfigRom->m_modelId );
643     result &= deser.read( path + "m_unit_specifier_id", pConfigRom->m_unit_specifier_id );
644     result &= deser.read( path + "m_unit_version", pConfigRom->m_unit_version );
645     result &= deser.read( path + "m_isIsoResourceManager", pConfigRom->m_isIsoResourceManager );
646     result &= deser.read( path + "m_isCycleMasterCapable", pConfigRom->m_isCycleMasterCapable );
647     result &= deser.read( path + "m_isSupportIsoOperations", pConfigRom->m_isSupportIsoOperations );
648     result &= deser.read( path + "m_isBusManagerCapable", pConfigRom->m_isBusManagerCapable );
649     result &= deser.read( path + "m_cycleClkAcc", pConfigRom->m_cycleClkAcc );
650     result &= deser.read( path + "m_maxRec", pConfigRom->m_maxRec );
651     result &= deser.read( path + "m_nodeVendorId", pConfigRom->m_nodeVendorId );
652     result &= deser.read( path + "m_chipIdHi", pConfigRom->m_chipIdHi );
653     result &= deser.read( path + "m_chipIdLow", pConfigRom->m_chipIdLow );
654
655     if ( !result ) {
656         delete pConfigRom;
657         return 0;
658     }
659
660     return pConfigRom;
661 }
662
663 bool
664 ConfigRom::setNodeId( fb_nodeid_t nodeId )
665 {
666     m_nodeId = nodeId;
667     return true;
668 }
Note: See TracBrowser for help on using the browser.