diff options
author | XVSALGE <xvsalge@ubuntu.(none)> | 2012-04-12 09:13:38 +0200 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2012-05-25 14:45:27 +0200 |
commit | 91209946caf8680942ea79166bb209f57ca3e69c (patch) | |
tree | 446e3077624097ee1544f5608e31d575fedc1e33 | |
parent | 3176413a5633b84e0232f0720f42071f9363c81a (diff) |
Multidownloads fails some times
Improve retransmission mechanism for
recovering USB communication.
ST-Ericsson ID: 422235
ST-Ericsson FOSS-OUT ID: NA
Change-Id: Ia61eb582111eb78d883fd6be534b43b0fb97db9d
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/54748
Reviewed-by: QABUILD
Reviewed-by: QATEST
Reviewed-by: Vlatko MARKOVIC <vlatko.markovic@seavus.com>
Tested-by: Cvetko MLADENOVSKI <cvetko.mladenovski@seavus.com>
Reviewed-by: Viktor MLADENOVSKI <viktor.mladenovski@stericsson.com>
-rw-r--r-- | lcmodule/source/cnh1605204_ldr_transport_layer/include/t_bulk_protocol.h | 2 | ||||
-rw-r--r-- | lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_bulk_protocol.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_bulk_protocol.h index 95c4dbd..67a1dab 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_bulk_protocol.h +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_bulk_protocol.h @@ -121,6 +121,8 @@ typedef struct { TL_BulkProtocolState_t State; /** Current bulk session ID. */ uint16 SessionId; + /** Counter for Bulk Timer Retransmissions. */ + uint16 BulkRetransmissionNo; /** Length of the file transfered with bulk transfer. */ uint64 TotalLength; /** Length of payload data transfered with bulk transfer. */ diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c index a509408..d8c5d04 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c @@ -353,6 +353,7 @@ ErrorCode_e Do_R15_Bulk_StartSession(Communication_t *Communication_p, TL_BulkVe BulkVector_p->Status = BULK_SESSION_PROCESSING; BulkVector_p->Offset = Offset; + BulkVector_p->BulkRetransmissionNo = 0; /* set the handle for the current bulk vector */ R15_TRANSPORT(Communication_p)->BulkHandle.BulkVector_p = BulkVector_p; @@ -434,6 +435,9 @@ ErrorCode_e Do_R15_Bulk_CloseSession(Communication_t *Communication_p, TL_BulkVe /* Verify that the requested bulk session is started. */ VERIFY(NULL != BulkVector_p, E_FAILED_TO_CLOSE_BULK_SESSION); + /* Reset Bulk retransmission counter */ + BulkVector_p->BulkRetransmissionNo = 0; + /* Try to release the timer for the bulk read request */ if (R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey > 0) { (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey); @@ -1205,6 +1209,14 @@ static void R15_Bulk_ReadChunkCallBack(Communication_t *Communication_p, const v return; } + BulkVector_p->BulkRetransmissionNo ++; + + if (BulkVector_p->BulkRetransmissionNo > MAX_RESENDS) { + A_(printf("bulk_protocol.c(%d) Bulk Retransmission Failed, loader will stop with execution!\n", __LINE__);) + R15_NETWORK(Communication_p)->Outbound.LCM_Error = E_RETRANSMITION_FAILED; + return; + } + if (BULK_SESSION_FINISHED != BulkVector_p->Status) { uint32 ChunkId = 0; uint8 ChunksList[MAX_BULK_TL_PROCESSES] = {0}; @@ -1212,7 +1224,9 @@ static void R15_Bulk_ReadChunkCallBack(Communication_t *Communication_p, const v R15_Bulk_GetListOfReceivedChunks(BulkVector_p, &ChunkId, ChunksList); BulkVector_p->State = WAIT_CHUNKS; - A_(printf("bulk_protocol.c(%d) Timer Retransmission \n", __LINE__);) + A_(printf("bulk_protocol.c(%d) Number Of Timer Retransmissions %d \n", __LINE__, BulkVector_p->BulkRetransmissionNo);) + + R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = R15_Bulk_GetTimerChunkRetransmision(Communication_p, R15_TIMEOUTS(Communication_p)->TBDR, (HandleFunction_t)R15_Bulk_ReadChunkCallBack); (void)R15_Bulk_SendReadRequest(Communication_p, BulkVector_p, ChunkId, ChunksList, NULL); } |