Audio playback implementation for the SF32LB52 audio codec (AUDCODEC) DAC.
More...
Audio playback implementation for the SF32LB52 audio codec (AUDCODEC) DAC.
◆ AudioDevice
DA7212 audio device.
SF32LB52 audio device.
QEMU audio device.
| Data Fields |
|
DMA_Channel_TypeDef * |
audec_dma_channel |
AUDCODEC DAC DMA channel. |
|
IRQn_Type |
audec_dma_irq |
AUDCODEC DAC DMA interrupt. |
|
uint32_t |
audec_dma_request |
AUDCODEC DAC DMA request. |
|
DMA_Channel_TypeDef * |
audprc_dma_channel |
AUDPRC DMA channel; not used by the driver. |
|
IRQn_Type |
audprc_dma_irq |
AUDPRC DMA interrupt; not used by the driver. |
|
uint32_t |
audprc_dma_request |
AUDPRC DMA request; not used by the driver. |
|
uint32_t |
base_addr |
Base address of the device registers. |
|
uint32_t |
channels |
Number of channels. |
|
I2CSlavePort * |
codec |
Codec control port. |
|
uint8_t |
data_format |
Sample width in bits; not used by the driver. |
|
uint8_t |
data_mode |
Data mode; not used by the driver. |
|
nrfx_i2s_t |
i2s_instance |
I2S instance. |
|
uint8_t |
irq_priority |
I2S interrupt priority. |
|
uint32_t |
irq_priority |
DAC DMA interrupt priority. |
|
int |
irqn |
Device interrupt number. |
|
uint32_t |
lrck_pin |
I2S LRCK pin, to the codec WCLK. |
|
uint32_t |
mck_pin |
I2S MCK pin, to the codec MCLK. |
|
OutputConfig |
pa_ctrl |
Power amplifier enable output. |
|
const BoardPowerOps * |
power_ops |
Board power hooks, or NULL. |
|
uint32_t |
samplerate |
Sample rate in Hz. |
|
uint32_t |
sck_pin |
I2S SCK pin, to the codec BCLK. |
|
uint32_t |
sdin_pin |
I2S SDIN pin, or NRF_I2S_PIN_NOT_CONNECTED. |
|
uint32_t |
sdout_pin |
I2S SDOUT pin, to the codec DATA_IN. |
|
AudioDeviceState * |
state |
Driver runtime state. |
◆ CFG_AUDIO_PLAYBACK_PIPE_SIZE
| #define CFG_AUDIO_PLAYBACK_PIPE_SIZE (1024) |
Size, in bytes, of each half of the DAC DMA buffer.
◆ CIRCULAR_BUF_SIZE_BYTES
◆ CIRCULAR_BUF_SIZE_MS
| #define CIRCULAR_BUF_SIZE_MS (128) |
Length of the queue between audio_write() and DMA, in milliseconds.
◆ CIRCULAR_BUF_SIZE_SAMPLES
◆ audec_dac0_dma_irq_handler()
| void audec_dac0_dma_irq_handler |
( |
AudioDevice * |
audio_device | ) |
|
|
extern |
AUDCODEC DAC DMA interrupt handler.
- Parameters
-
| audio_device | Audio device. |
◆ audec_init()
Initialize the AUDCODEC DAC path.
- Parameters
-
| audio_device | Audio device. |
- Returns
- True on success.
◆ audec_set_vol()
| void audec_set_vol |
( |
AudioDevice * |
audio_device, |
|
|
int |
volume |
|
) |
| |
|
extern |
Set the DAC volume, backing audio_set_volume().
- Parameters
-
| audio_device | Audio device. |
| volume | Volume from 0 to 100, clamped. |
◆ audec_start()
Start DAC playback, backing audio_start().
- Parameters
-
| audio_device | Audio device. |
| cb | Called on the system task whenever the device wants more data. |
◆ audec_stop()
Stop DAC playback, backing audio_stop().
- Parameters
-
| audio_device | Audio device. |
◆ audec_write()
| uint32_t audec_write |
( |
AudioDevice * |
audio_device, |
|
|
void * |
writeBuf, |
|
|
uint32_t |
size |
|
) |
| |
|
extern |
Queue PCM data, backing audio_write().
- Parameters
-
| audio_device | Audio device. |
| writeBuf | 16-bit PCM samples. |
| size | Size of writeBuf in bytes; data that does not fit is dropped. |
- Returns
- Free queue space in bytes after the write, 0 if not started.