diff options
Diffstat (limited to 'lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h')
-rw-r--r-- | lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h | 103 |
1 files changed, 103 insertions, 0 deletions
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 new file mode 100644 index 0000000..fa5402f --- /dev/null +++ b/lcmodule/source/cnh1605205_ldr_network_layer/include/t_protrom_network.h @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license + ******************************************************************************/ +#ifndef T_PROTROM_NETWORK_H_ +#define T_PROTROM_NETWORK_H_ +/** + * @addtogroup ldr_communication_serv + * @{ + * @addtogroup protrom_family + * @{ + * @addtogroup ldr_protrom_network_layer + * @{ + */ + +/******************************************************************************* + * Includes + ******************************************************************************/ +#include "t_communication_service.h" +#include "t_protrom_header.h" + +/******************************************************************************* + * Types, constants + ******************************************************************************/ + +/** PROTROM protocol ID */ +#define PROTROM_PROTOCOL (0xFB) +/** PROTROM CRC length */ +#define PROTROM_CRC_LENGTH (2) + +/** Defined state of the receiver */ +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_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_OutboundState_t; + +/** Structure for the packet meta data type. */ +typedef struct Protrom_Packet { + Protrom_Header_t Header; /**< PROTROM header structure. */ + 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 */ +} Protrom_Packet_t; + +/** Structure for handling incoming PROTROM packets.*/ +typedef struct { + /**< State of the state machine for handling incoming PROTROM packets. */ + Protrom_InboundState_t State; + /**< Number of requested data for receiving from communication device. */ + uint32 ReqData; + /**< Number of receivied data from communication device. */ + uint32 RecData; + /**< Number of receivied data from backup buffer used for switching the + * protocol family. */ + uint32 RecBackupData; + /**< Offset in the buffer for next data that should be received. */ + uint32 ReqBuffOffset; + /**< Temporary pointer to buffer for handling received data.*/ + 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; + +/** Structure for handling outgoing PROTROM packets.*/ +typedef struct { + /**< State of the state machine for handling outgoing PROTROM packets. */ + 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; +} Protrom_Outbound_t; + + +/** PROTROM Network context */ +typedef struct { + /**< Structure for handling incoming PROTROM packets.*/ + Protrom_Inbound_t Inbound; + /**< Structure for handling outgoing PROTROM packets.*/ + Protrom_Outbound_t Outbound; +} Protrom_NetworkContext_t; + +/** @} */ +/** @} */ +/** @} */ +#endif /*T_NETWORK_LAYER_H_*/ |