Arm Virtual Hardware  Version 2.1.0
AVH FVP Models
 
Loading...
Searching...
No Matches

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.
 

Description

Audio Driver API functions.

Typedef Documentation

◆ AudioDrv_Event_t

AudioDrv_Event_t

Audio Events callback function type.

Parameters
[in]eventevents notification mask
Returns
none

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:

Function Documentation

◆ AudioDrv_Initialize()

int32_t AudioDrv_Initialize ( AudioDrv_Event_t  cb_event)

Initialize Audio Interface.

Parameters
[in]cb_eventpointer to AudioDrv_Event_t
Returns
return code

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:

  • Initializes the required resources of the audio interface.
  • Registers the AudioDrv_Event_t callback function.

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:

  • AUDIO_DRV_OK : audio interface is successfully initialized.

◆ AudioDrv_Uninitialize()

int32_t AudioDrv_Uninitialize ( void  )

De-initialize Audio Interface.

Returns
return code

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:

  • AUDIO_DRV_OK : audio interface is successfully de-initialized.

◆ AudioDrv_Configure()

int32_t AudioDrv_Configure ( uint32_t  interface,
uint32_t  channels,
uint32_t  sample_bits,
uint32_t  sample_rate 
)

Configure Audio Interface.

Parameters
[in]interfaceaudio interface
[in]channelsnumber of channels
[in]sample_bitssample number of bits (8..32)
[in]sample_ratesample rate (samples per second)
Returns
return code

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:

◆ AudioDrv_SetBuf()

int32_t AudioDrv_SetBuf ( uint32_t  interface,
void *  buf,
uint32_t  block_num,
uint32_t  block_size 
)

Set Audio Interface buffer.

Parameters
[in]interfaceaudio interface
[in]bufpointer to buffer for audio data
[in]block_numnumber of blocks in buffer (must be 2^n)
[in]block_sizeblock size in bytes
Returns
return code

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:

◆ AudioDrv_Control()

int32_t AudioDrv_Control ( uint32_t  control)

Control Audio Interface.

Parameters
[in]controloperation
Returns
return code

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.

◆ AudioDrv_GetTxCount()

uint32_t AudioDrv_GetTxCount ( void  )

Get transmitted block count.

Returns
number of transmitted blocks

The function AudioDrv_GetTxCount returns the number of the currently transmitted data items.

◆ AudioDrv_GetRxCount()

uint32_t AudioDrv_GetRxCount ( void  )

Get received block count.

Returns
number of received blocks

The function AudioDrv_GetRxCount returns the number of the currently received data items.

◆ AudioDrv_GetStatus()

AudioDrv_Status_t AudioDrv_GetStatus ( void  )

Get Audio Interface status.

Returns
AudioDrv_Status_t

The function AudioDrv_GetStatus retrieves the current Audio interface status.