DevIchHdaCodec.h revision 6e4f0a21de35da7e77586bc1fab65d1bbf611eee
/* $Id$ */
/** @file
* DevIchHdaCodec - VBox ICH Intel HD Audio Codec.
*/
/*
* Copyright (C) 2006-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef DEV_CODEC_H
#define DEV_CODEC_H
/** The ICH HDA (Intel) controller. */
/** The ICH HDA (Intel) codec state. */
/** The HDA host driver backend. */
typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
typedef struct PDMAUDIOGSTSTRMOUT *PPDMAUDIOGSTSTRMOUT;
typedef struct PDMAUDIOGSTSTRMIN *PPDMAUDIOGSTSTRMIN;
/**
* Verb processor method.
*/
typedef FNHDACODECVERBPROCESSOR **PPFNHDACODECVERBPROCESSOR;
/* PRM 5.3.1 */
#ifndef VBOX_WITH_HDA_CODEC_EMU
typedef struct CODECVERB
{
/* operation bitness mask */
} CODECVERB;
#endif
#ifndef VBOX_WITH_HDA_CODEC_EMU
# define TYPE union
#else
# define TYPE struct
#endif
typedef enum
{
PI_INDEX = 0, /* PCM in */
PO_INDEX, /* PCM out */
MC_INDEX, /* Mic in */
typedef struct HDACODEC
{
/* List of assigned HDA drivers to this codec.
* A driver only can be assigned to one codec
* at a time. */
#ifndef VBOX_WITH_HDA_CODEC_EMU
int cVerbs;
#else
#endif
/** Pointer to HDA state (controller) this
* codec is assigned to. */
bool fInReset;
#ifndef VBOX_WITH_HDA_CODEC_EMU
const uint8_t cTotalNodes;
const uint8_t *au8AdcVols;
const uint8_t *au8AdcMuxs;
const uint8_t *au8Pcbeeps;
const uint8_t *au8SpdifIns;
const uint8_t *au8SpdifOuts;
const uint8_t *au8DigInPins;
const uint8_t *au8DigOutPins;
const uint8_t *au8VolKnobs;
const uint8_t *au8Reserveds;
const uint8_t u8AdcVolsLineIn;
const uint8_t u8DacLineOut;
#endif
#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
/* Callbacks to the HDA controller, mostly used for multiplexing to the various host backends. */
DECLR3CALLBACKMEMBER(int, pfnOpenIn, (PHDASTATE pThis, const char *pszName, PDMAUDIORECSOURCE enmRecSource, PPDMAUDIOSTREAMCFG pCfg));
DECLR3CALLBACKMEMBER(int, pfnOpenOut, (PHDASTATE pThis, const char *pszName, PPDMAUDIOSTREAMCFG pCfg));
DECLR3CALLBACKMEMBER(int, pfnSetVolume, (PHDASTATE pThis, bool fMute, uint8_t uVolLeft, uint8_t uVolRight));
#else
/** PCM in */
/** PCM out */
/* Callbacks for host driver backends. */
DECLR3CALLBACKMEMBER(int, pfnTransfer, (PHDACODEC pCodec, ENMSOUNDSOURCE enmSource, uint32_t cbAvail));
#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
/* Callbacks by codec implementation. */
/* Callbacks by codec implementation to answer debugger requests. */
DECLR3CALLBACKMEMBER(void, pfnCodecDbgListNodes, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
DECLR3CALLBACKMEMBER(void, pfnCodecDbgSelector, (PHDACODEC pThis, PCDBGFINFOHLP pHlp, const char *pszArgs));
} CODECState;
#ifdef VBOX_WITH_PDM_AUDIO_DRIVER
int hdaCodecOpenStream(PHDACODEC pThis, PDMAUDIORECSOURCE enmRecSource, PDMAUDIOSTREAMCFG *pAudioSettings);
#else
int hdaCodecOpenVoice(PHDACODEC pThis, ENMSOUNDSOURCE enmSoundSource, audsettings_t *pAudioSettings);
#endif /* VBOX_WITH_PDM_AUDIO_DRIVER */
#define HDA_SSM_VERSION 4
#define HDA_SSM_VERSION_1 1
#define HDA_SSM_VERSION_2 2
#define HDA_SSM_VERSION_3 3
# ifdef VBOX_WITH_HDA_CODEC_EMU
/* */
struct CODECEMU
{
};
# endif
#endif