summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macData.h
blob: 2110e04c090fd7b9d8c94e45106bd2439059b1a1 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/**************************************************************************//**
  \file macData.h
  
  \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 
    data primitives.
    
  \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 _MACDATA_H
#define _MACDATA_H

/******************************************************************************
                        Includes section
******************************************************************************/
#include <macAddr.h>
#include <macCommon.h>


/******************************************************************************
                        Defines section
******************************************************************************/


/******************************************************************************
                        Types section
******************************************************************************/
/**
 * \brief MAC data TxOptions.
 * IEEE 802.15.4-2006 Table 41.
*/
typedef enum
{
  MAC_NO_TXOPTION                   = 0x00,
  MAC_ACK_TXOPTION                  = 0x01,
  MAC_GTS_TXOPTION                  = 0x02,
  MAC_INDIRECT_TXOPTION             = 0x04,
  MAC_NO_PANID_COMPRESSION_TXOPTION = 0x08 //It is not from IEEE 802.15.4
} MAC_TxOptions_t;

/**
 * \brief MCPS-DATA confirm primitive's parameters structure declaration.
 * IEEE 802.15.4-2006 7.1.1.2 MCPS-DATA.confirm.
*/
typedef struct
{
  //! The handle associated with the MSDU being confirmed.
  uint8_t       msduHandle;
  //! The status of the last MSDU transmission.
  MAC_Status_t  status;
}  MAC_DataConf_t;

/**
 * \brief MCPS-DATA request primitive's parameters structure declaration.
 * IEEE 802.15.4-2006 7.1.1.1 MCPS-DATA.request.
*/
typedef struct
{
  //! Service field - for internal needs.
  MAC_ServiceTransaction_t service;
  //! The source addressing mode for this primitive and subsequent MPDU.
  MAC_AddrMode_t  srcAddrMode;
  //! The destination addressing mode for this primitive and subsequent MPDU.
  MAC_AddrMode_t  dstAddrMode;
  //! The 16-bit PAN identifier of the entity to which the MSDU is being transferred.
  PanId_t         dstPanId;
  //! The individual device address of the entity to which the MSDU is being transferred.
  MAC_Addr_t      dstAddr;
  //! The number of octets contained in the MSDU to be transmitted by the MAC sublayer entity.
  uint8_t         msduLength;
  //! The set of octets pointer forming the MSDU to be transmitted by the MAC sublayer entity.
  uint8_t         *msdu;
  //! The handle associated with the MSDU to be transmitted by the MAC sublayer entity.
  uint8_t         msduHandle;
  //! The 3 bits indicate the transmission options for this MSDU.
  MAC_TxOptions_t txOptions;
  //! MCPS-DATA confirm callback function's pointer.
  void (*MAC_DataConf)(MAC_DataConf_t *conf);
  //! MCPS-DATA confirm parameters' structure.
  MAC_DataConf_t confirm;
}  MAC_DataReq_t;


/**
 * \brief MCPS-DATA indication primitive's parameters.
 * IEEE 802.15.4-2006 7.1.1.3 MCPS-DATA.indication.
*/
typedef struct
{
  //! The source addressing mode for this primitive corresponding to the received.
  MAC_AddrMode_t srcAddrMode;
  //! The 16-bit PAN identifier of the entity from which the MSDU was received.
  PanId_t        srcPANId;
  //! The individual device address of the entity from which the MSDU was received.
  MAC_Addr_t     srcAddr;
  //! The destination addressing mode for this primitive corresponding to the received MPDU.
  MAC_AddrMode_t dstAddrMode;
  //! The 16-bit PAN identifier of the entity to which the MSDU is being transferred.
  PanId_t        dstPANId;
  //! The individual device address of the entity to which the MSDU is being transferred.
  MAC_Addr_t     dstAddr;
  //! The number of octets contained in the MSDU being indicated by the MAC sublayer entity.
  uint8_t        msduLength;
  //! The set of octets pointer forming the MSDU being indicated by the MAC sublayer entity.
  uint8_t        *msdu;
  //! LQI value measured during reception of the MPDU.
  uint8_t        linkQuality;
  //! The DSN of the received data frame.
  uint8_t        dsn;
  //! RSSI value measured during  reception of the MPDU. Non-standard addition.
  int8_t         rssi;
}  MAC_DataInd_t;


/******************************************************************************
                        Prototypes section
******************************************************************************/
/**************************************************************************//**
  \brief MCPS-DATA request primitive's prototype.
  \param reqParams -  MCPS-DATA request parameters' structure pointer.
  \return none.
******************************************************************************/
void MAC_DataReq(MAC_DataReq_t *reqParams);

/**************************************************************************//**
  \brief MCPS-DATA indication primitive's prototype.
  \param indParams -  MCPS-DATA indication parameters' structure pointer.
  \return none.
******************************************************************************/
extern void MAC_DataInd(MAC_DataInd_t *indParams);

#endif /* _MACDATA_H */

// eof macData.h