1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
3 |
* |
---|
4 |
* This file is part of FFADO |
---|
5 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
6 |
* |
---|
7 |
* FFADO is based upon FreeBoB. |
---|
8 |
* |
---|
9 |
* This library is free software; you can redistribute it and/or |
---|
10 |
* modify it under the terms of the GNU Lesser General Public |
---|
11 |
* License version 2.1, as published by the Free Software Foundation; |
---|
12 |
* |
---|
13 |
* This library is distributed in the hope that it will be useful, |
---|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 |
* Lesser General Public License for more details. |
---|
17 |
* |
---|
18 |
* You should have received a copy of the GNU Lesser General Public |
---|
19 |
* License along with this library; if not, write to the Free Software |
---|
20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
21 |
* MA 02110-1301 USA |
---|
22 |
*/ |
---|
23 |
|
---|
24 |
#include "IsoStream.h" |
---|
25 |
#include <assert.h> |
---|
26 |
|
---|
27 |
namespace Streaming |
---|
28 |
{ |
---|
29 |
|
---|
30 |
IMPL_DEBUG_MODULE( IsoStream, IsoStream, DEBUG_LEVEL_NORMAL ); |
---|
31 |
|
---|
32 |
enum raw1394_iso_disposition |
---|
33 |
IsoStream::putPacket(unsigned char *data, unsigned int length, |
---|
34 |
unsigned char channel, unsigned char tag, unsigned char sy, |
---|
35 |
unsigned int cycle, unsigned int dropped) { |
---|
36 |
|
---|
37 |
debugOutput( DEBUG_LEVEL_VERY_VERBOSE, |
---|
38 |
"received packet: length=%d, channel=%d, cycle=%d\n", |
---|
39 |
length, channel, cycle ); |
---|
40 |
|
---|
41 |
return RAW1394_ISO_OK; |
---|
42 |
} |
---|
43 |
|
---|
44 |
enum raw1394_iso_disposition |
---|
45 |
IsoStream::getPacket(unsigned char *data, unsigned int *length, |
---|
46 |
unsigned char *tag, unsigned char *sy, |
---|
47 |
int cycle, unsigned int dropped, unsigned int max_length) { |
---|
48 |
debugOutput( DEBUG_LEVEL_VERY_VERBOSE, |
---|
49 |
"sending packet: length=%d, cycle=%d\n", |
---|
50 |
*length, cycle ); |
---|
51 |
|
---|
52 |
memcpy(data,&cycle,sizeof(cycle)); |
---|
53 |
*length=sizeof(cycle); |
---|
54 |
*tag = 1; |
---|
55 |
*sy = 0; |
---|
56 |
|
---|
57 |
|
---|
58 |
return RAW1394_ISO_OK; |
---|
59 |
} |
---|
60 |
|
---|
61 |
int IsoStream::getNodeId() { |
---|
62 |
if (m_handler) { |
---|
63 |
return m_handler->getLocalNodeId(); |
---|
64 |
} |
---|
65 |
return -1; |
---|
66 |
} |
---|
67 |
|
---|
68 |
|
---|
69 |
void IsoStream::dumpInfo() |
---|
70 |
{ |
---|
71 |
|
---|
72 |
debugOutputShort( DEBUG_LEVEL_NORMAL, " Address : %p\n",this); |
---|
73 |
debugOutputShort( DEBUG_LEVEL_NORMAL, " Stream type : %s\n", |
---|
74 |
(this->getStreamType()==eST_Receive ? "Receive" : "Transmit")); |
---|
75 |
debugOutputShort( DEBUG_LEVEL_NORMAL, " Port, Channel : %d, %d\n", |
---|
76 |
m_port, m_channel); |
---|
77 |
|
---|
78 |
} |
---|
79 |
|
---|
80 |
bool IsoStream::setChannel(int c) { |
---|
81 |
debugOutput( DEBUG_LEVEL_VERBOSE, "setting channel for (%p) to %d\n",this, c); |
---|
82 |
|
---|
83 |
m_channel=c; |
---|
84 |
return true; |
---|
85 |
} |
---|
86 |
|
---|
87 |
|
---|
88 |
bool IsoStream::reset() { |
---|
89 |
debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n"); |
---|
90 |
return true; |
---|
91 |
} |
---|
92 |
|
---|
93 |
bool IsoStream::prepare() { |
---|
94 |
debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n"); |
---|
95 |
return true; |
---|
96 |
} |
---|
97 |
|
---|
98 |
bool IsoStream::init() { |
---|
99 |
debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n"); |
---|
100 |
return true; |
---|
101 |
|
---|
102 |
} |
---|
103 |
|
---|
104 |
void IsoStream::setHandler(IsoHandler *h) { |
---|
105 |
debugOutput( DEBUG_LEVEL_VERBOSE, "setting handler of isostream %p to %p\n", this,h); |
---|
106 |
m_handler=h; |
---|
107 |
} |
---|
108 |
|
---|
109 |
void IsoStream::clearHandler() { |
---|
110 |
debugOutput( DEBUG_LEVEL_VERBOSE, "clearing handler of isostream %p\n", this); |
---|
111 |
|
---|
112 |
m_handler=0; |
---|
113 |
|
---|
114 |
} |
---|
115 |
|
---|
116 |
|
---|
117 |
} |
---|