Audio Driver API functions. More...
Typedefs | |
typedef void(* | AudioDrv_Event_t) (uint32_t event) |
Audio Events callback function type. | |
Functions | |
int32_t | AudioDrv_Initialize (AudioDrv_Event_t cb_event) |
Initialize Audio Interface. | |
int32_t | AudioDrv_Uninitialize (void) |
De-initialize Audio Interface. | |
int32_t | AudioDrv_Configure (uint32_t interface, uint32_t channels, uint32_t sample_bits, uint32_t sample_rate) |
Configure Audio Interface. | |
int32_t | AudioDrv_SetBuf (uint32_t interface, void *buf, uint32_t block_num, uint32_t block_size) |
Set Audio Interface buffer. | |
int32_t | AudioDrv_Control (uint32_t control) |
Control Audio Interface. | |
uint32_t | AudioDrv_GetTxCount (void) |
Get transmitted block count. | |
uint32_t | AudioDrv_GetRxCount (void) |
Get received block count. | |
AudioDrv_Status_t | AudioDrv_GetStatus (void) |
Get Audio Interface status. | |
Audio Driver API functions.
AudioDrv_Event_t |
Audio Events callback function type.
[in] | event | events notification mask |
Provides the typedef for the event callback function AudioDrv_Event (uint32 event) to be registered with AudioDrv_Initialize.
The parameter event indicates the reported event(s) that occurred during driver operation. Each event is encoded in a separate bit so it is possible to signal multiple events within the same call. AUDIO_DRV_EVENT_... definitions list the events that can be reported.
Parameter for:
int32_t AudioDrv_Initialize | ( | AudioDrv_Event_t | cb_event | ) |
Initialize Audio Interface.
[in] | cb_event | pointer to AudioDrv_Event_t |
The function AudioDrv_Initialize initializes the Audio interface over VSI peripheral. It is called when the middleware component starts operation.
The function performs the following operations:
The parameter cb_event is a pointer to the AudioDrv_Event_t callback function; use a NULL pointer when no callback signals are required.
Possible return values:
int32_t AudioDrv_Uninitialize | ( | void | ) |
De-initialize Audio Interface.
The function AudioDrv_Uninitialize de-initializes the resources of Audio interface.
It is called when the middleware component stops operation and releases the software resources used by the interface.
Possible return values:
int32_t AudioDrv_Configure | ( | uint32_t | interface, |
uint32_t | channels, | ||
uint32_t | sample_bits, | ||
uint32_t | sample_rate | ||
) |
Configure Audio Interface.
[in] | interface | audio interface |
[in] | channels | number of channels |
[in] | sample_bits | sample number of bits (8..32) |
[in] | sample_rate | sample rate (samples per second) |
The function AudioDrv_Configure configures audio interface according to specified arguments.
interface configures the audio interface either for input (AUDIO_DRV_INTERFACE_RX) or output (AUDIO_DRV_INTERFACE_TX).
channels, sample_bits, sample_rate define configuration parameters.
Possible return values:
int32_t AudioDrv_SetBuf | ( | uint32_t | interface, |
void * | buf, | ||
uint32_t | block_num, | ||
uint32_t | block_size | ||
) |
Set Audio Interface buffer.
[in] | interface | audio interface |
[in] | buf | pointer to buffer for audio data |
[in] | block_num | number of blocks in buffer (must be 2^n) |
[in] | block_size | block size in bytes |
The function AudioDrv_SetBuf assigns DMA buffer to the audio driver interface.
interface specifies whether the buffer is used for input (AUDIO_DRV_INTERFACE_RX) or output (AUDIO_DRV_INTERFACE_TX).
buf points to the memory buffer. block_num and block_size define buffer configuration. Note that the memory allocated for the buffer shall be at least block_num*block_size bytes.
Possible return values:
int32_t AudioDrv_Control | ( | uint32_t | control | ) |
Control Audio Interface.
[in] | control | operation |
The function AudioDrv_Control controls the Audio interface.
The parameter control specifies the operation as described in the table.
Parameter control | Bit | Description |
---|---|---|
AUDIO_DRV_CONTROL_TX_ENABLE. When executed, a timer is configured that periodically sends event to python interface for delivering the audio data. | 0 | Enable transmit operation. |
AUDIO_DRV_CONTROL_RX_ENABLE. When executed, a timer is configured that periodically sends event to python interface for delivering the audio data. | 1 | Enable receive operation. When executed, a timer is configured that periodically sends event to python interface for retrieving the audio data. |
AUDIO_DRV_CONTROL_TX_DISABLE | 2 | Disable transmit operation. |
AUDIO_DRV_CONTROL_RX_DISABLE | 3 | Disable receive operation. |
uint32_t AudioDrv_GetTxCount | ( | void | ) |
Get transmitted block count.
The function AudioDrv_GetTxCount returns the number of the currently transmitted data items.
uint32_t AudioDrv_GetRxCount | ( | void | ) |
Get received block count.
The function AudioDrv_GetRxCount returns the number of the currently received data items.
AudioDrv_Status_t AudioDrv_GetStatus | ( | void | ) |
Get Audio Interface status.
The function AudioDrv_GetStatus retrieves the current Audio interface status.