root/trunk/libffado/src/libstreaming/motu/MotuTransmitStreamProcessor.h

Revision 742, 4.0 kB (checked in by ppalmers, 13 years ago)

- Remove some obsolete support files and dirs

- Clean up the license statements in the source files. Everything is

GPL version 3 now.

- Add license and copyright notices to scons scripts

- Clean up some other text files

Line 
1 /*
2  * Copyright (C) 2005-2007 by Jonathan Woithe
3  * Copyright (C) 2005-2007 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 3 of the License, or
13  * (at your option) any later version.
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_MOTUTRANSMITSTREAMPROCESSOR__
26 #define __FFADO_MOTUTRANSMITSTREAMPROCESSOR__
27
28 /**
29  * This class implements MOTU based 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 Port;
40 class MotuAudioPort;
41
42 /*!
43 \brief The Base Class for an MOTU transmit stream processor
44
45  This class implements a TransmitStreamProcessor that multiplexes Ports
46  into MOTU streams.
47
48 */
49 class MotuTransmitStreamProcessor
50     : public StreamProcessor
51 {
52
53 public:
54     /**
55      * Create a MOTU transmit StreamProcessor
56      */
57     MotuTransmitStreamProcessor(int port, unsigned int event_size);
58     virtual ~MotuTransmitStreamProcessor() {};
59
60     enum eChildReturnValue generatePacketHeader(unsigned char *data, unsigned int *length,
61                               unsigned char *tag, unsigned char *sy,
62                               int cycle, unsigned int dropped, unsigned int max_length);
63     enum eChildReturnValue generatePacketData(unsigned char *data, unsigned int *length,
64                             unsigned char *tag, unsigned char *sy,
65                             int cycle, unsigned int dropped, unsigned int max_length);
66     enum eChildReturnValue generateSilentPacketHeader(unsigned char *data, unsigned int *length,
67                                     unsigned char *tag, unsigned char *sy,
68                                     int cycle, unsigned int dropped, unsigned int max_length);
69     enum eChildReturnValue generateSilentPacketData(unsigned char *data, unsigned int *length,
70                                   unsigned char *tag, unsigned char *sy,
71                                   int cycle, unsigned int dropped, unsigned int max_length);
72     virtual bool prepareChild();
73
74 public:
75     virtual unsigned int getEventSize()
76                 {return m_event_size;};
77     virtual unsigned int getMaxPacketSize();
78     virtual unsigned int getEventsPerFrame()
79                     { return 1; }; // FIXME: check
80     virtual unsigned int getNominalFramesPerPacket();
81
82 protected:
83     bool processWriteBlock(char *data, unsigned int nevents, unsigned int offset);
84     bool transmitSilenceBlock(char *data, unsigned int nevents, unsigned int offset);
85
86 private:
87     unsigned int fillNoDataPacketHeader(quadlet_t *data, unsigned int* length);
88     unsigned int fillDataPacketHeader(quadlet_t *data, unsigned int* length, uint32_t ts);
89
90     int transmitBlock(char *data, unsigned int nevents,
91                         unsigned int offset);
92
93     bool encodePacketPorts(quadlet_t *data, unsigned int nevents,
94                            unsigned int dbc);
95
96     int encodePortToMotuEvents(MotuAudioPort *, quadlet_t *data,
97                                 unsigned int offset, unsigned int nevents);
98     int encodeSilencePortToMotuEvents(MotuAudioPort *, quadlet_t *data,
99                                 unsigned int offset, unsigned int nevents);
100
101     /*
102      * An iso packet mostly consists of multiple events.  m_event_size
103      * is the size of a single 'event' in bytes.
104      */
105     unsigned int m_event_size;
106
107     // Keep track of transmission data block count
108     unsigned int m_tx_dbc;
109
110 };
111
112 } // end of namespace Streaming
113
114 #endif /* __FFADO_MOTUTRANSMITSTREAMPROCESSOR__ */
115
Note: See TracBrowser for help on using the browser.