summaryrefslogtreecommitdiff
path: root/source/LCM/include/t_protrom_network.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/LCM/include/t_protrom_network.h')
-rw-r--r--source/LCM/include/t_protrom_network.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/source/LCM/include/t_protrom_network.h b/source/LCM/include/t_protrom_network.h
new file mode 100644
index 0000000..c33deac
--- /dev/null
+++ b/source/LCM/include/t_protrom_network.h
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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_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];
+ /** 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_*/