root/branches/streaming-rework/src/libieee1394/ARMHandler.h

Revision 414, 2.7 kB (checked in by pieterpalmers, 17 years ago)

extended ARM handler functionality

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) 2005,2006 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_ARMHANDLER__
29 #define __FREEBOB_ARMHANDLER__
30
31 #include "../debugmodule/debugmodule.h"
32
33 #include <libraw1394/raw1394.h>
34
35 #include "ieee1394service.h"
36
37 /**
38  * @brief Class to handle AddressRangeMappings
39  *
40  * This class is intended to help with implementing
41  * address range mapping, i.e. implementing handlers
42  * that react to reads/writes of certain addresses
43  * in 1394 memory space
44  *
45  * see the _arm_ functions in raw1394.h for more insight
46  *
47  */
48  
49 class ARMHandler {
50 friend class Ieee1394Service;
51
52 public:
53
54     ARMHandler(nodeaddr_t start, size_t length,
55                unsigned int access_rights,
56                unsigned int notification_options,
57                unsigned int client_transactions
58               );
59    
60     virtual ~ARMHandler();
61
62     bool handleRead(struct raw1394_arm_request  *);
63     bool handleWrite(struct raw1394_arm_request  *);
64     bool handleLock(struct raw1394_arm_request  *);
65
66     struct raw1394_arm_response *getResponse() {return &m_response;};
67    
68     nodeaddr_t getStart() {return m_start;};
69     nodeaddr_t getLength() {return m_length;};
70     unsigned int getAccessRights() {return m_access_rights;};
71     unsigned int getNotificationOptions() {return m_notification_options;};
72     unsigned int getClientTransactions() {return m_client_transactions;};
73    
74     byte_t *getBuffer() {return m_buffer;};
75    
76 private:
77     nodeaddr_t m_start;
78     size_t m_length;
79     unsigned int m_access_rights;
80     unsigned int m_notification_options;
81     unsigned int m_client_transactions;
82
83     byte_t *m_buffer;
84    
85     struct raw1394_arm_response m_response;
86    
87     void printBufferBytes( unsigned int level, size_t length, byte_t* buffer ) const;
88     void printRequest(struct raw1394_arm_request *arm_req);
89    
90 protected:
91
92    
93     DECLARE_DEBUG_MODULE;
94
95 };
96
97 #endif /* __FREEBOB_ARMHANDLER__ */
98
99
Note: See TracBrowser for help on using the browser.