root/trunk/libfreebob/src/bebob/bebob_dl_mgr.h

Revision 303, 3.6 kB (checked in by wagi, 18 years ago)

Streaming test for the m-audio 410. some improvements in handling of
non-comfrorming devices (such as firespy)

Line 
1 /* bebob_dl_mgr.h
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 #ifndef BEBOB_DL_MGR_H
22 #define BEBOB_DL_MGR_H
23
24 #include "bebob_dl_codes.h"
25
26 #include "fbtypes.h"
27 #include "threads.h"
28
29 #include "debugmodule/debugmodule.h"
30
31 #include <iostream>
32
33 class Ieee1394Service;
34 class ConfigRom;
35
36 namespace BeBoB {
37     class BCD;
38
39     class BootloaderManager {
40     public:
41         BootloaderManager( Ieee1394Service& ieee1349service,
42                            fb_nodeid_t nodeId );
43         ~BootloaderManager();
44
45         const ConfigRom* const getConfigRom() const
46             { return m_configRom; }
47
48         void printInfoRegisters();
49
50         bool downloadFirmware( std::string filename );
51         bool downloadCnE( std::string filename );
52         bool programGUID( octlet_t guid );
53
54         void busresetHandler();
55
56         Ieee1394Service* get1394Serivce() const
57             { return m_ieee1394service; }
58
59         bool setForceOperations( bool enabled )
60             { m_forceEnabled = enabled; return true; }
61
62         bool setStartBootloader( bool bStartBootloader )
63             { m_bStartBootloader = bStartBootloader; return true; }
64     protected:
65         enum EObjectType {
66             eOT_Application,
67             eOT_CnE
68         };
69
70         void waitForBusReset();
71         bool writeRequest( CommandCodes& cmd );
72         bool readResponse( CommandCodes& writeRequestCmd );
73         bool downloadObject( BCD& bcd, EObjectType eObject );
74
75         bool programGUIDCmd( octlet_t guid );
76         bool startBootloaderCmd();
77         bool startApplicationCmd();
78         bool initializePersParamCmd();
79         bool initializeConfigToFactorySettingCmd();
80         bool checkDeviceCompatibility( BCD& bcd );
81
82     private:
83         bool cacheInfoRegisters();
84         bool cacheInfoRegisters( int retries );
85
86         struct info_register_t {
87             fb_octlet_t  m_manId;
88             fb_quadlet_t m_protocolVersion;
89             fb_quadlet_t m_bootloaderVersion;
90             fb_octlet_t  m_guid;
91             fb_quadlet_t m_hardwareModelId;
92             fb_quadlet_t m_hardwareRevision;
93             fb_octlet_t  m_softwareDate;
94             fb_octlet_t  m_softwareTime;
95             fb_quadlet_t m_softwareId;
96             fb_quadlet_t m_softwareVersion;
97             fb_quadlet_t m_baseAddress;
98             fb_quadlet_t m_maxImageLen;
99             fb_octlet_t  m_bootloaderDate;
100             fb_octlet_t  m_bootloaderTime;
101             fb_octlet_t  m_debuggerDate;
102             fb_octlet_t  m_debuggerTime;
103             fb_quadlet_t m_debuggerId;
104             fb_quadlet_t m_debuggerVersion;
105         };
106
107         Ieee1394Service*   m_ieee1394service;
108         ConfigRom*         m_configRom;
109
110         EBootloaderProtocolVersion m_protocolVersion;
111         bool               m_isAppRunning;
112         info_register_t    m_cachedInfoRegs;
113
114         pthread_mutex_t m_mutex;
115         pthread_cond_t  m_cond;
116
117         Functor*        m_functor;
118
119         bool            m_forceEnabled;
120         bool            m_bStartBootloader;
121
122         DECLARE_DEBUG_MODULE;
123     };
124 }
125
126 #endif
Note: See TracBrowser for help on using the browser.