mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
SAMA5D3X-EK: Add support for the WM8904 audio CODEC
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* arch/arm/src/sama5/sam_pio.c
|
* arch/arm/src/sama5/sam_pio.c
|
||||||
* General Purpose Input/Output (PIO) logic for the SAMA5
|
* General Purpose Input/Output (PIO) logic for the SAMA5
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/sama5/sam_pioirq.c
|
* arch/arm/src/sama5/sam_pioirq.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -247,4 +247,18 @@ config SAMA5D3xEK_OV2640_DEMO
|
|||||||
Enable the SAMA5 OV2640 camera demo
|
Enable the SAMA5 OV2640 camera demo
|
||||||
|
|
||||||
endif # VIDEO_OV2640
|
endif # VIDEO_OV2640
|
||||||
|
|
||||||
|
if AUDIO_WM8904
|
||||||
|
|
||||||
|
config SAMA5D3xEK_WM8904_I2CFREQUENCY
|
||||||
|
int "WM8904 I2C Frequency"
|
||||||
|
default 400000
|
||||||
|
range 1 400000
|
||||||
|
---help---
|
||||||
|
This option selects the I2C frequency to use when communicating with
|
||||||
|
the WM8904 device. The default, 400KHz, is the maximum supported by
|
||||||
|
the WM8904. If you have problems communicating with the WM8904,
|
||||||
|
then you might want to try lowering this rate.
|
||||||
|
|
||||||
|
endif # AUDIO_WM8904
|
||||||
endif # ARCH_BOARD_SAMA5D3X_EK
|
endif # ARCH_BOARD_SAMA5D3X_EK
|
||||||
|
|||||||
@@ -1649,6 +1649,8 @@ SDRAM Support
|
|||||||
CONFIG_SAMA5_DDRCS=y : Tell the system that DRAM is at the DDR CS
|
CONFIG_SAMA5_DDRCS=y : Tell the system that DRAM is at the DDR CS
|
||||||
CONFIG_SAMA5_DDRCS_SIZE=268435456 : 2Gb DRAM -> 256MB
|
CONFIG_SAMA5_DDRCS_SIZE=268435456 : 2Gb DRAM -> 256MB
|
||||||
CONFIG_SAMA5_DDRCS_LPDDR2=y : Its DDR2
|
CONFIG_SAMA5_DDRCS_LPDDR2=y : Its DDR2
|
||||||
|
|
||||||
|
Board Selection
|
||||||
CONFIG_SAMA5D3xEK_MT47H128M16RT=y : This is the type of DDR2
|
CONFIG_SAMA5D3xEK_MT47H128M16RT=y : This is the type of DDR2
|
||||||
|
|
||||||
System Type->Heap Configuration
|
System Type->Heap Configuration
|
||||||
@@ -1717,6 +1719,8 @@ SDRAM Support
|
|||||||
CONFIG_SAMA5_DDRCS=y : Tell the system that DRAM is at the DDR CS
|
CONFIG_SAMA5_DDRCS=y : Tell the system that DRAM is at the DDR CS
|
||||||
CONFIG_SAMA5_DDRCS_SIZE=268435456 : 2Gb DRAM -> 256GB
|
CONFIG_SAMA5_DDRCS_SIZE=268435456 : 2Gb DRAM -> 256GB
|
||||||
CONFIG_SAMA5_DDRCS_LPDDR2=y : Its DDR2
|
CONFIG_SAMA5_DDRCS_LPDDR2=y : Its DDR2
|
||||||
|
|
||||||
|
Board Selection
|
||||||
CONFIG_SAMA5D3xEK_MT47H128M16RT=y : This is the type of DDR2
|
CONFIG_SAMA5D3xEK_MT47H128M16RT=y : This is the type of DDR2
|
||||||
|
|
||||||
System Type->Heap Configuration
|
System Type->Heap Configuration
|
||||||
@@ -2699,6 +2703,81 @@ I2S Audio Support
|
|||||||
1 IRQ/GPIO1 PD16 INT_AUDIO N/A
|
1 IRQ/GPIO1 PD16 INT_AUDIO N/A
|
||||||
------------- ---------------- -----------------
|
------------- ---------------- -----------------
|
||||||
|
|
||||||
|
WM8904 Configuration
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
System Type -> SAMA5 Peripheral Support
|
||||||
|
CONFIG_SAMA5_DMAC0=y : DMAC0 required by SSC0
|
||||||
|
CONFIG_SAMA5_TWI0=y : Enable TWI0 driver support
|
||||||
|
CONFIG_SAMA5_SSCO=y : Enable SSC0 driver support
|
||||||
|
|
||||||
|
System Type -> SSC0 Configuration
|
||||||
|
CONFIG_SAMA5_SSC_MAXINFLIGHT=16
|
||||||
|
CONFIG_SAMA5_SSC0_DATALEN=16
|
||||||
|
|
||||||
|
Device Drivers -> I2C Driver Support
|
||||||
|
CONFIG_I2C=y : Enable I2C support
|
||||||
|
CONFIG_I2C_EXCHANGE=y : Support the exchange method
|
||||||
|
CONFIG_I2C_RESET=n : (Maybe y, if you have bus problems)
|
||||||
|
|
||||||
|
System Type -> SSC Configuration
|
||||||
|
CONFIG_SAMA5_SSC_MAXINFLIGHT=16 : Up to 16 pending DMA transfers
|
||||||
|
CONFIG_SAMA5_SSC0_DATALEN=16 : 16-bit data
|
||||||
|
CONFIG_SAMA5_SSC0_RX=y : Support a receiver (although it is not used!)
|
||||||
|
CONFIG_SAMA5_SSC0_TX_TKINPUT=y : Receiver gets clock the RK0 input
|
||||||
|
CONFIG_SAMA5_SSC0_TX=y : Support a transmitter
|
||||||
|
CONFIG_SAMA5_SSC0_TX_TKINPUT=y : Transmitter gets clock the TK0 input
|
||||||
|
|
||||||
|
Audio
|
||||||
|
CONFIG_AUDIO=y : Audio support needed
|
||||||
|
CONFIG_AUDIO_FORMAT_PCM=y : Only PCM files are supported
|
||||||
|
CONFIG_AUDIO_NUM_BUFFERS=8 : Number of audio buffers
|
||||||
|
CONFIG_AUDIO_BUFFER_NUMBYTES=8192 : Audio buffer size
|
||||||
|
|
||||||
|
Drivers -> Audio
|
||||||
|
CONFIG_I2S=y : General I2S support
|
||||||
|
CONFIG_AUDIO_DEVICES=y : Audio device support
|
||||||
|
CONFIG_AUDIO_WM8904=y : Build WM8904 driver character driver
|
||||||
|
|
||||||
|
Board Selection
|
||||||
|
CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY=400000
|
||||||
|
|
||||||
|
Library Routines
|
||||||
|
CONFIG_SCHED_WORKQUEUE=y : MW8904 driver needs work queue support
|
||||||
|
|
||||||
|
The NxPlayer
|
||||||
|
------------
|
||||||
|
|
||||||
|
The NxPlayer is a audio library and command line application for playing
|
||||||
|
audio file. The NxPlayer can be found at apps/system/nxplayer. If you
|
||||||
|
would like to add the NxPlayer, here are some recommended configuration
|
||||||
|
settings.
|
||||||
|
|
||||||
|
First of all, the NxPlayer depends on the NuttX audio subsystem. See the
|
||||||
|
"WM8904 Configuration" above for an example of how the audio subsystem is
|
||||||
|
configured to use the WM8904 CODED with PCM decoding.
|
||||||
|
|
||||||
|
Then the NxPlayer can be enabled as follows:
|
||||||
|
|
||||||
|
System Libraries and NSH Add-Ons -> NxPlayer media player / command line ->
|
||||||
|
CONFIG_SYSTEM_NXPLAYER=y : Build the NxPlayer library
|
||||||
|
CONFIG_NXPLAYER_PLAYTHREAD_STACKSIZE=1500 : Size of the audio player stack
|
||||||
|
CONFIG_NXPLAYER_COMMAND_LINE=y : Build command line application
|
||||||
|
CONFIG_NXPLAYER_INCLUDE_HELP=y : Includes a help command
|
||||||
|
CONFIG_NXPLAYER_INCLUDE_DEVICE_SEARCH=n : (Since there is only one audio device)
|
||||||
|
CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE=y : Only one audio device is supported
|
||||||
|
CONFIG_NXPLAYER_FMT_FROM_EXT=y : (Since only PCM is supported)
|
||||||
|
CONFIG_NXPLAYER_FMT_FROM_HEADER=n : (Since only PCM is supported)
|
||||||
|
CONFIG_NXPLAYER_INCLUDE_MEDIADIR=y : Specify a media directory
|
||||||
|
CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sdcard" : See below
|
||||||
|
CONFIG_NXPLAYER_RECURSIVE_MEDIA_SEARCH=y : Search all sub-directories
|
||||||
|
CONFIG_NXPLAYER_INCLUDE_SYSTEM_RESET=y : Add support for reset command
|
||||||
|
|
||||||
|
You must include the full path to the location where NxPlayer can find the
|
||||||
|
media files. That path is given by CONFIG_NXPLAYER_DEFAULT_MEDIADIR.
|
||||||
|
Here I use the example "/mnt/scard". That is a location where you could,
|
||||||
|
for example, mount an MMC/SD card driver.
|
||||||
|
|
||||||
I2S Loopback Test
|
I2S Loopback Test
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
@@ -2706,9 +2785,6 @@ I2S Audio Support
|
|||||||
nuttx/drivers/audio/i2schar.c) and a test driver at apps/examples/i2schar.
|
nuttx/drivers/audio/i2schar.c) and a test driver at apps/examples/i2schar.
|
||||||
The I2S driver was verified in loopback mode with no audio device.
|
The I2S driver was verified in loopback mode with no audio device.
|
||||||
|
|
||||||
[NOTE: The above statement is anticipatory: As of this writing I2S driver
|
|
||||||
verification is underway and still not complete].
|
|
||||||
|
|
||||||
This section describes the modifications to the NSH configuration that were
|
This section describes the modifications to the NSH configuration that were
|
||||||
used to perform the I2S testing:
|
used to perform the I2S testing:
|
||||||
|
|
||||||
@@ -2720,7 +2796,7 @@ I2S Audio Support
|
|||||||
|
|
||||||
System Type -> SAMA5 Peripheral Support
|
System Type -> SAMA5 Peripheral Support
|
||||||
CONFIG_SAMA5_SSC1=y : Enable SSC0 driver support
|
CONFIG_SAMA5_SSC1=y : Enable SSC0 driver support
|
||||||
CONFIG_SAMA5_DMAC1=y : DMAC0 required by SSC0
|
CONFIG_SAMA5_DMAC0=y : DMAC0 required by SSC0
|
||||||
|
|
||||||
System Type -> SSC Configuration
|
System Type -> SSC Configuration
|
||||||
CONFIG_SAMA5_SSC_MAXINFLIGHT=16 : Up to 16 pending DMA transfers
|
CONFIG_SAMA5_SSC_MAXINFLIGHT=16 : Up to 16 pending DMA transfers
|
||||||
@@ -3079,6 +3155,8 @@ Configurations
|
|||||||
used to verify the SAMA5D3x-EK TFT LCD. This test case focuses on
|
used to verify the SAMA5D3x-EK TFT LCD. This test case focuses on
|
||||||
general window controls, movement, mouse and keyboard input. It
|
general window controls, movement, mouse and keyboard input. It
|
||||||
requires no user interaction.
|
requires no user interaction.
|
||||||
|
nxplayer: A command line media player using the on-board WM8904 audio
|
||||||
|
CODEC.
|
||||||
nxwm: This is a special configuration setup for the NxWM window manager
|
nxwm: This is a special configuration setup for the NxWM window manager
|
||||||
UnitTest. It integrates support for both the SAMA5 LCDC and the
|
UnitTest. It integrates support for both the SAMA5 LCDC and the
|
||||||
SAMA5 ADC touchscreen controller and provides a more advance
|
SAMA5 ADC touchscreen controller and provides a more advance
|
||||||
@@ -3366,6 +3444,56 @@ Configurations
|
|||||||
window controls, movement, mouse and keyboard input. It requires no
|
window controls, movement, mouse and keyboard input. It requires no
|
||||||
user interaction.
|
user interaction.
|
||||||
|
|
||||||
|
nxplayer
|
||||||
|
|
||||||
|
A command line media player using the on-board WM8904 audio CODEC.
|
||||||
|
This configuration is based on the nsh configuration above with the
|
||||||
|
following extensions:
|
||||||
|
|
||||||
|
a. It runs at 528MHz
|
||||||
|
b. It includes SDRAM support
|
||||||
|
c. Support for the WM8904 audio CODEC is enabled along with
|
||||||
|
support for TWI0, SSC0, and DMAC0 needed by the SM8904.
|
||||||
|
d. Support for the full size SD card slot (HSMCI0) is enable
|
||||||
|
e. The NxPlayer command line media player is built in.
|
||||||
|
|
||||||
|
NOTES:
|
||||||
|
|
||||||
|
1. See the NOTEs for the nsh configuration. Since this configuration
|
||||||
|
derives from that configuration, all notes apply.
|
||||||
|
|
||||||
|
2. Using NxPlayer
|
||||||
|
|
||||||
|
This configuration depends on media files in the default mountpoint
|
||||||
|
at /mnt/sdard. You will need to mount the media before running
|
||||||
|
NxPlayer, Here are the general steps to play a file:
|
||||||
|
|
||||||
|
a. You will need an (full size) SD card containing the .WAV files
|
||||||
|
that you want to play (.WAV is only format supported as of this
|
||||||
|
writing). That SD card should be inserted in the HSMCI0 media
|
||||||
|
slot A (best done before powering up).
|
||||||
|
|
||||||
|
b. If the NuttX auto-mounter is enabled and properly configured,
|
||||||
|
then the FAT file system appear at /mnt/sdcard. If the auto-
|
||||||
|
mounter is not enabled, then here are the steps to manually
|
||||||
|
mount the FAT file system:
|
||||||
|
|
||||||
|
Then from NSH prompt, you need to mount the media volume like:
|
||||||
|
|
||||||
|
nsh> mount -t vfat /dev/mmcsd0 /mnt/sdcard
|
||||||
|
|
||||||
|
NOTE: There is an auto-mounter that could be used to eliminate
|
||||||
|
this step. The automounter is not enabled or integrated into
|
||||||
|
in this configuration, however. See the sectino entitle
|
||||||
|
"Auto-Mounter " above
|
||||||
|
|
||||||
|
c. Then you can run the media player like:
|
||||||
|
|
||||||
|
nsh> nxplayer
|
||||||
|
nxplayer> device pcm0
|
||||||
|
nxplayer> play <filename>
|
||||||
|
|
||||||
|
|
||||||
nxwm:
|
nxwm:
|
||||||
|
|
||||||
This is a special configuration setup for the NxWM window manager
|
This is a special configuration setup for the NxWM window manager
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
############################################################################
|
############################################################################
|
||||||
# configs/sama5d3x-ek/src/Makefile
|
# configs/sama5d3x-ek/src/Makefile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
# Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@@ -106,6 +106,14 @@ CSRCS += sam_ethernet.c
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_AUDIO_WM8904),y)
|
||||||
|
ifeq ($(CONFIG_SAMA5_TWI0),y)
|
||||||
|
ifeq ($(CONFIG_SAMA5_SSC0),y)
|
||||||
|
CSRCS += sam_wm8904.c
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||||
CSRCS += sam_nsh.c
|
CSRCS += sam_nsh.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* config/sama5d3x-ek/src/sam_nsh.c
|
* config/sama5d3x-ek/src/sam_nsh.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -86,8 +86,9 @@
|
|||||||
|
|
||||||
int nsh_archinitialize(void)
|
int nsh_archinitialize(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_AT24) || \
|
#if defined(HAVE_NAND) || defined(HAVE_AT25) || defined(HAVE_AT24) || \
|
||||||
defined(HAVE_HSMCI) || defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR)
|
defined(HAVE_HSMCI) || defined(HAVE_USBHOST) || defined(HAVE_USBMONITOR) ||\
|
||||||
|
defined(HAVE_WM8904)
|
||||||
int ret;
|
int ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -173,5 +174,15 @@ int nsh_archinitialize(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WM8904
|
||||||
|
/* Configure WM8904 audio */
|
||||||
|
|
||||||
|
ret = sam_wm8904_initialize(0);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
message("ERROR: Failed to initialize WM8904 audio: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
#define HAVE_USBMONITOR 1
|
#define HAVE_USBMONITOR 1
|
||||||
#define HAVE_NETWORK 1
|
#define HAVE_NETWORK 1
|
||||||
#define HAVE_CAMERA 1
|
#define HAVE_CAMERA 1
|
||||||
|
#define HAVE_WM8904 1
|
||||||
|
|
||||||
/* HSMCI */
|
/* HSMCI */
|
||||||
/* Can't support MMC/SD if the card interface(s) are not enable */
|
/* Can't support MMC/SD if the card interface(s) are not enable */
|
||||||
@@ -318,6 +319,41 @@
|
|||||||
# undef HAVE_NETWORK
|
# undef HAVE_NETWORK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Audio */
|
||||||
|
/* PCM/WM8904 driver */
|
||||||
|
|
||||||
|
#ifndef CONFIG_AUDIO_WM8904
|
||||||
|
# undef HAVE_WM8904
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_WM8904
|
||||||
|
# ifndef CONFIG_SAMA5_TWI0
|
||||||
|
# warning CONFIG_SAMA5_TWI0 is required for audio support
|
||||||
|
# undef HAVE_WM8904
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CONFIG_SAMA5_SSC0
|
||||||
|
# warning CONFIG_SAMA5_SSC0 is required for audio support
|
||||||
|
# undef HAVE_WM8904
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CONFIG_AUDIO_FORMAT_PCM
|
||||||
|
# warning CONFIG_AUDIO_FORMAT_PCM is required for audio support
|
||||||
|
# undef HAVE_WM8904
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifndef CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY
|
||||||
|
# warning Defaulting to maximum WM8904 I2C frequency
|
||||||
|
# define CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY 400000
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY > 400000
|
||||||
|
# warning WM8904 I2C frequency cannot exceed 400KHz
|
||||||
|
# undef CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY
|
||||||
|
# define CONFIG_SAMA5D3xEK_WM8904_I2CFREQUENCY 400000
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Camera */
|
/* Camera */
|
||||||
|
|
||||||
#define OV2640_BUS 1
|
#define OV2640_BUS 1
|
||||||
@@ -549,6 +585,39 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* WM8904 Audio Codec ***************************************************************/
|
||||||
|
/* SAMA5D3-EK Interface
|
||||||
|
* ------------- ---------------- -----------------
|
||||||
|
* WM8904 SAMA5D3 NuttX Pin Name
|
||||||
|
* ------------- ---------------- -----------------
|
||||||
|
* 3 SDA PA30 TWD0 PIO_TWI0_D
|
||||||
|
* 2 SCLK PA31 TWCK0 PIO_TWI0_CK
|
||||||
|
* 28 MCLK PD30 PCK0 PIO_PMC_PCK0
|
||||||
|
* 29 BCLK/GPIO4 PC16 TK PIO_SSC0_TK
|
||||||
|
* "" " " PC19 RK PIO_SSC0_RK
|
||||||
|
* 30 LRCLK PC17 TF PIO_SSC0_TF
|
||||||
|
* "" " " PC20 RF PIO_SSC0_RF
|
||||||
|
* 31 ADCDAT PC21 RD PIO_SSC0_RD
|
||||||
|
* 32 DACDAT PC18 TD PIO_SSC0_TD
|
||||||
|
* 1 IRQ/GPIO1 PD16 INT_AUDIO N/A
|
||||||
|
* ------------- ---------------- -----------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Audio Interrupt */
|
||||||
|
|
||||||
|
#define PIO_INT_WM8904 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \
|
||||||
|
PIO_INT_BOTHEDGES | PIO_PORT_PIOD | PIO_PIN16)
|
||||||
|
#define IRQ_INT_WM8904 SAM_IRQ_PD16
|
||||||
|
|
||||||
|
/* The MW8904 communicates on TWI0, I2C address 0x1a for control operations */
|
||||||
|
|
||||||
|
#define WM8904_TWI_BUS 0
|
||||||
|
#define WM8904_I2C_ADDRESS 0x1a
|
||||||
|
|
||||||
|
/* The MW8904 transfers data on SSC0 */
|
||||||
|
|
||||||
|
#define WM8904_SSC_BUS 0
|
||||||
|
|
||||||
/* SPI Chip Selects *****************************************************************/
|
/* SPI Chip Selects *****************************************************************/
|
||||||
/* Both the Ronetix and Embest versions of the SAMAD3x CPU modules include an
|
/* Both the Ronetix and Embest versions of the SAMAD3x CPU modules include an
|
||||||
* Atmel AT25DF321A, 32-megabit, 2.7-volt SPI serial flash. The SPI
|
* Atmel AT25DF321A, 32-megabit, 2.7-volt SPI serial flash. The SPI
|
||||||
@@ -743,6 +812,27 @@ int sam_usbhost_initialize(void);
|
|||||||
void weak_function sam_netinitialize(void);
|
void weak_function sam_netinitialize(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sam_wm8904_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function is called by platform-specific, setup logic to configure
|
||||||
|
* and register the WM8904 device. This function will register the driver
|
||||||
|
* as /dev/wm8904[x] where x is determined by the minor device number.
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* minor - The input device minor number
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero is returned on success. Otherwise, a negated errno value is
|
||||||
|
* returned to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef HAVE_WM8904
|
||||||
|
int sam_wm8904_initialize(int minor);
|
||||||
|
#endif /* HAVE_WM8904 */
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: board_led_initialize
|
* Name: board_led_initialize
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|||||||
@@ -2427,19 +2427,19 @@ I2C Tool
|
|||||||
responding on TWI0 (the default) like this:
|
responding on TWI0 (the default) like this:
|
||||||
|
|
||||||
nsh> i2c dev 0x03 0x77
|
nsh> i2c dev 0x03 0x77
|
||||||
0 1 2 3 4 5 6 7 8 9 a b c d e f
|
0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||||
00: -- -- -- -- -- -- -- -- -- -- -- -- --
|
00: -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
10: -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- --
|
10: -- -- -- -- -- -- -- -- -- -- -- 1b -- -- -- --
|
||||||
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- 3d -- --
|
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
40: -- -- -- -- -- -- -- -- -- -- -- -- 4c -- -- --
|
||||||
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
50: 50 -- -- -- -- -- -- -- -- -- -- 5b -- -- -- --
|
||||||
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
70: -- -- -- -- -- -- -- --
|
70: -- -- -- -- -- -- -- --
|
||||||
nsh>
|
nsh>
|
||||||
|
|
||||||
Address 0x1a is the WM8904. Address 0x39 is the SIL9022A. I am not sure
|
Addresses 0x1b, 0x4c, and 0x50 are devices on the TM7000 module.
|
||||||
what is at address 0x3d and 0x60
|
0x5b is the address of the on-board PMIC chip.
|
||||||
|
|
||||||
SAMA5 ADC Support
|
SAMA5 ADC Support
|
||||||
=================
|
=================
|
||||||
@@ -2771,17 +2771,18 @@ Audio Support
|
|||||||
WM8904 Configuration
|
WM8904 Configuration
|
||||||
--------------------
|
--------------------
|
||||||
System Type -> SAMA5 Peripheral Support
|
System Type -> SAMA5 Peripheral Support
|
||||||
|
CONFIG_SAMA5_XDMAC0=y : XDMAC0 required by SSC0
|
||||||
CONFIG_SAMA5_TWI0=y : Enable TWI0 driver support
|
CONFIG_SAMA5_TWI0=y : Enable TWI0 driver support
|
||||||
CONFIG_SAMA5_SSCO=y : Enable SSC0 driver support
|
CONFIG_SAMA5_SSCO=y : Enable SSC0 driver support
|
||||||
CONFIG_SAMA5_XDMAC0=y : XDMAC0 required by SSC0
|
|
||||||
|
|
||||||
System Type -> SSC0 Configuration
|
System Type -> SSC0 Configuration
|
||||||
CONFIG_SAMA5_SSC_MAXINFLIGHT=16
|
CONFIG_SAMA5_SSC_MAXINFLIGHT=16
|
||||||
CONFIG_SAMA5_SSC0_DATALEN=16
|
CONFIG_SAMA5_SSC0_DATALEN=16
|
||||||
|
|
||||||
Device Drivers -> SPI Driver Support
|
Device Drivers -> I2C Driver Support
|
||||||
CONFIG_SPI=y : Enable SPI support
|
CONFIG_I2C=y : Enable I2C support
|
||||||
CONFIG_SPI_EXCHANGE=y : Support the exchange method
|
CONFIG_I2C_EXCHANGE=y : Support the exchange method
|
||||||
|
CONFIG_I2C_RESET=n : (Maybe y, if you have bus problems)
|
||||||
|
|
||||||
System Type -> SSC Configuration
|
System Type -> SSC Configuration
|
||||||
CONFIG_SAMA5_SSC_MAXINFLIGHT=16 : Up to 16 pending DMA transfers
|
CONFIG_SAMA5_SSC_MAXINFLIGHT=16 : Up to 16 pending DMA transfers
|
||||||
@@ -2826,7 +2827,11 @@ Audio Support
|
|||||||
would like to add the NxPlayer, here are some recommended configuration
|
would like to add the NxPlayer, here are some recommended configuration
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
First of all, the NxPlayer depends on the NuttX audio subsystem. Here are some recommended settings for the audio subsystem:
|
First of all, the NxPlayer depends on the NuttX audio subsystem. See the
|
||||||
|
"WM8904 Configuration" above for an example of how the audio subsystem is
|
||||||
|
configured to use the WM8904 CODED with PCM decoding. Or, for testing
|
||||||
|
purposes, here is how might want to configure NULL, do-nothing audio
|
||||||
|
device:
|
||||||
|
|
||||||
Audio Support ->
|
Audio Support ->
|
||||||
CONFIG_AUDIO=y
|
CONFIG_AUDIO=y
|
||||||
@@ -2842,14 +2847,14 @@ Audio Support
|
|||||||
Then the NxPlayer can be enabled as follows:
|
Then the NxPlayer can be enabled as follows:
|
||||||
|
|
||||||
System Libraries and NSH Add-Ons -> NxPlayer media player / command line ->
|
System Libraries and NSH Add-Ons -> NxPlayer media player / command line ->
|
||||||
CONFIG_NXPLAYER_PLAYTHREAD_STACKSIZE=1500 : Size of the audio player stack
|
|
||||||
CONFIG_SYSTEM_NXPLAYER=y : Build the NxPlayer library
|
CONFIG_SYSTEM_NXPLAYER=y : Build the NxPlayer library
|
||||||
|
CONFIG_NXPLAYER_PLAYTHREAD_STACKSIZE=1500 : Size of the audio player stack
|
||||||
CONFIG_NXPLAYER_COMMAND_LINE=y : Build command line application
|
CONFIG_NXPLAYER_COMMAND_LINE=y : Build command line application
|
||||||
CONFIG_NXPLAYER_INCLUDE_HELP=y : Includes a help command
|
CONFIG_NXPLAYER_INCLUDE_HELP=y : Includes a help command
|
||||||
CONFIG_NXPLAYER_INCLUDE_DEVICE_SEARCH=n : (Since there is only one audio device)
|
CONFIG_NXPLAYER_INCLUDE_DEVICE_SEARCH=n : (Since there is only one audio device)
|
||||||
CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE=y : Only one audio device is supported
|
CONFIG_NXPLAYER_INCLUDE_PREFERRED_DEVICE=y : Only one audio device is supported
|
||||||
CONFIG_NXPLAYER_FMT_FROM_EXT=y : (Since only PCM is supported)
|
CONFIG_NXPLAYER_FMT_FROM_EXT=y : (Since only PCM is supported)
|
||||||
NXPLAYER_FMT_FROM_HEADER=n : (Since only PCM is supported)
|
CONFIG_NXPLAYER_FMT_FROM_HEADER=n : (Since only PCM is supported)
|
||||||
CONFIG_NXPLAYER_INCLUDE_MEDIADIR=y : Specify a media directory
|
CONFIG_NXPLAYER_INCLUDE_MEDIADIR=y : Specify a media directory
|
||||||
CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sdcard" : See below
|
CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sdcard" : See below
|
||||||
CONFIG_NXPLAYER_RECURSIVE_MEDIA_SEARCH=y : Search all sub-directories
|
CONFIG_NXPLAYER_RECURSIVE_MEDIA_SEARCH=y : Search all sub-directories
|
||||||
@@ -4268,4 +4273,5 @@ To-Do List
|
|||||||
minor redesign and re-testing before they can be available.
|
minor redesign and re-testing before they can be available.
|
||||||
|
|
||||||
5) Board-related I2C issues have prevented integration of the WM8904 audio
|
5) Board-related I2C issues have prevented integration of the WM8904 audio
|
||||||
decoder. So the NxWM Media Player demo cannot produce sounds.
|
decoder. So the NxPlayer and NxWM Media Player demo cannot produce
|
||||||
|
sounds.
|
||||||
|
|||||||
Reference in New Issue
Block a user