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

Revision 864, 3.7 kB (checked in by ppalmers, 16 years ago)

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef BEBOB_DL_MGR_H
25 #define BEBOB_DL_MGR_H
26
27 #include "bebob_dl_codes.h"
28
29 #include "fbtypes.h"
30 #include "threads.h"
31
32 #include "debugmodule/debugmodule.h"
33
34 #include <iostream>
35
36 class Ieee1394Service;
37 class ConfigRom;
38
39 namespace BeBoB {
40     class BCD;
41
42     class BootloaderManager {
43     public:
44         BootloaderManager( Ieee1394Service& ieee1349service,
45                            fb_nodeid_t nodeId );
46         ~BootloaderManager();
47
48         const ConfigRom* const getConfigRom() const
49             { return m_configRom; }
50
51         void printInfoRegisters();
52
53         bool downloadFirmware( std::string filename );
54         bool downloadCnE( std::string filename );
55         bool programGUID( octlet_t guid );
56
57         void busresetHandler();
58
59         Ieee1394Service* get1394Serivce() const
60                 { return m_ieee1394service; }
61
62         bool setForceOperations( bool enabled )
63                 { m_forceEnabled = enabled; return true; }
64
65         bool setStartBootloader( bool bStartBootloader )
66             { m_bStartBootloader = bStartBootloader; return true; }
67         protected:
68         enum EObjectType {
69             eOT_Application,
70             eOT_CnE
71         };
72
73         void waitForBusReset();
74         bool writeRequest( CommandCodes& cmd );
75         bool readResponse( CommandCodes& writeRequestCmd );
76         bool downloadObject( BCD& bcd, EObjectType eObject );
77
78         bool programGUIDCmd( octlet_t guid );
79         bool startBootloaderCmd();
80         bool startApplicationCmd();
81         bool initializePersParamCmd();
82         bool initializeConfigToFactorySettingCmd();
83         bool checkDeviceCompatibility( BCD& bcd );
84
85     private:
86         bool cacheInfoRegisters();
87         bool cacheInfoRegisters( int retries );
88
89         struct info_register_t {
90             fb_octlet_t  m_manId;
91             fb_quadlet_t m_protocolVersion;
92             fb_quadlet_t m_bootloaderVersion;
93             fb_octlet_t  m_guid;
94             fb_quadlet_t m_hardwareModelId;
95             fb_quadlet_t m_hardwareRevision;
96             fb_octlet_t  m_softwareDate;
97             fb_octlet_t  m_softwareTime;
98             fb_quadlet_t m_softwareId;
99             fb_quadlet_t m_softwareVersion;
100             fb_quadlet_t m_baseAddress;
101             fb_quadlet_t m_maxImageLen;
102             fb_octlet_t  m_bootloaderDate;
103             fb_octlet_t  m_bootloaderTime;
104             fb_octlet_t  m_debuggerDate;
105             fb_octlet_t  m_debuggerTime;
106             fb_quadlet_t m_debuggerId;
107             fb_quadlet_t m_debuggerVersion;
108         };
109
110         Ieee1394Service*   m_ieee1394service;
111         ConfigRom*         m_configRom;
112
113         EBootloaderProtocolVersion m_protocolVersion;
114         bool               m_isAppRunning;
115         info_register_t    m_cachedInfoRegs;
116
117         pthread_mutex_t m_mutex;
118         pthread_cond_t  m_cond;
119
120         Functor*        m_functor;
121
122             bool            m_forceEnabled;
123         bool            m_bStartBootloader;
124
125         DECLARE_DEBUG_MODULE;
126     };
127 }
128
129 #endif
Note: See TracBrowser for help on using the browser.