From c9d1f9613e3ac18d5dd3b9432646e289bb88cec9 Mon Sep 17 00:00:00 2001 From: xmarvla Date: Wed, 15 Jun 2011 14:03:08 +0200 Subject: Add support for M730 Platform Added new command: System_StartCommRelay (For M730 platform). New state machine in Protrom Network Transmitter Handler. Small changes in Z protocol due to implementation of Communication Relay in Hassium Loaders. Add implementation for CriticalSection synchronization mechanism. ST-Ericsson ID: 325251 ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204 Depends-On: I0d34a2c4504a2b52ff5ab5efd2da36d8d1fa9816 Change-Id: I0d34a2c4504a2b52ff5ab5efd2da36d8d1fa9816 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/20944 Reviewed-by: QATOOLS Reviewed-by: Vlatko PISTOLOV Tested-by: Vlatko PISTOLOV --- source/LCM/include/c_compiler.h | 19 ++++++++----------- source/LCM/include/c_system.h | 4 ++-- source/LCM/include/t_basicdefinitions.h | 2 +- source/LCM/include/t_communication_service.h | 14 ++++++++------ source/LCM/include/t_critical_section.h | 27 +++++++++++++++++++++++++++ source/LCM/include/t_protrom_network.h | 18 +++++++++++++----- source/LCM/include/t_r15_header.h | 3 +-- source/LCM/include/t_r15_network_layer.h | 16 +++++++++++----- source/LCM/include/t_time_utilities.h | 2 ++ 9 files changed, 73 insertions(+), 32 deletions(-) create mode 100755 source/LCM/include/t_critical_section.h (limited to 'source/LCM') diff --git a/source/LCM/include/c_compiler.h b/source/LCM/include/c_compiler.h index 77cd673..90799b1 100644 --- a/source/LCM/include/c_compiler.h +++ b/source/LCM/include/c_compiler.h @@ -4,7 +4,6 @@ * License terms: 3-clause BSD license * ******************************************************************************/ - #ifndef _C_COMPILER_H #define _C_COMPILER_H @@ -25,14 +24,7 @@ * * REVISION HISTORY: * -* $Log: \KIRND_FuncBlocks_Utilities_003\cnh1606432\dependencies\Utils\c_compiler.h $ - * - * Version: ...\cnh1606432\cnh1606432_r1\7 18 Nov 2009 10:18 (GMT) qsjomik - * Overwrite merge. - * Compiled with _INTERCEPTCALLBACKS pre-compiler directive. - * Stability, Multi-Dut and storing BufferVector updates. - * Updated for LCM R1B. - * R1A027. +* $Log: \LD_FuncBlocks_012\cnh160692_exec_pltf_srv_swbp\inc\c_compiler.h $ * * Version: ...\cnh160692_r1a_dev\3 12 Mar 2002 14:21 (GMT) QCSSTZI * rename p_compiler to c_compiler. @@ -89,10 +81,15 @@ #define COMPILER_ARM_ARM /* Preferred */ #define COMPILER_ARM #define ARM +#elif defined(__GNUC__) +#ifdef __arm__ +#define COMPILER_GCC_ARM +#elif defined(__linux__) +/* TARGET IS LINUX */ +#define COMPILER_GCC +#endif #elif defined(__IAR_SYSTEMS_ASM__) #elif defined(_lint) -#elif defined(__GNUC__) -#define COMPILER_GNUC #else #error Unknown compiler #endif diff --git a/source/LCM/include/c_system.h b/source/LCM/include/c_system.h index 0b058ec..fe65751 100644 --- a/source/LCM/include/c_system.h +++ b/source/LCM/include/c_system.h @@ -2,8 +2,8 @@ #define INCLUSION_GUARD_C_SYSTEM_H /************************************************************************* - * Copyright (C) ST-Ericsson SA 2011 - * License terms: 3-clause BSD license +* Copyright (C) ST-Ericsson SA 2011 +* License terms: 3-clause BSD license ************************************************************************** * * DESCRIPTION: diff --git a/source/LCM/include/t_basicdefinitions.h b/source/LCM/include/t_basicdefinitions.h index 4d5b0ee..038971d 100644 --- a/source/LCM/include/t_basicdefinitions.h +++ b/source/LCM/include/t_basicdefinitions.h @@ -178,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_GNUC) +#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/LCM/include/t_communication_service.h b/source/LCM/include/t_communication_service.h index 74e72a9..3b686cc 100644 --- a/source/LCM/include/t_communication_service.h +++ b/source/LCM/include/t_communication_service.h @@ -325,18 +325,20 @@ typedef struct { /** Structure for initialization and manipulation of protocol family */ typedef struct FamilyDescriptor_s { - ErrorCode_e(*FamilyInit_fn)(Communication_t *Communication_p); /**< Pointer to Interface function for protocol family initialization. */ - ErrorCode_e(*FamilyShutdown_fn)(Communication_t *Communication_p); + ErrorCode_e(*FamilyInit_fn)(Communication_t *Communication_p); /**< Pointer to Interface function for protocol family de-initialization. */ - ErrorCode_e(*Process_fn)(Communication_t *Communication_p); + ErrorCode_e(*FamilyShutdown_fn)(Communication_t *Communication_p); /**< Pointer to Pooling function in curren protocol family. */ - ErrorCode_e(*Send_fn)(Communication_t *Communication_p, void *InputData_p); + ErrorCode_e(*Process_fn)(Communication_t *Communication_p); /**< Pointer to function for sending packets.*/ - ErrorCode_e(*SetProtocolTimeouts_fn)(Communication_t *Communication_p, void *TimeoutData_p); + ErrorCode_e(*Send_fn)(Communication_t *Communication_p, void *InputData_p); /**< Pointer to function for setting communication timeouts for current protocol family. */ - ErrorCode_e(*GetProtocolTimeouts_fn)(Communication_t *Communication_p, void *TimeoutData_p); + 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. */ + ErrorCode_e(*CancelReceiver_fn)(Communication_t *Communication_p, uint8 PacketsBeforeTransferStop); } FamilyDescriptor_t; /** @} */ diff --git a/source/LCM/include/t_critical_section.h b/source/LCM/include/t_critical_section.h new file mode 100755 index 0000000..17e4ff7 --- /dev/null +++ b/source/LCM/include/t_critical_section.h @@ -0,0 +1,27 @@ +/******************************************************************************* + * $Copyright ST-Ericsson 2011 $ + ******************************************************************************/ +#ifndef _T_CRITITCAL_SECTION_H_ +#define _T_CRITITCAL_SECTION_H_ + +/** + * @addtogroup ldr_utilities + * @{ + * @addtogroup critical_section + * @{ + */ + +/******************************************************************************* + * Includes + ******************************************************************************/ +#include "t_basicdefinitions.h" + +/******************************************************************************* + * Types, constants + ******************************************************************************/ +/** Critical Section abstract type definition */ +typedef void* CriticalSection_t; + +/** @} */ +/** @} */ +#endif /*_T_CRITITCAL_SECTION_H_*/ diff --git a/source/LCM/include/t_protrom_network.h b/source/LCM/include/t_protrom_network.h index c33deac..955b589 100644 --- a/source/LCM/include/t_protrom_network.h +++ b/source/LCM/include/t_protrom_network.h @@ -17,6 +17,7 @@ * Includes ******************************************************************************/ #include "t_communication_service.h" +#include "t_critical_section.h" #include "t_protrom_header.h" /******************************************************************************* @@ -32,14 +33,17 @@ 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_ERROR, /**< State for error handling.*/ + PROTROM_RECEIVE_IDLE /**< State for receiver idele.*/ } Protrom_InboundState_t; /** Defined state of the transmitter */ typedef enum { PROTROM_SEND_IDLE, /**< Transmiter idle state.*/ - PROTROM_SEND_PACKET, /**< Transmiter send packet. */ - PROTROM_SENDING_PACKET /**< Transmiter is in process sending packet.*/ + 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_OutboundState_t; /** Structure for the packet meta data type. */ @@ -69,6 +73,10 @@ typedef struct { uint8 *Target_p; /**< Temporary buffer for receiving data. */ uint8 Scratch[PROTROM_HEADER_LENGTH]; + /** Number of packets before receiver is stoped. */ + uint8 PacketsBeforeReceiverStop; + /** Indicator for stopping the receiver. */ + boolean StopTransfer; /** Temporary structure for handling PROTROM packet.*/ Protrom_Packet_t *Packet_p; } Protrom_Inbound_t; @@ -79,8 +87,8 @@ typedef struct { Protrom_OutboundState_t State; /** Temporary pointer for handling PROTROM packet.*/ Protrom_Packet_t *Packet_p; - /**< Boolean value for controling re-entry in transmiter fucntion. */ - boolean InLoad; + /**< Synchronization object to avoid parallel access in transmitter function. */ + CriticalSection_t TxCriticalSection; } Protrom_Outbound_t; diff --git a/source/LCM/include/t_r15_header.h b/source/LCM/include/t_r15_header.h index 55b717b..f102912 100644 --- a/source/LCM/include/t_r15_header.h +++ b/source/LCM/include/t_r15_header.h @@ -17,7 +17,6 @@ * Includes ******************************************************************************/ #include "t_basicdefinitions.h" -#include "command_ids.h" /******************************************************************************* * Types, constants @@ -81,7 +80,7 @@ typedef struct { typedef struct { uint16 SessionState; /**< Session and state for command header */ uint8 Command; /**< Specified command */ - GroupId_e CommandGroup; /**< Specified command group */ + uint8 CommandGroup; /**< Specified command group */ } CommandExtendedHeader_t; /** diff --git a/source/LCM/include/t_r15_network_layer.h b/source/LCM/include/t_r15_network_layer.h index c99d073..5e78ddd 100644 --- a/source/LCM/include/t_r15_network_layer.h +++ b/source/LCM/include/t_r15_network_layer.h @@ -16,6 +16,7 @@ * Includes ******************************************************************************/ #include "t_communication_service.h" +#include "t_critical_section.h" #include "t_r15_header.h" #include "t_time_utilities.h" @@ -55,9 +56,9 @@ #else /** Acknowledge packet time(mS) out value */ -#define ACK_TIMEOUT_IN_MS (1000) +#define ACK_TIMEOUT_IN_MS (5000) /** Default time(mS) out for receiving bulk command */ -#define BULK_COMMAND_RECEIVING_TIMEOUT (1000) +#define BULK_COMMAND_RECEIVING_TIMEOUT (5000) /** Default time(mS) out for receiving bulk data. This value is set for UART on 115200kbps! */ #define BULK_DATA_RECEIVING_TIMEOUT (120000) #endif @@ -151,7 +152,8 @@ typedef enum { RECEIVE_HEADER, /**< State for receiving Header.*/ RECEIVE_EXTENDED_HEADER, /**< State for receiving Extended Header.*/ RECEIVE_PAYLOAD, /**< State for receiving Payload.*/ - RECEIVE_ERROR /**< State for error handling.*/ + RECEIVE_ERROR, /**< State for error handling.*/ + RECEIVE_IDLE /**< State for receiver idle.*/ } R15_InboundState_t; /** Defined state of the transmitter */ @@ -257,6 +259,10 @@ typedef struct { R15_Header_t Header; /** Poiter to meta data for allocated buffer for handling R15 packet.*/ PacketMeta_t *Packet_p; + /** Number of packets before receiver is stoped. */ + uint8 PacketsBeforeReceiverStop; + /** Indicator for stopping the receiver. */ + boolean StopTransfer; /** Error flag, purposed for error handling.*/ ErrorCode_e LCM_Error; } R15_Inbound_t; @@ -268,8 +274,8 @@ typedef struct { R15_OutboundState_t State; /** Temporary pointer for handling PROTROM packet.*/ PacketMeta_t *Packet_p; - /**< Boolean value for controling re-entry in transmiter fucntion. */ - boolean InLoad; + /**< Synchronization object to avoid parallel access in transmitter function. */ + CriticalSection_t TxCriticalSection; /** Error flag, purposed for error handling.*/ ErrorCode_e LCM_Error; } R15_Outbound_t; diff --git a/source/LCM/include/t_time_utilities.h b/source/LCM/include/t_time_utilities.h index bcc8254..5346679 100644 --- a/source/LCM/include/t_time_utilities.h +++ b/source/LCM/include/t_time_utilities.h @@ -28,6 +28,8 @@ typedef struct { HandleFunction_t HandleFunction_p; /**< Callback function*/ void *Data_p; /**< Pointer to data. */ void *Param_p; /**< Extra parameters. */ + uint32 Set_Time; /**< Used for debugging purposes only. */ + uint32 Set_System_Time; /**< Used for debugging purposes only. */ } Timer_t; /** -- cgit v1.2.3