libpynq  (release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
audio.h File Reference
#include <stdint.h>
Include dependency graph for audio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LINE_IN   0
 
#define MIC   1
 
#define IIC_SLAVE_ADDR   0x3b
 
#define IIC_SCLK_RATE   400000
 
#define I2S_DATA_RX_L_REG   0x00
 
#define I2S_DATA_RX_R_REG   0x04
 
#define I2S_DATA_TX_L_REG   0x08
 
#define I2S_DATA_TX_R_REG   0x0C
 
#define I2S_STATUS_REG   0x10
 

Enumerations

enum  audio_adau1761_regs {
  R0_CLOCK_CONTROL = 0x00, R1_PLL_CONTROL = 0x02, R2_DIGITAL_MIC_JACK_DETECTION_CONTROL = 0x08, R3_RECORD_POWER_MANAGEMENT = 0x09,
  R4_RECORD_MIXER_LEFT_CONTROL_0 = 0x0A, R5_RECORD_MIXER_LEFT_CONTROL_1 = 0x0B, R6_RECORD_MIXER_RIGHT_CONTROL_0 = 0x0C, R7_RECORD_MIXER_RIGHT_CONTROL_1 = 0x0D,
  R8_LEFT_DIFFERENTIAL_INPUT_VOLUME_CONTROL = 0x0E, R9_RIGHT_DIFFERENTIAL_INPUT_VOLUME_CONTROL = 0x0F, R10_RECORD_MICROPHONE_BIAS_CONTROL = 0x10, R11_ALC_CONTROL_0 = 0x11,
  R12_ALC_CONTROL_1 = 0x12, R13_ALC_CONTROL_2 = 0x13, R14_ALC_CONTROL_3 = 0x14, R15_SERIAL_PORT_CONTROL_0 = 0x15,
  R16_SERIAL_PORT_CONTROL_1 = 0x16, R17_CONVERTER_CONTROL_0 = 0x17, R18_CONVERTER_CONTROL_1 = 0x18, R19_ADC_CONTROL = 0x19,
  R20_LEFT_INPUT_DIGITAL_VOLUME = 0x1A, R21_RIGHT_INPUT_DIGITAL_VOLUME = 0x1B, R22_PLAYBACK_MIXER_LEFT_CONTROL_0 = 0x1C, R23_PLAYBACK_MIXER_LEFT_CONTROL_1 = 0x1D,
  R24_PLAYBACK_MIXER_RIGHT_CONTROL_0 = 0x1E, R25_PLAYBACK_MIXER_RIGHT_CONTROL_1 = 0x1F, R26_PLAYBACK_LR_MIXER_LEFT_LINE_OUTPUT_CONTROL = 0x20, R27_PLAYBACK_LR_MIXER_RIGHT_LINE_OUTPUT_CONTROL = 0x21,
  R28_PLAYBACK_LR_MIXER_MONO_OUTPUT_CONTROL = 0x22, R29_PLAYBACK_HEADPHONE_LEFT_VOLUME_CONTROL = 0x23, R30_PLAYBACK_HEADPHONE_RIGHT_VOLUME_CONTROL = 0x24, R31_PLAYBACK_LINE_OUTPUT_LEFT_VOLUME_CONTROL = 0x25,
  R32_PLAYBACK_LINE_OUTPUT_RIGHT_VOLUME_CONTROL = 0x26, R33_PLAYBACK_MONO_OUTPUT_CONTROL = 0x27, R34_PLAYBACK_POP_CLICK_SUPPRESSION = 0x28, R35_PLAYBACK_POWER_MANAGEMENT = 0x29,
  R36_DAC_CONTROL_0 = 0x2A, R37_DAC_CONTROL_1 = 0x2B, R38_DAC_CONTROL_2 = 0x2C, R39_SERIAL_PORT_PAD_CONTROL = 0x2D,
  R40_CONTROL_PORT_PAD_CONTROL_0 = 0x2F, R41_CONTROL_PORT_PAD_CONTROL_1 = 0x30, R42_JACK_DETECT_PIN_CONTROL = 0x31, R67_DEJITTER_CONTROL = 0x36,
  R58_SERIAL_INPUT_ROUTE_CONTROL = 0xF2, R59_SERIAL_OUTPUT_ROUTE_CONTROL = 0xF3, R61_DSP_ENABLE = 0xF5, R62_DSP_RUN = 0xF6,
  R63_DSP_SLEW_MODES = 0xF7, R64_SERIAL_PORT_SAMPLING_RATE = 0xF8, R65_CLOCK_ENABLE_0 = 0xF9, R66_CLOCK_ENABLE_1 = 0xFA
}
 

Functions

void audio_init (void)
 
void audio_select_input (int input)
 
void write_audio_reg (unsigned char u8RegAddr, unsigned char u8Data, int iic_fd)
 
void config_audio_pll (void)
 
void config_audio_codec (void)
 
void select_line_in (void)
 
void select_mic (void)
 
void deselect (void)
 
void audio_bypass (unsigned int audio_mmap_size, unsigned int nsamples, unsigned int volume, int uio_index)
 
void audio_record (unsigned int audio_mmap_size, unsigned int *BufAddr, unsigned int nsamples, int uio_index)
 
void audio_play (unsigned int audio_mmap_size, unsigned int *BufAddr, unsigned int nsamples, unsigned int volume, int uio_index)
 
void audio_repeat_play (unsigned int audio_mmap_size, unsigned int *BufAddr, unsigned int nsamples, unsigned int volume, unsigned int repetitions)
 
void audio_generate_tone (unsigned int frequency, uint32_t time_ms, unsigned int volume)
 
int32_t * audio_record_response (unsigned int frequency, uint32_t nperiods, unsigned int volume, uint32_t *nsamples)
 
void audio_record_response_start (void)