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