summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxmarvla <vlatko.markovic@seavus.com>2012-05-09 10:38:57 +0200
committerViktor Mladenovski <viktor.mladenovski@seavus.com>2012-05-25 14:47:16 +0200
commit4dae139e02676ddcc97544f91c87248141d2477a (patch)
treeeb1e418f5f1218490bb96bd281616a5e0e0bb6d0
parent3d6c24ee9d71c1880d758e80bfb76cea490edf9d (diff)
Dump command on UART channels sometimes fails.
Correct the Write Request handling on the host in the LCM bulk protocol. Fix build with Visual Studio for development purposes. ST-Ericsson ID: 432407 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Change-Id: I3bbae61cace9a24ba59d634bcfda7fd0a9c683eb Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/58237 Tested-by: Aleksandar GASOSKI <aleksandar.gasoski@seavus.com> Tested-by: Vlatko STENKOSKI Reviewed-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com> Tested-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com>
-rw-r--r--lcmodule/source/LCM.vcproj4
-rw-r--r--lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c46
-rw-r--r--lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c6
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/include/r_communication_service.h1
-rw-r--r--lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c14
-rw-r--r--source/LCDriver.vcproj4
-rw-r--r--source/LCM/include/t_bulk_protocol.h2
-rw-r--r--source/LcmInterface.cpp4
-rw-r--r--source/LcmInterface.h2
9 files changed, 64 insertions, 19 deletions
diff --git a/lcmodule/source/LCM.vcproj b/lcmodule/source/LCM.vcproj
index ae70436..f2edfc6 100644
--- a/lcmodule/source/LCM.vcproj
+++ b/lcmodule/source/LCM.vcproj
@@ -374,10 +374,6 @@
>
</File>
<File
- RelativePath=".\cnh1606344_ldr_communication_module\source\lcm_version.c"
- >
- </File>
- <File
RelativePath=".\cnh1606344_ldr_communication_module\source\protrom_family.c"
>
</File>
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 d8c5d04..689cd28 100644
--- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
+++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c
@@ -468,8 +468,8 @@ ErrorCode_e R15_Bulk_Process(Communication_t *Communication_p, PacketMeta_t *Pac
{
ErrorCode_e ReturnValue = E_SUCCESS;
BulkExtendedHeader_t ExtendedHeader = {0};
-#ifdef CFG_ENABLE_LOADER_TYPE
TL_BulkVectorList_t *BulkVector_p = R15_TRANSPORT(Communication_p)->BulkHandle.BulkVector_p;
+#ifdef CFG_ENABLE_LOADER_TYPE
TL_BulkVectorList_t *PreviousBulkVector_p = &(R15_TRANSPORT(Communication_p)->PreviousBulkVector);
uint32 ChunksCount = 0;
uint8 ChunksList[MAX_BULK_TL_PROCESSES];
@@ -520,11 +520,45 @@ ErrorCode_e R15_Bulk_Process(Communication_t *Communication_p, PacketMeta_t *Pac
case CMD_BULK_WRITE:
if (NULL != R15_TRANSPORT(Communication_p)->BulkCommandCallback_p) {
- BulkCommandReqCallback_t pcbf = (BulkCommandReqCallback_t)R15_TRANSPORT(Communication_p)->BulkCommandCallback_p;
- pcbf(Communication_p->Object_p, ExtendedHeader.Session, ExtendedHeader.ChunkSize, ExtendedHeader.Offset, ExtendedHeader.Length, FALSE);
+ if ((NULL != BulkVector_p) && (ExtendedHeader.Session <= BulkVector_p->SessionId)) {
+ if (WAIT_CHUNKS == BulkVector_p->State) {
+ /* Read Request already sent to the loader, but probably it was not received correctly,
+ or the timeout in the loader for the Write Request Packet is too short. */
+ uint32 ChunkId = 0;
+ uint8 ChunksList[MAX_BULK_TL_PROCESSES] = {0};
+
+ A_(printf("bulk_protocol.c (%d): Write Request packet Received. Session %d already started! Read Request ignored in Loader!\n", __LINE__, ExtendedHeader.Session);)
+
+ /* 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);
+ R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = 0;
+ }
+
+ R15_Bulk_GetListOfReceivedChunks(BulkVector_p, &ChunkId, ChunksList);
+ R15_TRANSPORT(Communication_p)->BulkHandle.TimerKey = R15_Bulk_GetTimerChunkRetransmision(Communication_p, R15_TIMEOUTS(Communication_p)->TBDR, (HandleFunction_t)R15_Bulk_ReadChunkCallBack);
+
+ if (0 != ChunkId) {
+ ReturnValue = R15_Bulk_SendReadRequest(Communication_p, BulkVector_p, ChunkId, ChunksList, NULL);
+ } else {
+ ReturnValue = R15_Bulk_SendReadRequest(Communication_p, BulkVector_p, 0, NULL, (void *)R15_Bulk_ReadChunkCallBack);
+ }
+ } else if (SEND_READ_REQUEST == BulkVector_p->State) {
+ /* Write Request received from the loader and the LCM is in process of sending of Read Request packet.
+ Probably the timeout in the loader for the Write Request Packet is too short. Packet will be ignored! */
+ A_(printf("bulk_protocol.c (%d): Write Request packet will be Ignored. Session %d already started! ReadRequest in process of sending!\n", __LINE__, ExtendedHeader.Session);)
+ } else {
+ /* Write Request received from the loader and it is still being processed by LCM.
+ Probably the timeout in the loader for the Write Request Packet is too short. Packet will be ignored! */
+ A_(printf("bulk_protocol.c (%d): Write Request packet will be Ignored. Session %d already started! Problem Undefined!\n", __LINE__, ExtendedHeader.Session);)
+ }
+ } else {
+ BulkCommandReqCallback_t pcbf = (BulkCommandReqCallback_t)R15_TRANSPORT(Communication_p)->BulkCommandCallback_p;
+ pcbf(Communication_p->Object_p, ExtendedHeader.Session, ExtendedHeader.ChunkSize, ExtendedHeader.Offset, ExtendedHeader.Length, FALSE);
+ }
}
- /* release the buffer for undefined command */
+ /* release the buffer for Bulk Write command */
ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p);
break;
#endif
@@ -532,13 +566,13 @@ ErrorCode_e R15_Bulk_Process(Communication_t *Communication_p, PacketMeta_t *Pac
case CMD_BULK_STATUS:
// not implemented.
A_(printf("bulk_protocol.c (%d): ** Not implemented bulk command! **\n", __LINE__);)
- /* release the buffer for unimplemented command */
+ /* release the buffer for Bulk Status command */
ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p);
break;
default:
A_(printf("bulk_protocol.c (%d): ** Undefined bulk command! **\n", __LINE__);)
- /* release the buffer for undefined command */
+ /* Undefined Bulk command!!! Release the buffer. */
ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p);
break;
}
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 b74cb4a..e0f1760 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
@@ -230,6 +230,7 @@ ErrorCode_e R15_Network_ReceiverHandler(Communication_t *Communication_p)
ReqData - In_p->RecBackupData, R15_Network_ReadCallback,
Communication_p->CommunicationDevice_p)) {
/* Read failed! Return to previous state. */
+ A_(printf("r15_network_layer.c (%d) R15_Network_ReceiverHandler() Read Failed!\n", __LINE__);)
In_p->ReqData = ReqData;
In_p->ReqBuffOffset = ReqBufferOffset;
Communication_p->BackupCommBufferSize = In_p->RecBackupData;
@@ -274,6 +275,7 @@ ErrorCode_e R15_Network_ReceiverHandler(Communication_t *Communication_p)
In_p->Target_p + ReqBufferOffset, ReqData, R15_Network_ReadCallback,
Communication_p->CommunicationDevice_p)) {
/* Read failed! Return to previous state. */
+ A_(printf("r15_network_layer.c (%d) R15_Network_ReceiverHandler() Read Failed!\n", __LINE__);)
In_p->ReqData = ReqData;
In_p->ReqBuffOffset = ReqBufferOffset;
}
@@ -293,6 +295,8 @@ ErrorCode_e R15_Network_ReceiverHandler(Communication_t *Communication_p)
In_p->ReqBuffOffset = 0;
#ifdef CFG_ENABLE_LOADER_TYPE
+ A_(printf("r15_network_layer.c (%d) R15_Network_ReceiverHandler() Receive Error ! \n\n", __LINE__);)
+
if (E_SUCCESS == Communication_p->CommunicationDevice_p->Read(In_p->Target_p,
ALIGNED_HEADER_LENGTH, R15_Network_ReadCallback,
Communication_p->CommunicationDevice_p)) {
@@ -354,6 +358,7 @@ StartTramsmitter:
Out_p->State = SEND_HEADER;
} else {
//Do_CommunicationInternalErrorHandler(E_RETRANSMITION_FAILED);
+ A_(printf("r15_network_layer.c (%d) Packet Retransmission Failed! Polling will stop!\n", __LINE__);)
ReturnValue = E_RETRANSMITION_FAILED;
break;
}
@@ -742,6 +747,7 @@ static ErrorCode_e R15_Network_ReceiveHeader(const Communication_t *const Commun
A_(static uint8 print_header = 1;)
if (In_p->RecData == 0) {
+ A_(printf("r15_network_layer.c (%d) Synchronize for Receiving Header!\n", __LINE__);)
In_p->ReqData = ALIGNED_HEADER_LENGTH;
In_p->Target_p = In_p->Scratch;
In_p->ReqBuffOffset = 0;
diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/include/r_communication_service.h b/lcmodule/source/cnh1606344_ldr_communication_module/include/r_communication_service.h
index e012feb..2403713 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/include/r_communication_service.h
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/include/r_communication_service.h
@@ -58,6 +58,7 @@ extern Communication_t *GlobalCommunication_p;
extern Communication_t DebugCommunication;
+extern char LCM_CurrentVersion[];
/*******************************************************************************
* Declaration of functions
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 775b5bf..54ff332 100644
--- a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c
+++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c
@@ -34,10 +34,6 @@
#include "r_z_transport.h"
#endif
-
-extern char LCM_CurrentVersion[];
-
-
/*******************************************************************************
* File scope types, constants and variables
******************************************************************************/
@@ -46,6 +42,16 @@ extern char LCM_CurrentVersion[];
Communication_t GlobalCommunication = {0};
Communication_t *GlobalCommunication_p = &GlobalCommunication;
+#if !(defined(__MINGW32__) || defined(__linux__) || defined(__APPLE__))
+#ifdef CFG_ENABLE_LOADER_TYPE
+#ifndef MACH_TYPE_STN8500
+char LCM_CurrentVersion[] = ""; // Generate Empty String for Loader Builds on ClearCase
+#endif // MACH_TYPE_STN8500
+#else
+char LCM_CurrentVersion[] = "TestBuild"; // Generate Test String for unofficial builds in Windows environment
+#endif // CFG_ENABLE_LOADER_TYPE
+#endif // __MINGW32__ || __linux__ || __APPLE__
+
static FamilyDescriptor_t ProtocolFamilies[] = {
{
R15_Family_Init,
diff --git a/source/LCDriver.vcproj b/source/LCDriver.vcproj
index ef7e7c4..44672e4 100644
--- a/source/LCDriver.vcproj
+++ b/source/LCDriver.vcproj
@@ -537,10 +537,6 @@
RelativePath=".\LCDriverThread.cpp"
>
</File>
- <File
- RelativePath=".\LcdVersion.cpp"
- >
- </File>
</Filter>
<Filter
Name="api_wrappers"
diff --git a/source/LCM/include/t_bulk_protocol.h b/source/LCM/include/t_bulk_protocol.h
index 95c4dbd..67a1dab 100644
--- a/source/LCM/include/t_bulk_protocol.h
+++ b/source/LCM/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/source/LcmInterface.cpp b/source/LcmInterface.cpp
index 6ddea57..a5f7baa 100644
--- a/source/LcmInterface.cpp
+++ b/source/LcmInterface.cpp
@@ -16,7 +16,9 @@
#endif
char *LcmInterface::m_pchLCMLibPath = 0;
-extern const char LCD_LCM_Compatibility[];
+#if !(defined(__MINGW32__) || defined(__linux__) || defined(__APPLE__))
+char LCD_LCM_Compatibility[] = "TestBuild"; // Generate Test String for unofficial builds in Windows environment
+#endif // __MINGW32__ || __linux__ || __APPLE__
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
diff --git a/source/LcmInterface.h b/source/LcmInterface.h
index be1bc01..1619257 100644
--- a/source/LcmInterface.h
+++ b/source/LcmInterface.h
@@ -17,6 +17,8 @@
typedef void *HMODULE;
#endif
+extern char LCD_LCM_Compatibility[];
+
typedef ErrorCode_e(*CommunicationInitialize_t)(void *Object_p, Communication_t **Communication_pp, Family_t Family, HashDevice_t *HashDevice_p, CommunicationDevice_t *CommunicationDevice_p, Do_CEH_Call_t CommandCallback_p, BuffersInterface_t *Buffers_p, TimersInterface_t *Timers_p, QueueInterface_t *Queue_p);
typedef ErrorCode_e(*CommunicationShutdown_t)(Communication_t **Communication_pp);
typedef ErrorCode_e(*CommunicationPoll_t)(Communication_t *Communication_p);