mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
SAMA5 SSC: Add framework (only) for a forthcoming SSC-based I2S driver
This commit is contained in:
@@ -5984,4 +5984,8 @@
|
|||||||
* include/nuttx/audio/i2s.h: First cut at an I2S interface
|
* include/nuttx/audio/i2s.h: First cut at an I2S interface
|
||||||
definition. This initial definition is sparse will will
|
definition. This initial definition is sparse will will
|
||||||
probably evolve significantly (2011-11-7).
|
probably evolve significantly (2011-11-7).
|
||||||
|
* arch/arm/src/sama5/sam_ssc.c and .h: Skeleton and build setup
|
||||||
|
for a forthcoming SSC (aka I2S) driver for the SAMA5. The
|
||||||
|
initial check-in is just the SAMA5 SPI driver gutted and hacked
|
||||||
|
to use the I2S interface. More coming (2013-11-7).
|
||||||
|
|
||||||
|
|||||||
@@ -481,6 +481,15 @@ config DEBUG_SPI
|
|||||||
Support for this debug option is architecture-specific and may not
|
Support for this debug option is architecture-specific and may not
|
||||||
be available for some MCUs.
|
be available for some MCUs.
|
||||||
|
|
||||||
|
config DEBUG_I2S
|
||||||
|
bool "I2S Debug Output"
|
||||||
|
default n
|
||||||
|
depends on I2S
|
||||||
|
---help---
|
||||||
|
Enable I2S 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_CAN
|
config DEBUG_CAN
|
||||||
bool "CAN Debug Output"
|
bool "CAN Debug Output"
|
||||||
default n
|
default n
|
||||||
|
|||||||
@@ -249,10 +249,12 @@ config SAMA5_ISI
|
|||||||
config SAMA5_SSC0
|
config SAMA5_SSC0
|
||||||
bool "Synchronous Serial Controller 0 (SSC0)"
|
bool "Synchronous Serial Controller 0 (SSC0)"
|
||||||
default n
|
default n
|
||||||
|
select I2S
|
||||||
|
|
||||||
config SAMA5_SSC1
|
config SAMA5_SSC1
|
||||||
bool "Synchronous Serial Controller 1 (SSC1)"
|
bool "Synchronous Serial Controller 1 (SSC1)"
|
||||||
default n
|
default n
|
||||||
|
select I2S
|
||||||
|
|
||||||
config SAMA5_CAN0
|
config SAMA5_CAN0
|
||||||
bool "CAN controller 0 (CAN0)"
|
bool "CAN controller 0 (CAN0)"
|
||||||
@@ -1373,6 +1375,238 @@ config SAMA5_TWI_REGDEBUG
|
|||||||
endmenu # TWI device driver options
|
endmenu # TWI device driver options
|
||||||
endif # SAMA5_TWI0 || SAMA5_TWI1 || SAMA5_TWI2
|
endif # SAMA5_TWI0 || SAMA5_TWI1 || SAMA5_TWI2
|
||||||
|
|
||||||
|
if SAMA5_SSC0 || SAMA5_SSC1
|
||||||
|
menu "SSC Configuration"
|
||||||
|
|
||||||
|
config SAMA5_SSC_DMA
|
||||||
|
bool "Enable SSC DMA"
|
||||||
|
default n
|
||||||
|
depends on (SAMA5_DMAC0 && SAMA5_SSC0) || (SAMA5_DMAC1 && SAMA5_SSC1)
|
||||||
|
---help---
|
||||||
|
Enable use of DMA in I2C tranfers
|
||||||
|
|
||||||
|
config SAMA5_SSC_DMATHRESHOLD
|
||||||
|
int "DMA transfer threshold"
|
||||||
|
default 4
|
||||||
|
depends on SAMA5_SSC_DMA
|
||||||
|
---help---
|
||||||
|
Small I2S transfers are better performed without using DMA. This
|
||||||
|
setting defines a threshold to select when small transfer should
|
||||||
|
be performed without using DMA.
|
||||||
|
|
||||||
|
if SAMA5_SSC0
|
||||||
|
comment "SSC0 Configuration"
|
||||||
|
|
||||||
|
config SAMA5_SSC0_RX
|
||||||
|
bool "Enable I2C receive"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S receipt logic
|
||||||
|
|
||||||
|
if SAMA5_SSC0_RX
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Receiver clock source"
|
||||||
|
default SAMA5_SSC0_RX_INTCLK
|
||||||
|
|
||||||
|
config SAMA5_SSC0_RX_EXTCLK
|
||||||
|
bool "External Clock"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is an external clock provided on the RK input
|
||||||
|
pin.
|
||||||
|
|
||||||
|
config SAMA5_SSC0_RX_TXCLK
|
||||||
|
bool "Transmitter Clock"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is transmitter clock.
|
||||||
|
|
||||||
|
config SAMA5_SSC0_RX_INTCLK
|
||||||
|
bool "MCK/2"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is the MCK/2 divided by a up to 4095.
|
||||||
|
|
||||||
|
endchoice # Receiver clock source
|
||||||
|
|
||||||
|
config SAMA5_SSC0_RX_EXTFREQ
|
||||||
|
int "External reciver clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC0_RX_EXTCLK
|
||||||
|
---help---
|
||||||
|
If the receiver clock is provided via a clock input on the RK pin,
|
||||||
|
then the frequency of the receiver clock must be provided.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC0_RX
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX
|
||||||
|
bool "Enable I2C transmit"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S transmission logic
|
||||||
|
|
||||||
|
if SAMA5_SSC0_TX
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Transmitter clock source"
|
||||||
|
default SAMA5_SSC0_TX_INTCLK
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX_EXTCLK
|
||||||
|
bool "External Clock"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is an external clock provided on the TK input
|
||||||
|
pin.
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX_RXCLK
|
||||||
|
bool "Receiver Clock"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is receiver clock.
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX_INTCLK
|
||||||
|
bool "MCK/2"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is the MCK/2 divided by a up to 4095.
|
||||||
|
|
||||||
|
endchoice # Transmitter clock source
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX_EXTFREQ
|
||||||
|
int "External transmitter clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC0_TX_EXTCLK
|
||||||
|
---help---
|
||||||
|
If the transmitter clock is provided via a clock input on the TK pin,
|
||||||
|
then the frequency of the transmitter clock must be provided.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC0_TX
|
||||||
|
|
||||||
|
config SAMA5_SSC0_TX_INTCLK_FREQUENCY
|
||||||
|
int "Internal transmitter clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC0_RX_INTCLK || SAMA5_SSC0_TX_INTCLK
|
||||||
|
---help---
|
||||||
|
If the either the receiver or transmitter clock is provided by MCK/2 divided
|
||||||
|
down, then the target frequency must be provided. The SSC driver will
|
||||||
|
determine the best divider to obtain that frequency (up to 4095). If the
|
||||||
|
frequency is too low to be obtained by dividing down the MCK/2, a compile
|
||||||
|
time error will occur.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC0
|
||||||
|
|
||||||
|
if SAMA5_SSC1
|
||||||
|
comment "SSC1 Configuration"
|
||||||
|
|
||||||
|
config SAMA5_SSC1_RX
|
||||||
|
bool "Enable I2C receive"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S receipt logic
|
||||||
|
|
||||||
|
if SAMA5_SSC1_RX
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Receiver clock source"
|
||||||
|
default SAMA5_SSC1_RX_INTCLK
|
||||||
|
|
||||||
|
config SAMA5_SSC1_RX_EXTCLK
|
||||||
|
bool "External Clock"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is an external clock provided on the RK input
|
||||||
|
pin.
|
||||||
|
|
||||||
|
config SAMA5_SSC1_RX_TXCLK
|
||||||
|
bool "Transmitter Clock"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is transmitter clock.
|
||||||
|
|
||||||
|
config SAMA5_SSC1_RX_INTCLK
|
||||||
|
bool "MCK/2"
|
||||||
|
---help---
|
||||||
|
The SSC receiver clock is the MCK/2 divided by a up to 4095.
|
||||||
|
|
||||||
|
endchoice # Receiver clock source
|
||||||
|
|
||||||
|
config SAMA5_SSC1_RX_EXTFREQ
|
||||||
|
int "External reciver clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC1_RX_EXTCLK
|
||||||
|
---help---
|
||||||
|
If the receiver clock is provided via a clock input on the RK pin,
|
||||||
|
then the frequency of the receiver clock must be provided.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC0_RX
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX
|
||||||
|
bool "Enable I2C transmit"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S transmission logic
|
||||||
|
|
||||||
|
if SAMA5_SSC1_TX
|
||||||
|
|
||||||
|
choice
|
||||||
|
prompt "Transmitter clock source"
|
||||||
|
default SAMA5_SSC1_TX_INTCLK
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX_EXTCLK
|
||||||
|
bool "External Clock"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is an external clock provided on the TK input
|
||||||
|
pin.
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX_RXCLK
|
||||||
|
bool "Receiver Clock"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is receiver clock.
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX_INTCLK
|
||||||
|
bool "MCK/2"
|
||||||
|
---help---
|
||||||
|
The SSC transmitter clock is the MCK/2 divided by a up to 4095.
|
||||||
|
|
||||||
|
endchoice # Transmitter clock source
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX_EXTFREQ
|
||||||
|
int "External transmitter clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC1_TX_EXTCLK
|
||||||
|
---help---
|
||||||
|
If the transmitter clock is provided via a clock input on the TK pin,
|
||||||
|
then the frequency of the transmitter clock must be provided.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC1_TX
|
||||||
|
|
||||||
|
config SAMA5_SSC1_TX_INTCLK_FREQUENCY
|
||||||
|
int "Internal transmitter clock frequency"
|
||||||
|
default 100
|
||||||
|
depends on SAMA5_SSC1_RX_INTCLK || SAMA5_SSC1_TX_INTCLK
|
||||||
|
---help---
|
||||||
|
If the either the receiver or transmitter clock is provided by MCK/2 divided
|
||||||
|
down, then the target frequency must be provided. The SSC driver will
|
||||||
|
determine the best divider to obtain that frequency (up to 4095). If the
|
||||||
|
frequency is too low to be obtained by dividing down the MCK/2, a compile
|
||||||
|
time error will occur.
|
||||||
|
|
||||||
|
endif # SAMA5_SSC1
|
||||||
|
|
||||||
|
config SAMA5_SSC_DMADEBUG
|
||||||
|
bool "SSC DMA transfer debug"
|
||||||
|
depends on SAMA5_SSC_DMA && DEBUG && DEBUG_DMA
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable special debug instrumentation analyze SSC DMA data transfers.
|
||||||
|
This logic is as non-invasive as possible: It samples DMA
|
||||||
|
registers at key points in the data transfer and then dumps all of
|
||||||
|
the registers at the end of the transfer.
|
||||||
|
|
||||||
|
config SAMA5_SSC_REGDEBUG
|
||||||
|
bool "SSC Register level debug"
|
||||||
|
depends on DEBUG
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Output detailed register-level SSC device debug information.
|
||||||
|
Very invasive! Requires also DEBUG.
|
||||||
|
|
||||||
|
endmenu # SSC Configuration
|
||||||
|
endif # SAMA5_SSC0 || SAMA5_SSC1
|
||||||
|
|
||||||
if SAMA5_HSMCI0 || SAMA5_HSMCI1 || SAMA5_HSMCI2
|
if SAMA5_HSMCI0 || SAMA5_HSMCI1 || SAMA5_HSMCI2
|
||||||
menu "HSMCI device driver options"
|
menu "HSMCI device driver options"
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,15 @@ else
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_SAMA5_SSC0),y)
|
||||||
|
CHIP_CSRCS += sam_ssc.c
|
||||||
|
else
|
||||||
|
ifeq ($(CONFIG_SAMA5_SSC1),y)
|
||||||
|
CHIP_CSRCS += sam_ssc.c
|
||||||
|
else
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SAMA5_LCDC),y)
|
ifeq ($(CONFIG_SAMA5_LCDC),y)
|
||||||
CHIP_CSRCS += sam_lcd.c
|
CHIP_CSRCS += sam_lcd.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
#define SAM_SSC_IMR_OFFSET 0x004c /* Interrupt Mask Register */
|
#define SAM_SSC_IMR_OFFSET 0x004c /* Interrupt Mask Register */
|
||||||
#define SAM_SSC_WPMR_OFFSET 0x00e4 /* Write Protect Mode Register */
|
#define SAM_SSC_WPMR_OFFSET 0x00e4 /* Write Protect Mode Register */
|
||||||
#define SAM_SSC_WPSR_OFFSET 0x00e8 /* Write Protect Status Register */
|
#define SAM_SSC_WPSR_OFFSET 0x00e8 /* Write Protect Status Register */
|
||||||
/* 0x50-0x124 Reserved
|
/* 0x50-0x124 Reserved */
|
||||||
|
|
||||||
/* SSC Register Addresses ***********************************************************/
|
/* SSC Register Addresses ***********************************************************/
|
||||||
|
|
||||||
@@ -193,9 +193,9 @@
|
|||||||
|
|
||||||
#define SSC_TCMR_CKS_SHIFT (0) /* Bits 0-1: Transmit Clock Selection */
|
#define SSC_TCMR_CKS_SHIFT (0) /* Bits 0-1: Transmit Clock Selection */
|
||||||
#define SSC_TCMR_CKS_MASK (3 << SSC_TCMR_CKS_SHIFT)
|
#define SSC_TCMR_CKS_MASK (3 << SSC_TCMR_CKS_SHIFT)
|
||||||
# define SSC_TCMR_CKS_ MCK (0 << SSC_TCMR_CKS_SHIFT) /* Divided Clock */
|
# define SSC_TCMR_CKS_MCK (0 << SSC_TCMR_CKS_SHIFT) /* Divided Clock */
|
||||||
# define SSC_TCMR_CKS_ RK (1 << SSC_TCMR_CKS_SHIFT) /* RK Clock signal */
|
# define SSC_TCMR_CKS_RK (1 << SSC_TCMR_CKS_SHIFT) /* RK Clock signal */
|
||||||
# define SSC_TCMR_CKS_ TK (2 << SSC_TCMR_CKS_SHIFT) /* TK pin */
|
# define SSC_TCMR_CKS_TK (2 << SSC_TCMR_CKS_SHIFT) /* TK pin */
|
||||||
#define SSC_TCMR_CKO_SHIFT (2) /* Bits 2-3: Transmit Clock Output Mode Selection */
|
#define SSC_TCMR_CKO_SHIFT (2) /* Bits 2-3: Transmit Clock Output Mode Selection */
|
||||||
#define SSC_TCMR_CKO_MASK (3 << SSC_TCMR_CKO_SHIFT)
|
#define SSC_TCMR_CKO_MASK (3 << SSC_TCMR_CKO_SHIFT)
|
||||||
# define SSC_TCMR_CKO_NONE (0 << SSC_TCMR_CKO_SHIFT) /* None, TK pin is an input */
|
# define SSC_TCMR_CKO_NONE (0 << SSC_TCMR_CKO_SHIFT) /* None, TK pin is an input */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* arch/arm/src/sama5/sam_ssc.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 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 __ARCH_ARM_SRC_SAMA5_SAM_SSC_H
|
||||||
|
#define __ARCH_ARM_SRC_SAMA5_SAM_SSC_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/audio/i2s.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "chip/sam_ssc.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Types
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Inline Functions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Data
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sam_ssc_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the selected I2S port.
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* Port number (for hardware that has mutiple I2S interfaces)
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Valid I2S device structure reference on succcess; a NULL on failure
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FAR struct i2s_dev_s *sam_ssc_initialize(int port);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_ARM_SRC_SAMA5_SAM_SSC_H */
|
||||||
+21
-5
@@ -161,6 +161,17 @@ if SPI
|
|||||||
source drivers/spi/Kconfig
|
source drivers/spi/Kconfig
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
menuconfig I2S
|
||||||
|
bool "I2S Driver Support"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This selection enables selection of common I2S options. This option
|
||||||
|
should be enabled by all platforms that support I2S interfaces.
|
||||||
|
See include/nuttx/audio/i2s.h for further I2S driver information.
|
||||||
|
|
||||||
|
if I2S
|
||||||
|
endif # I2S
|
||||||
|
|
||||||
menuconfig RTC
|
menuconfig RTC
|
||||||
bool "RTC Driver Support"
|
bool "RTC Driver Support"
|
||||||
default n
|
default n
|
||||||
@@ -170,10 +181,11 @@ menuconfig RTC
|
|||||||
Most RTC drivers are MCU specific and may require other specific
|
Most RTC drivers are MCU specific and may require other specific
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
|
if RTC
|
||||||
|
|
||||||
config RTC_DATETIME
|
config RTC_DATETIME
|
||||||
bool "Date/Time RTC Support"
|
bool "Date/Time RTC Support"
|
||||||
default n
|
default n
|
||||||
depends on RTC
|
|
||||||
---help---
|
---help---
|
||||||
There are two general types of RTC: (1) A simple battery backed
|
There are two general types of RTC: (1) A simple battery backed
|
||||||
counter that keeps the time when power is down, and (2) a full
|
counter that keeps the time when power is down, and (2) a full
|
||||||
@@ -182,10 +194,11 @@ config RTC_DATETIME
|
|||||||
of RTC. In this case, the RTC is used to "seed" the normal NuttX timer
|
of RTC. In this case, the RTC is used to "seed" the normal NuttX timer
|
||||||
and the NuttX system timer provides for higher resolution time.
|
and the NuttX system timer provides for higher resolution time.
|
||||||
|
|
||||||
|
if !RTC_DATETIME
|
||||||
|
|
||||||
config RTC_HIRES
|
config RTC_HIRES
|
||||||
bool "Hi-Res RTC Support"
|
bool "Hi-Res RTC Support"
|
||||||
default n
|
default n
|
||||||
depends on RTC && !RTC_DATETIME
|
|
||||||
---help---
|
---help---
|
||||||
If RTC_DATETIME not selected, then the simple, battery backed counter
|
If RTC_DATETIME not selected, then the simple, battery backed counter
|
||||||
is used. There are two different implementations of such simple
|
is used. There are two different implementations of such simple
|
||||||
@@ -201,20 +214,23 @@ config RTC_HIRES
|
|||||||
config RTC_FREQUENCY
|
config RTC_FREQUENCY
|
||||||
int "Hi-Res RTC frequency"
|
int "Hi-Res RTC frequency"
|
||||||
default 1
|
default 1
|
||||||
depends on RTC && !RTC_DATETIME && RTC_HIRES
|
depends on RTC_HIRES
|
||||||
---help---
|
---help---
|
||||||
If RTC_HIRES is defined, then the frequency of the high resolution RTC
|
If RTC_HIRES is defined, then the frequency of the high resolution RTC
|
||||||
must be provided. If RTC_HIRES is not defined, RTC_FREQUENCY is
|
must be provided. If RTC_HIRES is not defined, RTC_FREQUENCY is
|
||||||
assumed to be one Hz.
|
assumed to be one Hz.
|
||||||
|
|
||||||
|
endif # !RTC_DATETIME
|
||||||
|
|
||||||
config RTC_ALARM
|
config RTC_ALARM
|
||||||
bool "RTC Alarm Support"
|
bool "RTC Alarm Support"
|
||||||
default n
|
default n
|
||||||
depends on RTC
|
|
||||||
---help---
|
---help---
|
||||||
Enable if the RTC hardware supports setting of an alarm. A callback
|
Enable if the RTC hardware supports setting of an alarm. A callback
|
||||||
function will be executed when the alarm goes off.
|
function will be executed when the alarm goes off.
|
||||||
|
|
||||||
|
endif # RTC
|
||||||
|
|
||||||
menuconfig WATCHDOG
|
menuconfig WATCHDOG
|
||||||
bool "Watchdog Timer Support"
|
bool "Watchdog Timer Support"
|
||||||
default n
|
default n
|
||||||
@@ -224,7 +240,7 @@ menuconfig WATCHDOG
|
|||||||
information.
|
information.
|
||||||
|
|
||||||
if WATCHDOG
|
if WATCHDOG
|
||||||
endif
|
endif # WATCHDOG
|
||||||
|
|
||||||
menuconfig ANALOG
|
menuconfig ANALOG
|
||||||
bool "Analog Device(ADC/DAC) Support"
|
bool "Analog Device(ADC/DAC) Support"
|
||||||
|
|||||||
+14
-30
@@ -46,6 +46,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2S
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -68,7 +70,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define I2S_FREQUENCY(d,f) ((d)->ops->frequency(d,f))
|
#define I2S_FREQUENCY(d,f) ((d)->ops->i2s_frequency(d,f))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: I2S_SEND
|
* Name: I2S_SEND
|
||||||
@@ -86,8 +88,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define I2S_SEND(d,b,n) ((d)->ops->send(d,b,n))
|
#define I2S_SEND(d,b,n) ((d)->ops->i2s_send(d,b,n))
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: I2S_RECEIVE
|
* Name: I2S_RECEIVE
|
||||||
@@ -106,7 +107,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define I2S_RECEIVE(d,b,n) ((d)->ops->recvblock(d,b,n))
|
#define I2S_RECEIVE(d,b,n) ((d)->ops->i2s_receive(d,b,n))
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
@@ -117,11 +118,11 @@
|
|||||||
struct i2s_dev_s;
|
struct i2s_dev_s;
|
||||||
struct i2s_ops_s
|
struct i2s_ops_s
|
||||||
{
|
{
|
||||||
uint32_t (*frequency)(FAR struct i2s_dev_s *dev, uint32_t frequency);
|
uint32_t (*i2s_frequency)(FAR struct i2s_dev_s *dev, uint32_t frequency);
|
||||||
void (*send)(FAR struct i2s_dev_s *dev, FAR const void *buffer,
|
void (*i2s_send)(FAR struct i2s_dev_s *dev, FAR const void *buffer,
|
||||||
size_t nbytes);
|
size_t nbytes);
|
||||||
void (*receive)(FAR struct i2s_dev_s *dev, FAR void *buffer,
|
void (*i2s_receive)(FAR struct i2s_dev_s *dev, FAR void *buffer,
|
||||||
size_t nbytes);
|
size_t nbytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* I2S private data. This structure only defines the initial fields of the
|
/* I2S private data. This structure only defines the initial fields of the
|
||||||
@@ -135,7 +136,7 @@ struct i2s_dev_s
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
@@ -148,30 +149,13 @@ extern "C"
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_i2cinitialize
|
* Public Functions
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Initialize the selected I2S port.
|
|
||||||
*
|
|
||||||
* This is a generic prototype for the I2S initialize logic. Specific
|
|
||||||
* architectures may support different I2S initialization functions if,
|
|
||||||
* for example, those architectures support multiple, incompatible I2S
|
|
||||||
* implementations. In any event, the prototype of those architecture-
|
|
||||||
* specific initialization functions should be the same as
|
|
||||||
* up_i2cinitialize()
|
|
||||||
*
|
|
||||||
* Input Parameter:
|
|
||||||
* Port number (for hardware that has mutiple I2S interfaces)
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* Valid I2S device structure reference on succcess; a NULL on failure
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
FAR struct i2s_dev_s *up_i2cinitialize(int port);
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* CONFIG_I2S */
|
||||||
#endif /* __INCLUDE_NUTTX_AUDIO_I2S_H */
|
#endif /* __INCLUDE_NUTTX_AUDIO_I2S_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user