📄 pmic_audio.h
字号:
/*---------------------------------------------------------------------------
* Copyright (C) 2004-2006, Freescale Semiconductor, Inc. All Rights Reserved.
* THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
* AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
*--------------------------------------------------------------------------*/
#ifndef __PMIC_AUDIO_H__
#define __PMIC_AUDIO_H__
/*!
* @defgroup PMIC_AUDIO PMIC Audio Driver
* @ingroup PMIC_DRVRS
*/
/*!
* @file pmic_audio.h
* @brief External definitions for the PMIC Audio Client driver.
*
* The PMIC Audio driver and this API were developed to support the
* audio playback, recording, and mixing capabilities of the power
* management ICs that are available from Freescale Semiconductor, Inc.
* In particular, both the MC13783 and SC55112 power management
* ICs are currently supported. All of the common features of each
* power management IC are available as well as access to all device-
* specific features. However, attempting to use a device-specific
* feature on a platform on which it is not supported will simply
* return an error status.
*
* The following table shows which audio-related capabilities are supported
* by each power management IC:
*
* @verbatim
Operating Mode MC13783 SC55112
----------------------------- ------- -------
Stereo DAC Playback Yes Yes
Stereo DAC Input Mixing Yes Yes
Voice CODEC Playback Yes Yes
Voice CODEC Input Mixing Yes No
Voice CODEC Mono Recording Yes Yes
Voice CODEC Stereo Recording Yes No
Sampling Rate and Clock Select Yes Yes
Input Amplifier Control Yes Yes
Microphone Bias Control Yes Yes
Output Amplifier Control Yes Yes
Output Mixing Control Yes Yes
Data Bus Protocol Select Yes Yes
Master/Slave Mode Select Yes Yes
Anti Pop Bias Circuit Control Yes Yes
Microphone/Headset Detect Yes Yes
PTT Detect No Yes
@endverbatim
*
* Note that the Voice CODEC may also be referred to as the Telephone
* CODEC in the power management IC DTS documentation. Also note that,
* while the power management ICs do provide similar audio capabilities,
* each PMIC may support additional configuration settings and features.
* Therefore, it is highly recommended that the appropriate power
* management IC DTS documents be used in conjunction with this API
* interface. The following documents were used in the development
* and testing of this API:
*
* [1] MC13783 Detailed Technical Specification (Level 3),
* Rev 1.3 - 04/09/17. Freescale Semiconductor, Inc.
*
* [2] iDEN Phoenix Platform Level 3 Detailed Technical Specification,
* Rev 2.2 11-03-2005. Freescale Semiconductor, Inc.
*
* @ingroup PMIC_AUDIO
*/
#include "pmic_status.h"
/***************************************************************************
* TYPEDEFS AND ENUMERATIONS *
***************************************************************************/
/*!
* @name General Setup and Audio Device Access Typedefs and Enumerations
* Typedefs and enumerations that are used for initial access to the
* PMIC Audio hardware.
*/
/*@{*/
/*!
* @typedef PMIC_AUDIO_HANDLE
* @brief Define typedef for a handle to the PMIC Audio hardware.
*
* Define a "handle" that is returned when the PMIC Audio hardware
* is opened. This handle grants exclusive access to the PMIC Audio
* hardware and must be used in all subsequent function calls. When access
* to the PMIC Audio hardware is no longer required, then a close
* operation must be done with this handle. The handle is no longer valid
* if the close operation was successful.
*/
typedef long PMIC_AUDIO_HANDLE;
/*!
* @enum PMIC_AUDIO_EVENTS
* @brief Identify the audio events that have been detected and should be
* handled.
*
* This enumeration defines all of the possible PMIC Audio events. Multiple
* events may be selected when defining a mask and multiple events may be
* signalled together.
*
* Note that the MICROPHONE_DETECT and MICROPHONE_REMOVED events may also be
* used to signal the operation of a serial or parallel microphone switch
* when used with a combined headset+microphone device. In that case the
* HEADSET_DETECT state must also be checked to determine if it's only the
* microphone switch being operated or whether the microphone has truly been
* inserted/removed (along with the headset).
*/
typedef enum
{
HEADSET_DETECTED = 1, /*!< Detected headset insertion. */
HEADSET_STEREO = 2, /*!< Detected stereo headset device. */
HEADSET_MONO = 4, /*!< Detected mono headset device. */
HEADSET_THERMAL_SHUTDOWN = 8, /*!< Detected output amplifier
shutdown due to thermal
limits <b>(MC13783-only)</b>. */
HEADSET_SHORT_CIRCUIT = 16, /*!< Detected output amplifier
short circuit condition
<b>(MC13783-only)</b>. */
HEADSET_REMOVED = 32, /*!< Detected headset removal. */
MICROPHONE_DETECTED = 64, /*!< Detected microphone insertion. */
MICROPHONE_REMOVED = 128, /*!< Detected microphone removal. */
PTT_BUTTON_PRESS = 256, /*!< Detected PTT button down
<b>(SC55112)</b>. */
PTT_BUTTON_RANGE = 512, /*!< Detected PTT button within
voltage range
<b>(SC55112)</b>. */
PTT_SHORT_OR_INVALID = 1024 /*!< Detected PTT button outside
of voltage range or invalid
device <b>(SC55112)</b>. */
} PMIC_AUDIO_EVENTS;
/*!
* @typedef PMIC_AUDIO_CALLBACK
* @brief Typedef for PMIC Audio event notification callback function.
*
* Define a typedef for the PMIC Audio event notification callback
* function. The signalled events are passed to the function as the first
* argument. The callback function should then process whatever events it
* can and then return the set of unhandled events (if any).
*/
typedef PMIC_AUDIO_EVENTS (*PMIC_AUDIO_CALLBACK)(
const PMIC_AUDIO_EVENTS event);
/*!
* @enum PMIC_AUDIO_SOURCE
* @brief Select an audio signal processing component.
*
* This enumeration defines all of the possible PMIC audio signal handling
* components which can be acquired by calling pmic_audio_open().
*
* Note that the EXTERNAL_STEREO_IN selection is used to simply gain access
* to the stereo input pins. The stereo input signal can then be routed
* directly to the output amplifiers. In this case, no signal processing is
* done by either the Voice CODEC or the Stereo DAC.
*/
typedef enum
{
STEREO_DAC, /*!< Open connection to Stereo DAC. */
VOICE_CODEC, /*!< Open connection to Voice CODEC. */
EXTERNAL_STEREO_IN /*!< Open connection to external stereo inputs. */
} PMIC_AUDIO_SOURCE;
/*@}*/
/*!
* @name Data Bus Setup and Configuration Typedefs and Enumerations
* Typedefs and enumerations that are used to define and configure
* the data bus protocol in order to communicate with the Stereo DAC
* or the Voice CODEC.
*/
/*@{*/
/*!
* @enum PMIC_AUDIO_DATA_BUS
* @brief Select the data bus used to transfer data between the host and
* Voice CODEC and/or the Stereo DAC.
*
* This enumeration defines all of the possible PMIC audio data buses that
* can be used to transfer data between the host and the Voice CODEC and/or
* the Stereo DAC on the PMIC.
*
* Note that the same data bus may be used to transfer audio data to/from
* the Voice CODEC and the Stereo DAC. However, in this case, the data bus
* must be configured for network mode with different timeslots assigned to
* the Voice CODEC and the Stereo DAC. Also, the sampling rates must be
* identical for both the Voice CODEC and the Stereo DAC in order to avoid
* a data bus timing conflict and audio signal distortion.
*/
typedef enum
{
AUDIO_DATA_BUS_1, /*!< Use data bus 1 for audio data. */
AUDIO_DATA_BUS_2 /*!< Use data bus 2 for audio data. */
} PMIC_AUDIO_DATA_BUS;
/*!
* @enum PMIC_AUDIO_BUS_PROTOCOL
* @brief Select the data bus protocol to be used.
*
* This enumeration defines all of the possible PMIC audio data bus protocols
* that may be selected.
*/
typedef enum
{
NORMAL_MSB_JUSTIFIED_MODE, /*!< Transmit and receive audio data
in normal MSB-justified mode. */
NETWORK_MODE, /*!< Transmit and receive audio data
in network mode. */
I2S_MODE, /*!< Transmit and receive audio data
in I2S mode. */
SPD_IF_MODE /*!< Transmit and receive audio data
in SPD/IF mode <b>(MC13783-only)</b>.*/
} PMIC_AUDIO_BUS_PROTOCOL;
/*!
* @enum PMIC_AUDIO_BUS_MODE
* @brief Select the data bus mode to be used.
*
* This enumeration defines all of the possible PMIC audio data bus modes
* that may be selected. When configured in BUS_MASTER_MODE, the PMIC is
* responsible for supplying the data bus clock signals. Alternatively,
* when configured in BUS_SLAVE_MODE, the PMIC will use the data bus clock
* signals that are supplied by the bus master.
*/
typedef enum
{
BUS_MASTER_MODE = 0, /*!< Operate as bus master. */
BUS_SLAVE_MODE = 1 /*!< Operate as bus slave. */
} PMIC_AUDIO_BUS_MODE;
/*!
* @enum PMIC_AUDIO_CLOCK_IN_SOURCE
* @brief Select the clock signal source.
*
* This enumeration defines all of the possible PMIC audio clock signal
* sources that may be selected. One of these clock signal sources must
* be selected in order to use either the Voice CODEC or the Stereo DAC.
*
* When configured in BUS_MASTER_MODE, the PMIC's onboard PLL circuits
* will also be driven by the selected clock input signal.
*/
typedef enum
{
CLOCK_IN_DEFAULT, /*!< Just use default (power-up) clock input. */
CLOCK_IN_CLIA, /*!< Use the CLIA clock source (Stereo DAC
default) <b>(MC13783-only)</b>. */
CLOCK_IN_CLIB, /*!< Use the CLIB clock source (Voice CODEC
default) <b>(MC13783-only)</b>. */
CLOCK_IN_CLKIN, /*!< Use the CLKIN clock source
<b>(SC55112)</b>. */
CLOCK_IN_MCLK, /*!< Disable the internal PLL and use the MCLK
clock source (Stereo DAC only)
<b>(SC55112)</b>. */
CLOCK_IN_FSYNC, /*!< Internal PLL input from external framesync
(Stereo DAC only). */
CLOCK_IN_BITCLK /*!< Internal PLL input from external bitclock
(Stereo DAC only). */
} PMIC_AUDIO_CLOCK_IN_SOURCE;
/*!
* @enum PMIC_AUDIO_CLOCK_INVERT
* @brief Select whether to invert the frame sync or bit clock signals.
*
* This enumeration enables or disables the inversion of the incoming
* frame sync or bit clock signals.
*/
typedef enum
{
NO_INVERT = 0, /*!< Do not invert the clock signals. */
INVERT_BITCLOCK = 1, /*!< Invert the BCLK input signal. */
INVERT_FRAMESYNC = 2 /*!< Invert the FSYNC input signal. */
} PMIC_AUDIO_CLOCK_INVERT;
/*!
* @enum PMIC_AUDIO_NUMSLOTS
* @brief Select whether to invert the frame sync or bit clock signals.
*
* This enumeration defines all of the possible number of timeslots that may
* be selected when the PMIC is configured as the data bus master. One of these
* options must be selected if the Stereo DAC is to provide the data bus
* clock signals.
*
* Note that the Voice CODEC currently only allows USE_4_TIMESLOTS when
* operating in data bus master mode.
*/
typedef enum
{
USE_2_TIMESLOTS, /*!< Configure for 2 timeslots. */
USE_4_TIMESLOTS, /*!< Configure for 4 timeslots. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -