summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/NWK/include/private/nwkLoopback.h
blob: 91710e26d925f1d88d7d2084f3a339136b5eb2d0 (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
80
81
82
83
84
85
86
87
/**************************************************************************//**
  \file nwkLoopback.h

  \brief Interface of network loopback.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
   History:
    2009-10-06 Max Gekk - Created.
   Last change:
    $Id: nwkLoopback.h 17923 2011-07-08 14:13:30Z mgekk $
 ******************************************************************************/
#if !defined _NWK_LOOPBACK_H
#define _NWK_LOOPBACK_H

/******************************************************************************
                               Includes section
 ******************************************************************************/
#include <nwkConfig.h>
#include <queue.h>
#include <nldeData.h>

/******************************************************************************
                                Types section
 ******************************************************************************/
/** Internal states of the loopback component. */
typedef enum _NwkLoopbackState_t
{
  NWK_LOOPBACK_UNKNOWN_STATE = 0x00,
  NWK_LOOPBACK_FIRST_STATE = 0x8e,
  NWK_LOOPBACK_IDLE_STATE = NWK_LOOPBACK_FIRST_STATE,
  NWK_LOOPBACK_REQUEST_PROCESSING_STATE = 0x8f,
  NWK_LOOPBACK_WAIT_PACKET_STATE = 0x90,
  NWK_LOOPBACK_LAST_STATE
} NwkLoopbackState_t;

/** Internal parameters of the loopback component. */
typedef struct _NwkLoopback_t
{
  QueueDescriptor_t queue; /**< Queue of requests from upper layer */
  NwkLoopbackState_t state; /**< Finite-state machine */
} NwkLoopback_t;

/******************************************************************************
                               Prototypes section
 ******************************************************************************/

/**************************************************************************//**
  \brief The main task handler of the network loopback component.
 ******************************************************************************/
NWK_PRIVATE void nwkLoopbackTaskHandler(void);

/**************************************************************************//**
  \brief Handler of free packet indication.
 ******************************************************************************/
NWK_PRIVATE void nwkLoopbackFreePacketInd(void);

/**************************************************************************//**
  \brief Reset the network loopback component.
 ******************************************************************************/
NWK_PRIVATE void nwkResetLoopback(void);

/******************************************************************************
  \brief nwkLoopback idle checking.

  \return true, if nwkLoopback performs no activity, false - otherwise.
 ******************************************************************************/
NWK_PRIVATE bool nwkLoopbackIsIdle(void);

/**************************************************************************//**
  \brief Checks, if outgoing packet should be indicated to the next upper layer.

  \param[in] req - pointer to NLDE-DATA.request parameter's structure.

  \return True, if indication required, false - otherwise
 ******************************************************************************/
NWK_PRIVATE bool nwkLoopbackRequired(const NWK_DataReq_t *const req);

#endif /* _NWK_LOOPBACK_H */
/** nwkLoopback.h */