9
0
Fork 0

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 022d456026
commit b0d39caa14
8 changed files with 245 additions and 79 deletions

View File

@ -379,7 +379,7 @@
state due to e.g. powerdown or other manual intervention. From state due to e.g. powerdown or other manual intervention. From
Petteri Aimonen (2013-6-4). Petteri Aimonen (2013-6-4).
1.9 2013-xx-xx Gregory Nutt <gnutt@nuttx.org> 1.9 2013-10-28 Gregory Nutt <gnutt@nuttx.org>
* NxWM::CCalibration.cxx/hxx: If CONFIG_NXWM_CALIBRATION_MESSAGES is * NxWM::CCalibration.cxx/hxx: If CONFIG_NXWM_CALIBRATION_MESSAGES is
defined then CCalibration will provide some instructions in the center defined then CCalibration will provide some instructions in the center
@ -398,3 +398,5 @@
* NxWM::CCalibration and NxWM::CTouchscreen: Add a complex touchscreen * NxWM::CCalibration and NxWM::CTouchscreen: Add a complex touchscreen
scaling algorithm to handling the case where the measured X values also scaling algorithm to handling the case where the measured X values also
vary with y position (and vice versa) (2013-10-17). vary with y position (and vice versa) (2013-10-17).
1.10 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>

View File

@ -646,7 +646,7 @@
* apps/nshlib/nsh_fscmds.c: Fix NSH listing output for the case * apps/nshlib/nsh_fscmds.c: Fix NSH listing output for the case
of a single file. Provided by Lorenz Meier (2013-9-13). of a single file. Provided by Lorenz Meier (2013-9-13).
6.31 2013-xx-xx Gregory Nutt <gnutt@nuttx.org> 6.31 2013-10-28 Gregory Nutt <gnutt@nuttx.org>
* apps/nshlib/nsh_netcmds.c: Remove a warning when DHCP is not * apps/nshlib/nsh_netcmds.c: Remove a warning when DHCP is not
enabled (2013-9-17). enabled (2013-9-17).
@ -655,7 +655,7 @@
(2013-9017). (2013-9017).
* apps/examples/ostest/Kconfig: Add configuration options for * apps/examples/ostest/Kconfig: Add configuration options for
the FPU test. There are still many OS test configuration the FPU test. There are still many OS test configuration
optionst that do not appear in Kconfig (2013-9-18). options that do not appear in Kconfig (2013-9-18).
* apps/examples/cc3000: Condition the CC3000 example on having * apps/examples/cc3000: Condition the CC3000 example on having
selected the CC3000 device. Otherwise, you are prompted for selected the CC3000 device. Otherwise, you are prompted for
this the CC3000 option on each 'make oldconfig' (2013-9-18). this the CC3000 option on each 'make oldconfig' (2013-9-18).
@ -702,4 +702,7 @@
* apps/examples/cc3000: Updates from David Sidrane (2013-10-25). * apps/examples/cc3000: Updates from David Sidrane (2013-10-25).
* apps/system/nxplayer: Implements a command line media * apps/system/nxplayer: Implements a command line media
player. From Ken Pettit (2013-10-27). player. From Ken Pettit (2013-10-27).
* apps/system/nxplayer: Add logic to verify the audio sub-format.
From Ken Pettit (2013-10-28).
6.31 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>

View File

@ -180,6 +180,8 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, char* device);
* filename - Pointer to pathname of the file to play * filename - Pointer to pathname of the file to play
* filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF * filefmt - Format of audio in filename if known, AUDIO_FMT_UNDEF
* to let nxplayer_playfile() determine automatically. * to let nxplayer_playfile() determine automatically.
* subfmt - Sub-Format of audio in filename if known, AUDIO_FMT_UNDEF
* to let nxplayer_playfile() determine automatically.
* *
* Returned values: * Returned values:
* OK if file found, device found, and playback started. * OK if file found, device found, and playback started.
@ -187,7 +189,7 @@ int nxplayer_setdevice(FAR struct nxplayer_s *pPlayer, char* device);
**************************************************************************/ **************************************************************************/
int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* filename, int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* filename,
int filefmt); int filefmt, int subfmt);
/**************************************************************************** /****************************************************************************
* Name: nxplayer_stop * Name: nxplayer_stop
@ -353,4 +355,3 @@ int nxplayer_systemreset(FAR struct nxplayer_s *pPlayer);
#endif #endif
#endif /* __APPS_SYSTEM_NXPLAYER_NXPLAYER_H */ #endif /* __APPS_SYSTEM_NXPLAYER_NXPLAYER_H */

View File

@ -81,6 +81,7 @@ struct nxplayer_ext_fmt_s
{ {
const char *ext; const char *ext;
uint16_t format; uint16_t format;
CODE int (*getsubformat)(FAR FILE *fd);
}; };
#endif #endif
@ -88,6 +89,10 @@ struct nxplayer_ext_fmt_s
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_AUDIO_FORMAT_MIDI
int nxplayer_getmidisubformat(FAR FILE *fd);
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
@ -95,26 +100,26 @@ struct nxplayer_ext_fmt_s
#ifdef CONFIG_NXPLAYER_FMT_FROM_EXT #ifdef CONFIG_NXPLAYER_FMT_FROM_EXT
static const struct nxplayer_ext_fmt_s g_known_ext[] = { static const struct nxplayer_ext_fmt_s g_known_ext[] = {
#ifdef CONFIG_AUDIO_FORMAT_AC3 #ifdef CONFIG_AUDIO_FORMAT_AC3
{ "ac3", AUDIO_FMT_AC3 }, { "ac3", AUDIO_FMT_AC3, NULL },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_MP3 #ifdef CONFIG_AUDIO_FORMAT_MP3
{ "mp3", AUDIO_FMT_MP3 }, { "mp3", AUDIO_FMT_MP3, NULL },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_DTS #ifdef CONFIG_AUDIO_FORMAT_DTS
{ "dts", AUDIO_FMT_DTS }, { "dts", AUDIO_FMT_DTS, NULL },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_WMA #ifdef CONFIG_AUDIO_FORMAT_WMA
{ "wma", AUDIO_FMT_WMA }, { "wma", AUDIO_FMT_WMA, NULL },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_PCM #ifdef CONFIG_AUDIO_FORMAT_PCM
{ "wav", AUDIO_FMT_PCM }, { "wav", AUDIO_FMT_PCM, NULL },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_MIDI #ifdef CONFIG_AUDIO_FORMAT_MIDI
{ "mid", AUDIO_FMT_MIDI }, { "mid", AUDIO_FMT_MIDI, nxplayer_getmidisubformat },
{ "midi", AUDIO_FMT_MIDI }, { "midi", AUDIO_FMT_MIDI, nxplayer_getmidisubformat },
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_OGG_VORBIS #ifdef CONFIG_AUDIO_FORMAT_OGG_VORBIS
{ "ogg", AUDIO_FMT_OGG_VORBIS } { "ogg", AUDIO_FMT_OGG_VORBIS, NULL }
#endif #endif
}; };
static const int g_known_ext_count = sizeof(g_known_ext) / static const int g_known_ext_count = sizeof(g_known_ext) /
@ -140,12 +145,15 @@ static const int g_known_ext_count = sizeof(g_known_ext) /
* *
****************************************************************************/ ****************************************************************************/
static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format) static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format,
int subfmt)
{ {
struct dirent* pDevice; struct dirent* pDevice;
DIR* dirp; DIR* dirp;
char path[64]; char path[64];
struct audio_caps_s caps; struct audio_caps_s caps;
uint8_t supported = TRUE;
uint8_t x;
/* If we have a preferred device, then open it */ /* If we have a preferred device, then open it */
@ -156,7 +164,7 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
* format is specified by the device * format is specified by the device
*/ */
if (((pPlayer->prefformat & format) == 0) || if (((pPlayer->prefformat & (1 << (format - 1)) == 0) ||
((pPlayer->preftype & AUDIO_TYPE_OUTPUT) == 0)) ((pPlayer->preftype & AUDIO_TYPE_OUTPUT) == 0))
{ {
/* Format not supported by the device */ /* Format not supported by the device */
@ -223,19 +231,69 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
caps.ac_len = sizeof(caps); caps.ac_len = sizeof(caps);
caps.ac_type = AUDIO_TYPE_QUERY; caps.ac_type = AUDIO_TYPE_QUERY;
caps.ac_subtype = AUDIO_TYPE_QUERY; caps.ac_subtype = AUDIO_TYPE_QUERY;
if (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, (unsigned long) &caps) if (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS, (unsigned long) &caps)
== caps.ac_len) == caps.ac_len)
{ {
/* Test if this device supports the format we want */ /* Test if this device supports the format we want */
int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8); int ac_format = caps.ac_format[0] | (caps.ac_format[1] << 8);
if (((ac_format & format) != 0) && if (((ac_format & (1 << (format - 1))) != 0) &&
(caps.ac_controls[0] & AUDIO_TYPE_OUTPUT)) (caps.ac_controls[0] & AUDIO_TYPE_OUTPUT))
{ {
/* Yes, it supports this format. Use this device */ /* Do subformat detection */
closedir(dirp); if (subfmt != AUDIO_FMT_UNDEF)
return OK; {
/* Prepare to get sub-formats for this main format */
caps.ac_subtype = format;
caps.ac_format[0] = 0;
while (ioctl(pPlayer->devFd, AUDIOIOC_GETCAPS,
(unsigned long) &caps) == caps.ac_len)
{
/* Check the next set of 4 controls to find the subformat */
for (x = 0; x < sizeof(caps.ac_controls); x++)
{
if (caps.ac_controls[x] == subfmt)
{
/* Sub format supported! */
break;
}
else if (caps.ac_controls[x] == AUDIO_SUBFMT_END)
{
/* Sub format not supported */
supported = FALSE;
break;
}
}
/* If we reached the end of the subformat list, then
* break out of the loop.
*/
if (x != sizeof(caps.ac_controls))
{
break;
}
/* Increment ac_format[0] to get next set of subformats */
caps.ac_format[0]++;
}
}
/* Test if subformat needed and detected */
if (supported)
{
/* Yes, it supports this format. Use this device */
closedir(dirp);
return OK;
}
} }
} }
@ -257,6 +315,47 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
return -ENODEV; return -ENODEV;
} }
/****************************************************************************
* Name: nxplayer_getmidisubformat
*
* nxplayer_getmidisubformat() reads the MIDI header and determins the
* MIDI format of the file.
*
****************************************************************************/
#ifdef CONFIG_AUDIO_FORMAT_MIDI
int nxplayer_getmidisubformat(FAR FILE *fd)
{
char type[2];
int ret;
/* Seek to location 8 in the file (the format type) */
fseek(fd, 8, SEEK_SET);
fread(type, 1, 2, fd);
/* Set return value based on type */
switch (type[1])
{
case 0:
ret = AUDIO_SUBFMT_MIDI_0;
break;
case 1:
ret = AUDIO_SUBFMT_MIDI_1;
break;
case 2:
ret = AUDIO_SUBFMT_MIDI_2;
break;
}
fseek(fd, 0, SEEK_SET);
return ret;
}
#endif
/**************************************************************************** /****************************************************************************
* Name: nxplayer_fmtfromextension * Name: nxplayer_fmtfromextension
* *
@ -266,10 +365,12 @@ static int nxplayer_opendevice(FAR struct nxplayer_s *pPlayer, int format)
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NXPLAYER_FMT_FROM_EXT #ifdef CONFIG_NXPLAYER_FMT_FROM_EXT
static int nxplayer_fmtfromextension(char* pFilename) static inline int nxplayer_fmtfromextension(FAR struct nxplayer_s *pPlayer,
char* pFilename, int *subfmt)
{ {
const char *pExt; const char *pExt;
int x, c; uint8_t x;
uint8_t c;
/* Find the file extension, if any */ /* Find the file extension, if any */
@ -289,6 +390,14 @@ static int nxplayer_fmtfromextension(char* pFilename)
if (strcasecmp(pExt, g_known_ext[c].ext) == 0) if (strcasecmp(pExt, g_known_ext[c].ext) == 0)
{ {
/* Test if we have a sub-format detection routine */
if (subfmt && g_known_ext[c].getsubformat)
{
*subfmt = g_known_ext[c].getsubformat(pPlayer->fileFd);
}
/* Return the format for this extension */ /* Return the format for this extension */
return g_known_ext[c].format; return g_known_ext[c].format;
@ -1027,6 +1136,7 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer)
sem_post(&pPlayer->sem); /* Release the semaphore */ sem_post(&pPlayer->sem); /* Release the semaphore */
return OK; return OK;
} }
sem_post(&pPlayer->sem); sem_post(&pPlayer->sem);
/* Notify the playback thread that it needs to cancel the playback */ /* Notify the playback thread that it needs to cancel the playback */
@ -1067,9 +1177,10 @@ int nxplayer_stop(FAR struct nxplayer_s *pPlayer)
* *
****************************************************************************/ ****************************************************************************/
int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filefmt) int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filefmt,
int subfmt)
{ {
int ret; int ret, tmpsubfmt = AUDIO_FMT_UNDEF;
struct mq_attr attr; struct mq_attr attr;
struct sched_param sparam; struct sched_param sparam;
pthread_attr_t tattr; pthread_attr_t tattr;
@ -1106,7 +1217,9 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
/* File not found in the media dir. Do a search */ /* File not found in the media dir. Do a search */
if (nxplayer_mediasearch(pPlayer, pFilename, path, sizeof(path)) != OK) if (nxplayer_mediasearch(pPlayer, pFilename, path, sizeof(path)) != OK)
return -ENOENT; {
return -ENOENT;
}
#else #else
return -ENOENT; return -ENOENT;
#endif /* CONFIG_NXPLAYER_MEDIA_SEARCH */ #endif /* CONFIG_NXPLAYER_MEDIA_SEARCH */
@ -1121,14 +1234,14 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
#ifdef CONFIG_NXPLAYER_FMT_FROM_EXT #ifdef CONFIG_NXPLAYER_FMT_FROM_EXT
if (filefmt == AUDIO_FMT_UNDEF) if (filefmt == AUDIO_FMT_UNDEF)
filefmt = nxplayer_fmtfromextension(pFilename); filefmt = nxplayer_fmtfromextension(pPlayer, pFilename, &tmpsubfmt);
#endif #endif
/* If type not identified, then test for known header types */ /* If type not identified, then test for known header types */
#ifdef CONFIG_NXPLAYER_FMT_FROM_HEADER #ifdef CONFIG_NXPLAYER_FMT_FROM_HEADER
if (filefmt == AUDIO_FMT_UNDEF) if (filefmt == AUDIO_FMT_UNDEF)
filefmt = nxplayer_fmtfromheader(pPlayer); filefmt = nxplayer_fmtfromheader(pPlayer, &subfmt, &tmpsubfmt);
#endif #endif
/* Test if we determined the file format */ /* Test if we determined the file format */
@ -1141,9 +1254,16 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
goto err_out_nodev; goto err_out_nodev;
} }
/* Test if we have a sub format assignment from above */
if (subfmt == AUDIO_FMT_UNDEF)
{
subfmt = tmpsubfmt;
}
/* Try to open the device */ /* Try to open the device */
ret = nxplayer_opendevice(pPlayer, filefmt); ret = nxplayer_opendevice(pPlayer, filefmt, subfmt);
if (ret < 0) if (ret < 0)
{ {
/* Error opening the device */ /* Error opening the device */
@ -1224,12 +1344,14 @@ int nxplayer_playfile(FAR struct nxplayer_s *pPlayer, char* pFilename, int filef
err_out: err_out:
close(pPlayer->devFd); close(pPlayer->devFd);
pPlayer->devFd = -1; pPlayer->devFd = -1;
err_out_nodev: err_out_nodev:
if (pPlayer->fileFd != NULL) if (pPlayer->fileFd != NULL)
{ {
fclose(pPlayer->fileFd); fclose(pPlayer->fileFd);
pPlayer->fileFd = NULL; pPlayer->fileFd = NULL;
} }
return ret; return ret;
} }

View File

@ -187,7 +187,7 @@ static int nxplayer_cmd_play(FAR struct nxplayer_s *pPlayer, char* parg)
/* Try to play the file specified */ /* Try to play the file specified */
ret = nxplayer_playfile(pPlayer, parg, AUDIO_FMT_UNDEF); ret = nxplayer_playfile(pPlayer, parg, AUDIO_FMT_UNDEF, AUDIO_FMT_UNDEF);
/* Test if the device file exists */ /* Test if the device file exists */
@ -507,7 +507,11 @@ static int nxplayer_cmd_device(FAR struct nxplayer_s *pPlayer, char* parg)
static int nxplayer_cmd_quit(FAR struct nxplayer_s *pPlayer, char* parg) static int nxplayer_cmd_quit(FAR struct nxplayer_s *pPlayer, char* parg)
{ {
/* Nothing to do */ /* Stop the playback if any */
#ifndef CONFIG_AUDIO_EXCLUDE_STOP
nxplayer_stop(pPlayer);
#endif
return OK; return OK;
} }

View File

@ -5559,7 +5559,7 @@
are just hacked out and gutted versions of the corresponding are just hacked out and gutted versions of the corresponding
STM32 files (2013-9-13). 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 * nuttx/fs/romfs/fs_romfsutil.c: Back out part of a recent
ROMFS change (2013-9-14). ROMFS change (2013-9-14).
@ -5571,7 +5571,7 @@
* configs/ and a few Ethernet drivers: Add the prefix ETH0 * configs/ and a few Ethernet drivers: Add the prefix ETH0
to all PHY configuration selections. This will allow us to all PHY configuration selections. This will allow us
to support to Ethernet MAC drivers with two different 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 and drivers/net/Kconfig: Move PHY selections from
net/Kconfig to drivers/net/Kconfig where they belong. Add the previx net/Kconfig to drivers/net/Kconfig where they belong. Add the previx
ETH0_ to each PHY selection. And a new configuration 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 endpoint from 0xff (invalid) to 10. This is not a critical change
but will avoid a complaint from the Linux driver when it overrides but will avoid a complaint from the Linux driver when it overrides
the 0xff value (2013-9-22). 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). From Rashid Fatah (2013-9-23).
* arch/arm/src/sama5/sam_hsmci.c: TX DMA disabled. It is just not * 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). 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 next outgoing packet from the TX done interrupt handling. From
Max Holtzberg (2013-9-27) Max Holtzberg (2013-9-27)
* sched/os_start.c: Should not call group_setupidlefiles() if there * 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 * 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 * configs/compal_e86: Basic board support for the Motorola C139
(Compal E86) phone. From Craig Comstock (2013-9-27). (Compal E86) phone. From Craig Comstock (2013-9-27).
* configs/compal_e86: Converted to use the kconfig-frontends * configs/compal_e86: Converted to use the kconfig-frontends
@ -5686,14 +5686,14 @@
From Alan Carvalho de Assis. (2013-9-30). From Alan Carvalho de Assis. (2013-9-30).
* net/net_sendfile: The high performance sendfile logic is * net/net_sendfile: The high performance sendfile logic is
now functional. From Max Holtzberg (2013-9-30). 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). adapted to observed behavior (2013-9-30).
* include/nuttx/net/route.h and net/net_*route.c: Partial * include/nuttx/net/route.h and net/net_*route.c: Partial
implementation of a routing table. Not yet hooked into the implementation of a routing table. Not yet hooked into the
build system (2013-10-1) build system (2013-10-1)
* include/net/route.h: Defines the application interface to * include/net/route.h: Defines the application interface to
the routing table (2013-10-2). 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). 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: * include/net/route.h and libc/net/lib_addroute.c and delroute.c:
Add an application interface to manage the routing table Add an application interface to manage the routing table
@ -5724,7 +5724,7 @@
Max Holtzberg (2013-10-8). Max Holtzberg (2013-10-8).
* arch/arm/src/sama5/sam_lcd.c: LCDC driver is code complete and * arch/arm/src/sama5/sam_lcd.c: LCDC driver is code complete and
incorporated into the build system (but still untested (2013-10-8). 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). will be used for the SAMA5 LCD bring-up (2013-10-8).
* configs/arduino-due/Kconfig and include/board.h: Add configuration * configs/arduino-due/Kconfig and include/board.h: Add configuration
to select revision 3 of the Arduino Due which has some small 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/uip_udpconn.c, uip/uip_udpinput.c: Changed the meaning of the
uip_*input functions. They now return success when a packet is uip_*input functions. They now return success when a packet is
dropped; This is needed for the ENCX24J600 driver that must make 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). dropped packets. From Max Holtzberg (2013-10-11).
* drivers/net/encx24j600.c and Kconfig: ENCX24J600: Improved descriptor * drivers/net/encx24j600.c and Kconfig: ENCX24J600: Improved descriptor
handling, free packets on rx abort interrupt. From Max Holtzberg 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 * configs/sama5d3x-ek/nxwm/defconfig: Now uses scaled icons in the
the NxWM taskbar (2013-10-15). the NxWM taskbar (2013-10-15).
* configs/sama5d3x-ek/nxwm/defconfig: Use the 320x320 NuttX logo as * 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 * arch/arm/src/stm32/chip/stm32f103c_pinmap.h: Pinmapping corrections
from David Sidrane (2013-10-16). from David Sidrane (2013-10-16).
* configs/spark: The Spark device configuration is receiving some * configs/spark: The Spark device configuration is receiving some
@ -5826,7 +5826,7 @@
driver into the build system; Verify the correct operation of the driver into the build system; Verify the correct operation of the
SAMA5 RTC driver (2013-10-19). SAMA5 RTC driver (2013-10-19).
* arch/arm/src/sama5/sam_wdt.c and .h: Add a SAMA5 watchdog timer * 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 * 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). 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 * 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 * drivers/audio/ and include/nuttx/audio/vs1053.h: Updated
VS1053 driver from ken Pettit (2013-10-27). VS1053 driver from ken Pettit (2013-10-27).
* configs/mikroe-stm32f4/: Updated configuration for the * configs/mikroe-stm32f4/: Updated configuration for the
Mikrow STM32F4 board from Ken Pettit (2013-10-27). Mikroe STM32F4 board from Ken Pettit (2013-10-27).
* arch/arm/src/stm32/stm32_spi.c: DMA-related fixe from Ken * arch/arm/src/stm32/stm32_spi.c: DMA-related fixes from Ken
Pettit (2013-10-27). Pettit (2013-10-27).
* sched/sched_releasetcb.c: Fix a cornercase: If sched_releasetcb() * sched/sched_releasetcb.c: Fix a cornercase: If sched_releasetcb()
is called as part of a failed pthread startup before the flags 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. modes: single channel or multiple channel with sequencer support.
software trigger or timer trigger; ADC channel interrupts or software trigger or timer trigger; ADC channel interrupts or
DMA (2013-10-28). 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 */ 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 #ifdef CONFIG_AUDIO_FORMAT_AC3
| AUDIO_FMT_AC3 | (1 << (AUDIO_FMT_AC3 - 1))
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_MP3 #ifdef CONFIG_AUDIO_FORMAT_MP3
| AUDIO_FMT_MP3 | (1 << (AUDIO_FMT_MP3 - 1))
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_WMA #ifdef CONFIG_AUDIO_FORMAT_WMA
| AUDIO_FMT_WMA | (1 << (AUDIO_FMT_WMA - 1))
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_MIDI #ifdef CONFIG_AUDIO_FORMAT_MIDI
| AUDIO_FMT_MIDI | (1 << (AUDIO_FMT_MIDI - 1))
#endif #endif
#ifdef CONFIG_AUDIO_FORMAT_PCM #ifdef CONFIG_AUDIO_FORMAT_PCM
| AUDIO_FMT_PCM | (1 << (AUDIO_FMT_PCM - 1))
#endif #endif
;
#ifdef CONFIG_AUDIO_FORMAT_OGG_VORBIS #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 #endif
/* The types of audio units we implement */ default:
pCaps->ac_controls[0] = AUDIO_SUBFMT_END;
pCaps->ac_controls[0] = AUDIO_TYPE_OUTPUT | AUDIO_TYPE_FEATURE | break;
AUDIO_TYPE_PROCESSING; }
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 */ /* 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[0] = AUDIO_FU_VOLUME | AUDIO_FU_BASS | AUDIO_FU_TREBLE;
pCaps->ac_controls[1] = AUDIO_FU_BALANCE >> 8;
} }
else else
{ {

View File

@ -129,33 +129,40 @@
* is a list of bit-field definitons for defining the device type. * is a list of bit-field definitons for defining the device type.
*/ */
#define AUDIO_TYPE_QUERY 0x0000 #define AUDIO_TYPE_QUERY 0x00
#define AUDIO_TYPE_INPUT 0x0002 #define AUDIO_TYPE_INPUT 0x02
#define AUDIO_TYPE_OUTPUT 0x0004 #define AUDIO_TYPE_OUTPUT 0x02
#define AUDIO_TYPE_MIXER 0x0008 #define AUDIO_TYPE_MIXER 0x04
#define AUDIO_TYPE_SELECTOR 0x0010 #define AUDIO_TYPE_SELECTOR 0x08
#define AUDIO_TYPE_FEATURE 0x0020 #define AUDIO_TYPE_FEATURE 0x10
#define AUDIO_TYPE_EFFECT 0x0040 #define AUDIO_TYPE_EFFECT 0x20
#define AUDIO_TYPE_PROCESSING 0x0080 #define AUDIO_TYPE_PROCESSING 0x40
#define AUDIO_TYPE_EXTENSION 0x0100 #define AUDIO_TYPE_EXTENSION 0x80
/* Audio Format Types *******************************************************/ /* 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_UNDEF 0x00
#define AUDIO_FMT_OTHER 0x001 #define AUDIO_FMT_OTHER 0x01
#define AUDIO_FMT_MPEG 0x002 #define AUDIO_FMT_MPEG 0x02
#define AUDIO_FMT_AC3 0x004 #define AUDIO_FMT_AC3 0x03
#define AUDIO_FMT_WMA 0x008 #define AUDIO_FMT_WMA 0x04
#define AUDIO_FMT_DTS 0x010 #define AUDIO_FMT_DTS 0x05
#define AUDIO_FMT_PCM 0x020 #define AUDIO_FMT_PCM 0x06
#define AUDIO_FMT_WAV 0x020 #define AUDIO_FMT_WAV 0x07
#define AUDIO_FMT_MP3 0x040 #define AUDIO_FMT_MP3 0x08
#define AUDIO_FMT_MIDI 0x080 #define AUDIO_FMT_MIDI 0x09
#define AUDIO_FMT_OGG_VORBIS 0x100 #define AUDIO_FMT_OGG_VORBIS 0x0A
#define AUDIO_FMT_FLAC 0x0B
/* Audio Sub-Format Types ***************************************************/ /* Audio Sub-Format Types ***************************************************/
#define AUDIO_SUBFMT_END 0x00
#define AUDIO_SUBFMT_PCM_MP1 0x01 #define AUDIO_SUBFMT_PCM_MP1 0x01
#define AUDIO_SUBFMT_PCM_MP2 0x02 #define AUDIO_SUBFMT_PCM_MP2 0x02
#define AUDIO_SUBFMT_PCM_MP3 0x03 #define AUDIO_SUBFMT_PCM_MP3 0x03
@ -167,6 +174,9 @@
#define AUDIO_SUBFMT_PCM_S16_BE 0x09 #define AUDIO_SUBFMT_PCM_S16_BE 0x09
#define AUDIO_SUBFMT_PCM_S16_LE 0x0A #define AUDIO_SUBFMT_PCM_S16_LE 0x0A
#define AUDIO_SUBFMT_PCM_U16_BE 0x0B #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 *************************************************/ /* Supported Sampling Rates *************************************************/