diff options
author | xmarvla <vlatko.markovic@seavus.com> | 2012-03-19 10:07:32 +0100 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2012-05-25 14:44:23 +0200 |
commit | 682f6b9fbd2f7296b53896b0d534627e7bcf255d (patch) | |
tree | a40f183581ca0f0a731fad490e1f6203e86f2e00 | |
parent | 9dc2897fef041426347e80385707b7c86324c63e (diff) |
Fix flashing hang when wolverine is used.
LCM adjustment for new USB RAM based driver in DBDT environment.
ST-Ericsson ID: 421630
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: I2f2835b56857eb9640501ff681400517600ccdef
Depends-On: I6112822704abd420e9a68d4b542234245a734773
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/52545
Tested-by: Vlatko STENKOSKI
Reviewed-by: QABUILD
Reviewed-by: QATEST
Reviewed-by: Zoran ANCEVSKI <zoran.ancevski@seavus.com>
27 files changed, 335 insertions, 238 deletions
diff --git a/lcmodule/source/LCM.rc b/lcmodule/source/LCM.rc index 180fe54..61bc97a 100644 --- a/lcmodule/source/LCM.rc +++ b/lcmodule/source/LCM.rc @@ -69,15 +69,15 @@ BEGIN BEGIN
BLOCK "040904b0"
BEGIN
- VALUE "Comments", "Build date: 2012-02-07"
+ VALUE "Comments", "Build date: 2012-03-14" VALUE "CompanyName", "STEricsson AB"
VALUE "FileDescription", "LCM Dynamic Link Library"
VALUE "FileVersion", "1, 0, 0, 1"
VALUE "InternalName", "Loader Communication Module"
VALUE "LegalCopyright", "Copyright (C) STEricsson AB 2012"
- VALUE "PrivateBuild", "Change-Id: I70835353a592d1f1ad40743640a1d0827e56fd2e"
+ VALUE "PrivateBuild", "Change-Id: I2f2835b56857eb9640501ff681400517600ccdef" VALUE "ProductName", "CXA1104507 Loader Communication Module"
- VALUE "ProductVersion", "P4Y"
+ VALUE "ProductVersion", "P5Y" END
END
BLOCK "VarFileInfo"
diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h index 25ef644..7399c2f 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/include/t_protrom_transport.h @@ -17,6 +17,7 @@ * Includes ******************************************************************************/ #include "t_basicdefinitions.h" +#include "t_protrom_header.h" /******************************************************************************* * Types, constants and external variables diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c index 4e4a1fb..9905069 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/bulk_protocol.c @@ -204,7 +204,7 @@ TL_BulkVectorList_t *Do_R15_Bulk_CreateVector(const Communication_t *const Commu return NULL; } - Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; Packet_p->Payload_p = Packet_p->ExtendedHeader_p + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; #else /* packet meta info allocate */ @@ -220,8 +220,8 @@ TL_BulkVectorList_t *Do_R15_Bulk_CreateVector(const Communication_t *const Commu Packet_p->Buffer_p = NULL; Packet_p->BufferSize = BULK_BUFFER_SIZE; SET_PACKET_FLAGS(Packet_p, PACKET_ALLOCATION_STATE_MASK, BUF_ALLOCATED); - Packet_p->Payload_p = (uint8 *)(HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH); - Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + Packet_p->Payload_p = (uint8 *)(ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH); + Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; BuffersNr = 0; do { @@ -1124,7 +1124,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta TL_BulkVectorList_t *BulkVector_p = R15_TRANSPORT(Communication_p)->BulkHandle.BulkVector_p; uint32 DeltaLength = 0; - Packet_p->Timer_p = NULL; + memset(&(Packet_p->Timer), 0, sizeof(Timer_t)); Packet_p->Resend = 0; /* set call back function */ Packet_p->CallBack_p = NULL; @@ -1157,7 +1157,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta ExtendedHeader.TypeFlags = CMD_BULK_DATA; /* serialize and calculate extended header */ - Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; R15_SerializeExtendedHeader(Packet_p->ExtendedHeader_p, Header.Protocol, &ExtendedHeader, &(Header.ExtendedHeaderChecksum)); /* setup header for serialization and calculation */ memcpy(&Packet_p->Header, &Header, HEADER_LENGTH); @@ -1174,7 +1174,7 @@ static void R15_Bulk_SerializeChunk(Communication_t *Communication_p, PacketMeta (void *)Packet_p); } else { memset(&Packet_p->Header.PayloadChecksum, 0x0, sizeof(uint32)); - R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header); + R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header); SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED); } } @@ -1190,7 +1190,7 @@ static void R15_Bulk_OutHashCallback(const void *const Data_p, uint32 Length, co PacketMeta_t *Packet_p = (PacketMeta_t *)Param_p; memcpy(&Packet_p->Header.PayloadChecksum, Hash_p, sizeof(uint32)); - R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header); + R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header); SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED); } diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c index 311ca2b..6041965 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/command_protocol.c @@ -259,25 +259,18 @@ static ErrorCode_e DispatchCommand(Communication_t *Communication_p, PacketMeta_ CmdData.ApplicationNr = ExtendedHeader.CommandGroup; CmdData.SessionNr = ExtendedHeader.SessionState >> 2; CmdData.Payload.Size = Packet_p->Header.PayloadLength; - CmdData.Payload.Data_p = NULL; - - if (0 != CmdData.Payload.Size) { - CmdData.Payload.Data_p = (uint8 *)malloc(Packet_p->Header.PayloadLength); - - if (NULL == CmdData.Payload.Data_p) { - return E_ALLOCATE_FAILED; - } - - memcpy(CmdData.Payload.Data_p, Packet_p->Payload_p, Packet_p->Header.PayloadLength); - } - - ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p); + CmdData.Payload.Data_p = Packet_p->Payload_p; ReturnValue = Communication_p->Do_CEH_Call_Fn(OBJECT_CEH_CALL(Communication_p), &CmdData); - if (NULL != CmdData.Payload.Data_p) { - free(CmdData.Payload.Data_p); - CmdData.Payload.Data_p = NULL; + if (E_SUCCESS == ReturnValue) { + ReturnValue = R15_Network_PacketRelease(Communication_p, Packet_p); + } else { + ErrorCode_e PacketReleaseRet = R15_Network_PacketRelease(Communication_p, Packet_p); + + if (E_SUCCESS != PacketReleaseRet) { + A_(printf("command_protocol.c (%d): Failed to release Network packet! Error: %d\n", __LINE__, PacketReleaseRet);) + } } return ReturnValue; diff --git a/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c b/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c index dcc5a3a..220ccec 100644 --- a/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c +++ b/lcmodule/source/cnh1605204_ldr_transport_layer/source/r15_transport_layer.c @@ -35,7 +35,7 @@ /******************************************************************************* * Declaration of file local functions ******************************************************************************/ -static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p); +static void TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p); static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Length, const uint8 *const Hash_p, void *Param_p); #ifdef CFG_ENABLE_LOADER_TYPE static ErrorCode_e ConfigureDeviceTimeouts(Communication_t *Communication_p); @@ -187,16 +187,16 @@ ErrorCode_e R15_Transport_Send(Communication_t *Communication_p, void *InputData Packet_p->Resend = 0; Packet_p->CallBack_p = NULL; - Packet_p->Timer_p = TimerSet(Packet_p, InputData_p, Communication_p); + TimerSet(Packet_p, InputData_p, Communication_p); Packet_p->Header = *InputData_p->Header_p; /* serialize and calculate extended header */ - Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + Packet_p->ExtendedHeader_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; R15_SerializeExtendedHeader(Packet_p->ExtendedHeader_p, InputData_p->Header_p->Protocol, InputData_p->ExtendedHeader_p, &(Packet_p->Header.ExtendedHeaderChecksum)); if (Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) { - Packet_p->Payload_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH; + Packet_p->Payload_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH + ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH; } else { - Packet_p->Payload_p = Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; + Packet_p->Payload_p = Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; } if (NULL != InputData_p->Payload_p) { @@ -215,12 +215,12 @@ ErrorCode_e R15_Transport_Send(Communication_t *Communication_p, void *InputData } else { SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED); memset(&Packet_p->Header.PayloadChecksum, 0x0, sizeof(uint32)); - R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header); + R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header); (void)QUEUE(Packet_p->Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Packet_p->Communication_p), Packet_p->Communication_p->Outbound_p, Packet_p); } } else { - R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header); + R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header); (void)QUEUE(Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, Packet_p); } @@ -290,7 +290,7 @@ static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Lengt SET_PACKET_FLAGS(Packet_p, PACKET_CRC_STATE_MASK, BUF_PAYLOAD_CRC_CALCULATED); memcpy(&Packet_p->Header.PayloadChecksum, Hash_p, sizeof(uint32)); - R15_SerializeHeader(Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &Packet_p->Header); + R15_SerializeHeader(Packet_p->Buffer_p, &Packet_p->Header); (void)QUEUE(Packet_p->Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Packet_p->Communication_p), Packet_p->Communication_p->Outbound_p, Packet_p); } @@ -304,26 +304,16 @@ static void R15_Transport_OutHashCallback(const void *const Data_p, uint32 Lengt * * @return none. */ -static Timer_t *TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p) +static void TimerSet(PacketMeta_t *Packet_p, const SendData_LP_t *const InputData_p, Communication_t *Communication_p) { - Timer_t *Timer_p = NULL; - if (InputData_p->Time > 0) { - Timer_p = (Timer_t *)malloc(sizeof(Timer_t)); - - if (NULL == Timer_p) { - return NULL; - } - /* timer data */ - Timer_p->Time = InputData_p->Time; - Timer_p->PeriodicalTime = 0; - Timer_p->HandleFunction_p = (HandleFunction_t)(InputData_p->TimerCallBackFn_p); - Timer_p->Data_p = (void *)Packet_p; - Timer_p->Param_p = (void *)Communication_p; + Packet_p->Timer.Time = InputData_p->Time; + Packet_p->Timer.PeriodicalTime = 0; + Packet_p->Timer.HandleFunction_p = (HandleFunction_t)(InputData_p->TimerCallBackFn_p); + Packet_p->Timer.Data_p = (void *)Packet_p; + Packet_p->Timer.Param_p = (void *)Communication_p; } - - return Timer_p; } #ifdef CFG_ENABLE_LOADER_TYPE diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h index 4b5cc70..a5ed3eb 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_header.h @@ -40,12 +40,6 @@ #define COMMAND_EXTENDED_HEADER_LENGTH 4 /** The length of the bulk extended header. */ #define BULK_EXTENDED_HEADER_LENGTH 20 -/** Offset of the header in the buffer. */ -#ifndef CFG_ENABLE_LOADER_TYPE -#define HEADER_OFFSET_IN_BUFFER 0 -#else -#define HEADER_OFFSET_IN_BUFFER 8 -#endif #define ALIGNED_HEADER_LENGTH ALIGN_SIZE #define ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH ALIGN_SIZE diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h index 408fdf9..9b1f09e 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_r15_network_layer.h @@ -210,7 +210,7 @@ typedef struct PacketMeta { the packet. */ R15_Header_t Header; /**< Structure of the header. */ uint32 Resend; /**< Resent counter. */ - Timer_t *Timer_p; /**< Timer data used for + Timer_t Timer; /**< Timer data used for sending/receiving packet. */ uint8 *ExtendedHeader_p; /**< Pointer to the extended header located in the packet. */ @@ -236,6 +236,7 @@ typedef struct { uint32 Key; /**< Generated unique key, used for marking packet for retransmission or removing from retransmission list. */ PacketMeta_t *Packet_p; /**< Pointer to the packet for retransmission. */ + boolean InUse; /**< Determine if the entry in retransmission list is currently allocated. */ } RetransmissionContext_t; @@ -284,9 +285,9 @@ typedef struct { /** R15 Network context */ typedef struct { - PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT]; + PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT]; /**< List of meta data for used packets. */ - RetransmissionContext_t *RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; + RetransmissionContext_t RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; /**< List of packet for retransmission */ uint32 RetransmissionListCount; /**< Counter for packets retransmission */ diff --git a/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c b/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c index 509e8cf..b74cb4a 100644 --- a/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c +++ b/lcmodule/source/cnh1605205_ldr_network_layer/source/r15_network_layer.c @@ -318,14 +318,27 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) #ifdef CFG_ENABLE_LOADER_TYPE uint8 *HeaderStartInBuffer_p = NULL; boolean IsBufferContinuous = FALSE; -#endif + static R15_OutboundState_t SavedState = SEND_IDLE; + static boolean ReRun = FALSE; +#endif // CFG_ENABLE_LOADER_TYPE uint32 ContinuousBufferLength = 0; boolean RegisterRetransmission = FALSE; uint32 ExtHdrLen = 0; uint32 Aligned_Length = 0; +#ifdef CFG_ENABLE_LOADER_TYPE +StartTramsmitter: +#endif // CFG_ENABLE_LOADER_TYPE + if (!Do_CriticalSection_Enter(Out_p->TxCriticalSection)) { +#ifdef CFG_ENABLE_LOADER_TYPE + ReRun = TRUE; + SavedState = Out_p->State; + A_(printf("r15_network_layer.c (%d) Failed to lock CriticalSection code! \n", __LINE__);) + return E_CS_LOCK_FAILED; +#else return ReturnValue; +#endif // CFG_ENABLE_LOADER_TYPE } switch (Out_p->State) { @@ -341,13 +354,14 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) Out_p->State = SEND_HEADER; } else { //Do_CommunicationInternalErrorHandler(E_RETRANSMITION_FAILED); - return E_RETRANSMITION_FAILED; + ReturnValue = E_RETRANSMITION_FAILED; + break; } /* FALLTHROUGH */ case SEND_HEADER: #ifdef CFG_ENABLE_LOADER_TYPE - HeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER; + HeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p; if (Out_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) { ExtHdrLen = ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH; @@ -381,7 +395,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) #endif - if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER), + if (E_SUCCESS == Communication_p->CommunicationDevice_p->Write((Out_p->Packet_p->Buffer_p), ContinuousBufferLength, R15_Network_WriteCallback, Communication_p->CommunicationDevice_p)) { C_(printf("r15_network_layer.c (%d) Header Sent to comm device! \n", __LINE__);) } else { @@ -397,7 +411,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) break; case SEND_EX_HEADER: - ExHeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + ExHeaderStartInBuffer_p = Out_p->Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; if (Out_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) { ExtHdrLen = ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH; @@ -451,7 +465,7 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) } if (RegisterRetransmission) { - if (NULL != Out_p->Packet_p->Timer_p) { + if (0 != Out_p->Packet_p->Timer.Time) { C_(printf("r15_network_layer.c (%d) Register retransmission\n", __LINE__);) (void)R15_Network_RegisterRetransmission(Communication_p, Out_p->Packet_p); } @@ -459,6 +473,25 @@ ErrorCode_e R15_Network_TransmiterHandler(Communication_t *Communication_p) Do_CriticalSection_Leave(Out_p->TxCriticalSection); +#ifdef CFG_ENABLE_LOADER_TYPE + + if (TRUE == ReRun) { + ReRun = FALSE; + Out_p->State = SavedState; + + ExHeaderStartInBuffer_p = NULL; + HeaderStartInBuffer_p = NULL; + IsBufferContinuous = FALSE; + ContinuousBufferLength = 0; + RegisterRetransmission = FALSE; + ExtHdrLen = 0; + Aligned_Length = 0; + + goto StartTramsmitter; + } + +#endif // CFG_ENABLE_LOADER_TYPE + return ReturnValue; } @@ -477,27 +510,26 @@ ErrorCode_e R15_Network_CancelRetransmission(const Communication_t *const Commun uint32 Index = 0; do { - if ((R15_NETWORK(Communication_p)->RetransmissionList[Index] != NULL) && (R15_NETWORK(Communication_p)->RetransmissionList[Index]->Key == UniqueKey)) { - (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index]->TimerKey); + if ((TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) && (R15_NETWORK(Communication_p)->RetransmissionList[Index].Key == UniqueKey)) { + R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE; + + (void)TIMER(Communication_p, TimerRelease_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey); - free(R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p->Timer_p); - R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p->Timer_p = NULL; - ReturnValue = R15_Network_PacketRelease(Communication_p, R15_NETWORK(Communication_p)->RetransmissionList[Index]->Packet_p); + memset(&(R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p->Timer), 0, sizeof(Timer_t)); + + ReturnValue = R15_Network_PacketRelease(Communication_p, R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p); if (E_SUCCESS != ReturnValue) { A_(printf("r15_network_layer.c(%d): Packet release failed!\n", __LINE__);) return ReturnValue; } - free(R15_NETWORK(Communication_p)->RetransmissionList[Index]); - R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL; R15_NETWORK(Communication_p)->RetransmissionListCount--; for (; Index < R15_NETWORK(Communication_p)->RetransmissionListCount; Index++) { R15_NETWORK(Communication_p)->RetransmissionList[Index] = R15_NETWORK(Communication_p)->RetransmissionList[Index + 1]; } - R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL; ReturnValue = E_SUCCESS; break; } @@ -661,6 +693,10 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa Communication_t *Communication_p = (Communication_t *)(((CommunicationDevice_t *)Param_p)->Object_p); R15_Outbound_t *Out_p = &(R15_NETWORK(Communication_p)->Outbound); BulkExtendedHeader_t ExtendedHeader = {0}; +#ifdef CFG_ENABLE_LOADER_TYPE + ErrorCode_e ReturnValue = E_GENERAL_COMMUNICATION_ERROR; + R15_OutboundState_t SavedState = Out_p->State; +#endif // CFG_ENABLE_LOADER_TYPE B_(printf("r15_network_layer.c (%d): Device write finished!! \n", __LINE__);) if (SENDING_HEADER == Out_p->State) { @@ -668,7 +704,7 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa } else if (SENDING_EX_HEADER == Out_p->State) { Out_p->State = SEND_PAYLOAD; } else if (SENDING_PAYLOAD == Out_p->State) { - if (NULL == Out_p->Packet_p->Timer_p) { + if (0 == Out_p->Packet_p->Timer.Time) { if (Out_p->Packet_p->Header.Protocol == BULK_PROTOCOL) { R15_DeserializeBulkExtendedHeader(&ExtendedHeader, Out_p->Packet_p->ExtendedHeader_p); } @@ -684,7 +720,11 @@ void R15_Network_WriteCallback(const void *Data_p, const uint32 Length, void *Pa #ifdef CFG_ENABLE_LOADER_TYPE - if (E_SUCCESS != R15_Network_TransmiterHandler(Communication_p)) { + ReturnValue = R15_Network_TransmiterHandler(Communication_p); + + if (E_CS_LOCK_FAILED == ReturnValue) { + Out_p->State = SavedState; + } else if (E_SUCCESS != ReturnValue) { R15_NETWORK(Communication_p)->Outbound.LCM_Error = E_GENERAL_COMMUNICATION_ERROR; } @@ -773,7 +813,7 @@ static ErrorCode_e R15_Network_ReceiveExtendedHeader(Communication_t *Communicat VERIFY(NULL != In_p->Packet_p, E_FAILED_TO_FIND_COMM_BUFFER); In_p->Packet_p->Header = R15Header; - In_p->Packet_p->ExtendedHeader_p = In_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH; + In_p->Packet_p->ExtendedHeader_p = In_p->Packet_p->Buffer_p + ALIGNED_HEADER_LENGTH; SET_PACKET_FLAGS(In_p->Packet_p, PACKET_RX_STATE_MASK, BUF_HDR_CRC_OK); if (In_p->Packet_p->Header.ExtendedHeaderLength == COMMAND_EXTENDED_HEADER_LENGTH) { @@ -782,7 +822,7 @@ static ErrorCode_e R15_Network_ReceiveExtendedHeader(Communication_t *Communicat In_p->Packet_p->Payload_p = In_p->Packet_p->ExtendedHeader_p + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; } - memcpy(In_p->Packet_p->Buffer_p + HEADER_OFFSET_IN_BUFFER, &In_p->Packet_p->Header, HEADER_LENGTH); + memcpy(In_p->Packet_p->Buffer_p, &In_p->Packet_p->Header, HEADER_LENGTH); memcpy(In_p->Packet_p->ExtendedHeader_p, In_p->Target_p, In_p->Header.ExtendedHeaderLength); In_p->Target_p = In_p->Packet_p->Payload_p; @@ -877,54 +917,46 @@ static ErrorCode_e R15_Network_ReceivePayload(Communication_t *Communication_p) static ErrorCode_e R15_Network_RegisterRetransmission(Communication_t *Communication_p, PacketMeta_t *Packet_p) { - int i; - int Index; - ErrorCode_e ReturnValue = E_SUCCESS; - static RetransmissionContext_t *R_Ctx_p = NULL; + int i = 0; + int Index = 0; + ErrorCode_e ReturnValue = E_RETRANSMISSION_LIST_FULL; if (R15_NETWORK(Communication_p)->RetransmissionListCount < MAX_SIZE_RETRANSMISSION_LIST) { - if (NULL == Packet_p->Timer_p->HandleFunction_p) { - Packet_p->Timer_p->HandleFunction_p = (HandleFunction_t)R15_Network_RetransmissionCallback; - Packet_p->Timer_p->Param_p = Communication_p; - } - - R_Ctx_p = (RetransmissionContext_t *)malloc(sizeof(RetransmissionContext_t)); - - if (NULL == R_Ctx_p) { - return E_ALLOCATE_FAILED; + if (NULL == Packet_p->Timer.HandleFunction_p) { + Packet_p->Timer.HandleFunction_p = (HandleFunction_t)R15_Network_RetransmissionCallback; + Packet_p->Timer.Param_p = Communication_p; } - R_Ctx_p->TimerKey = TIMER(Communication_p, TimerGet_Fn)(OBJECT_TIMER(Communication_p), Packet_p->Timer_p); - R_Ctx_p->Timeout = Packet_p->Timer_p->Time; - R_Ctx_p->Packet_p = Packet_p; - R_Ctx_p->Key = R15_Network_CreateUniqueKey(Packet_p, (uint8)(*(R_Ctx_p->Packet_p->ExtendedHeader_p + sizeof(uint16)))); - - Index = 0; - C_(printf("r15_network_layer.c (%d) Key(%d) TKey(%d) \n", __LINE__, R_Ctx_p->Key, R_Ctx_p->TimerKey);) - do { - if (NULL != R15_NETWORK(Communication_p)->RetransmissionList[Index]) { - if (R_Ctx_p->Timeout < TIMER(Communication_p, ReadTime_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index]->TimerKey)) { + if (TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) { + if (Packet_p->Timer.Time < TIMER(Communication_p, ReadTime_Fn)(OBJECT_TIMER(Communication_p), R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey)) { i = R15_NETWORK(Communication_p)->RetransmissionListCount; for (; Index < i; i--) { R15_NETWORK(Communication_p)->RetransmissionList[i] = R15_NETWORK(Communication_p)->RetransmissionList[i - 1]; } - R15_NETWORK(Communication_p)->RetransmissionList[Index] = R_Ctx_p; - R_Ctx_p = NULL; - R15_NETWORK(Communication_p)->RetransmissionListCount++; break; } Index++; } else { - R15_NETWORK(Communication_p)->RetransmissionList[Index] = R_Ctx_p; - R_Ctx_p = NULL; - R15_NETWORK(Communication_p)->RetransmissionListCount++; break; } } while (Index < MAX_SIZE_RETRANSMISSION_LIST); + + if (Index != MAX_SIZE_RETRANSMISSION_LIST) { + R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey = TIMER(Communication_p, TimerGet_Fn)(OBJECT_TIMER(Communication_p), &(Packet_p->Timer)); + R15_NETWORK(Communication_p)->RetransmissionList[Index].Timeout = Packet_p->Timer.Time; + R15_NETWORK(Communication_p)->RetransmissionList[Index].Packet_p = Packet_p; + R15_NETWORK(Communication_p)->RetransmissionList[Index].Key = R15_Network_CreateUniqueKey(Packet_p, (uint8)(*(Packet_p->ExtendedHeader_p + sizeof(uint16)))); + R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = TRUE; + R15_NETWORK(Communication_p)->RetransmissionListCount++; + C_(printf("r15_network_layer.c (%d) Key(%d) TKey(%d) \n", __LINE__, (R15_NETWORK(Communication_p)->RetransmissionList[Index].Key), (R15_NETWORK(Communication_p)->RetransmissionList[Index].TimerKey));) + } + + ReturnValue = E_SUCCESS; + } else { A_(printf("r15_network_layer.c (%d) ** Err: Retransmission List is full! ** \n", __LINE__);) } @@ -938,9 +970,8 @@ static void R15_Network_RetransmissionCallback(Communication_t *Communication_p, uint32 Index = 0; /* get first in list of packets for retransmission and remove */ - if (NULL != R15_NETWORK(Communication_p)->RetransmissionList[Index]) { - free(R15_NETWORK(Communication_p)->RetransmissionList[Index]); - R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL; + if (TRUE == R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse) { + R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE; } if (R15_NETWORK(Communication_p)->RetransmissionListCount > 0) { @@ -951,7 +982,7 @@ static void R15_Network_RetransmissionCallback(Communication_t *Communication_p, R15_NETWORK(Communication_p)->RetransmissionList[Index] = R15_NETWORK(Communication_p)->RetransmissionList[Index + 1]; } - R15_NETWORK(Communication_p)->RetransmissionList[Index] = NULL; + R15_NETWORK(Communication_p)->RetransmissionList[Index].InUse = FALSE; /* enqueue the packet for retransmission */ (void)QUEUE(Communication_p, FifoEnqueue_Fn)(OBJECT_QUEUE(Communication_p), Communication_p->Outbound_p, Packet_p); diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl b/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl index d4a8672..e0a2302 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/command_marshal.xsl @@ -197,6 +197,7 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) ErrorCode_e AuditResponse = CommandAudit(CmdData_p); CommandData_t CmdData = {0}; uint32 PLSize = sizeof(ErrorCode_e); + uint8 AuditResponseData[PLSize]; if (E_SUCCESS != AuditResponse) { @@ -207,31 +208,18 @@ ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p) CmdData.ApplicationNr = CmdData_p->ApplicationNr; CmdData.SessionNr = CmdData_p->SessionNr; CmdData.Payload.Size = PLSize; - CmdData.Payload.Data_p = NULL; - CmdData.Payload.Data_p = (uint8 *)malloc(PLSize); - - if (NULL == CmdData.Payload.Data_p) { - A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n", __LINE__);) - return E_ALLOCATE_FAILED; - } + CmdData.Payload.Data_p = AuditResponseData; Data_p = CmdData.Payload.Data_p; put_uint32(&Data_p, AuditResponse); Status = Do_R15_Command_Send(GlobalCommunication_p, &CmdData); - if (NULL != CmdData.Payload.Data_p) { - - free(CmdData.Payload.Data_p); - } - if (E_SUCCESS != Status) { - return Status; } if (E_UNSUPPORTED_CMD == AuditResponse) { - Status = Do_System_ShutDownImpl(CmdData.SessionNr); } diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl b/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl index 9919b3d..a0b879a 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/common.xsl @@ -81,9 +81,9 @@ </when> <when test="@type='buffer' and @length!='*'">put_block(&Data_p, <value-of select="@name" />, <value-of select="@length" />); </when> - <when test="@type='SupportedCommand' and @length!='*'">if (<value-of select="@name" /> != NULL) { - put_block(&Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />); - } + <when test="@type='SupportedCommand' and @length!='*'"> if (<value-of select="@name" /> != NULL) { + put_block(&Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />); + } </when> <when test="@type='ListDevice' and @length!='*'">serialize_device_entries(&Data_p, <value-of select="@name" />, <value-of select="@length" />);<!--put_block(&Data_p, <value-of select="@name" />, PLSize<value-of select="@name" />);--> </when> @@ -106,7 +106,7 @@ </when> <when test="@type='buffer' and @length!='*'">PLSize += <value-of select="@length" />; </when> - <when test="@type='SupportedCommand' and @length!='*'">PLSize += PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(SupportedCommand_t); + <when test="@type='SupportedCommand' and @length!='*'"> PLSize += PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(SupportedCommand_t); </when> <when test="@type='ListDevice' and @length!='*'">PLSize += get_device_entries_len(<value-of select="@name" />, <value-of select="@length" />); <!--PLSize<value-of select="@name" /> = <value-of select="@length" /> * sizeof(DirEntry_t);--> </when> diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml b/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml index 22251d4..459edac 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml +++ b/lcmodule/source/cnh1606344_ldr_communication_module/config/error_codes.xml @@ -17,6 +17,7 @@ <value number="52" name="E_INVALID_CURRDATE_STRING_LENGTH" fatal="false" short="Indicate that the currdate string array variable has invalid length."> Try to reset the loader and if problem still exist, report this error.</value> <value number="53" name="E_UNALIGNED_DATA" fatal="false" short="Indicate that a variable is not aligned."> Try to reset the loader and if still exist the problem, report this error.</value> <value number="54" name="E_COPS_DEAUTHENTICATION_FAILED" fatal="false" short="Indicate that ME De-Authentication failed."> Try to reset the loader and if still exist the problem, report this error.</value> + <value number="55" name="E_CS_LOCK_FAILED" fatal="false" short="Failed to lock code region protected with critical section."> Loader internal error which should be handled in place where code is executed. Try to reset the loader and if still exist the problem, report this error.</value> <!-- * IO Fatal 100-150 @@ -75,6 +76,7 @@ <value number="261" name="E_PREVIOUS_BULK_SESSION_IS_NOT_CLOSED" fatal="false" short="Previous bulk session not closed.">Try to reset the loader. If the problem still exist, report this error.</value> <value number="262" name="E_INVALID_BULK_PROTOCOL_STATE" fatal="false" short="Invalid bulk protocol state.">Try to reset the loader. If the problem still exist, report this error.</value> <value number="263" name="E_UNSUPPORTED_USB_TRANSFER_TYPE" fatal="false" short="Type of transfer is unsupported.">USB bulk transfer in DMA mode 1 is only supported.</value> + <value number="264" name="E_RETRANSMISSION_LIST_FULL" fatal="false" short="Packet can't be registered for retransmission because retransmission list is full.">All entries in the retransmission list are allocated. No place for new packet to be registered in the retransmission list.</value> <!-- * Signature Fatal 300-350 diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c index 9ceab4c..775b5bf 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/communication_service.c @@ -243,7 +243,11 @@ ErrorCode_e Do_Communication_Shutdown(Communication_t **Communication_pp) DestroyBufferInterface(Communication_p); DestroyTimerInterface(Communication_p); DestroyQueueInterface(Communication_p); - free(Communication_p->Functions_p); + + if (NULL != Communication_p->Functions_p) { + free(Communication_p->Functions_p); + Communication_p->Functions_p = NULL; + } memset(Communication_p, 0, sizeof(Communication_t)); diff --git a/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c b/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c index 224e4fb..b95f288 100644 --- a/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c +++ b/lcmodule/source/cnh1606344_ldr_communication_module/source/lcm_version.c @@ -13,6 +13,6 @@ * LCD_LCM_CompatibilityList in file LcdVersion.cpp in LCD code. */ -char LCM_CurrentVersion[] = "P4Y"; +char LCM_CurrentVersion[] = "P5Y"; /** @} */ diff --git a/lcmodule/source/legacy_compatibility/t_basicdefinitions.h b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h index 8b453ff..08c3560 100644 --- a/lcmodule/source/legacy_compatibility/t_basicdefinitions.h +++ b/lcmodule/source/legacy_compatibility/t_basicdefinitions.h @@ -75,6 +75,12 @@ #define SINT64_SUPPORTED #define UINT64_SUPPORTED #define INT64_BASE_TYPE __int64 +#elif (defined(__linux__) || defined(__APPLE__)) +#define SINT64_SUPPORTED +#define UINT64_SUPPORTED +#define INT64_BASE_TYPE long long +#else +#error "Unknown platform" #endif @@ -172,7 +178,7 @@ typedef uint8 boolean; * Portable bitfield definitions *******************************************/ -#if defined(COMPILER_IAR_AVR) || defined(COMPILER_IAR_ARM) || defined(_WIN32) || defined(COMPILER_ARM_ARM) || defined(COMPILER_GCC_ARM) || defined(COMPILER_GCC) +#if defined(COMPILER_IAR_AVR) || defined(COMPILER_IAR_ARM) || defined(_WIN32) || defined(COMPILER_ARM_ARM) || defined(COMPILER_GNUC) || defined(COMPILER_GCC) || defined(COMPILER_GCC_ARM) /** Type definition to be used when implementing bit-fields that should hold * signed values. */ diff --git a/source/CEH/ProtromRpcInterface.cpp b/source/CEH/ProtromRpcInterface.cpp index d5a3dc8..7b3bc80 100644 --- a/source/CEH/ProtromRpcInterface.cpp +++ b/source/CEH/ProtromRpcInterface.cpp @@ -4,6 +4,7 @@ ******************************************************************************/ #include "ProtromRpcInterface.h" #include "t_protrom_transport.h" +#include "t_protrom_network.h" #include "Serialization.h" ProtromRpcInterface::ProtromRpcInterface(CmdResult *CmdResult, LcmInterface *LcmInterface) diff --git a/source/LCDriver.rc b/source/LCDriver.rc index fdf0284..0b30f01 100644 --- a/source/LCDriver.rc +++ b/source/LCDriver.rc @@ -81,15 +81,15 @@ BEGIN BEGIN
BLOCK "000904b0"
BEGIN
- VALUE "Comments", "Build date: 2012-02-07"
+ VALUE "Comments", "Build date: 2012-03-14" 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 2012"
- VALUE "PrivateBuild", "Change-Id: I70835353a592d1f1ad40743640a1d0827e56fd2e"
+ VALUE "PrivateBuild", "Change-Id: I2f2835b56857eb9640501ff681400517600ccdef" VALUE "ProductName", "CXC 173 0865, LCDriver DLL"
- VALUE "ProductVersion", "P4Y"
+ VALUE "ProductVersion", "P5Y" END
END
BLOCK "VarFileInfo"
diff --git a/source/LCM/Buffers.cpp b/source/LCM/Buffers.cpp index 6e513bf..831c6e4 100644 --- a/source/LCM/Buffers.cpp +++ b/source/LCM/Buffers.cpp @@ -166,7 +166,7 @@ int Buffers::AllocateBulkVector(TL_BulkVectorList_t *BulkVector_p, uint32 iChunk CLockCS CsLock(m_BulkFile->csBulkVectors); int ReturnValue = E_SUCCESS; - int HeaderBufferSize = HEADER_OFFSET_IN_BUFFER + ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; + int HeaderBufferSize = ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH; int CurrentHeaderBufferSize = (BulkVector_p->Buffers) * HeaderBufferSize; TBulkVector *currentVector = NULL; diff --git a/source/LCM/include/error_codes.h b/source/LCM/include/error_codes.h index cc970cb..fd652f8 100644 --- a/source/LCM/include/error_codes.h +++ b/source/LCM/include/error_codes.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (C) ST-Ericsson SA 2011 + * Copyright (C) ST-Ericsson SA 2012 * License terms: 3-clause BSD license ******************************************************************************/ /* NOTE: This is an automatically generated file. DO NOT EDIT! */ @@ -43,8 +43,8 @@ * Authentication Fatal 400-450 * Authentication non-fatal 451-499 * - * COPS General Fatal 500-550 - * COPS General non-fatal 551-599 + * Zip Parser Fatal 500-550 + * Zip Parser non-fatal 551-599 * * System Fatal 600-650 * System non-fatal 651-699 @@ -52,8 +52,6 @@ * Flash Fatal 700-750 * Flash non-fatal 751-799 * - * Parameters Fatal 800-850 - * Parameters non-fatal 851-899 * * File management Fatal 900-950 * File management non-fatal 951-999 @@ -61,35 +59,73 @@ * Command Auditing and execution Fatal 1000-1050 * Command Auditing and execution non-fatal 1051-1099 * - * Emulation Fatal 1100-1150 - * Emulation non-fatal 1151-1199 * * Timers Fatal 1200-1250 * Timers non-fatal 1251-1299 * - * CABS Fatal 1300-1350 - * CABS non-fatal 1351-1399 + * Parameter Fatal 1300-1350 + * Parameter non-fatal 1351-1399 * - * GDFS Fatal 1400-1450 - * GDFS non-fatal 1451-1499 + * Block device Fatal 1400-1450 + * Block device non-fatal 1451-1499 * - * Antirollback Fatal 1500-1550 - * Antirollback non-fatal 1551-1599 + * Boot area Fatal 1500-1550 + * Boot area non-fatal 1551-1599 * - * Memory and Boot Fatal 1600-1650 - * Memory and Boot non-fatal 1651-1699 + * Cops data Fatal 1600-1650 + * Cops data non-fatal 1651-1699 * - * @todo this should be removed and error codes should be remaped. - * The same applies to Emulator errors. + * PD NAND Fatal 1700-1750 + * PD NAND non-fatal 1751-1799 * - * Job Handler Fatal 1700-1750 - * Job Handler non-fatal 1751-1799 - * - * Emulator Fatal 1800-1850 - * Emulator non-fatal 1851-1899 + * Trim Area non-fatal 1851-1899 * * Loader utilities Fatal 1900-1950 * Loader utilities non-fatal 1951-1999 + * + * Loader ADBG Fatal 2000-2050 + * Loader ADBG non-fatal 2051-2099 + * + * OTP applications Fatal 2100-2150 + * OTP applications non-fatal 2151-2199 + * + * Security applications Fatal 2200-2250 + * Security applications non-fatal 2251-2299 + * + * Trim Area Fatal 2300-2350 + * Trim Area non-fatal 2351-2499 + * + * Recovery applications Fatal 2500-2550 + * Recovery applications non-fatal 2551-2599 + * + * PD CFI Flash Fatal 2600-2650 + * PD CFI Flash non-fatal 2651-2699 + * + * HSI Driver Fatal 2700-2724 + * HSI Driver Non-Fatal 2725-2749 + * + * HSI Driver Error Callback Fatal 2750-2774 + * HSI Driver Error Callback Non-Fatal 2775-2799 + * + * Communication Relay Fatal 2800-2849 + * Communication Relay Non-Fatal 2850-2899 + * + * SDIO Driver Fatal 2900-2924 + * SDIO Driver Non-Fatal 2925-2949 + * + * SDIO Driver Error Callback Fatal 2950-2974 + * SDIO Driver Error Callback Non-Fatal 2975-2999 + * + * External BAM Interface Fatal 3000-3049 + * External BAM Interface non-fatal 3050-3099 + * + * Security Library Fatal 4000-4050 + * Security Library non-fatal 4051-4250 + * + * Emulator Fatal 4300-4350 + * Emulator non-fatal 4351-4399 + * + * A2 and lower versions error codes translation 5000+ */ @@ -100,6 +136,8 @@ typedef enum { E_INVALID_INPUT_PARAMETERS = 51, /**< The expected value into the function was incorrect. */ E_INVALID_CURRDATE_STRING_LENGTH = 52, /**< Indicate that the currdate string array variable has invalid length. */ E_UNALIGNED_DATA = 53, /**< Indicate that a variable is not aligned. */ + E_COPS_DEAUTHENTICATION_FAILED = 54, /**< Indicate that ME De-Authentication failed. */ + E_CS_LOCK_FAILED = 55, /**< Failed to lock code region protected with critical section. */ E_VECTOR_CREATE_FAIL = 100, /**< Failed to create vector in IO Layer. */ E_VECTOR_DESTROY_FAIL = 101, /**< Failed to destroy vector in IO Layer. */ E_GENERAL_IO_ERROR = 151, /**< Unknown IO error. */ @@ -147,6 +185,8 @@ typedef enum { E_INVALID_BULK_SESSION_ID = 260, /**< Invalid bulk session ID is used. */ E_PREVIOUS_BULK_SESSION_IS_NOT_CLOSED = 261, /**< Previous bulk session not closed. */ E_INVALID_BULK_PROTOCOL_STATE = 262, /**< Invalid bulk protocol state. */ + E_UNSUPPORTED_USB_TRANSFER_TYPE = 263, /**< Type of transfer is unsupported. */ + E_RETRANSMISSION_LIST_FULL = 264, /**< Packet can't be registered for retransmission because retransmission list is full. */ E_UNKNWON_PROPERTY = 351, /**< Unknown property id. */ E_CYCLIC_GRAPH = 451, /**< Cyclic graph in services detected. */ E_SERVICE_NOT_SUPPORTED = 452, /**< The service is not supported. */ @@ -165,19 +205,22 @@ typedef enum { 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_RTC_INTIALIZATION_FAILED = 652, /**< Hardware error occurred during initialization of RTC. */ + E_UNDEFINED_DEAUTHENTICATION_TYPE = 653, /**< Undefined deauthentication type. */ + E_COPS_DEVICE_STATE_FULL = 654, /**< Indicate that ME is in full security mode,Full authentication is needed prior to use COPS functionalities. */ + E_COPS_DEVICE_STATE_RELAXED = 655, /**< Indicate that ME is in authenticate security mode, Permanent type authentication is needed prior to use COPS functionalities. */ 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. */ E_FLASH_APP_INTERNAL_ERROR = 754, /**< Internal during execution of flash commands. */ E_DEVICE_NAME_TOO_LONG = 755, /**< Device name is too long. */ - E_FLASH_ARCHIVE_MISMATCH = 756, /**< Mismatch between archieve that is flashed and previosly flashed one. */ + E_FLASH_ARCHIVE_MISMATCH = 756, /**< Mismatch between archive that is flashed and previously flashed one. */ E_UNSUPPORTED_FLASH_TYPE = 757, /**< Flash memory device type is not supported. */ 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_MISMATCH_MANIFEST_FLASHLAYOUT = 762, /**< Mismatch between manifest and flash layout. */ 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. */ @@ -193,6 +236,10 @@ typedef enum { 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_ERASING_BAM_AREA_FAILED = 778, /**< Boot area is not empty. Erasing boot area on a logical level is not allowed. */ + E_ENHANCED_AREA_NOT_SET = 779, /**< Enhanced area is not set */ + E_ENHANCED_IMAGE_OUT_OF_ENHANCED_AREA = 780, /**< Image out of enhanced area */ + E_SET_ENHANCED_AREA_FAILED = 781, /**< Setting of enhanced area failed */ 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. */ @@ -258,7 +305,7 @@ typedef enum { E_GD_FG_UNIT_SIZE_MISMATCH = 1360, /**< GD/GDFS: Attempt to access a unit outside its beyond its end. */ E_GD_FG_ILLEGAL_LOG_BLK_NR = 1361, /**< GD/GDFS: Attempt to access a logical block that does not exist. (Hardware, fatal). */ E_GD_FG_ILLEGAL_PHYS_BLK_NR = 1362, /**< GD/GDFS: Attempt to access a physical block that does not exist (internal error). */ - E_GD_FG_BLK_FULL = 1363, /**< GD/GDFS: Attempted to write more data to a block than could be fitted into one FLASH block. */ + E_GD_FG_BLK_FULL = 1363, /**< GD/GDFS: Attempted to write more data to a block than could be placed into one FLASH block. */ E_GD_FG_NO_BLK_FREE = 1364, /**< GD/GDFS: Internal error (no free blocks are available). */ E_GD_FG_UNIT_CHECKSUM = 1365, /**< GD/GDFS: The checksum or a unit being read is wrong. */ E_GD_FG_NOT_DIRECT_BLOCK = 1366, /**< GD/GDFS: Block is not direct. */ @@ -376,16 +423,40 @@ typedef enum { E_BAM_ERR_BLOCK_NOT_ERASED = 1593, /**< BAM: Block not erased. */ E_BAM_ONLD_CRITICAL_ERROR = 1601, /**< BAM ONLD: Critical error. */ E_BAM_ONLD_INVALID_PARAMS = 1602, /**< BAM ONLD: Invalid parameters. */ - E_BAM_ONLD_INITIALISATION_ERROR = 1603, /**< BAM ONLD: Initialisation error. */ + E_BAM_ONLD_INITIALISATION_ERROR = 1603, /**< BAM ONLD: Initialization error. */ E_BAM_ONLD_READ_ERROR = 1604, /**< BAM ONLD: An error occurred while reading. */ E_BAM_ONLD_WRITE_ERROR = 1605, /**< BAM ONLD: An error occurred while writing. */ E_BAM_ONLD_ERASE_ERROR = 1606, /**< BAM ONLD: An error occurred while erasing. */ E_BAM_ONLD_DEVICE_ERROR = 1607, /**< BAM ONLD: Device error. */ E_BAM_ONLD_GOODBLOCK = 1608, /**< BAM ONLD: Good block. */ E_BAM_ONLD_BADBLOCK = 1609, /**< BAM ONLD: Bad block. */ + E_COPS_RC_ASYNC_CALL = 1621, /**< COPS: Asynchronous call initiated. */ + E_COPS_RC_IPC_ERROR = 1622, /**< COPS: IPC failed. */ + E_COPS_RC_INTERNAL_IPC_ERROR = 1623, /**< COPS: Internal IPC lib error. */ + E_COPS_RC_ASYNC_IPC_ERROR = 1624, /**< COPS: Asynchronous IPC is not supported/setup for this function. */ + E_COPS_RC_ARGUMENT_ERROR = 1625, /**< COPS: Incorrect arguments for function. */ + E_COPS_RC_STORAGE_ERROR = 1626, /**< COPS: Storage error (read/write flash failed). */ + E_COPS_RC_MEMORY_ALLOCATION_ERROR = 1627, /**< COPS: Failed to allocate memory. */ + E_COPS_RC_UNSPECIFIC_ERROR = 1628, /**< COPS: Unspecified error. */ + E_COPS_RC_SERVICE_NOT_AVAILABLE_ERROR = 1629, /**< COPS: Service not available error. */ + E_COPS_RC_SERVICE_ERROR = 1630, /**< COPS: Error in a service. */ + E_COPS_RC_NOT_AUTHENTICATED_ERROR = 1631, /**< COPS: Not authenticated error. */ + E_COPS_RC_CHALLENGE_MISSING_ERROR = 1632, /**< COPS: No challenge found. */ + E_COPS_RC_SIGNATURE_VERIFICATION_ERROR = 1633, /**< COPS: Signature validation failed. */ + E_COPS_RC_DATA_TAMPERED_ERROR = 1634, /**< COPS: Data tampered. */ + E_COPS_RC_DATA_CONFIGURATION_ERROR = 1635, /**< COPS: Data configuration error. */ + E_COPS_RC_INCORRECT_SIM = 1636, /**< COPS: SIM card is not OK with SIMLock settings. */ + E_COPS_RC_TIMER_RUNNING = 1637, /**< COPS: A simlock unlock timer is currently running. */ + E_COPS_RC_NO_UNLOCK_ATTEMPTS_LEFT = 1638, /**< COPS: No simlock unlock attempts left. */ + E_COPS_RC_INVALID_SIMLOCK_KEY = 1639, /**< COPS: The key is invalid. */ + E_COPS_RC_INTERNAL_ERROR = 1640, /**< COPS: Internal error. */ + E_COPS_RC_LOCKING_ERROR = 1641, /**< COPS: Not allowed to lock a simlock. */ + E_COPS_RC_UNLOCK_ATTEMPTS_STILL_LEFT = 1642, /**< COPS: Still unlock attempts left for the lock. */ + E_COPS_RC_ROUTED = 1643, /**< COPS: Message should be routed. */ + E_COPS_RC_AUTOLOCK_NOT_ALLOWED = 1644, /**< COPS: Autolock only allowed during first boot. */ E_COPS_MEMORY_ALLOC_FAILED = 1651, /**< COPS: Memory allocation failed. */ E_COPS_DATA_TAMPERED = 1652, /**< COPS: Data is tempered. */ - E_COPS_IMEI_MISSMATCH = 1653, /**< COPS: IMEI missmatch. */ + E_COPS_IMEI_MISSMATCH = 1653, /**< COPS: IMEI mismatch. */ E_COPS_OTP_LOCKED = 1654, /**< COPS: OTP is locked. */ E_COPS_MAC_FUNCTION_LOCKED_DOWN = 1655, /**< COPS: Function for calculating MAC is locked down. */ E_COPS_AUTHENTICATION_FAILED = 1656, /**< COPS: Authentication failed. */ @@ -405,7 +476,7 @@ typedef enum { E_COPS_PARAMETER_ERROR = 1670, /**< COPS: Parameter error. */ E_COPS_BUFFER_TOO_SMALL = 1671, /**< COPS: Memory buffer is too small. */ E_COPS_FORBIDDEN_PARAMETER_ID = 1672, /**< COPS: Parameter is not allowed. */ - E_COPS_UNKNOWN_PARAMETER_ID = 1673, /**< COPS: Parameter can not be recognised. */ + E_COPS_UNKNOWN_PARAMETER_ID = 1673, /**< COPS: Parameter can not be recognized. */ E_COPS_ARGUMENT_ERROR = 1674, /**< COPS: Argument error! */ E_COPS_VERIFY_FAILED = 1698, /**< COPS: Failed to verify internal data. */ E_COPS_UNDEFINED_ERROR = 1699, /**< COPS: Undefined error. */ @@ -421,12 +492,12 @@ typedef enum { E_GD_TA_BASE = 1851, /**< GD/TA: TA base. */ E_GD_TA_UNKNOWN_PARTITION = 1852, /**< GD/TA: Unknown partition. */ E_GD_TA_UNKNOWN_CONFIG = 1853, /**< GD/TA: Unknown configuration. */ - E_GD_TA_ILLOGICAL_CONFIGURATION = 1854, /**< GD/TA: Ilogical configuration. */ + E_GD_TA_ILLOGICAL_CONFIGURATION = 1854, /**< GD/TA: Illogical configuration. */ E_GD_TA_UNKNOWN_MEMORY_TYPE = 1855, /**< GD/TA: Unknown memory type. */ E_GD_TA_WRONG_PARAMETER = 1856, /**< GD/TA: Wrong parameter. */ E_GD_TA_OUT_OF_MEMORY = 1857, /**< GD/TA: Out of memory. */ - E_GD_TA_INVALID_ADRESS = 1858, /**< GD/TA: Invalid adress. */ - E_GD_TA_UNUSED_ADRESS = 1859, /**< GD/TA: Unused adress. */ + E_GD_TA_INVALID_ADRESS = 1858, /**< GD/TA: Invalid address. */ + E_GD_TA_UNUSED_ADRESS = 1859, /**< GD/TA: Unused address. */ E_GD_TA_UNIT_NOT_FOUND = 1860, /**< GD/TA: Unit not found. */ E_GD_TA_NOT_IMPLEMENTED = 1861, /**< GD/TA: TA is not supported. */ E_GD_TA_FAIL = 1862, /**< GD/TA: TA fail. */ @@ -511,7 +582,7 @@ typedef enum { 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_INVALID_STATE = 2850, /**< Invalid state for communication 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. */ @@ -522,6 +593,29 @@ typedef enum { 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_BAM_INVALID_HANDLE = 3051, /**< The handle supplied to BAM is invalid. */ + E_BAM_ALREADY_INITIALIZED = 3052, /**< The instance if BAM has already been initialized. */ + E_BAM_INVALID_CONF = 3053, /**< BAM configuration is invalid. */ + E_BAM_BAD_PARAM = 3054, /**< One of the parameter passed to BAM makes no sense. */ + E_BAM_ENOMEM = 3055, /**< BAM could not allocate enough memory to complete the operation. */ + E_BAM_ENOENT = 3056, /**< BAM could not locate the requested image/partition. */ + E_BAM_EEXIST = 3057, /**< An image with the same ID has already been written. */ + E_BAM_ENOSPACE = 3058, /**< BAM could not complete the operation due to insufficient storage space. */ + E_BAM_ERANGE = 3059, /**< A TOC entry specifies a location outside the area. */ + E_BAM_INVALID_TOC = 3060, /**< The TOC passed to BAM was detected as corrupt. */ + E_BAM_INVALID_AREA = 3061, /**< An area found in the TOC or passed to BAM is invalid. */ + E_BAM_NOT_INITIALIZED = 3062, /**< The instance or update mode of BAM has not been initialized. */ + E_BAM_HW_ERR = 3063, /**< BAM was unable to perform the operation due to failure in HW. */ + E_BAM_STATE_CORRUPT = 3064, /**< The BAM state is corrupt. */ + E_BAM_NOT_ALLOWED = 3065, /**< The operation is not allowed. */ + E_BAM_FS_ERROR = 3066, /**< An Operation towards the FileSystem return an unexpected result. */ + E_BAM_BAD_FS_STATE = 3067, /**< BAM state files in the FS is not in the expected state. */ + E_BAM_HASH_ERROR = 3068, /**< The hash callback function failed unexpectedly. */ + E_BAM_UPDATE_IN_PROGRESS = 3069, /**< An update is already in progress. */ + E_BAM_BUF_TOO_SMALL = 3070, /**< The supplied buffer is to small.The image will not be written. */ + E_BAM_EXTERNAL_ERROR = 3071, /**< An external error occurred. */ + E_BAM_NOT_INSTANTIATED = 3072, /**< The requested function is not compiled into the loadmodule that supplies the service. */ + E_BAM_UPDATE_NOT_POSSIBLE = 3073, /**< The state in the flash prevents BAM from performing any updates. */ 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. */ @@ -560,7 +654,7 @@ typedef enum { E_LOADER_SEC_LIB_UNSUPPORTED_NO_DEBUG_HW = 4207, /**< No debug hardware detected. */ E_LOADER_SEC_LIB_CHANGE_OPERATION_NOT_SUPPORTED = 4208, /**< Requested change operation is not supported or not allowed. */ E_LOADER_SEC_LIB_INVALID_CHANGE_OPERATION = 4209, /**< Invalid change operation. */ - E_LOADER_SEC_LIB_RWIMEI_NOT_ALLOWED = 4210, /**< Rewriteable IMEI is not allowed to change. */ + E_LOADER_SEC_LIB_RWIMEI_NOT_ALLOWED = 4210, /**< Re-writable IMEI is not allowed to change. */ E_LOADER_SEC_LIB_REQUEST_DENIED = 4211, /**< Request for change operation is denied. */ 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. */ @@ -613,7 +707,7 @@ typedef enum { A2_E_BOOTIMAGE_SIGNATURE_FAILED = 5033, /**< Boot image signature failed. */ A2_E_BOOTIMAGE_FAILED_TO_READ_IMAGE = 5034, /**< Failed to read image. */ A2_E_BOOTIMAGE_FAILED_ALLOCATE_MEM = 5035, /**< Failed to allocate memory. */ - A2_E_BOOTIMAGE_INVALID_PARAM = 5036, /**< Boot image invalid parametars. */ + A2_E_BOOTIMAGE_INVALID_PARAM = 5036, /**< Boot image invalid parameters. */ A2_E_BOOTIMAGE_INVALID_LENGTH = 5037, /**< Boot image has invalid length. */ A2_E_BOOTIMAGE_MACED_HEADER_SIZE_ZERO = 5038, /**< Header size is zero. */ A2_E_FLASH_RESULT_DEVICE_PROTECTED = 5039, /**< The flash device was protected. */ @@ -702,11 +796,11 @@ typedef enum { A2_E_PMC_OVERFLOWN = 5122, /**< All steps of the PMC are destroyed. */ A2_E_PMC_ONCE_REQUIRED = 5123, /**< New version of once protected module attempted to be loaded without ARB flag set. */ A2_E_PMC_BAD_N_OF_STEPS = 5124, /**< Unsuitable number of steps within PMC. */ - A2_E_UNIT_MISSING = 5125, /**< Dynamyc variable is missing. */ - A2_E_UNIT_TO_BIG = 5126, /**< Dynamyc variable found is to big. */ + A2_E_UNIT_MISSING = 5125, /**< Dynamic variable is missing. */ + A2_E_UNIT_TO_BIG = 5126, /**< Dynamic variable found is to big. */ A2_E_PARTMAN_READ_ERROR = 5127, /**< Error reading partition manger status. */ A2_E_PARTMAN_INIT_ERROR = 5128, /**< Error initializing partition manger. */ - A2_E_BOOTIMAGE_INVALID_ALLIGNMENT = 5129, /**< Boot container size is not word alligned. */ + A2_E_BOOTIMAGE_INVALID_ALLIGNMENT = 5129, /**< Boot container size is not word aligned. */ A2_E_BOOTIMAGE_INSUFFICIENT_CONTAINERS = 5130, /**< Not enough boot containers are allocated. */ A2_E_BOOTIMAGE_INVALID_CONTAINER_TYPE = 5131, /**< Invalid boot container type. At this position other type of container is expected. */ A2_E_DATA_LENGTH_IS_NOT_ALIGNED = 5132, /**< The data size must be aligned to 512 bytes when reading or writing pages to/from the NAND. */ diff --git a/source/LCM/include/t_bulk_protocol.h b/source/LCM/include/t_bulk_protocol.h index 38ca8b4..95c4dbd 100644 --- a/source/LCM/include/t_bulk_protocol.h +++ b/source/LCM/include/t_bulk_protocol.h @@ -64,14 +64,14 @@ TYPEDEF_ENUM { WAIT_TX_DONE = 9, /**< Wait all chunks to be sent. */ WRITE_BULK_FINISH = 10, /**< Bulk acknowledge has been received, finish the write bulk process. */ - WAIT_WRITE_REQUEST = 11, /**< Wait bulk request command. */ + WAIT_WRITE_REQUEST = 11, /**< Wait bulk request command. */ CANCEL_BULK = 12 } ENUM8(TL_BulkProtocolState_t); /** Defined bulk process states. */ TYPEDEF_ENUM { BULK_SESSION_IDLE = 0x00, /**< Bulk transfer is closed and ready - for starting. */ + for starting. */ BULK_SESSION_OPEN = 0x01, /**< Bulk transfer is opened. */ BULK_SESSION_PROCESSING = 0x02, /**< Processing the bulk transfer. */ BULK_SESSION_FINISHED = 0x04, /**< Bulk transfer is finished. */ diff --git a/source/LCM/include/t_command_protocol.h b/source/LCM/include/t_command_protocol.h index 2ca51c6..5896727 100644 --- a/source/LCM/include/t_command_protocol.h +++ b/source/LCM/include/t_command_protocol.h @@ -30,9 +30,9 @@ */ typedef enum { COMMAND_TYPE, /**< Command type of the packet.*/ - COMMAND_ACK, /**< Acknwoledge type of the packet.*/ + COMMAND_ACK, /**< Acknowledge type of the packet.*/ GENERAL_RESPONSE, /**< General response type of the packet.*/ - GENERAL_RESPONSE_ACK /**< General response acknwoledge type of the packet.*/ + GENERAL_RESPONSE_ACK /**< General response acknowledge type of the packet.*/ } CommandType_t; @@ -52,7 +52,7 @@ typedef struct Buffer_s { typedef struct Result_s { ErrorCode_e Status; /**< Status send by the general response. */ Buffer_t *Response_p; /**< Buffer holding data that should be - returned trough the general response */ + returned trough the general response */ } Result_t; /** @@ -62,7 +62,7 @@ typedef struct CommandData_s { uint8 CommandNr; /**< Number of the command. */ uint8 ApplicationNr;/**< Number of the application (command) group. */ uint16 SessionNr; /**< Number of the session in which this command - was received.*/ + was received.*/ CommandType_t Type; /**< Command type. */ Buffer_t Payload; /**< Holds the data received with the command.*/ } CommandData_t; diff --git a/source/LCM/include/t_communication_service.h b/source/LCM/include/t_communication_service.h index 74f4721..268788a 100644 --- a/source/LCM/include/t_communication_service.h +++ b/source/LCM/include/t_communication_service.h @@ -13,7 +13,6 @@ /******************************************************************************* * Includes ******************************************************************************/ -#include "c_system.h" #include "t_basicdefinitions.h" #include "error_codes.h" #include "t_security_algorithms.h" @@ -21,12 +20,6 @@ #include "t_queue.h" #include "t_time_utilities.h" -#ifndef CFG_ENABLE_LOADER_TYPE -#ifdef WIN32 -#include <windows.h> -#endif -#endif - /******************************************************************************* * Types, constants and external variables @@ -47,6 +40,7 @@ typedef void (*HashCallback_t)(void *Data_p, const uint32 Length, uint8 *Hash_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 ErrorCode_e(*DeviceSetTimeouts_fn)(void *Timeouts_p, void *Param_p); typedef void (*HashDeviceCancel_fn)(void *Object_p, void **Param_p); typedef void (*DeviceCalculate_fn)(void *Object_p, HashType_e Type, void *Data_p, const uint32 Length, uint8 *Hash_p, HashCallback_t Callback_fn, void *Param_p); @@ -243,14 +237,16 @@ typedef struct { * Structure contain all functions for communication device manipulating. */ typedef struct { - DeviceRead_fn Read; /**< Pointer to function for read data from - communication device. */ - DeviceWrite_fn Write; /**< Pointer to function for write data thru the - communication device. */ - DeviceCancel_fn Cancel; /**< Pointer to function for canceling current - communication with communication device. */ - void *Context_p; /**< Pointer to Device description data. */ - void *Object_p; /**< Pointer to Object associated with the device. */ + DeviceRead_fn Read; /**< Pointer to function for read data from + communication device. */ + DeviceWrite_fn Write; /**< Pointer to function for write data thru the + communication device. */ + DeviceCancel_fn Cancel; /**< Pointer to function for canceling current + communication with communication device. */ + DeviceSetTimeouts_fn SetTimeouts; /**< Pointer to function for setting timeouts + for the communication device*/ + void *Context_p; /**< Pointer to Device description data. */ + void *Object_p; /**< Pointer to Object associated with the device. */ } CommunicationDevice_t; /** @@ -338,7 +334,7 @@ typedef struct FamilyDescriptor_s { ErrorCode_e(*SetProtocolTimeouts_fn)(Communication_t *Communication_p, void *TimeoutData_p); /**< Pointer to function for getting communication timeouts from current protocol family. */ ErrorCode_e(*GetProtocolTimeouts_fn)(Communication_t *Communication_p, void *TimeoutData_p); - /**< Pointer to function for stopping the transmition pool after sending the specified number of packets. */ + /**< Pointer to function for stopping the transmission pool after sending the specified number of packets. */ ErrorCode_e(*CancelReceiver_fn)(Communication_t *Communication_p, uint8 PacketsBeforeTransferStop); } FamilyDescriptor_t; diff --git a/source/LCM/include/t_protrom_header.h b/source/LCM/include/t_protrom_header.h index e8f52c4..a434e79 100644 --- a/source/LCM/include/t_protrom_header.h +++ b/source/LCM/include/t_protrom_header.h @@ -50,7 +50,7 @@ typedef struct { uint8 HeaderPattern; /**< Header pattern for marking header start.*/ uint8 Protocol; /**< Protocol type. */ uint8 SourceAddress; /**< Source address. */ - uint8 DestinationAddress; /**< Destionation address. */ + uint8 DestinationAddress; /**< Destination address. */ uint8 ReservedField; /**< Reserved field. */ uint16 PayloadLength; /**< Payload length. */ } Protrom_Header_t; diff --git a/source/LCM/include/t_protrom_network.h b/source/LCM/include/t_protrom_network.h index b29a65a..fe693f4 100644 --- a/source/LCM/include/t_protrom_network.h +++ b/source/LCM/include/t_protrom_network.h @@ -39,11 +39,11 @@ typedef enum { /** Defined state of the transmitter */ typedef enum { - PROTROM_SEND_IDLE, /**< Transmiter idle state.*/ - PROTROM_SEND_HEADER, /**< Transmiter send header. */ - PROTROM_SEND_PAYLOAD, /**< Transmiter send payload. */ - PROTROM_SENDING_HEADER, /**< Transmiter is in process sending header.*/ - PROTROM_SENDING_PAYLOAD /**< Transmiter is in process sending payload.*/ + PROTROM_SEND_IDLE, /**< Transmitter idle state.*/ + PROTROM_SEND_HEADER, /**< Transmitter send header. */ + PROTROM_SEND_PAYLOAD, /**< Transmitter send payload. */ + PROTROM_SENDING_HEADER, /**< Transmitter is in process sending header.*/ + PROTROM_SENDING_PAYLOAD /**< Transmitter is in process sending payload.*/ } Protrom_OutboundState_t; /** Structure for the packet meta data type. */ @@ -52,8 +52,8 @@ typedef struct Protrom_Packet { uint8 *Buffer_p; /**< Temporary buffer for receiving data.*/ uint16 CRC; /**< Calculated CRC of received packet. */ Communication_t *Communication_p; /**< The communication over which this - packet has been/is to be transferred - over */ + packet has been/is to be transferred + over */ } Protrom_Packet_t; /** Structure for handling incoming PROTROM packets.*/ @@ -62,9 +62,9 @@ typedef struct { Protrom_InboundState_t State; /**< Number of requested data for receiving from communication device. */ uint32 ReqData; - /**< Number of receivied data from communication device. */ + /**< Number of received data from communication device. */ uint32 RecData; - /**< Number of receivied data from backup buffer used for switching the + /**< Number of received data from backup buffer used for switching the * protocol family. */ uint32 RecBackupData; /**< Offset in the buffer for next data that should be received. */ @@ -73,7 +73,7 @@ typedef struct { uint8 *Target_p; /**< Temporary buffer for receiving data. */ uint8 Scratch[PROTROM_HEADER_LENGTH]; - /** Number of packets before receiver is stoped. */ + /** Number of packets before receiver is stopped. */ uint8 PacketsBeforeReceiverStop; /** Indicator for stopping the receiver. */ boolean StopTransfer; diff --git a/source/LCM/include/t_protrom_transport.h b/source/LCM/include/t_protrom_transport.h index 20eef29..7399c2f 100644 --- a/source/LCM/include/t_protrom_transport.h +++ b/source/LCM/include/t_protrom_transport.h @@ -17,7 +17,7 @@ * Includes ******************************************************************************/ #include "t_basicdefinitions.h" -#include "t_protrom_network.h" +#include "t_protrom_header.h" /******************************************************************************* * Types, constants and external variables diff --git a/source/LCM/include/t_r15_header.h b/source/LCM/include/t_r15_header.h index e31ca8c..a5ed3eb 100644 --- a/source/LCM/include/t_r15_header.h +++ b/source/LCM/include/t_r15_header.h @@ -40,12 +40,6 @@ #define COMMAND_EXTENDED_HEADER_LENGTH 4 /** The length of the bulk extended header. */ #define BULK_EXTENDED_HEADER_LENGTH 20 -/** Offset of the header in the buffer. */ -#ifndef CFG_ENABLE_LOADER_TYPE -#define HEADER_OFFSET_IN_BUFFER 0 -#else -#define HEADER_OFFSET_IN_BUFFER 8 -#endif #define ALIGNED_HEADER_LENGTH ALIGN_SIZE #define ALIGNED_COMMAND_EXTENDED_HEADER_LENGTH ALIGN_SIZE @@ -69,7 +63,7 @@ typedef struct { uint8 HeaderPattern; /**< Header pattern for marking header start.*/ uint8 Protocol; /**< Protocol type. */ uint16 HeaderPatternExtension; /**< Header pattern extension.*/ - uint8 Flags; /**< Flasgs for the header.*/ + uint8 Flags; /**< Flags for the header.*/ uint8 ExtendedHeaderLength; /**< Extended header length.*/ uint8 ExtendedHeaderChecksum; /**< Extended header checksum.*/ uint32 PayloadLength; /**< Payload length. */ diff --git a/source/LCM/include/t_r15_network_layer.h b/source/LCM/include/t_r15_network_layer.h index fbf1da1..9b1f09e 100644 --- a/source/LCM/include/t_r15_network_layer.h +++ b/source/LCM/include/t_r15_network_layer.h @@ -50,7 +50,7 @@ /** Acknowledge packet time(mS) out value */ #define ACK_TIMEOUT_IN_MS 10000 /** Default time(mS) out for receiving bulk command */ -#define BULK_COMMAND_RECEIVING_TIMEOUT 10000 +#define BULK_COMMAND_RECEIVING_TIMEOUT 20000 /** Default time(mS) out for receiving bulk data. This value is set for UART on 115200kbps! */ #define BULK_DATA_RECEIVING_TIMEOUT 120000 @@ -71,8 +71,8 @@ /** Size of a buffer used for commands. */ #define COMMAND_BUFFER_SIZE 0x00010000 -/** Size of a buffer used for bulk transfer, - * must be biger than buffer for commands. */ +/** Size of a payload buffer used for bulk transfer, + * must be larger than buffer for commands. */ #define BULK_BUFFER_SIZE 0x00100000 @@ -86,7 +86,7 @@ #define SESSION_MASK 0xFFFC /** - * Defines all posible types of buffers that can be created (allocated). + * Defines all possible types of buffers that can be created (allocated). * * It is used to specified the type of the buffer * when allocating a new buffer. Also it is used when @@ -108,7 +108,7 @@ TYPEDEF_ENUM { BUF_TX_SENT = 0x00000008, /**< The buffer is sent and wait ACK. */ BUF_TX_DONE = 0x00000010, /**< The buffer has been sent and can be deallocated. */ - BUF_TX_TIMEOUT = 0x00000020, /**< The timeout ocure when buffer is + BUF_TX_TIMEOUT = 0x00000020, /**< The timeout occur when buffer is sending. */ BUF_RX_READY = 0x00000040, /**< The buffer is filled with received data and is ready for @@ -145,7 +145,7 @@ TYPEDEF_ENUM { (packet)->Flags |= (mask & flags); \ } while (0) -#define CHECK_PACKET_FLAGS(packet, flags) (((flags) == ((packet)->Flags & (flags))) ? TRUE : FALSE) +#define CHECK_PACKET_FLAGS(packet, flags) ((0 != ((packet)->Flags & (flags))) ? TRUE : FALSE) /** Defined state of the receiver */ typedef enum { @@ -158,11 +158,13 @@ typedef enum { /** Defined state of the transmitter */ typedef enum { - SEND_IDLE, /**< Transmiter idle state.*/ - SEND_HEADER, /**< Transmiter send header and extended header. */ - SENDING_HEADER, /**< Transmiter is in process sending the header and extended header. */ - SEND_PAYLOAD, /**< Transmiter send payload. */ - SENDING_PAYLOAD /**< Transmiter is in process sending payload.*/ + SEND_IDLE, /**< Transmitter idle state.*/ + SEND_HEADER, /**< Transmitter send header. */ + SENDING_HEADER, /**< Transmitter is in process sending header. */ + SEND_EX_HEADER, /**< Transmitter send extended header. */ + SENDING_EX_HEADER, /**< Transmitter is in process sending extended header. */ + SEND_PAYLOAD, /**< Transmitter send payload. */ + SENDING_PAYLOAD /**< Transmitter is in process sending payload.*/ } R15_OutboundState_t; /** @@ -199,7 +201,7 @@ typedef void (*PacketCallBack_t)(Communication_t *Communication_p, const void *D /** Structure for the packet meta data. */ typedef struct PacketMeta { - PacketCallBack_t CallBack_p; /**< Cllback function used after + PacketCallBack_t CallBack_p; /**< Callback function used after sending packet.*/ uint32 Flags; /**< Field is a bit-field. Flags for the Packet state. */ @@ -207,9 +209,9 @@ typedef struct PacketMeta { corresponding buffer used in the packet. */ R15_Header_t Header; /**< Structure of the header. */ - uint32 Resend; /**< Resend counter. */ - Timer_t *Timer_p; /**< Timer data used for - sending/reciving packet. */ + uint32 Resend; /**< Resent counter. */ + Timer_t Timer; /**< Timer data used for + sending/receiving packet. */ uint8 *ExtendedHeader_p; /**< Pointer to the extended header located in the packet. */ uint8 *Payload_p; /**< Pointer to the payload data @@ -232,9 +234,9 @@ typedef struct { uint32 Timeout; /**< Defined timeout for retransmission. */ uint32 TimerKey; /**< Timer identification number.*/ uint32 Key; /**< Generated unique key, used for marking packet for - retransmission or removing from - retransmission list. */ + retransmission or removing from retransmission list. */ PacketMeta_t *Packet_p; /**< Pointer to the packet for retransmission. */ + boolean InUse; /**< Determine if the entry in retransmission list is currently allocated. */ } RetransmissionContext_t; @@ -244,9 +246,9 @@ typedef struct { R15_InboundState_t State; /**< Number of requested data for receiving from communication device. */ uint32 ReqData; - /**< Number of receivied data from communication device. */ + /**< Number of received data from communication device. */ uint32 RecData; - /**< Number of receivied data from backup buffer used for switching the + /**< Number of received data from backup buffer used for switching the * protocol family. */ uint32 RecBackupData; /**< Offset in the buffer for next data that should be received. */ @@ -257,9 +259,9 @@ typedef struct { uint8 Scratch[ALIGNED_HEADER_LENGTH + ALIGNED_BULK_EXTENDED_HEADER_LENGTH]; /** Temporary structure for handling R15 packet.*/ R15_Header_t Header; - /** Poiter to meta data for allocated buffer for handling R15 packet.*/ + /** Pointer to meta data for allocated buffer for handling R15 packet.*/ 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; @@ -283,9 +285,9 @@ typedef struct { /** R15 Network context */ typedef struct { - PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT]; + PacketMeta_t *MetaInfoList[COMMAND_BUFFER_COUNT + BULK_BUFFER_COUNT]; /**< List of meta data for used packets. */ - RetransmissionContext_t *RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; + RetransmissionContext_t RetransmissionList[MAX_SIZE_RETRANSMISSION_LIST]; /**< List of packet for retransmission */ uint32 RetransmissionListCount; /**< Counter for packets retransmission */ diff --git a/source/LcdVersion.cpp b/source/LcdVersion.cpp index f95c525..9e908b0 100644 --- a/source/LcdVersion.cpp +++ b/source/LcdVersion.cpp @@ -18,6 +18,6 @@ * This table contains compatibility information for the versions of LCM. * Current LCM version is defined in file lcm_version.c in LCM code. */ -const char *LCD_LCM_CompatibilityList[] = {"P4Y", +const char *LCD_LCM_CompatibilityList[] = {"P5Y", NULL }; |