nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
audio_module.h File Reference
#include <zephyr/kernel.h>
#include <data_fifo.h>
#include "audio_defines.h"

Go to the source code of this file.

Data Structures

struct  audio_module_functions
 Private pointer to a module's functions. More...
 
struct  audio_module_description
 A module's minimum description. More...
 
struct  audio_module_thread_configuration
 Module's thread configuration structure. More...
 
struct  audio_module_parameters
 Module's generic set-up structure. More...
 
struct  audio_module_handle
 Private module handle. More...
 
struct  audio_module_message
 Private structure describing a data_in message into the module thread. More...
 

Macros

#define AUDIO_MODULE_PARAMETERS(p, dest, stk, stk_size, pri, fifo_rx, fifo_tx, slab, slab_size)
 Helper macro to configure the modules parameters.
 
#define AUDIO_MODULE_LOCATIONS_NUM   (32)
 Number of valid location bits.
 

Typedefs

typedef void(* audio_module_response_cb) (struct audio_module_handle_private *handle, struct audio_data const *const audio_data)
 Callback function for a response to a data_send as supplied by the module user.
 

Enumerations

enum  audio_module_type { AUDIO_MODULE_TYPE_UNDEFINED = 0 , AUDIO_MODULE_TYPE_INPUT , AUDIO_MODULE_TYPE_OUTPUT , AUDIO_MODULE_TYPE_IN_OUT }
 Module type. More...
 
enum  audio_module_state { AUDIO_MODULE_STATE_UNDEFINED = 0 , AUDIO_MODULE_STATE_CONFIGURED , AUDIO_MODULE_STATE_RUNNING , AUDIO_MODULE_STATE_STOPPED }
 Module state. More...
 

Functions

int audio_module_open (struct audio_module_parameters const *const parameters, struct audio_module_configuration const *const configuration, char const *const name, struct audio_module_context *context, struct audio_module_handle *handle)
 Open an audio module.
 
int audio_module_close (struct audio_module_handle *handle)
 Close an opened audio module.
 
int audio_module_reconfigure (struct audio_module_handle *handle, struct audio_module_configuration const *const configuration)
 Reconfigure an opened audio module.
 
int audio_module_configuration_get (struct audio_module_handle const *const handle, struct audio_module_configuration *configuration)
 Get the configuration of an audio module.
 
int audio_module_connect (struct audio_module_handle *handle_from, struct audio_module_handle *handle_to, bool connect_external)
 Connect two audio modules together or connect to the module's TX FIFO.
 
int audio_module_disconnect (struct audio_module_handle *handle, struct audio_module_handle *handle_disconnect, bool disconnect_external)
 Disconnect audio modules from each other or disconnect the module's TX FIFO. The function should be called for all individual disconnections.
 
int audio_module_start (struct audio_module_handle *handle)
 Start processing audio data in the audio module given by handle.
 
int audio_module_stop (struct audio_module_handle *handle)
 Stop processing audio data in the audio module given by handle.
 
int audio_module_data_tx (struct audio_module_handle *handle, struct audio_data const *const audio_data, audio_module_response_cb response_cb)
 Send an audio data item to an audio module, all data is consumed by the module.
 
int audio_module_data_rx (struct audio_module_handle *handle, struct audio_data *audio_data, k_timeout_t timeout)
 Retrieve an audio data item from an audio module.
 
int audio_module_data_tx_rx (struct audio_module_handle *handle_tx, struct audio_module_handle *handle_rx, struct audio_data const *const audio_data_tx, struct audio_data *audio_data_rx, k_timeout_t timeout)
 Send an audio data to an audio module and retrieve an audio data from an audio module.
 
int audio_module_names_get (struct audio_module_handle const *const handle, char **base_name, char *instance_name)
 Helper to get the base and instance names for a given audio module handle.
 
int audio_module_state_get (struct audio_module_handle const *const handle, enum audio_module_state *state)
 Helper to get the state of a given audio module handle.
 
int audio_module_number_channels_calculate (uint32_t locations, int8_t *number_channels)
 Helper to calculate the number of channels from the channel map for the given audio data.