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

Revision 407, 3.6 kB (checked in by pieterpalmers, 17 years ago)

- Changed the way the device class configure options are handled. Now they are handled in the makefiles instead of the source files. The only source file that still contains the #ifdef's is devicemanager.cpp, to conditionally include the device class include files and to conditionally probe the classes that might be supported.
- added a configure option to disable the compilation of the test programs in tests/
- cleaned up the ADMTP transmit streamprocessor. Now it sends silenced packets when in the disabled state, instead of no-data packets
- added a getNodeID() to ieee1394service
- made comments in ieee1394service.h doxygen compliant

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