Remove non-jackdbus man pages
[jackdbus.git] / linux / firewire / ffado_driver.h
blob8ee387b22b52e970116fcac1ead5c02ea955b1c5
1 /*
2 * FireWire Backend for Jack
3 * using FFADO
4 * FFADO = Firewire (pro-)audio for linux
6 * http://www.ffado.org
7 * http://www.jackaudio.org
9 * Copyright (C) 2005-2007 Pieter Palmers
10 * Copyright (C) 2009 Devin Anderson
12 * adapted for JackMP by Pieter Palmers
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 * Main Jack driver entry routines
34 #ifndef __JACK_FFADO_DRIVER_H__
35 #define __JACK_FFADO_DRIVER_H__
37 #include <libffado/ffado.h>
39 #include <string.h>
40 #include <stdlib.h>
41 #include <errno.h>
42 #include <stdio.h>
43 #include <poll.h>
44 #include <sys/time.h>
45 #include <netinet/in.h>
46 #include <endian.h>
48 #include <pthread.h>
49 #include <semaphore.h>
51 #include <driver.h>
52 #include <types.h>
54 #include <assert.h>
55 //#include <jack/midiport.h>
57 // debug print control flags
58 #define DEBUG_LEVEL_BUFFERS (1<<0)
59 #define DEBUG_LEVEL_HANDLERS (1<<1)
60 #define DEBUG_LEVEL_XRUN_RECOVERY (1<<2)
61 #define DEBUG_LEVEL_WAIT (1<<3)
63 #define DEBUG_LEVEL_RUN_CYCLE (1<<8)
65 #define DEBUG_LEVEL_PACKETCOUNTER (1<<16)
66 #define DEBUG_LEVEL_STARTUP (1<<17)
67 #define DEBUG_LEVEL_THREADS (1<<18)
69 //#define DEBUG_ENABLED
70 #ifdef DEBUG_ENABLED
72 // default debug level
73 #define DEBUG_LEVEL ( DEBUG_LEVEL_RUN_CYCLE | \
74 (DEBUG_LEVEL_XRUN_RECOVERY)| DEBUG_LEVEL_STARTUP | DEBUG_LEVEL_WAIT | DEBUG_LEVEL_PACKETCOUNTER)
76 #warning Building debug build!
78 #define printMessage(format, args...) jack_error( "firewire MSG: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
79 #define printError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
81 #define printEnter() jack_error( "FWDRV ENTERS: %s (%s)\n", __FUNCTION__, __FILE__)
82 #define printExit() jack_error( "FWDRV EXITS: %s (%s)\n", __FUNCTION__, __FILE__)
83 #define printEnter()
84 #define printExit()
86 #define debugError(format, args...) jack_error( "firewire ERR: %s:%d (%s): " format, __FILE__, __LINE__, __FUNCTION__, ##args )
87 #define debugPrint(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error("DEBUG %s:%d (%s) :" format, __FILE__, __LINE__, __FUNCTION__, ##args );
88 #define debugPrintShort(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( format,##args );
89 #define debugPrintWithTimeStamp(Level, format, args...) if(DEBUG_LEVEL & (Level)) jack_error( "%16lu: " format, debugGetCurrentUTime(), ##args );
90 #define SEGFAULT int *test=NULL; *test=1;
91 #else
92 #define DEBUG_LEVEL
94 #define printMessage(format, args...) if(g_verbose) \
95 jack_error("firewire MSG: " format, ##args )
96 #define printError(format, args...) jack_error("firewire ERR: " format, ##args )
98 #define printEnter()
99 #define printExit()
101 #define debugError(format, args...)
102 #define debugPrint(Level, format, args...)
103 #define debugPrintShort(Level, format, args...)
104 #define debugPrintWithTimeStamp(Level, format, args...)
105 #endif
107 // thread priority setup
108 #define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE 5
110 typedef struct _ffado_driver ffado_driver_t;
113 * Jack Driver command line parameters
116 typedef struct _ffado_jack_settings ffado_jack_settings_t;
117 struct _ffado_jack_settings
119 int verbose_level;
121 int period_size_set;
122 jack_nframes_t period_size;
124 int sample_rate_set;
125 int sample_rate;
127 int buffer_size_set;
128 jack_nframes_t buffer_size;
130 int playback_ports;
131 int capture_ports;
133 jack_nframes_t capture_frame_latency;
134 jack_nframes_t playback_frame_latency;
136 int slave_mode;
137 int snoop_mode;
139 char *device_info;
142 typedef struct _ffado_capture_channel
144 ffado_streaming_stream_type stream_type;
145 uint32_t *midi_buffer;
146 void *midi_input;
148 ffado_capture_channel_t;
150 typedef struct _ffado_playback_channel
152 ffado_streaming_stream_type stream_type;
153 uint32_t *midi_buffer;
154 void *midi_output;
156 ffado_playback_channel_t;
159 * JACK driver structure
161 struct _ffado_driver
163 JACK_DRIVER_NT_DECL;
165 jack_nframes_t sample_rate;
166 jack_nframes_t period_size;
167 unsigned long wait_time;
169 jack_time_t wait_last;
170 jack_time_t wait_next;
171 int wait_late;
173 jack_client_t *client;
175 int xrun_detected;
176 int xrun_count;
178 int process_count;
180 /* settings from the command line */
181 ffado_jack_settings_t settings;
183 /* the firewire virtual device */
184 ffado_device_t *dev;
186 channel_t playback_nchannels;
187 channel_t capture_nchannels;
189 ffado_playback_channel_t *playback_channels;
190 ffado_capture_channel_t *capture_channels;
191 ffado_sample_t *nullbuffer;
192 ffado_sample_t *scratchbuffer;
194 jack_nframes_t playback_frame_latency;
195 jack_nframes_t capture_frame_latency;
197 ffado_device_info_t device_info;
198 ffado_options_t device_options;
202 #endif /* __JACK_FFADO_DRIVER_H__ */