xmc4: fix some CS releted issues and remove empty files

This commit is contained in:
raiden00pl 2020-03-21 13:29:04 +01:00 committed by Xiang Xiao
parent d450f5ce77
commit e663f8ea2e
20 changed files with 105 additions and 131 deletions

View File

@ -126,18 +126,6 @@ ifeq ($(CONFIG_DEBUG_GPIO_INFO),y)
CHIP_CSRCS += xmc4_pindump.c
endif
ifeq ($(CONFIG_XMC4_DMA),y)
CHIP_CSRCS += xmc4_dma.c
endif
ifeq ($(CONFIG_PWM),y)
CHIP_CSRCS += xmc4_pwm.c
endif
ifeq ($(CONFIG_I2C),y)
CHIP_CSRCS += xmc4_i2c.c
endif
ifeq ($(CONFIG_XMC4_USCI_SPI),y)
CHIP_CSRCS += xmc4_spi.c
endif

View File

@ -50,6 +50,10 @@
#include <arch/xmc4/chip.h>
#include "hardware/xmc4_memorymap.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* If the common ARMv7-M vector handling logic is used, then it expects the
* following definition in this file that provides the number of supported external
* interrupts which, for this architecture, is provided in the arch/xmc4/chip.h
@ -58,20 +62,4 @@
#define ARMV7M_PERIPHERAL_INTERRUPTS XMC4_IRQ_NEXTINTS
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_XMC4_CHIP_H */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/xmc4/xmc4_clockconfig.h
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
@ -31,28 +31,28 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_XMC4_XMC4_CLOCKCONFIG_H
#define __ARCH_ARM_SRC_XMC4_XMC4_CLOCKCONFIG_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/************************************************************************************
/****************************************************************************
* Preprocessor Definitions
************************************************************************************/
****************************************************************************/
#define OFI_FREQUENCY 24000000 /* Frequency of internal Backup Clock Source */
#define OSI_FREQUENCY 32768 /* Frequency of internal Slow Clock Source */
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: xmc4_clock_configure

View File

@ -52,8 +52,8 @@
* Name: xmc4_clrpend
*
* Description:
* Clear a pending interrupt at the NVIC. This does not seem to be required
* for most interrupts. Don't know why...
* Clear a pending interrupt at the NVIC. This does not seem to be
* required for most interrupts. Don't know why...
*
* I keep it in a separate file so that it will not increase the footprint
* on Kinetis platforms that do not need this function.
@ -66,15 +66,15 @@ void xmc4_clrpend(int irq)
if (irq >= XMC4_IRQ_FIRST)
{
if (irq < (XMC4_IRQ_FIRST+32))
if (irq < (XMC4_IRQ_FIRST + 32))
{
putreg32(1 << (irq - XMC4_IRQ_FIRST), NVIC_IRQ0_31_CLRPEND);
}
else if (irq < (XMC4_IRQ_FIRST+64))
else if (irq < (XMC4_IRQ_FIRST + 64))
{
putreg32(1 << (irq - XMC4_IRQ_FIRST - 32), NVIC_IRQ32_63_CLRPEND);
}
else if (irq < (XMC4_IRQ_FIRST+96))
else if (irq < (XMC4_IRQ_FIRST +96))
{
putreg32(1 << (irq - XMC4_IRQ_FIRST - 64), NVIC_IRQ64_95_CLRPEND);
}

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/xmc4/xmc4_config.h
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
@ -31,25 +31,26 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_XMC4_XMC4_CONFIG_H
#define __ARCH_ARM_SRC_XMC4_XMC4_CONFIG_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <arch/board/board.h>
#include "chip.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Configuration ************************************************************/
/* Configuration *********************************************************************/
/* Make sure that no unsupported UARTs are enabled */
#ifndef CONFIG_XMC4_USIC0
@ -101,8 +102,8 @@
# define HAVE_UART_DEVICE 1
#endif
/* Is there a serial console? There should be at most one defined. It could be on
* any UARTn, n=0,1,2,3,4,5
/* Is there a serial console? There should be at most one defined.
* It could be on any UARTn, n=0,1,2,3,4,5
*/
#undef HAVE_UART_CONSOLE
@ -200,20 +201,4 @@
# define CONFIG_XMC4_UART5PRIO NVIC_SYSH_PRIORITY_DEFAULT
#endif
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Inline Functions
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_XMC4_XMC4_CONFIG_H */

View File

@ -1 +0,0 @@

View File

@ -98,10 +98,9 @@ extern "C"
#define EXTERN extern
#endif
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: xmc4_dmainitialize

View File

@ -1 +0,0 @@

View File

@ -378,9 +378,10 @@ int xmc4_uart_configure(enum usic_channel_e channel,
* a data word
*/
regval &= ~(USIC_TBCTR_DPTR_MASK | USIC_TBCTR_LIMIT_MASK | USIC_TBCTR_STBTEN |
USIC_TBCTR_SIZE_MASK | USIC_TBCTR_LOF);
regval |= (USIC_TBCTR_DPTR(16) | USIC_TBCTR_LIMIT(1) | USIC_TBCTR_SIZE_16);
regval &= ~(USIC_TBCTR_DPTR_MASK | USIC_TBCTR_LIMIT_MASK |
USIC_TBCTR_STBTEN | USIC_TBCTR_SIZE_MASK | USIC_TBCTR_LOF);
regval |= (USIC_TBCTR_DPTR(16) | USIC_TBCTR_LIMIT(1) |
USIC_TBCTR_SIZE_16);
putreg32(regval, base + XMC4_USIC_TBCTR_OFFSET);
/* Disable the receive FIFO */
@ -399,8 +400,10 @@ int xmc4_uart_configure(enum usic_channel_e channel,
* of a new data word
*/
regval &= ~(USIC_RBCTR_DPTR_MASK | USIC_RBCTR_LIMIT_MASK | USIC_RBCTR_SIZE_MASK);
regval |= (USIC_RBCTR_DPTR(0) | USIC_RBCTR_LIMIT(15) | USIC_RBCTR_SIZE_16 | USIC_RBCTR_LOF);
regval &= ~(USIC_RBCTR_DPTR_MASK | USIC_RBCTR_LIMIT_MASK |
USIC_RBCTR_SIZE_MASK);
regval |= (USIC_RBCTR_DPTR(0) | USIC_RBCTR_LIMIT(15) | USIC_RBCTR_SIZE_16 |
USIC_RBCTR_LOF);
putreg32(regval, base + XMC4_USIC_RBCTR_OFFSET);
/* Start UART */

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/xmc4/xmc4_mpuinit.h
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
@ -31,20 +31,20 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_XMC4_XMC4_MPUINIT_H
#define __ARCH_ARM_SRC_XMC4_XMC4_MPUINIT_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: xmc4_mpuinitialize

View File

@ -1 +0,0 @@

View File

@ -70,7 +70,7 @@ extern "C"
#endif
/************************************************************************************
* Public Functions
* Public Function Prototypes
************************************************************************************/
/************************************************************************************

View File

@ -64,7 +64,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Some sanity checks *******************************************************/
/* Is there at least one UART enabled and configured as a RS-232 device? */
#ifndef HAVE_UART_DEVICE
@ -348,7 +350,7 @@ static uart_dev_t g_uart0port =
{
.size = CONFIG_UART0_TXBUFSIZE,
.buffer = g_uart0txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart0priv,
};
@ -383,7 +385,7 @@ static uart_dev_t g_uart1port =
{
.size = CONFIG_UART1_TXBUFSIZE,
.buffer = g_uart1txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart1priv,
};
@ -418,7 +420,7 @@ static uart_dev_t g_uart2port =
{
.size = CONFIG_UART2_TXBUFSIZE,
.buffer = g_uart2txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart2priv,
};
@ -453,7 +455,7 @@ static uart_dev_t g_uart3port =
{
.size = CONFIG_UART3_TXBUFSIZE,
.buffer = g_uart3txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart3priv,
};
@ -488,7 +490,7 @@ static uart_dev_t g_uart4port =
{
.size = CONFIG_UART4_TXBUFSIZE,
.buffer = g_uart4txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart4priv,
};
@ -523,7 +525,7 @@ static uart_dev_t g_uart5port =
{
.size = CONFIG_UART5_TXBUFSIZE,
.buffer = g_uart5txbuffer,
},
},
.ops = &g_uart_ops,
.priv = &g_uart5priv,
};
@ -557,8 +559,9 @@ static inline void xmc4_serialout(struct xmc4_dev_s *priv,
* Name: xmc4_modifyreg
****************************************************************************/
static inline void xmc4_modifyreg(struct xmc4_dev_s *priv, unsigned int offset,
uint32_t setbits, uint32_t clrbits)
static inline void xmc4_modifyreg(struct xmc4_dev_s *priv, unsigned
int offset, uint32_t setbits,
uint32_t clrbits)
{
irqstate_t flags;
uintptr_t regaddr = priv->uartbase + offset;
@ -678,14 +681,15 @@ static void xmc4_shutdown(struct uart_dev_s *dev)
* Name: xmc4_attach
*
* Description:
* Configure the UART to operation in interrupt driven mode. This method is
* called when the serial port is opened. Normally, this is just after the
* Configure the UART to operation in interrupt driven mode. This method
* is called when the serial port is opened. Normally, this is just after
* the setup() method is called, however, the serial console may operate in
* a non-interrupt driven mode during the boot phase.
*
* RX and TX interrupts are not enabled when by the attach method (unless the
* hardware supports multiple levels of interrupt enabling). The RX and TX
* interrupts are not enabled until the txint() and rxint() methods are called.
* RX and TX interrupts are not enabled when by the attach method (unless
* the hardware supports multiple levels of interrupt enabling).
* The RX and TX interrupts are not enabled until the txint() and rxint()
* methods are called.
*
****************************************************************************/
@ -712,8 +716,8 @@ static int xmc4_attach(struct uart_dev_s *dev)
*
* Description:
* Detach UART interrupts. This method is called when the serial port is
* closed normally just before the shutdown method is called. The exception
* is the serial console which is never shutdown.
* closed normally just before the shutdown method is called.
* The exception is the serial console which is never shutdown.
*
****************************************************************************/
@ -885,8 +889,8 @@ static void xmc4_rxint(struct uart_dev_s *dev, bool enable)
if (enable)
{
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
/* Receive an interrupt when their is anything in the Rx data register (or an Rx
* timeout occurs).
/* Receive an interrupt when their is anything in the Rx data register
* (or an Rx timeout occurs).
*/
priv->ccr |= CCR_RX_EVENTS;

View File

@ -121,7 +121,8 @@ FAR struct spi_dev_s *xmc4_spibus_initialize(int channel);
****************************************************************************/
#ifdef CONFIG_XMC4_SPI0
void xmc4_spi0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi0select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi0status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
@ -129,7 +130,8 @@ int xmc4_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_XMC4_SPI1
void xmc4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi1select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi1status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
@ -137,7 +139,8 @@ int xmc4_spi1cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_XMC4_SPI2
void xmc4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi2select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi2status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
@ -145,7 +148,8 @@ int xmc4_spi2cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_XMC4_SPI3
void xmc4_spi3select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi3select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi3status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
@ -153,7 +157,8 @@ int xmc4_spi3cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_XMC4_SPI4
void xmc4_spi4select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi4select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi4status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
@ -161,7 +166,8 @@ int xmc4_spi4cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);
#endif
#ifdef CONFIG_XMC4_SPI5
void xmc4_spi5select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected);
void xmc4_spi5select(FAR struct spi_dev_s *dev, uint32_t devid,
bool selected);
uint8_t xmc4_spi5status(FAR struct spi_dev_s *dev, uint32_t devid);
#ifdef CONFIG_SPI_CMDDATA
int xmc4_spi5cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd);

View File

@ -73,9 +73,10 @@ static void go_nx_start(void *pv, unsigned int nbytes)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Memory Map ***************************************************************/
/*
* 0x0000:0000 - Beginning of the internal FLASH. Address of vectors.
/* 0x0000:0000 - Beginning of the internal FLASH. Address of vectors.
* Mapped as boot memory address 0x0000:0000 at reset.
* 0x07ff:ffff - End of flash region (assuming the max of 2MiB of FLASH).
* 0x1fff:0000 - Start of internal SRAM and start of .data (_sdata)
@ -119,7 +120,6 @@ const uintptr_t g_idle_topstack = HEAP_BASE;
* Private Functions
****************************************************************************/
#ifdef CONFIG_ARMV7M_STACKCHECK
/* we need to get r10 set before we can allow instrumentation calls */
@ -142,7 +142,8 @@ void __start(void) __attribute__ ((no_instrument_function));
* done, the processor reserves space on the stack for the FP state,
* but does not save that state information to the stack.
*
* Software must not change the value of the ASPEN bit or LSPEN bit while either:
* Software must not change the value of the ASPEN bit or LSPEN bit while
* either:
* - the CPACR permits access to CP10 and CP11, that give access to the FP
* extension, or
* - the CONTROL.FPCA bit is set to 1
@ -176,7 +177,7 @@ static inline void xmc4_fpu_config(void)
/* Enable full access to CP10 and CP11 */
regval = getreg32(NVIC_CPACR);
regval |= ((3 << (2*10)) | (3 << (2*11)));
regval |= ((3 << (2 * 10)) | (3 << (2 * 11)));
putreg32(regval, NVIC_CPACR);
}
@ -206,7 +207,7 @@ static inline void xmc4_fpu_config(void)
/* Enable full access to CP10 and CP11 */
regval = getreg32(NVIC_CPACR);
regval |= ((3 << (2*10)) | (3 << (2*11)));
regval |= ((3 << (2 * 10)) | (3 << (2 * 11)));
putreg32(regval, NVIC_CPACR);
}
@ -312,10 +313,12 @@ void __start(void)
#ifdef CONFIG_ARMV7M_STACKCHECK
/* Set the stack limit before we attempt to call any functions */
__asm__ volatile ("sub r10, sp, %0" : : "r" (CONFIG_IDLETHREAD_STACKSIZE - 64) : );
__asm__ volatile ("sub r10, sp, %0" : : "r"
(CONFIG_IDLETHREAD_STACKSIZE - 64) :);
#endif
/* Disable the watchdog timer */
/* TODO - add logic to disable the watchdog timer */
/* Enable unaligned memory access */

View File

@ -43,7 +43,7 @@
#include <nuttx/config.h>
/************************************************************************************
* Public Functions
* Public Function Prototypes
************************************************************************************/
/************************************************************************************

View File

@ -1,4 +1,4 @@
/************************************************************************************
/****************************************************************************
* arch/arm/src/xmc4/xmc4_userspace.h
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
@ -31,20 +31,20 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __ARCH_ARM_SRC_XMC4_XMC4_USERSPACE_H
#define __ARCH_ARM_SRC_XMC4_XMC4_USERSPACE_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: xmc4_userspace

View File

@ -1,7 +1,7 @@
README for the XMC4500 Relax
============================
The directory provides board support for the Infinion XMC4500 Relax v1
The directory provides board support for the Infineon XMC4500 Relax v1
boards. There are to variants of this board: There is a Lite version
that has fewer features, for example, no 32.768KHz crystal.

View File

@ -93,7 +93,7 @@
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Functions
* Public Function Prototypes
****************************************************************************/
/****************************************************************************

View File

@ -90,10 +90,10 @@ void weak_function xmc4_spidev_initialize(void)
*
* Description:
* These external functions must be provided by board-specific logic. They
* are implementations of the select, status, and cmddata methods of the SPI
* interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h). All
* other methods including xmc4_spibus_initialize()) are provided by common
* Kinetis logic. To use this common SPI logic on your board:
* are implementations of the select, status, and cmddata methods of the
* SPI interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h).
* All other methods including xmc4_spibus_initialize()) are provided by
* common xmc4 logic. To use this common SPI logic on your board:
*
* 1. Provide logic in xmc4_boardinitialize() to configure SPI chip select
* pins.
@ -113,6 +113,7 @@ void weak_function xmc4_spidev_initialize(void)
* the SPI MMC/SD driver).
*
****************************************************************************/
/****************************************************************************
* Name: xmc4_spi[n]select
*