![]() |
RZ Flexible Software Package Documentation
Release v4.0.0
|
|
Interface for PDM audio communication.
The pulse-density modulation(PDM) interface provides APIs and definitions for PDM audio communication.
Classes | |
| struct | st_pdm_callback_args |
| struct | st_pdm_sound_detection_setting |
| struct | st_pdm_status |
| struct | st_pdm_cfg |
| struct | st_pdm_api |
| struct | st_pdm_instance |
Typedefs | |
| typedef struct st_pdm_callback_args | pdm_callback_args_t |
| typedef struct st_pdm_sound_detection_setting | pdm_sound_detection_setting_t |
| typedef void | pdm_ctrl_t |
| typedef struct st_pdm_status | pdm_status_t |
| typedef struct st_pdm_cfg | pdm_cfg_t |
| typedef struct st_pdm_api | pdm_api_t |
| typedef struct st_pdm_instance | pdm_instance_t |
Enumerations | |
| enum | pdm_pcm_width_t |
| enum | pdm_input_data_edge_t |
| enum | pdm_event_t |
| enum | pdm_error_t |
| enum | pdm_state_t |
| struct RZV::st_pdm_callback_args |
Callback function parameter data
| Class Members | ||
|---|---|---|
| void * | p_context |
Placeholder for user data. Set in pdm_api_t::open function in pdm_cfg_t. |
| pdm_event_t | event | The event can be used to identify what caused the callback (overflow or error). |
| pdm_error_t | error | The kind of error. |
| struct RZV::st_pdm_sound_detection_setting |
| struct RZV::st_pdm_status |
PDM status.
| Class Members | ||
|---|---|---|
| pdm_state_t | state | Current PDM data state. |
| bool | sound_detection_enabled | Current PDM sound detection status. |
| pdm_error_t | error | Bitfield of current PDM errors. |
| struct RZV::st_pdm_cfg |
User configuration structure, used in open function
Public Attributes | |
| uint32_t | unit |
| pdm_pcm_width_t | pcm_width |
| Audio PCM data width. | |
| pdm_input_data_edge_t | pcm_edge |
| Input data select. | |
| transfer_instance_t const * | p_transfer_rx |
| void(* | p_callback )(pdm_callback_args_t *p_args) |
| void * | p_context |
| void const * | p_extend |
| Extension parameter for hardware specific settings. | |
| uint8_t | dat_ipl |
| Data reception interrupt priority. | |
| uint8_t | sdet_ipl |
| Sound detection interrupt priority. | |
| uint8_t | err_ipl |
| Idle/Error interrupt priority. | |
| IRQn_Type | dat_irq |
| IRQ number of data reception interrupt. | |
| IRQn_Type | sdet_irq |
| IRQ number of sound detection interrupt. | |
| IRQn_Type | err_irq |
| IRQ number of error detection interrupt. | |
| uint32_t unit |
Select a unit/channel corresponding to the unit/channel number of the hardware.
| transfer_instance_t const* p_transfer_rx |
To use DMA for receiving link a Transfer instance here. Set to NULL if unused.
| void(* p_callback) (pdm_callback_args_t *p_args) |
Callback provided when an PDM ISR occurs. Set to NULL for no CPU interrupt.
| void* p_context |
Placeholder for user data. Passed to the user callback in pdm_callback_args_t.
| struct RZV::st_pdm_api |
PDM functions implemented at the HAL layer will follow this API.
Public Attributes | |
| fsp_err_t(* | open )(pdm_ctrl_t *const p_ctrl, pdm_cfg_t const *const p_cfg) |
| fsp_err_t(* | start )(pdm_ctrl_t *const p_ctrl, void *const p_buffer, size_t const buffer_size, uint32_t const number_of_data_to_callback) |
| fsp_err_t(* | stop )(pdm_ctrl_t *const p_ctrl) |
| fsp_err_t(* | soundDetectionEnable )(pdm_ctrl_t *const p_ctrl, pdm_sound_detection_setting_t pdm_sound_detection_setting) |
| fsp_err_t(* | soundDetectionDisable )(pdm_ctrl_t *const p_ctrl) |
| fsp_err_t(* | read )(pdm_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes) |
| fsp_err_t(* | statusGet )(pdm_ctrl_t *const p_ctrl, pdm_status_t *const p_status) |
| fsp_err_t(* | close )(pdm_ctrl_t *const p_ctrl) |
| fsp_err_t(* | callbackSet )(pdm_ctrl_t *const p_ctrl, void(*p_callback)(pdm_callback_args_t *), void *const p_context, pdm_callback_args_t *const p_callback_memory) |
| fsp_err_t(* open) (pdm_ctrl_t *const p_ctrl, pdm_cfg_t const *const p_cfg) |
Initial configuration.
| [in] | p_ctrl | Pointer to control block. Must be declared by user. Elements set here. |
| [in] | p_cfg | Pointer to configuration structure. All elements of this structure must be set by user. |
| fsp_err_t(* start) (pdm_ctrl_t *const p_ctrl, void *const p_buffer, size_t const buffer_size, uint32_t const number_of_data_to_callback) |
Start communication.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| [in] | p_buffer | Pointer to the reception buffer |
| [in] | buffer_size | Size of the buffer |
| [in] | number_of_data_to_callback | Number of the data to call the callback function from dat_isr |
| fsp_err_t(* stop) (pdm_ctrl_t *const p_ctrl) |
Stop communication. Communication is stopped when callback is called with PDM_EVENT_IDLE.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| fsp_err_t(* soundDetectionEnable) (pdm_ctrl_t *const p_ctrl, pdm_sound_detection_setting_t pdm_sound_detection_setting) |
Enable sound detection with the specified settings.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| [in] | pdm_sound_detection_setting | Settings to configure sound detection. |
| fsp_err_t(* soundDetectionDisable) (pdm_ctrl_t *const p_ctrl) |
Disable sound detection.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| fsp_err_t(* read) (pdm_ctrl_t *const p_ctrl, void *const p_dest, uint32_t const bytes) |
Read remaining PDM data. This function can be called during PDM_STATE_STOPPED.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| [in] | p_dest | Buffer to store PCM samples. Must be 4 byte aligned. |
| [in] | bytes | Number of bytes in the buffer. Recommended requesting a multiple of 8 bytes. If not a multiple of 8, receive will stop at the multiple of 8 below requested bytes. |
| fsp_err_t(* statusGet) (pdm_ctrl_t *const p_ctrl, pdm_status_t *const p_status) |
Get current status and store it in provided pointer p_status.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| [out] | p_status | Current status of the driver. |
| fsp_err_t(* close) (pdm_ctrl_t *const p_ctrl) |
Allows driver to be reconfigured and may reduce power consumption.
| [in] | p_ctrl | Control block set in pdm_api_t::open call for this instance. |
| fsp_err_t(* callbackSet) (pdm_ctrl_t *const p_ctrl, void(*p_callback)(pdm_callback_args_t *), void *const p_context, pdm_callback_args_t *const p_callback_memory) |
Specify callback function and optional context pointer and working memory pointer.
| [in] | p_ctrl | Pointer to the PDM control block. |
| [in] | p_callback | Callback function |
| [in] | p_context | Pointer to send to callback function |
| [in] | p_callback_memory | Pointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback. |
| struct RZV::st_pdm_instance |
This structure encompasses everything that is needed to use an instance of this interface.
| Class Members | ||
|---|---|---|
| pdm_ctrl_t * | p_ctrl | Pointer to the control structure for this instance. |
| pdm_cfg_t const * | p_cfg | Pointer to the configuration structure for this instance. |
| pdm_api_t const * | p_api | Pointer to the API structure for this instance. |
| typedef struct st_pdm_callback_args pdm_callback_args_t |
Callback function parameter data Please refer to the struct st_pdm_callback_args.
| typedef struct st_pdm_sound_detection_setting pdm_sound_detection_setting_t |
Sound detection window setting Please refer to the struct st_pdm_sound_detection_setting.
| typedef void pdm_ctrl_t |
PDM control block. Allocate an instance specific control block to pass into the PDM API calls.
| typedef struct st_pdm_status pdm_status_t |
PDM status. Please refer to the struct st_pdm_status.
| typedef struct st_pdm_cfg pdm_cfg_t |
User configuration structure, used in open function Please refer to the struct st_pdm_cfg.
| typedef struct st_pdm_api pdm_api_t |
PDM functions implemented at the HAL layer will follow this API. Please refer to the struct st_pdm_api.
| typedef struct st_pdm_instance pdm_instance_t |
This structure encompasses everything that is needed to use an instance of this interface. Please refer to the struct st_pdm_instance.
| enum pdm_pcm_width_t |
Audio PCM width
| enum pdm_event_t |
| enum pdm_error_t |
Error information included in a callback function
| enum pdm_state_t |
Possible status values returned by pdm_api_t::statusGet.
| Enumerator | |
|---|---|
| PDM_STATE_IN_USE | PDM is actively reading data. |
| PDM_STATE_STOPPED | PDM is stopped and not actively reading data. |