summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h
blob: 1c897c1a6715f3392f89fd81df5804761f8e1b83 (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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/******************************************************************************
  \file machwiManager.h

  \brief Main MAC layer requests' manager header file.

  \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:
      15/06/07 ALuzhetsky - Created.
******************************************************************************/

#ifndef _MACHWIMANAGER_H
#define _MACHWIMANAGER_H

/******************************************************************************
                        Includes  section.
******************************************************************************/
#include <macAssociate.h>
#include <macOrphan.h>
#include <macCommStatus.h>
#include <macData.h>
#include <macAssociate.h>
#include <macDisassociate.h>
#include <macPoll.h>
#include <macPurge.h>
#include <macReset.h>
#include <macRxEnable.h>
#include <macStart.h>
#include <macScan.h>
#include <macSync.h>
#include <macSetGet.h>

/******************************************************************************
                        Types section.
******************************************************************************/
/******************************************************************************
  Status of current operation which could be returned from particular handler.
******************************************************************************/
typedef enum
{
  MACHWI_SUCCESS_HNDLR_RESULT,
  MACHWI_IN_PROGRESS_HNDLR_RESULT,
} MachwiHandlerResult_t;

/******************************************************************************
  Possible states of machwiManager.
******************************************************************************/
typedef enum // machwiManager possible states.
{
  MACHWI_IDLE_STATE,
  MACHWI_SET_REQ_STATE,
  MACHWI_GET_REQ_STATE,
  MACHWI_HARD_RESET_REQ_STATE,
  MACHWI_SOFT_RESET_REQ_STATE,
  MACHWI_SCAN_REQ_STATE,
#ifdef _FFD_
  MACHWI_START_REQ_STATE,
#endif //_FFD_
  MACHWI_ASSOCIATE_REQ_STATE,
#ifdef _FFD_
  MACHWI_ASSOCIATE_RESP_STATE,
#endif //_FFD_
  MACHWI_DISASSOCIATE_REQ_STATE,
  MACHWI_RX_ENABLE_REQ_STATE,
#ifdef _FFD_
  MACHWI_ORPHAN_RESP_STATE,
#endif //_FFD_
  MACHWI_POLL_REQ_STATE,
  MACHWI_DATA_REQ_STATE,
#ifdef _FFD_
  MACHWI_PURGE_REQ_STATE,
#endif //_FFD_
  MACHWI_TRANSACTION_TX_STATE,
  MACHWI_BEACON_TX_STATE,
} MachwiState_t;

/******************************************************************************
  Types of possible requests to MAC_HWI.
******************************************************************************/
typedef enum  // machwi possible requests' types.
{
  MACHWI_SET_REQ_ID            = MACHWI_SET_REQ_STATE,
  MACHWI_GET_REQ_ID            = MACHWI_GET_REQ_STATE,
  MACHWI_HARD_RESET_REQ_ID     = MACHWI_HARD_RESET_REQ_STATE,
  MACHWI_SOFT_RESET_REQ_ID     = MACHWI_SOFT_RESET_REQ_STATE,
  MACHWI_SCAN_REQ_ID           = MACHWI_SCAN_REQ_STATE,
#ifdef _FFD_
  MACHWI_START_REQ_ID          = MACHWI_START_REQ_STATE,
#endif //_FFD_
  MACHWI_ASSOCIATE_REQ_ID      = MACHWI_ASSOCIATE_REQ_STATE,
#ifdef _FFD_
  MACHWI_ASSOCIATE_RESP_ID     = MACHWI_ASSOCIATE_RESP_STATE,
#endif //_FFD_
  MACHWI_DISASSOCIATE_REQ_ID   = MACHWI_DISASSOCIATE_REQ_STATE,
  MACHWI_RX_ENABLE_REQ_ID      = MACHWI_RX_ENABLE_REQ_STATE,
#ifdef _FFD_
  MACHWI_ORPHAN_RESP_ID        = MACHWI_ORPHAN_RESP_STATE,
#endif //_FFD_
  MACHWI_POLL_REQ_ID           = MACHWI_POLL_REQ_STATE,
  MACHWI_DATA_REQ_ID           = MACHWI_DATA_REQ_STATE,
#ifdef _FFD_
  MACHWI_PURGE_REQ_ID          = MACHWI_PURGE_REQ_STATE,
#endif //_FFD_
  MACHWI_TRANSACTION_TX_REQ_ID = MACHWI_TRANSACTION_TX_STATE,
  MACHWI_BEACON_TX_REQ_ID      = MACHWI_BEACON_TX_STATE,
} MachwiRequestId_t;

/******************************************************************************
  Types of possible postponed MAC_HWI actions.
******************************************************************************/
typedef enum
{
  MAC_HWI_POSTPONED_ACTION_TRANSACTION_TX = (1 << 0),
  MAC_HWI_POSTPONED_ACTION_BEACON_TX      = (1 << 1),
} MachwiPostponedAction_t;

/******************************************************************************
                        Prototypes section.
******************************************************************************/
/******************************************************************************
  Main system entry point.
  Parameters:
    none.
  returns:
    none.
******************************************************************************/
void MAC_HWI_TaskHandler(void);

/******************************************************************************
 Sends confirmation to the upper layer.
 Parameters:
   request - parameters of the request to be confirmed.
 Returns:
   none.
******************************************************************************/
void machwiSendConfToUpperLayer(void *request);

#ifdef _FFD_
/******************************************************************************
  Sends MAC_AssociteInd to the upper layer.
  Parameters:
    associateInd - associate indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendAssociateInd(MAC_AssociateInd_t *associateInd);
#endif //_FFD_

/******************************************************************************
  Sends MAC_DataInd to the upper layer.
  Parameters:
    dataInd - data indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendDataInd(MAC_DataInd_t *dataInd);

/******************************************************************************
  Sends MAC_DisassociteInd to the upper layer.
  Parameters:
    disassociateInd - disassociate indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendDisassociateInd(MAC_DisassociateInd_t *disassociateInd);

/******************************************************************************
  Sends MAC_BeaconNotifyInd to the upper layer.
  Parameters:
    beaconInd - beacon notify indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendBeaconNotifyInd(MAC_BeaconNotifyInd_t *beaconInd);

/******************************************************************************
  Sends MAC_SyncLossInd to the upper layer.
  Parameters:
    lossInd - sync loss notify indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendSyncLossNotifyInd(MAC_SyncLossInd_t *syncLoss);

#ifdef _FFD_
/******************************************************************************
  Sends MAC_OrphanInd to the upper layer.
  Parameters:
    orphanInd - orphan indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendOrphanInd(MAC_OrphanInd_t *orphanInd);

/******************************************************************************
  Sends MAC_PollInd to the upper layer.
  Parameters:
    pollInd - poll indication descriptor.
  Returnes:
    none.
******************************************************************************/
void machwiSendPollInd(MAC_PollInd_t *pollInd);

/******************************************************************************
  \brief initiates transaction transmission if MAC is in IDLE state. If state
    is not IDLE - postpones operation.
******************************************************************************/
void machwiTxTransactionReq(void);

/******************************************************************************
  \brief initiates beacon transmission if MAC is in IDLE state. If state
    is not IDLE - postpones operation.
******************************************************************************/
void machwiTxBeaconReq(void);

/**************************************************************************//**
  \brief Checks if there are any active transactions on MAC layer.

  \return true, if there are any active transactions on MAC layer,
          false - otherwise
 ******************************************************************************/
bool MAC_IsActiveTransaction(void);

#endif //_FFD_

#endif //_MACHWIMANAGER_H

// eof machwiManager.h