RA Flexible Software Package Documentation  Release v5.2.0

 
ADPCM Decoder (rm_adpcm_decoder)

Functions

fsp_err_t RM_ADPCM_DECODER_Open (adpcm_decoder_ctrl_t *p_ctrl, adpcm_decoder_cfg_t const *const p_cfg)
 
fsp_err_t RM_ADPCM_DECODER_Decode (adpcm_decoder_ctrl_t *const p_ctrl, void const *p_src, void *p_dest, uint32_t src_len_bytes)
 
fsp_err_t RM_ADPCM_DECODER_Reset (adpcm_decoder_ctrl_t *p_ctrl)
 
fsp_err_t RM_ADPCM_DECODER_Close (adpcm_decoder_ctrl_t *p_ctrl)
 

Detailed Description

Middleware to implement the ADPCM Audio Decoder. This module implements the ADPCM Decoder Interface.

Overview

Features

The ADPCM Audio Decoder has the following key features:

Configuration

Build Time Configurations for rm_adpcm_decoder

The following build time configurations are defined in fsp_cfg/rm_adpcm_decoder_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.

Configurations for Audio > ADPCM Decoder (rm_adpcm_decoder)

This module can be added to the Stacks tab via New Stack > Audio > ADPCM Decoder (rm_adpcm_decoder).

ConfigurationOptionsDefaultDescription
NameName must be a valid C symbolg_adpcm_decoder0 Module name.

Clock Configuration

This module has no required clock configurations.

Pin Configuration

This module does not use I/O pins.

Examples

Basic Example

This is a basic example of minimal use of the ADPCM Audio Decoder implementation in an application.

void rm_adpcm_decoder_example ()
{
/* Open the ADPCM audio decoder instance. */
fsp_err_t err = RM_ADPCM_DECODER_Open(&g_adpcmdec_ctrl, &g_adpcmdec_cfg);
/* Handle any errors. This function should be defined by the user. */
assert(FSP_SUCCESS == err);
/* Decode the data */
err = RM_ADPCM_DECODER_Decode(&g_adpcmdec_ctrl, g_adpcm_stream1, g_pcm_stream, ADPCM_BUFFER_SIZE_BYTES);
assert(FSP_SUCCESS == err);
/* Reset the ADPCM audio decoder instance before decoding a new stream. */
err = RM_ADPCM_DECODER_Reset(&g_adpcmdec_ctrl);
assert(FSP_SUCCESS == err);
/* Decode the first chunk of ADPCM data */
err = RM_ADPCM_DECODER_Decode(&g_adpcmdec_ctrl, g_adpcm_stream2, g_pcm_stream, (ADPCM_BUFFER_SIZE_BYTES/2));
assert(FSP_SUCCESS == err);
/* Decode the second chunk of ADPCM data */
err = RM_ADPCM_DECODER_Decode(&g_adpcmdec_ctrl, &g_adpcm_stream2[ADPCM_BUFFER_SIZE_BYTES/2],
g_pcm_stream, (ADPCM_BUFFER_SIZE_BYTES/2));
assert(FSP_SUCCESS == err);
}

Data Structures

struct  adpcm_decoder_instance_ctrl_t
 

Data Structure Documentation

◆ adpcm_decoder_instance_ctrl_t

struct adpcm_decoder_instance_ctrl_t

RM_ADPCM_DECODER instance control block. DO NOT INITIALIZE. Initialized in adpcm_decoder_api_t::open().

Function Documentation

◆ RM_ADPCM_DECODER_Open()

fsp_err_t RM_ADPCM_DECODER_Open ( adpcm_decoder_ctrl_t p_ctrl,
adpcm_decoder_cfg_t const *const  p_cfg 
)

Initializes ADPCM audio decoder device.

Implements adpcm_decoder_api_t::open().

Return values
FSP_SUCCESSModule is ready for use.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_ALREADY_OPENThe instance control structure has already been opened.

◆ RM_ADPCM_DECODER_Decode()

fsp_err_t RM_ADPCM_DECODER_Decode ( adpcm_decoder_ctrl_t *const  p_ctrl,
void const *  p_src,
void *  p_dest,
uint32_t  src_len_bytes 
)

Decodes 4bit ADPCM data to 16bit PCM data. It reads ADPCM data from area pointed by inputAddr pointer, decodes the number of samples specified and stores the decoded data in buffer pointed with outputAddr pointer.

Implements adpcm_decoder_api_t::decode().

Return values
FSP_SUCCESSDecode operation successfully completed.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ RM_ADPCM_DECODER_Reset()

fsp_err_t RM_ADPCM_DECODER_Reset ( adpcm_decoder_ctrl_t p_ctrl)

This function resets the ADPCM decoder device.

Implements adpcm_decoder_api_t::reset().

Return values
FSP_SUCCESSModule closed.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.

◆ RM_ADPCM_DECODER_Close()

fsp_err_t RM_ADPCM_DECODER_Close ( adpcm_decoder_ctrl_t p_ctrl)

This function closes the ADPCM decoder device.

Implements adpcm_decoder_api_t::close().

Return values
FSP_SUCCESSModule closed.
FSP_ERR_ASSERTIONAn input argument is invalid.
FSP_ERR_NOT_OPENUnit is not open.