diff options
Diffstat (limited to 'lcmodule/source/cnh1605204_ldr_transport_layer/source')
5 files changed, 54 insertions, 18 deletions
diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_transport.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_transport.c index cee9aa3..9ae5f18 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_transport.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_transport.c @@ -14,7 +14,7 @@ /******************************************************************************* * Includes ******************************************************************************/ -#include "c_system.h" +#include "c_system_v2.h" #include "r_a2_network.h" #include "r_a2_transport.h" #include <stdlib.h> 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 feff254..4e4a1fb 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c @@ -14,7 +14,7 @@ /******************************************************************************* * Includes ******************************************************************************/ -#include "c_system.h" +#include "c_system_v2.h" #include "r_basicdefinitions.h" #include <stdlib.h> #include <stdio.h> @@ -908,7 +908,7 @@ ErrorCode_e R15_Bulk_Process_Write(Communication_t *Communication_p, TL_BulkVect } #endif - C_(printf("bulk_protocol.c(%d) Sent chunk (%d) session (%d)\n", __LINE__, ChunkId, BulkVector_p->SessionId);) + C_(printf("bulk_protocol.c(%d) Sent chunk (%d) session (%d)\n", __LINE__, BulkVector_p->SendingChunkId, BulkVector_p->SessionId);) } break; @@ -955,12 +955,12 @@ ErrorCode_e R15_Bulk_Process_Write(Communication_t *Communication_p, TL_BulkVect } #endif - C_(printf("bulk_protocol.c(%d) Sent chunk (%d) session (%d)\n", __LINE__, ChunkId, BulkVector_p->SessionId);) + C_(printf("bulk_protocol.c(%d) Sent chunk (%d) session (%d)\n", __LINE__, BulkVector_p->SendingChunkId, BulkVector_p->SessionId);) } } #ifdef CFG_ENABLE_MEASUREMENT_TOOL - ReturnValue = MP(Measurement_p, ChunkId, RECEIVED_CHUNK_TIME); + ReturnValue = MP(Measurement_p, BulkVector_p->SendingChunkId, RECEIVED_CHUNK_TIME); #endif break; @@ -979,7 +979,7 @@ ErrorCode_e R15_Bulk_Process_Write(Communication_t *Communication_p, TL_BulkVect pcbf(Communication_p->Object_p, BulkVector_p->SessionId, BulkVector_p->ChunkSize, BulkVector_p->Offset, BulkVector_p->Length, TRUE); // close the current bulk session - (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: da se hendla return vrednosta! + (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: return value should be handled BulkExtendedHeader_t *PendingHeader_p = R15_TRANSPORT(Communication_p)->BulkHandle.PendingBulkHeader_p; @@ -1030,7 +1030,7 @@ ErrorCode_e R15_Bulk_Process_Write(Communication_t *Communication_p, TL_BulkVect #ifndef CFG_ENABLE_LOADER_TYPE ErrExit: -#endif +#endif //CFG_ENABLE_LOADER_TYPE Do_CriticalSection_Leave(R15_TRANSPORT(Communication_p)->BulkHandle.BulkTransferCS); return ReturnValue; @@ -1302,9 +1302,9 @@ static uint32 R15_Bulk_GetChunkId(const PacketMeta_t *const Packet_p) { BulkExtendedHeader_t BulkExtendedHeader = {0}; + //lint -e(413,826) R15_DeserializeBulkExtendedHeader(&BulkExtendedHeader, Packet_p->ExtendedHeader_p); - //lint -e(413,826) return BulkExtendedHeader.AcksChunk; } @@ -1457,7 +1457,7 @@ static ErrorCode_e R15_Bulk_ReadRequestHandler(Communication_t *Communication_p, pcbf(Communication_p->Object_p, BulkVector_p->SessionId, BulkVector_p->ChunkSize, BulkVector_p->Offset, BulkVector_p->Length, TRUE); // close the current bulk session - (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: da se hendla return vrednosta! + (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: return value should be handled // set bulk parameters for new bulk session ACK_Read = FALSE; @@ -1494,7 +1494,7 @@ static ErrorCode_e R15_Bulk_ReadRequestHandler(Communication_t *Communication_p, /* Try to release the timer for the bulk session acknowledge */ if (R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey > 0) { - (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey); // LCM MB bug fix: Timer should be released on request for retransmission + (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey); // LCM bug fix: Timer should be released on request for retransmission R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = 0; } @@ -1510,7 +1510,7 @@ static ErrorCode_e R15_Bulk_ReadRequestHandler(Communication_t *Communication_p, pcbf = (BulkCommandReqCallback_t)R15_TRANSPORT(Communication_p)->BulkCommandCallback_p; pcbf(Communication_p->Object_p, BulkVector_p->SessionId, BulkVector_p->ChunkSize, BulkVector_p->Offset, BulkVector_p->Length, TRUE); - (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: da se hendla return vrednosta! + (void)Do_R15_Bulk_CloseSession(Communication_p, BulkVector_p); //TODO: return value should be handled } else { /* Clean the previous saved data if there is any */ BUFFER_FREE(R15_TRANSPORT(Communication_p)->BulkHandle.PendingBulkHeader_p); @@ -1532,7 +1532,7 @@ static ErrorCode_e R15_Bulk_ReadRequestHandler(Communication_t *Communication_p, /* Try to release the timer for the bulk session acknowledge */ if (R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey > 0) { - (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey); // LCM MB bug fix: Timer should be released on request for retransmission + (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey); // LCM bug fix: Timer should be released on request for retransmission R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = 0; } } @@ -1602,7 +1602,7 @@ static ErrorCode_e R15_Bulk_DataRequestHandler(Communication_t *Communication_p, BulkVector_p->TransferedLength += BulkVector_p->ChunkSize; pcbf = (BulkDataReqCallback_t)R15_TRANSPORT(Communication_p)->BulkDataCallback_p; pcbf(Communication_p->Object_p, BulkVector_p->SessionId, ExtendedHeader.ChunkSize, BulkVector_p->Offset, BulkVector_p->Length, BulkVector_p->TotalLength, BulkVector_p->TransferedLength); - C_(printf("S(%d) L(%d) CS(%d)\n", BulkVector_p->SessionId, BulkVector_p->Length, BulkVector_p->ChunkSize);) + C_(printf("S(%d) L(%d) CS(%d)\n", BulkVector_p->SessionId, BulkVector_p->Length, ExtendedHeader.ChunkSize);) } } diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c index 08b4819..311ca2b 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c @@ -54,7 +54,7 @@ static ErrorCode_e DispatchCommand(Communication_t *Communication_p, PacketMeta_ */ ErrorCode_e Do_R15_Command_ResetSessionCounters(const Communication_t *const Communication_p) { - /* Iintialize the session counters */ + /* Initialize the session counters */ R15_TRANSPORT(Communication_p)->SessionStateIn = 0; R15_TRANSPORT(Communication_p)->SessionStateOut = 0; diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c index 6ea08d4..8f9ba0f 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c @@ -17,7 +17,7 @@ #include <stdlib.h> #include <string.h> -#include "c_system.h" +#include "c_system_v2.h" #include "t_basicdefinitions.h" #include "r_debug.h" #include "r_debug_macro.h" diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c index 893412f..dcc5a3a 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c @@ -14,7 +14,7 @@ /******************************************************************************* * Includes ******************************************************************************/ -#include "c_system.h" +#include "c_system_v2.h" #include "r_r15_transport_layer.h" #include <stdlib.h> #include <string.h> @@ -37,7 +37,9 @@ ******************************************************************************/ static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p); static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Length, const uint8 *const Hash_p, void *Param_p); - +#ifdef CFG_ENABLE_LOADER_TYPE +static ErrorCode_e ConfigureDeviceTimeouts(Communication_t *Communication_p); +#endif /******************************************************************************* * File scope types, constants and variables ******************************************************************************/ @@ -57,6 +59,7 @@ static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Lengt */ ErrorCode_e R15_Transport_Initialize(const Communication_t *const Communication_p) { + ErrorCode_e ReturnValue = E_SUCCESS; int VectorCounter; /* Initialize the session counters for command protocol*/ @@ -67,9 +70,14 @@ ErrorCode_e R15_Transport_Initialize(const Communication_t *const Communication_ R15_TRANSPORT(Communication_p)->BulkSessionCounter = 0; /* Initialize the default timeouts */ +#ifndef CFG_ENABLE_LOADER_TYPE R15_TIMEOUTS(Communication_p)->TCACK = ACK_TIMEOUT_IN_MS; R15_TIMEOUTS(Communication_p)->TBCR = BULK_COMMAND_RECEIVING_TIMEOUT; R15_TIMEOUTS(Communication_p)->TBDR = BULK_DATA_RECEIVING_TIMEOUT; +#else + ReturnValue = ConfigureDeviceTimeouts((Communication_t *)Communication_p); + VERIFY(E_SUCCESS == ReturnValue, ReturnValue); +#endif for (VectorCounter = 0; VectorCounter < MAX_BULK_TL_PROCESSES; VectorCounter++) { R15_TRANSPORT(Communication_p)->BulkVectorList[VectorCounter].Status = BULK_SESSION_IDLE; @@ -80,7 +88,10 @@ ErrorCode_e R15_Transport_Initialize(const Communication_t *const Communication_ R15_TRANSPORT(Communication_p)->BulkHandle.BulkTransferCS = Do_CriticalSection_Create(); R15_TRANSPORT(Communication_p)->BulkHandle.PendingBulkHeader_p = NULL; - return E_SUCCESS; +#ifdef CFG_ENABLE_LOADER_TYPE +ErrorExit: +#endif + return ReturnValue; } /* @@ -314,6 +325,31 @@ static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const Inpu return Timer_p; } + +#ifdef CFG_ENABLE_LOADER_TYPE +/* + * Function for configuration of timeouts for communication device. + * + * @param [in] Communication_p Communication module context. + * + * @return E_SUCCESS If is successfully executed. + */ +static ErrorCode_e ConfigureDeviceTimeouts(Communication_t *Communication_p) +{ + ErrorCode_e ReturnValue = E_INVALID_INPUT_PARAMETERS; + R15_Timeouts_t NewTimeoutData = {0}; + + ReturnValue = Communication_p->CommunicationDevice_p->SetTimeouts((void *)&NewTimeoutData, (void *)Communication_p); + VERIFY(E_SUCCESS == ReturnValue, ReturnValue); + + ReturnValue = R15_SetProtocolTimeouts(Communication_p, (void *)&NewTimeoutData); + VERIFY(E_SUCCESS == ReturnValue, ReturnValue); + +ErrorExit: + return ReturnValue; +} +#endif + /** @} */ /** @} */ /** @} */ |