drivers/modem/altair: Fix behavior when a reset packet conflicts with a send packet

Even in the case of a conflict between a reset packet
and a send packet, the send size is compared and the
larger size is sent as the payload.
This commit is contained in:
SPRESENSE 2021-05-19 16:56:13 +09:00 committed by Alin Jerpelea
parent 9a99d813fa
commit 139f1f1548

View File

@ -1232,12 +1232,24 @@ static int do_trxreset(FAR struct altmdm_dev_s *priv)
ret = wait_receiverready(priv, WAIT_RXREQ_TIMEOUT);
if (ret >= 0)
{
/* If a conflict occurs with the reset packet,
* the packet is transferred by the size specified
* by the receiving side. Discard the data on the sending side.
/* Even in the case of a conflict between a reset packet
* and a send packet, the send size is compared and the
* larger size is sent as the payload.
* If the send packet that conflicts with the reset packet
* is in ALTCOM command format, the modem may assert.
* If it is not in the ALTCOM command format, it will be
* discarded by the modem, so dummy data will be sent to
* avoid assertion.
*/
xfer_size = spidev->rx_param.total_size;
if (spidev->tx_param.total_size < spidev->rx_param.total_size)
{
xfer_size = spidev->rx_param.total_size;
}
else
{
xfer_size = spidev->tx_param.total_size;
}
/* Get DMA transfer size */