root/branches/streaming-rework/src/bebob/bebob_dl_mgr.cpp

Revision 404, 21.1 kB (checked in by pieterpalmers, 16 years ago)

- introduce support framework for DICE and Metric Halo
- change probe/discovery code to make adding devices easier
- made conditional compilation effectively work.

./configure now has the following switches:

--enable-bebob build BeBoB support (default=yes)
--enable-motu build Motu support (default=no)
--enable-dice build DICE support (default=no)
--enable-metric-halo build Metric Halo support (note: completely useless)

(default=no)

--enable-rme build RME support (note: completely useless)

(default=no)

--enable-bounce build Bounce device support (default=no)
--enable-all-devices build support for all supported devices (default=no)

these now turn on/off compilation effectively.

Line 
1 /* bebob_dl_mgr.cpp
2  * Copyright (C) 2006 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #ifdef ENABLE_BEBOB
22
23 #include "bebob_dl_mgr.h"
24 #include "bebob_dl_codes.h"
25 #include "bebob_dl_bcd.h"
26
27 #include "configrom.h"
28 #include "libfreebobavc/ieee1394service.h"
29 #include "libfreebobavc/avc_serialize.h"
30
31 #include <netinet/in.h>
32
33 #include <cstdio>
34
35 namespace BeBoB {
36     enum {
37         AddrRegInfo    = 0xffffc8020000ULL,
38         AddrRegReq     = 0xffffc8021000ULL,
39         AddrRegReqBuf  = 0xffffc8021040ULL,
40         AddrRegResp    = 0xffffc8029000ULL,
41         AddrRegRespBuf = 0xffffc8029040ULL,
42     };
43
44     enum {
45         RegInfoManufactorIdOffset =      0x00,
46         RegInfoProtocolVersionOffset =   0x08,
47         RegInfoBootloaderVersionOffset = 0x0c,
48         RegInfoGUID =                    0x10,
49         RegInfoHardwareModelId =         0x18,
50         RegInfoHardwareRevision =        0x1c,
51         RegInfoSoftwareDate =            0x20,
52         RegInfoSoftwareTime =            0x28,
53         RegInfoSoftwareId =              0x30,
54         RegInfoSoftwareVersion =         0x34,
55         RegInfoBaseAddress =             0x38,
56         RegInfoMaxImageLen =             0x3c,
57         RegInfoBootloaderDate =          0x40,
58         RegInfoBootloaderTime =          0x48,
59         RegInfoDebuggerDate =            0x50,
60         RegInfoDebuggerTime =            0x58,
61         RegInfoDebuggerId =              0x60,
62         RegInfoDebuggerVersion =         0x64
63     };
64
65     enum {
66         MaxRetries = 10,
67     };
68
69     IMPL_DEBUG_MODULE( BootloaderManager, BootloaderManager, DEBUG_LEVEL_NORMAL );
70 }
71
72 BeBoB::BootloaderManager::BootloaderManager(Ieee1394Service& ieee1349service,
73                                             fb_nodeid_t nodeId )
74     : m_ieee1394service( &ieee1349service )
75     , m_protocolVersion( eBPV_Unknown )
76     , m_isAppRunning( false )
77     , m_forceEnabled( false )
78     , m_bStartBootloader( true )
79 {
80     memset( &m_cachedInfoRegs, 0, sizeof( m_cachedInfoRegs ) );
81
82     m_configRom = new ConfigRom( *m_ieee1394service, nodeId );
83     // XXX throw exception if initialize fails!
84     m_configRom->initialize();
85     if ( !cacheInfoRegisters() ) {
86         debugError( "BootloaderManager: could not cache info registers\n" );
87     }
88
89     switch(  m_cachedInfoRegs.m_protocolVersion ) {
90     case 1:
91         m_protocolVersion = eBPV_V1;
92         break;
93     case 3:
94         m_protocolVersion = eBPV_V3;
95         break;
96     default:
97         // exception?
98         break;
99     }
100
101     pthread_mutex_init( &m_mutex, 0 );
102     pthread_cond_init( &m_cond, 0 );
103
104     m_functor = new MemberFunctor0< BeBoB::BootloaderManager*,
105                 void (BeBoB::BootloaderManager::*)() >
106                 ( this, &BeBoB::BootloaderManager::busresetHandler, false );
107     m_ieee1394service->addBusResetHandler( m_functor );
108 }
109
110 BeBoB::BootloaderManager::~BootloaderManager()
111 {
112     m_ieee1394service->remBusResetHandler( m_functor );
113     delete( m_functor );
114
115     delete m_configRom;
116
117     pthread_cond_destroy( &m_cond );
118     pthread_mutex_destroy( &m_mutex );
119 }
120
121 bool
122 BeBoB::BootloaderManager::cacheInfoRegisters()
123 {
124     if ( !m_configRom->updatedNodeId() ) {
125         debugError( "cacheInfoRegisters: did not find device anymore\n" );
126         return false;
127     }
128
129     if ( !m_ieee1394service->read(
130              0xffc0 | m_configRom->getNodeId(),
131              AddrRegInfo,
132              sizeof( m_cachedInfoRegs )/4,
133              reinterpret_cast<fb_quadlet_t*>( &m_cachedInfoRegs ) ) )
134     {
135         return false;
136     }
137
138     if ( m_cachedInfoRegs.m_bootloaderVersion != 0x0 ) {
139         m_isAppRunning = false;
140     } else {
141         m_isAppRunning = true;
142     }
143
144     m_cachedInfoRegs.m_guid = ( m_cachedInfoRegs.m_guid >> 32 )
145                               | ( m_cachedInfoRegs.m_guid << 32 );
146
147     return true;
148 }
149
150 bool
151 BeBoB::BootloaderManager::cacheInfoRegisters( int retries )
152 {
153     for ( int i = 0; i < retries; ++i ) {
154         if ( cacheInfoRegisters() ) {
155             return true;
156         }
157         sleep( 1 );
158     }
159
160     return false;
161 }
162
163 void
164 BeBoB::BootloaderManager::printInfoRegisters()
165 {
166     using namespace std;
167
168     if ( !cacheInfoRegisters() ) {
169         debugError( "Could not read info registers\n" );
170         return;
171     }
172
173     printf( "Info Registers\n" );
174     printf( "\tManufactors Id:\t\t%s\n",
175             makeString( m_cachedInfoRegs.m_manId ).c_str() );
176     printf( "\tProtocol Version:\t0x%08x\n",
177             m_cachedInfoRegs.m_protocolVersion );
178     printf( "\tBootloader Version:\t0x%08x\n",
179             m_cachedInfoRegs.m_bootloaderVersion );
180     printf( "\tGUID:\t\t\t0x%08x%08x\n",
181             ( unsigned int )( m_cachedInfoRegs.m_guid >> 32 ),
182             ( unsigned int )( m_cachedInfoRegs.m_guid & 0xffffffff ) );
183     printf( "\tHardware Model ID:\t0x%08x\n",
184             m_cachedInfoRegs.m_hardwareModelId );
185     printf( "\tHardware Revision:\t0x%08x\n",
186             m_cachedInfoRegs.m_hardwareRevision );
187     if (  m_cachedInfoRegs.m_softwareDate
188           && m_cachedInfoRegs.m_softwareTime )
189     {
190         printf( "\tSoftware Date:\t\t%s, %s\n",
191                 makeDate( m_cachedInfoRegs.m_softwareDate ).c_str(),
192                 makeTime( m_cachedInfoRegs.m_softwareTime ).c_str() );
193     }
194     printf( "\tSoftware Id:\t\t0x%08x\n", m_cachedInfoRegs.m_softwareId );
195     printf( "\tSoftware Version:\t0x%08x\n",
196             m_cachedInfoRegs.m_softwareVersion );
197     printf( "\tBase Address:\t\t0x%08x\n", m_cachedInfoRegs.m_baseAddress );
198     printf( "\tMax. Image Len:\t\t0x%08x\n", m_cachedInfoRegs.m_maxImageLen );
199     if ( m_cachedInfoRegs.m_bootloaderDate
200          && m_cachedInfoRegs.m_bootloaderTime )
201     {
202         printf( "\tBootloader Date:\t%s, %s\n",
203                 makeDate( m_cachedInfoRegs.m_bootloaderDate ).c_str(),
204                 makeTime( m_cachedInfoRegs.m_bootloaderTime ).c_str() );
205     }
206     if ( m_cachedInfoRegs.m_debuggerDate
207          && m_cachedInfoRegs.m_debuggerTime )
208     {
209         printf( "\tDebugger Date:\t\t%s, %s\n",
210                 makeDate( m_cachedInfoRegs.m_debuggerDate ).c_str(),
211                 makeTime( m_cachedInfoRegs.m_debuggerTime ).c_str() );
212     }
213     printf( "\tDebugger Id:\t\t0x%08x\n", m_cachedInfoRegs.m_debuggerId );
214     printf( "\tDebugger Version:\t0x%08x\n",
215             m_cachedInfoRegs.m_debuggerVersion );
216 }
217
218 bool
219 BeBoB::BootloaderManager::downloadFirmware( std::string filename )
220 {
221     using namespace std;
222
223     printf( "parse BCD file\n" );
224     std::auto_ptr<BCD> bcd = std::auto_ptr<BCD>( new BCD( filename ) );
225     if ( !bcd.get() ) {
226         debugError( "downloadFirmware: Could not open or parse BCD '%s'\n",
227                     filename.c_str() );
228         return false;
229     }
230     if ( !bcd->parse() ) {
231         debugError( "downloadFirmware: BCD parsing failed\n" );
232         return false;
233     }
234
235     printf( "check firmware device compatibility... " );
236     if ( !m_forceEnabled ) {
237         if ( !checkDeviceCompatibility( *bcd ) ) {
238             printf( "failed.\n" );
239             return false;
240         }
241         printf( "ok\n" );
242     } else {
243         printf( "forced\n" );
244     }
245
246     if ( m_bStartBootloader ) {
247         printf( "prepare for download (start bootloader)\n" );
248         if ( !startBootloaderCmd() ) {
249             debugError( "downloadFirmware: Could not start bootloader\n" );
250             return false;
251         }
252     }
253
254     printf( "start downloading protocol for application image\n" );
255     if ( !downloadObject( *bcd, eOT_Application ) ) {
256         debugError( "downloadFirmware: Firmware download failed\n" );
257         return false;
258     }
259
260     printf( "start downloading protocol for CnE\n" );
261     if ( !downloadObject( *bcd, eOT_CnE ) ) {
262         debugError( "downloadFirmware: CnE download failed\n" );
263         return false;
264     }
265
266     printf( "setting CnE to factory default settings\n" );
267     if ( !initializeConfigToFactorySettingCmd() ) {
268         debugError( "downloadFirmware: Could not reinitalize CnE\n" );
269         return false;
270     }
271
272     printf( "start application\n" );
273     if ( !startApplicationCmd() ) {
274         debugError( "downloadFirmware: Could not restart application\n" );
275         return false;
276     }
277
278     return true;
279 }
280
281 bool
282 BeBoB::BootloaderManager::downloadCnE( std::string filename )
283 {
284     using namespace std;
285
286     printf( "parse BCD file\n" );
287     std::auto_ptr<BCD> bcd = std::auto_ptr<BCD>( new BCD( filename ) );
288     if ( !bcd.get() ) {
289         debugError( "downloadCnE: Could not open or parse BCD '%s'\n",
290                     filename.c_str() );
291         return false;
292     }
293     if ( !bcd->parse() ) {
294         debugError( "downloadCnE: BCD parsing failed\n" );
295         return false;
296     }
297
298     printf( "check firmware device compatibility... " );
299     if ( !m_forceEnabled ) {
300         if ( !checkDeviceCompatibility( *bcd ) ) {
301             printf( "failed.\n" );
302             return false;
303         }
304         printf( "ok\n" );
305     } else {
306         printf( "forced\n" );
307     }
308
309     if ( m_bStartBootloader ) {
310         printf( "prepare for download (start bootloader)\n" );
311         if ( !startBootloaderCmd() ) {
312             debugError( "downloadCnE: Could not start bootloader\n" );
313             return false;
314         }
315     }
316
317     printf( "start downloading protocol for CnE\n" );
318     if ( !downloadObject( *bcd, eOT_CnE ) ) {
319         debugError( "downloadCnE: CnE download failed\n" );
320         return false;
321     }
322
323     printf( "setting CnE to factory default settings\n" );
324     if ( !initializeConfigToFactorySettingCmd() ) {
325         debugError( "downloadFirmware: Could not reinitalize CnE\n" );
326         return false;
327     }
328
329     printf( "start application\n" );
330     if ( !startApplicationCmd() ) {
331         debugError( "downloadCnE: Could not restart application\n" );
332         return false;
333     }
334
335     return true;
336 }
337
338
339 bool
340 BeBoB::BootloaderManager::downloadObject( BCD& bcd, EObjectType eObject )
341 {
342     using namespace std;
343
344     CommandCodesDownloadStart::EObject eCCDSObject;
345     fb_quadlet_t baseAddress;
346     fb_quadlet_t imageLength;
347     fb_quadlet_t crc;
348     fb_quadlet_t offset;
349
350     switch ( eObject ) {
351     case eOT_Application:
352         eCCDSObject = CommandCodesDownloadStart::eO_Application;
353         baseAddress = bcd.getImageBaseAddress();
354         imageLength = bcd.getImageLength();
355         crc = bcd.getImageCRC();
356         offset = bcd.getImageOffset();
357         break;
358     case eOT_CnE:
359         eCCDSObject = CommandCodesDownloadStart::eO_Config;
360         baseAddress = 0;
361         imageLength = bcd.getCnELength();
362         crc = bcd.getCnECRC();
363         offset = bcd.getCnEOffset();
364         break;
365     default:
366         return false;
367     }
368
369     CommandCodesDownloadStart ccDStart ( m_protocolVersion, eCCDSObject );
370     ccDStart.setDate( bcd.getSoftwareDate() );
371     ccDStart.setTime( bcd.getSoftwareTime() );
372     ccDStart.setId( bcd.getSoftwareId() );
373     ccDStart.setVersion( bcd.getSoftwareVersion() );
374     ccDStart.setBaseAddress( baseAddress );
375     ccDStart.setLength( imageLength );
376     ccDStart.setCRC( crc );
377
378     if ( !writeRequest( ccDStart ) ) {
379         debugError( "downloadObject: start command write request failed\n" );
380         return false;
381     }
382
383     // bootloader erases the flash, have to wait until is ready
384     // to answer our next request
385     printf( "wait until flash ereasing has terminated\n" );
386     sleep( 30 );
387
388     if ( !readResponse( ccDStart ) ) {
389         debugError( "downloadObject: (start) command read request failed\n" );
390         return false;
391     }
392
393     if ( ccDStart.getMaxBlockSize() < 0 ) {
394         debugError( "downloadObject: (start) command reported error %d\n",
395                     ccDStart.getMaxBlockSize() );
396         return false;
397     }
398
399     unsigned int maxBlockSize = m_configRom->getAsyMaxPayload();
400     unsigned int i = 0;
401     fb_quadlet_t address = 0;
402     bool result = true;
403     int totalBytes = imageLength;
404     int downloadedBytes = 0;
405     while ( imageLength > 0 ) {
406         unsigned int blockSize = imageLength > maxBlockSize ?
407                         maxBlockSize  : imageLength;
408
409         fb_byte_t block[blockSize];
410         if ( !bcd.read( offset, block, blockSize ) ) {
411             result = false;
412             break;
413         }
414
415         if ( !get1394Serivce()->write(
416                  0xffc0 | getConfigRom()->getNodeId(),
417                  AddrRegReqBuf,
418                  ( blockSize + 3 ) / 4,
419                  reinterpret_cast<fb_quadlet_t*>( block ) ) )
420         {
421             debugError( "downloadObject: Could not write to node %d\n",
422                         getConfigRom()->getNodeId() );
423             return false;
424         }
425
426         CommandCodesDownloadBlock ccBlock( m_protocolVersion );
427         ccBlock.setSeqNumber( i );
428         ccBlock.setAddress( baseAddress + address );
429         ccBlock.setNumberBytes( blockSize );
430
431         if ( !writeRequest( ccBlock ) ) {
432             debugError( "downloadObject: (block) write request failed" );
433             result = false;
434             break;
435         }
436         usleep( 100 );
437
438         if ( !readResponse( ccBlock ) ) {
439             debugError( "downloadObject: (block) read request failed\n" );
440             result = false;
441             break;
442         }
443
444         if ( i != ccBlock.getRespSeqNumber() ) {
445             debugError( "downloadObject: (block) wrong sequence number "
446                         "reported. %d expected, %d reported\n",
447                         i, ccBlock.getRespSeqNumber() );
448             result = false;
449             break;
450         }
451         if ( ccBlock.getRespErrorCode() != 0 ) {
452             debugError( "downloadObject: (block) failed download with "
453                         "error code 0x%08x\n", ccBlock.getRespErrorCode() );
454             result = false;
455             break;
456         }
457
458         downloadedBytes += blockSize;
459         if ( ( i % 100 ) == 0 ) {
460            printf( "%10d/%d bytes downloaded\n",
461                    downloadedBytes, totalBytes );
462         }
463
464         imageLength -= blockSize;
465         address += blockSize;
466         offset += blockSize;
467         i++;
468     }
469     printf( "%10d/%d bytes downloaded\n",
470             downloadedBytes, totalBytes );
471
472     if ( !result ) {
473         debugError( "downloadObject: seqNumber = %d, "
474                     "address = 0%08x, offset = 0x%08x, "
475                     "restImageLength = 0x%08x\n",
476                     i, address, offset, imageLength );
477     }
478
479     CommandCodesDownloadEnd ccEnd( m_protocolVersion );
480     if ( !writeRequest( ccEnd ) ) {
481         debugError( "downloadObject: (end) command write failed\n" );
482     }
483
484     printf( "wait for transaction completion\n" );
485     sleep( 10 );
486
487     if ( !readResponse( ccEnd ) ) {
488         debugError( "downloadObject: (end) command read failed\n" );
489     }
490
491     if ( result ) {
492         if ( ccEnd.getRespIsValid() ) {
493             if ( ccEnd.getRespCrc32() == crc ) {
494                 debugOutput( DebugModule::eDL_Normal,
495                              "downloadObject: CRC match\n" );
496             } else {
497                 debugError( "downloadObject: CRC mismatch. 0x%08x expected, "
498                             "0x%08x reported",
499                             crc, ccEnd.getRespCrc32() );
500                 result = false;
501             }
502         } else {
503             debugError( "downloadObject: (end) object is not valid\n" );
504             result = false;
505         }
506     }
507     printf( "download protocol successfuly completed\n" );
508     return result;
509 }
510
511 bool
512 BeBoB::BootloaderManager::programGUID( fb_octlet_t guid )
513 {
514     if ( m_bStartBootloader ) {
515         if ( !startBootloaderCmd() ) {
516             debugError( "programGUID: Could not start bootloader\n" );
517             return false;
518         }
519     }
520
521     if ( !programGUIDCmd( guid ) ) {
522         debugError( "programGUID: Could not program guid\n" );
523         return false;
524     }
525
526     if ( !startApplicationCmd() ) {
527         debugError( "Could not restart application\n");
528         return false;
529     }
530
531     return true;
532 }
533
534 void
535 BeBoB::BootloaderManager::busresetHandler()
536 {
537     pthread_cond_signal( &m_cond );
538 }
539
540 void
541 BeBoB::BootloaderManager::waitForBusReset()
542 {
543     pthread_cond_wait( &m_cond, &m_mutex );
544 }
545
546 bool
547 BeBoB::BootloaderManager::writeRequest( CommandCodes& cmd )
548 {
549     unsigned char buf[ ( ( cmd.getMaxSize()+3 )/4 ) * 4 ];
550     memset( buf, 0, sizeof( buf ) );
551
552     BufferSerialize se( buf,  sizeof( buf ) );
553     if ( !cmd.serialize( se ) ) {
554         debugError( "writeRequest: Could not serialize command code %d\n",
555                     cmd.getCommandCode() );
556         return false;
557     }
558
559     if ( !get1394Serivce()->write(
560              0xffc0 | getConfigRom()->getNodeId(),
561              AddrRegReq,
562              sizeof( buf )/4,
563              reinterpret_cast<fb_quadlet_t*>( buf ) ) )
564     {
565         debugError( "writeRequest: Could not ARM write to node %d\n",
566                     getConfigRom()->getNodeId() );
567         return false;
568     }
569
570     return true;
571 }
572
573 bool
574 BeBoB::BootloaderManager::readResponse( CommandCodes& writeRequestCmd )
575 {
576     const size_t buf_length = 0x40;
577     unsigned char raw[buf_length];
578     if ( !get1394Serivce()->read(
579              0xffc0 | getConfigRom()->getNodeId(),
580              AddrRegResp,
581              writeRequestCmd.getRespSizeInQuadlets(),
582              reinterpret_cast<fb_quadlet_t*>( raw ) ) )
583     {
584         return false;
585     }
586
587     BufferDeserialize de( raw, buf_length );
588     if ( !writeRequestCmd.deserialize( de ) ) {
589         debugError( "readResponse: deserialize failed\n" );
590         return false;
591     }
592
593     bool result =
594         writeRequestCmd.getProtocolVersion()
595         == writeRequestCmd.getRespProtocolVersion();
596     result &=
597         writeRequestCmd.getCommandId()
598         == writeRequestCmd.getRespCommandId();
599     result &=
600         writeRequestCmd.getCommandCode()
601         == writeRequestCmd.getRespCommandCode();
602     #ifdef DEBUG
603        if ( !result ) {
604            debugError( "readResponse: protocol version: %d expected, "
605                        " %d reported\n",
606                        writeRequestCmd.getProtocolVersion(),
607                        writeRequestCmd.getRespProtocolVersion() );
608            debugError( "readResponse: command id: %d expected, "
609                        " %d reported\n",
610                        writeRequestCmd.getCommandId(),
611                        writeRequestCmd.getRespCommandId() );
612            debugError( "readResponse: command code: %d expected, "
613                        " %d reported\n",
614                        writeRequestCmd.getCommandCode(),
615                        writeRequestCmd.getRespCommandCode() );
616        }
617     #endif
618     return result;
619 }
620
621 bool
622 BeBoB::BootloaderManager::startBootloaderCmd()
623 {
624     CommandCodesReset cmd( m_protocolVersion,
625                            CommandCodesReset::eSM_Bootloader ) ;
626     if ( !writeRequest( cmd ) ) {
627         debugError( "startBootloaderCmd: writeRequest failed\n" );
628         return false;
629     }
630
631     waitForBusReset();
632     if ( !cacheInfoRegisters( MaxRetries ) ) {
633         debugError( "startBootloaderCmd: Could not read info registers\n" );
634         return false;
635     }
636
637     // wait for bootloader finish startup sequence
638     // there is no way to find out when it has finished
639     sleep( 10 );
640
641     return true;
642 }
643
644 bool
645 BeBoB::BootloaderManager::startApplicationCmd()
646 {
647     CommandCodesGo cmd( m_protocolVersion,
648                            CommandCodesGo::eSM_Application ) ;
649     if ( !writeRequest( cmd ) ) {
650         debugError( "startApplicationCmd: writeRequest failed\n" );
651         return false;
652     }
653
654     return true;
655 }
656
657 bool
658 BeBoB::BootloaderManager::programGUIDCmd( fb_octlet_t guid )
659 {
660     CommandCodesProgramGUID cmd( m_protocolVersion, guid );
661     if ( !writeRequest( cmd ) ) {
662         debugError( "programGUIDCmd: writeRequest failed\n" );
663         return false;
664     }
665
666     sleep( 1 );
667
668     return true;
669 }
670
671 bool
672 BeBoB::BootloaderManager::initializePersParamCmd()
673 {
674     CommandCodesInitializePersParam cmd( m_protocolVersion );
675     if ( !writeRequest( cmd ) ) {
676         debugError( "initializePersParamCmd: writeRequest failed\n" );
677         return false;
678     }
679
680     sleep( 1 );
681
682     return true;
683 }
684
685 bool
686 BeBoB::BootloaderManager::initializeConfigToFactorySettingCmd()
687 {
688     CommandCodesInitializeConfigToFactorySetting cmd( m_protocolVersion );
689     if ( !writeRequest( cmd ) ) {
690         debugError( "initializeConfigToFactorySettingCmd: writeRequest failed\n" );
691         return false;
692     }
693
694     sleep( 5 );
695
696     return true;
697 }
698
699 bool
700 BeBoB::BootloaderManager::checkDeviceCompatibility( BCD& bcd )
701 {
702     fb_quadlet_t vendorOUI = (  m_cachedInfoRegs.m_guid >> 40 );
703
704
705     if ( ( vendorOUI == bcd.getVendorOUI() )
706          && ( m_cachedInfoRegs.m_softwareId == bcd.getSoftwareId() ) )
707     {
708         return true;
709     }
710
711     printf( "vendorOUI = 0x%08x\n", vendorOUI );
712     printf( "BCD vendorOUI = 0x%08x\n", bcd.getVendorOUI() );
713     printf( "software ID = 0x%08x\n", m_cachedInfoRegs.m_softwareId );
714     printf( "BCD software ID = 0x%08x\n", bcd.getSoftwareId() );
715
716     return false;
717 }
718
719 #endif //#ifdef ENABLE_BEBOB
Note: See TracBrowser for help on using the browser.