InPlay API
|
HAL AUDIO. More...
Enumerations | |
enum | audio_status_t { AUDIO_ERR_OK = 0, AUDIO_ERR_NOT_INIT = 1, AUDIO_ERR_ALREADY_INIT = 2, AUDIO_ERR_DEV_BAD_STATE = 3, AUDIO_ERR_INVALID_PARA = 4, AUDIO_ERR_OP_BLOCKED = 5, AUDIO_ERR_NO_AUDIO_CONFIG = 6, AUDIO_ERR_BAD_HW_GPIO_CONFIG = 7, AUDIO_ERR_AUDIO_HW_INTR = 8 } |
Audio function status return. More... | |
Functions | |
int | hal_audio_enc_open (void) |
Initialize encode functionality. More... | |
int | hal_audio_dec_open (void) |
Initialize decode functionality. More... | |
int | hal_audio_resample_open (void) |
Initialize resample functionality. More... | |
int | hal_audio_enc_close (void) |
Clean-up encode functionality. More... | |
int | hal_audio_dec_close (void) |
Clean-up decode functionality. More... | |
int | hal_audio_resample_close (void) |
Clean-up resample functionality. More... | |
int | hal_audio_enc_set_pdm_mic_inp (int pdm_l_core, int pdm_r_core, int wss_l_low) |
Configure PDM mic input control. More... | |
int | hal_audio_enc_set_predict_endianness (int is_little_end) |
Configure encode frame header endianness. More... | |
int | hal_audio_dec_set_predict_endianness (int is_little_end) |
Configure decode frame header endianness. More... | |
int | hal_audio_enc_set_config (int is_pdm, int is_I2S_master, float in_rate, float out_rate, int is_stereo, int bytes_per_frame, int gain) |
Configure audio_control encode function settings. More... | |
int | hal_audio_dec_set_config (int is_i2s, int is_I2S_master, float in_rate, float out_rate, uint8_t out_clk_src, float out_clk_rate, int is_stereo, int bytes_per_frame, int gain) |
Configure audio_control decode function settings. More... | |
int | hal_audio_resample_set_config (float in_rate, float out_rate, int is_stereo, int gain) |
Configure audio_control resample function settings. More... | |
int | hal_audio_enc_pdm_dc_offset_cal (int bytes_per_frame, int is_stereo, int num_frames_skip, int num_frames_samp) |
Calibrate PDM Encoder DC Offset. Must be called after hal_audio_enc_set_config. Once called, user must execute function again to re-calibrate. More... | |
int | hal_audio_encode_start (void *pv, void(*enc_lmt_callback)(void *)) |
Begin encode audio functionality based on current configuration. More... | |
int | hal_audio_encode_process (uint8_t *out_buf, uint32_t buf_sz, uint16_t *in_size) |
Request encoded data. More... | |
int | hal_audio_decode_start (uint8_t *in_buf, uint16_t buf_size, uint16_t *in_size, void *pv, void(*dec_lmt_callback)(void *pv)) |
Begin decode audio functionality based on current configuration and input data. More... | |
int | hal_audio_decode_process (uint8_t *in_buf, uint16_t buf_size, uint16_t *in_size) |
Provide audio hardware with additional encoded data to be decoded. More... | |
int | hal_audio_resample_process (uint32_t *in_buf, uint16_t *in_size, uint32_t *out_buf) |
Execute resample audio functionality based on current configuration and input data. More... | |
int | hal_audio_encode_stop (void) |
Stop encode audio functionality. More... | |
int | hal_audio_decode_stop (void) |
Stop decode audio functionality. More... | |
int | hal_audio_resample_stop (void) |
Stop resample audio functionality. More... | |
HAL AUDIO.
enum audio_status_t |
Audio function status return.
int hal_audio_dec_close | ( | void | ) |
Clean-up decode functionality.
int hal_audio_dec_open | ( | void | ) |
Initialize decode functionality.
int hal_audio_dec_set_config | ( | int | is_i2s, |
int | is_I2S_master, | ||
float | in_rate, | ||
float | out_rate, | ||
uint8_t | out_clk_src, | ||
float | out_clk_rate, | ||
int | is_stereo, | ||
int | bytes_per_frame, | ||
int | gain | ||
) |
Configure audio_control decode function settings.
[in] | is_i2s | 1 if audio decode output is i2s output path, 0 if output is sigma delta output path. |
[in] | is_I2S_master | 1 if audio decode output is I2S connected to I2S master core, 0 if output is I2S connected to I2S slave core, otherwise don't care. |
[in] | in_rate | Audio input encoded data rate in float format. |
[in] | is_stereo | 1 if audio sample format is stereo, 0 if format is mono. |
[in] | out_rate | Audio decode output decoded data rate in float format. |
[in] | out_clk_src | Audio decode clock rate source. 0 if source is I2S Master, 1 if source is I2S Slave, 2 if source is PDM clock. If clock source is PDM, hardware will internally configure clock. If clock source is I2S Master or I2S Slave, user must generate and/or supply clock signal. |
[in] | out_clk_rate | Audio decode clock rate used to generate audio decode out rate in float format. |
[in] | bytes_per_frame | Number of total bytes per decoded audio frame. Max 512 bytes. |
[in] | gain | Left/Right gain setting. |
int hal_audio_dec_set_predict_endianness | ( | int | is_little_end | ) |
Configure decode frame header endianness.
[in] | is_little_end | 1 if frame header predict bytes in little-endian format, 0 if big-endian format. |
int hal_audio_decode_process | ( | uint8_t * | in_buf, |
uint16_t | buf_size, | ||
uint16_t * | in_size | ||
) |
Provide audio hardware with additional encoded data to be decoded.
[in] | in_buf | Pointer to the input encoded data to be decoded. |
[in] | buf_size | Buffer size |
[out] | in_size | return with actual number of bytes inserted into audio hardware. |
int hal_audio_decode_start | ( | uint8_t * | in_buf, |
uint16_t | buf_size, | ||
uint16_t * | in_size, | ||
void * | pv, | ||
void(*)(void *pv) | dec_lmt_callback | ||
) |
Begin decode audio functionality based on current configuration and input data.
[in] | in_buf | Pointer to the input location of encoded data to be decoded. |
[in] | buf_size | Buffer size |
[out] | in_size | return with actual number of bytes inserted into audio hardware. |
int hal_audio_decode_stop | ( | void | ) |
Stop decode audio functionality.
int hal_audio_enc_close | ( | void | ) |
Clean-up encode functionality.
int hal_audio_enc_open | ( | void | ) |
Initialize encode functionality.
int hal_audio_enc_pdm_dc_offset_cal | ( | int | bytes_per_frame, |
int | is_stereo, | ||
int | num_frames_skip, | ||
int | num_frames_samp | ||
) |
Calibrate PDM Encoder DC Offset. Must be called after hal_audio_enc_set_config. Once called, user must execute function again to re-calibrate.
[in] | bytes_per_frame | Number of total bytes per encoded audio frame. Max 512 bytes. |
[in] | is_stereo | 1 if audio sample format is stereo, 0 if format is mono. |
[in] | num_frames_skip | Number of initial frames to skip when sampling dc offset |
[in] | num_frames_samp | Number of frames to measure when sampling dc offset |
int hal_audio_enc_set_config | ( | int | is_pdm, |
int | is_I2S_master, | ||
float | in_rate, | ||
float | out_rate, | ||
int | is_stereo, | ||
int | bytes_per_frame, | ||
int | gain | ||
) |
Configure audio_control encode function settings.
[in] | is_pdm | 1 if audio encode input is PDM mic, 0 if input is I2S mic. |
[in] | is_I2S_master | 1 if audio encode input is I2S mic connected to I2S master core, 0 if input is I2S mic connected to I2S slave core, otherwise don't care. |
[in] | in_rate | Audio encode microphone input sampling rate in float format. |
[in] | is_stereo | 1 if audio sample format is stereo, 0 if format is mono. |
[in] | out_rate | Audio encode output encoded data rate in float format. |
[in] | bytes_per_frame | Number of total bytes per encoded audio frame. Max 512 bytes. |
[in] | gain | Left/Right gain setting. |
int hal_audio_enc_set_pdm_mic_inp | ( | int | pdm_l_core, |
int | pdm_r_core, | ||
int | wss_l_low | ||
) |
Configure PDM mic input control.
[in] | pdm_l_core | 0 if pdm left input is connected to pin pdm data 0, 1 if connected to pin pdm data 1. |
[in] | pdm_r_core | 0 if pdm right input is connected to pin pdm data 0, 1 if connected to pin pdm data 1. |
[in] | wss_l_low | 0 if pdm left input is set during word select signal low, 1 if set during signal high. |
int hal_audio_enc_set_predict_endianness | ( | int | is_little_end | ) |
Configure encode frame header endianness.
[in] | is_little_end | 1 if frame header predict bytes in little-endian format, 0 if big-endian format. |
int hal_audio_encode_process | ( | uint8_t * | out_buf, |
uint32_t | buf_sz, | ||
uint16_t * | in_size | ||
) |
Request encoded data.
[in] | out_buf | Pointer to the output location where encoded data is to be written. |
[in] | buf_sz | Buffer size. |
[out] | in_size | Pointer to the requested number of encoded bytes of data. Location will be updated upon return with actual number of bytes written to output buffer. |
int hal_audio_encode_start | ( | void * | pv, |
void(*)(void *) | enc_lmt_callback | ||
) |
Begin encode audio functionality based on current configuration.
int hal_audio_encode_stop | ( | void | ) |
Stop encode audio functionality.
int hal_audio_resample_close | ( | void | ) |
Clean-up resample functionality.
int hal_audio_resample_open | ( | void | ) |
Initialize resample functionality.
int hal_audio_resample_process | ( | uint32_t * | in_buf, |
uint16_t * | in_size, | ||
uint32_t * | out_buf | ||
) |
Execute resample audio functionality based on current configuration and input data.
[in] | in_buf | Pointer to the input audio data to be resampled. |
[in] | in_size | Pointer to the requested number of bytes of data to be resampled. |
[out] | out_buf | Pointer to the output location where resampled data will be written. |
int hal_audio_resample_set_config | ( | float | in_rate, |
float | out_rate, | ||
int | is_stereo, | ||
int | gain | ||
) |
Configure audio_control resample function settings.
[in] | in_rate | Audio resample input sampling rate in float format. |
[in] | is_stereo | 1 if audio sample format is stereo, 0 if format is mono. |
[in] | out_rate | Audio resample output sampling rate in float format. |
[in] | gain | Left/Right gain setting. |
int hal_audio_resample_stop | ( | void | ) |
Stop resample audio functionality.