1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
3 |
* Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or |
---|
11 |
* modify it under the terms of the GNU Lesser General Public |
---|
12 |
* License version 2.1, as published by the Free Software Foundation; |
---|
13 |
* |
---|
14 |
* This library 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 GNU |
---|
17 |
* Lesser General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU Lesser General Public |
---|
20 |
* License along with this library; if not, write to the Free Software |
---|
21 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
22 |
* MA 02110-1301 USA |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#ifndef __FFADO_BOUNCESLAVEDEVICE__ |
---|
26 |
#define __FFADO_BOUNCESLAVEDEVICE__ |
---|
27 |
|
---|
28 |
#include "debugmodule/debugmodule.h" |
---|
29 |
#include "bounce_avdevice.h" |
---|
30 |
|
---|
31 |
#define FFADO_MAX_NAME_LEN 256 |
---|
32 |
|
---|
33 |
#define FFADO_BOUNCE_SERVER_VENDORNAME "FFADO Server" |
---|
34 |
#define FFADO_BOUNCE_SERVER_MODELNAME "ffado-server" |
---|
35 |
|
---|
36 |
// NOTE: this is currently free, but it is not really allowed to use |
---|
37 |
#define FFADO_BOUNCE_SERVER_VENDORID 0x000B0001 |
---|
38 |
#define FFADO_BOUNCE_SERVER_MODELID 0x000B0001 |
---|
39 |
#define FFADO_BOUNCE_SERVER_SPECID 0x000B0001 |
---|
40 |
|
---|
41 |
namespace Bounce { |
---|
42 |
|
---|
43 |
class BounceSlaveDevice : public BounceDevice { |
---|
44 |
class BounceSlaveNotifier; |
---|
45 |
public: |
---|
46 |
|
---|
47 |
BounceSlaveDevice( std::auto_ptr<ConfigRom>( configRom ), |
---|
48 |
Ieee1394Service& ieee1394Service ); |
---|
49 |
virtual ~BounceSlaveDevice(); |
---|
50 |
|
---|
51 |
static bool probe( ConfigRom& configRom ); |
---|
52 |
bool discover(); |
---|
53 |
bool prepare(); |
---|
54 |
bool lock(); |
---|
55 |
bool unlock(); |
---|
56 |
|
---|
57 |
bool startStreamByIndex(int i); |
---|
58 |
bool stopStreamByIndex(int i); |
---|
59 |
|
---|
60 |
private: |
---|
61 |
bool waitForRegisterNotEqualTo(nodeaddr_t offset, fb_quadlet_t v); |
---|
62 |
bool initMemSpace(); |
---|
63 |
bool restoreMemSpace(); |
---|
64 |
|
---|
65 |
private: // configrom shit |
---|
66 |
|
---|
67 |
struct configrom_backup { |
---|
68 |
quadlet_t rom[0x100]; |
---|
69 |
size_t rom_size; |
---|
70 |
unsigned char rom_version; |
---|
71 |
}; |
---|
72 |
struct configrom_backup m_original_config_rom; |
---|
73 |
|
---|
74 |
struct configrom_backup |
---|
75 |
save_config_rom(raw1394handle_t handle); |
---|
76 |
int restore_config_rom(raw1394handle_t handle, struct configrom_backup old); |
---|
77 |
int init_config_rom(raw1394handle_t handle); |
---|
78 |
|
---|
79 |
private: |
---|
80 |
BounceSlaveNotifier *m_Notifier; |
---|
81 |
/** |
---|
82 |
* this class reacts on the ohter side writing to the |
---|
83 |
* hosts address space |
---|
84 |
*/ |
---|
85 |
class BounceSlaveNotifier : public ARMHandler |
---|
86 |
{ |
---|
87 |
public: |
---|
88 |
BounceSlaveNotifier(BounceSlaveDevice *, nodeaddr_t start); |
---|
89 |
virtual ~BounceSlaveNotifier(); |
---|
90 |
|
---|
91 |
private: |
---|
92 |
BounceSlaveDevice *m_bounceslavedevice; |
---|
93 |
}; |
---|
94 |
}; |
---|
95 |
|
---|
96 |
} // end of namespace Bounce |
---|
97 |
|
---|
98 |
#endif /* __FFADO_BOUNCESLAVEDEVICE__ */ |
---|
99 |
|
---|
100 |
|
---|