1 |
/* Ieee1394Service.cpp |
---|
2 |
* Copyright (C) 2005 by Daniel Wagner |
---|
3 |
* |
---|
4 |
* This file is part of FreeBob. |
---|
5 |
* |
---|
6 |
* FreeBob is free software; you can redistribute it and/or modify |
---|
7 |
* it under the terms of the GNU General Public License as published by |
---|
8 |
* the Free Software Foundation; either version 2 of the License, or |
---|
9 |
* (at your option) any later version. |
---|
10 |
* FreeBob is distributed in the hope that it will be useful, |
---|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 |
* GNU General Public License for more details. |
---|
14 |
* |
---|
15 |
* You should have received a copy of the GNU General Public License |
---|
16 |
* along with FreeBob; if not, write to the Free Software |
---|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
18 |
* MA 02111-1307 USA. |
---|
19 |
*/ |
---|
20 |
|
---|
21 |
#ifndef FREEBOBIEEE1394SERVICE_H |
---|
22 |
#define FREEBOBIEEE1394SERVICE_H |
---|
23 |
|
---|
24 |
#include "fbtypes.h" |
---|
25 |
|
---|
26 |
#include <libraw1394/raw1394.h> |
---|
27 |
|
---|
28 |
class Ieee1394Service{ |
---|
29 |
public: |
---|
30 |
Ieee1394Service(); |
---|
31 |
~Ieee1394Service(); |
---|
32 |
|
---|
33 |
bool initialize( int port ); |
---|
34 |
|
---|
35 |
int getPort() |
---|
36 |
{ return m_port; } |
---|
37 |
/** |
---|
38 |
* getNodecount - get number of nodes on the bus |
---|
39 |
* |
---|
40 |
* Since the root node always has |
---|
41 |
* the highest node ID, this number can be used to determine that ID (it's |
---|
42 |
* LOCAL_BUS|(count-1)). |
---|
43 |
* |
---|
44 |
* Returns: the number of nodes on the bus to which the port is connected. |
---|
45 |
* This value can change with every bus reset. |
---|
46 |
*/ |
---|
47 |
int getNodeCount(); |
---|
48 |
|
---|
49 |
/** |
---|
50 |
* read - send async read request to a node and wait for response. |
---|
51 |
* @node: target node |
---|
52 |
* @addr: address to read from |
---|
53 |
* @length: amount of data to read in quadlets |
---|
54 |
* @buffer: pointer to buffer where data will be saved |
---|
55 |
* |
---|
56 |
* This does the complete transaction and will return when it's finished. |
---|
57 |
* |
---|
58 |
* Returns: truee on success or false on failure (sets errno) |
---|
59 |
*/ |
---|
60 |
bool read( fb_nodeid_t nodeId, |
---|
61 |
fb_nodeaddr_t addr, |
---|
62 |
size_t size, |
---|
63 |
fb_quadlet_t* buffer ); |
---|
64 |
|
---|
65 |
/** |
---|
66 |
* write - send async write request to a node and wait for response. |
---|
67 |
* @node: target node |
---|
68 |
* @addr: address to write to |
---|
69 |
* @length: amount of data to write in quadlets |
---|
70 |
* @data: pointer to data to be sent |
---|
71 |
* |
---|
72 |
* This does the complete transaction and will return when it's finished. |
---|
73 |
* |
---|
74 |
* Returns: true on success or false on failure (sets errno) |
---|
75 |
*/ |
---|
76 |
bool write( fb_nodeid_t nodeId, |
---|
77 |
fb_nodeaddr_t addr, |
---|
78 |
size_t length, |
---|
79 |
fb_quadlet_t *data ); |
---|
80 |
|
---|
81 |
|
---|
82 |
fb_quadlet_t* transactionBlock( fb_nodeid_t nodeId, |
---|
83 |
fb_quadlet_t* buf, |
---|
84 |
int len ); |
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 |
|
---|
89 |
private: |
---|
90 |
raw1394handle_t m_handle; |
---|
91 |
int m_port; |
---|
92 |
}; |
---|
93 |
|
---|
94 |
#endif |
---|