summaryrefslogtreecommitdiff
path: root/lcmodule
diff options
context:
space:
mode:
Diffstat (limited to 'lcmodule')
-rw-r--r--lcmodule/source/LCM.rc6
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h1
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c14
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c25
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c38
-rw-r--r--lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h6
-rw-r--r--lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h7
-rw-r--r--lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c133
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl16
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl8
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml2
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c6
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c2
-rw-r--r--lcmodule/source/legacy_compatibility/t_basicdefinitions.h8
14 files changed, 141 insertions, 131 deletions
diff --git a/lcmodule/source/LCM.rc b/lcmodule/source/LCM.rc
index 180fe54..61bc97a 100644
--- a/lcmodule/source/LCM.rc
+++ b/lcmodule/source/LCM.rc
@@ -69,15 +69,15 @@ BEGIN
BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "Comments", "Build date: 2012-02-07"
+ VALUE "Comments", "Build date: 2012-03-14"
VALUE "CompanyName", "STEricsson AB"
VALUE "FileDescription", "LCM Dynamic Link Library"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Loader Communication Module"
VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2012"
- VALUE "PrivateBuild", "Change-Id: I70835353a592d1f1ad40743640a1d0827e56fd2e"
+ VALUE "PrivateBuild", "Change-Id: I2f2835b56857eb9640501ff681400517600ccdef"
VALUE "ProductName", "CXA1104507 Loader Communication Module"
- VALUE "ProductVersion", "P4Y"
+ VALUE "ProductVersion", "P5Y"
END
END
BLOCK "VarFileInfo"
diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h
index 25ef644..7399c2f 100644
--- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h
+++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h
@@ -17,6 +17,7 @@
* Includes
******************************************************************************/
#include "t_basicdefinitions.h"
+#include "t_protrom_header.h"
/*******************************************************************************
* Types, constants and external variables
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 4e4a1fb..9905069 100644
--- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
+++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
@@ -204,7 +204,7 @@ TL_BulkVectorList_t *Do_R15_Bulk_CreateVector(const Communication_t *const Commu
return NULL;
}
- Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
Packet_p->Payload_p = Packet_p->ExtendedHeader_p + ALIGNED_BULK_EXTENDED_HEADER_LENGTH;
#else
/* packet meta info allocate */
@@ -220,8 +220,8 @@ TL_BulkVectorList_t *Do_R15_Bulk_CreateVector(const Communication_t *const Commu
Packet_p->Buffer_p = NULL;
Packet_p->BufferSize = BULK_BUFFER_SIZE;
SET_PACKET_FLAGS(Packet_p, PACKET_ALLOCATION_STATE_MASK, BUF_ALLOCATED);
- Packet_p->Payload_p = (uint8 *)(HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH);
- Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ Packet_p->Payload_p = (uint8 *)(ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH);
+ Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
BuffersNr = 0;
do {
@@ -1124,7 +1124,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta
TL_BulkVectorList_t *BulkVector_p = R15_TRANSPORT(Communication_p)->BulkHandle.BulkVector_p;
uint32 DeltaLength = 0;
- Packet_p->Timer_p = NULL;
+ memset(&(Packet_p->Timer), 0, sizeof(Timer_t));
Packet_p->Resend = 0;
/* set call back function */
Packet_p->CallBack_p = NULL;
@@ -1157,7 +1157,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta
ExtendedHeader.TypeFlags = CMD_BULK_DATA;
/* serialize and calculate extended header */
- Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
R15_SerializeExtendedHeader(Packet_p->ExtendedHeader_p, Header.Protocol, &ExtendedHeader, &(Header.ExtendedHeaderChecksum));
/* setup header for serialization and calculation */
memcpy(&Packet_p->Header, &Header, HEADER_LENGTH);
@@ -1174,7 +1174,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta
(void *)Packet_p);
} else {
memset(&Packet_p->Header.PayloadChecksum, 0x0, sizeof(uint32));
- R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header);
+ R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);
SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED);
}
}
@@ -1190,7 +1190,7 @@ static void R15_Bulk_OutHashCallback(const void *const Data_p, uint32 Length, co
PacketMeta_t *Packet_p = (PacketMeta_t *)Param_p;
memcpy(&Packet_p->Header.PayloadChecksum, Hash_p, sizeof(uint32));
- R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header);
+ R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);
SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED);
}
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 311ca2b..6041965 100644
--- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c
+++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c
@@ -259,25 +259,18 @@ static ErrorCode_e DispatchCommand(Communication_t *Communication_p, PacketMeta_
CmdData.ApplicationNr = ExtendedHeader.CommandGroup;
CmdData.SessionNr = ExtendedHeader.SessionState >> 2;
CmdData.Payload.Size = Packet_p->Header.PayloadLength;
- CmdData.Payload.Data_p = NULL;
-
- if (0 != CmdData.Payload.Size) {
- CmdData.Payload.Data_p = (uint8 *)malloc(Packet_p->Header.PayloadLength);
-
- if (NULL == CmdData.Payload.Data_p) {
- return E_ALLOCATE_FAILED;
- }
-
- memcpy(CmdData.Payload.Data_p, Packet_p->Payload_p, Packet_p->Header.PayloadLength);
- }
-
- ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p);
+ CmdData.Payload.Data_p = Packet_p->Payload_p;
ReturnValue = Communication_p->Do_CEH_Call_Fn(OBJECT_CEH_CALL(Communication_p), &CmdData);
- if (NULL != CmdData.Payload.Data_p) {
- free(CmdData.Payload.Data_p);
- CmdData.Payload.Data_p = NULL;
+ if (E_SUCCESS == ReturnValue) {
+ ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p);
+ } else {
+ ErrorCode_e PacketReleaseRet = R15_Network_PacketRelease(Communication_p, Packet_p);
+
+ if (E_SUCCESS != PacketReleaseRet) {
+ A_(printf("command_protocol.c (%d): Failed to release Network packet! Error: %d\n", __LINE__, PacketReleaseRet);)
+ }
}
return ReturnValue;
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 dcc5a3a..220ccec 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
@@ -35,7 +35,7 @@
/*******************************************************************************
* Declaration of file local functions
******************************************************************************/
-static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p);
+static void 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);
@@ -187,16 +187,16 @@ ErrorCode_e R15_Transport_Send(Communication_t *Communication_p, void *InputData
Packet_p->Resend = 0;
Packet_p->CallBack_p = NULL;
- Packet_p->Timer_p = TimerSet(Packet_p, InputData_p, Communication_p);
+ TimerSet(Packet_p, InputData_p, Communication_p);
Packet_p->Header = *InputData_p->Header_p;
/* serialize and calculate extended header */
- Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
R15_SerializeExtendedHeader(Packet_p->ExtendedHeader_p, InputData_p->Header_p->Protocol, InputData_p->ExtendedHeader_p, &(Packet_p->Header.ExtendedHeaderChecksum));
if (Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) {
- Packet_p->Payload_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH;
+ Packet_p->Payload_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH + ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH;
} else {
- Packet_p->Payload_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH;
+ Packet_p->Payload_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH;
}
if (NULL != InputData_p->Payload_p) {
@@ -215,12 +215,12 @@ ErrorCode_e R15_Transport_Send(Communication_t *Communication_p, void *InputData
} else {
SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED);
memset(&Packet_p->Header.PayloadChecksum, 0x0, sizeof(uint32));
- R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header);
+ R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);
(void)QUEUE(Packet_p->Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Packet_p->Communication_p), Packet_p->Communication_p->Outbound_p, Packet_p);
}
} else {
- R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header);
+ R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);
(void)QUEUE(Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, Packet_p);
}
@@ -290,7 +290,7 @@ static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Lengt
SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED);
memcpy(&Packet_p->Header.PayloadChecksum, Hash_p, sizeof(uint32));
- R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header);
+ R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header);
(void)QUEUE(Packet_p->Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Packet_p->Communication_p), Packet_p->Communication_p->Outbound_p, Packet_p);
}
@@ -304,26 +304,16 @@ static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Lengt
*
* @return none.
*/
-static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p)
+static void TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p)
{
- Timer_t *Timer_p = NULL;
-
if (InputData_p->Time > 0) {
- Timer_p = (Timer_t *)malloc(sizeof(Timer_t));
-
- if (NULL == Timer_p) {
- return NULL;
- }
-
/* timer data */
- Timer_p->Time = InputData_p->Time;
- Timer_p->PeriodicalTime = 0;
- Timer_p->HandleFunction_p = (HandleFunction_t)(InputData_p->TimerCallBackFn_p);
- Timer_p->Data_p = (void *)Packet_p;
- Timer_p->Param_p = (void *)Communication_p;
+ Packet_p->Timer.Time = InputData_p->Time;
+ Packet_p->Timer.PeriodicalTime = 0;
+ Packet_p->Timer.HandleFunction_p = (HandleFunction_t)(InputData_p->TimerCallBackFn_p);
+ Packet_p->Timer.Data_p = (void *)Packet_p;
+ Packet_p->Timer.Param_p = (void *)Communication_p;
}
-
- return Timer_p;
}
#ifdef CFG_ENABLE_LOADER_TYPE
diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h
index 4b5cc70..a5ed3eb 100644
--- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h
+++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h
@@ -40,12 +40,6 @@
#define COMMAND_EXTENDED_HEADER_LENGTH 4
/** The length of the bulk extended header. */
#define BULK_EXTENDED_HEADER_LENGTH 20
-/** Offset of the header in the buffer. */
-#ifndef CFG_ENABLE_LOADER_TYPE
-#define HEADER_OFFSET_IN_BUFFER 0
-#else
-#define HEADER_OFFSET_IN_BUFFER 8
-#endif
#define ALIGNED_HEADER_LENGTH ALIGN_SIZE
#define ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH ALIGN_SIZE
diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h
index 408fdf9..9b1f09e 100644
--- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h
+++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h
@@ -210,7 +210,7 @@ typedef struct PacketMeta {
the packet. */
R15_Header_t Header; /**< Structure of the header. */
uint32 Resend; /**< Resent counter. */
- Timer_t *Timer_p; /**< Timer data used for
+ Timer_t Timer; /**< Timer data used for
sending/receiving packet. */
uint8 *ExtendedHeader_p; /**< Pointer to the extended
header located in the packet. */
@@ -236,6 +236,7 @@ typedef struct {
uint32 Key; /**< Generated unique key, used for marking packet for
retransmission or removing from retransmission list. */
PacketMeta_t *Packet_p; /**< Pointer to the packet for retransmission. */
+ boolean InUse; /**< Determine if the entry in retransmission list is currently allocated. */
} RetransmissionContext_t;
@@ -284,9 +285,9 @@ typedef struct {
/** R15 Network context */
typedef struct {
- PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT];
+ PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT];
/**< List of meta data for used packets. */
- RetransmissionContext_t *RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST];
+ RetransmissionContext_t RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST];
/**< List of packet for retransmission */
uint32 RetransmissionListCount;
/**< Counter for packets retransmission */
diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c b/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c
index 509e8cf..b74cb4a 100644
--- a/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c
+++ b/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c
@@ -318,14 +318,27 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
#ifdef CFG_ENABLE_LOADER_TYPE
uint8 *HeaderStartInBuffer_p = NULL;
boolean IsBufferContinuous = FALSE;
-#endif
+ static R15_OutboundState_t SavedState = SEND_IDLE;
+ static boolean ReRun = FALSE;
+#endif // CFG_ENABLE_LOADER_TYPE
uint32 ContinuousBufferLength = 0;
boolean RegisterRetransmission = FALSE;
uint32 ExtHdrLen = 0;
uint32 Aligned_Length = 0;
+#ifdef CFG_ENABLE_LOADER_TYPE
+StartTramsmitter:
+#endif // CFG_ENABLE_LOADER_TYPE
+
if (!Do_CriticalSection_Enter(Out_p->TxCriticalSection)) {
+#ifdef CFG_ENABLE_LOADER_TYPE
+ ReRun = TRUE;
+ SavedState = Out_p->State;
+ A_(printf("r15_network_layer.c (%d) Failed to lock CriticalSection code! \n", __LINE__);)
+ return E_CS_LOCK_FAILED;
+#else
return ReturnValue;
+#endif // CFG_ENABLE_LOADER_TYPE
}
switch (Out_p->State) {
@@ -341,13 +354,14 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
Out_p->State = SEND_HEADER;
} else {
//Do_CommunicationInternalErrorHandler(E_RETRANSMITION_FAILED);
- return E_RETRANSMITION_FAILED;
+ ReturnValue = E_RETRANSMITION_FAILED;
+ break;
}
/* FALLTHROUGH */
case SEND_HEADER:
#ifdef CFG_ENABLE_LOADER_TYPE
- HeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER;
+ HeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p;
if (Out_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) {
ExtHdrLen = ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH;
@@ -381,7 +395,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
#endif
- if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER),
+ if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p),
ContinuousBufferLength, R15_Network_WriteCallback, Communication_p->CommunicationDevice_p)) {
C_(printf("r15_network_layer.c (%d) Header Sent to comm device! \n", __LINE__);)
} else {
@@ -397,7 +411,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
break;
case SEND_EX_HEADER:
- ExHeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ ExHeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
if (Out_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) {
ExtHdrLen = ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH;
@@ -451,7 +465,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
}
if (RegisterRetransmission) {
- if (NULL != Out_p->Packet_p->Timer_p) {
+ if (0 != Out_p->Packet_p->Timer.Time) {
C_(printf("r15_network_layer.c (%d) Register retransmission\n", __LINE__);)
(void)R15_Network_RegisterRetransmission(Communication_p, Out_p->Packet_p);
}
@@ -459,6 +473,25 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p)
Do_CriticalSection_Leave(Out_p->TxCriticalSection);
+#ifdef CFG_ENABLE_LOADER_TYPE
+
+ if (TRUE == ReRun) {
+ ReRun = FALSE;
+ Out_p->State = SavedState;
+
+ ExHeaderStartInBuffer_p = NULL;
+ HeaderStartInBuffer_p = NULL;
+ IsBufferContinuous = FALSE;
+ ContinuousBufferLength = 0;
+ RegisterRetransmission = FALSE;
+ ExtHdrLen = 0;
+ Aligned_Length = 0;
+
+ goto StartTramsmitter;
+ }
+
+#endif // CFG_ENABLE_LOADER_TYPE
+
return ReturnValue;
}
@@ -477,27 +510,26 @@ ErrorCode_e R15_Network_CancelRetransmission(const Communication_t *const Commun
uint32 Index = 0;
do {
- if ((R15_NETWORK(Communication_p)->RetransmissionList[Index] != NULL) && (R15_NETWORK(Communication_p)->RetransmissionList[Index]->Key == UniqueKey)) {
- (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index]->TimerKey);
+ if ((TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) && (R15_NETWORK(Communication_p)->RetransmissionList[Index].Key == UniqueKey)) {
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE;
+
+ (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey);
- free(R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p->Timer_p);
- R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p->Timer_p = NULL;
- ReturnValue = R15_Network_PacketRelease(Communication_p, R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p);
+ memset(&(R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p->Timer), 0, sizeof(Timer_t));
+
+ ReturnValue = R15_Network_PacketRelease(Communication_p, R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p);
if (E_SUCCESS != ReturnValue) {
A_(printf("r15_network_layer.c(%d): Packet release failed!\n", __LINE__);)
return ReturnValue;
}
- free(R15_NETWORK(Communication_p)->RetransmissionList[Index]);
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL;
R15_NETWORK(Communication_p)->RetransmissionListCount--;
for (; Index < R15_NETWORK(Communication_p)->RetransmissionListCount; Index++) {
R15_NETWORK(Communication_p)->RetransmissionList[Index] = R15_NETWORK(Communication_p)->RetransmissionList[Index + 1];
}
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL;
ReturnValue = E_SUCCESS;
break;
}
@@ -661,6 +693,10 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa
Communication_t *Communication_p = (Communication_t *)(((CommunicationDevice_t *)Param_p)->Object_p);
R15_Outbound_t *Out_p = &(R15_NETWORK(Communication_p)->Outbound);
BulkExtendedHeader_t ExtendedHeader = {0};
+#ifdef CFG_ENABLE_LOADER_TYPE
+ ErrorCode_e ReturnValue = E_GENERAL_COMMUNICATION_ERROR;
+ R15_OutboundState_t SavedState = Out_p->State;
+#endif // CFG_ENABLE_LOADER_TYPE
B_(printf("r15_network_layer.c (%d): Device write finished!! \n", __LINE__);)
if (SENDING_HEADER == Out_p->State) {
@@ -668,7 +704,7 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa
} else if (SENDING_EX_HEADER == Out_p->State) {
Out_p->State = SEND_PAYLOAD;
} else if (SENDING_PAYLOAD == Out_p->State) {
- if (NULL == Out_p->Packet_p->Timer_p) {
+ if (0 == Out_p->Packet_p->Timer.Time) {
if (Out_p->Packet_p->Header.Protocol == BULK_PROTOCOL) {
R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Out_p->Packet_p->ExtendedHeader_p);
}
@@ -684,7 +720,11 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa
#ifdef CFG_ENABLE_LOADER_TYPE
- if (E_SUCCESS != R15_Network_TransmiterHandler(Communication_p)) {
+ ReturnValue = R15_Network_TransmiterHandler(Communication_p);
+
+ if (E_CS_LOCK_FAILED == ReturnValue) {
+ Out_p->State = SavedState;
+ } else if (E_SUCCESS != ReturnValue) {
R15_NETWORK(Communication_p)->Outbound.LCM_Error = E_GENERAL_COMMUNICATION_ERROR;
}
@@ -773,7 +813,7 @@ static ErrorCode_e R15_Network_ReceiveExtendedHeader(Communication_t *Communicat
VERIFY(NULL != In_p->Packet_p, E_FAILED_TO_FIND_COMM_BUFFER);
In_p->Packet_p->Header = R15Header;
- In_p->Packet_p->ExtendedHeader_p = In_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH;
+ In_p->Packet_p->ExtendedHeader_p = In_p->Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH;
SET_PACKET_FLAGS(In_p->Packet_p, PACKET_RX_STATE_MASK, BUF_HDR_CRC_OK);
if (In_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) {
@@ -782,7 +822,7 @@ static ErrorCode_e R15_Network_ReceiveExtendedHeader(Communication_t *Communicat
In_p->Packet_p->Payload_p = In_p->Packet_p->ExtendedHeader_p + ALIGNED_BULK_EXTENDED_HEADER_LENGTH;
}
- memcpy(In_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &In_p->Packet_p->Header, HEADER_LENGTH);
+ memcpy(In_p->Packet_p->Buffer_p, &In_p->Packet_p->Header, HEADER_LENGTH);
memcpy(In_p->Packet_p->ExtendedHeader_p, In_p->Target_p, In_p->Header.ExtendedHeaderLength);
In_p->Target_p = In_p->Packet_p->Payload_p;
@@ -877,54 +917,46 @@ static ErrorCode_e R15_Network_ReceivePayload(Communication_t *Communication_p)
static ErrorCode_e R15_Network_RegisterRetransmission(Communication_t *Communication_p, PacketMeta_t *Packet_p)
{
- int i;
- int Index;
- ErrorCode_e ReturnValue = E_SUCCESS;
- static RetransmissionContext_t *R_Ctx_p = NULL;
+ int i = 0;
+ int Index = 0;
+ ErrorCode_e ReturnValue = E_RETRANSMISSION_LIST_FULL;
if (R15_NETWORK(Communication_p)->RetransmissionListCount < MAX_SIZE_RETRANSMISSION_LIST) {
- if (NULL == Packet_p->Timer_p->HandleFunction_p) {
- Packet_p->Timer_p->HandleFunction_p = (HandleFunction_t)R15_Network_RetransmissionCallback;
- Packet_p->Timer_p->Param_p = Communication_p;
- }
-
- R_Ctx_p = (RetransmissionContext_t *)malloc(sizeof(RetransmissionContext_t));
-
- if (NULL == R_Ctx_p) {
- return E_ALLOCATE_FAILED;
+ if (NULL == Packet_p->Timer.HandleFunction_p) {
+ Packet_p->Timer.HandleFunction_p = (HandleFunction_t)R15_Network_RetransmissionCallback;
+ Packet_p->Timer.Param_p = Communication_p;
}
- R_Ctx_p->TimerKey = TIMER(Communication_p, TimerGet_Fn)(OBJECT_TIMER(Communication_p), Packet_p->Timer_p);
- R_Ctx_p->Timeout = Packet_p->Timer_p->Time;
- R_Ctx_p->Packet_p = Packet_p;
- R_Ctx_p->Key = R15_Network_CreateUniqueKey(Packet_p, (uint8)(*(R_Ctx_p->Packet_p->ExtendedHeader_p + sizeof(uint16))));
-
- Index = 0;
- C_(printf("r15_network_layer.c (%d) Key(%d) TKey(%d) \n", __LINE__, R_Ctx_p->Key, R_Ctx_p->TimerKey);)
-
do {
- if (NULL != R15_NETWORK(Communication_p)->RetransmissionList[Index]) {
- if (R_Ctx_p->Timeout < TIMER(Communication_p, ReadTime_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index]->TimerKey)) {
+ if (TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) {
+ if (Packet_p->Timer.Time < TIMER(Communication_p, ReadTime_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey)) {
i = R15_NETWORK(Communication_p)->RetransmissionListCount;
for (; Index < i; i--) {
R15_NETWORK(Communication_p)->RetransmissionList[i] = R15_NETWORK(Communication_p)->RetransmissionList[i - 1];
}
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = R_Ctx_p;
- R_Ctx_p = NULL;
- R15_NETWORK(Communication_p)->RetransmissionListCount++;
break;
}
Index++;
} else {
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = R_Ctx_p;
- R_Ctx_p = NULL;
- R15_NETWORK(Communication_p)->RetransmissionListCount++;
break;
}
} while (Index < MAX_SIZE_RETRANSMISSION_LIST);
+
+ if (Index != MAX_SIZE_RETRANSMISSION_LIST) {
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey = TIMER(Communication_p, TimerGet_Fn)(OBJECT_TIMER(Communication_p), &(Packet_p->Timer));
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].Timeout = Packet_p->Timer.Time;
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p = Packet_p;
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].Key = R15_Network_CreateUniqueKey(Packet_p, (uint8)(*(Packet_p->ExtendedHeader_p + sizeof(uint16))));
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = TRUE;
+ R15_NETWORK(Communication_p)->RetransmissionListCount++;
+ C_(printf("r15_network_layer.c (%d) Key(%d) TKey(%d) \n", __LINE__, (R15_NETWORK(Communication_p)->RetransmissionList[Index].Key), (R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey));)
+ }
+
+ ReturnValue = E_SUCCESS;
+
} else {
A_(printf("r15_network_layer.c (%d) ** Err: Retransmission List is full! ** \n", __LINE__);)
}
@@ -938,9 +970,8 @@ static void R15_Network_RetransmissionCallback(Communication_t *Communication_p,
uint32 Index = 0;
/* get first in list of packets for retransmission and remove */
- if (NULL != R15_NETWORK(Communication_p)->RetransmissionList[Index]) {
- free(R15_NETWORK(Communication_p)->RetransmissionList[Index]);
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL;
+ if (TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) {
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE;
}
if (R15_NETWORK(Communication_p)->RetransmissionListCount > 0) {
@@ -951,7 +982,7 @@ static void R15_Network_RetransmissionCallback(Communication_t *Communication_p,
R15_NETWORK(Communication_p)->RetransmissionList[Index] = R15_NETWORK(Communication_p)->RetransmissionList[Index + 1];
}
- R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL;
+ R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE;
/* enqueue the packet for retransmission */
(void)QUEUE(Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, Packet_p);
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl b/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl
index d4a8672..e0a2302 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl
@@ -197,6 +197,7 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p)
ErrorCode_e AuditResponse = CommandAudit(CmdData_p);
CommandData_t CmdData = {0};
uint32 PLSize = sizeof(ErrorCode_e);
+ uint8 AuditResponseData[PLSize];
if (E_SUCCESS != AuditResponse) {
@@ -207,31 +208,18 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p)
CmdData.ApplicationNr = CmdData_p-&gt;ApplicationNr;
CmdData.SessionNr = CmdData_p-&gt;SessionNr;
CmdData.Payload.Size = PLSize;
- CmdData.Payload.Data_p = NULL;
- CmdData.Payload.Data_p = (uint8 *)malloc(PLSize);
-
- if (NULL == CmdData.Payload.Data_p) {
- A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n", __LINE__);)
- return E_ALLOCATE_FAILED;
- }
+ CmdData.Payload.Data_p = AuditResponseData;
Data_p = CmdData.Payload.Data_p;
put_uint32(&amp;Data_p, AuditResponse);
Status = Do_R15_Command_Send(GlobalCommunication_p, &amp;CmdData);
- if (NULL != CmdData.Payload.Data_p) {
-
- free(CmdData.Payload.Data_p);
- }
-
if (E_SUCCESS != Status) {
-
return Status;
}
if (E_UNSUPPORTED_CMD == AuditResponse) {
-
Status = Do_System_ShutDownImpl(CmdData.SessionNr);
}
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl b/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl
index 9919b3d..a0b879a 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl
@@ -81,9 +81,9 @@
</when>
<when test="@type='buffer' and @length!='*'">put_block(&amp;Data_p, <value-of select="@name" />, <value-of select="@length" />);
</when>
- <when test="@type='SupportedCommand' and @length!='*'">if (<value-of select="@name" /> != NULL) {
- put_block(&amp;Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />);
- }
+ <when test="@type='SupportedCommand' and @length!='*'"> if (<value-of select="@name" /> != NULL) {
+ put_block(&amp;Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />);
+ }
</when>
<when test="@type='ListDevice' and @length!='*'">serialize_device_entries(&amp;Data_p, <value-of select="@name" />, <value-of select="@length" />);<!--put_block(&amp;Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />);-->
</when>
@@ -106,7 +106,7 @@
</when>
<when test="@type='buffer' and @length!='*'">PLSize += <value-of select="@length" />;
</when>
- <when test="@type='SupportedCommand' and @length!='*'">PLSize += PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(SupportedCommand_t);
+ <when test="@type='SupportedCommand' and @length!='*'"> PLSize += PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(SupportedCommand_t);
</when>
<when test="@type='ListDevice' and @length!='*'">PLSize += get_device_entries_len(<value-of select="@name" />, <value-of select="@length" />); <!--PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(DirEntry_t);-->
</when>
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml b/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml
index 22251d4..459edac 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml
@@ -17,6 +17,7 @@
<value number="52" name="E_INVALID_CURRDATE_STRING_LENGTH" fatal="false" short="Indicate that the currdate string array variable has invalid length."> Try to reset the loader and if problem still exist, report this error.</value>
<value number="53" name="E_UNALIGNED_DATA" fatal="false" short="Indicate that a variable is not aligned."> Try to reset the loader and if still exist the problem, report this error.</value>
<value number="54" name="E_COPS_DEAUTHENTICATION_FAILED" fatal="false" short="Indicate that ME De-Authentication failed."> Try to reset the loader and if still exist the problem, report this error.</value>
+ <value number="55" name="E_CS_LOCK_FAILED" fatal="false" short="Failed to lock code region protected with critical section."> Loader internal error which should be handled in place where code is executed. Try to reset the loader and if still exist the problem, report this error.</value>
<!--
* IO Fatal 100-150
@@ -75,6 +76,7 @@
<value number="261" name="E_PREVIOUS_BULK_SESSION_IS_NOT_CLOSED" fatal="false" short="Previous bulk session not closed.">Try to reset the loader. If the problem still exist, report this error.</value>
<value number="262" name="E_INVALID_BULK_PROTOCOL_STATE" fatal="false" short="Invalid bulk protocol state.">Try to reset the loader. If the problem still exist, report this error.</value>
<value number="263" name="E_UNSUPPORTED_USB_TRANSFER_TYPE" fatal="false" short="Type of transfer is unsupported.">USB bulk transfer in DMA mode 1 is only supported.</value>
+ <value number="264" name="E_RETRANSMISSION_LIST_FULL" fatal="false" short="Packet can't be registered for retransmission because retransmission list is full.">All entries in the retransmission list are allocated. No place for new packet to be registered in the retransmission list.</value>
<!--
* Signature Fatal 300-350
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c
index 9ceab4c..775b5bf 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c
@@ -243,7 +243,11 @@ ErrorCode_e Do_Communication_Shutdown(Communication_t **Communication_pp)
DestroyBufferInterface(Communication_p);
DestroyTimerInterface(Communication_p);
DestroyQueueInterface(Communication_p);
- free(Communication_p->Functions_p);
+
+ if (NULL != Communication_p->Functions_p) {
+ free(Communication_p->Functions_p);
+ Communication_p->Functions_p = NULL;
+ }
memset(Communication_p, 0, sizeof(Communication_t));
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c
index 224e4fb..b95f288 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c
@@ -13,6 +13,6 @@
* LCD_LCM_CompatibilityList in file LcdVersion.cpp in LCD code.
*/
-char LCM_CurrentVersion[] = "P4Y";
+char LCM_CurrentVersion[] = "P5Y";
/** @} */
diff --git a/lcmodule/source/legacy_compatibility/t_basicdefinitions.h b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h
index 8b453ff..08c3560 100644
--- a/lcmodule/source/legacy_compatibility/t_basicdefinitions.h
+++ b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h
@@ -75,6 +75,12 @@
#define SINT64_SUPPORTED
#define UINT64_SUPPORTED
#define INT64_BASE_TYPE __int64
+#elif (defined(__linux__) || defined(__APPLE__))
+#define SINT64_SUPPORTED
+#define UINT64_SUPPORTED
+#define INT64_BASE_TYPE long long
+#else
+#error "Unknown platform"
#endif
@@ -172,7 +178,7 @@ typedef uint8 boolean;
* Portable bitfield definitions
*******************************************/
-#if defined(COMPILER_IAR_AVR) || defined(COMPILER_IAR_ARM) || defined(_WIN32) || defined(COMPILER_ARM_ARM) || defined(COMPILER_GCC_ARM) || defined(COMPILER_GCC)
+#if defined(COMPILER_IAR_AVR) || defined(COMPILER_IAR_ARM) || defined(_WIN32) || defined(COMPILER_ARM_ARM) || defined(COMPILER_GNUC) || defined(COMPILER_GCC) || defined(COMPILER_GCC_ARM)
/** Type definition to be used when implementing bit-fields that should hold
* signed values.
*/