mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 10:06:38 +08:00
Nucleo-F401RE: With these changes and the changes from previous commits, the basic Nucleo-F401RE NSH configuration is working.
This commit is contained in:
@@ -992,7 +992,11 @@ static struct up_dev_s g_uart8priv =
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This table lets us iterate over the configured USARTs */
|
||||
/* This table lets us iterate over the configured USARTs.
|
||||
*
|
||||
* REVISIT: The following logic is not valid for the STM32F401 which
|
||||
* supports 3 USARTS: USART1, USART2, and USART6.
|
||||
*/
|
||||
|
||||
static struct up_dev_s *uart_devs[STM32_NUSART] =
|
||||
{
|
||||
@@ -1153,7 +1157,7 @@ static int up_dma_nextrx(struct up_dev_s *priv)
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
static void up_set_format(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
uint32_t regval;
|
||||
|
||||
#ifdef CONFIG_STM32_STM32F30XX
|
||||
@@ -1315,7 +1319,7 @@ static void up_set_format(struct uart_dev_s *dev)
|
||||
|
||||
static int up_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
|
||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||
uint32_t regval;
|
||||
@@ -1418,7 +1422,7 @@ static int up_setup(struct uart_dev_s *dev)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static int up_dma_setup(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
int result;
|
||||
uint32_t regval;
|
||||
|
||||
@@ -1479,7 +1483,7 @@ static int up_dma_setup(struct uart_dev_s *dev)
|
||||
|
||||
static void up_shutdown(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
uint32_t regval;
|
||||
|
||||
/* Disable all interrupts */
|
||||
@@ -1505,7 +1509,7 @@ static void up_shutdown(struct uart_dev_s *dev)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static void up_dma_shutdown(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
|
||||
/* Perform the normal UART shutdown */
|
||||
|
||||
@@ -1539,7 +1543,7 @@ static void up_dma_shutdown(struct uart_dev_s *dev)
|
||||
|
||||
static int up_attach(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
int ret;
|
||||
|
||||
/* Attach and enable the IRQ */
|
||||
@@ -1568,7 +1572,7 @@ static int up_attach(struct uart_dev_s *dev)
|
||||
|
||||
static void up_detach(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
up_disable_irq(priv->irq);
|
||||
irq_detach(priv->irq);
|
||||
}
|
||||
@@ -1713,7 +1717,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
struct uart_dev_s *dev = inode->i_private;
|
||||
#endif
|
||||
#ifdef CONFIG_SERIAL_TERMIOS
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
#endif
|
||||
int ret = OK;
|
||||
|
||||
@@ -1722,7 +1726,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
#ifdef CONFIG_SERIAL_TIOCSERGSTRUCT
|
||||
case TIOCSERGSTRUCT:
|
||||
{
|
||||
struct up_dev_s *user = (struct up_dev_s*)arg;
|
||||
struct up_dev_s *user = (struct up_dev_s *)arg;
|
||||
if (!user)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
@@ -1910,7 +1914,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
#ifndef SERIAL_HAVE_ONLY_DMA
|
||||
static int up_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
uint32_t rdr;
|
||||
|
||||
/* Get the Rx byte */
|
||||
@@ -1939,7 +1943,7 @@ static int up_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
#ifndef SERIAL_HAVE_ONLY_DMA
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
irqstate_t flags;
|
||||
uint16_t ie;
|
||||
|
||||
@@ -1997,7 +2001,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable)
|
||||
#ifndef SERIAL_HAVE_ONLY_DMA
|
||||
static bool up_rxavailable(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
return ((up_serialin(priv, STM32_USART_SR_OFFSET) & USART_SR_RXNE) != 0);
|
||||
}
|
||||
#endif
|
||||
@@ -2015,7 +2019,7 @@ static bool up_rxavailable(struct uart_dev_s *dev)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static int up_dma_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
int c = 0;
|
||||
|
||||
if (up_dma_nextrx(priv) != priv->rxdmanext)
|
||||
@@ -2044,7 +2048,7 @@ static int up_dma_receive(struct uart_dev_s *dev, uint32_t *status)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static void up_dma_rxint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
|
||||
/* En/disable DMA reception.
|
||||
*
|
||||
@@ -2069,7 +2073,7 @@ static void up_dma_rxint(struct uart_dev_s *dev, bool enable)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static bool up_dma_rxavailable(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
|
||||
/* Compare our receive pointer to the current DMA pointer, if they
|
||||
* do not match, then there are bytes to be received.
|
||||
@@ -2089,7 +2093,7 @@ static bool up_dma_rxavailable(struct uart_dev_s *dev)
|
||||
|
||||
static void up_send(struct uart_dev_s *dev, int ch)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
#ifdef HAVE_RS485
|
||||
if (priv->rs485_dir_gpio != 0)
|
||||
stm32_gpiowrite(priv->rs485_dir_gpio, priv->rs485_dir_polarity);
|
||||
@@ -2107,7 +2111,7 @@ static void up_send(struct uart_dev_s *dev, int ch)
|
||||
|
||||
static void up_txint(struct uart_dev_s *dev, bool enable)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
irqstate_t flags;
|
||||
|
||||
/* USART transmit interrupts:
|
||||
@@ -2167,7 +2171,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable)
|
||||
|
||||
static bool up_txready(struct uart_dev_s *dev)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
|
||||
return ((up_serialin(priv, STM32_USART_SR_OFFSET) & USART_SR_TXE) != 0);
|
||||
}
|
||||
|
||||
@@ -2247,7 +2251,7 @@ static int up_interrupt_uart8(int irq, void *context)
|
||||
#ifdef SERIAL_HAVE_DMA
|
||||
static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
|
||||
{
|
||||
struct up_dev_s *priv = (struct up_dev_s*)arg;
|
||||
struct up_dev_s *priv = (struct up_dev_s *)arg;
|
||||
|
||||
if (priv->rxenable && up_dma_rxavailable(&priv->dev))
|
||||
{
|
||||
|
||||
@@ -63,6 +63,10 @@
|
||||
************************************************************************************/
|
||||
/* Make sure that we have not enabled more U[S]ARTs than are support by
|
||||
* the device.
|
||||
*
|
||||
* REVISIT: These should be replaced with the CONFIG_STM32_HAVE_USARTn now generated
|
||||
* by the Kconfig file. The following logic is not valid for the STM32F401 which
|
||||
* supports 3 USARTS: USART1, USART2, and USART6.
|
||||
*/
|
||||
|
||||
#if STM32_NUSART < 8
|
||||
|
||||
Reference in New Issue
Block a user