![]() |
MCUXpresso SDK API Reference Manual
Rev 2.16.000
NXP Semiconductors
|
The codec common driver provides a codec control abstraction interface.
Modules | |
CODEC Adapter | |
CS42888 Adapter | |
DA7212 Adapter | |
SGTL5000 Adapter | |
WM8904 Adapter | |
WM8960 Adapter | |
Data Structures | |
struct | _codec_config |
Initialize structure of the codec. More... | |
struct | _codec_capability |
codec capability More... | |
struct | _codec_handle |
Codec handle definition. More... | |
Macros | |
#define | CODEC_VOLUME_MAX_VALUE (100U) |
codec maximum volume range | |
Typedefs | |
typedef enum _codec_audio_protocol | codec_audio_protocol_t |
AUDIO format definition. More... | |
typedef enum _codec_module | codec_module_t |
audio codec module | |
typedef enum _codec_module_ctrl_cmd | codec_module_ctrl_cmd_t |
audio codec module control cmd | |
typedef struct _codec_handle | codec_handle_t |
codec handle declaration | |
typedef struct _codec_config | codec_config_t |
Initialize structure of the codec. | |
typedef struct _codec_capability | codec_capability_t |
codec capability | |
Functions | |
status_t | CODEC_Init (codec_handle_t *handle, codec_config_t *config) |
Codec initilization. More... | |
status_t | CODEC_Deinit (codec_handle_t *handle) |
Codec de-initilization. More... | |
status_t | CODEC_SetFormat (codec_handle_t *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) |
set audio data format. More... | |
status_t | CODEC_ModuleControl (codec_handle_t *handle, codec_module_ctrl_cmd_t cmd, uint32_t data) |
codec module control. More... | |
status_t | CODEC_SetVolume (codec_handle_t *handle, uint32_t channel, uint32_t volume) |
set audio codec pl volume. More... | |
status_t | CODEC_SetMute (codec_handle_t *handle, uint32_t channel, bool mute) |
set audio codec module mute. More... | |
status_t | CODEC_SetPower (codec_handle_t *handle, codec_module_t module, bool powerOn) |
set audio codec power. More... | |
status_t | CODEC_SetRecord (codec_handle_t *handle, uint32_t recordSource) |
codec set record source. More... | |
status_t | CODEC_SetRecordChannel (codec_handle_t *handle, uint32_t leftRecordChannel, uint32_t rightRecordChannel) |
codec set record channel. More... | |
status_t | CODEC_SetPlay (codec_handle_t *handle, uint32_t playSource) |
codec set play source. More... | |
Driver version | |
#define | FSL_CODEC_DRIVER_VERSION (MAKE_VERSION(2, 3, 1)) |
CLOCK driver version 2.3.1. More... | |
struct _codec_config |
Data Fields | |
uint32_t | codecDevType |
codec type | |
void * | codecDevConfig |
Codec device specific configuration. | |
struct _codec_capability |
Data Fields | |
uint32_t | codecModuleCapability |
codec module capability | |
uint32_t | codecPlayCapability |
codec play capability | |
uint32_t | codecRecordCapability |
codec record capability | |
uint32_t | codecVolumeCapability |
codec volume capability | |
struct _codec_handle |
Data Fields | |
codec_config_t * | codecConfig |
codec configuration function pointer | |
const codec_capability_t * | codecCapability |
codec capability | |
uint8_t | codecDevHandle [HAL_CODEC_HANDLER_SIZE] |
codec device handle | |
#define FSL_CODEC_DRIVER_VERSION (MAKE_VERSION(2, 3, 1)) |
typedef enum _codec_audio_protocol codec_audio_protocol_t |
anonymous enum |
anonymous enum |
anonymous enum |
enum _codec_module |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
status_t CODEC_Init | ( | codec_handle_t * | handle, |
codec_config_t * | config | ||
) |
handle | codec handle. |
config | codec configurations. |
status_t CODEC_Deinit | ( | codec_handle_t * | handle | ) |
handle | codec handle. |
status_t CODEC_SetFormat | ( | codec_handle_t * | handle, |
uint32_t | mclk, | ||
uint32_t | sampleRate, | ||
uint32_t | bitWidth | ||
) |
handle | codec handle. |
mclk | master clock frequency in HZ. |
sampleRate | sample rate in HZ. |
bitWidth | bit width. |
status_t CODEC_ModuleControl | ( | codec_handle_t * | handle, |
codec_module_ctrl_cmd_t | cmd, | ||
uint32_t | data | ||
) |
This function is used for codec module control, support switch digital interface cmd, can be expand to support codec module specific feature.
handle | codec handle. |
cmd | module control cmd, reference _codec_module_ctrl_cmd. |
data | value to write, when cmd is kCODEC_ModuleRecordSourceChannel, the data should be a value combine of channel and source, please reference macro CODEC_MODULE_RECORD_SOURCE_CHANNEL(source, LP, LN, RP, RN), reference codec specific driver for detail configurations. |
status_t CODEC_SetVolume | ( | codec_handle_t * | handle, |
uint32_t | channel, | ||
uint32_t | volume | ||
) |
handle | codec handle. |
channel | audio codec volume channel, can be a value or combine value of _codec_volume_capability or _codec_play_channel. |
volume | volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. |
status_t CODEC_SetMute | ( | codec_handle_t * | handle, |
uint32_t | channel, | ||
bool | mute | ||
) |
handle | codec handle. |
channel | audio codec volume channel, can be a value or combine value of _codec_volume_capability or _codec_play_channel. |
mute | true is mute, false is unmute. |
status_t CODEC_SetPower | ( | codec_handle_t * | handle, |
codec_module_t | module, | ||
bool | powerOn | ||
) |
handle | codec handle. |
module | audio codec module. |
powerOn | true is power on, false is power down. |
status_t CODEC_SetRecord | ( | codec_handle_t * | handle, |
uint32_t | recordSource | ||
) |
handle | codec handle. |
recordSource | audio codec record source, can be a value or combine value of _codec_record_source. |
status_t CODEC_SetRecordChannel | ( | codec_handle_t * | handle, |
uint32_t | leftRecordChannel, | ||
uint32_t | rightRecordChannel | ||
) |
handle | codec handle. |
leftRecordChannel | audio codec record channel, reference _codec_record_channel, can be a value combine of member in _codec_record_channel. |
rightRecordChannel | audio codec record channel, reference _codec_record_channel, can be a value combine of member in _codec_record_channel. |
status_t CODEC_SetPlay | ( | codec_handle_t * | handle, |
uint32_t | playSource | ||
) |
handle | codec handle. |
playSource | audio codec play source, can be a value or combine value of _codec_play_source. |