#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

comment "XMC4xxx Configuration Options"

choice
	prompt "XMC4xxx Chip Selection"
	default ARCH_CHIP_XMC4500
	depends on ARCH_CHIP_XMC4

config ARCH_CHIP_XMC4500
	bool "XMC4500"
	select ARCH_HAVE_FPU

config ARCH_CHIP_XMC4700
	bool "XMC4700"
	select ARCH_HAVE_FPU

config ARCH_CHIP_XMC4800
	bool "XMC4800"
	select ARCH_HAVE_FPU

endchoice

# These "hidden" settings determine whether a peripheral option is available
# for the selected MCU

# When there are multiple instances of a device, these "hidden" settings
# will automatically be selected and will represent the 'OR' of the
# instances selected.

config XMC4_USIC
	bool
	default n

config XMC4_USCI_UART
	bool
	default n
	select MCU_SERIAL

config XMC4_USCI_LIN
	bool
	default n

config XMC4_LIN0
	bool
	default n

config XMC4_LIN1
	bool
	default n

config XMC4_LIN2
	bool
	default n

config XMC4_LIN3
	bool
	default n

config XMC4_LIN4
	bool
	default n

config XMC4_LIN5
	bool
	default n

config XMC4_USCI_SPI
	bool
	default n

config XMC4_SPI0
	bool
	default n

config XMC4_SPI1
	bool
	default n

config XMC4_SPI2
	bool
	default n

config XMC4_SPI3
	bool
	default n

config XMC4_SPI4
	bool
	default n

config XMC4_SPI5
	bool
	default n

config XMC4_USCI_I2C
	bool
	default n

config XMC4_I2C0
	bool
	default n

config XMC4_I2C1
	bool
	default n

config XMC4_I2C2
	bool
	default n

config XMC4_I2C3
	bool
	default n

config XMC4_I2C4
	bool
	default n

config XMC4_I2C5
	bool
	default n

config XMC4_USCI_I2S
	bool
	default n

config XMC4_I2S0
	bool
	default n

config XMC4_I2S1
	bool
	default n

config XMC4_I2S2
	bool
	default n

config XMC4_I2S3
	bool
	default n

config XMC4_I2S4
	bool
	default n

config XMC4_I2S5
	bool
	default n

# Chip families

menu "XMC4xxx Peripheral Support"

config XMC4_USIC0
	bool "USIC0"
	default n
	select XMC4_USIC
	---help---
		Support USIC0

config XMC4_USIC1
	bool "USIC1"
	default n
	select XMC4_USIC
	---help---
		Support USIC1

config XMC4_USIC2
	bool "USIC2"
	default n
	select XMC4_USIC
	---help---
		Support USIC2

config XMC4_ECAT
	bool "Enable EtherCAT interface"
	default y
	depends on ARCH_CHIP_XMC4800
	---help---
		Enable start up of the EtherCAT interface and configure ports.

config XMC4_ECAT_P0
	bool "Enable EtherCAT port 0"
	default y
	depends on XMC4_ECAT

config XMC4_ECAT_P1
	bool "Enable EtherCAT port 1"
	default n
	depends on XMC4_ECAT

config XMC4_PWM
	bool "Enable Capture Compare Units 4 (CCU4x) for PWM"
	default n
	---help---
		Support CCU4x

endmenu

menu "XMC4xxx USIC Configuration"
	depends on XMC4_USIC

menu "USIC0 Channel 0 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC0

choice
	prompt "Protocol"
	default XMC4_USIC0_CHAN0_ISUART

config XMC4_USIC0_CHAN0_NONE
	bool "Not used"
	---help---
		USIC0 Channel 0 will not be enabled

config XMC4_USIC0_CHAN0_ISUART
	bool "UART0"
	select UART0_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC0 Channel 0 as a UART

config XMC4_USIC0_CHAN0_ISLIN
	bool "LIN0"
	select XMC4_LIN0
	select XMC4_USCI_LIN
	---help---
		Configure USIC0 Channel 0 as a LIN UART

config XMC4_USIC0_CHAN0_ISSPI
	bool "SPI0"
	select XMC4_SPI0
	select XMC4_USCI_SPI
	---help---
		Configure USIC0 Channel 0 for SPI communications

config XMC4_USIC0_CHAN0_ISI2C
	bool "I2C0"
	select XMC4_I2C0
	select XMC4_USCI_I2C
	---help---
		Configure USIC0 Channel 0 for I2C communications

config XMC4_USIC0_CHAN0_ISI2S
	bool "I2S0"
	select XMC4_I2S0
	select XMC4_USCI_I2S
	---help---
		Configure USIC0 Channel 0 for I2S audio

endchoice # USIC0 Channel 0 Protocol

config XMC4_USIC0_CHAN0_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC0_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC0_CHAN0_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC0_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC0 Channel 0 Configuration


menu "USIC0 Channel 1 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC0

choice
	prompt "Protocol"
	default XMC4_USIC0_CHAN1_ISUART

config XMC4_USIC0_CHAN1_NONE
	bool "Not used"
	---help---
		USIC0 Channel 1 will not be enabled

config XMC4_USIC0_CHAN1_ISUART
	bool "UART1"
	select UART1_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC0 Channel 1 as a UART

config XMC4_USIC0_CHAN1_ISLIN
	bool "LIN1"
	select XMC4_LIN1
	select XMC4_USCI_LIN
	---help---
		Configure USIC0 Channel 1 as a LIN UART

config XMC4_USIC0_CHAN1_ISSPI
	bool "SPI1"
	select XMC4_SPI1
	select XMC4_USCI_SPI
	---help---
		Configure USIC0 Channel 1 for SPI communications

config XMC4_USIC0_CHAN1_ISI2C
	bool "I2C1"
	select XMC4_I2C1
	select XMC4_USCI_I2C
	---help---
		Configure USIC0 Channel 1 for I2C communications

config XMC4_USIC0_CHAN1_ISI2S
	bool "I2S1"
	select XMC4_I2S1
	select XMC4_USCI_I2S
	---help---
		Configure USIC0 Channel 1 for I2S audio

endchoice # USIC0 Channel 1 Protocol

config XMC4_USIC0_CHAN0_TX_BUFFER_SIZE
	int "Channel 0 Tx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC0_CHAN0_ISUART
	default 16
	---help---
		USIC0_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 TX in USIC0 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC0_CHAN0_RX_BUFFER_SIZE
	int "Channel 0 Rx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC0_CHAN0_ISUART
	default 16
	---help---
		USIC0_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 RX in USIC0 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC0_CHAN1_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC0_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC0_CHAN1_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC0_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC0 Channel 1 Configuration

menu "USIC1 Channel 0 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC1

choice
	prompt "Protocol"
	default XMC4_USIC1_CHAN0_ISUART

config XMC4_USIC1_CHAN0_NONE
	bool "Not used"
	---help---
		USIC0 Channel 0 will not be enabled

config XMC4_USIC1_CHAN0_ISUART
	bool "UART2"
	select UART2_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC1 Channel 0 as a UART

config XMC4_USIC1_CHAN0_ISLIN
	bool "LIN2"
	select XMC4_LIN2
	select XMC4_USCI_LIN
	---help---
		Configure USIC1 Channel 0 as a LIN UART

config XMC4_USIC1_CHAN0_ISSPI
	bool "SPI2"
	select XMC4_SPI2
	select XMC4_USCI_SPI
	---help---
		Configure USIC1 Channel 0 for SPI communications

config XMC4_USIC1_CHAN0_ISI2C
	bool "I2C2"
	select XMC4_I2C2
	select XMC4_USCI_I2C
	---help---
		Configure USIC1 Channel 0 for I2C communications

config XMC4_USIC1_CHAN0_ISI2S
	bool "I2S2"
	select XMC4_I2S2
	select XMC4_USCI_I2S
	---help---
		Configure USIC1 Channel 0 for I2S audio

endchoice # USIC1 Channel 0 Protocol

config XMC4_USIC1_CHAN0_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC1_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC1_CHAN0_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC1_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC1 Channel 0 Configuration

menu "USIC1 Channel 1 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC1

choice
	prompt "Protocol"
	default XMC4_USIC1_CHAN1_ISUART

config XMC4_USIC1_CHAN1_NONE
	bool "Not used"
	---help---
		USIC0 Channel 1 will not be enabled

config XMC4_USIC1_CHAN1_ISUART
	bool "UART3"
	select UART3_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC1 Channel 1 as a UART

config XMC4_USIC1_CHAN1_ISLIN
	bool "LIN3"
	select XMC4_LIN3
	select XMC4_USCI_LIN
	---help---
		Configure USIC1 Channel 1 as a LIN UART

config XMC4_USIC1_CHAN1_ISSPI
	bool "SPI3"
	select XMC4_SPI3
	select XMC4_USCI_SPI
	---help---
		Configure USIC1 Channel 1 for SPI communications

config XMC4_USIC1_CHAN1_ISI2C
	bool "I2C3"
	select XMC4_I2C3
	select XMC4_USCI_I2C
	---help---
		Configure USIC1 Channel 1 for I2C communications

config XMC4_USIC1_CHAN1_ISI2S
	bool "I2S3"
	select XMC4_I2S3
	select XMC4_USCI_I2S
	---help---
		Configure USIC1 Channel 1 for I2S audio

endchoice # USIC1 Channel 1 Protocol

config XMC4_USIC1_CHAN0_TX_BUFFER_SIZE
	int "Channel 0 Tx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC1_CHAN0_ISUART
	default 16
	---help---
		USIC1_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 TX in USIC1 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC1_CHAN0_RX_BUFFER_SIZE
	int "Channel 0 Rx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC1_CHAN0_ISUART
	default 16
	---help---
		USIC1_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 RX in USIC1 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC1_CHAN1_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC1_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC1_CHAN1_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC1_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC1 Channel 1 Configuration

menu "USIC2 Channel 0 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC2

choice
	prompt "Protocol"
	default XMC4_USIC2_CHAN0_ISUART

config XMC4_USIC2_CHAN0_NONE
	bool "Not used"
	---help---
		USIC0 Channel 0 will not be enabled

config XMC4_USIC2_CHAN0_ISUART
	bool "UART4"
	select UART4_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC2 Channel 0 as a UART

config XMC4_USIC2_CHAN0_ISLIN
	bool "LIN4"
	select XMC4_LIN4
	select XMC4_USCI_LIN
	---help---
		Configure USIC2 Channel 0 as a LIN UART

config XMC4_USIC2_CHAN0_ISSPI
	bool "SPI4"
	select XMC4_SPI4
	select XMC4_USCI_SPI
	---help---
		Configure USIC2 Channel 0 for SPI communications

config XMC4_USIC2_CHAN0_ISI2C
	bool "I2C4"
	select XMC4_I2C4
	select XMC4_USCI_I2C
	---help---
		Configure USIC2 Channel 0 for I2C communications

config XMC4_USIC2_CHAN0_ISI2S
	bool "I2S4"
	select XMC4_I2S4
	select XMC4_USCI_I2S
	---help---
		Configure USIC2 Channel 0 for I2S audio

endchoice # USIC2 Channel 0 Protocol

config XMC4_USIC2_CHAN0_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC2_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC2_CHAN0_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC2_CHAN0_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC2 Channel 0 Configuration

menu "USIC2 Channel 1 Configuration"
	depends on XMC4_USIC
	depends on XMC4_USIC2

choice
	prompt "Protocol"
	default XMC4_USIC2_CHAN1_ISUART

config XMC4_USIC2_CHAN1_NONE
	bool "Not used"
	---help---
		USIC0 Channel 1 will not be enabled

config XMC4_USIC2_CHAN1_ISUART
	bool "UART5"
	select UART5_SERIALDRIVER
	select XMC4_USCI_UART
	---help---
		Configure USIC2 Channel 1 as a UART

config XMC4_USIC2_CHAN1_ISLIN
	bool "LIN5"
	select XMC4_LIN5
	select XMC4_USCI_LIN
	---help---
		Configure USIC2 Channel 1 as a LIN UART

config XMC4_USIC2_CHAN1_ISSPI
	bool "SPI5"
	select XMC4_SPI5
	select XMC4_USCI_SPI
	---help---
		Configure USIC2 Channel 1 for SPI communications

config XMC4_USIC2_CHAN1_ISI2C
	bool "I2C5"
	select XMC4_I2C5
	select XMC4_USCI_I2C
	---help---
		Configure USIC2 Channel 1 for I2C communications

config XMC4_USIC2_CHAN1_ISI2S
	bool "I2S5"
	select XMC4_I2S5
	select XMC4_USCI_I2S
	---help---
		Configure USIC2 Channel 1 for I2S audio
endchoice # USIC2 Channel 1 Protocol

config XMC4_USIC2_CHAN0_TX_BUFFER_SIZE
	int "Channel 0 Tx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC2_CHAN0_ISUART
	default 16
	---help---
		USIC2_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 TX in USIC2 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC2_CHAN0_RX_BUFFER_SIZE
	int "Channel 0 Rx FIFO Buffer Size (non-UART)"
	depends on !XMC4_USIC2_CHAN0_ISUART
	default 16
	---help---
		USIC2_CHAN0 is not an UART but user can still set the desired offsets
		for CHAN1 RX in USIC2 FIFO buffer. The buffer is mapped as follow :
		CHAN0_TX[CHAN0_TX_BUFFER_SIZE] - CHAN0_RX[CHAN10_RX_BUFFER_SIZE] - CHAN1_TX[CHAN2_TX_BUFFER_SIZE] - CHAN1_RX[CHAN2_RX_BUFFER_SIZE]

		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC2_CHAN1_TX_BUFFER_SIZE
	int "Tx Fifo Buffer Size"
	depends on XMC4_USIC2_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

config XMC4_USIC2_CHAN1_RX_BUFFER_SIZE
	int "Rx Fifo Buffer Size"
	depends on XMC4_USIC2_CHAN1_ISUART
	default 16
	---help---
		Should be a power of 2 between 2 and 64
		The sum of Rx and Tx buffers sizes of both
		channels should be inferior to 64

endmenu # USIC2 Channel 1 Configuration

endmenu # XMC4xxx USIC Configuration

menu "XMC4xxx PWM Configuration"
depends on XMC4_PWM

config XMC4_CCU40
	bool "Enable CCU40"
	default n
	---help---
		Support CCU40

config XMC4_CCU40_CC40
	bool "Enable CCU40 Slice 0 (not compatible with tickless)"
	default n
	depends on XMC4_CCU40 && !CONFIG_SCHED_TICKLESS
	---help---
		Support CCU40 CC40, cannot be activated when tickless OS is enabled

config XMC4_CCU40_CC41
	bool "Enable CCU40 Slice 1"
	default n
	depends on XMC4_CCU40
	---help---
		Support CCU40 CC41

config XMC4_CCU40_CC42
	bool "Enable CCU40 Slice 2"
	default n
	depends on XMC4_CCU40
	---help---
		Support CCU40 CC42

config XMC4_CCU40_CC43
	bool "Enable CCU40 Slice 3"
	default n
	depends on XMC4_CCU40
	---help---
		Support CCU40 CC43

config XMC4_CCU41
	bool "Enable CCU41"
	default n
	---help---
		Support CCU41

config XMC4_CCU41_CC40
	bool "Enable CCU41 Slice 0 (not compatible with tickless)"
	default n
	depends on XMC4_CCU41 && !CONFIG_SCHED_TICKLESS
	---help---
		Support CCU41 CC40, cannot be activated when tickless OS is enabled

config XMC4_CCU41_CC41
	bool "Enable CCU41 Slice 1"
	default n
	depends on XMC4_CCU41
	---help---
		Support CCU41 CC41

config XMC4_CCU41_CC42
	bool "Enable CCU41 Slice 2"
	default n
	depends on XMC4_CCU41
	---help---
		Support CCU41 CC42

config XMC4_CCU41_CC43
	bool "Enable CCU41 Slice 3"
	default n
	depends on XMC4_CCU41
	---help---
		Support CCU41 CC43

config XMC4_CCU42
	bool "Enable CCU42"
	default n
	---help---
		Support CCU42

config XMC4_CCU42_CC40
	bool "Enable CCU42 Slice 0"
	default n
	depends on XMC4_CCU42
	---help---
		Support CCU42 CC40

config XMC4_CCU42_CC41
	bool "Enable CCU42 Slice 1"
	default n
	depends on XMC4_CCU42
	---help---
		Support CCU42 CC41

config XMC4_CCU42_CC42
	bool "Enable CCU42 Slice 2"
	default n
	depends on XMC4_CCU42
	---help---
		Support CCU42 CC42

config XMC4_CCU42_CC43
	bool "Enable CCU42 Slice 3"
	default n
	depends on XMC4_CCU42
	---help---
		Support CCU42 CC43

config XMC4_CCU43
	bool "Enable CCU43"
	default n
	---help---
		Support CCU43

config XMC4_CCU43_CC40
	bool "Enable CCU43 Slice 0"
	default n
	depends on XMC4_CCU43
	---help---
		Support CCU43 CC40

config XMC4_CCU43_CC41
	bool "Enable CCU43 Slice 1"
	default n
	depends on XMC4_CCU43
	---help---
		Support CCU43 CC41

config XMC4_CCU43_CC42
	bool "Enable CCU43 Slice 2"
	default n
	depends on XMC4_CCU43
	---help---
		Support CCU43 CC42

config XMC4_CCU43_CC43
	bool "Enable CCU43 Slice 3"
	default n
	depends on XMC4_CCU43
	---help---
		Support CCU43 CC43

endmenu # XMC4xxx PWM Configuration
