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

Revision 688, 3.8 kB (checked in by ppalmers, 13 years ago)

- Remove bebob sync tool, since this is now generalized into the FFADODevice API.

the sync source can be set with tests/test-ffado

- introduce a new directory for firmware tools: support/firmware
- Move the bridgeco firmware downloader to the support/firmware directory
- initial code for echo firmware downloading

Line 
1 /*
2  * Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
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.