root/branches/streaming-rework/src/bounce/bounce_slave_avdevice.h

Revision 426, 2.5 kB (checked in by pieterpalmers, 17 years ago)

- changed the IAvDevice from an interface to a base class,

since there is some code duplication starting to
appear.

Line 
1 /* $Id$ */
2
3 /*
4  *   FreeBob Streaming API
5  *   FreeBob = Firewire (pro-)audio for linux
6  *
7  *   http://freebob.sf.net
8  *
9  *   Copyright (C) 2007 Pieter Palmers <pieterpalmers@users.sourceforge.net>
10  *
11  *   This program is free software {} you can redistribute it and/or modify
12  *   it under the terms of the GNU General Public License as published by
13  *   the Free Software Foundation {} either version 2 of the License, or
14  *   (at your option) any later version.
15  *
16  *   This program is distributed in the hope that it will be useful,
17  *   but WITHOUT ANY WARRANTY {} without even the implied warranty of
18  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *   GNU General Public License for more details.
20  *
21  *   You should have received a copy of the GNU General Public License
22  *   along with this program {} if not, write to the Free Software
23  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  *
26  *
27  */
28 #ifndef __FREEBOB_BOUNCESLAVEDEVICE__
29 #define __FREEBOB_BOUNCESLAVEDEVICE__
30
31 #include "debugmodule/debugmodule.h"
32 #include "bounce_avdevice.h"
33
34 namespace Bounce {
35
36 class BounceSlaveDevice : public BounceDevice {
37     class BounceSlaveNotifier;
38 public:
39
40     BounceSlaveDevice( std::auto_ptr<ConfigRom>( configRom ),
41           Ieee1394Service& ieee1394Service );
42     virtual ~BounceSlaveDevice();
43    
44     static bool probe( ConfigRom& configRom );
45     bool discover();
46     bool prepare();
47     bool lock();
48     bool unlock();
49    
50     bool startStreamByIndex(int i);
51     bool stopStreamByIndex(int i);
52
53 private:
54     bool waitForRegisterNotEqualTo(nodeaddr_t offset, fb_quadlet_t v);
55     bool initMemSpace();
56     bool restoreMemSpace();
57    
58 private: // configrom shit
59
60     struct configrom_backup {
61         quadlet_t rom[0x100];
62         size_t rom_size;
63         unsigned char rom_version;
64     };
65     struct configrom_backup m_original_config_rom;
66    
67     struct configrom_backup
68         save_config_rom(raw1394handle_t handle);
69     int restore_config_rom(raw1394handle_t handle, struct configrom_backup old);
70     int init_config_rom(raw1394handle_t handle);
71    
72 private:
73     BounceSlaveNotifier *m_Notifier;
74     /**
75      * this class reacts on the ohter side writing to the
76      * hosts address space
77      */
78     class BounceSlaveNotifier : public ARMHandler
79     {
80     public:
81         BounceSlaveNotifier(BounceSlaveDevice *, nodeaddr_t start);
82         virtual ~BounceSlaveNotifier();
83        
84     private:
85         BounceSlaveDevice *m_bounceslavedevice;
86     };
87 };
88
89 } // end of namespace Bounce
90
91 #endif /* __FREEBOB_BOUNCESLAVEDEVICE__ */
92
93
Note: See TracBrowser for help on using the browser.