Add new framework for the PCM decoder. It is now a 'front end' for lower-level drivers like the WM8904 that performs the PCM decoding from end

This commit is contained in:
Gregory Nutt
2014-07-22 11:54:13 -06:00
parent 8548c64915
commit a4dcd690bb
9 changed files with 720 additions and 85 deletions
+8 -9
View File
@@ -287,9 +287,9 @@
/* Define the size of AP Buffer sample count base on CONFIG */
#ifdef CONFIG_AUDIO_LARGE_BUFFERS
typedef uint32_t apb_samp_t;
typedef uint32_t apb_samp_t;
#else
typedef uint16_t apb_samp_t;
typedef uint16_t apb_samp_t;
#endif
/* This structure is used to describe the audio device capabilities */
@@ -375,8 +375,7 @@ struct audio_msg_s
} u;
};
/* Strucure defining the built-in sounds */
/* Structure defining the built-in sounds */
#ifdef CONFIG_AUDIO_BUILTIN_SOUNDS
struct audio_sound_s
@@ -390,7 +389,7 @@ struct audio_sound_s
#endif
/* Structure for allocating, freeing and enqueuing audio pipeline
/* Structure for allocating, freeing and enqueueing audio pipeline
* buffers via the AUDIOIOC_ALLOCBUFFER, AUDIOIOC_FREEBUFFER,
* and AUDIOIOC_ENQUEUEBUFFER ioctls.
*/
@@ -404,7 +403,7 @@ struct audio_buf_desc_s
union
{
FAR struct ap_buffer_s *pBuffer; /* Buffer to free / enqueue */
FAR struct ap_buffer_s **ppBuffer; /* Pointer to receive alloced buffer */
FAR struct ap_buffer_s **ppBuffer; /* Pointer to receive allocated buffer */
} u;
};
@@ -467,7 +466,7 @@ struct audio_ops_s
/* Start audio streaming in the configured mode. For input and synthesis
* devices, this means it should begin sending streaming audio data. For output
* or processing type device, it means it should begin processing of any enqueued
* Audio Pipline Buffers.
* Audio Pipeline Buffers.
*/
#ifdef CONFIG_AUDIO_MULTI_SESSION
@@ -568,7 +567,7 @@ struct audio_ops_s
*/
#ifdef CONFIG_AUDIO_MULTI_SESSION
CODE int (*reserve)(FAR struct audio_lowerhalf_s *dev, FAR void **psession );
CODE int (*reserve)(FAR struct audio_lowerhalf_s *dev, FAR void **psession);
#else
CODE int (*reserve)(FAR struct audio_lowerhalf_s *dev);
#endif
@@ -576,7 +575,7 @@ struct audio_ops_s
/* Release a session. */
#ifdef CONFIG_AUDIO_MULTI_SESSION
CODE int (*release)(FAR struct audio_lowerhalf_s *dev, FAR void *session );
CODE int (*release)(FAR struct audio_lowerhalf_s *dev, FAR void *session);
#else
CODE int (*release)(FAR struct audio_lowerhalf_s *dev);
#endif
+118
View File
@@ -0,0 +1,118 @@
/****************************************************************************
* include/nuttx/audio/pcm_decode.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_AUDIO_PCM_DECODE_H
#define __INCLUDE_NUTTX_AUDIO_PCM_DECODE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/irq.h>
#ifdef CONFIG_AUDIO_FORMAT_PCM
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************
*
* CONFIG_AUDIO_FORMAT_PCM - Enabled PCM support
*/
/* Pre-requisites */
#ifndef CONFIG_AUDIO
# error CONFIG_AUDIO is required for PCM support
#endif
#ifndef CONFIG_SCHED_WORKQUEUE
# error CONFIG_SCHED_WORKQUEUE is required by the PCM driver
#endif
/* Default configuration values */
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: pcm_decode_initialize
*
* Description:
* Initialize the PCM device. The PCM device accepts and contains a
* low-level audio DAC-type device. It then returns a new audio lower
* half interface at adds a PCM decoding from end to the low-level
* audio device
*
* Input Parameters:
* dev - A reference to the low-level audio DAC-type device to contain.
*
* Returned Value:
* On success, a new audio device instance is returned that wraps the
* low-level device and provides a PCM decoding front end. NULL is
* returned on failure.
*
****************************************************************************/
FAR struct audio_lowerhalf_s *
pcm_decode_initialize(FAR struct audio_lowerhalf_s *dev);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_AUDIO_FORMAT_PCM */
#endif /* __INCLUDE_NUTTX_AUDIO_PCM_DECODE_H */