root/trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.h

Revision 2802, 3.7 kB (checked in by jwoithe, 3 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

Line 
1 /*
2  * Copyright (C) 2005-2009 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_RMERECEIVESTREAMPROCESSOR__
26 #define __FFADO_RMERECEIVESTREAMPROCESSOR__
27
28 /**
29  * This class implements RME 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 RmeAudioPort;
40 class RmeMidiPort;
41 /*!
42  * \brief The Base Class for a RME receive stream processor
43  *
44  * This class implements the outgoing stream processing for
45  * motu devices
46  *
47  */
48 class RmeReceiveStreamProcessor
49     : public StreamProcessor
50 {
51
52 public:
53     /**
54      * Create a RME receive StreamProcessor
55      * @param port 1394 port
56      * @param dimension number of substreams in the ISO stream
57      *                  (midi-muxed is only one stream)
58      */
59     RmeReceiveStreamProcessor(FFADODevice &parent, unsigned int model, unsigned int event_size);
60     virtual ~RmeReceiveStreamProcessor() {};
61
62     enum eChildReturnValue processPacketHeader(unsigned char *data, unsigned int length,
63                                                unsigned char tag, unsigned char sy,
64                                                uint32_t pkt_ctr);
65     enum eChildReturnValue processPacketData(unsigned char *data, unsigned int length);
66
67     virtual bool prepareChild();
68
69 public:
70     virtual unsigned int getEventSize()
71                 {return m_event_size;};
72     virtual unsigned int getMaxPacketSize();
73     virtual unsigned int getEventsPerFrame()
74                     { return 1; };
75     virtual unsigned int getNominalFramesPerPacket();
76
77     /* For testing only at this stage */
78     signed int n_hw_tx_buffer_samples;
79
80 protected:
81     bool processReadBlock(char *data, unsigned int nevents, unsigned int offset);
82
83 private:
84     bool decodePacketPorts(quadlet_t *data, unsigned int nevents, unsigned int dbc);
85
86     int decodeRmeEventsToPort(RmeAudioPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
87     int decodeRmeMidiEventsToPort(RmeMidiPort *, quadlet_t *data, unsigned int offset, unsigned int nevents);
88
89     unsigned int m_rme_model;
90     /*
91      * An iso packet mostly consists of multiple events.  m_event_size
92      * is the size of a single 'event' in bytes.
93      */
94     unsigned int m_event_size;
95
96     /* A small MIDI buffer to cover for the case where we need to span a
97      * period - that is, if more than one MIDI byte is sent per packet.
98      * Since the long-term average data rate must be close to the MIDI spec
99      * (as it's coming from a physical MIDI port_ this buffer doesn't have
100      * to be particularly large.  The size is a power of 2 for optimisation
101      * reasons.
102      *
103      * FIXME: it is yet to be determined whether this is required for RME
104      * devices.
105      */
106     #define RX_MIDIBUFFER_SIZE_EXP 6
107     #define RX_MIDIBUFFER_SIZE     (1<<RX_MIDIBUFFER_SIZE_EXP)
108     unsigned int midibuffer[RX_MIDIBUFFER_SIZE];
109     unsigned mb_head, mb_tail;
110 };
111
112
113 } // end of namespace Streaming
114
115 #endif /* __FFADO_RMERECEIVESTREAMPROCESSOR__ */
116
Note: See TracBrowser for help on using the browser.