root/trunk/libffado/src/fireworks/fireworks_device.h

Revision 2803, 4.7 kB (checked in by jwoithe, 1 year ago)

Cosmetic: capitalise "L" in "Linux".

"Linux" is a proper noun so it should start with a capital letter. These
changes are almost all within comments.

This patch was originally proposed by pander on the ffado-devel mailing
list. It has been expanded to cover all similar cases to maintain
consistency throughout the source tree.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
3  * Copyright (C) 2005-2008 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free FireWire (pro-)audio drivers for Linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 2 of the License, or
13  * (at your option) version 3 of the License.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef FIREWORKS_DEVICE_H
26 #define FIREWORKS_DEVICE_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "genericavc/avc_avdevice.h"
31
32 #include "efc/efc_cmd.h"
33 #include "efc/efc_cmds_hardware.h"
34 #include "efc/efc_cmds_hardware_ctrl.h"
35 #include "fireworks_session_block.h"
36
37 #include <pthread.h>
38 #include "libutil/Mutex.h"
39
40 class ConfigRom;
41 class Ieee1394Service;
42
43 namespace FireWorks {
44
45 class Device : public GenericAVC::Device {
46     friend class MonitorControl;
47     friend class SimpleControl;
48     friend class BinaryControl;
49     friend class IOConfigControl;
50    
51 public:
52     Device( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom ) );
53     virtual ~Device();
54    
55     static bool probe( Util::Configuration&, ConfigRom& configRom, bool generic = false );
56     static FFADODevice * createDevice( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom ));
57     virtual bool discover();
58
59     virtual void showDevice();
60    
61     virtual bool buildMixer();
62     virtual bool destroyMixer();
63
64     virtual std::vector<int> getSupportedSamplingFrequencies();
65
66     virtual ClockSourceVector getSupportedClockSources();
67     virtual bool setActiveClockSource(ClockSource);
68     virtual ClockSource getActiveClockSource();
69     virtual int getSamplingFrequency();
70     virtual bool setSamplingFrequency( int );
71
72     const EfcHardwareInfoCmd getHwInfo()
73         {return m_HwInfo;};
74
75 // protected: //?
76     bool doEfcOverAVC(EfcCmd& c);
77    
78     /**
79      * @brief Read flash
80      * @param start start address
81      * @param len length in quadlets (4 bytes)
82      * @param buffer target buffer (should be 'len*4' bytes long)
83      * @return true if successful
84      */
85     bool readFlash(uint32_t start, uint32_t len, uint32_t* buffer);
86
87     /**
88      * @brief Write flash
89      * @param start start address
90      * @param len length in quadlets (4 bytes)
91      * @param buffer target buffer (should be 'len*4' bytes long)
92      * @return true if successful
93      */
94     bool writeFlash(uint32_t start, uint32_t len, uint32_t* buffer);
95
96     /**
97      * @brief (un)lock the flash
98      * @param lock true=locked, false=unlocked
99      * @return true if successful
100      */
101     bool lockFlash(bool lock);
102     /**
103      * @brief erase flash block
104      * @param addr address of block to erase
105      * @return true if successful
106      */
107     bool eraseFlash(uint32_t addr);
108     bool eraseFlashBlocks(uint32_t start_address, unsigned int nb_quads);
109
110     /**
111      * @brief wait until the device indicates the flash memory is ready
112      * @param msecs time to wait before timeout
113      * @return true if the flash is ready, false if timeout
114      */
115     bool waitForFlash(unsigned int msecs);
116
117     /**
118      * @brief get the flash address of the session block
119      * @return session block base address
120      */
121     uint32_t getSessionBase();
122
123     /**
124      * load the session block from the device
125      * @return true if successful
126      */
127     bool loadSession();
128     /**
129      * save the session block to the device
130      * @return true if successful
131      */
132     bool saveSession();
133
134 // Echo specific stuff
135 private:
136    
137     bool discoverUsingEFC();
138
139     FFADODevice::ClockSource clockIdToClockSource(uint32_t clockflag);
140     bool isClockValid(uint32_t id);
141
142     bool getClock(EfcGetClockCmd &gccmd);
143     uint32_t getClockSrc();
144
145     bool setClock(EfcSetClockCmd sccmd);
146     bool setClockSrc(uint32_t clock);
147  
148     /*
149      * Audiofire12 often return wrong data for clock source.
150      * This member is used to cache the latest clock source change.
151      */
152     int m_current_clock;
153
154     EfcHardwareInfoCmd  m_HwInfo;
155
156     bool updatePolledValues();
157     Util::Mutex*        m_poll_lock;
158     EfcPolledValuesCmd  m_Polled;
159
160     bool                m_efc_discovery_done;
161
162 protected:
163     Session             m_session;
164 private:
165     Control::Container *m_MixerContainer;
166     Control::Container *m_HwInfoContainer;
167
168 };
169
170
171 } // namespace FireWorks
172
173 #endif
Note: See TracBrowser for help on using the browser.