root/branches/streaming-rework/src/libstreaming/IsoStream.cpp

Revision 390, 3.1 kB (checked in by pieterpalmers, 17 years ago)

* working version of SYT based AMDTP receive and transmit.

Still has to be tuned to work with low buffer sizes.

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
29 #include "IsoStream.h"
30 #include <assert.h>
31
32 namespace FreebobStreaming
33 {
34
35 IMPL_DEBUG_MODULE( IsoStream, IsoStream, DEBUG_LEVEL_NORMAL );
36
37 enum raw1394_iso_disposition
38 IsoStream::putPacket(unsigned char *data, unsigned int length,
39                      unsigned char channel, unsigned char tag, unsigned char sy,
40                      unsigned int cycle, unsigned int dropped) {
41
42     debugOutput( DEBUG_LEVEL_VERY_VERBOSE,
43                  "received packet: length=%d, channel=%d, cycle=%d\n",
44                  length, channel, cycle );
45
46     return RAW1394_ISO_OK;
47 }
48
49 enum raw1394_iso_disposition
50 IsoStream::getPacket(unsigned char *data, unsigned int *length,
51                      unsigned char *tag, unsigned char *sy,
52                      int cycle, unsigned int dropped, unsigned int max_length) {
53     debugOutput( DEBUG_LEVEL_VERY_VERBOSE,
54                  "sending packet: length=%d, cycle=%d\n",
55                  *length, cycle );
56
57     memcpy(data,&cycle,sizeof(cycle));
58     *length=sizeof(cycle);
59     *tag = 1;
60     *sy = 0;
61
62
63     return RAW1394_ISO_OK;
64 }
65
66 int IsoStream::getNodeId() {
67     if (m_handler) {
68         return m_handler->getLocalNodeId();
69     }
70     return -1;
71 }
72
73
74 void IsoStream::dumpInfo()
75 {
76
77     debugOutputShort( DEBUG_LEVEL_NORMAL, "  Address        : %p\n",this);
78     debugOutputShort( DEBUG_LEVEL_NORMAL, "  Stream type    : %s\n",
79             (this->getType()==EST_Receive ? "Receive" : "Transmit"));
80     debugOutputShort( DEBUG_LEVEL_NORMAL, "  Port, Channel  : %d, %d\n",
81             m_port, m_channel);
82
83 }
84
85 bool IsoStream::setChannel(int c) {
86     debugOutput( DEBUG_LEVEL_VERBOSE, "setting channel to %d\n",c);
87
88     m_channel=c;
89     return true;
90 }
91
92
93 bool IsoStream::reset() {
94     debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
95     return true;
96 }
97
98 bool IsoStream::prepare() {
99     debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
100     return true;
101 }
102
103 bool IsoStream::init() {
104     debugOutput( DEBUG_LEVEL_VERBOSE, "enter...\n");
105     return true;
106
107 }
108
109 void IsoStream::setHandler(IsoHandler *h) {
110     debugOutput( DEBUG_LEVEL_VERBOSE, "setting handler of isostream %p to %p\n", this,h);
111     m_handler=h;
112 }
113
114 void IsoStream::clearHandler() {
115     debugOutput( DEBUG_LEVEL_VERBOSE, "clearing handler of isostream %p\n", this);
116
117     m_handler=0;
118
119 }
120
121
122 }
Note: See TracBrowser for help on using the browser.