summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSuperframe.h
blob: 7203deb5c018403f2e13ac40d2f4d066319f9a48 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**************************************************************************//**
  \file macSuperframe.h
  
  \brief Superframe types' declarations.
  
  \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:     
      18/06/07 ALuzhetsky - Created.
******************************************************************************/

#ifndef _MACSUPERFRAME_H
#define _MACSUPERFRAME_H

/******************************************************************************
                        Include section.
******************************************************************************/
#include <types.h>
#include <bcEndian.h>
#include <macAddr.h>

/******************************************************************************
                        Types section.
******************************************************************************/
//! MAC GTS characteristics. IEEE 802.15.4-2006 Figure 65.
BEGIN_PACK
typedef struct PACK
{
  LITTLE_ENDIAN_OCTET(4, (
    uint8_t    length : 4,
    uint8_t direction : 1,
    uint8_t      type : 1,
    uint8_t  reserved : 2
  ))
}  MAC_GtsCharacteristics_t;
END_PACK

//! Superframe specification. IEEE 802.15.4-2006 Figure 47.
BEGIN_PACK
typedef struct PACK
{
  LITTLE_ENDIAN_OCTET(2, (
    uint16_t beaconOrder       : 4,
    uint16_t superframeOrder   : 4
  ))
  LITTLE_ENDIAN_OCTET(5, (  
    uint16_t finalCapSlot      : 4,
    uint16_t battLifeExt       : 1,
    uint16_t reserved          : 1,
    uint16_t panCoordinator    : 1,
    uint16_t associationPermit : 1
  ))
}  MAC_SuperframeSpec_t;
END_PACK

//! GTS specification field. IEEE 802.15.4-2006 Figure 48.
BEGIN_PACK
typedef struct PACK
{
  LITTLE_ENDIAN_OCTET(3, (
    uint8_t count    : 3,
    uint8_t reserved : 4,
    uint8_t permit   : 1
  ))
}  MAC_GtsSpec_t;
END_PACK

//! GTS descriptor. IEEE 802.15.4-2006  Figure 50.
BEGIN_PACK
typedef struct PACK
{
  ShortAddr_t shortAddr;
  struct
  {
    LITTLE_ENDIAN_OCTET(2, (
      uint8_t startSlot : 4,
      uint8_t length    : 4
    ))
  } gts;
}  MAC_GtsDescr_t;
END_PACK

/******************************************************************************
                        Defines section.
******************************************************************************/
//! Max of GTS.
#define MAC_GTS_MAX 7 

//! MAC GTS direction type. IEEE 802.15.4-2006 7.3.9.2 GTS Characteristics field.
typedef enum
{
  MAC_GTS_DIRECTION_TRANSMIT = 0,
  MAC_GTS_DIRECTION_RECEIVE  = 1
} MAC_GtsDirection_t;

#endif // _MACSUPERFRAME_H

// eof macSuperframe.h