Zephyr API 3.6.99
Loading...
Searching...
No Matches
codec.h File Reference

Public API header file for Audio Codec. More...

Go to the source code of this file.

Data Structures

union  audio_dai_cfg_t
 Digital Audio Interface Configuration. More...
 
struct  audio_codec_cfg
 Codec configuration parameters. More...
 
union  audio_property_value_t
 Codec property values. More...
 

Typedefs

typedef void(* audio_codec_error_callback_t) (const struct device *dev, uint32_t errors)
 Callback for error interrupt.
 

Enumerations

enum  audio_pcm_rate_t {
  AUDIO_PCM_RATE_8K = 8000 , AUDIO_PCM_RATE_11P025K = 11025 , AUDIO_PCM_RATE_16K = 16000 , AUDIO_PCM_RATE_22P05K = 22050 ,
  AUDIO_PCM_RATE_24K = 24000 , AUDIO_PCM_RATE_32K = 32000 , AUDIO_PCM_RATE_44P1K = 44100 , AUDIO_PCM_RATE_48K = 48000 ,
  AUDIO_PCM_RATE_96K = 96000 , AUDIO_PCM_RATE_192K = 192000
}
 PCM audio sample rates. More...
 
enum  audio_pcm_width_t { AUDIO_PCM_WIDTH_16_BITS = 16 , AUDIO_PCM_WIDTH_20_BITS = 20 , AUDIO_PCM_WIDTH_24_BITS = 24 , AUDIO_PCM_WIDTH_32_BITS = 32 }
 PCM audio sample bit widths. More...
 
enum  audio_dai_type_t {
  AUDIO_DAI_TYPE_I2S , AUDIO_DAI_TYPE_LEFT_JUSTIFIED , AUDIO_DAI_TYPE_RIGHT_JUSTIFIED , AUDIO_DAI_TYPE_PCMA ,
  AUDIO_DAI_TYPE_PCMB , AUDIO_DAI_TYPE_INVALID
}
 Digital Audio Interface (DAI) type. More...
 
enum  audio_property_t { AUDIO_PROPERTY_OUTPUT_VOLUME , AUDIO_PROPERTY_OUTPUT_MUTE , AUDIO_PROPERTY_INPUT_VOLUME , AUDIO_PROPERTY_INPUT_MUTE }
 Codec properties that can be set by audio_codec_set_property(). More...
 
enum  audio_channel_t {
  AUDIO_CHANNEL_FRONT_LEFT , AUDIO_CHANNEL_FRONT_RIGHT , AUDIO_CHANNEL_LFE , AUDIO_CHANNEL_FRONT_CENTER ,
  AUDIO_CHANNEL_REAR_LEFT , AUDIO_CHANNEL_REAR_RIGHT , AUDIO_CHANNEL_REAR_CENTER , AUDIO_CHANNEL_SIDE_LEFT ,
  AUDIO_CHANNEL_SIDE_RIGHT , AUDIO_CHANNEL_HEADPHONE_LEFT , AUDIO_CHANNEL_HEADPHONE_RIGHT , AUDIO_CHANNEL_ALL
}
 Audio channel identifiers to use in audio_codec_set_property(). More...
 
enum  audio_route_t { AUDIO_ROUTE_BYPASS , AUDIO_ROUTE_PLAYBACK , AUDIO_ROUTE_PLAYBACK_CAPTURE , AUDIO_ROUTE_CAPTURE }
 
enum  audio_codec_error_type {
  AUDIO_CODEC_ERROR_OVERCURRENT = BIT(0) , AUDIO_CODEC_ERROR_OVERTEMPERATURE = BIT(1) , AUDIO_CODEC_ERROR_UNDERVOLTAGE = BIT(2) , AUDIO_CODEC_ERROR_OVERVOLTAGE = BIT(3) ,
  AUDIO_CODEC_ERROR_DC = BIT(4)
}
 Codec error type. More...
 

Functions

static int audio_codec_configure (const struct device *dev, struct audio_codec_cfg *cfg)
 Configure the audio codec.
 
static void audio_codec_start_output (const struct device *dev)
 Set codec to start output audio playback.
 
static void audio_codec_stop_output (const struct device *dev)
 Set codec to stop output audio playback.
 
static int audio_codec_set_property (const struct device *dev, audio_property_t property, audio_channel_t channel, audio_property_value_t val)
 Set a codec property defined by audio_property_t.
 
static int audio_codec_apply_properties (const struct device *dev)
 Atomically apply any cached properties.
 
static int audio_codec_clear_errors (const struct device *dev)
 Clear any codec errors.
 
static int audio_codec_register_error_callback (const struct device *dev, audio_codec_error_callback_t cb)
 Register a callback function for codec error.
 
static int audio_codec_route_input (const struct device *dev, audio_channel_t channel, uint32_t input)
 Sets up signal routing for a given input channel.
 
static int audio_codec_route_output (const struct device *dev, audio_channel_t channel, uint32_t output)
 Sets up signal routing for a given output channel.
 

Detailed Description

Public API header file for Audio Codec.

This file contains the Audio Codec APIs