Merge remote-tracking branch 'origin/master' into ieee802154
This commit is contained in:
commit
9fb2fed90e
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32/stm32_can.c
|
* arch/arm/src/stm32/stm32_can.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2016-2017 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved.
|
* Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved.
|
||||||
@ -74,10 +74,6 @@
|
|||||||
|
|
||||||
#define INAK_TIMEOUT 65535
|
#define INAK_TIMEOUT 65535
|
||||||
|
|
||||||
/* Mailboxes ****************************************************************/
|
|
||||||
|
|
||||||
#define CAN_ALL_MAILBOXES (CAN_TSR_TME0 | CAN_TSR_TME1 | CAN_TSR_TME2)
|
|
||||||
|
|
||||||
/* Bit timing ***************************************************************/
|
/* Bit timing ***************************************************************/
|
||||||
|
|
||||||
#define CAN_BIT_QUANTA (CONFIG_CAN_TSEG1 + CONFIG_CAN_TSEG2 + 1)
|
#define CAN_BIT_QUANTA (CONFIG_CAN_TSEG1 + CONFIG_CAN_TSEG2 + 1)
|
||||||
@ -172,6 +168,12 @@ static int stm32can_bittiming(FAR struct stm32_can_s *priv);
|
|||||||
static int stm32can_cellinit(FAR struct stm32_can_s *priv);
|
static int stm32can_cellinit(FAR struct stm32_can_s *priv);
|
||||||
static int stm32can_filterinit(FAR struct stm32_can_s *priv);
|
static int stm32can_filterinit(FAR struct stm32_can_s *priv);
|
||||||
|
|
||||||
|
/* TX mailbox status */
|
||||||
|
|
||||||
|
static bool stm32can_txmb0empty(uint32_t tsr_regval);
|
||||||
|
static bool stm32can_txmb1empty(uint32_t tsr_regval);
|
||||||
|
static bool stm32can_txmb2empty(uint32_t tsr_regval);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -1170,15 +1172,15 @@ static int stm32can_send(FAR struct can_dev_s *dev,
|
|||||||
/* Select one empty transmit mailbox */
|
/* Select one empty transmit mailbox */
|
||||||
|
|
||||||
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
||||||
if ((regval & CAN_TSR_TME0) != 0 && (regval & CAN_TSR_RQCP0) == 0)
|
if (stm32can_txmb0empty(regval))
|
||||||
{
|
{
|
||||||
txmb = 0;
|
txmb = 0;
|
||||||
}
|
}
|
||||||
else if ((regval & CAN_TSR_TME1) != 0 && (regval & CAN_TSR_RQCP1) == 0)
|
else if (stm32can_txmb1empty(regval))
|
||||||
{
|
{
|
||||||
txmb = 1;
|
txmb = 1;
|
||||||
}
|
}
|
||||||
else if ((regval & CAN_TSR_TME2) != 0 && (regval & CAN_TSR_RQCP2) == 0)
|
else if (stm32can_txmb2empty(regval))
|
||||||
{
|
{
|
||||||
txmb = 2;
|
txmb = 2;
|
||||||
}
|
}
|
||||||
@ -1321,7 +1323,8 @@ static bool stm32can_txready(FAR struct can_dev_s *dev)
|
|||||||
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
||||||
caninfo("CAN%d TSR: %08x\n", priv->port, regval);
|
caninfo("CAN%d TSR: %08x\n", priv->port, regval);
|
||||||
|
|
||||||
return (regval & CAN_ALL_MAILBOXES) != 0;
|
return stm32can_txmb0empty(regval) || stm32can_txmb1empty(regval) ||
|
||||||
|
stm32can_txmb2empty(regval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1352,7 +1355,8 @@ static bool stm32can_txempty(FAR struct can_dev_s *dev)
|
|||||||
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
regval = stm32can_getreg(priv, STM32_CAN_TSR_OFFSET);
|
||||||
caninfo("CAN%d TSR: %08x\n", priv->port, regval);
|
caninfo("CAN%d TSR: %08x\n", priv->port, regval);
|
||||||
|
|
||||||
return (regval & CAN_ALL_MAILBOXES) == CAN_ALL_MAILBOXES;
|
return stm32can_txmb0empty(regval) && stm32can_txmb1empty(regval) &&
|
||||||
|
stm32can_txmb2empty(regval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -1553,15 +1557,10 @@ static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
|
|
||||||
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP0);
|
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP0);
|
||||||
|
|
||||||
/* Check for errors */
|
/* Tell the upper half that the transfer is finished. */
|
||||||
|
|
||||||
if ((regval & CAN_TSR_TXOK0) != 0)
|
|
||||||
{
|
|
||||||
/* Tell the upper half that the tansfer is finished. */
|
|
||||||
|
|
||||||
(void)can_txdone(dev);
|
(void)can_txdone(dev);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for RQCP1: Request completed mailbox 1 */
|
/* Check for RQCP1: Request completed mailbox 1 */
|
||||||
|
|
||||||
@ -1573,15 +1572,10 @@ static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
|
|
||||||
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP1);
|
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP1);
|
||||||
|
|
||||||
/* Check for errors */
|
/* Tell the upper half that the transfer is finished. */
|
||||||
|
|
||||||
if ((regval & CAN_TSR_TXOK1) != 0)
|
|
||||||
{
|
|
||||||
/* Tell the upper half that the tansfer is finished. */
|
|
||||||
|
|
||||||
(void)can_txdone(dev);
|
(void)can_txdone(dev);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for RQCP2: Request completed mailbox 2 */
|
/* Check for RQCP2: Request completed mailbox 2 */
|
||||||
|
|
||||||
@ -1593,15 +1587,10 @@ static int stm32can_txinterrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
|
|
||||||
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP2);
|
stm32can_putreg(priv, STM32_CAN_TSR_OFFSET, CAN_TSR_RQCP2);
|
||||||
|
|
||||||
/* Check for errors */
|
/* Tell the upper half that the transfer is finished. */
|
||||||
|
|
||||||
if ((regval & CAN_TSR_TXOK2) != 0)
|
|
||||||
{
|
|
||||||
/* Tell the upper half that the tansfer is finished. */
|
|
||||||
|
|
||||||
(void)can_txdone(dev);
|
(void)can_txdone(dev);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -2111,6 +2100,57 @@ static int stm32can_delstdfilter(FAR struct stm32_can_s *priv, int arg)
|
|||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32can_txmb0empty
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* tsr_regval - value of CAN transmit status register
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns true if mailbox 0 is empty and can be used for sending.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static bool stm32can_txmb0empty(uint32_t tsr_regval)
|
||||||
|
{
|
||||||
|
return (tsr_regval & CAN_TSR_TME0) != 0 &&
|
||||||
|
(tsr_regval & CAN_TSR_RQCP0) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32can_txmb1empty
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* tsr_regval - value of CAN transmit status register
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns true if mailbox 1 is empty and can be used for sending.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static bool stm32can_txmb1empty(uint32_t tsr_regval)
|
||||||
|
{
|
||||||
|
return (tsr_regval & CAN_TSR_TME1) != 0 &&
|
||||||
|
(tsr_regval & CAN_TSR_RQCP1) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: stm32can_txmb2empty
|
||||||
|
*
|
||||||
|
* Input Parameter:
|
||||||
|
* tsr_regval - value of CAN transmit status register
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Returns true if mailbox 2 is empty and can be used for sending.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static bool stm32can_txmb2empty(uint32_t tsr_regval)
|
||||||
|
{
|
||||||
|
return (tsr_regval & CAN_TSR_TME2) != 0 &&
|
||||||
|
(tsr_regval & CAN_TSR_RQCP2) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
@ -653,6 +653,8 @@ static int null_enqueuebuffer(FAR struct audio_lowerhalf_s *dev,
|
|||||||
FAR struct null_dev_s *priv = (FAR struct null_dev_s *)dev;
|
FAR struct null_dev_s *priv = (FAR struct null_dev_s *)dev;
|
||||||
bool done;
|
bool done;
|
||||||
|
|
||||||
|
DEBUGASSERT(priv && apb && priv->dev.upper);
|
||||||
|
|
||||||
audinfo("apb=%p curbyte=%d nbytes=%d\n", apb, apb->curbyte, apb->nbytes);
|
audinfo("apb=%p curbyte=%d nbytes=%d\n", apb, apb->curbyte, apb->nbytes);
|
||||||
|
|
||||||
/* Say that we consumed all of the data */
|
/* Say that we consumed all of the data */
|
||||||
@ -663,10 +665,6 @@ static int null_enqueuebuffer(FAR struct audio_lowerhalf_s *dev,
|
|||||||
|
|
||||||
done = ((apb->flags & AUDIO_APB_FINAL) != 0);
|
done = ((apb->flags & AUDIO_APB_FINAL) != 0);
|
||||||
|
|
||||||
/* And return the buffer to the upper level */
|
|
||||||
|
|
||||||
DEBUGASSERT(priv && apb && priv->dev.upper);
|
|
||||||
|
|
||||||
/* The buffer belongs to to an upper level. Just forward the event to
|
/* The buffer belongs to to an upper level. Just forward the event to
|
||||||
* the next level up.
|
* the next level up.
|
||||||
*/
|
*/
|
||||||
|
@ -345,6 +345,7 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
bch->refs++;
|
bch->refs++;
|
||||||
*bchr = bch;
|
*bchr = bch;
|
||||||
|
ret = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bchlib_semgive(bch);
|
bchlib_semgive(bch);
|
||||||
|
@ -201,7 +201,7 @@ static inline int ajoy_takesem(sem_t *sem)
|
|||||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||||
static void ajoy_enable(FAR struct ajoy_upperhalf_s *priv)
|
static void ajoy_enable(FAR struct ajoy_upperhalf_s *priv)
|
||||||
{
|
{
|
||||||
FAR const struct ajoy_lowerhalf_s *lower = priv->au_lower;
|
FAR const struct ajoy_lowerhalf_s *lower;
|
||||||
FAR struct ajoy_open_s *opriv;
|
FAR struct ajoy_open_s *opriv;
|
||||||
ajoy_buttonset_t press;
|
ajoy_buttonset_t press;
|
||||||
ajoy_buttonset_t release;
|
ajoy_buttonset_t release;
|
||||||
@ -210,8 +210,9 @@ static void ajoy_enable(FAR struct ajoy_upperhalf_s *priv)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(priv && priv->au_lower);
|
DEBUGASSERT(priv);
|
||||||
lower = priv->au_lower;
|
lower = priv->au_lower;
|
||||||
|
DEBUGASSERT(lower);
|
||||||
|
|
||||||
/* This routine is called both task level and interrupt level, so
|
/* This routine is called both task level and interrupt level, so
|
||||||
* interrupts must be disabled.
|
* interrupts must be disabled.
|
||||||
@ -295,7 +296,7 @@ static void ajoy_interrupt(FAR const struct ajoy_lowerhalf_s *lower,
|
|||||||
|
|
||||||
static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
|
static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
|
||||||
{
|
{
|
||||||
FAR const struct ajoy_lowerhalf_s *lower = priv->au_lower;
|
FAR const struct ajoy_lowerhalf_s *lower;
|
||||||
FAR struct ajoy_open_s *opriv;
|
FAR struct ajoy_open_s *opriv;
|
||||||
ajoy_buttonset_t sample;
|
ajoy_buttonset_t sample;
|
||||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||||
@ -308,8 +309,9 @@ static void ajoy_sample(FAR struct ajoy_upperhalf_s *priv)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(priv && priv->au_lower);
|
DEBUGASSERT(priv);
|
||||||
lower = priv->au_lower;
|
lower = priv->au_lower;
|
||||||
|
DEBUGASSERT(lower);
|
||||||
|
|
||||||
/* This routine is called both task level and interrupt level, so
|
/* This routine is called both task level and interrupt level, so
|
||||||
* interrupts must be disabled.
|
* interrupts must be disabled.
|
||||||
|
@ -201,7 +201,7 @@ static inline int djoy_takesem(sem_t *sem)
|
|||||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||||
static void djoy_enable(FAR struct djoy_upperhalf_s *priv)
|
static void djoy_enable(FAR struct djoy_upperhalf_s *priv)
|
||||||
{
|
{
|
||||||
FAR const struct djoy_lowerhalf_s *lower = priv->du_lower;
|
FAR const struct djoy_lowerhalf_s *lower;
|
||||||
FAR struct djoy_open_s *opriv;
|
FAR struct djoy_open_s *opriv;
|
||||||
djoy_buttonset_t press;
|
djoy_buttonset_t press;
|
||||||
djoy_buttonset_t release;
|
djoy_buttonset_t release;
|
||||||
@ -210,8 +210,9 @@ static void djoy_enable(FAR struct djoy_upperhalf_s *priv)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(priv && priv->du_lower);
|
DEBUGASSERT(priv);
|
||||||
lower = priv->du_lower;
|
lower = priv->du_lower;
|
||||||
|
DEBUGASSERT(lower);
|
||||||
|
|
||||||
/* This routine is called both task level and interrupt level, so
|
/* This routine is called both task level and interrupt level, so
|
||||||
* interrupts must be disabled.
|
* interrupts must be disabled.
|
||||||
@ -295,7 +296,7 @@ static void djoy_interrupt(FAR const struct djoy_lowerhalf_s *lower,
|
|||||||
|
|
||||||
static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
|
static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
|
||||||
{
|
{
|
||||||
FAR const struct djoy_lowerhalf_s *lower = priv->du_lower;
|
FAR const struct djoy_lowerhalf_s *lower;
|
||||||
FAR struct djoy_open_s *opriv;
|
FAR struct djoy_open_s *opriv;
|
||||||
djoy_buttonset_t sample;
|
djoy_buttonset_t sample;
|
||||||
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
#if !defined(CONFIG_DISABLE_POLL) || !defined(CONFIG_DISABLE_SIGNALS)
|
||||||
@ -308,8 +309,9 @@ static void djoy_sample(FAR struct djoy_upperhalf_s *priv)
|
|||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUGASSERT(priv && priv->du_lower);
|
DEBUGASSERT(priv);
|
||||||
lower = priv->du_lower;
|
lower = priv->du_lower;
|
||||||
|
DEBUGASSERT(lower);
|
||||||
|
|
||||||
/* This routine is called both task level and interrupt level, so
|
/* This routine is called both task level and interrupt level, so
|
||||||
* interrupts must be disabled.
|
* interrupts must be disabled.
|
||||||
|
@ -141,13 +141,16 @@ static int ubxmdm_ioctl(FAR struct file* filep,
|
|||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode* inode = filep->f_inode;
|
FAR struct inode* inode = filep->f_inode;
|
||||||
FAR struct ubxmdm_upper* upper = inode->i_private;
|
FAR struct ubxmdm_upper* upper;
|
||||||
FAR struct ubxmdm_lower* lower = upper->lower;
|
FAR struct ubxmdm_lower* lower;
|
||||||
int ret;
|
int ret;
|
||||||
FAR struct ubxmdm_status* status;
|
FAR struct ubxmdm_status* status;
|
||||||
|
|
||||||
m_info("cmd: %d arg: %ld\n", cmd, arg);
|
m_info("cmd: %d arg: %ld\n", cmd, arg);
|
||||||
DEBUGASSERT(upper && lower);
|
upper = inode->i_private;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->lower;
|
||||||
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
@ -320,8 +323,9 @@ void ubxmdm_unregister(FAR void *handle)
|
|||||||
FAR struct ubxmdm_lower *lower;
|
FAR struct ubxmdm_lower *lower;
|
||||||
|
|
||||||
upper = (FAR struct ubxmdm_upper*) handle;
|
upper = (FAR struct ubxmdm_upper*) handle;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
lower = upper->lower;
|
lower = upper->lower;
|
||||||
DEBUGASSERT(upper && lower);
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
m_info("Unregistering: %s\n", upper->path);
|
m_info("Unregistering: %s\n", upper->path);
|
||||||
|
|
||||||
|
@ -318,11 +318,13 @@ static ssize_t pwm_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
#ifdef CONFIG_PWM_PULSECOUNT
|
#ifdef CONFIG_PWM_PULSECOUNT
|
||||||
static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
||||||
{
|
{
|
||||||
FAR struct pwm_lowerhalf_s *lower = upper->dev;
|
FAR struct pwm_lowerhalf_s *lower;
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
DEBUGASSERT(upper != NULL && lower->ops->start != NULL);
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->dev;
|
||||||
|
DEBUGASSERT(lower != NULL && lower->ops->start != NULL);
|
||||||
|
|
||||||
/* Verify that the PWM is not already running */
|
/* Verify that the PWM is not already running */
|
||||||
|
|
||||||
@ -385,10 +387,12 @@ static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
|||||||
#else
|
#else
|
||||||
static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
static int pwm_start(FAR struct pwm_upperhalf_s *upper, unsigned int oflags)
|
||||||
{
|
{
|
||||||
FAR struct pwm_lowerhalf_s *lower = upper->dev;
|
FAR struct pwm_lowerhalf_s *lower;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
DEBUGASSERT(upper != NULL && lower->ops->start != NULL);
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->dev;
|
||||||
|
DEBUGASSERT(lower != NULL && lower->ops->start != NULL);
|
||||||
|
|
||||||
/* Verify that the PWM is not already running */
|
/* Verify that the PWM is not already running */
|
||||||
|
|
||||||
|
@ -201,6 +201,7 @@ config MS58XX_I2C_FREQUENCY
|
|||||||
config MS58XX_VDD
|
config MS58XX_VDD
|
||||||
int "MEAS MS58XX VDD"
|
int "MEAS MS58XX VDD"
|
||||||
default 30
|
default 30
|
||||||
|
depends on MS58XX
|
||||||
|
|
||||||
config MPL115A
|
config MPL115A
|
||||||
bool "Freescale MPL115A Barometer Sensor support"
|
bool "Freescale MPL115A Barometer Sensor support"
|
||||||
|
@ -201,10 +201,10 @@ static int hts221_do_transfer(FAR struct hts221_dev_s *priv,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = up_i2creset(priv->i2c);
|
ret = I2C_RESET(priv->i2c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
hts221_dbg("up_i2creset failed: %d\n", ret);
|
hts221_dbg("I2C_RESET failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -892,7 +892,7 @@ static int hts221_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct hts221_dev_s *priv = inode->i_private;
|
FAR struct hts221_dev_s *priv = inode->i_private;
|
||||||
int32_t ret = 0;
|
int ret = OK;
|
||||||
|
|
||||||
while (sem_wait(&priv->devsem) != 0)
|
while (sem_wait(&priv->devsem) != 0)
|
||||||
{
|
{
|
||||||
@ -932,7 +932,7 @@ static int hts221_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -ENOTTY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,9 +131,11 @@ static int lis2dh_get_reading(FAR struct lis2dh_dev_s *dev,
|
|||||||
FAR struct lis2dh_vector_s *res, bool force_read);
|
FAR struct lis2dh_vector_s *res, bool force_read);
|
||||||
static int lis2dh_powerdown(FAR struct lis2dh_dev_s *dev);
|
static int lis2dh_powerdown(FAR struct lis2dh_dev_s *dev);
|
||||||
static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev);
|
static int lis2dh_reboot(FAR struct lis2dh_dev_s *dev);
|
||||||
|
#ifndef CONFIG_DISABLE_POLL
|
||||||
static int lis2dh_poll(FAR struct file *filep,
|
static int lis2dh_poll(FAR struct file *filep,
|
||||||
FAR struct pollfd *fds, bool setup);
|
FAR struct pollfd *fds, bool setup);
|
||||||
static void lis2dh_notify(FAR struct lis2dh_dev_s *priv);
|
static void lis2dh_notify(FAR struct lis2dh_dev_s *priv);
|
||||||
|
#endif
|
||||||
static int lis2dh_int_handler(int irq, FAR void *context,
|
static int lis2dh_int_handler(int irq, FAR void *context,
|
||||||
FAR void *arg);
|
FAR void *arg);
|
||||||
static int lis2dh_setup(FAR struct lis2dh_dev_s *dev,
|
static int lis2dh_setup(FAR struct lis2dh_dev_s *dev,
|
||||||
@ -1614,10 +1616,10 @@ static int lis2dh_access(FAR struct lis2dh_dev_s *dev, uint8_t subaddr,
|
|||||||
{
|
{
|
||||||
/* Some error. Try to reset I2C bus and keep trying. */
|
/* Some error. Try to reset I2C bus and keep trying. */
|
||||||
#ifdef CONFIG_I2C_RESET
|
#ifdef CONFIG_I2C_RESET
|
||||||
int ret = up_i2creset(dev->i2c);
|
int ret = I2C_RESET(dev->i2c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
lis2dh_dbg("up_i2creset failed: %d\n", ret);
|
lis2dh_dbg("I2C_RESET failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -257,10 +257,10 @@ static int lps25h_do_transfer(FAR struct lps25h_dev_s *dev,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = up_i2creset(dev->i2c);
|
ret = I2C_RESET(dev->i2c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
lps25h_dbg("up_i2creset failed: %d\n", ret);
|
lps25h_dbg("I2C_RESET failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -708,7 +708,7 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct lps25h_dev_s *dev = inode->i_private;
|
FAR struct lps25h_dev_s *dev = inode->i_private;
|
||||||
int ret = 0;
|
int ret = OK;
|
||||||
|
|
||||||
while (sem_wait(&dev->devsem) != 0)
|
while (sem_wait(&dev->devsem) != 0)
|
||||||
{
|
{
|
||||||
@ -742,7 +742,7 @@ static int lps25h_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ret = -EINVAL;
|
ret = -ENOTTY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,12 +276,15 @@ static ssize_t qe_write(FAR struct file *filep, FAR const char *buffer, size_t b
|
|||||||
static int qe_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
static int qe_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct qe_upperhalf_s *upper = inode->i_private;
|
FAR struct qe_upperhalf_s *upper;
|
||||||
FAR struct qe_lowerhalf_s *lower = upper->lower;
|
FAR struct qe_lowerhalf_s *lower;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
sninfo("cmd: %d arg: %ld\n", cmd, arg);
|
sninfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||||
DEBUGASSERT(upper && lower);
|
upper = inode->i_private;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->lower;
|
||||||
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
/* Get exclusive access to the device structures */
|
/* Get exclusive access to the device structures */
|
||||||
|
|
||||||
|
@ -254,12 +254,15 @@ static ssize_t timer_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
static int timer_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
static int timer_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct timer_upperhalf_s *upper = inode->i_private;
|
FAR struct timer_upperhalf_s *upper;
|
||||||
FAR struct timer_lowerhalf_s *lower = upper->lower;
|
FAR struct timer_lowerhalf_s *lower;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
tmrinfo("cmd: %d arg: %ld\n", cmd, arg);
|
tmrinfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||||
DEBUGASSERT(upper && lower);
|
upper = inode->i_private;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->lower;
|
||||||
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
/* Handle built-in ioctl commands */
|
/* Handle built-in ioctl commands */
|
||||||
|
|
||||||
|
@ -240,12 +240,15 @@ static ssize_t wdog_write(FAR struct file *filep, FAR const char *buffer, size_t
|
|||||||
static int wdog_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
static int wdog_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
FAR struct inode *inode = filep->f_inode;
|
FAR struct inode *inode = filep->f_inode;
|
||||||
FAR struct watchdog_upperhalf_s *upper = inode->i_private;
|
FAR struct watchdog_upperhalf_s *upper;
|
||||||
FAR struct watchdog_lowerhalf_s *lower = upper->lower;
|
FAR struct watchdog_lowerhalf_s *lower;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
wdinfo("cmd: %d arg: %ld\n", cmd, arg);
|
wdinfo("cmd: %d arg: %ld\n", cmd, arg);
|
||||||
DEBUGASSERT(upper && lower);
|
upper = inode->i_private;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
|
lower = upper->lower;
|
||||||
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
/* Get exclusive access to the device structures */
|
/* Get exclusive access to the device structures */
|
||||||
|
|
||||||
@ -533,8 +536,9 @@ void watchdog_unregister(FAR void *handle)
|
|||||||
/* Recover the pointer to the upper-half driver state */
|
/* Recover the pointer to the upper-half driver state */
|
||||||
|
|
||||||
upper = (FAR struct watchdog_upperhalf_s *)handle;
|
upper = (FAR struct watchdog_upperhalf_s *)handle;
|
||||||
|
DEBUGASSERT(upper != NULL);
|
||||||
lower = upper->lower;
|
lower = upper->lower;
|
||||||
DEBUGASSERT(upper && lower);
|
DEBUGASSERT(lower != NULL);
|
||||||
|
|
||||||
wdinfo("Unregistering: %s\n", upper->path);
|
wdinfo("Unregistering: %s\n", upper->path);
|
||||||
|
|
||||||
|
@ -176,10 +176,10 @@ static int fusb301_getreg(FAR struct fusb301_dev_s *priv, uint8_t reg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = up_i2creset(priv->i2c);
|
ret = I2C_RESET(priv->i2c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fusb301_err("ERROR: up_i2creset failed: %d\n", ret);
|
fusb301_err("ERROR: I2C_RESET failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -246,10 +246,10 @@ static int fusb301_putreg(FAR struct fusb301_dev_s *priv, uint8_t regaddr,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = up_i2creset(priv->i2c);
|
ret = I2C_RESET(priv->i2c);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fusb301_err("ERROR: up_i2creset failed: %d\n", ret);
|
fusb301_err("ERROR: I2C_RESET failed: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -314,10 +314,44 @@ found:
|
|||||||
|
|
||||||
if ((tcp->flags & TCP_RST) != 0)
|
if ((tcp->flags & TCP_RST) != 0)
|
||||||
{
|
{
|
||||||
conn->tcpstateflags = TCP_CLOSED;
|
FAR struct tcp_conn_s *listener = NULL;
|
||||||
nwarn("WARNING: RESET - TCP state: TCP_CLOSED\n");
|
|
||||||
|
/* An RST received during the 3-way connection handshake requires
|
||||||
|
* little more clean-up.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((conn->tcpstateflags & TCP_STATE_MASK) == TCP_SYN_RCVD)
|
||||||
|
{
|
||||||
|
conn->tcpstateflags = TCP_CLOSED;
|
||||||
|
nwarn("WARNING: RESET in TCP_SYN_RCVD\n");
|
||||||
|
|
||||||
|
/* Notify the listener for the connection of the reset event */
|
||||||
|
|
||||||
|
listener = tcp_findlistener(conn->lport);
|
||||||
|
|
||||||
|
/* We must free this TCP connection structure; this connection
|
||||||
|
* will never be established.
|
||||||
|
*/
|
||||||
|
|
||||||
|
tcp_free(conn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
conn->tcpstateflags = TCP_CLOSED;
|
||||||
|
nwarn("WARNING: RESET TCP state: TCP_CLOSED\n");
|
||||||
|
|
||||||
|
/* Notify this connection of the reset event */
|
||||||
|
|
||||||
|
listener = conn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Perform the TCP_ABORT callback and drop the packet */
|
||||||
|
|
||||||
|
if (listener != NULL)
|
||||||
|
{
|
||||||
|
(void)tcp_callback(dev, listener, TCP_ABORT);
|
||||||
|
}
|
||||||
|
|
||||||
(void)tcp_callback(dev, conn, TCP_ABORT);
|
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
|
|||||||
FAR struct tcp_conn_s *listener;
|
FAR struct tcp_conn_s *listener;
|
||||||
|
|
||||||
conn->tcpstateflags = TCP_CLOSED;
|
conn->tcpstateflags = TCP_CLOSED;
|
||||||
ninfo("TCP state: TCP_CLOSED\n");
|
ninfo("TCP state: TCP_SYN_RCVD->TCP_CLOSED\n");
|
||||||
|
|
||||||
/* Find the listener for this connection. */
|
/* Find the listener for this connection. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user