1
0
Fork 0
forked from nuttx/nuttx-update

arch/xtensa/src/esp32/esp32_serial.c: Fix some backward arguments. Correct 2-stop bit setting.

sched/sched/sched_waitid.c:  Could exit without leaving critical section on some error conditions.
sched/signal/sig_deliver.c: Update some comments.
This commit is contained in:
Gregory Nutt 2019-02-28 11:32:31 -06:00
parent b2f110e0b0
commit 3c0f6f4876
3 changed files with 25 additions and 14 deletions

View file

@ -1,7 +1,7 @@
/****************************************************************************
* arch/xtensa/src/esp32/esp32_serial.c
*
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2016-2017, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -505,7 +505,7 @@ static int esp32_setup(struct uart_dev_s *dev)
if (priv->stopbits2)
{
conf0 |= 3 << UART_STOP_BIT_NUM_S;
conf0 |= 2 << UART_STOP_BIT_NUM_S;
}
else
{
@ -594,17 +594,17 @@ static void esp32_shutdown(struct uart_dev_s *dev)
/* Revert pins to inputs and detach UART signals */
esp32_configgpio(priv->config->txpin, INPUT);
gpio_matrix_out(MATRIX_DETACH_OUT_SIG, priv->config->txsig, true, false);
gpio_matrix_out(priv->config->txsig, MATRIX_DETACH_OUT_SIG, true, false);
esp32_configgpio(priv->config->rxpin, INPUT);
gpio_matrix_in(MATRIX_DETACH_IN_LOW_PIN, priv->config->rxsig, false);
gpio_matrix_in(priv->config->rxsig, MATRIX_DETACH_IN_LOW_PIN, false);
#if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL)
esp32_configgpio(priv->config->rtspin, INPUT);
gpio_matrix_out(MATRIX_DETACH_OUT_SIG, priv->config->rtssig, true, false);
gpio_matrix_out(priv->config->rtssig, MATRIX_DETACH_OUT_SIG, true, false);
esp32_configgpio(priv->config->ctspin, INPUT);
gpio_matrix_in(MATRIX_DETACH_IN_LOW_PIN, priv->config->ctssig, false);
gpio_matrix_in(priv->config->ctssig, MATRIX_DETACH_IN_LOW_PIN, false);
#endif
/* Unconfigure and disable the UART */
@ -1168,7 +1168,8 @@ static bool esp32_txempty(struct uart_dev_s *dev)
{
struct esp32_dev_s *priv = (struct esp32_dev_s *)dev->priv;
return ((esp32_serialin(priv, UART_STATUS_OFFSET) & UART_TXFIFO_CNT_M) > 0);
return ((esp32_serialin(priv, UART_STATUS_OFFSET) & UART_TXFIFO_CNT_M)
== 0);
}
/****************************************************************************

View file

@ -1,7 +1,7 @@
/****************************************************************************
* sched/sched/sched_waitid.c
*
* Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015, 2017, 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -166,22 +166,26 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
int errcode;
int ret;
/* waitid() is a cancellation point */
(void)enter_cancellation_point();
/* MISSING LOGIC: If WNOHANG is provided in the options, then this function
* should returned immediately. However, there is no mechanism available now
* know if the thread has child: The children remember their parents (if
* CONFIG_SCHED_HAVE_PARENT) but the parents do not remember their children.
*/
#ifdef CONFIG_DEBUG_FEATURES
/* Only ID types P_PID and P_ALL are supported */
if (idtype != P_PID && idtype != P_ALL)
{
set_errno(ENOSYS);
return ERROR;
}
/* None of the options are supported except for WEXITED (which must be
* provided. Currently SIGCHILD always reports CLD_EXITED so we cannot
* distinguish any other events.
*/
#ifdef CONFIG_DEBUG_FEATURES
if (options != WEXITED)
{
set_errno(ENOSYS);
@ -189,6 +193,10 @@ int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options)
}
#endif
/* waitid() is a cancellation point */
(void)enter_cancellation_point();
/* Create a signal set that contains only SIGCHLD */
(void)sigemptyset(&set);

View file

@ -79,7 +79,9 @@ void nxsig_deliver(FAR struct tcb_s *stcb)
for (; ; )
{
/* Test if this task is already handling a signal */
/* Test if this task is already handling a signal (we don't permit
* nested signals on the same thread).
*/
flags = enter_critical_section();
if ((stcb->flags & TCB_FLAG_SIGNAL_ACTION) != 0)