/*****************************************************************************
Copyright(c) 2005 Analog Devices, Inc.  All Rights Reserved. This software is 
proprietary and confidential to Analog Devices, Inc. and its licensors.
******************************************************************************

$RCSfile: adac_buffer.h,v $
$Revision: 1.1 $
$Date: 2008/03/17 14:50:34 $

Project:	Audio kit
Title:		User defined routines to be called by service/utility modules
Author(s):	dwu
Revised by: 

Description:
			User defined ISRs for the audio interrupts

References:
			None

******************************************************************************
Tab Setting:			4

Target Processor:		ADSP-BF5xx
Target Tools Revision:	ADSP VisualDSP++ v4.0
******************************************************************************

Modification History:
====================
$Log: adac_buffer.h,v $
Revision 1.1  2008/03/17 14:50:34  gstephan
Updates for SDK 3.00

Revision 1.2  2007/05/23 02:19:46  randreol
Modified for new combined audio application

Revision 1.1  2006/11/10 05:00:09  randreol
Initial rev

Revision 1.2  2006/05/10 05:03:26  dwu
Added extra function to wait for the buffers to empty

Revision 1.1.1.1  2006/05/09 04:01:29  dwu
USB based audio demonstration



*****************************************************************************/

#ifndef ADAC_BUFFER__H
#define ADAC_BUFFER__H

#include <drivers/adi_dev.h>

/*****************************************************************************
 *          #DEFINES                                                         *
 *****************************************************************************/
 
/*****************************************************************************
 *			TYPEDEFS / ENUMERATIONS											 *
 *****************************************************************************/


/*****************************************************************************
 *			Variable declaratioins											 *
 *****************************************************************************/


/****************************************************************************
 *      	FUNCTION PROTOTYPES                                         	*
 ****************************************************************************/
/*****************************************************************************
 	Initialization function
 	The fifo_buffer_size is specified in number of bytes
 *****************************************************************************/
void usr_init(short *fifo_buffer, int fifo_buffer_size, int fifo_count);

/*****************************************************************************
 	Function to return a contiguous block of buffer space for writing
 	The argument buffer_size is in number of 16-bit words. Returns NULL
 	if no memory blocks are available.
 *****************************************************************************/
char *usr_getpcmbuffer(unsigned int buffer_size);

/*****************************************************************************
 	Function to set the number of bytes written into the buffer that was
 	retrived by calling usr_getpcmbuffer().
 	The argument sample_count is in number of 16-bit words.
 *****************************************************************************/
void usr_setsamplecount(unsigned int sample_count);

/*****************************************************************************
	Function to enable/disable audio muting. Set argument to 1 for enable
	muting, 0 to disable
 *****************************************************************************/
void usr_mute_output(bool mute_enable, u32 SampleRate);
 
/*****************************************************************************
 	Function to inform the module that there'll be no more data to be written
 	into the fifo.
 *****************************************************************************/
void usr_nomore_data(void);

/*****************************************************************************
	Function to return number of free buffers for writing
 *****************************************************************************/
int usr_get_freebuffercount(void);

/*****************************************************************************
	Function to wait for all the buffers to be emptied
 *****************************************************************************/
void usr_wait_buffers_emptied(void);

/*****************************************************************************
 	User ISRs
 *****************************************************************************/
int DACUserISR(ADI_DEV_1D_BUFFER *pArg,unsigned int num_samples);


 
#endif  // #ifndef USR_ROUTINES__H

