mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
add userled driver initialization
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
7864bf4870
commit
f51d6b8c72
@@ -1150,5 +1150,4 @@ int up_putc(int ch)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* HAVE_UART_DEVICE && USE_SERIALDRIVER */
|
#endif /* HAVE_UART_DEVICE && USE_SERIALDRIVER */
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ static bool spi_checkreg(struct xmc4_spidev_s *spi, bool wr,
|
|||||||
uint32_t value, uint32_t address);
|
uint32_t value, uint32_t address);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define spi_checkreg(spi, wr, value, address) (false)
|
# define spi_checkreg(spi, wr, value, address) (false)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline uint32_t spi_getreg(struct xmc4_spidev_s *spi,
|
static inline uint32_t spi_getreg(struct xmc4_spidev_s *spi,
|
||||||
@@ -233,7 +233,7 @@ static inline struct xmc4_spidev_s *spi_device(struct xmc4_spics_s *spics);
|
|||||||
#ifdef CONFIG_DEBUG_SPI_INFO
|
#ifdef CONFIG_DEBUG_SPI_INFO
|
||||||
static void spi_dumpregs(struct xmc4_spidev_s *spi, const char *msg);
|
static void spi_dumpregs(struct xmc4_spidev_s *spi, const char *msg);
|
||||||
#else
|
#else
|
||||||
# define spi_dumpregs(spi, msg)
|
# define spi_dumpregs(spi, msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void spi_flush(struct xmc4_spidev_s *spi);
|
static inline void spi_flush(struct xmc4_spidev_s *spi);
|
||||||
|
|||||||
@@ -320,10 +320,9 @@
|
|||||||
|
|
||||||
#define BOARD_SPI_DX USIC_DXC
|
#define BOARD_SPI_DX USIC_DXC
|
||||||
#define GPIO_SPI4_MOSI (GPIO_U2C0_DOUT0_2 | GPIO_PADA2_STRONGMEDIUM)
|
#define GPIO_SPI4_MOSI (GPIO_U2C0_DOUT0_2 | GPIO_PADA2_STRONGMEDIUM)
|
||||||
#define GPIO_SPI4_MISO (GPIO_U1C0_DX0C)
|
#define GPIO_SPI4_MISO (GPIO_U2C0_DX0C)
|
||||||
#define GPIO_SPI4_SCLK (GPIO_U2C0_SCLKOUT_1 | GPIO_PADA2_STRONGMEDIUM)
|
#define GPIO_SPI4_SCLK (GPIO_U2C0_SCLKOUT_1 | GPIO_PADA2_STRONGMEDIUM)
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ void xmc4_board_initialize(void)
|
|||||||
/* Configure on-board LEDs if LED support has been selected. */
|
/* Configure on-board LEDs if LED support has been selected. */
|
||||||
|
|
||||||
board_autoled_initialize();
|
board_autoled_initialize();
|
||||||
#else
|
|
||||||
board_userled_initialize();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_XMC4_USCI_SPI
|
#ifdef CONFIG_XMC4_USCI_SPI
|
||||||
|
|||||||
@@ -26,9 +26,15 @@
|
|||||||
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <nuttx/spi/spi_transfer.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_XMC4_USCI_SPI
|
||||||
|
# include <nuttx/spi/spi_transfer.h>
|
||||||
|
#endif
|
||||||
|
#ifdef CONFIG_USERLED
|
||||||
|
# include <nuttx/leds/userled.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -50,15 +56,25 @@ int xmc4_bringup(void)
|
|||||||
spi = xmc4_spibus_initialize(4);
|
spi = xmc4_spibus_initialize(4);
|
||||||
|
|
||||||
if (!spi)
|
if (!spi)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = spi_register(spi, 0);
|
ret = spi_register(spi, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USERLED
|
||||||
|
/* Register the LED driver */
|
||||||
|
|
||||||
|
ret = userled_lower_initialize("/dev/userleds");
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* boards/arm/xmc4/xmc4500-relax/src/xmc4_spi.c
|
* boards/arm/xmc4/xmc4700-relax/src/xmc4_spi.c
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* Name: xmc4_spidev_initialize
|
* Name: xmc4_spidev_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Called to configure SPI chip select GPIO pins for the FRDM-KL25Z board.
|
* Called to configure SPI chip select GPIO pins.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ void xmc4_spi4select(struct spi_dev_s *dev, uint32_t devid,
|
|||||||
* devid - Identifies the (logical) device
|
* devid - Identifies the (logical) device
|
||||||
*
|
*
|
||||||
* Returned Values:
|
* Returned Values:
|
||||||
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
|
* Bit-encoded SPI status (see include/nuttx/spi/spi.h).
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ uint8_t xmc4_spi4status(struct spi_dev_s *dev, uint32_t devid)
|
|||||||
* cmd - Determines where command or data should be selected.
|
* cmd - Determines where command or data should be selected.
|
||||||
*
|
*
|
||||||
* Returned Values:
|
* Returned Values:
|
||||||
* Bit-encoded SPI status (see include/nuttx/spi/spi.h.
|
* Bit-encoded SPI status (see include/nuttx/spi/spi.h).
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user