arch/arm/src/imxrt/imxrt_enet.c: Fix a race condition in setting up the Ethernet Tx transfer.
This commit is contained in:
parent
6e4545a924
commit
4eb118afd1
|
@ -461,6 +461,7 @@ static bool imxrt_txringfull(FAR struct imxrt_driver_s *priv)
|
|||
static int imxrt_transmit(FAR struct imxrt_driver_s *priv)
|
||||
{
|
||||
struct enet_desc_s *txdesc;
|
||||
irqstate_t flags;
|
||||
uint32_t regval;
|
||||
uint8_t *buf;
|
||||
|
||||
|
@ -526,9 +527,9 @@ static int imxrt_transmit(FAR struct imxrt_driver_s *priv)
|
|||
DEBUGASSERT(txdesc->data == buf);
|
||||
}
|
||||
|
||||
/* Start the TX transfer (if it was not already waiting for buffers) */
|
||||
/* Make the following operations atomic */
|
||||
|
||||
putreg32(ENET_TDAR, IMXRT_ENET_TDAR);
|
||||
flags = spin_lock_irqsave();
|
||||
|
||||
/* Enable TX interrupts */
|
||||
|
||||
|
@ -540,6 +541,12 @@ static int imxrt_transmit(FAR struct imxrt_driver_s *priv)
|
|||
|
||||
(void)wd_start(priv->txtimeout, IMXRT_TXTIMEOUT, imxrt_txtimeout_expiry, 1,
|
||||
(wdparm_t)priv);
|
||||
|
||||
/* Start the TX transfer (if it was not already waiting for buffers) */
|
||||
|
||||
putreg32(ENET_TDAR, IMXRT_ENET_TDAR);
|
||||
|
||||
spin_unlock_irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C1)
|
||||
static void imxrt_i2c_register(int bus)
|
||||
{
|
||||
FAR struct i2c_master_s *i2c;
|
||||
|
@ -77,6 +78,7 @@ static void imxrt_i2c_register(int bus)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
@ -109,7 +111,7 @@ int imxrt_bringup(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined ( CONFIG_I2C_DRIVER ) & (CONFIG_IMXRT_LPI2C1)
|
||||
#if defined(CONFIG_I2C_DRIVER) && defined(CONFIG_IMXRT_LPI2C1)
|
||||
imxrt_i2c_register(1);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue