libpynq
(release 5EID0-2023 version 0.3.0 of 2024-04-25 09:42 )
|
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 |
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) |
Low-level audio functions.
mic+ph and line_in can be used as audio input and mic+ph as output.
An example of using this library to play audio from line_in to mic+Ph:
enum audio_adau1761_regs |
void audio_bypass | ( | unsigned int | audio_mmap_size, |
unsigned int | nsamples, | ||
unsigned int | volume, | ||
int | uio_index | ||
) |
void audio_generate_tone | ( | unsigned int | frequency, |
uint32_t | time_ms, | ||
unsigned int | volume | ||
) |
void audio_init | ( | void | ) |
void audio_play | ( | unsigned int | audio_mmap_size, |
unsigned int * | BufAddr, | ||
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 | ||
) |
Function to support audio recording without the audio codec controller.
Notice that the buffer has to be twice the size of the number of samples, because both left and right channels are sampled.
audio_mmap_size | is the address range of the audio codec. |
BufAddr | is the buffer address. |
nsamples | is the number of samples. |
uio_index | is the uio index in /dev list. |
Definition at line 419 of file audio.c.
int32_t* audio_record_response | ( | unsigned int | frequency, |
uint32_t | nperiods, | ||
unsigned int | volume, | ||
uint32_t * | nsamples | ||
) |
void audio_record_response_start | ( | void | ) |
void audio_repeat_play | ( | unsigned int | audio_mmap_size, |
unsigned int * | BufAddr, | ||
unsigned int | nsamples, | ||
unsigned int | volume, | ||
unsigned int | repetitions | ||
) |
Function to play one audio fragment for multiple repititions.
audio_mmap_size | is the address range of the audio codec. |
BufAddr | is the buffer address. |
nsamples | is the number of samples. |
volume | is the volume of the output. |
repetitions | is the number of repitions. |
Definition at line 540 of file audio.c.
void audio_select_input | ( | int | input | ) |
void config_audio_codec | ( | void | ) |
void config_audio_pll | ( | void | ) |
void deselect | ( | void | ) |
void select_line_in | ( | void | ) |
void select_mic | ( | void | ) |