Add for audio sub-format in audion system. From Ken Pettit

This commit is contained in:
Gregory Nutt 2013-10-28 12:11:52 -06:00
parent 3fd4629bd7
commit de234b3a89
3 changed files with 82 additions and 48 deletions

View File

@ -5559,7 +5559,7 @@
are just hacked out and gutted versions of the corresponding
STM32 files (2013-9-13).
6.31 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
6.31 2013-10-28 Gregory Nutt <gnutt@nuttx.org>
* nuttx/fs/romfs/fs_romfsutil.c: Back out part of a recent
ROMFS change (2013-9-14).
@ -5571,7 +5571,7 @@
* configs/ and a few Ethernet drivers: Add the prefix ETH0
to all PHY configuration selections. This will allow us
to support to Ethernet MAC drivers with two different
PHYS (identified with ETH0 and ETH1) (2013-9-17).
PHYs (identified with ETH0 and ETH1) (2013-9-17).
* net/Kconfig and drivers/net/Kconfig: Move PHY selections from
net/Kconfig to drivers/net/Kconfig where they belong. Add the previx
ETH0_ to each PHY selection. And a new configuration
@ -5617,7 +5617,7 @@
endpoint from 0xff (invalid) to 10. This is not a critical change
but will avoid a complaint from the Linux driver when it overrides
the 0xff value (2013-9-22).
* configs/zkit-arm-1769: LED1 is not user controllable after booting.
* configs/zkit-arm-1769: LED1 is now user controllable after booting.
From Rashid Fatah (2013-9-23).
* arch/arm/src/sama5/sam_hsmci.c: TX DMA disabled. It is just not
reliable. No idea why. RX DMA is still used (2013-9-23).
@ -5654,9 +5654,9 @@
next outgoing packet from the TX done interrupt handling. From
Max Holtzberg (2013-9-27)
* sched/os_start.c: Should not call group_setupidlefiles() if there
are not file descriptors (and, hence, no file system) (2013-9-27).
are no file descriptors (and, hence, no file system) (2013-9-27).
* arch/arm/src/sama5/sam_gmac.c: GMAC driver and GMII logic is
code complete and readay for test (2013-9-27)
code complete and ready for test (2013-9-27)
* configs/compal_e86: Basic board support for the Motorola C139
(Compal E86) phone. From Craig Comstock (2013-9-27).
* configs/compal_e86: Converted to use the kconfig-frontends
@ -5686,14 +5686,14 @@
From Alan Carvalho de Assis. (2013-9-30).
* net/net_sendfile: The high performance sendfile logic is
now functional. From Max Holtzberg (2013-9-30).
* tools/define.sh: 'cut' long because as it once did. Script
* tools/define.sh: 'cut' no longer works as it once did. Script
adapted to observed behavior (2013-9-30).
* include/nuttx/net/route.h and net/net_*route.c: Partial
implementation of a routing table. Not yet hooked into the
build system (2013-10-1)
* include/net/route.h: Defines the application interface to
the routing table (2013-10-2).
* configs/spark: Add configuratino for the Spark Core. The
* configs/spark: Add configuration for the Spark Core. The
initial check-in is basically the Maple Mini board (2013-10-2).
* include/net/route.h and libc/net/lib_addroute.c and delroute.c:
Add an application interface to manage the routing table
@ -5724,7 +5724,7 @@
Max Holtzberg (2013-10-8).
* arch/arm/src/sama5/sam_lcd.c: LCDC driver is code complete and
incorporated into the build system (but still untested (2013-10-8).
* configs/sama5d3x-ek/nx: Add an examples/nx configuratino that
* configs/sama5d3x-ek/nx: Add an examples/nx configuration that
will be used for the SAMA5 LCD bring-up (2013-10-8).
* configs/arduino-due/Kconfig and include/board.h: Add configuration
to select revision 3 of the Arduino Due which has some small
@ -5749,7 +5749,7 @@
uip/uip_udpconn.c, uip/uip_udpinput.c: Changed the meaning of the
uip_*input functions. They now return success when a packet is
dropped; This is needed for the ENCX24J600 driver that must make
a decision to return the packet or not: It should not retai
a decision to return the packet or not: It should not retry
dropped packets. From Max Holtzberg (2013-10-11).
* drivers/net/encx24j600.c and Kconfig: ENCX24J600: Improved descriptor
handling, free packets on rx abort interrupt. From Max Holtzberg
@ -5768,7 +5768,7 @@
* configs/sama5d3x-ek/nxwm/defconfig: Now uses scaled icons in the
the NxWM taskbar (2013-10-15).
* configs/sama5d3x-ek/nxwm/defconfig: Use the 320x320 NuttX logo as
the NxWM backgroun (2013-10-15).
the NxWM background (2013-10-15).
* arch/arm/src/stm32/chip/stm32f103c_pinmap.h: Pinmapping corrections
from David Sidrane (2013-10-16).
* configs/spark: The Spark device configuration is receiving some
@ -5826,7 +5826,7 @@
driver into the build system; Verify the correct operation of the
SAMA5 RTC driver (2013-10-19).
* arch/arm/src/sama5/sam_wdt.c and .h: Add a SAMA5 watchdog timer
drvier. Untested on initial check-in (2013-10-19).
driver. Untested on initial check-in (2013-10-19).
* arch/arm/src/sama5/sam_trng.c, sam_trng.h, and chip/sam_trng.h: Add
a /dev/random driver based on the SAMA5D3 TRNG peripheral (2013-10-20).
* configs/sama5d3x-3k/demo: The TRNG and /dev/random are now enabled
@ -5893,8 +5893,8 @@
* drivers/audio/ and include/nuttx/audio/vs1053.h: Updated
VS1053 driver from ken Pettit (2013-10-27).
* configs/mikroe-stm32f4/: Updated configuration for the
Mikrow STM32F4 board from Ken Pettit (2013-10-27).
* arch/arm/src/stm32/stm32_spi.c: DMA-related fixe from Ken
Mikroe STM32F4 board from Ken Pettit (2013-10-27).
* arch/arm/src/stm32/stm32_spi.c: DMA-related fixes from Ken
Pettit (2013-10-27).
* sched/sched_releasetcb.c: Fix a cornercase: If sched_releasetcb()
is called as part of a failed pthread startup before the flags
@ -5904,4 +5904,7 @@
modes: single channel or multiple channel with sequencer support.
software trigger or timer trigger; ADC channel interrupts or
DMA (2013-10-28).
* nuttx/drivers/audio/vs1053.c and nuttx/include/nuttx/audio/audio.h:
Add logic to verify the audio sub-format. From Ken Pettit (2013-10-28).
6.32 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>

View File

@ -583,34 +583,54 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
pCaps->ac_channels = 2; /* Stereo output */
/* The input formats we can decode / accept */
switch (pCaps->ac_subtype)
{
case AUDIO_TYPE_QUERY:
/* The input formats we can decode / accept */
pCaps->ac_format[0] = 0
*((uint16_t *) &pCaps->ac_format[0]) = 0
#ifdef CONFIG_AUDIO_FORMAT_AC3
| AUDIO_FMT_AC3
| (1 << (AUDIO_FMT_AC3 - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_MP3
| AUDIO_FMT_MP3
| (1 << (AUDIO_FMT_MP3 - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_WMA
| AUDIO_FMT_WMA
| (1 << (AUDIO_FMT_WMA - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_MIDI
| AUDIO_FMT_MIDI
| (1 << (AUDIO_FMT_MIDI - 1))
#endif
#ifdef CONFIG_AUDIO_FORMAT_PCM
| AUDIO_FMT_PCM
| (1 << (AUDIO_FMT_PCM - 1))
#endif
;
#ifdef CONFIG_AUDIO_FORMAT_OGG_VORBIS
pCaps->ac_format[1] = (AUDIO_FMT_OGG_VORBIS) >> 8;
| (1 << (AUDIO_FMT_OGG_VORBIS - 1))
#endif
;
/* The types of audio units we implement */
pCaps->ac_controls[0] = AUDIO_TYPE_OUTPUT | AUDIO_TYPE_FEATURE |
AUDIO_TYPE_PROCESSING;
break;
/* Report sub-formats for MIDI if requested */
#ifdef CONFIG_AUDIO_FORMAT_MIDI
case AUDIO_FMT_MIDI:
/* We only support Format 0 */
pCaps->ac_controls[0] = AUDIO_SUBFMT_MIDI_0;
pCaps->ac_controls[1] = AUDIO_SUBFMT_END;
break;
#endif
/* The types of audio units we implement */
pCaps->ac_controls[0] = AUDIO_TYPE_OUTPUT | AUDIO_TYPE_FEATURE |
AUDIO_TYPE_PROCESSING;
default:
pCaps->ac_controls[0] = AUDIO_SUBFMT_END;
break;
}
break;
@ -663,6 +683,7 @@ static int vs1053_getcaps(FAR struct audio_lowerhalf_s *lower, int type,
/* Fill in the ac_controls section with the Feature Units we have */
pCaps->ac_controls[0] = AUDIO_FU_VOLUME | AUDIO_FU_BASS | AUDIO_FU_TREBLE;
pCaps->ac_controls[1] = AUDIO_FU_BALANCE >> 8;
}
else
{

View File

@ -129,33 +129,40 @@
* is a list of bit-field definitons for defining the device type.
*/
#define AUDIO_TYPE_QUERY 0x0000
#define AUDIO_TYPE_INPUT 0x0002
#define AUDIO_TYPE_OUTPUT 0x0004
#define AUDIO_TYPE_MIXER 0x0008
#define AUDIO_TYPE_SELECTOR 0x0010
#define AUDIO_TYPE_FEATURE 0x0020
#define AUDIO_TYPE_EFFECT 0x0040
#define AUDIO_TYPE_PROCESSING 0x0080
#define AUDIO_TYPE_EXTENSION 0x0100
#define AUDIO_TYPE_QUERY 0x00
#define AUDIO_TYPE_INPUT 0x02
#define AUDIO_TYPE_OUTPUT 0x02
#define AUDIO_TYPE_MIXER 0x04
#define AUDIO_TYPE_SELECTOR 0x08
#define AUDIO_TYPE_FEATURE 0x10
#define AUDIO_TYPE_EFFECT 0x20
#define AUDIO_TYPE_PROCESSING 0x40
#define AUDIO_TYPE_EXTENSION 0x80
/* Audio Format Types *******************************************************/
/* The following defines the audio data format types in NuttX. */
/* The following defines the audio data format types in NuttX. During a
* format query, these will be converted to bit positions withing the
* ac_format field, meaning we currently only support up to 16 formats. To
* support more than that, we will use the FMT_OTHER entry, and the
* interfacing software can perform a second query to get the other formats.
*/
#define AUDIO_FMT_UNDEF 0x000
#define AUDIO_FMT_OTHER 0x001
#define AUDIO_FMT_MPEG 0x002
#define AUDIO_FMT_AC3 0x004
#define AUDIO_FMT_WMA 0x008
#define AUDIO_FMT_DTS 0x010
#define AUDIO_FMT_PCM 0x020
#define AUDIO_FMT_WAV 0x020
#define AUDIO_FMT_MP3 0x040
#define AUDIO_FMT_MIDI 0x080
#define AUDIO_FMT_OGG_VORBIS 0x100
#define AUDIO_FMT_UNDEF 0x00
#define AUDIO_FMT_OTHER 0x01
#define AUDIO_FMT_MPEG 0x02
#define AUDIO_FMT_AC3 0x03
#define AUDIO_FMT_WMA 0x04
#define AUDIO_FMT_DTS 0x05
#define AUDIO_FMT_PCM 0x06
#define AUDIO_FMT_WAV 0x07
#define AUDIO_FMT_MP3 0x08
#define AUDIO_FMT_MIDI 0x09
#define AUDIO_FMT_OGG_VORBIS 0x0A
#define AUDIO_FMT_FLAC 0x0B
/* Audio Sub-Format Types ***************************************************/
#define AUDIO_SUBFMT_END 0x00
#define AUDIO_SUBFMT_PCM_MP1 0x01
#define AUDIO_SUBFMT_PCM_MP2 0x02
#define AUDIO_SUBFMT_PCM_MP3 0x03
@ -167,6 +174,9 @@
#define AUDIO_SUBFMT_PCM_S16_BE 0x09
#define AUDIO_SUBFMT_PCM_S16_LE 0x0A
#define AUDIO_SUBFMT_PCM_U16_BE 0x0B
#define AUDIO_SUBFMT_MIDI_0 0x0C
#define AUDIO_SUBFMT_MIDI_1 0x0D
#define AUDIO_SUBFMT_MIDI_2 0x0E
/* Supported Sampling Rates *************************************************/