summaryrefslogtreecommitdiff
path: root/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
diff options
context:
space:
mode:
authorViktor Mladenovski <viktor.mladenovski@seavus.com>2011-06-21 17:51:15 +0200
committerViktor Mladenovski <viktor.mladenovski@seavus.com>2011-06-21 17:51:15 +0200
commit12da7d3751c8b7bd088587c8323123019680efff (patch)
tree6e1e3f6a65e260ba8ffe2e1336a0cc4f0be145ba /lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
parentf7e95217e936da34d7124aaced590692eb515923 (diff)
Flashing procedure stops at different stages
Adds fix for retransmission in LCM transport layer ST-Ericsson ID: 325725 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Change-Id: Ie6b32dcf6bf7b3023237920204e3c55ac0624a79
Diffstat (limited to 'lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c')
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c32
1 files changed, 19 insertions, 13 deletions
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 173bb5b..5727d4e 100644
--- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
+++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
@@ -50,7 +50,16 @@
extern Measurement_t *Measurement_p;
#endif
+typedef struct {
+ TL_BulkVectorList_t *BulkVector_p;
+ uint32 ChunkId;
+ uint8* ChunksList_p;
+} TL_RetransmissionRequest_t;
+
+static TL_RetransmissionRequest_t RetransmissionRequest;
+
static void R15_Bulk_ReadChunkCallBack(Communication_t *Communication_p, const void *const Timer_p, const void *const Data_p);
+static void R15_Bulk_ReadDataChunkCallBack(Communication_t *Communication_p, const void *const Timer_p, const void *const Data_p);
static void R15_Bulk_RetransmitChunks_CallBack(const Communication_t *const Communication_p, const void *const Timer_p, const void *const Data_p);
static ErrorCode_e R15_Bulk_Process_Read(Communication_t *Communication_p, TL_BulkVectorList_t *BulkVector_p, PacketMeta_t *Packet_p);
static ErrorCode_e R15_Bulk_SendReadRequest(Communication_t *Communication_p, TL_BulkVectorList_t *BulkVector_p, uint32 Chunks, void *ChunksList_p, void *CallBack_p);
@@ -763,16 +772,14 @@ static ErrorCode_e R15_Bulk_Process_Read(Communication_t *Communication_p, TL_Bu
} else if (VECTOR_MISSING_CHUNK == ChunkReceivedStatus) {
ReturnValue = R15_Bulk_SendReadRequest(Communication_p, BulkVector_p, ChunkId, ChunksList, NULL);
} else { // Chunks are received in order
- R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = R15_Bulk_GetTimerChunkRetransmision(Communication_p, R15_TIMEOUTS(Communication_p)->TBDR, (HandleFunction_t)R15_Bulk_ReadChunkCallBack);
+ RetransmissionRequest.BulkVector_p = BulkVector_p;
+ RetransmissionRequest.ChunkId = ChunkId;
+ RetransmissionRequest.ChunksList_p = ChunksList;
+ R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = R15_Bulk_GetTimerChunkRetransmision(Communication_p, R15_TIMEOUTS(Communication_p)->TBDR, (HandleFunction_t)R15_Bulk_ReadDataChunkCallBack);
}
break;
- case SEND_BULK_ACK: //TODO: check this state. look like unused state!!!
- R15_Bulk_GetListOfReceivedChunks(BulkVector_p, &ChunkId, ChunksList);
- ReturnValue = R15_Bulk_SendReadRequest(Communication_p, BulkVector_p, ChunkId, ChunksList, NULL);
- break;
-
default:
BulkVector_p->State = BULK_IDLE_STATE;
ReturnValue = E_INVALID_BULK_PROTOCOL_STATE;
@@ -921,11 +928,6 @@ static ErrorCode_e R15_Bulk_SendReadRequest(Communication_t *Communication_p, TL
} else {
Param.Time = R15_TIMEOUTS(Communication_p)->TBDR; // Receiving chunks
- if (Chunks != 0) {
- VERIFY(NULL != ChunksList_p, E_INVALID_INPUT_PARAMETERS);
- Param.Payload_p = ChunksList_p;
- }
-
VERIFY(NULL != CallBack_p, E_INVALID_INPUT_PARAMETERS);
//lint --e(611)
Param.TimerCallBackFn_p = (HandleFunction_t)CallBack_p;
@@ -1062,6 +1064,11 @@ static void R15_Bulk_ReadChunkCallBack(Communication_t *Communication_p, const v
(void)QUEUE((Communication_p), FifoEnqueue_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, (void *)Data_p);
}
+static void R15_Bulk_ReadDataChunkCallBack(Communication_t *Communication_p, const void *const Timer_p, const void *const Data_p)
+{
+ (void)R15_Bulk_SendReadRequest(Communication_p, RetransmissionRequest.BulkVector_p, RetransmissionRequest.ChunkId, RetransmissionRequest.ChunksList_p, NULL);
+}
+
static void R15_Bulk_RetransmitChunks_CallBack(const Communication_t *const Communication_p, const void *const Timer_p, const void *const Data_p)
{
/* set all chunks for retransmision . Max retransmision is 3. */
@@ -1122,8 +1129,7 @@ static TL_BulkVectorStatus_t R15_Bulk_GetVectorStatus(TL_BulkVectorList_t *BulkV
for (ChunkCounter = 0; ChunkCounter < BulkVector_p->Buffers; ChunkCounter++) {
Packet_p = BulkVector_p->Entries[ChunkCounter].Buffer_p;
- if (Packet_p == NULL ||
- !(CHECK_PACKET_FLAGS(Packet_p, BUF_ACK_READY) || CHECK_PACKET_FLAGS(Packet_p, BUF_ACKNOWLEDGED))) {
+ if (Packet_p == NULL || !(CHECK_PACKET_FLAGS(Packet_p, BUF_ACK_READY) || CHECK_PACKET_FLAGS(Packet_p, BUF_ACKNOWLEDGED))) {
Status = VECTOR_NOT_COMPLETE;
} else {
if (Status == VECTOR_NOT_COMPLETE) {