diff --git a/Kconfig b/Kconfig index bc5d1f3df2..7a5f41cba1 100644 --- a/Kconfig +++ b/Kconfig @@ -379,31 +379,19 @@ config DEBUG_VERBOSE comment "Subsystem Debug Options" -config DEBUG_MM - bool "Memory Manager Debug Output" +config DEBUG_AUDIO + bool "Audio Device Debug Output" default n ---help--- - Enable memory management debug SYSLOG output (disabled by default) + Enable low level debug SYSLOG output from the audio subsystem and + device drivers. (disabled by default). Support for this debug option + is architecture-specific and may not be available for some MCUs. -config DEBUG_SCHED - bool "Scheduler Debug Output" +config DEBUG_BINFMT + bool "Binary Loader Debug Output" default n ---help--- - Enable OS debug SYSLOG output (disabled by default) - -config DEBUG_PAGING - bool "Demand Paging Debug Output" - default n - depends on PAGING - ---help--- - Enable demand paging debug SYSLOG output (disabled by default) - -config DEBUG_NET - bool "Network Debug Output" - default n - depends on ARCH_HAVE_NET - ---help--- - Enable network debug SYSLOG output (disabled by default) + Enable binary loader debug SYSLOG output (disabled by default) config DEBUG_CRYPTO bool "Crypto Debug Output" @@ -412,36 +400,68 @@ config DEBUG_CRYPTO ---help--- Enable Crypto debug SYSLOG output (disabled by default) -config DEBUG_USB - bool "USB Debug Output" - default n - depends on USBDEV || USBHOST - ---help--- - Enable usb debug SYSLOG output (disabled by default) - config DEBUG_FS bool "File System Debug Output" default n ---help--- Enable file system debug SYSLOG output (disabled by default) +config DEBUG_GRAPHICS + bool "Graphics Debug Output" + default n + ---help--- + Enable NX graphics debug SYSLOG output (disabled by default) + config DEBUG_LIB bool "C Library Debug Output" default n ---help--- Enable C library debug SYSLOG output (disabled by default) -config DEBUG_BINFMT - bool "Binary Loader Debug Output" +config DEBUG_MM + bool "Memory Manager Debug Output" default n ---help--- - Enable binary loader debug SYSLOG output (disabled by default) + Enable memory management debug SYSLOG output (disabled by default) -config DEBUG_GRAPHICS - bool "Graphics Debug Output" +config DEBUG_NET + bool "Network Debug Output" + default n + depends on ARCH_HAVE_NET + ---help--- + Enable network debug SYSLOG output (disabled by default) + +config DEBUG_SCHED + bool "Scheduler Debug Output" default n ---help--- - Enable NX graphics debug SYSLOG output (disabled by default) + Enable OS debug SYSLOG output (disabled by default) + +config DEBUG_SYSCALL + bool "SYSCALL Debug Output" + default n + depends on NUTTX_KERNEL + ---help--- + Enable very low level output related to system calls. This gives + you basically a poor man's version of strace. + +comment "OS Function Debug Options" + +config DEBUG_DMA + bool "DMA Debug Output" + default n + depends on ARCH_DMA + ---help--- + Enable DMA-releated debug SYSLOG output (disabled by default). + Support for this debug option is architecture-specific and may not + be available for some MCUs. + +config DEBUG_HEAP + bool "Heap usage debug hooks" + default n + depends on ARCH_HAVE_HEAPCHECK + ---help--- + Enable hooks to check heap usage. Only supported by a few architectures. config DEBUG_IRQ bool "Interrupt Controller Debug Output" @@ -454,13 +474,12 @@ config DEBUG_IRQ that here is a problem with that logic. On some platforms, this option may even cause crashes! Use with care! -config DEBUG_SYSCALL - bool "SYSCALL Debug Output" +config DEBUG_PAGING + bool "Demand Paging Debug Output" default n - depends on NUTTX_KERNEL + depends on PAGING ---help--- - Enable very low level output related to system calls. This gives - you basically a poor man's version of strace. + Enable demand paging debug SYSLOG output (disabled by default) config DEBUG_STACK bool "Stack usage debug hooks" @@ -469,13 +488,6 @@ config DEBUG_STACK ---help--- Enable hooks to check stack usage. Only supported by a few architectures. -config DEBUG_HEAP - bool "Heap usage debug hooks" - default n - depends on ARCH_HAVE_HEAPCHECK - ---help--- - Enable hooks to check heap usage. Only supported by a few architectures. - comment "Driver Debug Options" config DEBUG_LCD @@ -515,6 +527,23 @@ config DEBUG_ANALOG this debug option is architecture-specific and may not be available for some MCUs. +config DEBUG_CAN + bool "CAN Debug Output" + default n + depends on CAN + ---help--- + Enable CAN driver debug SYSLOG output (disabled by default). + Support for this debug option is architecture-specific and may not + be available for some MCUs. + +config DEBUG_GPIO + bool "GPIO Debug Output" + default n + ---help--- + Enable GPIO-releated debug SYSLOG output (disabled by default). + Support for this debug option is architecture-specific and may not + be available for some MCUs. + config DEBUG_I2C bool "I2C Debug Output" default n @@ -524,15 +553,6 @@ config DEBUG_I2C Support for this debug option is architecture-specific and may not be available for some MCUs. -config DEBUG_SPI - bool "SPI Debug Output" - default n - depends on SPI - ---help--- - Enable I2C driver debug SYSLOG output (disabled by default). - Support for this debug option is architecture-specific and may not - be available for some MCUs. - config DEBUG_I2S bool "I2S Debug Output" default n @@ -542,15 +562,6 @@ config DEBUG_I2S Support for this debug option is architecture-specific and may not be available for some MCUs. -config DEBUG_CAN - bool "CAN Debug Output" - default n - depends on CAN - ---help--- - Enable CAN driver debug SYSLOG output (disabled by default). - Support for this debug option is architecture-specific and may not - be available for some MCUs. - config DEBUG_PWM bool "PWM Debug Output" default n @@ -560,32 +571,6 @@ config DEBUG_PWM Support for this debug option is architecture-specific and may not be available for some MCUs. -config DEBUG_SDIO - bool "SDIO Debug Output" - default n - depends on MMCSD_SDIO - ---help--- - Enable SDIO driver debug SYSLOG output (disabled by default). - Support for this debug option is architecture-specific and may not - be available for some MCUs. - -config DEBUG_GPIO - bool "GPIO Debug Output" - default n - ---help--- - Enable GPIO-releated debug SYSLOG output (disabled by default). - Support for this debug option is architecture-specific and may not - be available for some MCUs. - -config DEBUG_DMA - bool "DMA Debug Output" - default n - depends on ARCH_DMA - ---help--- - Enable DMA-releated debug SYSLOG output (disabled by default). - Support for this debug option is architecture-specific and may not - be available for some MCUs. - config DEBUG_RTC bool "RTC Debug Output" default n @@ -595,12 +580,21 @@ config DEBUG_RTC Support for this debug option is architecture-specific and may not be available for some MCUs. -config DEBUG_WATCHDOG - bool "Watchdog Timer Debug Output" +config DEBUG_SDIO + bool "SDIO Debug Output" default n - depends on WATCHDOG + depends on MMCSD_SDIO ---help--- - Enable watchdog timer debug SYSLOG output (disabled by default). + Enable SDIO driver debug SYSLOG output (disabled by default). + Support for this debug option is architecture-specific and may not + be available for some MCUs. + +config DEBUG_SPI + bool "SPI Debug Output" + default n + depends on SPI + ---help--- + Enable I2C driver debug SYSLOG output (disabled by default). Support for this debug option is architecture-specific and may not be available for some MCUs. @@ -613,13 +607,21 @@ config DEBUG_TIMER Support for this debug option is architecture-specific and may not be available for some MCUs. -config DEBUG_AUDIO - bool "Audio Device Debug Output" +config DEBUG_USB + bool "USB Debug Output" default n + depends on USBDEV || USBHOST ---help--- - Enable low level debug SYSLOG output from the audio subsystem and - device drivers. (disabled by default). Support for this debug option - is architecture-specific and may not be available for some MCUs. + Enable usb debug SYSLOG output (disabled by default) + +config DEBUG_WATCHDOG + bool "Watchdog Timer Debug Output" + default n + depends on WATCHDOG + ---help--- + Enable watchdog timer debug SYSLOG output (disabled by default). + Support for this debug option is architecture-specific and may not + be available for some MCUs. endif # DEBUG diff --git a/arch/arm/src/sama5/chip/sama5d4x_pinmap.h b/arch/arm/src/sama5/chip/sama5d4x_pinmap.h index 1ead0d3d5d..f98554079f 100644 --- a/arch/arm/src/sama5/chip/sama5d4x_pinmap.h +++ b/arch/arm/src/sama5/chip/sama5d4x_pinmap.h @@ -54,12 +54,12 @@ * * Alternative pin selections are provided with a numeric suffix like _1, _2, etc. Drivers, however, will * use the pin selection without the numeric suffix. Additional definitions are required in the board.h - * file. For example, if we wanted the PCK0on PB26, then the following definition should appear in the + * file. For example, if we wanted the PCK0 on PB26, then the following definition should appear in the * board.h header file for that board: * * #define PIO_PMC_PCK0 PIO_PMC_PCK0_1 * - * The LCD driver will then automatically configure PA16 as the DAT16 pin. + * The PCK logic will then automatically configure PB26 as the PCK0 pin. */ /* WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! diff --git a/arch/arm/src/sama5/sam_ssc.c b/arch/arm/src/sama5/sam_ssc.c index 65cca17fd3..56c16064b7 100644 --- a/arch/arm/src/sama5/sam_ssc.c +++ b/arch/arm/src/sama5/sam_ssc.c @@ -52,6 +52,7 @@ #include #include + #include #include #include @@ -200,29 +201,51 @@ #define SSC_CLKOUT_CONT 1 /* Continuous */ #define SSC_CLKOUT_XFER 2 /* Only output clock during transfers */ +/* Bus configuration differ with chip */ + +#if defined(ATSAMA5D3) + /* System bus interfaces */ + +# define DMACH_FLAG_PERIPH_IF DMACH_FLAG_PERIPHAHB_AHB_IF2 +# define DMACH_FLAG_MEM_IF DMACH_FLAG_MEMAHB_AHB_IF0 + +#elif defined(ATSAMA5D4) + /* System Bus Interfaces + * + * Both SSC0 and SSC1 are APB1; HSMCI1 is on H32MX. Both are accessible + * on MATRIX IF1. + * + * Memory is available on either port 5 (IF0 for both XDMAC0 and 1) or + * port 6 (IF1 for both XDMAC0 and 1). + */ + +# define DMACH_FLAG_PERIPH_IF DMACH_FLAG_PERIPHAHB_AHB_IF1 +# define DMACH_FLAG_MEM_IF DMACH_FLAG_MEMAHB_AHB_IF0 +#endif + /* DMA configuration */ #define DMA8_FLAGS \ - (DMACH_FLAG_PERIPHAHB_AHB_IF2 | DMACH_FLAG_PERIPHH2SEL | \ + (DMACH_FLAG_PERIPH_IF | DMACH_FLAG_PERIPHH2SEL | \ DMACH_FLAG_PERIPHISPERIPH | DMACH_FLAG_PERIPHWIDTH_8BITS | \ DMACH_FLAG_PERIPHCHUNKSIZE_1 | DMACH_FLAG_MEMPID_MAX | \ - DMACH_FLAG_MEMAHB_AHB_IF0 | DMACH_FLAG_MEMWIDTH_16BITS | \ + DMACH_FLAG_MEM_IF | DMACH_FLAG_MEMWIDTH_16BITS | \ DMACH_FLAG_MEMINCREMENT | DMACH_FLAG_MEMCHUNKSIZE_4| \ DMACH_FLAG_MEMBURST_4) #define DMA16_FLAGS \ - (DMACH_FLAG_PERIPHAHB_AHB_IF2 | DMACH_FLAG_PERIPHH2SEL | \ + (DMACH_FLAG_PERIPH_IF | DMACH_FLAG_PERIPHH2SEL | \ DMACH_FLAG_PERIPHISPERIPH | DMACH_FLAG_PERIPHWIDTH_16BITS | \ DMACH_FLAG_PERIPHCHUNKSIZE_1 | DMACH_FLAG_MEMPID_MAX | \ - DMACH_FLAG_MEMAHB_AHB_IF0 | DMACH_FLAG_MEMWIDTH_16BITS | \ + DMACH_FLAG_MEM_IF | DMACH_FLAG_MEMWIDTH_16BITS | \ DMACH_FLAG_MEMINCREMENT | DMACH_FLAG_MEMCHUNKSIZE_4 | \ DMACH_FLAG_MEMBURST_4) #define DMA32_FLAGS \ - (DMACH_FLAG_PERIPHAHB_AHB_IF2 | DMACH_FLAG_PERIPHH2SEL | \ + (DMACH_FLAG_PERIPH_IF | DMACH_FLAG_PERIPHH2SEL | \ DMACH_FLAG_PERIPHISPERIPH | DMACH_FLAG_PERIPHWIDTH_32BITS | \ DMACH_FLAG_PERIPHCHUNKSIZE_1 | DMACH_FLAG_MEMPID_MAX | \ - DMACH_FLAG_MEMAHB_AHB_IF0 | DMACH_FLAG_MEMWIDTH_32BITS | \ + DMACH_FLAG_MEM_IF | DMACH_FLAG_MEMWIDTH_32BITS | \ DMACH_FLAG_MEMINCREMENT | DMACH_FLAG_MEMCHUNKSIZE_4 | \ DMACH_FLAG_MEMBURST_4) @@ -2610,6 +2633,7 @@ static void ssc_clocking(struct sam_ssc_s *priv) /* Determine the maximum SSC peripheral clock frequency */ mck = BOARD_MCK_FREQUENCY; +#ifdef SAMA5_HAVE_PMC_PCR_DIV DEBUGASSERT((mck >> 3) <= SAM_SSC_MAXPERCLK); if (mck <= SAM_SSC_MAXPERCLK) @@ -2633,6 +2657,13 @@ static void ssc_clocking(struct sam_ssc_s *priv) regval = PMC_PCR_DIV8; } +#else + /* No PCR_DIV field */ + + priv->frequency = mck; + regval = 0; +#endif + /* Set the maximum SSC peripheral clock frequency */ regval |= PMC_PCR_PID(priv->pid) | PMC_PCR_CMD | PMC_PCR_EN; diff --git a/configs/sama5d4-ek/README.txt b/configs/sama5d4-ek/README.txt index 81dffcc942..27c37df8bf 100644 --- a/configs/sama5d4-ek/README.txt +++ b/configs/sama5d4-ek/README.txt @@ -2761,12 +2761,12 @@ Audio Support 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_NUM_BUFFERS=8 : Number of audio buffers - CONFIG_AUDIO_BUFFER_NUMBYTES=8192 : Audio buffer size CONFIG_AUDIO_WM8904=y : Build WM8904 driver character driver Board Selection @@ -2785,6 +2785,33 @@ Audio Support file at SAMA5D4-EK for information about how you might implement this test for the SAMA5D4-EK. + 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: + + 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_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=n : (Since only PCM is supported) + 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. + TM7000 LCD/Touchscreen ====================== diff --git a/configs/sama5d4-ek/include/board.h b/configs/sama5d4-ek/include/board.h index b528ed2921..9f3b8abef5 100644 --- a/configs/sama5d4-ek/include/board.h +++ b/configs/sama5d4-ek/include/board.h @@ -228,11 +228,25 @@ #define BOARD_EBICS3_NAND_DATAADDR 0x60000000 /* Pin disambiguation ***************************************************************/ +/* Alternative pin selections are provided with a numeric suffix like _1, _2, etc. + * Drivers, however, will use the pin selection without the numeric suffix. + * Additional definitions are required in this board.h file. For example, if we + * wanted the PCK0on PB26, then the following definition should appear in the + * board.h header file for that board: + * + * #define PIO_PMC_PCK0 PIO_PMC_PCK0_1 + * + * The PCK logic will then automatically configure PB26 as the PCK0 pin. + */ + +/* SSC0 TD is provided on PB28 */ + +#define PIO_SSC0_TD PIO_SSC0_TD_2 /* PCK0 is provided to the WM8904 audio CODEC via PB26 */ #ifdef CONFIG_AUDIO_WM8904 -# define PIO_PMC_PCK0 PIO_PMC_PCK0_1 +# define PIO_PMC_PCK0 PIO_PMC_PCK0_1 #endif /************************************************************************************ diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index ceece883ef..57ce192a04 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -153,8 +153,7 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev, static int wm8904_configure(FAR struct audio_lowerhalf_s *dev, FAR const struct audio_caps_s *caps); #endif -static int wm8904_softreset(FAR struct wm8904_dev_s *priv); -static int wm8904_hardreset(FAR struct wm8904_dev_s *priv); +static int wm8904_reset(FAR struct wm8904_dev_s *priv); static int wm8904_shutdown(FAR struct audio_lowerhalf_s *dev); static void wm8904_senddone(FAR struct i2s_dev_s *i2s, FAR struct ap_buffer_s *apb, FAR void *arg, int result); @@ -315,7 +314,7 @@ static uint16_t wm8904_readreg(FAR struct wm8904_dev_s *priv, uint8_t regaddr) * return the value read. */ - regval = ((uint16_t)data[0] << 8) | (uint16_t)data[1] + regval = ((uint16_t)data[0] << 8) | (uint16_t)data[1]; audvdbg("READ: %02x -> %04x\n", regaddr, regval); return regval; } @@ -859,41 +858,23 @@ static int wm8904_configure(FAR struct audio_lowerhalf_s *dev, } /**************************************************************************** - * Name: wm8904_softreset + * Name: wm8904_reset * * Description: - * Performs a soft reset on the WM8904 chip by setting the RESET bit of - * the MODE register. + * Performs a soft reset on the WM8904 chip by writing to the SWRST + * register. * ****************************************************************************/ -static int wm8904_softreset(FAR struct wm8904_dev_s *priv) +static int wm8904_reset(FAR struct wm8904_dev_s *priv) { /* First disable interrupts */ WM8904_DISABLE(priv->lower); /* Now issue a reset command */ -#warning Missing logic - /* Select the lowest power consumption mode of operation */ - /* REVISIT */ - - return OK; -} - -/**************************************************************************** - * Name: wm8904_hardreset - * - * Description: - * Performs a hardware reset on the WM8904 chip by toggling the RST line, - * disabling interrupts, and setting the default operating frequency. - * - ****************************************************************************/ - -static int wm8904_hardreset(FAR struct wm8904_dev_s *priv) -{ - WM8904_DISABLE(priv->lower); + wm8904_writereg(priv, WM8904_SWRST, 0); return OK; } @@ -909,7 +890,7 @@ static int wm8904_shutdown(FAR struct audio_lowerhalf_s *dev) { FAR struct wm8904_dev_s *priv = (FAR struct wm8904_dev_s *)dev; -#warning Missing logic + wm8904_reset(priv); return OK; } @@ -950,7 +931,7 @@ static void wm8904_senddone(FAR struct i2s_dev_s *i2s, /* And decrement the number of buffers in-flight */ - DEBUGASSERT(inflight > 0); + DEBUGASSERT(priv->inflight > 0); priv->inflight--; /* Save the result of the transfer */ @@ -963,10 +944,6 @@ static void wm8904_senddone(FAR struct i2s_dev_s *i2s, * buffers in the done queue that need to be cleaned up. */ - DEBUGASSERT(lower && priv); - - /* Create an (empty) message and send it to the worker thread */ - msg.msgId = AUDIO_MSG_COMPLETE; ret = mq_send(priv->mq, &msg, sizeof(msg), CONFIG_WM8904_MSG_PRIO); if (ret < 0) @@ -1207,7 +1184,7 @@ static void *wm8904_workerthread(pthread_addr_t pvarg) break; default: - auddbg("ERROR: Ignoring message ID %d\n", msg.msgID); + auddbg("ERROR: Ignoring message ID %d\n", msg.msgId); break; } } @@ -1275,7 +1252,7 @@ static int wm8904_start(FAR struct audio_lowerhalf_s *dev) /* Do a soft reset, just in case */ - wm8904_softreset(priv); + wm8904_reset(priv); /* Exit reduced power modes of operation */ /* REVISIT */ @@ -1508,7 +1485,7 @@ static int wm8904_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, */ case AUDIOIOC_HWRESET: - wm8904_hardreset((FAR struct wm8904_dev_s *)dev); + wm8904_reset((FAR struct wm8904_dev_s *)dev); break; /* Report our preferred buffer size and quantity */