/*****************************************************************************/
/* Copyright (c) 2009 NXP B.V.  All rights are reserved.                     */
/*                                                                           */
/* Redistribution and use in source and binary forms, with or without        */
/* modification, are permitted provided that the following conditions        */
/* are met:                                                                  */
/*                                                                           */
/* Redistributions of source code must retain the above copyright            */
/* notice, this list of conditions and the following disclaimer.             */
/*                                                                           */
/* Redistributions in binary form must reproduce the above copyright         */
/* notice, this list of conditions and the following disclaimer in the       */
/* documentation and/or other materials provided with the distribution.      */
/*                                                                           */
/* Neither the name of NXP nor the names of its                              */
/* contributors may be used to endorse or promote products derived from      */
/* this software without specific prior written permission.                  */
/*                                                                           */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE         */
/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */
/* DAMAGE.                                                                   */
/*                                                                           */
/*****************************************************************************/

/**
 * \file          tmdlAudioIO.h
 *
 * \brief         CPI API of the audio control IO.
 *
 * REFERENCE DOCUMENTS : SCS, SCD of tmdlAudioIO
 *
 * This file contains all the APIs of CPI component which is responsible for the
 * control of the audio IO
 *
 * \section info Change Information
 *
 * \verbatim
   Date          Modified by CRPRNr  TASKNr  Maintenance description
   -------------|-----------|-------|-------|-----------------------------------
   12-Sept-2007 | robbe     | 12130 | 21378 | Common Caen/Soton agreed version
   20-June-2007 | legendre  |       |       | Initial version
   25-Octo-2007 | batelaan  |       |       | Overwrote with PNX8335 version (25). Sorry, needs merging!
   23-Nov-2007  | barnish   |       | 3735  | removed SetPtsBufferId()
   20-Dec-2007  | barnish   |       | 3921  | add/update start, stop , pause
   28-Jan-2008  | barnish   |       | 4120  | add event callback registration
   30-Jan-2008  | barnish   |       | 4190  | add GetSpdifSource
   07-Feb-2008  | batelaan  |       |       | Update file copyright/license text
   12-Feb-2008  | ashetty   |       |       | add aupport for audio feedback
   07-Mar-2008  | laird     |       |       | Fix name of exported function.
   11-Mar-2008  | ashetty   |       |       | Remove hard coded compile option for audio feedback
   19-Mar-2008  | barnish   |       |       | Merge & reinstate CPI aligned name for RegisterCallback
   15-May-2008  | barnish   |       |       | Add fixed sample rate define
   20-May-2008  | barnish   |       |       | Change fixed sample rate to 44.1kHz
   08-Aug-2008  | awest     |       |       | Add new Spif setup function
   18-Sep-2008  | awest     |       |       | Add get/set spdif channel status, modify setSampleRate
   21-Oct-2008  | laird     |       |       | Add enabled/Mute spdif functions.
   25-Nov-2008  | awest     |       |       | Add tmdlAudioIO_SpdifStatusReset
   20-Jan-2009  | batelaan  | Update file copyright/license text
   02-Feb-2008  | neill     |       |       | Add audio capture support
   \endverbatim
 *
*/

#ifndef TMDLAUDIOIO_H
#define TMDLAUDIOIO_H
/*============================================================================*/
/*                      STANDARD INCLUDE FILES                                */
/*============================================================================*/
#include "tmCompId.h"
#include "tmNxTypes.h"


/*============================================================================*/
/*                      PROJECT INCLUDE FILES                                 */
/*============================================================================*/

#ifdef __cplusplus
extern "C"
{
#endif

/*==========================================================================*/
/*               PUBLIC TYPE DEFINITION                                     */
/*==========================================================================*/


/** buffer requirements in instance setup */
typedef struct
{
    uint32_t size;
    uint32_t alignment;
    uint32_t address;
}tmdlAudioIO_Buffer_t;

/** Available AudioIO output */
typedef enum
{
    tmdlAudioIO_Output_I2S_0,
    tmdlAudioIO_Output_I2S_1,
    tmdlAudioIO_Output_I2S_2,
    tmdlAudioIO_Output_I2S_3,
    tmdlAudioIO_Output_I2S_4,
    tmdlAudioIO_Output_SPDIF,
    tmdlAudioIO_Output_Guard
} tmdlAudioIO_Output_t;

/** Available sample rates */
typedef enum
{
    tmdlAudioIO_SampleRate32KHZ,
    tmdlAudioIO_SampleRate44KHZ,
    tmdlAudioIO_SampleRate48KHZ,
    tmdlAudioIO_SampleRate96KHZ,
    tmdlAudioIO_SampleRateGuard,
} tmdlAudioIO_SampleRate_t;

/** Instance setup */
typedef struct
{
    tmdlAudioIO_Buffer_t buffer[tmdlAudioIO_Output_Guard];

}tmdlAudioIO_InstanceSetup_t;

typedef struct
{
    tmdlAudioIO_Buffer_t buffer[tmdlAudioIO_Output_Guard];
}tmdlAudioIO_PtsBufferIDs_t;

typedef enum
{
    tmdlAudioIO_AcpClk_Internal = 0,
    tmdlAudioIO_AcpClk_External
}tmdlAudioIO_AcpClkSource_t;

typedef enum
{
    tmdlAudioIO_SyncModePTSLocked = 0,
    tmdlAudioIO_SyncModeFreeRunning,
    tmdlAudioIO_SyncModeBufControlled,
    tmdlAudioIO_SyncModeSwControlled
}tmdlAudioIO_SyncMode_t ;

typedef enum
{
    tmdlAudioIO_SpdifModeLpcm = 0,
    tmdlAudioIO_SpdifModeBitStream,
}tmdlAudioIO_SpdifMode_t ;


typedef enum
{
    tmdlAudioIO_SpdifChannelMode0, // Mode 0
    tmdlAudioIO_SpdifChannelMode1, // Resevered
    tmdlAudioIO_SpdifChannelMode2, // Resevered
    tmdlAudioIO_SpdifChannelMode3, // Resevered
    tmdlAudioIO_SpdifChannelModeGuard
} tmdlAudioIO_SpdifChannelMode_t;

typedef enum
{
    tmdlAudioIO_SpdifChannelCategoryGeneral, /* General format */
    tmdlAudioIO_SpdifChannelCategoryCD, /* CD Player */
    tmdlAudioIO_SpdifChannelCategoryDAT, /* DAT Player */
    tmdlAudioIO_SpdifChannelCategoryGuard
} tmdlAudioIO_SpdifChannelCategory_t;

typedef enum
{
    tmdlAudioIO_SpdifChannelSourceEither, /* don't case */
    tmdlAudioIO_SpdifChannelSource0, /* Input Source 0 */
    tmdlAudioIO_SpdifChannelSource1, /* Input Source 1 */
    tmdlAudioIO_SpdifChannelSourceGuard
} tmdlAudioIO_SpdifChannelSource_t;

typedef enum
{
    tmdlAudioIO_SpdifChannelNumberEither, /* Don't Care */
    tmdlAudioIO_SpdifChannelNumberLeft,   /* Left channel for stereo */
    tmdlAudioIO_SpdifChannelNumberRight,  /* Right channel for stereo */
    tmdlAudioIO_SpdifChannelNumberBoth,   /* Both Channels */
    tmdlAudioIO_SpdifChannelNumberGuard
} tmdlAudioIO_SpdifChannelNumber_t;


typedef enum
{
    tmdlAudioIO_SpdifChannelClockNormal,   /* Normal clock accuracy */
    tmdlAudioIO_SpdifChannelClockHigh,     /* High clock accuracy */
    tmdlAudioIO_SpdifChannelClockVariable, /* variable speed */
    tmdlAudioIO_SpdifChannelClockGuard
} tmdlAudioIO_SpdifChannelClock_t;

typedef enum
{
    tmdlAudioIO_HdmiStream_I2S_Stereo,          /* Stereo on I2S*/
    tmdlAudioIO_HdmiStream_I2S_Multichannel,    /* Multichannel on I2S */
    tmdlAudioIO_HdmiStream_SPDIF_Burst,         /* SPDIF burst out */
    tmdlAudioIO_HdmiStream_SPDIF_Pcm,           /* SPDIF PCM out */
    tmdlAudioIO_HdmiStream_Guard
} tmdlAudioIO_HdmiStreamOut_t;

typedef struct
{
    /* Encoding Type: False=Consumer True=Professional */
    Bool professionalStandard;
    /* Data Type: False=Analogue True=Digital Data */
    Bool digitalData;
    /* Copy Protection: False=Copy Prohibited True=Copy permitted */
    Bool copyPermitted;
    /* Pre-emphsis: False=without Pre-emphasis True=with Pre-emphasis */
    Bool preEmphasis;
    /* Number of Channels: False=2 Channel True=4 Channel */
    Bool fourChannelRecording;
    /* Channel Mode */
    tmdlAudioIO_SpdifChannelMode_t mode;
    /* Category Code */
    tmdlAudioIO_SpdifChannelCategory_t category;
    /* Original Recording: False = originalRecodering True:FirstCopy */
    Bool firstCopy;
    /* Data source */
    tmdlAudioIO_SpdifChannelSource_t source;
    /* Stereo Channel Status */
    tmdlAudioIO_SpdifChannelNumber_t stereoChannel;
    /* Sample Rate  - 32000, 44100 or 48000*/
    tmdlAudioIO_SampleRate_t sampleRate;
    /* Clock Accuracy */
    tmdlAudioIO_SpdifChannelClock_t clockType;
} tmdlAudioIO_SpdifChannelStatusInfo_t;

/** pointer to event callback function */
typedef void (*pCallbackFunc_t)(int context, int event, void * pdata);

typedef void (*pDataCallbackFunc_t)(uint8_t *pData, uint32_t length);

/*============================================================================*/
/*                      PUBLIC MACRO DEFINITION                               */
/*============================================================================*/
/* Can be accessed by external components                                     */

/** Total number of SBM buffers used by component */
#define TMDL_AUDIOIO_TOTAL_BUFFERS         6

/** Fixed output sample rate */
#define TMDL_AUDIOIO_FIXED_RATE            tmdlAudioIO_SampleRate44KHZ

/** Conversion from tmdlAudioIO_SampleRate_t type to numeric value */
#define CONVERT_FROM_SAMPLERATE_TYPE_TO_NUM(_tmdlAudioIO_SampleRate)     \
    ((_tmdlAudioIO_SampleRate) == tmdlAudioIO_SampleRate32KHZ) ? 32000 : \
    ((_tmdlAudioIO_SampleRate) == tmdlAudioIO_SampleRate44KHZ) ? 44100 : \
    ((_tmdlAudioIO_SampleRate) == tmdlAudioIO_SampleRate48KHZ) ? 48000 : \
    ((_tmdlAudioIO_SampleRate) == tmdlAudioIO_SampleRate96KHZ) ? 96000 : \
    48000

#define CONVERT_FROM_NUM_TYPE_TO_SAMPLERATE(_SampleRate)     \
    ((_SampleRate) == 32000) ? tmdlAudioIO_SampleRate32KHZ : \
    ((_SampleRate) == 44100) ? tmdlAudioIO_SampleRate44KHZ : \
    ((_SampleRate) == 48000) ? tmdlAudioIO_SampleRate48KHZ : \
    ((_SampleRate) == 96000) ? tmdlAudioIO_SampleRate96KHZ : \
    tmdlAudioIO_SampleRate48KHZ


/*============================================================================*/
/*                      PUBLIC FUNCTION DECLARATION                           */
/*============================================================================*/
/* Can be accessed by external components                                     */

// TODO use tmInstance_t for each AudioIO instance handle
// TODO AudioIO instance part of Start/Stop etc
// TODO consider mapping aioInst to channel id?


/******************************************************************************/
/** Open an AudioIO driver instance on unit0

    @param  pAioInst    OUT     handle for the instance

    @retval TM_OK                   Success
    @retval TM_ERR_INSTANCE_IN_USE  Free AudioIO instance is not available
*/
tmErrorCode_t tmdlAudioIO_Open(
    tmInstance_t *pAioInst
    );

/******************************************************************************/
/** Open an AudioIO driver instance on a given hardware unit

    @param  pAioInst    OUT     handle for the instance
    @param  unitSelect  IN      the hardware unit (only 0 currently valid)

    @retval TM_OK                   Success
    @retval TM_ERR_INSTANCE_IN_USE  Free AudioIO instance is not available
*/
tmErrorCode_t tmdlAudioIO_OpenM(
    tmInstance_t *pAioInst,
    tmUnitSelect_t   unitSelect
    );

/******************************************************************************/
/** Close a driver instance

    @param  aioInst     IN      handle of the driver to close

    @retval TM_OK                       Success
    @retval TM_ERR_BAD_INSTANCE         Invalid AudioIO instance handle
    @retval TM_ERR_RESOURCE_NOT_OWNED   AudioIO instance handle not in use
*/
tmErrorCode_t tmdlAudioIO_Close(
    tmInstance_t aioInst
    );

/******************************************************************************/
/**  Get instance setup data

    @param  aioInst     IN      handle of the driver
    @param  ppSetup     OUT     pointer to current setup

*/
tmErrorCode_t tmdlAudioIO_GetInstanceSetup(
    tmInstance_t AioInst,
    tmdlAudioIO_InstanceSetup_t ** ppSetup
    );

/******************************************************************************/
/**  Setup instance

    @param  aioInst     IN      handle of the driver
    @param  pSetup      IN      pointer to new setup

*/
tmErrorCode_t tmdlAudioIO_InstanceSetup(
    tmInstance_t AioInst,
    tmdlAudioIO_InstanceSetup_t * pSetup
    );

/******************************************************************************/
/**  Put data into the audio output buffer

    @param  output     IN     input buffer instance
    @param  data_ptr         IN     pointer to audio data
    @param  data_size        IN     max nr of char to load
    @param  data_loaded_ptr  OUT    nr of char loaded

    @retval TM_OK       Success
*/
// TODO add AudioIO inst handle
extern tmErrorCode_t tmdlAudioIO_FillBuffer(
    tmdlAudioIO_Output_t output,
    char *data_ptr,
    UInt32 data_size,
    UInt32 *data_loaded_ptr
    );

/******************************************************************************/
/** \brief  This function allows the caller to play the specified instance. Play
 *          back starts with the configuration parameters and the synchronization
 *          mode specificed in tmdlAudioIOInstanceSetup
 *
 *  \param  kAudioIoInstance   : (In) the AUDIOIO instance to start
 *  \param  kOutput            : (In) Which output to start
 *
 *  \return The error code.
 *           - TM_OK                          : success
 *           - TMDL_ERR_AUDIOIO_BAD_PARAMS    : the specified instance output
 *                                              is not valid
 *           - TMDL_ERR_AUDIOIO_FATAL         : error at OS level
 *           - TMDL_ERR_AUDIOIO_NOT_SUPPORTED : output already started
 *
 *  \note   tmdlAudioIOOpen and tmdlAudioIOInstanceSetup must have been called before.
 */
/******************************************************************************/
extern tmErrorCode_t tmdlAudioIOStart(
    tmInstance_t        kAudioIoInstance,
    tmdlAudioIO_Output_t kOutput
    );

/******************************************************************************/
/** \brief  This function allows the caller to stop the specified instance
 *
 *  \param  kAudioIoInstance   : (In) the AUDIOIO instance to stop
 *  \param  kOutput            : (In) Which output to stop
 *
 *  \return The error code.
 *           - TM_OK                       : success
 *           - TMDL_ERR_AUDIOIO_BAD_PARAMS : the specified instance is not valid
 *           - TMDL_ERR_AUDIOIO_FATAL      : error at OS level
 *
 *  \note   tmdlAudioIOOpen and tmdlAudioIOInstanceSetup must have been called before.
 */
/******************************************************************************/
extern tmErrorCode_t tmdlAudioIOStop(
    tmInstance_t        kAudioIoInstance,
    tmdlAudioIO_Output_t kOutput
    );

/******************************************************************************/
/** \brief  This function allows the caller to pause the specified instance
 *
 *  \param  kAudioIoInstance   : (In) the AUDIOIO instance to pause
 *  \param  kOutput            : (In) Which output to pause
 *  \param  kPause             : (In) true= pause, false = continue
 *
 *  \return The error code.
 *           - TM_OK                       : success
 *           - TMDL_ERR_AUDIOIO_BAD_PARAMS : the specified instance is not valid
 *           - TMDL_ERR_AUDIOIO_FATAL      : error at OS level
 *
 *  \note   tmdlAudioIOOpen and tmdlAudioIOInstanceSetup must have been called before.
 */
/******************************************************************************/
extern tmErrorCode_t tmdlAudioIOPause(
    tmInstance_t         kAudioIOInstance,
    tmdlAudioIO_Output_t kOutput,
    bool                 kPause
    );


/******************************************************************************/
/** Flush a buffer

    @note Currently not implemented

    @param  output    IN      output
    @param  nb_bytes  IN/OUT  number of bytes to flush

    @retval TM_OK           Success
*/
// TODO add AudioIO inst handle
extern tmErrorCode_t tmdlAudioIO_Flush(
    tmdlAudioIO_Output_t output,
    Int32 *nb_bytes
    );

/******************************************************************************/
/**  Set Sample rate and configure HDMI


    @param  aioInst         IN     handle of the driver
    @param  sampleRate      IN     Sample rate
    @param  hdmiStreamOut   IN     Expected out on HDMI

    @retval TM_OK                   Success

    @Note  If HDMI is not present then hdmiStreamOut will be ignored.
*/
// TODO add AudioIO inst handle
extern tmErrorCode_t tmdlAudioIO_SetSampleRate(
    tmInstance_t aioInst,
    tmdlAudioIO_SampleRate_t sampleRate,
    tmdlAudioIO_HdmiStreamOut_t hdmiStreamOut
    );


/******************************************************************************/
/** set the acp clock internal or external

    @param  instance         IN     handle of the driver
    @param  acpClk           IN     clock selection

    @retval TM_OK - success
*/
extern tmErrorCode_t tmdlAudioIO_SetAcpClocks(
    tmInstance_t instance,
    tmdlAudioIO_AcpClkSource_t acp_clk
);

/******************************************************************************/
/** set the stc clock for the outputs

    @param  instance         IN     handle of the driver
    @param  stcValue         IN     stc value to set

    @retval TM_OK - success
*/
extern tmErrorCode_t tmdlAudioIO_SetStc(
    tmInstance_t instance,
    tmTimeStamp_t stcValue
);

/******************************************************************************/
/** \brief  This function allows the caller to get the current STC value
 *
 *  \param  kAudioIoInstance   : (In)  the AUDIOIO instance
 *  \param  pkStcValue         : (Out) STC value
 *
 *  \return The error code.
 *           - TM_OK                       : success
 *           - TMDL_ERR_AUDIOIO_BAD_PARAMS : the specified instance is not valid
 *           - TMDL_ERR_AUDIOIO_FATAL      : error at OS level
 *
 *  \note   tmdlAudioIOOpen and tmdlAudioIOInstanceSetup must have been called before.
 */
/******************************************************************************/
extern tmErrorCode_t tmdlAudioIO_GetStc(
    tmInstance_t        kAudioIoInstance,
    tmTimeStamp_t       *pkStcValue
    );

/******************************************************************************/
/** Set the sync mode for this output

    @param  instance         IN     handle of the driver
    @param  channel          IN     output channel
    @param  syncMode         IN     synchronisation mode

*/
extern tmErrorCode_t tmdlAudioIO_SetSyncMode(
    tmInstance_t            instance,
    tmdlAudioIO_Output_t    output,
    tmdlAudioIO_SyncMode_t   syncMode
    );

/******************************************************************************/
/** Get the Spdif mirror destination

    Spdif can mirror to an i2s output
    
    @param  instance         IN     handle of the driver
    @param  pDestination     OUT    currently selected destinationwritten here

*/
extern tmErrorCode_t tmdlAudioIO_GetSpdifMirrorDestination(
    tmInstance_t            instance,
    tmdlAudioIO_Output_t    *pDestination
    );

/******************************************************************************/
/** Set the Spdif mirror destination

    Spdif can mirror to an i2s output

    @param  instance         IN     handle of the driver
    @param  destination      IN     selected destination

*/
extern tmErrorCode_t tmdlAudioIO_SetSpdifMirrorDestination(
    tmInstance_t            instance,
    tmdlAudioIO_Output_t    destination
    );



/******************************************************************************/
/** Gets the Current spdif status word.

    @param  instance         IN      handle of the driver
    @param  pChannelStatus   IN/Out  copy of the status setup

*/
extern tmErrorCode_t tmdlAudioIO_GetSpdifStatus(
    tmInstance_t instance,
    tmdlAudioIO_SpdifChannelStatusInfo_t *pChannelStatus
    );

/******************************************************************************/
/** Sets the Current spdif status word.

    @param  instance         IN      handle of the driver
    @param  pChannelStatus   IN      status setup

*/
extern tmErrorCode_t tmdlAudioIO_SetSpdifStatus(
    tmInstance_t instance,
    tmdlAudioIO_SpdifChannelStatusInfo_t channelStatus
    );


/******************************************************************************/
/** Resets the status work to the default state.

    @param  instance         IN      handle of the driver
    @return TM_OK or failure code
*/
extern tmErrorCode_t tmdlAudioIO_SpdifStatusReset(tmInstance_t instance);


/******************************************************************************/
/** Is the Spdif output enabled

    @param  instance         IN      handle of the driver

    @return True if it is, else False
*/
extern Bool tmdlAudioIO_SpdifEnabled(tmInstance_t instance);

/******************************************************************************/
/** Enables the SPDIF output

    @param  instance         IN      handle of the driver
    @param  enable           IN      true to enable, false to disable.
*/
extern tmErrorCode_t tmdlAudioIO_SpdifEnable(tmInstance_t instance,
                                             Bool enable);

/******************************************************************************/
/** Is the Spdif output muted

    @param  instance         IN      handle of the driver

    @return True if it is, else False
*/
extern Bool tmdlAudioIO_SpdifMuted(tmInstance_t instance);

/******************************************************************************/
/** Mutes/UnMutes the SPDIF output

    @param  instance         IN      handle of the driver
    @param  mute             IN      true to mute, false to un-mute.

*/
extern tmErrorCode_t tmdlAudioIO_SpdifMute(tmInstance_t instance,
                                           Bool mute);

/******************************************************************************/
/** \brief  This function allows the caller to supply a pointer to a function
 *          which will be called when audioIO raises an event.
 *
 *  \param  kAudioIoInstance   : (In) the AUDIOIO instance
 *  \param  kOutput            : (In) the output number
 *  \param  context            : (In) context which will be returned with the event
 *  \param  pCallback          : (In) pointer to callback function
 *
 *  \return The error code.
 *           - TM_OK                          : success
 *
 */
/******************************************************************************/
extern void tmdlAudioIORegisterCallback(
    tmInstance_t         kAudioIOInstance,
    tmdlAudioIO_Output_t kOutput,
    uint32_t             context,
    pCallbackFunc_t      pCallback
    );


/******************************************************************************/
/** \brief  This function allows the caller to supply a pointer to a function
 *          which will be called when audioIO receives a packet of data.
 *
 *  \param  output        : (In) the audio output to be associated with the callback function
 *  \param  pDataCallback : (In) pointer to callback function
 *
 *  \return Void
 *
 */
/******************************************************************************/
extern void tmdlAudioIO_RegisterDataCallback(tmdlAudioIO_Output_t output, 
                                             pDataCallbackFunc_t pDataCallback);

/******************************************************************************/
/** \brief  This function allows the callero to set the operation of the SPDIF blk
 *
 *  \param  mode               : (In) SPDIF block mode
 *
 *  \return void
 *
 */
/******************************************************************************/
extern void tmdlAudioIO_SetSpdifOutput(
    tmdlAudioIO_SpdifMode_t mode
    );

/******************************************************************************/
/**  Enable audio Beep

    @param  aioInst         IN      handle of the driver
    @param  VolAttnLevel    IN     Attenuation level 0 to 25

    @retval TM_OK       Success
*/
extern tmErrorCode_t tmdlAudioIO_AudioBeep(
    tmInstance_t aioInst,
    uint32_t VolAttnLevel
    );

/******************************************************************************/
/**  Select the audio beep

    @param  aioInst         IN      handle of the driver
    @param  Sel             IN     Audio beep selection ( 0 - 4)

    @retval TM_OK                   Success
            TM_ERR_BUSY if          audio beep is being played
            TM_ERR_NOT_SUPPORTED    for invalid selection
*/
extern tmErrorCode_t tmdlAudioIO_SelectBeep(
    tmInstance_t aioInst,
    uint32_t beepSel
    );

extern tmErrorCode_t tmdlAudioIO_SetVolume(tmInstance_t         kAudioIOInstance,
										   tmdlAudioIO_Output_t output,
										   Bool				 	left,
										   unsigned int 		volume);


extern tmErrorCode_t tmdlAudioIO_EndOfAudioMute(tmInstance_t         kAudioIOInstance,
												tmdlAudioIO_Output_t output);


#ifdef __cplusplus
}
#endif

#endif /* TMDLAUDIOIO_H */

/*=============================================================================*/
/*                            END OF FILE                                      */
/*=============================================================================*/
