1 |
/* |
---|
2 |
* Copyright (C) 2005-2008 by Jonathan Woithe |
---|
3 |
* Copyright (C) 2005-2008 by Pieter Palmers |
---|
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 program is free software: you can redistribute it and/or modify |
---|
11 |
* it under the terms of the GNU General Public License as published by |
---|
12 |
* the Free Software Foundation, either version 2 of the License, or |
---|
13 |
* (at your option) version 3 of the License. |
---|
14 |
* |
---|
15 |
* This program is distributed in the hope that it will be useful, |
---|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
* GNU General Public License for more details. |
---|
19 |
* |
---|
20 |
* You should have received a copy of the GNU General Public License |
---|
21 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
* |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#ifndef __FFADO_MOTURECEIVESTREAMPROCESSOR__ |
---|
26 |
#define __FFADO_MOTURECEIVESTREAMPROCESSOR__ |
---|
27 |
|
---|
28 |
/** |
---|
29 |
* This class implements MOTU streaming |
---|
30 |
*/ |
---|
31 |
|
---|
32 |
#include "debugmodule/debugmodule.h" |
---|
33 |
|
---|
34 |
#include "../generic/StreamProcessor.h" |
---|
35 |
#include "../util/cip.h" |
---|
36 |
|
---|
37 |
namespace Streaming { |
---|
38 |
|
---|
39 |
class MotuAudioPort; |
---|
40 |
/*! |
---|
41 |
* \brief The Base Class for a MOTU receive stream processor |
---|
42 |
* |
---|
43 |
* This class implements the outgoing stream processing for |
---|
44 |
* motu devices |
---|
45 |
* |
---|
46 |
*/ |
---|
47 |
class MotuReceiveStreamProcessor |
---|
48 |
: public StreamProcessor |
---|
49 |
{ |
---|
50 |
|
---|
51 |
public: |
---|
52 |
/** |
---|
53 |
* Create a MOTU receive StreamProcessor |
---|
54 |
* @param port 1394 port |
---|
55 |
* @param dimension number of substreams in the ISO stream |
---|
56 |
* (midi-muxed is only one stream) |
---|
57 |
*/ |
---|
58 |
MotuReceiveStreamProcessor(FFADODevice &parent, unsigned int event_size); |
---|
59 |
virtual ~MotuReceiveStreamProcessor() {}; |
---|
60 |
|
---|
61 |
enum eChildReturnValue processPacketHeader(unsigned char *data, unsigned int length, |
---|
62 |
unsigned char channel, unsigned char tag, unsigned char sy, |
---|
63 |
unsigned int cycle, unsigned int dropped); |
---|
64 |
enum eChildReturnValue processPacketData(unsigned char *data, unsigned int length, |
---|
65 |
unsigned char channel, unsigned char tag, unsigned char sy, |
---|
66 |
unsigned int cycle, unsigned int dropped); |
---|
67 |
|
---|
68 |
virtual bool prepareChild(); |
---|
69 |
|
---|
70 |
public: |
---|
71 |
virtual unsigned int getEventSize() |
---|
72 |
{return m_event_size;}; |
---|
73 |
virtual unsigned int getMaxPacketSize(); |
---|
74 |
virtual unsigned int getEventsPerFrame() |
---|
75 |
{ return 1; }; // FIXME: check |
---|
76 |
virtual unsigned int getNominalFramesPerPacket(); |
---|
77 |
|
---|
78 |
protected: |
---|
79 |
bool processReadBlock(char *data, unsigned int nevents, unsigned int offset); |
---|
80 |
|
---|
81 |
private: |
---|
82 |
bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc); |
---|
83 |
|
---|
84 |
int decodeMotuEventsToPort(MotuAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents); |
---|
85 |
|
---|
86 |
/* |
---|
87 |
* An iso packet mostly consists of multiple events. m_event_size |
---|
88 |
* is the size of a single 'event' in bytes. |
---|
89 |
*/ |
---|
90 |
unsigned int m_event_size; |
---|
91 |
}; |
---|
92 |
|
---|
93 |
|
---|
94 |
} // end of namespace Streaming |
---|
95 |
|
---|
96 |
#endif /* __FFADO_MOTURECEIVESTREAMPROCESSOR__ */ |
---|
97 |
|
---|