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

Revision 583, 3.0 kB (checked in by ppalmers, 13 years ago)

- Clean up the FFADODevice constructor to remove the nodeid that

can be retrieved from the configrom.

- Implement new method of creating devices: a device is supposed

to implement the createDevice static method that should return
an instance of itself or a subclass of itself. This should ease
support for manufacturer specific customizations since we don't
have to put them into the device manager class.

Line 
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( Ieee1394Service& ieee1394Service,
48                        std::auto_ptr<ConfigRom>( configRom ));
49     virtual ~BounceSlaveDevice();
50
51     static bool probe( ConfigRom& configRom );
52     static FFADODevice * createDevice( Ieee1394Service& ieee1394Service,
53                                         std::auto_ptr<ConfigRom>( configRom ));
54     bool discover();
55     bool prepare();
56     bool lock();
57     bool unlock();
58
59     bool startStreamByIndex(int i);
60     bool stopStreamByIndex(int i);
61
62 private:
63     bool waitForRegisterNotEqualTo(nodeaddr_t offset, fb_quadlet_t v);
64     bool initMemSpace();
65     bool restoreMemSpace();
66
67 private: // configrom shit
68
69     struct configrom_backup {
70         quadlet_t rom[0x100];
71         size_t rom_size;
72         unsigned char rom_version;
73     };
74     struct configrom_backup m_original_config_rom;
75
76     struct configrom_backup
77         save_config_rom(raw1394handle_t handle);
78     int restore_config_rom(raw1394handle_t handle, struct configrom_backup old);
79     int init_config_rom(raw1394handle_t handle);
80
81 private:
82     BounceSlaveNotifier *m_Notifier;
83     /**
84      * this class reacts on the ohter side writing to the
85      * hosts address space
86      */
87     class BounceSlaveNotifier : public ARMHandler
88     {
89     public:
90         BounceSlaveNotifier(BounceSlaveDevice *, nodeaddr_t start);
91         virtual ~BounceSlaveNotifier();
92
93     private:
94         BounceSlaveDevice *m_bounceslavedevice;
95     };
96 };
97
98 } // end of namespace Bounce
99
100 #endif /* __FFADO_BOUNCESLAVEDEVICE__ */
101
102
Note: See TracBrowser for help on using the browser.