ssp buffer check fix
This commit is contained in:
parent
264fbc1ecc
commit
8ddb2a6a2a
@ -597,14 +597,17 @@ static void ssp_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
|
|||||||
while ((ssp_getreg(priv, LPC43_SSP_SR_OFFSET) & SSP_SR_TNF) &&
|
while ((ssp_getreg(priv, LPC43_SSP_SR_OFFSET) & SSP_SR_TNF) &&
|
||||||
(rxpending < LPC43_SSP_FIFOSZ) && nwords)
|
(rxpending < LPC43_SSP_FIFOSZ) && nwords)
|
||||||
{
|
{
|
||||||
if (txbuffer && priv->nbits > 8)
|
if (txbuffer)
|
||||||
{
|
{
|
||||||
data = (uint32_t)*tx.p16++;
|
if (priv->nbits > 8)
|
||||||
}
|
{
|
||||||
else
|
data = (uint32_t)*tx.p16++;
|
||||||
{
|
}
|
||||||
data = (uint32_t)*tx.p8++;
|
else
|
||||||
}
|
{
|
||||||
|
data = (uint32_t)*tx.p8++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ssp_putreg(priv, LPC43_SSP_DR_OFFSET, txbuffer?data:datadummy);
|
ssp_putreg(priv, LPC43_SSP_DR_OFFSET, txbuffer?data:datadummy);
|
||||||
nwords--;
|
nwords--;
|
||||||
@ -617,14 +620,17 @@ static void ssp_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
|
|||||||
while (ssp_getreg(priv, LPC43_SSP_SR_OFFSET) & SSP_SR_RNE)
|
while (ssp_getreg(priv, LPC43_SSP_SR_OFFSET) & SSP_SR_RNE)
|
||||||
{
|
{
|
||||||
data = ssp_getreg(priv, LPC43_SSP_DR_OFFSET);
|
data = ssp_getreg(priv, LPC43_SSP_DR_OFFSET);
|
||||||
if (rxbuffer && priv->nbits > 8)
|
if (rxbuffer)
|
||||||
{
|
{
|
||||||
*rx.p16++ = (uint16_t)data;
|
if(priv->nbits > 8)
|
||||||
}
|
{
|
||||||
else
|
*rx.p16++ = (uint16_t)data;
|
||||||
{
|
}
|
||||||
*rx.p8++ = (uint8_t)data;
|
else
|
||||||
}
|
{
|
||||||
|
*rx.p8++ = (uint8_t)data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rxpending--;
|
rxpending--;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user