stm32f7: Add I2S audio driver
This commit is contained in:
parent
1ea10ddacc
commit
3edda2ab94
@ -33,8 +33,7 @@ list(
|
|||||||
stm32_start.c
|
stm32_start.c
|
||||||
stm32_capture.c
|
stm32_capture.c
|
||||||
stm32_uid.c
|
stm32_uid.c
|
||||||
stm32_waste.c
|
stm32_waste.c)
|
||||||
)
|
|
||||||
|
|
||||||
if(CONFIG_STM32F7_TICKLESS_TIMER)
|
if(CONFIG_STM32F7_TICKLESS_TIMER)
|
||||||
list(APPEND SRCS stm32_tickless.c)
|
list(APPEND SRCS stm32_tickless.c)
|
||||||
@ -94,6 +93,10 @@ if(CONFIG_STM32F7_I2C)
|
|||||||
list(APPEND SRCS stm32_i2c.c)
|
list(APPEND SRCS stm32_i2c.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_STM32F7_I2S)
|
||||||
|
list(APPEND SRCS stm32_i2s.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_STM32F7_SPI)
|
if(CONFIG_STM32F7_SPI)
|
||||||
list(APPEND SRCS stm32_spi.c)
|
list(APPEND SRCS stm32_spi.c)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1214,6 +1214,11 @@ config STM32F7_HAVE_EXTERNAL_ULPI
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config STM32F7_I2S
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
select STM32F7_SPI_DMA
|
||||||
|
|
||||||
config STM32F7_HAVE_SAI1
|
config STM32F7_HAVE_SAI1
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
@ -1499,6 +1504,24 @@ config STM32F7_RNG
|
|||||||
depends on STM32F7_HAVE_RNG
|
depends on STM32F7_HAVE_RNG
|
||||||
select ARCH_HAVE_RNG
|
select ARCH_HAVE_RNG
|
||||||
|
|
||||||
|
config STM32F7_I2S1
|
||||||
|
bool "I2S1"
|
||||||
|
default n
|
||||||
|
depends on !STM32F7_SPI1
|
||||||
|
select STM32F7_I2S
|
||||||
|
|
||||||
|
config STM32F7_I2S2
|
||||||
|
bool "I2S2"
|
||||||
|
default n
|
||||||
|
depends on !STM32F7_SPI2
|
||||||
|
select STM32F7_I2S
|
||||||
|
|
||||||
|
config STM32F7_I2S3
|
||||||
|
bool "I2S3"
|
||||||
|
default n
|
||||||
|
depends on !STM32F7_SPI3
|
||||||
|
select STM32F7_I2S
|
||||||
|
|
||||||
config STM32F7_SAI1
|
config STM32F7_SAI1
|
||||||
bool "SAI1"
|
bool "SAI1"
|
||||||
default n
|
default n
|
||||||
@ -2429,6 +2452,131 @@ config STM32F7_SPI6_DMA_BUFFER
|
|||||||
|
|
||||||
endmenu # "SPI Configuration"
|
endmenu # "SPI Configuration"
|
||||||
|
|
||||||
|
menu "I2S Configuration"
|
||||||
|
depends on STM32F7_I2S
|
||||||
|
|
||||||
|
config STM32F7_I2S_MAXINFLIGHT
|
||||||
|
int "I2S queue size"
|
||||||
|
default 16
|
||||||
|
---help---
|
||||||
|
This is the total number of transfers, both RX and TX, that can be
|
||||||
|
enqueue before the caller is required to wait. This setting
|
||||||
|
determines the number certain queue data structures that will be
|
||||||
|
pre-allocated.
|
||||||
|
|
||||||
|
if STM32F7_I2S1
|
||||||
|
|
||||||
|
comment "I2S1 Configuration"
|
||||||
|
|
||||||
|
config STM32F7_I2S1_MCK
|
||||||
|
bool "I2S1_MCK"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
TBD.
|
||||||
|
|
||||||
|
config STM32F7_I2S1_RX
|
||||||
|
bool "Enable I2S1 receiver"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S receipt logic
|
||||||
|
|
||||||
|
config STM32F7_I2S1_TX
|
||||||
|
bool "Enable I2S1 transmitter"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S transmission logic
|
||||||
|
|
||||||
|
config STM32F7_I2S1_DATALEN
|
||||||
|
int "I2S1 Data width (bits)"
|
||||||
|
default 16
|
||||||
|
---help---
|
||||||
|
Data width in bits. This is a default value and may be change
|
||||||
|
via the I2S interface
|
||||||
|
|
||||||
|
endif #STM32F7_I2S1
|
||||||
|
|
||||||
|
if STM32F7_I2S2
|
||||||
|
|
||||||
|
comment "I2S2 Configuration"
|
||||||
|
|
||||||
|
config STM32F7_I2S2_MCK
|
||||||
|
bool "I2S2_MCK"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
TBD.
|
||||||
|
|
||||||
|
config STM32F7_I2S2_RX
|
||||||
|
bool "Enable I2S2 receiver"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S receipt logic
|
||||||
|
|
||||||
|
config STM32F7_I2S2_TX
|
||||||
|
bool "Enable I2S2 transmitter"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S transmission logic
|
||||||
|
|
||||||
|
config STM32F7_I2S2_DATALEN
|
||||||
|
int "I2S2 Data width (bits)"
|
||||||
|
default 16
|
||||||
|
---help---
|
||||||
|
Data width in bits. This is a default value and may be change
|
||||||
|
via the I2S interface
|
||||||
|
|
||||||
|
endif #STM32F7_I2S2
|
||||||
|
|
||||||
|
if STM32F7_I2S3
|
||||||
|
|
||||||
|
comment "I2S3 Configuration"
|
||||||
|
|
||||||
|
config STM32F7_I2S3_MCK
|
||||||
|
bool "I2S3_MCK"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
TBD.
|
||||||
|
|
||||||
|
config STM32F7_I2S3_RX
|
||||||
|
bool "Enable I2S3 receiver"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S receipt logic
|
||||||
|
|
||||||
|
config STM32F7_I2S3_TX
|
||||||
|
bool "Enable I2S3 transmitter"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable I2S transmission logic
|
||||||
|
|
||||||
|
config STM32_I2S3_DATALEN
|
||||||
|
int "I2S3 Data width (bits)"
|
||||||
|
default 16
|
||||||
|
---help---
|
||||||
|
Data width in bits. This is a default value and may be change
|
||||||
|
via the I2S interface
|
||||||
|
|
||||||
|
endif #STM32F7_I2S3
|
||||||
|
|
||||||
|
config STM32F7_I2S_DMADEBUG
|
||||||
|
bool "I2S DMA transfer debug"
|
||||||
|
depends on DEBUG_DMA
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Enable special debug instrumentation analyze I2S 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 STM32_I2S_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 # I2S Configuration
|
||||||
|
|
||||||
menu "I2C Configuration"
|
menu "I2C Configuration"
|
||||||
depends on STM32F7_I2C
|
depends on STM32F7_I2C
|
||||||
|
|
||||||
|
@ -93,6 +93,10 @@ ifeq ($(CONFIG_STM32F7_I2C),y)
|
|||||||
CHIP_CSRCS += stm32_i2c.c
|
CHIP_CSRCS += stm32_i2c.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STM32F7_I2S),y)
|
||||||
|
CHIP_CSRCS += stm32_i2s.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_STM32F7_SPI),y)
|
ifeq ($(CONFIG_STM32F7_SPI),y)
|
||||||
CHIP_CSRCS += stm32_spi.c
|
CHIP_CSRCS += stm32_spi.c
|
||||||
endif
|
endif
|
||||||
|
2737
arch/arm/src/stm32f7/stm32_i2s.c
Normal file
2737
arch/arm/src/stm32f7/stm32_i2s.c
Normal file
File diff suppressed because it is too large
Load Diff
74
arch/arm/src/stm32f7/stm32_i2s.h
Normal file
74
arch/arm/src/stm32f7/stm32_i2s.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/stm32f7/stm32_i2s.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_ARM_SRC_STM32F7_STM32_I2S_H
|
||||||
|
#define __ARCH_ARM_SRC_STM32F7_STM32_I2S_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/audio/i2s.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32_i2sbus_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialize the selected I2S port
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* Port number (for hardware that has multiple I2S interfaces)
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Valid I2S device structure reference on success; a NULL on failure
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
struct i2s_dev_s *stm32_i2sbus_initialize(int port);
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_ARM_SRC_STM32F7_STM32_I2S_H */
|
@ -405,13 +405,13 @@ static inline void rcc_enableapb1(void)
|
|||||||
regval |= RCC_APB1ENR_WWDGEN;
|
regval |= RCC_APB1ENR_WWDGEN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_SPI2
|
#if defined(CONFIG_STM32F7_SPI2) || defined(CONFIG_STM32F7_I2S2)
|
||||||
/* SPI2 clock enable */
|
/* SPI2 clock enable */
|
||||||
|
|
||||||
regval |= RCC_APB1ENR_SPI2EN;
|
regval |= RCC_APB1ENR_SPI2EN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_STM32F7_SPI3
|
#if defined(CONFIG_STM32F7_SPI3) || defined(CONFIG_STM32F7_I2S3)
|
||||||
/* SPI3 clock enable */
|
/* SPI3 clock enable */
|
||||||
|
|
||||||
regval |= RCC_APB1ENR_SPI3EN;
|
regval |= RCC_APB1ENR_SPI3EN;
|
||||||
|
Loading…
Reference in New Issue
Block a user