diff options
author | Martijn Coenen <maco@google.com> | 2011-07-26 06:14:23 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-26 06:14:23 -0700 |
commit | f70efa7e8626a13c7c32a9a566b299bae9146962 (patch) | |
tree | b4c1291ed63af5f57f8aca41c135d44e7d86f2e8 | |
parent | cdfcf683579226c6f64c2d0774df09899f4018f6 (diff) | |
parent | 379262748505107b88ec92675529063789e44da6 (diff) | |
download | external_libnfc-nxp-f70efa7e8626a13c7c32a9a566b299bae9146962.zip external_libnfc-nxp-f70efa7e8626a13c7c32a9a566b299bae9146962.tar.gz external_libnfc-nxp-f70efa7e8626a13c7c32a9a566b299bae9146962.tar.bz2 |
Merge "Fixed LLCP receive function when accessing RW."
-rw-r--r-- | src/phFriNfc_LlcpTransport_Connection.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/phFriNfc_LlcpTransport_Connection.c b/src/phFriNfc_LlcpTransport_Connection.c index 19c662a..b75406b 100644 --- a/src/phFriNfc_LlcpTransport_Connection.c +++ b/src/phFriNfc_LlcpTransport_Connection.c @@ -2647,33 +2647,32 @@ NFCSTATUS phFriNfc_LlcpTransport_ConnectionOriented_Recv( phFriNfc_LlcpTransport if(dataLengthRead != 0) { /* Test If data is present in the RW Buffer */ - if(pLlcpSocket->indexRwRead != pLlcpSocket->indexRwWrite) + while(pLlcpSocket->indexRwRead != pLlcpSocket->indexRwWrite) { - do + /* Get the data length available in the linear buffer */ + dataLengthAvailable = phFriNfc_Llcp_CyclicFifoAvailable(&pLlcpSocket->sCyclicFifoBuffer); + + /* Exit if not enough memory available in linear buffer */ + if(dataLengthAvailable < pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length) { - /* Get the data length available in the linear buffer */ - dataLengthAvailable = phFriNfc_Llcp_CyclicFifoAvailable(&pLlcpSocket->sCyclicFifoBuffer); + break; + } - /* Test if enought place is available */ - if(dataLengthAvailable > pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length ) - { - /* Write data into the linear buffer */ - dataLengthWrite = phFriNfc_Llcp_CyclicFifoWrite(&pLlcpSocket->sCyclicFifoBuffer, - pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].buffer, - pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length); - /* Update VR */ - pLlcpSocket->socket_VR = (pLlcpSocket->socket_VR+1)%16; + /* Write data into the linear buffer */ + dataLengthWrite = phFriNfc_Llcp_CyclicFifoWrite(&pLlcpSocket->sCyclicFifoBuffer, + pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].buffer, + pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length); + /* Update VR */ + pLlcpSocket->socket_VR = (pLlcpSocket->socket_VR+1)%16; - /* Set flag bufferized to TRUE */ - dataBufferized = TRUE; + /* Set flag bufferized to TRUE */ + dataBufferized = TRUE; - /* Update RW Buffer length */ - pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length = 0; + /* Update RW Buffer length */ + pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length = 0; - /* Update Value Rw Read Index*/ - pLlcpSocket->indexRwRead++; - } - }while(dataLengthAvailable > pLlcpSocket->sSocketRwBufferTable[(pLlcpSocket->indexRwRead%pLlcpSocket->localRW)].length); + /* Update Value Rw Read Index*/ + pLlcpSocket->indexRwRead++; } /* Test if data has been bufferized after a read access */ |