mirror of
https://github.com/apache/nuttx.git
synced 2026-08-28 12:50:36 +00:00
arch: cxd56xx: Introduce driver-specific spinlock in cxd56_serial.c
Summary: - This commit introduces driver-specific spinlock in cxd56_serial.c to improve performance Impact: - SMP only Testing: - Tested with spresense:wifi and spresense:wifi_smp Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
611dbb6d22
commit
c024b414f8
1 changed files with 18 additions and 16 deletions
|
|
@ -39,6 +39,7 @@
|
|||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/serial/serial.h>
|
||||
#include <nuttx/spinlock.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
|
|
@ -85,6 +86,7 @@ struct up_dev_s
|
|||
bool dtrdir; /* DTR pin is the direction bit */
|
||||
#endif
|
||||
void *pmhandle;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -288,7 +290,7 @@ static inline void up_disableuartint(FAR struct up_dev_s *priv,
|
|||
{
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
if (ier)
|
||||
{
|
||||
*ier = priv->ier & UART_INTR_ALL;
|
||||
|
|
@ -296,7 +298,7 @@ static inline void up_disableuartint(FAR struct up_dev_s *priv,
|
|||
|
||||
priv->ier &= ~UART_INTR_ALL;
|
||||
up_serialout(priv, CXD56_UART_IMSC, priv->ier);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -307,10 +309,10 @@ static inline void up_restoreuartint(FAR struct up_dev_s *priv, uint32_t ier)
|
|||
{
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
priv->ier |= ier & UART_INTR_ALL;
|
||||
up_serialout(priv, CXD56_UART_IMSC, priv->ier);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -372,7 +374,7 @@ static void up_set_format(struct uart_dev_s *dev)
|
|||
uint32_t cr_en;
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
|
||||
/* Get the original state of control register */
|
||||
|
||||
|
|
@ -438,7 +440,7 @@ static void up_set_format(struct uart_dev_s *dev)
|
|||
#endif
|
||||
up_serialout(priv, CXD56_UART_CR, cr | cr_en);
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
|
||||
|
||||
|
|
@ -759,7 +761,7 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
break;
|
||||
}
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
|
||||
termiosp->c_cflag = ((priv->parity != 0) ? PARENB : 0) |
|
||||
((priv->parity == 1) ? PARODD : 0) |
|
||||
|
|
@ -793,7 +795,7 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
break;
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -808,7 +810,7 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
break;
|
||||
}
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
|
||||
switch (termiosp->c_cflag & CSIZE)
|
||||
{
|
||||
|
|
@ -853,25 +855,25 @@ static int up_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||
|
||||
up_set_format(dev);
|
||||
|
||||
spin_unlock_irqrestore(NLL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TIOCSBRK: /* BSD compatibility: Turn break on, unconditionally */
|
||||
{
|
||||
irqstate_t flags = spin_lock_irqsave(NULL);
|
||||
irqstate_t flags = spin_lock_irqsave(&priv->lock);
|
||||
up_enablebreaks(priv, true);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
break;
|
||||
|
||||
case TIOCCBRK: /* BSD compatibility: Turn break off, unconditionally */
|
||||
{
|
||||
irqstate_t flags;
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
up_enablebreaks(priv, false);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -922,7 +924,7 @@ static void up_rxint(FAR struct uart_dev_s *dev, bool enable)
|
|||
FAR struct up_dev_s *priv = (FAR struct up_dev_s *)dev->priv;
|
||||
irqstate_t flags;
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&priv->lock);
|
||||
if (enable)
|
||||
{
|
||||
#ifndef CONFIG_SUPPRESS_SERIAL_INTS
|
||||
|
|
@ -935,7 +937,7 @@ static void up_rxint(FAR struct uart_dev_s *dev, bool enable)
|
|||
}
|
||||
|
||||
up_serialout(priv, CXD56_UART_IMSC, priv->ier);
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue