root/branches/libffado-2.0/src/libieee1394/configrom.cpp

Revision 1292, 21.7 kB (checked in by ppalmers, 13 years ago)

- Improve bus reset handling. Bus resets now don't mess up a ffado client on an unrelated bus.

- add string id's to threads and mutexes to aid debugging

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