From b9b4df06ddb81a6d14354fc0d42e22acf0b4c30c Mon Sep 17 00:00:00 2001 From: xmarvla Date: Thu, 16 Jun 2011 14:45:38 +0100 Subject: LCM R1T and LCDriver R1N official release. ST-Ericsson ID: 345044 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Change-Id: Ib1901abfc2efa6c887c70b8583ddd2258e21aa78 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25187 Tested-by: Vlatko STENKOSKI Tested-by: Cvetko MLADENOVSKI Tested-by: Aleksandar GASOSKI Reviewed-by: Zoran ANCEVSKI Reviewed-by: QATEST Reviewed-by: Vlatko PISTOLOV Conflicts: lcmodule/win_binaries/LCM.dll win_binaries/LCDriver_CNH1606432.dll --- lcmodule/source/LCM.rc | 6 +- .../include/r_a2_protocol.h | 4 +- .../include/r_a2_speedflash.h | 4 - .../include/r_a2_transport.h | 5 +- .../source/a2_protocol.c | 4 +- .../source/a2_speedflash.c | 14 +- .../source/bulk_protocol.c | 2 +- .../source/protrom_transport.c | 2 +- .../include/r_a2_header.h | 4 +- .../include/r_a2_network.h | 4 +- .../include/r_r15_header.h | 6 +- .../include/t_a2_network.h | 6 +- .../include/t_protrom_network.h | 2 +- .../include/t_r15_network_layer.h | 6 +- .../source/a2_network.c | 83 ++- .../source/protrom_network.c | 91 ++- .../source/r15_network_layer.c | 156 +++-- .../source/z_network.c | 35 +- .../debug_subsystem/r_debug_subsystem.h | 29 +- .../include/r_debug_macro.h | 12 +- .../include/r_memmory_utils.h | 67 -- .../include/r_memory_utils.h | 66 ++ .../cnh1605551_ldr_utilities/include/r_queue.h | 22 +- .../include/r_serialization.h | 35 +- .../source/serialization.c | 188 +++--- .../config/a2_commands.xml | 672 ++++++++++----------- .../config/audit_c.xsl | 6 +- .../config/command_marshal.xsl | 16 +- .../config/error_codes.xml | 65 +- .../include/r_a2_family.h | 6 +- .../include/r_communication_service.h | 11 +- .../include/t_communication_service.h | 25 +- .../source/a2_family.c | 16 +- .../source/communication_service.c | 42 +- .../source/measurement_tool.c | 2 +- .../source/protrom_family.c | 18 +- .../source/r15_family.c | 24 +- .../source/z_family.c | 8 +- .../test_cases/ADbg_cnh1606344.c | 2 +- lcmodule/source/resource.h | 2 +- lcmodule/test_cases/ADbg_cnh1606344.c | 2 +- source/LCDriver.rc | 6 +- source/LCDriverMethods.cpp | 6 +- source/LCM/include/error_codes.h | 138 +++-- source/LCM/include/t_communication_service.h | 25 +- source/LCM/include/t_protrom_network.h | 2 +- source/LCM/include/t_r15_network_layer.h | 6 +- source/resource.h | 2 +- 48 files changed, 1126 insertions(+), 829 deletions(-) mode change 100644 => 100755 lcmodule/source/LCM.rc delete mode 100644 lcmodule/source/cnh1605551_ldr_utilities/include/r_memmory_utils.h create mode 100644 lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h mode change 100644 => 100755 source/LCDriver.rc diff --git a/lcmodule/source/LCM.rc b/lcmodule/source/LCM.rc old mode 100644 new mode 100755 index 57344f6..b011c38 --- a/lcmodule/source/LCM.rc +++ b/lcmodule/source/LCM.rc @@ -69,16 +69,16 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "Build date: 2011-06-15" + VALUE "Comments", "Build date: 2011-06-16" VALUE "CompanyName", "ST Ericsson AB" VALUE "FileDescription", "LCM Dynamic Link Library" VALUE "FileVersion", "1,0,0,1" VALUE "InternalName", "LCM" VALUE "LegalCopyright", "Copyright (C) ST Ericsson 2011" VALUE "OriginalFilename", "LCM.dll" - VALUE "PrivateBuild", "http://gerrit.lud.stericsson.com/gerrit/20944" + VALUE "PrivateBuild", "Change-Id: Ib1901abfc2efa6c887c70b8583ddd2258e21aa78" VALUE "ProductName", "CXA1104507 Loader Communication Module" - VALUE "ProductVersion", "P1N" + VALUE "ProductVersion", "R1T" END END BLOCK "VarFileInfo" diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_protocol.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_protocol.h index 6a94bae..fc453c2 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_protocol.h +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_protocol.h @@ -9,7 +9,9 @@ * @{ * @addtogroup a2_family * @{ - * @addtogroup a2_protocol + * @addtogroup a2_protocol A2 Protocol + * Functionalities for handling A2 commands. + * * @{ */ diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_speedflash.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_speedflash.h index 6124d58..b36b5f0 100755 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_speedflash.h +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_speedflash.h @@ -56,10 +56,7 @@ extern "C" * Set the LCM in A2 Speedflash Mode. * * @param [in] Communication_p Communication module context. - * @param [in] State State of the speedflash (TRUE - on, FALSE - off). * - * @retval E_SUCCESS After successful execution. - * @retval */ LCM_API void Do_A2_Speedflash_Start(Communication_t *Communication_p); @@ -73,7 +70,6 @@ extern "C" * @param [in] BufferSize Size of the speedflash sub-blocks. * * @retval E_SUCCESS After successful execution. - * @retval */ LCM_API ErrorCode_e Do_A2_Speedflash_WriteBlock(Communication_t *Communication_p, const void *Buffer, const uint32 BufferSize); #ifdef __cplusplus diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_transport.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_transport.h index bb082e7..7d90384 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_transport.h +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/r_a2_transport.h @@ -9,7 +9,8 @@ * @{ * @addtogroup a2_family * @{ - * @addtogroup ldr_transport_layer + * @addtogroup ldr_transport_layer A2 Transport Layer + * * @{ */ @@ -41,7 +42,7 @@ ErrorCode_e A2_Transport_Poll(Communication_t *Communication_p); * @param [in] Communication_p The communication context * structure to receive information * about this module instance. - * @param [in] InputData_p Pointer to the input data. + * @param [in] InputDataIn_p Pointer to the input data. * * @retval E_SUCCESS After successful execution. * @retval E_FAILED_TO_ALLOCATE_COMM_BUFFER Failed to allocate communication diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_protocol.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_protocol.c index a26b677..a2a2a43 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_protocol.c @@ -30,7 +30,7 @@ #include "r_debug.h" #include "r_debug_macro.h" #include "r_serialization.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" /******************************************************************************* * File scope types, constants and variables @@ -179,7 +179,7 @@ static ErrorCode_e ProcessAcknowledgement(Communication_t *Communication_p, A2_P ReturnValue = A2_Network_PacketRelease(Communication_p, Packet_p); if (A2_SPEEDFLASH_START == A2_SPEEDFLASH(Communication_p)->State) { - Communication_p->CommunicationDevice_p->Cancel(Communication_p); + Communication_p->CommunicationDevice_p->Cancel(Communication_p->CommunicationDevice_p); A2_SPEEDFLASH(Communication_p)->State = A2_SPEEDFLASH_ACTIVE; A2_SPEEDFLASH(Communication_p)->InboundState = A2_SPEEDFLASH_READ_REQ; } diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_speedflash.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_speedflash.c index b411027..abb6b58 100755 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_speedflash.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/a2_speedflash.c @@ -83,11 +83,15 @@ ErrorCode_e A2_Speedflash_Poll(Communication_t *Communication_p) case A2_SPEEDFLASH_READ_REQ: A2_SPEEDFLASH(Communication_p)->InboundState = A2_SPEEDFLASH_WAIT_READ_REQ; +#ifdef CFG_ENABLE_LOADER_TYPE if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read((void *)A2_SPEEDFLASH(Communication_p)->Scratch, - A2_SPEEDFLASH_REQ_SIZE, A2_Speedflash_ReadCallback, Communication_p)) { + A2_SPEEDFLASH_REQ_SIZE, A2_Speedflash_ReadCallback, Communication_p->CommunicationDevice_p)) { A2_SPEEDFLASH(Communication_p)->InboundState = A2_SPEEDFLASH_READ_REQ; } - +#else + (void)Communication_p->CommunicationDevice_p->Read((void *)A2_SPEEDFLASH(Communication_p)->Scratch, + A2_SPEEDFLASH_REQ_SIZE, A2_Speedflash_ReadCallback, Communication_p->CommunicationDevice_p); +#endif break; case A2_SPEEDFLASH_WAIT_READ_REQ: /* nothing to do */ @@ -98,7 +102,7 @@ ErrorCode_e A2_Speedflash_Poll(Communication_t *Communication_p) A2_SPEEDFLASH(Communication_p)->InboundState = A2_SPEEDFLASH_WAIT_WRITE_BLOCK; if (E_SUCCESS != Communication_p->CommunicationDevice_p->Write(A2_SPEEDFLASH(Communication_p)->Outbound_p, - A2_SPEEDFLASH(Communication_p)->OutboundSize, A2_Speedflash_WriteCallback, Communication_p)) { + A2_SPEEDFLASH(Communication_p)->OutboundSize, A2_Speedflash_WriteCallback, Communication_p->CommunicationDevice_p)) { A2_SPEEDFLASH(Communication_p)->InboundState = A2_SPEEDFLASH_WRITE_BLOCK; } } @@ -114,7 +118,7 @@ ErrorCode_e A2_Speedflash_Poll(Communication_t *Communication_p) void A2_Speedflash_WriteCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); A2_SPEEDFLASH(Communication_p)->Outbound_p = NULL; A2_SPEEDFLASH(Communication_p)->OutboundSize = 0; @@ -132,7 +136,7 @@ void A2_Speedflash_WriteCallback(const void *Data_p, const uint32 Length, void * void A2_Speedflash_ReadCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); A2_CommandData_t CmdData; CmdData.Type = A2_SPEEDFLASH_GR; 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 5727d4e..dd92fe8 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c @@ -29,7 +29,7 @@ #include "r_debug_macro.h" #include "r_communication_service.h" #include "t_security_algorithms.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" #ifdef CFG_ENABLE_MEASUREMENT_TOOL #include "r_measurement_tool.h" 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 ef50be7..6ea08d4 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/protrom_transport.c @@ -28,7 +28,7 @@ #include "r_protrom_protocol.h" #include "r_communication_service.h" #include "t_security_algorithms.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" /******************************************************************************* * Declaration of file local functions diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_header.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_header.h index cefb39f..d750063 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_header.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_header.h @@ -9,7 +9,9 @@ * @{ * @addtogroup a2_family * @{ - * @addtogroup ldr_header + * @addtogroup ldr_header A2 Header + * Functionalities for serialization and de-serialization A2 header. + * * @{ */ diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_network.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_network.h index e97a3e7..fd6efb7 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_network.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_a2_network.h @@ -9,7 +9,9 @@ * @{ * @addtogroup a2_family * @{ - * @addtogroup ldr_network_layer + * @addtogroup ldr_network_layer A2 Network Layer + * A2 network layer support receiving and sending A2 packets. + * * @{ */ diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_r15_header.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_r15_header.h index fc05539..0011bc3 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/r_r15_header.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/r_r15_header.h @@ -63,9 +63,9 @@ void R15_SerializeHeader(void *Data_p, const R15_Header_t *Header_p); /** * Deserialize the extended header stored in network format to a structure. * - * @param [out] Header_p Pointer to the extended header structure where the - * header data should be placed. - * @param [in] Data_p Pointer to the buffer with received header. + * @param [out] ExtendedHeader_p Pointer to the extended header structure where the + * header data should be placed. + * @param [in] Data_p Pointer to the buffer with received header. * * @return none. */ diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_a2_network.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_a2_network.h index cdc71d4..d91b2f0 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_a2_network.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_a2_network.h @@ -98,7 +98,7 @@ typedef struct A2_PacketMeta { corresponding buffer used in the packet. */ A2_Header_t Header; /**< Structure of the header. */ - uint32 Resend; /**< Resend counter. */ + uint32 Resend; /**< Re-send counter. */ Timer_t *Timer_p; /**< Timer data used for sending/receiving packet. */ uint8 *Payload_p; /**< Pointer to the payload data @@ -137,7 +137,7 @@ typedef struct { A2_Header_t Header; /** Pointer to meta data for allocated buffer for handling A2 packet.*/ A2_PacketMeta_t *Packet_p; - /** Number of packets before receiver is stoped. */ + /** Number of packets before receiver is stopped. */ uint8 PacketsBeforeReceiverStop; /** Indicator for stopping the receiver. */ boolean StopTransfer; @@ -148,7 +148,7 @@ typedef struct { /** A2_Outbound_t*/ /** Structure for handling outgoing A2 packets.*/ typedef struct { - /**< State of the state machine for handling outgoing A2 packets. */ + /** State of the state machine for handling outgoing A2 packets. */ A2_OutboundState_t State; /** Temporary pointer for handling PROTROM packet.*/ A2_PacketMeta_t *Packet_p; diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h index 955b589..b29a65a 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h @@ -34,7 +34,7 @@ typedef enum { PROTROM_RECEIVE_HEADER, /**< State for receiving Header.*/ PROTROM_RECEIVE_PAYLOAD, /**< State for receiving Payload.*/ PROTROM_RECEIVE_ERROR, /**< State for error handling.*/ - PROTROM_RECEIVE_IDLE /**< State for receiver idele.*/ + PROTROM_RECEIVE_IDLE /**< State for receiver idle.*/ } Protrom_InboundState_t; /** Defined state of the transmitter */ 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 5e78ddd..3d48957 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 @@ -286,13 +286,13 @@ typedef struct { PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT+BULK_BUFFER_COUNT]; /**< List of meta data for used packets. */ RetransmissionContext_t *RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; - /**< List of packet for retransmision */ + /**< List of packet for retransmission */ uint32 RetransmissionListCount; - /**< Counter for packets retransmision */ + /**< Counter for packets retransmission */ R15_Inbound_t Inbound; /**< Context for receiver. */ R15_Outbound_t Outbound; - /**< Context for transmiter. */ + /**< Context for transmitter. */ } R15_NetworkContext_t; /* diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/source/a2_network.c b/lcmodule/source/cnh1605205_ldr_network_layer/source/a2_network.c index 886ee46..cfbf592 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/source/a2_network.c +++ b/lcmodule/source/cnh1605205_ldr_network_layer/source/a2_network.c @@ -70,7 +70,7 @@ ErrorCode_e A2_Network_Initialize(Communication_t *Communication_p) memset(A2_NETWORK(Communication_p), 0, sizeof(A2_NetworkContext_t)); /* Simulate a finished read to get the inbound state-machine going. */ - A2_Network_ReadCallback(NULL, 0, Communication_p); + A2_Network_ReadCallback(NULL, 0, Communication_p->CommunicationDevice_p); A2_NETWORK(Communication_p)->Outbound.TxCriticalSection = Do_CriticalSection_Create(); #ifdef CFG_ENABLE_LOADER_TYPE @@ -123,7 +123,7 @@ ErrorExit: /* - * Handler for received packets in A2 protocl family. + * Handler for received packets in A2 protocol family. * * This callback function handles the received packets. * @@ -136,7 +136,7 @@ ErrorExit: void A2_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Param_p) { IDENTIFIER_NOT_USED(Data_p); - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); C_(printf("a2_network.c (%d) RecLength(%d) RecBackupData (%d)\n", __LINE__, Length, A2_NETWORK(Communication_p)->Inbound.RecBackupData);) A2_NETWORK(Communication_p)->Inbound.RecData += Length + A2_NETWORK(Communication_p)->Inbound.RecBackupData; @@ -186,46 +186,87 @@ void A2_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Para ErrorCode_e A2_Network_ReceiverHandler(Communication_t *Communication_p) { uint32 ReqData; + uint32 ReqBufferOffset; A2_Inbound_t *In_p = &(A2_NETWORK(Communication_p)->Inbound); if (In_p->ReqData > 0) { if (Communication_p->BackupCommBufferSize != 0) { if (Communication_p->BackupCommBufferSize < In_p->ReqData) { memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); - In_p->RecBackupData = Communication_p->BackupCommBufferSize; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + In_p->ReqBuffOffset + Communication_p->BackupCommBufferSize, - In_p->ReqData - Communication_p->BackupCommBufferSize, - A2_Network_ReadCallback, Communication_p); - C_(printf("a2_network.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, In_p->ReqData, In_p->RecData);) - C_(printf("a2_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) - In_p->RecData = 0; + ReqData = In_p->ReqData; + In_p->ReqData = 0; + ReqBufferOffset = In_p->ReqBuffOffset; In_p->ReqBuffOffset = 0; + In_p->RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; - In_p->ReqData = 0; + In_p->RecData = 0; + + C_(printf("a2_network.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, ReqData, In_p->RecData);) + C_(printf("a2_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, A2_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + Communication_p->BackupCommBufferSize = In_p->RecBackupData; + In_p->RecBackupData = 0; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, A2_Network_ReadCallback, + Communication_p->CommunicationDevice_p); +#endif } else { + /* Copy content of backup buffer into receive buffer */ memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, In_p->ReqData); + /* Move rest of backup data at the beginning of the backup buffer. */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + In_p->ReqData, Communication_p->BackupCommBufferSize - In_p->ReqData); + /* Update the size of the backup buffer to handle only unprocessed data. */ Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - In_p->ReqData; + ReqData = In_p->ReqData; In_p->ReqData = 0; - A2_Network_ReadCallback(In_p->Target_p + In_p->ReqBuffOffset, ReqData, Communication_p); + ReqBufferOffset = In_p->ReqBuffOffset; + In_p->ReqBuffOffset = 0; In_p->RecData = 0; + A2_Network_ReadCallback(In_p->Target_p + ReqBufferOffset, ReqData, Communication_p->CommunicationDevice_p); } } else { ReqData = In_p->ReqData; In_p->ReqData = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + In_p->ReqBuffOffset, ReqData, A2_Network_ReadCallback, Communication_p); - C_(printf("a2_network.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, In_p->ReqData, In_p->RecData);) - C_(printf("a2_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) - In_p->RecData = 0; + ReqBufferOffset = In_p->ReqBuffOffset; In_p->ReqBuffOffset = 0; + In_p->RecData = 0; + + C_(printf("a2_network.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, ReqData, In_p->RecData);) + C_(printf("a2_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, A2_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, A2_Network_ReadCallback, + Communication_p->CommunicationDevice_p); +#endif } } - /* check for receiver sinhronization */ + /* check for receiver synchronization */ if (In_p->State == A2_RECEIVE_ERROR) { A2_RESET_INBOUND(In_p, A2_RECEIVE_HEADER); A2_SYNC_HEADER(In_p, A2_HEADER_LENGTH, In_p->Scratch); - //(void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, A2_HEADER_LENGTH, A2_Network_ReadCallback, Communication_p); + //(void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, A2_HEADER_LENGTH, A2_Network_ReadCallback, Communication_p->CommunicationDevice_p); } return A2_NETWORK(Communication_p)->Inbound.LCM_Error; @@ -369,7 +410,7 @@ void A2_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Par { IDENTIFIER_NOT_USED(Data_p); IDENTIFIER_NOT_USED(Length); - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); A2_Outbound_t *Out_p = &(A2_NETWORK(Communication_p)->Outbound); if (A2_SENDING_PAYLOAD == Out_p->State) { @@ -512,7 +553,7 @@ ErrorCode_e A2_Network_TransmiterHandler(Communication_t *Communication_p) } if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p), - A2_HEADER_LENGTH, A2_Network_WriteCallback, Communication_p)) { + A2_HEADER_LENGTH, A2_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { C_(printf("a2_network.c (%d) Header Sent to comm device! \n", __LINE__);) } else { Out_p->State = A2_SEND_HEADER; @@ -529,7 +570,7 @@ ErrorCode_e A2_Network_TransmiterHandler(Communication_t *Communication_p) if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write( (Out_p->Packet_p->Buffer_p + A2_HEADER_LENGTH), Out_p->Packet_p->Header.DataLength + A2_CRC_LENGTH, - A2_Network_WriteCallback, Communication_p)) { + A2_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { C_(printf("a2_network.c (%d) Payload Sent to comm device! \n", __LINE__);) } else { Out_p->State = A2_SEND_PAYLOAD; diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/source/protrom_network.c b/lcmodule/source/cnh1605205_ldr_network_layer/source/protrom_network.c index 0e52519..7b264e1 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/source/protrom_network.c +++ b/lcmodule/source/cnh1605205_ldr_network_layer/source/protrom_network.c @@ -67,7 +67,7 @@ ErrorCode_e Protrom_Network_Initialize(Communication_t *Communication_p) PROTROM_NETWORK(Communication_p)->Outbound.TxCriticalSection = Do_CriticalSection_Create(); /* Simulate a finished read to get the inbound state-machine going. */ - Protrom_Network_ReadCallback(NULL, 0, Communication_p); + Protrom_Network_ReadCallback(NULL, 0, Communication_p->CommunicationDevice_p); (void)QUEUE(Communication_p, Fifo_SetCallback_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, QUEUE_NONEMPTY, Protrom_QueueCallback, Communication_p); return E_SUCCESS; @@ -109,13 +109,13 @@ ErrorCode_e Protrom_Network_Shutdown(const Communication_t *const Communication_ * * @param [in] Data_p Pointer to the received data. * @param [in] Length Length of the received data. - * @param [in] Param_p Extra parameteres. + * @param [in] Param_p Extra parameters. * * @return none. */ void Protrom_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); A_(printf("protrom_family.c (%d) RecLength(%d) RecBackupData (%d)\n", __LINE__, Length, PROTROM_NETWORK(Communication_p)->Inbound.RecBackupData);) PROTROM_NETWORK(Communication_p)->Inbound.RecData = Length + PROTROM_NETWORK(Communication_p)->Inbound.RecBackupData; @@ -175,6 +175,7 @@ void Protrom_Network_ReadCallback(const void *Data_p, const uint32 Length, void void Protrom_Network_ReceiverHandler(Communication_t *Communication_p) { uint32 ReqData; + uint32 ReqBufferOffset; Protrom_Inbound_t *In_p = &(PROTROM_NETWORK(Communication_p)->Inbound); /* new data for receiving ? */ @@ -182,42 +183,91 @@ void Protrom_Network_ReceiverHandler(Communication_t *Communication_p) if (Communication_p->BackupCommBufferSize != 0) { if (Communication_p->BackupCommBufferSize < In_p->ReqData) { memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); - In_p->RecBackupData = Communication_p->BackupCommBufferSize; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + In_p->ReqBuffOffset + Communication_p->BackupCommBufferSize, - In_p->ReqData - Communication_p->BackupCommBufferSize, - Protrom_Network_ReadCallback, Communication_p); - C_(printf("protrom_network.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, In_p->ReqData, In_p->RecData);) - C_(printf("protrom_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) - In_p->RecData = 0; + ReqData = In_p->ReqData; + In_p->ReqData = 0; + ReqBufferOffset = In_p->ReqBuffOffset; In_p->ReqBuffOffset = 0; + In_p->RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; - In_p->ReqData = 0; + In_p->RecData = 0; + + C_(printf("protrom_network.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, ReqData, In_p->RecData);) + C_(printf("protrom_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + Communication_p->BackupCommBufferSize = In_p->RecBackupData; + In_p->RecBackupData = 0; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p); +#endif } else { + /* Copy content of backup buffer into receive buffer */ memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, In_p->ReqData); + /* Move rest of backup data at the beginning of the backup buffer */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + In_p->ReqData, Communication_p->BackupCommBufferSize - In_p->ReqData); + /* Update the size of the backup buffer */ Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - In_p->ReqData; + ReqData = In_p->ReqData; In_p->ReqData = 0; - Protrom_Network_ReadCallback(In_p->Target_p + In_p->ReqBuffOffset, ReqData, Communication_p); + ReqBufferOffset = In_p->ReqBuffOffset; + In_p->ReqBuffOffset = 0; In_p->RecData = 0; + Protrom_Network_ReadCallback(In_p->Target_p + ReqBufferOffset, ReqData, Communication_p->CommunicationDevice_p); } } else { ReqData = In_p->ReqData; In_p->ReqData = 0; + ReqBufferOffset = In_p->ReqBuffOffset; + In_p->ReqBuffOffset = 0; In_p->RecData = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + In_p->ReqBuffOffset, ReqData, Protrom_Network_ReadCallback, Communication_p); - C_(printf("protrom_network.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, In_p->ReqData, In_p->RecData);) + C_(printf("protrom_network.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, ReqData, In_p->RecData);) C_(printf("protrom_network.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) - In_p->ReqBuffOffset = 0; + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p); +#endif } } - /* check for receiver sinhronization */ + /* check for receiver synchronization */ if (In_p->State == PROTROM_RECEIVE_ERROR) { In_p->ReqData = 0; In_p->RecData = 0; In_p->ReqBuffOffset = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, PROTROM_HEADER_LENGTH, Protrom_Network_ReadCallback, Communication_p); +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS == Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + PROTROM_HEADER_LENGTH, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + In_p->State = PROTROM_RECEIVE_HEADER; + } +#else + (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + PROTROM_HEADER_LENGTH, Protrom_Network_ReadCallback, + Communication_p->CommunicationDevice_p); In_p->State = PROTROM_RECEIVE_HEADER; +#endif } } @@ -236,7 +286,7 @@ void Protrom_Network_ReceiverHandler(Communication_t *Communication_p) */ void Protrom_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); Protrom_Outbound_t *Out_p = &(PROTROM_NETWORK(Communication_p)->Outbound); if (Out_p->State == PROTROM_SENDING_PAYLOAD) { if (NULL != Out_p->Packet_p) { @@ -341,12 +391,11 @@ static ErrorCode_e Protrom_Network_TransmiterHandler(Communication_t *Communicat } /* FALLTHROUGH */ - case PROTROM_SEND_HEADER: Out_p->State = PROTROM_SENDING_HEADER; if (E_SUCCESS != Communication_p->CommunicationDevice_p->Write(Out_p->Packet_p->Buffer_p, - PROTROM_HEADER_LENGTH, Protrom_Network_WriteCallback, Communication_p)) { + PROTROM_HEADER_LENGTH, Protrom_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { Out_p->State = PROTROM_SEND_HEADER; break; } @@ -357,7 +406,7 @@ static ErrorCode_e Protrom_Network_TransmiterHandler(Communication_t *Communicat Out_p->State = PROTROM_SENDING_PAYLOAD; if (E_SUCCESS != Communication_p->CommunicationDevice_p->Write(Out_p->Packet_p->Buffer_p + PROTROM_HEADER_LENGTH, Out_p->Packet_p->Header.PayloadLength + PROTROM_CRC_LENGTH, - Protrom_Network_WriteCallback, Communication_p)) { + Protrom_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { Out_p->State = PROTROM_SEND_PAYLOAD; 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 85be0a2..1ae4d2e 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 @@ -23,7 +23,6 @@ #include "c_system.h" #include "r_r15_transport_layer.h" #include "r_r15_family.h" -#include "r_communication_service.h" #include "r_r15_header.h" #include "r_bulk_protocol.h" #include "r_command_protocol.h" @@ -41,7 +40,7 @@ extern Measurement_t *Measurement_p; #endif -static PacketMeta_t PacketMetaInfo[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT] ; /* Packet Meta Info vector*/ +static PacketMeta_t PacketMetaInfo[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT] = {{0}}; /* Packet Meta Info vector*/ /******************************************************************************* * Declaration of file local functions @@ -86,7 +85,7 @@ ErrorCode_e R15_Network_Initialize(Communication_t *Communication_p) R15_NETWORK(Communication_p)->Outbound.TxCriticalSection = Do_CriticalSection_Create(); /* Simulate a finished read to get the inbound state-machine going. */ - R15_Network_ReadCallback(NULL, 0, Communication_p); + R15_Network_ReadCallback(NULL, 0, Communication_p->CommunicationDevice_p); #ifdef CFG_ENABLE_LOADER_TYPE (void)QUEUE(Communication_p, Fifo_SetCallback_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, QUEUE_NONEMPTY, R15_QueueOutCallback, Communication_p); (void)QUEUE(Communication_p, Fifo_SetCallback_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Inbound_p, QUEUE_NONEMPTY, R15_QueueInCallback, Communication_p); @@ -98,7 +97,7 @@ ErrorCode_e R15_Network_Initialize(Communication_t *Communication_p) } /* - * Shut down the r15 network layer. + * Shutdown the R15 Network layer. * * @param [in,out] Communication_p Communication module context. * @@ -152,7 +151,7 @@ ErrorExit: */ void R15_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); C_(printf("r15_network_layer.c (%d) RecLength(%d) RecBackupData (%d)\n", __LINE__, Length, R15_NETWORK(Communication_p)->Inbound.RecBackupData);) R15_NETWORK(Communication_p)->Inbound.RecData = Length + R15_NETWORK(Communication_p)->Inbound.RecBackupData; @@ -208,7 +207,7 @@ void R15_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Par ErrorCode_e R15_Network_ReceiverHandler(Communication_t *Communication_p) { uint32 ReqData; - uint32 ReqBuffOffset = 0; + uint32 ReqBufferOffset; R15_Inbound_t *In_p = &(R15_NETWORK(Communication_p)->Inbound); /* new data for receiving ? */ @@ -216,43 +215,93 @@ ErrorCode_e R15_Network_ReceiverHandler(Communication_t *Communication_p) if (Communication_p->BackupCommBufferSize != 0) { if (Communication_p->BackupCommBufferSize < In_p->ReqData) { memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); - In_p->RecBackupData = Communication_p->BackupCommBufferSize; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + In_p->ReqBuffOffset + Communication_p->BackupCommBufferSize, - In_p->ReqData - Communication_p->BackupCommBufferSize, - R15_Network_ReadCallback, Communication_p); - C_(printf("r15_network_layer.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, In_p->ReqData, In_p->RecData);) - C_(printf("r15_network_layer.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) - In_p->RecData = 0; + ReqData = In_p->ReqData; + In_p->ReqData = 0; + ReqBufferOffset = In_p->ReqBuffOffset; In_p->ReqBuffOffset = 0; + In_p->RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; - In_p->ReqData = 0; + In_p->RecData = 0; + + C_(printf("r15_network_layer.c (%d) ReqData(%d) RecData(%d)\n", __LINE__, ReqData, In_p->RecData);) + C_(printf("r15_network_layer.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + Communication_p->BackupCommBufferSize = In_p->RecBackupData; + In_p->RecBackupData = 0; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset + In_p->RecBackupData, + ReqData - In_p->RecBackupData, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p); + +#endif } else { + /* Copy content of backup buffer into receive buffer */ memcpy(In_p->Target_p + In_p->ReqBuffOffset, Communication_p->BackupCommBuffer_p, In_p->ReqData); + /* Move rest of backup data at the beginning of the backup buffer */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + In_p->ReqData, Communication_p->BackupCommBufferSize - In_p->ReqData); + /* Update the size of the backup buffer */ Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - In_p->ReqData; + ReqData = In_p->ReqData; In_p->ReqData = 0; - R15_Network_ReadCallback(In_p->Target_p + In_p->ReqBuffOffset, ReqData, Communication_p); + ReqBufferOffset = In_p->ReqBuffOffset; + In_p->ReqBuffOffset = 0; In_p->RecData = 0; + R15_Network_ReadCallback(In_p->Target_p + ReqBufferOffset, ReqData, Communication_p->CommunicationDevice_p); } } else { ReqData = In_p->ReqData; - ReqBuffOffset = (uint32)(In_p->ReqBuffOffset); - In_p->ReqBuffOffset = 0; In_p->ReqData = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p + ReqBuffOffset, ReqData, R15_Network_ReadCallback, Communication_p); - C_(printf("r15_network_layer.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, In_p->ReqData, In_p->RecData);) - C_(printf("r15_network_layer.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + ReqBufferOffset = In_p->ReqBuffOffset; + In_p->ReqBuffOffset = 0; In_p->RecData = 0; + + C_(printf("r15_network_layer.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, ReqData, In_p->RecData);) + C_(printf("r15_network_layer.c (%d) Communication_p->BackupCommBufferSize(%d) RecBackupData (%d)\n", __LINE__, Communication_p->BackupCommBufferSize, In_p->RecBackupData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + In_p->ReqBuffOffset = ReqBufferOffset; + } +#else + (void)Communication_p->CommunicationDevice_p->Read( + In_p->Target_p + ReqBufferOffset, ReqData, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p); +#endif } } - /* check for receiver sinhronization */ + /* check for receiver synchronization */ if (In_p->State == RECEIVE_ERROR) { In_p->ReqData = 0; In_p->RecData = 0; In_p->ReqBuffOffset = 0; +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS == Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + ALIGNED_HEADER_LENGTH, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p)){ + In_p->State = RECEIVE_HEADER; + } +#else + (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + ALIGNED_HEADER_LENGTH, R15_Network_ReadCallback, + Communication_p->CommunicationDevice_p); In_p->State = RECEIVE_HEADER; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, ALIGNED_HEADER_LENGTH, R15_Network_ReadCallback, Communication_p); +#endif } return R15_NETWORK(Communication_p)->Inbound.LCM_Error; @@ -323,7 +372,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER), ContinuousBufferLength, - R15_Network_WriteCallback, Communication_p)) { + R15_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { C_(printf("r15_network_layer.c (%d) Header Sent to comm device! \n", __LINE__);) } else { Out_p->State = SEND_HEADER; @@ -342,7 +391,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write(Out_p->Packet_p->Payload_p, Aligned_Length, - R15_Network_WriteCallback, Communication_p)) { + R15_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { RegisterRetransmission = TRUE; C_(printf("r15_network_layer.c (%d) Payload Sent to comm device! \n", __LINE__);) } else { @@ -421,7 +470,7 @@ ErrorCode_e R15_Network_CancelRetransmission(const Communication_t *const Commun * combination of protocol type, session number and command. * * @param [in] Packet_p Pointer to the packet. - * @param [in] ExternalKey External key for marking the packet for retransmision. + * @param [in] ExternalKey External key for marking the packet for retransmission. * * @return Unique key. */ @@ -473,7 +522,6 @@ PacketMeta_t *R15_Network_PacketAllocate(const Communication_t *const Communicat /* packet meta info setup */ C_( - if (BULK_BUFFER_SIZE > BufferSize) printf("CmdBuffGet:%x\n", Buffer_p); else { @@ -562,7 +610,7 @@ ErrorExit: */ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + 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}; B_(printf("r15_network_layer.c (%d): Device write finished!! \n", __LINE__);) @@ -605,12 +653,14 @@ static ErrorCode_e R15_Network_ReceiveHeader(const Communication_t *const Commun if (In_p->RecData == 0) { In_p->ReqData = ALIGNED_HEADER_LENGTH; In_p->Target_p = In_p->Scratch; + In_p->ReqBuffOffset = 0; } else { if (R15_IsReceivedHeader(In_p)) { if (R15_IsValidHeader(In_p->Scratch)) { R15_DeserializeHeader(&In_p->Header, In_p->Scratch); In_p->Target_p += ALIGNED_HEADER_LENGTH; + if (In_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) { SET_INBOUND(In_p, RECEIVE_EXTENDED_HEADER, ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH); } else { @@ -625,14 +675,16 @@ static ErrorCode_e R15_Network_ReceiveHeader(const Communication_t *const Commun } else { - uint32 Counter = 0; - - A_(printf("Invalid header! ");) - for (Counter = 0; Counter < 16; Counter++) - { - A_(printf(" %02X", In_p->Scratch[Counter]);) - } - A_(printf("\n\n");) + A_( + uint32 Counter = 0; + + printf("Invalid header! "); + for (Counter = 0; Counter < 16; Counter++) + { + printf(" %02X", In_p->Scratch[Counter]); + } + printf("\n\n"); + ) } } @@ -669,11 +721,13 @@ static ErrorCode_e R15_Network_ReceiveExtendedHeader(Communication_t *Communicat 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; 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) { In_p->Packet_p->Payload_p = In_p->Packet_p->ExtendedHeader_p + ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH; } else { 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->ExtendedHeader_p, In_p->Target_p, In_p->Header.ExtendedHeaderLength); @@ -731,14 +785,16 @@ static ErrorCode_e R15_Network_ReceivePayload(Communication_t *Communication_p) if (HASH_NONE != Packet_p->Header.Flags) { #ifdef CFG_ENABLE_MEASUREMENT_TOOL - if(In_p->Packet_p->Header.Protocol == BULK_PROTOCOL){ - BulkExtendedHeader_t ExtendedHeader = {0}; - R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Packet_p->ExtendedHeader_p); - if ((ExtendedHeader.TypeFlags & MASK_BULK_COMMAND_SELECT) == CMD_BULK_DATA){ - (void)MP(Measurement_p, ExtendedHeader.AcksChunk, START_HASHINGCHUNK_TIME); - } - } + if (In_p->Packet_p->Header.Protocol == BULK_PROTOCOL) { + BulkExtendedHeader_t ExtendedHeader = {0}; + R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Packet_p->ExtendedHeader_p); + + if ((ExtendedHeader.TypeFlags & MASK_BULK_COMMAND_SELECT) == CMD_BULK_DATA) { + (void)MP(Measurement_p, ExtendedHeader.AcksChunk, START_HASHINGCHUNK_TIME); + } + } + #endif Communication_p->HashDevice_p->Calculate(OBJECT_HASH(Communication_p), Communication_p->CurrentFamilyHash, @@ -807,7 +863,7 @@ static ErrorCode_e R15_Network_RegisterRetransmission(Communication_t *Communica } } while (Index < MAX_SIZE_RETRANSMISSION_LIST); } else { - A_(printf("r15_network_layer.c (%d) ** Err: Retransmision List is full! ** \n", __LINE__);) + A_(printf("r15_network_layer.c (%d) ** Err: Retransmission List is full! ** \n", __LINE__);) } return ReturnValue; @@ -845,14 +901,16 @@ static void R15_InHashCallback(const void *const Data_p, uint32 Length, const ui PacketMeta_t *Packet_p = (PacketMeta_t *)Param_p; #ifdef CFG_ENABLE_MEASUREMENT_TOOL - if(Packet_p->Header.Protocol == BULK_PROTOCOL){ - BulkExtendedHeader_t ExtendedHeader = {0}; - R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Packet_p->ExtendedHeader_p); - if ((ExtendedHeader.TypeFlags & MASK_BULK_COMMAND_SELECT) == CMD_BULK_DATA){ - (void)MP(Measurement_p, ExtendedHeader.AcksChunk, END_HASHINGCHUNK_TIME); - } + if (Packet_p->Header.Protocol == BULK_PROTOCOL) { + BulkExtendedHeader_t ExtendedHeader = {0}; + R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Packet_p->ExtendedHeader_p); + + if ((ExtendedHeader.TypeFlags & MASK_BULK_COMMAND_SELECT) == CMD_BULK_DATA) { + (void)MP(Measurement_p, ExtendedHeader.AcksChunk, END_HASHINGCHUNK_TIME); + } } + #endif if (memcmp(Hash_p, &Packet_p->Header.PayloadChecksum, 4) == 0) { diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/source/z_network.c b/lcmodule/source/cnh1605205_ldr_network_layer/source/z_network.c index 8d7ef09..99551f5 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/source/z_network.c +++ b/lcmodule/source/cnh1605205_ldr_network_layer/source/z_network.c @@ -56,7 +56,7 @@ ErrorCode_e Z_Network_Initialize(Communication_t *Communication_p) Z_NETWORK(Communication_p)->Outbound.TxCriticalSection = Do_CriticalSection_Create(); /* Simulate a finished read to get the inbound state-machine going. */ - Z_Network_ReadCallback(NULL, 0, Communication_p); + Z_Network_ReadCallback(NULL, 0, Communication_p->CommunicationDevice_p); return E_SUCCESS; } @@ -70,7 +70,7 @@ ErrorCode_e Z_Network_Shutdown(const Communication_t *const Communication_p) void Z_Network_ReadCallback(const void *Data_p, const uint32 Length, void *Param_p) { - Communication_t *Communication_p = (Communication_t *)Param_p; + Communication_t *Communication_p = (Communication_t*)(((CommunicationDevice_t*)Param_p)->Object_p); CommandData_t CmdData; Z_NETWORK(Communication_p)->Inbound.RecData += Length; @@ -100,15 +100,36 @@ void Z_Network_ReceiverHandler(Communication_t *Communication_p) ReqData = In_p->ReqData; In_p->ReqData = 0; In_p->RecData = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, ReqData, Z_Network_ReadCallback, Communication_p); C_(printf("z_network.c (%d) ReqData(%d) RecData(%d) \n", __LINE__, ReqData, In_p->RecData);) + +#ifdef CFG_ENABLE_LOADER_TYPE + if (E_SUCCESS != Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + ReqData, Z_Network_ReadCallback, Communication_p->CommunicationDevice_p)) { + /* Read failed! Return to previous state. */ + In_p->ReqData = ReqData; + } +#else + (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + ReqData, Z_Network_ReadCallback, Communication_p->CommunicationDevice_p); +#endif } - /* check for receiver sinhronization */ + /* check for receiver synchronization */ if (In_p->State == Z_RECEIVE_ERROR) { In_p->ReqData = 0; In_p->RecData = 0; - (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, Z_HEADER_LENGTH, Z_Network_ReadCallback, Communication_p); +#ifdef CFG_ENABLE_LOADER_TYPE + if (TRUE == Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + Z_HEADER_LENGTH, Z_Network_ReadCallback, + Communication_p->CommunicationDevice_p)) { + In_p->State = Z_RECEIVE_HEADER; + } +#else + (void)Communication_p->CommunicationDevice_p->Read(In_p->Target_p, + Z_HEADER_LENGTH, Z_Network_ReadCallback, + Communication_p->CommunicationDevice_p); + In_p->State = Z_RECEIVE_HEADER; +#endif } } @@ -130,7 +151,7 @@ ErrorCode_e Z_Network_TransmiterHandler(Communication_t *Communication_p, Z_Send switch (Out_p->State) { case Z_SEND_IDLE: - /* get next packet for transmiting */ + /* get next packet for transmitting */ Out_p->State = Z_SEND_PACKET; /* FALLTHROUGH */ @@ -138,7 +159,7 @@ ErrorCode_e Z_Network_TransmiterHandler(Communication_t *Communication_p, Z_Send if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write(Data_p, Size, - Z_Network_WriteCallback, Communication_p)) { + Z_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { Out_p->State = Z_SENDING_PACKET; } else { /* error state ?*/ diff --git a/lcmodule/source/cnh1605551_ldr_utilities/debug_subsystem/r_debug_subsystem.h b/lcmodule/source/cnh1605551_ldr_utilities/debug_subsystem/r_debug_subsystem.h index 8ab63cf..4f10bc6 100644 --- a/lcmodule/source/cnh1605551_ldr_utilities/debug_subsystem/r_debug_subsystem.h +++ b/lcmodule/source/cnh1605551_ldr_utilities/debug_subsystem/r_debug_subsystem.h @@ -24,6 +24,10 @@ ******************************************************************************/ #include "t_basicdefinitions.h" #include "t_debug_subsystem.h" +#ifdef CFG_ENABLE_LOADER_TYPE +#include "error_codes.h" +#include "t_communication_service.h" +#endif /******************************************************************************* * Defines @@ -50,13 +54,34 @@ #ifndef CFG_ENABLE_LOADER_TYPE void lcm_printf(const char *format, ...); #else +/* + * Initialization of Debug communication device. + * + * Used communication devices UART (specified with UART_DEBUG_PORT). + * + * @return none. + */ +void Do_Loader_DebugoutInit(void); + +/* + * Function for getting the debug communication device. + * + * @param [out] DebugDevice_pp Pointer to the initialized debug communication + * device. + * + * @retval E_SUCCESS After successful execution. + * @retval E_GENERAL_FATAL_ERROR If debug communication device is not + * initialized. + */ +ErrorCode_e Do_GetDebugCommunicationDevice(CommunicationDevice_t **DebugDevice_pp); + /** * Calls function 'circular_printf'. If debug queue is not initialized this - * function takes care for initialization and than redidrect input parameters to + * function takes care for initialization and than redirect input parameters to * 'circular_printf' function. * * @param [in] *format The string constant format provides a description of the - * output, with placeholders marked by "%" escape + * output, with place holders marked by "%" escape * characters, to specify both the relative location and the * type of output that the function should produce.(Standard * definition for library 'printf' function). diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_debug_macro.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_debug_macro.h index 43f9e88..4faf681 100644 --- a/lcmodule/source/cnh1605551_ldr_utilities/include/r_debug_macro.h +++ b/lcmodule/source/cnh1605551_ldr_utilities/include/r_debug_macro.h @@ -79,9 +79,7 @@ { \ if(!(Condition)) \ { \ - {\ - INT_DISABLE()\ - }\ + INT_DISABLE()\ while(1); \ } \ } while(0) @@ -143,9 +141,7 @@ if(!(Condition)) \ { \ A_(printf("%s (%d): ** Assert failed **\n",__FILE__, __LINE__);)\ - {\ - INT_DISABLE()\ - }\ + INT_DISABLE()\ while(1); \ } \ } while(0) @@ -155,9 +151,7 @@ { \ if(!(Condition)) \ { \ - {\ - INT_DISABLE()\ - }\ + INT_DISABLE()\ while(1); \ } \ } while(0) diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_memmory_utils.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_memmory_utils.h deleted file mode 100644 index fb4d54f..0000000 --- a/lcmodule/source/cnh1605551_ldr_utilities/include/r_memmory_utils.h +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (C) ST-Ericsson SA 2011 - * License terms: 3-clause BSD license - ******************************************************************************/ -#ifndef _R_MEMMORY_UTILS_H_ -#define _R_MEMMORY_UTILS_H_ - -/** - * @addtogroup ldr_utilities - * @{ - * @addtogroup memmory_utils - * @{ - */ - -/******************************************************************************* - * Includes - ******************************************************************************/ -#include -#include "error_codes.h" -#include "t_basicdefinitions.h" -#ifdef CFG_ENABLE_LOADER_TYPE -#include "cpu_support.h" - -/******************************************************************************* - * Macro that release allocated memory space in heap. - ******************************************************************************/ -#define BUFFER_FREE(Buffer) \ -if (NULL != (Buffer)) \ -{ \ - CPU_Irq_State_t IRQ_status; \ - \ - IRQ_status = CPU_IrqDisable();\ - free(Buffer); \ - (Buffer) = NULL; \ - \ - if (IRQ_status == CPU_IRQ_ENABLE)\ - {\ - CPU_IrqEnable();\ - }\ -} -#else //CFG_ENABLE_LOADER_TYPE -#define BUFFER_FREE(Buffer) \ -if (NULL != (Buffer)) \ -{ \ - free(Buffer); \ - (Buffer) = NULL; \ -} -#endif // CFG_ENABLE_LOADER_TYPE - -/** - * Macro that check alignment. If variable is not aligned it set the status - * variable ReturnValue to appropriate error code and send the function to error - * label. - * - * @param [in] x Variable for alignemend check. - * - * @sigbased No - Macro - */ -#define IS_ALIGNED(x) if(((x) & 3)) \ - { \ - ReturnValue = E_UNALIGNED_DATA; \ - goto ErrorExit; \ - } \ - -/** @} */ -/** @} */ -#endif /*_R_MEMMORY_UTILS_H_*/ diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h new file mode 100644 index 0000000..ee5eb18 --- /dev/null +++ b/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license + ******************************************************************************/ +#ifndef _R_MEMMORY_UTILS_H_ +#define _R_MEMMORY_UTILS_H_ + +/** + * @addtogroup ldr_utilities + * @{ + * @addtogroup memory_utils + * @{ + */ + +/******************************************************************************* + * Includes + ******************************************************************************/ +#include +#include "error_codes.h" +#include "t_basicdefinitions.h" +#ifdef CFG_ENABLE_LOADER_TYPE +#include "cpu_support.h" + +/******************************************************************************* + * Macro that release allocated memory space in heap. + ******************************************************************************/ +#define BUFFER_FREE(Buffer) \ +if (NULL != (Buffer)) \ +{ \ + CPU_Irq_State_t IRQ_status; \ + \ + IRQ_status = CPU_IrqDisable();\ + free(Buffer); \ + (Buffer) = NULL; \ + \ + if (IRQ_status == CPU_IRQ_ENABLE)\ + {\ + CPU_IrqEnable();\ + }\ +} +#else //CFG_ENABLE_LOADER_TYPE +#define BUFFER_FREE(Buffer) \ +if (NULL != (Buffer)) \ +{ \ + free(Buffer); \ + (Buffer) = NULL; \ +} +#endif // CFG_ENABLE_LOADER_TYPE + +/** + * Macro that check alignment. If variable is not aligned it set the status + * variable ReturnValue to appropriate error code and send the function to error + * label. + * + * @param [in] x Variable for alignment check. + * + */ +#define IS_ALIGNED(x) if(((x) & 3)) \ + { \ + ReturnValue = E_UNALIGNED_DATA; \ + goto ErrorExit; \ + } \ + +/** @} */ +/** @} */ +#endif /*_R_MEMMORY_UTILS_H_*/ diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_queue.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_queue.h index 06e9d17..abf0904 100644 --- a/lcmodule/source/cnh1605551_ldr_utilities/include/r_queue.h +++ b/lcmodule/source/cnh1605551_ldr_utilities/include/r_queue.h @@ -61,12 +61,12 @@ void Do_Fifo_Destroy(void *Object_p, void **const Queue_pp); * reentrant across different queues, but enqueueing on the same queue is * not necessarily reentrant. * - * @param [in] Object_p - Pointer to LCM instance context. - * @param [in] Queue_p - The queue to append to. - * @param [in] Value_p - The value to enqueue. + * @param [in] Object_p Pointer to LCM instance context. + * @param [in] Queue_p The queue to append to. + * @param [in] Value_p The value to enqueue. * @return E_SUCCESS - The function completed successfully. * - * @return E_FAILED_TO_STORE_IN_FIFO - Faliled to store data in fifo. + * @return E_FAILED_TO_STORE_IN_FIFO - Failed to store data in fifo. */ ErrorCode_e Do_Fifo_Enqueue(void *Object_p, void *const Queue_p, @@ -174,8 +174,8 @@ void Do_RFifo_Create(void *Object_p, /** * @brief Releases any resources associated with the specified queue structure. * - * @param [in] Object_p - Pointer to LCM instance context. - * @param [in,out] Queue_pp - Pointer to the queue structure to destroy. + * @param [in] Object_p Pointer to LCM instance context. + * @param [in,out] Queue_pp Pointer to the queue structure to destroy. */ void Do_RFifo_Destroy(void *Object_p, void **const Queue_pp); @@ -184,10 +184,10 @@ void Do_RFifo_Destroy(void *Object_p, void **const Queue_pp); * * Enqueueing function of a re-entrant, interrupt-safe FIFO queue. * - * @param [in] Object_p - Pointer to LCM instance context. - * @param [in] Queue_p - The queue to append to. - * @param [in] Value_p - The value to enqueue. - * @return E_SUCCESS - The function completed successfully. + * @param [in] Object_p Pointer to LCM instance context. + * @param [in] Queue_p The queue to append to. + * @param [in] Value_p The value to enqueue. + * @return E_SUCCESS The function completed successfully. * * @return E_FAILED_TO_STORE_IN_FIFO - Faliled to store data in fifo. */ @@ -226,7 +226,7 @@ void *Do_RFifo_Dequeue(void *Object_p, void *const Queue_p); * function should be called each time the queue has * transitioned from an empty to a non-empty state. * @param [in] Callback The function to call when the specified event occurs - * or NULL to unregister a previously registered func. + * or NULL to unregister a previously registered functions. * @param [in] Param_p Parameter to pass to the callback function. * @return The previously registered callback function for this * type. diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_serialization.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_serialization.h index b0cebd6..15a59bd 100644 --- a/lcmodule/source/cnh1605551_ldr_utilities/include/r_serialization.h +++ b/lcmodule/source/cnh1605551_ldr_utilities/include/r_serialization.h @@ -36,7 +36,9 @@ ******************************************************************************/ #include "t_basicdefinitions.h" #include "t_serialization.h" +#if defined(CFG_ENABLE_LOADER_SERIALIZATION) #include "command_ids.h" +#endif /******************************************************************************* * Declaration of functions @@ -320,9 +322,19 @@ void skip_block(void **data_pp, */ char *skip_str(void **data_pp); +/** + * @brief Serialize device entries. + * + * @param [out] data_pp Pointer of serialized data for device entries. + * @param [in] source_p Source. + * @param [in] length length of source string. + * @return void. + */ +void insert_string(char **data_pp, const char *source_p, uint32 length); +#if defined(CFG_ENABLE_LOADER_SERIALIZATION) /** - * @brief Get directory entries length...TODO: should be explained. + * @brief Get directory entries length. * * @param [out] source_p Source. * @param [in] DirectoryEntriesCount Entry counter. @@ -332,9 +344,9 @@ uint32 get_directory_entries_len(const DirEntry_t *source_p, uint32 DirectoryEntriesCount); /** - * @brief Serialize directory entries...TODO: should be explained. + * @brief Serialize directory entries. * - * @param [out] data_pp /...TODO: should be explained. + * @param [out] data_pp Pointer of serialized data for directory entries. * @param [in] source_p Source. * @param [in] DirectoryEntriesCount Entry counter. * @return void. @@ -344,7 +356,7 @@ void serialize_directory_entries(void **data_pp, uint32 DirectoryEntriesCount); /** - * @brief Get device entry length...TODO: should be explained. + * @brief Get device entry length. * * @param [out] source_p Source. * @param [in] DeviceEntriesCount Entry counter. @@ -354,9 +366,9 @@ uint32 get_device_entries_len(const ListDevice_t *source_p, uint32 DeviceEntriesCount); /** - * @brief Serialize device entries...TODO: should be explained. + * @brief Serialize device entries. * - * @param [out] data_pp /...TODO: should be explained. + * @param [out] data_pp Pointer of serialized data for device entries. * @param [in] source_p Source. * @param [in] DeviceEntriesCount Entry counter. * @return void. @@ -364,16 +376,7 @@ uint32 get_device_entries_len(const ListDevice_t *source_p, void serialize_device_entries(void **data_pp, const ListDevice_t *source_p, uint32 DeviceEntriesCount); - -/** - * @brief Serialize device entries...TODO: should be explained. - * - * @param [out] data_pp /...TODO: should be explained. - * @param [in] source_p Source. - * @param [in] length length of source string. - * @return void. - */ -void insert_string(char **data_pp, const char *source_p, uint32 length); +#endif /** @} */ /** @} */ diff --git a/lcmodule/source/cnh1605551_ldr_utilities/source/serialization.c b/lcmodule/source/cnh1605551_ldr_utilities/source/serialization.c index 3b6377f..717f847 100644 --- a/lcmodule/source/cnh1605551_ldr_utilities/source/serialization.c +++ b/lcmodule/source/cnh1605551_ldr_utilities/source/serialization.c @@ -76,103 +76,6 @@ uint32 get_uint32_be(void **data_pp) return ((d[0] << 8 | d[1]) << 8 | d[2]) << 8 | d[3]; } -uint32 get_directory_entries_len(const DirEntry_t *source_p, uint32 DirectoryEntriesCount) -{ - uint32 EntriesLen = 0; - uint32 i = 0; - - if (DirectoryEntriesCount > 0) { - for (i = 0; i < DirectoryEntriesCount; i++) { - EntriesLen += get_uint32_string_le((void **)&source_p[i].Name_p); - EntriesLen += sizeof(uint32) + sizeof(uint32) + sizeof(uint64); - } - } - - return EntriesLen; -} - -void serialize_directory_entries(void **data_pp, const DirEntry_t *source_p, uint32 DirectoryEntriesCount) -{ - uint32 NameLength = 0; - uint32 i = 0; - - if (DirectoryEntriesCount > 0) { - for (i = 0; i < DirectoryEntriesCount; i++) { - NameLength = get_uint32_string_le((void **)&source_p[i].Name_p); - memcpy(*data_pp, source_p[i].Name_p, NameLength); - *(const uint8 **)data_pp += NameLength; - memcpy(*data_pp, &source_p[i].Size, sizeof(uint64)); - *(const uint8 **)data_pp += sizeof(uint64); - memcpy(*data_pp, &source_p[i].Mode, sizeof(uint32)); - *(const uint8 **)data_pp += sizeof(uint32); - memcpy(*data_pp, &source_p[i].Time, sizeof(uint32)); - *(const uint8 **)data_pp += sizeof(uint32); - } - } -} - -uint32 get_device_entries_len(const ListDevice_t *source_p, uint32 DeviceEntriesCount) -{ - uint32 EntriesLen = 0; - uint32 i = 0; - - if (DeviceEntriesCount > 0) { - for (i = 0; i < DeviceEntriesCount; i++) { - if (NULL != source_p[i].Path_p) { - EntriesLen += get_uint32_string_le((void **)&source_p[i].Path_p); - } else { - EntriesLen += sizeof(uint32); - } - - if (NULL != source_p[i].Type_p) { - EntriesLen += get_uint32_string_le((void **)&source_p[i].Type_p); - } else { - EntriesLen += sizeof(uint32); - } - - EntriesLen += sizeof(uint64) + sizeof(uint64) + sizeof(uint64); - } - } - - return EntriesLen; -} - -void serialize_device_entries(void **data_pp, const ListDevice_t *source_p, uint32 DeviceEntriesCount) -{ - uint32 PathLen = 0; - uint32 TypeLen = 0; - uint32 i = 0; - - if (DeviceEntriesCount > 0) { - for (i = 0; i < DeviceEntriesCount; i++) { - if (NULL != source_p[i].Path_p) { - PathLen = get_uint32_string_le((void **)&source_p[i].Path_p); - memcpy(*data_pp, source_p[i].Path_p, PathLen); - *(const uint8 **)data_pp += PathLen; - } else { - memset(*data_pp, 0x00, sizeof(char *)); - *(const uint8 **)data_pp += sizeof(char *); - } - - if (NULL != source_p[i].Type_p) { - TypeLen = get_uint32_string_le((void **)&source_p[i].Type_p); - memcpy(*data_pp, source_p[i].Type_p, TypeLen); - *(const uint8 **)data_pp += TypeLen; - } else { - memset(*data_pp, 0x00, sizeof(char *)); - *(const uint8 **)data_pp += sizeof(char *); - } - - memcpy(*data_pp, &source_p[i].BlockSize, sizeof(uint64)); - *(const uint8 **)data_pp += sizeof(uint64); - memcpy(*data_pp, &source_p[i].Start, sizeof(uint64)); - *(const uint8 **)data_pp += sizeof(uint64); - memcpy(*data_pp, &source_p[i].Length, sizeof(uint64)); - *(const uint8 **)data_pp += sizeof(uint64); - } - } -} - void put_block(void **data_pp, const void *source_p, uint32 length) { if (length > 0) { @@ -324,6 +227,97 @@ void insert_string(char **data_pp, const char *source_p, uint32 length) memcpy(*data_pp + sizeof(uint32), source_p, length); } +#if defined(CFG_ENABLE_LOADER_SERIALIZATION) +uint32 get_directory_entries_len(const DirEntry_t *source_p, uint32 DirectoryEntriesCount) +{ + uint32 EntriesLen = 0; + uint32 i = 0; + + for (i = 0; i < DirectoryEntriesCount; i++) { + EntriesLen += get_uint32_string_le((void **)&source_p[i].Name_p); + EntriesLen += sizeof(uint32) + sizeof(uint32) + sizeof(uint64); + } + + return EntriesLen; +} + +void serialize_directory_entries(void **data_pp, const DirEntry_t *source_p, uint32 DirectoryEntriesCount) +{ + uint32 NameLength = 0; + uint32 i = 0; + + for (i = 0; i < DirectoryEntriesCount; i++) { + NameLength = get_uint32_string_le((void **)&source_p[i].Name_p); + memcpy(*data_pp, source_p[i].Name_p, NameLength); + *(const uint8 **)data_pp += NameLength; + memcpy(*data_pp, &source_p[i].Size, sizeof(uint64)); + *(const uint8 **)data_pp += sizeof(uint64); + memcpy(*data_pp, &source_p[i].Mode, sizeof(uint32)); + *(const uint8 **)data_pp += sizeof(uint32); + memcpy(*data_pp, &source_p[i].Time, sizeof(uint32)); + *(const uint8 **)data_pp += sizeof(uint32); + } +} + +uint32 get_device_entries_len(const ListDevice_t *source_p, uint32 DeviceEntriesCount) +{ + uint32 EntriesLen = 0; + uint32 i = 0; + + for (i = 0; i < DeviceEntriesCount; i++) { + if (NULL != source_p[i].Path_p) { + EntriesLen += get_uint32_string_le((void **)&source_p[i].Path_p); + } else { + EntriesLen += sizeof(uint32); + } + + if (NULL != source_p[i].Type_p) { + EntriesLen += get_uint32_string_le((void **)&source_p[i].Type_p); + } else { + EntriesLen += sizeof(uint32); + } + + EntriesLen += sizeof(uint64) + sizeof(uint64) + sizeof(uint64); + } + + return EntriesLen; +} + +void serialize_device_entries(void **data_pp, const ListDevice_t *source_p, uint32 DeviceEntriesCount) +{ + uint32 PathLen = 0; + uint32 TypeLen = 0; + uint32 i = 0; + + for (i = 0; i < DeviceEntriesCount; i++) { + if (NULL != source_p[i].Path_p) { + PathLen = get_uint32_string_le((void **)&source_p[i].Path_p); + memcpy(*data_pp, source_p[i].Path_p, PathLen); + *(const uint8 **)data_pp += PathLen; + } else { + memset(*data_pp, 0x00, sizeof(char *)); + *(const uint8 **)data_pp += sizeof(char *); + } + + if (NULL != source_p[i].Type_p) { + TypeLen = get_uint32_string_le((void **)&source_p[i].Type_p); + memcpy(*data_pp, source_p[i].Type_p, TypeLen); + *(const uint8 **)data_pp += TypeLen; + } else { + memset(*data_pp, 0x00, sizeof(char *)); + *(const uint8 **)data_pp += sizeof(char *); + } + + memcpy(*data_pp, &source_p[i].BlockSize, sizeof(uint64)); + *(const uint8 **)data_pp += sizeof(uint64); + memcpy(*data_pp, &source_p[i].Start, sizeof(uint64)); + *(const uint8 **)data_pp += sizeof(uint64); + memcpy(*data_pp, &source_p[i].Length, sizeof(uint64)); + *(const uint8 **)data_pp += sizeof(uint64); + } +} +#endif + /* @} */ /* @} */ diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/a2_commands.xml b/lcmodule/source/cnh1606344_ldr_communication_module/config/a2_commands.xml index b2ad470..171df8f 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/a2_commands.xml +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/a2_commands.xml @@ -9,14 +9,13 @@ - A1 CA - + Permission1 Permission2 @@ -43,19 +42,19 @@ A2 System commands group (0x01) - + Performs controlled power down of the ME. - - + + - - - + + + @@ -72,12 +71,12 @@ The Loader shuts down in a controlled fashion and proceeds to shut down the ME itself. - Application packet length - + Application packet length + - Loader version length - No data + Loader version length + No data @@ -87,42 +86,42 @@ The Loader Version command is sent by the PC to request version information from the loader. The ME responds with a Loader Version information coded as ASCII characters in the data field. - Application packet length - + Application packet length + - Loader version length + Loader version length Loader version identifier - + The Protocol Version command is sent by the PC to request the application protocol version information from the loader. The ME responds with two bytes holding the major and the minor version respectively. - Application packet length - + Application packet length + - Protocol version length + Protocol version length Protocol version identifier - + The Loader returns a list of implemented command groups and whether they are permitted to execute in the current Loader state. - Application packet length - + Application packet length + - Supported Groups length - Each byte of the string represents a supported command group. + Supported Groups length + Each byte of the string represents a supported command group. @@ -132,44 +131,44 @@ This command is sent by the PC to request a Platform Property, by sending a PropertyID in the data field. The ME responds with the Property value. - Application packet length - + Application packet length + - The size of the PropertyValue depends on the PropertyID - - + The size of the PropertyValue depends on the PropertyID + + - This command is sent by the PC to request a Memory Property. The ME responds with the Memory Property value. - - - Application packet length - - - - The size of the PropertyValue depends on the PropertyID - - - - - - - - This command is sent by the PC to set a Memory Property. - - - Application packet length - The MemoryPropertyPayload buffer holds the Memory Propertiy ID and the Memory Property value. The size of the MemoryPropertyValue depends on the PropertyID - - - The size of the PropertyValue depends on the PropertyID - - - + This command is sent by the PC to request a Memory Property. The ME responds with the Memory Property value. + + + Application packet length + + + + The size of the PropertyValue depends on the PropertyID + + + + + + + + This command is sent by the PC to set a Memory Property. + + + Application packet length + The MemoryPropertyPayload buffer holds the Memory Propertiy ID and the Memory Property value. The size of the MemoryPropertyValue depends on the PropertyID + + + The size of the PropertyValue depends on the PropertyID + + + @@ -177,93 +176,92 @@ This command is used in a Flashless bridge configuration. It returns the Static data and all dinamic variables cretaed during the signing process. - Application packet length - + Application packet length + - - - - - - - - - This command is used to transfer a new Loader to the ME. The data should hold either Header or Payload. - - - Application packet length - - - - - - - - - - - - The Reset command is used to instruct the Loader to reset the ME. Upon receiving this command, the Loader shuts down in a controlled fashion and restarts the ME. - - - Application packet length - The ResetTimeout value is in ms. - - - - - - + + + + + + + + + This command is used to transfer a new Loader to the ME. The data should hold either Header or Payload. + + + Application packet length + + + + + + + + + + + + The Reset command is used to instruct the Loader to reset the ME. Upon receiving this command, the Loader shuts down in a controlled fashion and restarts the ME. + + + Application packet length + The ResetTimeout value is in ms. + + + + + + - This command is sent by the PC to set the SIM Lock Keys. - + This command is sent by the PC to set the SIM Lock Keys. + - Application packet length - There are 12 SIM Lock Keys, each represented with a 16 bytes long string. - - - - - - + Application packet length + There are 12 SIM Lock Keys, each represented with a 16 bytes long string. + + + + + + + - + + + A2 Flash Commands group (0x02) + + - - - A2 Flash Commands group (0x02) - - - - Application packet length - - - - - + Application packet length + + + + + - + - Application packet length - There are two parameters in the input buffer: Start address and Block size, both 4 bytes long. - - - - + Application packet length + There are two parameters in the input buffer: Start address and Block size, both 4 bytes long. + + + + @@ -272,44 +270,43 @@ - Application packet length - - - - - - + Application packet length + + + + + + - - Application packet length - - - - - - - - - - - This command is used to readp from the flash. The input parameters buffer holds: Logical Unit number = 4 bits, Start address = 28 bits and End address = 4 bytes. - - - - Application packet length - - - - - - - + + Application packet length + + + + + + + + + + This command is used to readp from the flash. The input parameters buffer holds: Logical Unit number = 4 bits, Start address = 28 bits and End address = 4 bytes. + + + + Application packet length + + + + + + + @@ -323,21 +320,20 @@ - Application packet length - + Application packet length + - - + + - - A2 File system commands Group (0x04) - + A2 File system commands Group (0x04) + @@ -345,63 +341,62 @@ - Application packet length - - - - - - + Application packet length + + + + + + - - A2 Signature Commands Group (0x05) - + A2 Signature Commands Group (0x05) + - This command is used to write the SIM Lock control keys. + This command is used to write the SIM Lock control keys. - - Application packet length - There are 12 SIM Lock Keys, each represented with a 16 bytes long string. - - - - - + + Application packet length + There are 12 SIM Lock Keys, each represented with a 16 bytes long string. + + + + + - - - - - Application packet length - The SetPlatformPropertyIn buffer holds the Platform Property ID and the Platform property value. The size of the Platform Property ID is 4 bytes and the size of the Platform Property Value depends on the PropertyID - - - - - - - - + + + + + Application packet length + The SetPlatformPropertyIn buffer holds the Platform Property ID and the Platform property value. The size of the Platform Property ID is 4 bytes and the size of the Platform Property Value depends on the PropertyID + + + + + + + + - Application packet length - + Application packet length + - - + + @@ -410,156 +405,155 @@ - Application packet length - The WriteDefaultDataIn buffer holds the Unit number,the Unit size and Unit data - + Application packet length + The WriteDefaultDataIn buffer holds the Unit number,the Unit size and Unit data + - - + + - - - - - Application packet length - + + + + + Application packet length + - - + + - - - - - - Application packet length - - - - - - + + + + + + Application packet length + + + + + + - - - - - Application packet length - + + + + + Application packet length + - - + + - - - - - - Application packet length - - - - - - - - - - - - - - Application packet length - The KeySharStage1ReqIn buffer holds the Version (1 byte), the ID (4 bytes) and Random Value (24 bytes) - - - - - - - - - - - - - Application packet length - The KeySharStage2ReqIn buffer holds the ID (4 bytes), the Cipher (1 byte), the CertificateLength (4 bytes) and Certificate (CertificateLength) - - - - - - - - - - - - - Application packet length - The KeySharStage3ReqIn buffer holds the ID (4 bytes), C2 (16 bytes) and MAC (20 bytes). - - - - - - - - - - - - - Application packet length - - - - - - - - - - - This command is used to compare received SIM Lock keys against the SIM Lock keys stored in the ME. - - - - Application packet length - There are 12 SIM Lock Keys, each represented with a 16 bytes long string. - - - - - + + + + + + Application packet length + + + + + + + + + + + + + + Application packet length + The KeySharStage1ReqIn buffer holds the Version (1 byte), the ID (4 bytes) and Random Value (24 bytes) + + + + + + + + + + + + + Application packet length + The KeySharStage2ReqIn buffer holds the ID (4 bytes), the Cipher (1 byte), the CertificateLength (4 bytes) and Certificate (CertificateLength) + + + + + + + + + + + + + Application packet length + The KeySharStage3ReqIn buffer holds the ID (4 bytes), C2 (16 bytes) and MAC (20 bytes). + + + + + + + + + + + + + Application packet length + + + + + + + + + + + This command is used to compare received SIM Lock keys against the SIM Lock keys stored in the ME. + + + + Application packet length + There are 12 SIM Lock Keys, each represented with a 16 bytes long string. + + + + + - - - - - Application packet length - - - - - - - - + + + + + Application packet length + + + + + + + @@ -575,11 +569,11 @@ Application packet length - - + + - - + + @@ -589,16 +583,15 @@ Application packet length - - + + - - + + - - + A2 Control massage (0x10) @@ -611,11 +604,11 @@ - - + + - + @@ -631,7 +624,6 @@ - - + diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/audit_c.xsl b/lcmodule/source/cnh1606344_ldr_communication_module/config/audit_c.xsl index fbc00fc..db730d7 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/audit_c.xsl +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/audit_c.xsl @@ -205,9 +205,9 @@ CommandPermissionList_t * GetAuditData(CommandData_t * CmdData_p) boolean A1_RD = FALSE; boolean A1_Product = FALSE; boolean A1_Service = FALSE; - + uint8 A1_depandancy = 0x00; - + uint32 AuthenticationVector = 0; */ int CounterList = 0; @@ -228,7 +228,7 @@ ErrorCode_e CommandAudit(CommandData_t * CmdData_p) { ErrorCode_e ReturnValue = E_GENERAL_FATAL_ERROR; CommandPermissionList_t* CmdPermission_p = NULL; - + CmdPermission_p = GetAuditData(CmdData_p); if(NULL == CmdPermission_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 e351827..5e7842a 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl @@ -167,14 +167,14 @@ void disable_interrupt(void) #ifndef WIN32 /* todo implement this */ //#warning This is disable_interrupt -#endif +#endif } void enable_interrupt(void) { #ifndef WIN32 /* todo implement this */ //#warning This is enable_interrupt -#endif +#endif } ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) @@ -194,13 +194,13 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) // ResponseStatus = (ErrorCode_e)get_uint16(&Data_p); } -#ifdef CFG_ENABLE_AUDIT_CMD +#ifdef CFG_ENABLE_AUDIT_CMD if(COMMAND_TYPE == CmdData_p->Type) { ErrorCode_e AuditResponse = CommandAudit(CmdData_p); CommandData_t CmdData = {0}; uint32 PLSize = sizeof(ErrorCode_e); - + if (E_SUCCESS != AuditResponse) { memset((uint8*)&CmdData, 0x00, sizeof(CommandData_t)); @@ -217,10 +217,10 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n",__LINE__);) return E_ALLOCATE_FAILED; } - + Data_p = CmdData.Payload.Data_p; put_uint32(&Data_p, AuditResponse); - + Status = Do_R15_Command_Send(GlobalCommunication_p, &CmdData); if (NULL != CmdData.Payload.Data_p) { @@ -240,12 +240,12 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) } } #endif - + switch(COMMAND(response, CmdData_p->ApplicationNr, CmdData_p->CommandNr)) { default: - { + { Status = Do_CustomCEH_Call(CmdData_p); if (E_SUCCESS != Status) { 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 138c902..7435367 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml @@ -12,11 +12,11 @@ Operation finished successfully. Unknown error. Try to reset the loader and if problem still exist, report it. - + Check the input parameters in the command that you try to execute. Repeat operation. Report if problem is not solved. Try to reset the loader and if problem still exist, report this error. Try to reset the loader and if still exist the problem, report this error. - + - Internal error. Reset loader. Report if problem still exist. Check input parameters. Repeat operation with the correct input parameters. Report if problem still exist. Possible wrong or missing configuration in flash archive. Check the archive. Flash the correct archive. If problem still exist report the problem. @@ -433,7 +432,7 @@ Check input parameters. Requested unit is not supported. Repeat operation with the correct input parameters. Report if problem still exist. Reset loader. If problem doesn't solved report it. - + Init request is twice called and state is changed. Should be sent Update request then can be used Init request again. Use the implemented change operation. - + - Internal error. Reset loader. Report if problem still exist. It is possible that part of the operation has been carried out. @@ -570,6 +568,27 @@ Wrong value passed as state for the communication relay and hence it can't be used. Try setting some of predifined communication relay states. Communication relay is set in error state or it is not configured properly. Check the relay state. If error occured restart the loader, otherwise try reconfiguring the relay. + + It is possible to failed to initialize the communication device.Reset loader.Report if problem still exist + .Check input parameters. Retry operation. If problem still exist reset loader. Report if problem doesn't solved. + Implementation it is not supported anymore. + Buffer with unaligned length is requested to be transfered or device driver is confiured to use unsupported frame size. + Current transfer is not finished. + + + Incorrect number of bits received. + .Reset loader.Report if problem still exist. + Reset loader.Report if problem still exist. + Reset loader.Report if problem still exist. + diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/include/r_a2_family.h b/lcmodule/source/cnh1606344_ldr_communication_module/include/r_a2_family.h index 614aaa9..c5f409b 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/include/r_a2_family.h +++ b/lcmodule/source/cnh1606344_ldr_communication_module/include/r_a2_family.h @@ -7,7 +7,11 @@ /** * @addtogroup ldr_communication_serv * @{ - * @addtogroup a2_family + * @addtogroup a2_family A2 protocol family + * The A2 family include only one protocol, A2 protocol, used for + * communication between the ME and PC tool. This module includes + * A2 transport layer and A2 network layer for handling A2 protocol. + * * @{ */ 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 75306a9..86e2990 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 @@ -57,7 +57,6 @@ extern Communication_t *GlobalCommunication_p; extern Communication_t DebugCommunication; - /******************************************************************************* * Declaration of functions ******************************************************************************/ @@ -73,13 +72,17 @@ extern "C" * and communication device descriptor, a new instance of the * communication module is created and bound to use the provided devices. * - * @param [in,out] Communication_p Communication module context. + * @param [in] Object_p Instance which will use initialized communication. + * @param [in,out] Communication_pp Communication module context. * @param [in] Family Initial protocol family. * @param [in] HashDevice_p The device to use for checksum * calculations and verifications. - * @param [in] *CommunicationDevice_p The device to use for network + * @param [in] CommunicationDevice_p The device to use for network * transmission. * @param [in] CommandCallback_p Collback function for command handling. + * @param [in] Buffers_p Pointer to buffer handling functions. + * @param [in] Timers_p Pointer to timers handling functions. + * @param [in] Queue_p Pointer to queue handling functions. * * @retval E_SUCCESS If the module instance is successfully * initialized. A protocol family dependant error @@ -203,7 +206,7 @@ extern "C" LCM_API ErrorCode_e Do_Communication_SetCommunicationDevice(Communication_t *Communication_p, CommunicationDevice_t *CommunicationDevice_p); /* - * Cancek Receiving new packets + * Cancel Receiving new packets * * @param [in] Communication_p Communication module context. * @param [in] PacketsBeforeReceiverStop Number of packets to be send before stopping the receiver. diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/include/t_communication_service.h b/lcmodule/source/cnh1606344_ldr_communication_module/include/t_communication_service.h index 3b686cc..74f4721 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/include/t_communication_service.h +++ b/lcmodule/source/cnh1606344_ldr_communication_module/include/t_communication_service.h @@ -44,7 +44,7 @@ typedef enum { typedef void (*CommunicationCallback_t)(const void *Data_p, const uint32 Length, void *Param_p); typedef void (*HashCallback_t)(void *Data_p, const uint32 Length, uint8 *Hash_p, void *Param_p); -typedef boolean(*DeviceRead_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); +typedef ErrorCode_e(*DeviceRead_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); typedef ErrorCode_e(*DeviceWrite_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); typedef ErrorCode_e(*DeviceCancel_fn)(void *Param_p); typedef void (*HashDeviceCancel_fn)(void *Object_p, void **Param_p); @@ -122,8 +122,8 @@ typedef struct { defined timer. */ ReadTime_t ReadTime_Fn; /**< Pointer to function for read time from specified timer. */ - GetSystemTime_t GetSystemTime_Fn; /**< Pointer to function for read curent - sytem time. */ + GetSystemTime_t GetSystemTime_Fn; /**< Pointer to function for read current + system time. */ void *Object_p; /**< Pointer for instancing. It is used in the PC application, but in the loaders is always NULL */ @@ -165,7 +165,7 @@ typedef struct { then all interrupt enabled. */ RFifoDestroy_t RFifoDestroy_Fn; /**< Pointer to function - for Fifo destroing. + for Fifo destroying. First all interrupts are disabled, function executed and @@ -219,9 +219,9 @@ typedef struct { executed and then all interrupt enabled. */ void *Object_p; /**CurrentFamilyHash = HASH_CRC16; if (NULL != Communication_p->BackupCommBuffer_p) { - if (Communication_p->BackupCommBufferSize <= A2_HEADER_LENGTH) { + if (Communication_p->BackupCommBufferSize < A2_HEADER_LENGTH) { memcpy(A2_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); A2_NETWORK(Communication_p)->Inbound.ReqData = A2_HEADER_LENGTH - Communication_p->BackupCommBufferSize; A2_NETWORK(Communication_p)->Inbound.ReqBuffOffset = Communication_p->BackupCommBufferSize; A2_NETWORK(Communication_p)->Inbound.RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; } else { + /* Copy content of backup buffer into scratch buffer */ memcpy(A2_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, A2_HEADER_LENGTH); + /* Move rest of backup data at the beginning of the backup buffer */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + A2_HEADER_LENGTH, Communication_p->BackupCommBufferSize - A2_HEADER_LENGTH); + /* Update the size of the backup buffer */ Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - A2_HEADER_LENGTH; A2_NETWORK(Communication_p)->Inbound.RecBackupData = A2_HEADER_LENGTH; } @@ -86,7 +90,7 @@ ErrorExit: /* - * A2 family protocols sutdown. + * A2 family protocols shutdown. * * @param [in] Communication_p Communication module context. * @@ -131,10 +135,10 @@ ErrorExit: } /* - * A2 Cancel Transmition. + * A2 Cancel Transmission. * * @param [in] Communication_p Communication module context. - * @param [in] PacketsBeforeTransferStop Number of packets that will be transmited before stopping the transmition. + * @param [in] PacketsBeforeTransferStop Number of packets that will be transmitted before stopping the transmission. * * @retval E_SUCCESS After successful execution. * @retval E_INVALID_INPUT_PARAMETERS Invalid input parameter. @@ -145,12 +149,12 @@ ErrorCode_e A2_CancelReceiver(Communication_t *Communication_p, uint8 PacketsBef VERIFY(NULL != Communication_p, E_INVALID_INPUT_PARAMETERS); - A2_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; + A2_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; A2_NETWORK(Communication_p)->Inbound.StopTransfer = TRUE; ErrorExit: A_(printf("protrom_family.c(%d) ErrorCode=%d\n", __LINE__, ReturnValue);) - return ReturnValue; + return ReturnValue; } 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 342cb1b..99ac27e 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c @@ -21,7 +21,7 @@ #include "r_r15_network_layer.h" #include "r_communication_service.h" #include "r_basicdefinitions.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" #ifdef CFG_ENABLE_A2_FAMILY #include "r_a2_family.h" @@ -60,7 +60,7 @@ static FamilyDescriptor_t ProtocolFamilies[] = { A2_Transport_Send, NULL, NULL, - A2_CancelReceiver + A2_CancelReceiver #else NULL, NULL, @@ -104,7 +104,7 @@ static FamilyDescriptor_t ProtocolFamilies[] = { #define MAX_FAMILY (sizeof(ProtocolFamilies) / sizeof(ProtocolFamilies[0])) /******************************************************************************* - * Delaration of internal functions + * Declaration of internal functions ******************************************************************************/ static BuffersInterface_t *CreateBufferInterfaceHelpper(BuffersInterface_t *Buffers_p); @@ -120,23 +120,27 @@ FamilyDescriptor_t *GetFamily(Family_t Family); * Definition of external functions ******************************************************************************/ -/* +/** * Initialize an instance of the communication module. * * Given the initial family, already initialized hash device descriptor * and communication device descriptor, a new instance of the * communication module is created and bound to use the provided devices. * - * @param [in,out] Communication_p Communication module context. + * @param [in] Object_p Instance which will use initialized communication. + * @param [in,out] Communication_pp Communication module context. * @param [in] Family Initial protocol family. * @param [in] HashDevice_p The device to use for checksum * calculations and verifications. - * @param [in] *CommunicationDevice_p The device to use for network + * @param [in] CommunicationDevice_p The device to use for network * transmission. - * @param [in] CommandCallback_p Collback function for command handling. + * @param [in] CommandCallback_p Callback function for command handling. + * @param [in] Buffers_p Pointer to buffer handling functions. + * @param [in] Timers_p Pointer to timers handling functions. + * @param [in] Queue_p Pointer to queue handling functions. * * @retval E_SUCCESS If the module instance is successfully - * initialized. A protocol family dependant error + * initialized. A protocol family dependent error * code otherwise. */ ErrorCode_e Do_Communication_Initialize(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) @@ -188,6 +192,8 @@ ErrorCode_e Do_Communication_Initialize(void *Object_p, Communication_t **Commun Communication_p->CurrentFamilyHash = HASH_NONE; Communication_p->BackupCommBufferSize = 0; + CommunicationDevice_p->Object_p = Communication_p; + ReturnValue = Do_Communication_SetFamily(Communication_p, Family, CommandCallback_p); C_(printf("#---------------------------------------------------------\n");) @@ -208,7 +214,7 @@ ErrorExit: * @param [in,out] Communication_pp Communication module context. * * @retval E_SUCCESS If the module instance is successfully - * shut down. A protocol family dependant error + * shut down. A protocol family dependent error * code otherwise. */ ErrorCode_e Do_Communication_Shutdown(Communication_t **Communication_pp) @@ -261,7 +267,7 @@ ErrorExit: * @param [in] CEHCallback Callback that will handle the commands. * * @retval E_SUCCESS If the family is successfully changed. A - * protocol family dependant error code otherwise. + * protocol family dependent error code otherwise. */ ErrorCode_e Do_Communication_SetFamily(Communication_t *Communication_p, Family_t Family, Do_CEH_Call_t CEHCallback) { @@ -271,7 +277,7 @@ ErrorCode_e Do_Communication_SetFamily(Communication_t *Communication_p, Family_ VERIFY(NULL != Family_p, E_INVALID_INPUT_PARAMETERS); if (NULL != Communication_p->Family_p) { - (void)Communication_p->CommunicationDevice_p->Cancel(Communication_p); + (void)Communication_p->CommunicationDevice_p->Cancel(Communication_p->CommunicationDevice_p); ReturnValue = Communication_p->Family_p->FamilyShutdown_fn(Communication_p); VERIFY(E_SUCCESS == ReturnValue, ReturnValue); @@ -298,7 +304,7 @@ ErrorExit: * * * @retval E_SUCCESS If all packets are successfully handled. A - * protocol family dependant error code otherwise. + * protocol family dependent error code otherwise. */ ErrorCode_e Do_Communication_Poll(Communication_t *Communication_p) { @@ -316,7 +322,7 @@ ErrorExit: * Function for sending packet. * * @param [in] Communication_p Communication module context. - * @param [in] InputData_p Pointer to the data for tranmission. + * @param [in] InputData_p Pointer to the data for transmission. * * @retval E_SUCCESS After successful execution. * @retval E_FAILED_TO_ALLOCATE_COMM_BUFFER Failed to allocate communication @@ -397,7 +403,7 @@ ErrorExit: * device for the given LCM context. * * @retval E_SUCCESS After successful execution. - * @retval E_INVALID_INPUT_PARAMTERS In case when communicaiton is not Singleton + * @retval E_INVALID_INPUT_PARAMTERS In case when communication is not Singleton * and Communication_p is NULL pointer. */ ErrorCode_e Do_Communication_GetCommunicationDevice(Communication_t *Communication_p, CommunicationDevice_t** CommunicationDevice_pp) @@ -422,7 +428,7 @@ ErrorExit: * device to be set for the given LCM context. * * @retval E_SUCCESS After successful execution. - * @retval E_INVALID_INPUT_PARAMTERS In case when communicaiton is not Singleton + * @retval E_INVALID_INPUT_PARAMTERS In case when communication is not Singleton * and Communication_p is NULL pointer. */ ErrorCode_e Do_Communication_SetCommunicationDevice(Communication_t *Communication_p, CommunicationDevice_t* CommunicationDevice_p) @@ -437,7 +443,7 @@ ErrorExit: } /* - * Cancek Receiving new packets + * Cancel Receiving new packets * * @param [in] Communication_p Communication module context. * @param [in] PacketsBeforeReceiverStop Number of packets to be send before stopping the receiver. @@ -451,7 +457,7 @@ ErrorCode_e Do_Communication_Cancel_Receiver(Communication_t *Communication_p, u VERIFY(NULL != Communication_p->Family_p, ReturnValue); - ReturnValue = Communication_p->Family_p->CancelReceiver_fn(Communication_p, PacketsBeforeReceiverStop); + ReturnValue = Communication_p->Family_p->CancelReceiver_fn(Communication_p, PacketsBeforeReceiverStop); ErrorExit: return ReturnValue; @@ -463,7 +469,7 @@ void Do_CommunicationInternalErrorHandler(const ErrorCode_e IntError) IDENTIFIER_NOT_USED(IntError); #endif A_(printf("# Error Code: 0x%X !\n", IntError);) - A_(printf("# Loader stoped!\n");) + A_(printf("# Loader stopped!\n");) A_(printf("#---------------------------------------------------------\n");) /* coverity[no_escape] */ diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/measurement_tool.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/measurement_tool.c index 29c678d..4b42f60 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/measurement_tool.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/measurement_tool.c @@ -17,7 +17,7 @@ #include "r_time_utilities.h" #include "r_serialization.h" #include "r_debug_macro.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" /******************************************************************************* * File scope types, constants and variables diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/protrom_family.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/protrom_family.c index ec4c468..762d5cb 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/protrom_family.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/protrom_family.c @@ -52,14 +52,18 @@ ErrorCode_e Protrom_Family_Init(Communication_t *Communication_p) PROTROM_NETWORK(Communication_p)->Inbound.StopTransfer = FALSE; if (NULL != Communication_p->BackupCommBuffer_p) { - if (Communication_p->BackupCommBufferSize <= PROTROM_HEADER_LENGTH) { + if (Communication_p->BackupCommBufferSize < PROTROM_HEADER_LENGTH) { memcpy(PROTROM_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); PROTROM_NETWORK(Communication_p)->Inbound.ReqData = PROTROM_HEADER_LENGTH - Communication_p->BackupCommBufferSize; PROTROM_NETWORK(Communication_p)->Inbound.ReqBuffOffset = Communication_p->BackupCommBufferSize; PROTROM_NETWORK(Communication_p)->Inbound.RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; } else { + /* Copy content of backup buffer into scratch buffer */ memcpy(PROTROM_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, PROTROM_HEADER_LENGTH); + /* Move rest of backup data at the beginning of the backup buffer */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + PROTROM_HEADER_LENGTH, Communication_p->BackupCommBufferSize - PROTROM_HEADER_LENGTH); + /* Update the size of the backup buffer */ Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - PROTROM_HEADER_LENGTH; PROTROM_NETWORK(Communication_p)->Inbound.RecBackupData = PROTROM_HEADER_LENGTH; } @@ -79,7 +83,7 @@ ErrorExit: } /* - * Protrom family protocols sutdown. + * Protrom family protocols shutdown. * * @param [in] Communication_p Communication module context. * @@ -122,10 +126,10 @@ ErrorExit: } /* - * Protrom Cancel Transmition. + * Protrom Cancel Transmission. * * @param [in] Communication_p Communication module context. - * @param [in] PacketsBeforeTransferStop Number of packets that will be transmited before stopping the transmition. + * @param [in] PacketsBeforeTransferStop Number of packets that will be transmitted before stopping the transmission. * * @retval E_SUCCESS After successful execution. * @retval E_INVALID_INPUT_PARAMETERS Invalid input parameter. @@ -134,16 +138,16 @@ ErrorCode_e Protrom_CancelReceiver(Communication_t *Communication_p, uint8 Packe { ErrorCode_e ReturnValue = E_SUCCESS; - printf("Protrom_CancelReceiver called ...\n"); + printf("Protrom_CancelReceiver called ...\n"); VERIFY(NULL != Communication_p, E_INVALID_INPUT_PARAMETERS); - PROTROM_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; + PROTROM_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; PROTROM_NETWORK(Communication_p)->Inbound.StopTransfer = TRUE; ErrorExit: A_(printf("protrom_family.c(%d) ErrorCode=%d\n", __LINE__, ReturnValue);) - return ReturnValue; + return ReturnValue; } /** @} */ diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/r15_family.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/r15_family.c index bf9c24a..29be578 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/r15_family.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/r15_family.c @@ -57,16 +57,20 @@ ErrorCode_e R15_Family_Init(Communication_t *Communication_p) R15_NETWORK(Communication_p)->Inbound.StopTransfer = FALSE; if (NULL != Communication_p->BackupCommBuffer_p) { - if (Communication_p->BackupCommBufferSize <= HEADER_LENGTH) { + if (Communication_p->BackupCommBufferSize < ALIGNED_HEADER_LENGTH) { memcpy(R15_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize); - R15_NETWORK(Communication_p)->Inbound.ReqData = HEADER_LENGTH - Communication_p->BackupCommBufferSize; + R15_NETWORK(Communication_p)->Inbound.ReqData = ALIGNED_HEADER_LENGTH - Communication_p->BackupCommBufferSize; R15_NETWORK(Communication_p)->Inbound.ReqBuffOffset = Communication_p->BackupCommBufferSize; R15_NETWORK(Communication_p)->Inbound.RecBackupData = Communication_p->BackupCommBufferSize; Communication_p->BackupCommBufferSize = 0; } else { - memcpy(R15_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, HEADER_LENGTH); - Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - HEADER_LENGTH; - R15_NETWORK(Communication_p)->Inbound.RecBackupData = HEADER_LENGTH; + /* Copy content of backup buffer into scratch buffer */ + memcpy(R15_NETWORK(Communication_p)->Inbound.Scratch, Communication_p->BackupCommBuffer_p, ALIGNED_HEADER_LENGTH); + /* Move rest of backup data at the beginning of the backup buffer */ + memcpy(Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBuffer_p + ALIGNED_HEADER_LENGTH, Communication_p->BackupCommBufferSize - ALIGNED_HEADER_LENGTH); + /* Update the size of the backup buffer */ + Communication_p->BackupCommBufferSize = Communication_p->BackupCommBufferSize - ALIGNED_HEADER_LENGTH; + R15_NETWORK(Communication_p)->Inbound.RecBackupData = ALIGNED_HEADER_LENGTH; } C_(printf("r15_family.c(%d) BackupBuffer=0x%x Size=%d\n", __LINE__, Communication_p->BackupCommBuffer_p, Communication_p->BackupCommBufferSize);) @@ -89,7 +93,7 @@ ErrorExit: /* - * R15 family protocols sutdown. + * R15 family protocols shutdown. * * @param [in] Communication_p Communication module context. * @@ -136,10 +140,10 @@ ErrorExit: } /* - * R15 Cancel Transmition. + * R15 Cancel Transmission. * * @param [in] Communication_p Communication module context. - * @param [in] PacketsBeforeTransferStop Number of packets that will be transmited before stopping the transmition. + * @param [in] PacketsBeforeTransferStop Number of packets that will be transmitted before stopping the transmission. * * @retval E_SUCCESS After successful execution. * @retval E_INVALID_INPUT_PARAMETERS Invalid input parameter. @@ -150,12 +154,12 @@ ErrorCode_e R15_CancelReceiver(Communication_t *Communication_p, uint8 PacketsBe VERIFY(NULL != Communication_p, E_INVALID_INPUT_PARAMETERS); - R15_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; + R15_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; R15_NETWORK(Communication_p)->Inbound.StopTransfer = TRUE; ErrorExit: A_(printf("protrom_family.c(%d) ErrorCode=%d\n", __LINE__, ReturnValue);) - return ReturnValue; + return ReturnValue; } /** @} */ diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/z_family.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/z_family.c index ee090c9..d27a8b8 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/z_family.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/z_family.c @@ -115,10 +115,10 @@ ErrorExit: } /* - * Z family Cancel Transmition. + * Z family Cancel Transmission. * * @param [in] Communication_p Communication module context. - * @param [in] PacketsBeforeTransferStop Number of packets that will be transmited before stopping the transmition. + * @param [in] PacketsBeforeTransferStop Number of packets that will be transmitted before stopping the transmission. * * @retval E_SUCCESS After successful execution. * @retval E_INVALID_INPUT_PARAMETERS Invalid input parameter. @@ -129,12 +129,12 @@ ErrorCode_e Z_CancelReceiver(Communication_t *Communication_p, uint8 PacketsBefo VERIFY(NULL != Communication_p, E_INVALID_INPUT_PARAMETERS); - Z_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; + Z_NETWORK(Communication_p)->Inbound.PacketsBeforeReceiverStop = PacketsBeforeReceiverStop; Z_NETWORK(Communication_p)->Inbound.StopTransfer = TRUE; ErrorExit: A_(printf("protrom_family.c(%d) ErrorCode=%d\n", __LINE__, ReturnValue);) - return ReturnValue; + return ReturnValue; } /** @} */ diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/test_cases/ADbg_cnh1606344.c b/lcmodule/source/cnh1606344_ldr_communication_module/test_cases/ADbg_cnh1606344.c index 79845d6..eb0e2b4 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/test_cases/ADbg_cnh1606344.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/test_cases/ADbg_cnh1606344.c @@ -26,7 +26,7 @@ #include "r_adbg_module.h" #include "r_adbg_command.h" #include "r_communication_service.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" /******************************************************************************* * The test case functions declarations diff --git a/lcmodule/source/resource.h b/lcmodule/source/resource.h index e7c0c12..2f2342a 100644 --- a/lcmodule/source/resource.h +++ b/lcmodule/source/resource.h @@ -4,7 +4,7 @@ // // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 diff --git a/lcmodule/test_cases/ADbg_cnh1606344.c b/lcmodule/test_cases/ADbg_cnh1606344.c index d4b1c96..373102a 100644 --- a/lcmodule/test_cases/ADbg_cnh1606344.c +++ b/lcmodule/test_cases/ADbg_cnh1606344.c @@ -26,7 +26,7 @@ #include "r_adbg_module.h" #include "r_adbg_command.h" #include "r_communication_service.h" -#include "r_memmory_utils.h" +#include "r_memory_utils.h" /******************************************************************************* * The test case functions declarations diff --git a/source/LCDriver.rc b/source/LCDriver.rc old mode 100644 new mode 100755 index 2a79341..5be4ef9 --- a/source/LCDriver.rc +++ b/source/LCDriver.rc @@ -81,16 +81,16 @@ BEGIN BEGIN BLOCK "000904b0" BEGIN - VALUE "Comments", "Build date: 2011-06-15" + VALUE "Comments", "Build date: 2011-06-16" VALUE "CompanyName", "STEricsson AB" VALUE "FileDescription", "LCDriver Dynamic Link Library" VALUE "FileVersion", "1, 0, 0, 1" VALUE "InternalName", "Loader Communication Driver" VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2011" VALUE "OriginalFilename", "LCDriver_CNH1606432.dll" - VALUE "PrivateBuild", "http://gerrit.lud.stericsson.com/gerrit/20944" + VALUE "PrivateBuild", "Change-Id: Ib1901abfc2efa6c887c70b8583ddd2258e21aa78" VALUE "ProductName", "CXC 173 0865, LCDriver DLL" - VALUE "ProductVersion", "P1M" + VALUE "ProductVersion", "R1N" END END BLOCK "VarFileInfo" diff --git a/source/LCDriverMethods.cpp b/source/LCDriverMethods.cpp index 22c4923..7a54ecc 100644 --- a/source/LCDriverMethods.cpp +++ b/source/LCDriverMethods.cpp @@ -398,7 +398,7 @@ int CLCDriverMethods::Do_Initialize(void **ppInstance) } VERIFY_SUCCESS(m_pLcmInterface->CommunicationInitialize(this, m_CurrentProtocolFamily, m_pHashDevice, m_pCommunicationDevice, m_CurrentCEHCallback, &BufferFunctions, &TimerFunctions, &QueueFunctions)); - *ppInstance = m_pLcmInterface->getLCMContext(); + *ppInstance = m_pCommunicationDevice; // Create main thread if (m_pTimer) { @@ -725,7 +725,7 @@ int CLCDriverMethods::Done_System_GetControlKeys(TSIMLockKeys *pSIMLockKeys) pSIMLockKeys->pchPCKLock, pSIMLockKeys->pchESLCKLock, pSIMLockKeys->pchNLCKUnLock, pSIMLockKeys->pchNSLCKUnLock, pSIMLockKeys->pchSPLCKUnLock, pSIMLockKeys->pchCLCKUnLock, - pSIMLockKeys->pchPCKLock, pSIMLockKeys->pchESLCKUnLock)); + pSIMLockKeys->pchPCKUnLock, pSIMLockKeys->pchESLCKUnLock)); VERIFY_SUCCESS(WaitForEvent(EVENT_GR_RECEIVED, GROUP_SYSTEM, COMMAND_SYSTEM_AUTHENTICATE)); ErrorExit: @@ -2147,7 +2147,7 @@ int CLCDriverMethods::Do_Z_Exit_Z_Protocol() VERIFY_SUCCESS(IsMainThreadAlive()); - m_pCommunicationDevice->Cancel(m_pLcmInterface->getLCMContext()); + m_pCommunicationDevice->Cancel(m_pCommunicationDevice); //Send exit z-protocol command. VERIFY_SUCCESS(m_pZRpcFunctions->DoRPC_Z_Exit_Z_Protocol()); diff --git a/source/LCM/include/error_codes.h b/source/LCM/include/error_codes.h index e71d4b4..cc970cb 100644 --- a/source/LCM/include/error_codes.h +++ b/source/LCM/include/error_codes.h @@ -117,14 +117,28 @@ typedef enum { E_FAILED_TO_ALLOCATE_COMM_BUFFER = 206, /**< Failed to allocate communication buffer. */ E_FAILED_TO_FLUSH_RXFIFO = 207, /**< Failed to flush RX FIFO. */ E_RETRANSMITION_FAILED = 208, /**< Retransmission failed. After MAX_RESENDS attempt, failed to send packet. */ - E_COMMAND_NO_ERROR = 209, /**< */ + E_COMMAND_NO_ERROR = 209, /**< Stopped command error sequence. */ E_FAILED_TO_RELEASE_COMM_BUFFER = 210, /**< Failed to release communication buffer. */ E_FAILED_TO_INTIALIZE_TIMER_FUNCTIONS = 211, /**< Failed to initialize timer functions. */ E_FAILED_TO_INTIALIZE_QUEUE_FUNCTIONS = 212, /**< Failed to initialize queue functions. */ + E_DMA_INIT_ERROR = 213, /**< Failed to initialize DMA. */ + E_FAILED_TO_STOP_DMA = 214, /**< Failed to stop DMA channel. */ + E_FAILED_TO_OPEN_DMA_CHANNEL = 215, /**< Failed to open DMA channel. */ + E_FAILED_TO_SET_DMA_CHANNEL_TYPE = 216, /**< Failed to set DMA channel type. */ + E_FAILED_TO_SET_DMA_CHANNEL_MODE = 217, /**< Failed to set DMA channel mode. */ + E_FAILED_TO_OPEN_DMA_PIPE = 218, /**< Failed to open DMA pipe. */ + E_FAILED_TO_SET_DMA_IT_LOGIC = 219, /**< Failed to set DMA interrupt logic. */ + E_FAILED_TO_CLOSE_DMA_PIPE = 220, /**< Failed to close DMA pipe. */ + E_FAILED_TO_CLOSE_DMA_CHANNEL = 221, /**< Failed to close DMA channel. */ + E_FAILED_TO_CONFIG_SRC_DMA_DEVICE = 222, /**< Failed to configure DMA source device. */ + E_FAILED_TO_UPDATE_DMA_SRC_MEMORY_BUFFER = 223, /**< Failed to update DMA source memory buffer. */ + E_FAILED_TO_CONFIG_DEST_DMA_DEVICE = 224, /**< Failed to configure DMA destination device. */ + E_FAILED_TO_UPDATE_DMA_DEST_MEMORY_BUFFER = 225, /**< Failed to update DMA destination memory buffer. */ + E_FAILED_TO_RUN_DMA = 226, /**< Failed to run DMA transfer. */ E_INVALID_BULK_MODE = 251, /**< Invalid bulk mode. */ E_FAILED_TO_FIND_COMM_BUFFER = 252, /**< Failed to find communication buffer. */ E_INVALID_TYPE_OF_BUFFER = 253, /**< Invalid type of buffer. */ - E_COM_DEVICE_BUSY = 254, /**< */ + E_COM_DEVICE_BUSY = 254, /**< Communication device is busy. */ E_NOT_FOUND_ELEMENT_IN_RETRANSMISSION_LIST = 255, /**< The element in retransmission list is not found. */ E_FAILED_READING_FROM_BULK = 256, /**< Failed to read from bulk. */ E_FAILED_WRITING_TO_BULK = 257, /**< Failed to write to bulk. */ @@ -144,14 +158,14 @@ typedef enum { E_UNREGISTER_FS_SERVICE_FAILED = 458, /**< Unregistering of File System Manager Service failed. */ E_UNREGISTER_FPD_SERVICE_FAILED = 459, /**< Unregistering of Flash Physical Driver Service failed. */ E_UNREGISTER_GD_SERVICE_FAILED = 460, /**< Unregistering of Global Data Manager Service failed. */ - E_GENERAL_ZIP_ERROR = 551, /**< */ - E_ZIP_FAILED_TO_CREATE_CONTEXT = 552, /**< */ - E_ZIP_FAILED_TO_OPEN_FILE = 553, /**< */ - E_FILESYS_APP_INIT_FAILURE = 600, /**< */ - E_NO_FILESYSTEM_PROPERTY = 601, /**< */ - E_UNDEFINED_AUTHENTICATION_TYPE = 602, /**< */ - E_RTC_TIME_NOT_ACCURATE = 651, /**< */ - E_RTC_INTIALIZATION_FAILED = 652, /**< */ + E_GENERAL_ZIP_ERROR = 551, /**< General error. */ + E_ZIP_FAILED_TO_CREATE_CONTEXT = 552, /**< Failed to parse the zip. */ + E_ZIP_FAILED_TO_OPEN_FILE = 553, /**< Failed to open file from the zip. */ + E_FILESYS_APP_INIT_FAILURE = 600, /**< Failed to initialize the file system application. */ + E_NO_FILESYSTEM_PROPERTY = 601, /**< Failed to start file system. */ + E_UNDEFINED_AUTHENTICATION_TYPE = 602, /**< Undefined authentication type. */ + E_RTC_TIME_NOT_ACCURATE = 651, /**< System Time is not properly set. */ + E_RTC_INTIALIZATION_FAILED = 652, /**< Hardware error ocure during initialization of RTC. */ E_DIFFERENT_FLASHLAYOUT = 751, /**< Different flashlayout. */ E_EMPTY_FILE_IN_ARCHIVE = 752, /**< Archive contain empty file. */ E_UNKNOWN_COMM_DEVICE = 753, /**< Unknown communication device was detected. */ @@ -162,6 +176,23 @@ typedef enum { E_FPD_NOT_CONFIGURED = 758, /**< Flash physical driver is not configured. */ E_INVALID_SIZE_IN_MEMCONF = 759, /**< MEMCONF boot record contain invalid TotalSize field. */ E_ARCHIVE_TO_LARGE = 760, /**< Flash archive larger than available space in BDM. */ + E_ENTRY_NOT_FOUND_IN_FLASHLAYOUT = 761, /**< Entry not found in flashlayout file. */ + E_MISMATCH_MANIFEST_FLASHLAYOUT = 762, /**< Mismatch between manifest and flashlayout. */ + E_INVALID_SUBTOC_PARAMETERS = 763, /**< SUBTOC is invalid. */ + E_FAILED_TO_READ_SUBTOC = 764, /**< Reading SUBTOC from flash failed. */ + E_OVERLAPPING_PARTITIONS_FOUND = 765, /**< Overlapping partitions found in the archive. */ + E_PARTITION_NOT_FOUND = 766, /**< Partition not found in TOC. */ + E_FLASHLAYOUT_NULL = 767, /**< Flashlayout data equals NULL. */ + E_INVALID_TOC_TYPE = 768, /**< Invalid TOC type supplied during TOC list creation. */ + E_TOC_HANDLER_INPUT_DATA_EMPTY = 769, /**< TOC list cannot be created because supplied buffer is empty. */ + E_TOC_HANDLER_INPUT_DATA_CORRUPTED = 770, /**< TOC list cannot be created because supplied buffer contains corrupted data. */ + E_TOC_LIST_CORRUPTED = 771, /**< TOC list cannot be created. Some malicious state occurs. */ + E_TOC_BOOT_AREA_EMPTY = 772, /**< TOC list cannot be created. Boot area is empty. */ + E_BOOT_AREA_NOT_FOUND = 773, /**< Boot Area not found. */ + E_MISMATCH_MANIFEST_TOC = 774, /**< Mismatch between manifest and TOC. */ + E_FILE_TOO_LARGE = 775, /**< File too large. */ + E_FILE_OUT_OF_BOOT_AREA = 776, /**< File outside of boot area */ + E_DUMP_OUT_OF_FLASH_RANGE = 777, /**< Dump outside of flash range */ E_PATH_NOT_EXISTS = 951, /**< Path not exist. */ E_CLOSE_FILE = 952, /**< Failed to close a file in the file system. */ E_INSUFFICENT_SPACE = 953, /**< Not enough memory space for desired operation. */ @@ -207,13 +238,13 @@ typedef enum { E_INVALID_INPUT_PARAMETER = 1001, /**< Invalid input parameter */ E_UNSUPPORTED_CMD = 1002, /**< The loader does not support the requested command. */ E_UNSUPPORTED_GROUP = 1003, /**< The loader does not support the requested group. */ - E_INVALID_COMMAND_SIZE = 1051, /**< */ - E_OVERLOAD_COMMAND_TABLE = 1052, /**< */ - E_COMMAND_ALREADY_REGISTERED = 1053, /**< */ + E_INVALID_COMMAND_SIZE = 1051, /**< The size of the command is invalid. */ + E_OVERLOAD_COMMAND_TABLE = 1052, /**< Too many commands are registered. */ + E_COMMAND_ALREADY_REGISTERED = 1053, /**< Command has already registered in execution queue. */ E_AUDITING_FAILED = 1054, /**< Command auditing failed. */ - E_NONEXIST_TIMER = 1251, /**< */ - E_FAILED_TO_SET_TIMER = 1252, /**< */ - E_TIMER_INIT_FAILED = 1253, /**< */ + E_NONEXIST_TIMER = 1251, /**< Timer with the specified index does not exist. */ + E_FAILED_TO_SET_TIMER = 1252, /**< Failed to start the timer. */ + E_TIMER_INIT_FAILED = 1253, /**< Timer initialization failed. */ E_TIMER_IRQ_CONF_FAILED = 1254, /**< */ E_GD_INVALID_UNIT_SIZE = 1351, /**< GD/GDFS: Error in specifying unit size. */ E_GD_LL_ILLEGAL_SIZE = 1352, /**< GD/GDFS: Size too large for the block. */ @@ -247,6 +278,19 @@ typedef enum { E_GD_MISSING_CONFIG = 1380, /**< GD/GDFS: Missing configuration parameter. */ E_GD_ILLEGAL_CONFIG = 1381, /**< GD/GDFS: Illegal configuration. */ E_GD_TRANSACTION_LOG_CORRUPT = 1382, /**< GD/GDFS: The transaction log used for tracking updates to GD contents is corrupt and prevents roll-back from working properly. */ + E_CSPSA_RESULT_E_INVALID_KEY = 1383, /**< Error, parameter key not valid. */ + E_CSPSA_RESULT_E_OUT_OF_SPACE = 1384, /**< Error, there is not space enough on memory media to update the parameter area. */ + E_CSPSA_RESULT_E_NO_VALID_IMAGE = 1385, /**< Error, no valid CSPSA image found. */ + E_CSPSA_RESULT_E_MEDIA_INACCESSIBLE = 1386, /**< Memory media could not be accessed. */ + E_CSPSA_RESULT_E_READ_ONLY = 1387, /**< Image is read-only. */ + E_CSPSA_RESULT_E_READ_ERROR = 1388, /**< Error occurred while reading from media. */ + E_CSPSA_RESULT_E_WRITE_ERROR = 1389, /**< Error occurred while writing to media. */ + E_CSPSA_RESULT_UNDEFINED = 1390, /**< Represents an undefined value of this enum. */ + E_CSPSA_RESULT_E_END_OF_DATA = 1391, /**< No more parameters, end of data has been reached. */ + E_CSPSA_RESULT_E_OPEN_ERROR = 1392, /**< Parameter storage area could not be opened (media error). */ + E_CSPSA_RESULT_E_ALREADY_EXISTS = 1393, /**< Parameter storage area with same name was already registered. */ + E_CSPSA_RESULT_E_OUT_OF_MEMORY = 1394, /**< There was not enough memory to perform the operation. */ + E_CSPSA_RESULT_E_BAD_PARAMETER = 1395, /**< Error because of bad input parameter. */ E_GD_NO_DATA_TO_READ = 1399, /**< GD: No data to read. */ E_BDM_W_NO_MORE_GC_POSSIBLE = 1451, /**< BDM: No more garbage collection is possible. */ E_BDM_UNIT_STARTED = 1452, /**< BDM: Unit has already been started. */ @@ -416,12 +460,12 @@ typedef enum { E_INT_FUNCTION_LIST_EMPTY = 2007, /**< There isn't any interface function in interface group. */ E_PRECONDITION_IS_ALREADY_SET = 2008, /**< Request for setting precondition that is already set. */ E_PRECONDITION_IS_NOT_SET = 2009, /**< Request to recover condition that is not changed. */ - E_INIT_OTP_PD_FAILED = 2100, /**< */ - E_READING_OTP_FAILED = 2101, /**< */ - E_WRITTING_OTP_FAILED = 2102, /**< */ - E_INVALID_CID_VALUE = 2103, /**< */ - E_INIT_OTP_LD_FAILED = 2104, /**< */ - E_OTP_AREA_LOCKED = 2105, /**< */ + E_INIT_OTP_PD_FAILED = 2100, /**< Failed to initialize OTD driver. */ + E_READING_OTP_FAILED = 2101, /**< Failed to read data from OTP. */ + E_WRITTING_OTP_FAILED = 2102, /**< Failed to write data in OTP. */ + E_INVALID_CID_VALUE = 2103, /**< Trying to write invalid CID in OTP. */ + E_INIT_OTP_LD_FAILED = 2104, /**< Failed to initialize OTD logical driver. */ + E_OTP_AREA_LOCKED = 2105, /**< Requested OTP area is already locked. */ E_SEC_APP_PROPERTY_NOT_FOUND = 2251, /**< App property cannot be found. */ E_SEC_APP_IMEI_NOT_CHANGABLE = 2252, /**< IMEI not changeable. */ E_SEC_APP_OPERATION_DENIED = 2253, /**< Security operation denied. */ @@ -429,9 +473,9 @@ typedef enum { E_SEC_APP_ROM_ERROR_CRITICAL = 2255, /**< Critical error in ROM has occurred. */ E_SEC_APP_ROM_ERROR = 2256, /**< Unexpected ROM error. */ E_SEC_APP_PATCH_EXISTS = 2257, /**< ROM Patch is already installed. */ - E_SEC_APP_PATCH_REINSTALLED = 2258, /**< ROM Patch in Flash is reinstalled. */ - E_SEC_APP_ROOTKEY_EXISTS = 2259, /**< ROM Patch is already installed. */ - E_SEC_APP_ROOTKEY_REINSTALLED = 2260, /**< Root Key is reinstalled. */ + E_SEC_APP_PATCH_REINSTALLED = 2258, /**< Operation successful. */ + E_SEC_APP_ROOTKEY_EXISTS = 2259, /**< RootKey is already installed. */ + E_SEC_APP_ROOTKEY_REINSTALLED = 2260, /**< Operation successful. */ E_TA_WRONG_PARTITION = 2351, /**< TA: Unknown partition. */ E_TA_ILLOGICAL_CONFIGURATION = 2352, /**< TA: Configuration error. */ E_TA_UNKNOWN_MEMORY_TYPE = 2353, /**< TA: Unsupported memory type. */ @@ -456,6 +500,28 @@ typedef enum { E_PD_CFI_PROTECTED = 2656, /**< PD CFI: The requested flash address is protected from the requested type of access. */ E_PD_CFI_UNSUPPORTED_DEVICE = 2657, /**< PD CFI: Flash devices not supported by this driver. */ E_PD_CFI_OPERATION_COMPLETE = 2658, /**< PD CFI: Requested operation was not suspended as it has completed. */ + E_PD_CFI_HARDWARE_NOT_DETECTED = 2659, /**< PD CFI: NOR memory was not detected on current configuration. */ + E_HSI_BSC_RESULT_FAILED = 2701, /**< General Error. */ + E_HSI_BSC_RESULT_FAILED_INVALIDARGS = 2702, /**< Invalid arguments. */ + E_HSI_BSC_RESULT_FAILED_NOTSUPPORTED = 2703, /**< Implementation is removed. */ + E_HSI_BSC_RESULT_FAILED_HSIERR = 2704, /**< HSI internal error. */ + E_HSI_BSC_RESULT_FAILED_BUSY = 2705, /**< Communication device is busy. */ + E_HSI_BSC_ERROR_SIGNAL = 2751, /**< Signal error. */ + E_HSI_BSC_ERROR_TIMEOUT = 2752, /**< Timeout error. */ + E_HSI_BSC_ERROR_BREAK = 2753, /**< Break received. */ + E_HSI_BSC_ERROR_RECEIVE = 2754, /**< Receive buffer is not provided. */ + E_HSI_BSC_ERROR_TRANSMIT = 2755, /**< Transmit buffer is not provided. */ + E_CR_INVALID_STATE = 2850, /**< Invalid state for commnication relay detected. */ + E_CR_NOT_RUNNING = 2851, /**< Communication Relay is not running. */ + E_SDIO_BSC_RESULT_FAILED = 2901, /**< General Error. */ + E_SDIO_BSC_RESULT_FAILED_INVALIDARGS = 2902, /**< Invalid arguments. */ + E_SDIO_BSC_RESULT_FAILED_NOTSUPPORTED = 2903, /**< Implementation is removed. */ + E_SDIO_BSC_RESULT_FAILED_SDIOERR = 2904, /**< SDIO internal error. */ + E_SDIO_BSC_RESULT_FAILED_BUSY = 2905, /**< Communication device is busy. */ + E_SDIO_BSC_ERROR_TIMEOUT = 2951, /**< Timeout error. */ + E_SDIO_BSC_ERROR_BREAK = 2952, /**< Break received. */ + E_SDIO_BSC_ERROR_RECEIVE = 2953, /**< Receive buffer is not provided. */ + E_SDIO_BSC_ERROR_TRANSMIT = 2954, /**< Transmit buffer is not provided. */ E_LOADER_SEC_LIB_CHIP_ID_INVALID = 4000, /**< Invalid input parameters. */ E_LOADER_SEC_LIB_INVALID_PARAMETER_TO_FUNC = 4096, /**< Invalid input parameters. */ E_LOADER_SEC_LIB_FAILURE = 4120, /**< Failure. */ @@ -499,16 +565,18 @@ typedef enum { E_LOADER_SEC_LIB_BOOT_BLOCK_DO_NOT_EXIST = 4212, /**< Boot record do not exist. */ E_LOADER_SEC_LIB_CORRUPTED_DOMAIN_DATA = 4213, /**< Corrupted or do not exist domain data in boot block. */ E_LOADER_SEC_LIB_INVALID_DOMAIN = 4214, /**< Invalid domain. */ - E_FIFO_OVERFLOW = 4300, /**< */ - E_FIFO_UNDERFLOW = 4301, /**< */ - E_OBJECT_NULL = 4302, /**< */ - E_POINTER_NOT_NULL = 4303, /**< */ - E_UNRECOGNIZED_STATE = 4304, /**< */ - E_UNKNOWN_MANUFACTURER_ID = 4305, /**< */ - E_UNKNOWN_DEVICE_ID = 4306, /**< */ - E_INVALID_A01_FORMAT = 4308, /**< */ - E_A01_BUFFER_FULL = 4309, /**< */ - E_CONFIG_FILE_NOT_SPECIFIED = 4350, /**< */ + E_LOADER_SEC_LIB_INVALID_CHALLENGE_DATA_BLOCK = 4215, /**< Invalid challenge data block. */ + E_LOADER_SEC_LIB_NO_DEBUG_HW_NOT_ALLOWED = 4216, /**< Not allowed operation on NoDebug HW. */ + E_FIFO_OVERFLOW = 4300, /**< UART FIFO overflow. */ + E_FIFO_UNDERFLOW = 4301, /**< UART FIFO underflow. */ + E_OBJECT_NULL = 4302, /**< Null pointer to Object. */ + E_POINTER_NOT_NULL = 4303, /**< Pointer is not NULL. */ + E_UNRECOGNIZED_STATE = 4304, /**< The state in the State Machine is invalid. */ + E_UNKNOWN_MANUFACTURER_ID = 4305, /**< The provided manufacturer ID is not valid. */ + E_UNKNOWN_DEVICE_ID = 4306, /**< The provided device ID is not valid. */ + E_INVALID_A01_FORMAT = 4308, /**< Something wrong with the A01 file containing the flash image. */ + E_A01_BUFFER_FULL = 4309, /**< Buffer holding the data from the A01 file is full. */ + E_CONFIG_FILE_NOT_SPECIFIED = 4350, /**< Configuration file for the emulator is not specified. */ A2_E_SUCCESS = 5000, /**< Operation successful. */ A2_E_PROP_NOT_SUPPORTED = 5001, /**< The property is not supported. */ A2_E_PROP_READ_ONLY = 5002, /**< The property is read only. */ diff --git a/source/LCM/include/t_communication_service.h b/source/LCM/include/t_communication_service.h index 3b686cc..74f4721 100644 --- a/source/LCM/include/t_communication_service.h +++ b/source/LCM/include/t_communication_service.h @@ -44,7 +44,7 @@ typedef enum { typedef void (*CommunicationCallback_t)(const void *Data_p, const uint32 Length, void *Param_p); typedef void (*HashCallback_t)(void *Data_p, const uint32 Length, uint8 *Hash_p, void *Param_p); -typedef boolean(*DeviceRead_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); +typedef ErrorCode_e(*DeviceRead_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); typedef ErrorCode_e(*DeviceWrite_fn)(void *Data_p, uint32 Length, CommunicationCallback_t Callback_fn, void *Param_p); typedef ErrorCode_e(*DeviceCancel_fn)(void *Param_p); typedef void (*HashDeviceCancel_fn)(void *Object_p, void **Param_p); @@ -122,8 +122,8 @@ typedef struct { defined timer. */ ReadTime_t ReadTime_Fn; /**< Pointer to function for read time from specified timer. */ - GetSystemTime_t GetSystemTime_Fn; /**< Pointer to function for read curent - sytem time. */ + GetSystemTime_t GetSystemTime_Fn; /**< Pointer to function for read current + system time. */ void *Object_p; /**< Pointer for instancing. It is used in the PC application, but in the loaders is always NULL */ @@ -165,7 +165,7 @@ typedef struct { then all interrupt enabled. */ RFifoDestroy_t RFifoDestroy_Fn; /**< Pointer to function - for Fifo destroing. + for Fifo destroying. First all interrupts are disabled, function executed and @@ -219,9 +219,9 @@ typedef struct { executed and then all interrupt enabled. */ void *Object_p; /**