
/*
 Copyright 1999 by Digi International (www.digi.com)

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
 PURPOSE.  See the GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/*
 *	DXB API for the audiotap device
 *
 *	$Id: audiotap.h,v 1.6 1999/09/03 15:27:15 dickl Exp $
 */
#ifndef _AUDIOTAP_H
#define _AUDIOTAP_H

/*
 *	The name of the DXB device to open.  Note that we allow
 *	only one audio tap device to be open at a time.  I couldn't
 *	think of any practical application where you'd want more than
 *	one open.  Saves minor device numbers, too.  Hence, there is
 *	no data portion to the open message.
 */
#define	AUDIOTAP_NAME	"AUDIOTAP"

/*
 *	The output sample rate of the audiotap device
 */
#define AUDIOTAP_RATEOUT        8000

/*
 *	Once open, the audio tap is quiescent (does not send PCM data) until
 *	you write a control message to it.
 *
 *	As usual, I have avoided using evil ioctl's to control this.
 *	The write mechanism allows you to use a script to control the
 *	device.  E.G. for Unix types:
 *		cat /dev/dm/audiotap > /dev/audio &
 *		echo "ulaw 0 0x4000 0x4000 0" > /dev/dm/audiotap
 *
 *	The following messages are supported:
 *
 *	counter <nsamples>
 *		Generate incrementing counter test data.  Stop generating
 *		data after <nsamples> bytes.  If <nsamples> is 0, generate
 *		data forever.
 *
 *	flush
 *		Flush any data in the DSP sample buffer.  Countinue sampling.
 *
 *	pause <flag>
 *		If <flag> is 0, pause sampling temporarily.  If <flag> is 1,
 *		resume sampling.
 *
 *	stop
 *		Stop sampling and cause EOF to occur.
 *
 *	gain <tx_gain> <rx_gain>
 *		Change gain values (0x0000-0x8000).
 *
 *	ulaw <chan> <tx_gain> <rx_gain> <nsamples>
 *	alaw <chan> <tx_gain> <rx_gain> <nsamples>
 *	linear <chan> <tx_gain> <rx_gain> <nsamples>
 *		Select CSC instance <chan> for sampling.  Set gain values.
 *		Begin sending sample data to the host.  If <nsamples> is
 *		non-zero, stop sending data after <nsamples>, else send
 *		data forever.
 *
 *		ulaw/alaw/linear selects format of audio data.  The sample
 *		rate is always 8000 samples/second, regardless of the actual
 *		DSP sample rate.  ulaw and alaw are 8 bit data, linear is
 *		16 bit signed data.
 *
 *		NOTE: the PUMP code now supports a special "stereo" mode
 *		where the rx and tx samples are not mixed together.  To
 *		select this mode, select "linear" with gains set at 0,0.
 *		The samples will actually be sent as two ulaw values packed
 *		into each 16 bit word.
 *
 *	All numbers may be in decimal or hex (prefixed with 0x).
 */

#endif
