⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmaudio.h

📁 WM9713 audio codec driver for WinCE 5.0
💻 H
📖 第 1 页 / 共 5 页
字号:
{
	WM_AUDIOIF_16BIT = 16,
	WM_AUDIOIF_20BIT = 20,
	WM_AUDIOIF_24BIT = 24,
	WM_AUDIOIF_32BIT = 32
} WM_AUDIOIF_WIDTH;

typedef unsigned int WM_AUDIOIF_FLAGS;

#define WM_AUDIOIF_FLAGS_NONE           0x0000
#define WM_AUDIOIF_INVERT_CLOCK         0x0001
#define WM_AUDIOIF_INVERT_LR_CLOCK      0x0002
#define WM_AUDIOIF_LR_SWAP              0x0004
#define WM_AUDIOIF_MONO                 0x0008

/*
 * The interrupt states.
 */
typedef unsigned char WMAUDIO_INTSTATE;
#define WMAUDIO_INT_ERROR           0x1
#define WMAUDIO_INT_START           0x2
#define WMAUDIO_INT_END             0x4
#define WMAUDIO_INT_STOP            0x8

/*
 * Maximum number of DMA buffers that will be used
 * for all audio channels.
 *
 * Note: On some platforms the Audio DMA area is
 *       fixed. Make sure that the number of buffers
 *              and descriptors that are being allocated
 *              will fit in to this area.
 *
 * Note: Each channel requires 2 buffers.
 *       AC97 Out.
 *       AC97 In.
 *       I2S  Out.
 *       I2S  In.
 *       Mono Out.
 *       Voice Out.
 *       Voice In. ( Not supported yet ).
 */
#if WM_AC97
#   define WMAUDIO_AC97_BUFFERS     4
#else
#   define WMAUDIO_AC97_BUFFERS     0
#endif
#if WM_I2S
#   define WMAUDIO_I2S_BUFFERS      4
#else
#   define WMAUDIO_I2S_BUFFERS      0
#endif
#if WM_VOICE
#   define WMAUDIO_VOICE_BUFFERS    4
#else
#   define WMAUDIO_VOICE_BUFFERS    0
#endif
#if WM_MONODAC
#   define WMAUDIO_MONO_BUFFERS     2
#else
#   define WMAUDIO_MONO_BUFFERS     0
#endif

#define WMAUDIO_MAX_BUFFERS         ( WMAUDIO_AC97_BUFFERS      +   \
									  WMAUDIO_I2S_BUFFERS       +   \
									  WMAUDIO_VOICE_BUFFERS     +   \
									  WMAUDIO_MONO_BUFFERS          \
									)
/*
 * The value which defines the maximum amplitude of the waves generated by
 * WMAudioPlaySineWave and WMAudioPlaySquareWave.
 */
#define WM_AUDIO_MAX_AMPLITUDE      32768

/*
 * Function prototypes
 */
#ifdef __cplusplus
extern "C" {
#endif

/*
 * Only provide these if we're doing audio support.
 */
#if WM_AUDIO

/*-----------------------------------------------------------------------------
 * Function:    WMAudioInit
 *
 * Initialises the Audio functionality.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioInit( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioShutdown
 *
 * Shuts down the Audio functionality.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMAudioShutdown( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioPowerUp
 *
 * Called to power up the audio-specific sections of the chip.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      powerSections   The sections to power up.
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioPowerUp( WM_DEVICE_HANDLE   hDevice, 
						 WM_POWERFLAG       powerSections
					   );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioPowerDown
 *
 * Called to power down the audio-specific sections of the chip.  Note if the
 * sections are still in use by another driver they will not actually be
 * powered down.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      powerSections   The sections to power down.
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioPowerDown( WM_DEVICE_HANDLE hDevice,
						   WM_POWERFLAG     powerSections
						 );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioConfigureInterface
 *
 * Configures the streaming format for the link for the given interface.
 * Note: this is not required for AC'97 streams - HIFI and MONO on AC'97
 * codecs.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      audioIF         the interface to configure
 *      isMaster        whether the codec masters the link
 *      format          the streaming format to use
 *      width           the number of bits per sample
 *      flags           extra configuration flags
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioConfigureInterface( WM_DEVICE_HANDLE     hDevice,
									WM_AUDIO_INTERFACE   audioIF,
									WM_BOOL              isMaster,
									WM_AUDIOIF_FORMAT    format,
									WM_AUDIOIF_WIDTH     width,
									WM_AUDIOIF_FLAGS     flags
								  );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioUnconfigureInterface
 *
 * Unconfigures the streaming format for the link for the given interface.
 * Note: this is not required for AC'97 streams - HIFI and MONO on AC'97
 * codecs.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      audioIF         the interface to configure
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioUnconfigureInterface( WM_DEVICE_HANDLE     hDevice,
									  WM_AUDIO_INTERFACE   audioIF
									);

/*-----------------------------------------------------------------------------
 * Function:    WMAudioIsInterfaceConfigured
 *
 * Queries whether the given interface has been configured.
 * Note: this requires global data.  If there is no global data, this
 * function will return WMS_UNSUPPORTED.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      audioIF         the interface to query
 *
 * Returns:     WMSTATUS
 *      WMS_RETURN_TRUE     - interface is configured
 *      WMS_RETURN_FALSE    - interface is not configured
 *      WMS_UNSUPPORTED     - no global data, or interface not supported
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioIsInterfaceConfigured( WM_DEVICE_HANDLE     hDevice,
                                       WM_AUDIO_INTERFACE   audioIF
                                     );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioIsInterfaceSupported
 *
 * Queries whether the given audio interface is supported by the WDCL for
 * this device.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      audioIF         The interface to query
 *
 * Returns:     WM_BOOL
 *      TRUE     - interface is supported
 *      FALSE    - interface is not supported
 *---------------------------------------------------------------------------*/
WM_BOOL WMAudioIsInterfaceSupported( WM_DEVICE_HANDLE   hDevice,
                                     WM_AUDIO_INTERFACE audioIF
                                    );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioConfigurePath
 *
 * Configure and enable the paths from the DAC to the outputs (for an output
 * stream) or from the inputs to the ADC (for an input stream).
 * 
 * NOTE: This function works by loading specific profiles.  You can see what
 * these profiles do by looking in the file corresponding to your codec in
 * the ChipDefs subdirectory, and you can override the behaviour by adding
 * your own profiles with the same name in Common\UserProfiles.c .
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *      stream      The stream to configure
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioConfigurePath( WM_DEVICE_HANDLE hDevice,
                               WM_STREAM_ID     stream
                             );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioUnconfigurePath
 *
 * Unconfigure and disable the paths from the DAC to the outputs (for an output
 * stream) or from the inputs to the ADC (for an input stream).
 * 
 * NOTE: This function works by loading specific profiles.  You can see what
 * these profiles do by looking in the file corresponding to your codec in
 * the ChipDefs subdirectory, and you can override the behaviour by adding
 * your own profiles with the same name in Common\UserProfiles.c .
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *      stream      The stream to configure
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioUnconfigurePath( WM_DEVICE_HANDLE hDevice,
                                 WM_STREAM_ID     stream
                               );


/*-----------------------------------------------------------------------------
 * Function:    WMAudioIsStreamSupported
 *
 * Queries whether the given stream is supported by the WDCL for this device.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      stream          The stream to enable
 *
 * Returns:     WM_BOOL
 *      TRUE     - stream is supported
 *      FALSE    - stream is not supported
 *---------------------------------------------------------------------------*/
WM_BOOL WMAudioIsStreamSupported( WM_DEVICE_HANDLE hDevice,
                                  WM_STREAM_ID     stream
                                 );

/*-----------------------------------------------------------------------------
 * Function:    WMAudioEnableStream
 *
 * Called to enable the device to handle the given stream.  This powers up
 * and configures the interface according to the default values.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      stream          The stream to enable
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h.
 *---------------------------------------------------------------------------*/
WMSTATUS WMAudioEnableStream( WM_DEVICE_HANDLE hDevice,
							  WM_STREAM_ID     stream
							);

/*-----------------------------------------------------------------------------
 * Function:    WMAudioDisableStream
 *
 * Called to disable the given stream.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -