root/trunk/libffado/src/bounce/bounce_avdevice.h

Revision 2803, 4.0 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 Pieter Palmers
3  * Copyright (C) 2005-2008 by Daniel Wagner
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 BOUNCEDEVICE_H
26 #define BOUNCEDEVICE_H
27
28 #include "debugmodule/debugmodule.h"
29 #include "libavc/avc_definitions.h"
30 #include "libavc/general/avc_extended_cmd_generic.h"
31
32 #include "libstreaming/amdtp/AmdtpReceiveStreamProcessor.h"
33 #include "libstreaming/amdtp/AmdtpTransmitStreamProcessor.h"
34 #include "libstreaming/amdtp/AmdtpPort.h"
35 #include "libstreaming/amdtp/AmdtpPortInfo.h"
36
37 #include "libieee1394/ieee1394service.h"
38
39 #include "ffadodevice.h"
40
41 #include <vector>
42
43 #define BOUNCE_REGISTER_BASE 0x0000FFFFE0000000ULL
44 #define BOUNCE_REGISTER_LENGTH (4*256)
45 #define BOUNCE_REGISTER_TX_ISOCHANNEL 0x10
46 #define BOUNCE_REGISTER_RX_ISOCHANNEL 0x14
47 #define BOUNCE_INVALID_OFFSET 0xFFFFF00000000000ULL
48
49 #define BOUNCE_NB_AUDIO_CHANNELS 4
50
51 // don't define more than 8 midi channels!
52 #define BOUNCE_NB_MIDI_CHANNELS  2
53
54 class ConfigRom;
55 class DeviceManager;
56
57 namespace Util {
58     class Configuration;
59 }
60
61 namespace Bounce {
62
63 class Device : public FFADODevice {
64 private:
65     class BounceNotifier;
66 public:
67     Device( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom ));
68     virtual ~Device();
69
70     static bool probe( Util::Configuration&, ConfigRom& configRom, bool generic = false );
71     static FFADODevice * createDevice( DeviceManager& d, ffado_smartptr<ConfigRom>( configRom ));
72     virtual bool discover();
73
74     virtual bool setSamplingFrequency( int samplingFrequency );
75     virtual int getSamplingFrequency( );
76    
77     virtual ClockSourceVector getSupportedClockSources();
78     virtual bool setActiveClockSource(ClockSource);
79     virtual ClockSource getActiveClockSource();
80
81     virtual std::vector<int> getSupportedSamplingFrequencies();
82
83     virtual bool prepare();
84     virtual bool lock();
85     virtual bool unlock();
86
87     virtual int getStreamCount();
88
89     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
90
91     virtual bool startStreamByIndex(int i);
92     virtual bool stopStreamByIndex(int i);
93
94     virtual void showDevice();
95
96 protected:
97     unsigned int m_samplerate;
98
99     // streaming stuff
100     typedef std::vector< Streaming::StreamProcessor * > StreamProcessorVector;
101     StreamProcessorVector m_receiveProcessors;
102     StreamProcessorVector m_transmitProcessors;
103
104     bool addPortsToProcessor(
105        Streaming::StreamProcessor *processor,
106        Streaming::Port::E_Direction direction);
107
108 private: // generic helpers
109     int allocateIsoChannel(unsigned int packet_size);
110     bool deallocateIsoChannel(int channel);
111
112 protected: // I/O helpers
113     // quadlet read/write routines
114     bool readReg(fb_nodeaddr_t, fb_quadlet_t *);
115     bool writeReg(fb_nodeaddr_t, fb_quadlet_t);
116     bool readRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t);
117     bool writeRegBlock(fb_nodeaddr_t, fb_quadlet_t *, size_t);
118
119 private:
120     BounceNotifier *m_Notifier;
121     /**
122      * this class reacts on the other side writing to the
123      * hosts address space
124      */
125     #define BOUNCE_NOTIFIER_BASE_ADDRESS 0x0000FFFFE0000000ULL
126     #define BOUNCE_NOTIFIER_BLOCK_LENGTH 4
127     class BounceNotifier : public Ieee1394Service::ARMHandler
128     {
129     public:
130         BounceNotifier(Device &, nodeaddr_t start);
131         virtual ~BounceNotifier();
132
133     private:
134         Device &m_bouncedevice;
135     };
136 };
137
138 }
139
140 #endif
Note: See TracBrowser for help on using the browser.