summaryrefslogtreecommitdiff
path: root/lcmodule/source/cnh1605205_ldr_network_layer/include/t_z_network.h
blob: 413587333c8d2798b4df533b5b4e7c3e3357e31b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*******************************************************************************
 * Copyright (C) ST-Ericsson SA 2011
 * License terms: 3-clause BSD license
 ******************************************************************************/
#ifndef T_Z_NETWORK_H_
#define T_Z_NETWORK_H_
/**
 *  @addtogroup ldr_communication_serv
 *  @{
 *    @addtogroup z_family
 *    @{
 *      @addtogroup ldr_z_network_layer
 *      @{
 */

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include "t_communication_service.h"
#include "t_z_header.h"

/*******************************************************************************
 * Types, constants
 ******************************************************************************/

/** Defined state of the receiver */
typedef enum {
    Z_RECEIVE_HEADER,  /**< State for receiving Header.*/
    Z_RECEIVE_PAYLOAD, /**< State for receiving Payload.*/
    Z_RECEIVE_ERROR,   /**< State for error handling.*/
    Z_RECEIVE_IDLE     /**< Receiver idle state.*/
} Z_InboundState_t;

/** Defined state of the transmitter */
typedef enum {
    Z_SEND_IDLE,      /**< Transmiter idle state.*/
    Z_SEND_PACKET,    /**< Transmiter send packet. */
    Z_SENDING_PACKET  /**< Transmiter is in process sending packet.*/
} Z_OutboundState_t;

/** Structure for handling incoming Z packets.*/
typedef struct {
    /**< State of the state machine for handling incoming Z packets. */
    Z_InboundState_t  State;
    /**< Number of requested data for receiving from communication device. */
    uint32            ReqData;
    /**< Number of receivied data from communication device. */
    uint32            RecData;
    /**< Temporary pointer to buffer for handling received data.*/
    uint8             *Target_p;
    /** Number of packets before receiver is stoped. */
    uint8             PacketsBeforeReceiverStop;
    /** Indicator for stopping the receiver. */
    boolean           StopTransfer;
    /**< Temporary buffer for receiving data. */
    uint8             Scratch[Z_HEADER_LENGTH];
} Z_Inbound_t;

/** Structure for handling outgoing Z packets.*/
typedef struct {
    /**< State of the state machine for handling outgoing Z packets. */
    Z_OutboundState_t State;
    /**< Boolean value for controling re-entry in transmiter fucntion. */
    boolean           InLoad;
} Z_Outbound_t;


/** Z Network context */
typedef struct {
    /**< Structure for handling incoming Z packets.*/
    Z_Inbound_t         Inbound;
    /**< Structure for handling outgoing Z packets.*/
    Z_Outbound_t        Outbound;
} Z_NetworkContext_t;

/** @} */
/** @} */
/** @} */
#endif /*T_Z_LAYER_H_*/