summaryrefslogtreecommitdiff
path: root/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI
diff options
context:
space:
mode:
authorFlorent Duchon2012-12-26 17:36:00 +0100
committerFlorent Duchon2013-02-13 21:21:12 +0100
commitb24866225a6301d3a663f874725e83c012dc25d3 (patch)
treeca527a2aab9abcdfbaf244c53ca63f0c531892b0 /digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI
parent2ba279f4eb2f23fa08a7c13465d16ae6ba5d0f96 (diff)
digital/beacon: add bitcloud stack into common directory digital/zigbit
Diffstat (limited to 'digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI')
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiAssociateHandler.h101
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h50
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDataHandler.h65
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDisassociateHandler.h98
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h48
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h234
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMem.h82
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMemAccess.h88
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h61
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanIdConflictHandler.h41
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanServer.h67
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPollHandler.h82
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h58
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiResetHandler.h41
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiRxEnableHandler.h50
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiScanHandler.h97
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h50
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiStartHandler.h69
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h113
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionHandler.h85
-rw-r--r--digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h123
21 files changed, 1703 insertions, 0 deletions
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiAssociateHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiAssociateHandler.h
new file mode 100644
index 00000000..85c733e6
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiAssociateHandler.h
@@ -0,0 +1,101 @@
+/******************************************************************************
+ \file machwiAssociateHandler.h
+
+ \brief machwiAssociateHandler 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 _MACHWIASSOCIATEHANDLER_H
+#define _MACHWIASSOCIATEHANDLER_H
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <machwiManager.h>
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef enum
+{
+ MACHWI_IDLE_ASSOCIATE_STATE,
+ MACHWI_SET_CHANNEL_ASSOCIATE_STATE,
+ MACHWI_SET_PAGE_ASSOCIATE_STATE,
+ MACHWI_SET_COORD_PAN_ID_ASSOCIATE_STATE,
+ MACHWI_SET_SHORT_ADDR_ASSOCIATE_STATE,
+ MACHWI_CLR_RX_ON_WHEN_IDLE_ASSOCIATE_STATE,
+ MACHWI_TX_ASSOCIATE_REQUEST_ASSOCIATE_STATE,
+ MACHWI_WAIT_TX_DATA_REQUEST_ASSOCIATE_STATE,
+ MACHWI_TX_DATA_REQUEST_ASSOCIATE_STATE,
+ MACHWI_WAIT_ASSOCIATE_RESP_FRAME_ASSOCIATE_STATE,
+ MACHWI_SET_TRX_OFF_ASSOCIATE_STATE,
+} MachwiAssociateState_t;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Checks associate request parameters, sends associate and data request commands.
+ Waits for the responce.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiAssociateReqHandler(void);
+
+#ifdef _FFD_
+/******************************************************************************
+ Checks associate responce parameters, and puts the responce to the transaction
+ queue.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiAssociateRespHandler(void);
+#endif //_FFD_
+
+/******************************************************************************
+ Indicates, that associate response command frame was received.
+ Parameters:
+ associateRespDescr - associate response command frame description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiAssociateRespInd(MAC_FrameDescr_t *associateRespDescr);
+
+#ifdef _FFD_
+/******************************************************************************
+ Indicates, that associate request command frame was received.
+ Parameters:
+ associateReqDescr - associate request command frame description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiAssociateReqInd(MAC_FrameDescr_t *associateReqDescr);
+#endif //_FFD_
+
+/******************************************************************************
+ Resets associate handler.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetAssociateHandler(void);
+
+
+#endif /* _MACHWIASSOCIATEHANDLER_H */
+
+// eof machwiAssociateHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h
new file mode 100644
index 00000000..3f2372d1
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ \file machwiBeaconHandler.h
+
+ \brief Declares beacon routine functions.
+
+ \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).
+
+ \intrenal
+ History:
+ 01/07/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIBEACONHANDLER_H
+#define _MACHWIBEACONHANDLER_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <types.h>
+#include <macFrame.h>
+
+/******************************************************************************
+ Global variables.
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+
+/******************************************************************************
+ Implementations section.
+******************************************************************************/
+/**************************************************************************//**
+ \brief Forms and sends MAC Beacon frame.
+
+ \param none.
+ \return none.
+******************************************************************************/
+void machwiSendBeacon(void);
+
+#endif // _FFD_
+#endif //_MACHWIBEACONHANDLER_H
+
+// eof machwiBeaconHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDataHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDataHandler.h
new file mode 100644
index 00000000..76b69564
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDataHandler.h
@@ -0,0 +1,65 @@
+/******************************************************************************
+ \file machwiDataHandler.h
+
+ \brief machwiDataHandler 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 _MACHWIDATAHANDLER_H
+#define _MACHWIDATAHANDLER_H
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <machwd.h>
+#include <machwiManager.h>
+#include <macCommon.h>
+#include <macData.h>
+
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Checks data request parameters, fills frame descriptor and passes request
+ further.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiDataReqHandler(void);
+
+/******************************************************************************
+ Converts hwd data transmission status to IEEE802.15.4 status.
+ Parameters:
+ status - hwd data transmission status.
+ Returns:
+ IEEE802.15.4 data transmission status.
+******************************************************************************/
+MAC_Status_t machwiConvertmachwdDataConfirmTypes(MACHWD_DataStatus_t hwdStatus);
+
+/******************************************************************************
+ Fiils data frame fields.
+ Parameters:
+ frameDescr - pointer to frme descriptor to be filled.
+ dataReq - pointer to data request params.
+ Returns:
+ none.
+******************************************************************************/
+void machwiPrepareDataFrame(MAC_FrameDescr_t *frameDescr, MAC_DataReq_t *dataReq);
+
+
+#endif /* _MACHWIDATAHANDLER_H */
+
+// eof machwiDataHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDisassociateHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDisassociateHandler.h
new file mode 100644
index 00000000..fa04e5c7
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDisassociateHandler.h
@@ -0,0 +1,98 @@
+/******************************************************************************
+ \file machwiDisassociate.h
+
+ \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:
+ 14/08/07 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWIDISASSOCIATE_H
+#define _MACHWIDISASSOCIATE_H
+#ifdef _MAC_DISASSOCIATE_
+
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <macFrame.h>
+#include <macDisassociate.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef enum
+{
+ MACHWI_IDLE_DISASSOCIATE_STATE,
+ MACHWI_SET_PAN_ID_DISASSOCIATE_STATE,
+ MACHWI_SET_SHORT_ADDR_DISASSOCIATE_STATE,
+} MachwiDisassociateState_t;
+
+/******************************************************************************
+ Constants section
+******************************************************************************/
+
+/******************************************************************************
+ External variables
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Resets disassociate component.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetDisassociateHandler(void);
+
+/******************************************************************************
+ Checks disassociation request parameters, sends disassociation notification
+ command.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiDisassociateReqHandler(void);
+
+/******************************************************************************
+ Sets disassociation notification command fields.
+ Parameters:
+ frameDescr - pointer to frame descriptor which will be set.
+ disassociateReq - pointer to disassociation notification command
+ parameters.
+ Returns:
+ none.
+******************************************************************************/
+void machwiPrepareDisassociateNotifCmdFrame(
+ MAC_FrameDescr_t *frameDescr,
+ MAC_DisassociateReq_t *disassociateReq);
+
+/******************************************************************************
+ Indicates, that disassociation notification command frame was received.
+ Parameters:
+ frameDescr - frame description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiDisassociateNotifInd(MAC_FrameDescr_t *frameDescr);
+
+#endif // _MAC_DISASSOCIATE_
+
+#endif /* _MACHWIDISASSOCIATE_H */
+
+// eof machwiDisassociate.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h
new file mode 100644
index 00000000..4f3c9a22
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h
@@ -0,0 +1,48 @@
+/******************************************************************************
+ \file machwiHwdReqMemPool.h
+
+ \brief Types and constants declaration for machwi memory management for machwd
+ requests.
+
+ \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:
+ 19/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIHWDREQMEMPOOL_H
+#define _MACHWIHWDREQMEMPOOL_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+#include <machwd.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+/******************************************************************************
+ Union of possible request types for the requests to machwd module.
+******************************************************************************/
+typedef union
+{
+ MACHWD_DataReq_t data;
+ MACHWD_SetTrxStateReq_t setTrxState;
+ MACHWD_SetReq_t set;
+ MACHWD_EdReq_t ed;
+} MachwiHwdReqDescr_t;
+
+#endif //_MACHWIHWDREQMEMPOOL_H
+
+// eof machwiHwdReqMemPool.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h
new file mode 100644
index 00000000..1c897c1a
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h
@@ -0,0 +1,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
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMem.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMem.h
new file mode 100644
index 00000000..37d519ab
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMem.h
@@ -0,0 +1,82 @@
+/******************************************************************************
+ \file machwiMem.h
+
+ \brief MACHWI variable's memory description.
+
+ \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:
+ 03/11/07 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWIMEM_H
+#define _MACHWIMEM_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <queue.h>
+#include <bcTimer.h>
+#include <machwiManager.h>
+#include <machwiHwdReqMemPool.h>
+#include <machwiAssociateHandler.h>
+#include <machwiDisassociateHandler.h>
+#include <machwiScanHandler.h>
+#include <machwiStartHandler.h>
+#include <machwiTransactionHandler.h>
+#include <machwiPollHandler.h>
+#include <macBanNode.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef struct
+{
+ union
+ {
+ MachwiAssociateState_t assoc;
+#ifdef _MAC_DISASSOCIATE_
+ MachwiDisassociateState_t disassoc;
+#endif // _MAC_DISASSOCIATE_
+ MachwiScanState_t scan;
+#ifdef _FFD_
+ MachwiStartState_t start;
+#endif // _FFD_
+ } state;
+ MachwiState_t managerState; // For the manager needs.
+ MachwiPollHandlerState_t pollState; // For the poll handler needs.
+ void *machwiReq; // Used by all modules which need to save requests' parameters.
+ Timer_t comAppTimer; // Used by all modules except machwiTransactionQueue.
+ QueueDescriptor_t reqQueueDescr;
+ bool txCoordRealigCmd; // For the start handler needs.
+ MAC_DisassociateInd_t disassociateInd; // For the disassociate handler needs.
+ MachwiHwdReqDescr_t machwdReq;
+#ifdef _FFD_
+ QueueDescriptor_t transactionQueueDescr; // For the transaction queue needs - transaction queue descriptor.
+ Timer_t transTimer; // For the transaction queue needs - transaction queue timer.
+ MachwiTransactionHandlerState_t transactionHandlerState; // For the transaction handler needs.
+ uint8_t activatedTransactionsCounter;
+ MachwiTransaction_t *currentTransaction;
+#endif //_FFD_
+ bool switchIsLocked; // For the switching Rx Control needs.
+ void (*sendSwitchConfirm)(void);
+ uint8_t nextChannel; // For the scan handler needs.
+ uint8_t postponedAction; // MAC postponed actions bit field.
+#ifdef _MAC_BAN_NODE_
+ MAC_BanTable_t banTable;
+#endif /* _MAC_BAN_NODE_ */
+} MachwiMem_t;
+
+#endif /* _MACHWIMEM_H */
+
+// eof machwiMem.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMemAccess.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMemAccess.h
new file mode 100644
index 00000000..ac75894f
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMemAccess.h
@@ -0,0 +1,88 @@
+/******************************************************************************
+ \file machwiMemAccess.h
+
+ \brief Provides access to MACHWI memory .
+
+ \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:
+ 11/07/08 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWIMEMACCESS_H
+#define _MACHWIMEMACCESS_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+#include <macMem.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+/******************************************************************************
+ External variables.
+******************************************************************************/
+
+/******************************************************************************
+ Inline static functions prototypes section.
+******************************************************************************/
+/******************************************************************************
+ Gets address of MACHWI memory.
+ Parameters: none.
+ returns: Address of MACHWI memory.
+******************************************************************************/
+INLINE MachwiMem_t* machwiGetMem(void)
+{
+ return &macMem.hwi;
+}
+
+/******************************************************************************
+ Stores the pointer to the current request.
+ Parameters:
+ req - pointer to the current request.
+ returns:
+ none.
+******************************************************************************/
+INLINE void machwiStoreReqParams(void *req)
+{
+ machwiGetMem()->machwiReq = req;
+}
+
+/******************************************************************************
+ Gets the pointer to the current request.
+ Parameters:
+ none.
+ returns:
+ Pointer to the current request.
+******************************************************************************/
+INLINE void* machwiGetReqParams(void)
+{
+ return machwiGetMem()->machwiReq;
+}
+
+/**************************************************************************//**
+ \brief Allocates memory to execute request to MAC HWD sublayer.
+
+ \return none.
+******************************************************************************/
+INLINE MachwiHwdReqDescr_t* machwiGetHwdReqMem(void)
+{
+ return &machwiGetMem()->machwdReq;
+}
+
+#endif /* _MACHWIMEM_H */
+
+// eof machwiMemAccess.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h
new file mode 100644
index 00000000..3c833acf
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h
@@ -0,0 +1,61 @@
+/******************************************************************************
+ \file machwiOrphanHandler.h
+
+ \brief Header file of machwiOrphanHandler.c.
+
+ \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:
+ 17/08/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIORPHANHANDLER_H
+#define _MACHWIORPHANHANDLER_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <machwd.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Defines section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Checks orphan response parameters, fills frame descriptor and passes request
+ further if it is needed.
+ Parameters:
+ none.
+ Returns:
+ current status of operation ("success" or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiOrphanRespHandler(void);
+
+/******************************************************************************
+ Indicates tha orphan notification command was received.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiOrphanNotificationInd(MAC_FrameDescr_t *orphanNotificationDescr);
+
+#endif // _FFD_
+#endif /* _MACHWIORPHANHANDLER_H */
+
+// eof machwiOrphanHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanIdConflictHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanIdConflictHandler.h
new file mode 100644
index 00000000..2aa5e5d0
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanIdConflictHandler.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ \file machwiPanIdConflictHandler.h
+
+ \brief PAN ID coflict service routine 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:
+ 19/10/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIPANIDCONFLICTHANDLER_H
+#define _MACHWIPANIDCONFLICTHANDLER_H
+
+/******************************************************************************
+ Checks accordance between PAN ID and coordinator addresses.
+ Parameters:
+ beaconDescr - beacon frame description.
+ Return:
+ none.
+******************************************************************************/
+void machwiCheckPanIdConflict(MAC_FrameDescr_t *beaconDescr);
+
+/******************************************************************************
+ Indicates that PAN iD conflict notification command is received.
+ Parameters:
+ frameDescr - pointer to the command's frame descriptor.
+ Returns:
+ none.
+******************************************************************************/
+void machwiPanIdConflictNotifInd(MAC_FrameDescr_t *beaconDescr);
+
+#endif //_MACHWIPANIDCONFLICTHANDLER_H
+
+// eof machwiPollHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanServer.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanServer.h
new file mode 100644
index 00000000..909c3d3a
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanServer.h
@@ -0,0 +1,67 @@
+/******************************************************************************
+ \file machwiPanServer.h
+
+ \brief machwiPanServer 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:
+ 27/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIPANSERVER_H
+#define _MACHWIPANSERVER_H
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section.
+******************************************************************************/
+#include <types.h>
+#include <machwd.h>
+
+/******************************************************************************
+ Indicates that frame was received.
+ Parameters:
+ indParams - parameters of indication.
+ Returns:
+ none.
+******************************************************************************/
+void MACHWD_DataInd(MACHWD_DataInd_t *indParams);
+
+#ifdef _FFD_
+/******************************************************************************
+ Enable beacon transmission on beacon request.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiEnableBeaconTransmission(void);
+
+/******************************************************************************
+ Resets PanServer logic. MAC doesn't transmit beacon on beacon request after
+ resetting.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetPanServer(void);
+#endif //_FFD_
+
+#endif //_MACHWIPANSERVER_H
+
+// eof machwiPanServer.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPollHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPollHandler.h
new file mode 100644
index 00000000..10a04736
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPollHandler.h
@@ -0,0 +1,82 @@
+/******************************************************************************
+ \file machwiPollHandler.h
+
+ \brief MAC poll routine 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:
+ 09/07/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIPOLLHANDLER_H
+#define _MACHWIPOLLHANDLER_H
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <macFrame.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Typesa definition section
+******************************************************************************/
+/******************************************************************************
+ MAC Hardware Independent part POLL handler possible states.
+******************************************************************************/
+typedef enum
+{
+ MACHWI_POLL_HANDLER_STATE_IDLE,
+ MACHWI_POLL_HANDLER_STATE_DATA_REQ_TRANSMISSION,
+ MACHWI_POLL_HANDLER_STATE_ANSWER_WAITING,
+ MACHWI_POLL_HANDLER_STATE_TRX_STATE_SETTING,
+} MachwiPollHandlerState_t;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Resets poll handler.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetPollHandler(void);
+
+/******************************************************************************
+ Indicates data reception to upper layer.
+ Parameters:
+ frameDescr - pointer to frame descriptor.
+ Returns:
+ none.
+******************************************************************************/
+void machwiDataIndication(MAC_FrameDescr_t *frameDescr);
+
+/******************************************************************************
+ Checks poll request parameters, sends data request commands.
+ Waits for the data.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiPollReqHandler(void);
+
+/******************************************************************************
+ Indicates, that data request frame was received.
+ Parameters:
+ pollDescr - Poll description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiPollInd(MAC_FrameDescr_t *frameDescr);
+
+#endif //_MACHWIPOLLHANDLER_H
+// eof machwiPollHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h
new file mode 100644
index 00000000..1fb1ae4c
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h
@@ -0,0 +1,58 @@
+/******************************************************************************
+ \file machwiPurgeHandler.h
+
+ \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:
+ 28/08/07 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWIPURGEHANDLER_H
+#define _MACHWIPURGEHANDLER_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+#include <macPurge.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+/******************************************************************************
+ Constants section
+******************************************************************************/
+
+/******************************************************************************
+ External variables
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Purges an MSDU from the transaction queue.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (always success).
+******************************************************************************/
+MachwiHandlerResult_t machwiPurgeReqHandler(void);
+
+#endif //_FFD_
+#endif /* _MACHWIPURGEHANDLER_H */
+
+// eof machwiPurgeHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiResetHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiResetHandler.h
new file mode 100644
index 00000000..83c3a9b5
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiResetHandler.h
@@ -0,0 +1,41 @@
+/******************************************************************************
+ \file machwiResetHandler.h
+
+ \brief MAC reset routine 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:
+ 21/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIRESETHANDLER_H
+#define _MACHWIRESETHANDLER_H
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <machwiManager.h>
+
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ TBD
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+MachwiHandlerResult_t machwiResetReqHandler(void);
+
+// eof machwiResetHandler.h
+
+#endif //_MACHWIRESETHANDLER_H
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiRxEnableHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiRxEnableHandler.h
new file mode 100644
index 00000000..b79111cf
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiRxEnableHandler.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ \file machwiRxEnableHandler.h
+
+ \brief Header file of machwiRxEnableHandler.c.
+
+ \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:
+ 24/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWIRXENABLEHANDLER_H
+#define _MACHWIRXENABLEHANDLER_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <machwiManager.h>
+
+/******************************************************************************
+ Defines section
+******************************************************************************/
+
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ TBD
+ Parameters:
+ TBD - TBD.
+ Returns:
+ TBD.
+******************************************************************************/
+MachwiHandlerResult_t machwiRxEnableReqHandler(void);
+
+#endif /* _MACHWIRXENABLEHANDLER_H */
+
+// eof machwiRxEnableHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiScanHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiScanHandler.h
new file mode 100644
index 00000000..ab0304ae
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiScanHandler.h
@@ -0,0 +1,97 @@
+/******************************************************************************
+ \file machwiScanHandler.h
+
+ \brief Header file of machwiScanHandler.c.
+
+ \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:
+ 24/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWISCANHANDLER_H
+#define _MACHWISCANHANDLER_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <machwd.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Defines section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef enum
+{
+ MACHWI_IDLE_SCAN_STATE,
+ MACHWI_SET_CHANNEL_SCAN_STATE,
+ MACHWI_SET_BEACON_RX_MODE_SCAN_STATE,
+ MACHWI_CLR_BEACON_RX_MODE_SCAN_STATE,
+ MACHWI_SET_PAGE_SCAN_STATE,
+ MACHWI_SET_TRX_STATE_TRX_OFF_SCAN_STATE,
+ MACHWI_SET_TRX_STATE_RX_ON_SCAN_STATE,
+ MACHWI_SET_RF_IRQ_DISABLE_SCAN_STATE,
+ MACHWI_SET_RF_IRQ_ENABLE_SCAN_STATE,
+ MACHWI_SET_SHORT_ADDR_SCAN_STATE,
+ MACHWI_SET_PANID_SCAN_STATE,
+ MACHWI_SET_CHANNEL_AFTER_ORPHAN_SCAN_STATE,
+ MACHWI_WAIT_SCAN_STATE,
+ MACHWI_SCAN_TIME_EXHAUSTED_SCAN_STATE,
+ MACHWI_SET_ACTIVE_CHANNEL_SCAN_STATE,
+ MACHWI_SET_PANID_BROADCAST_SCAN_STATE,
+ MACHWI_SET_PANID_ORIGINAL_SCAN_STATE
+} MachwiScanState_t;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ TBD
+ Parameters:
+ TBD - TBD.
+ Returns:
+ TBD.
+******************************************************************************/
+MachwiHandlerResult_t machwiScanReqHandler(void);
+
+
+/******************************************************************************
+ Indicates, that beacon frame was received.
+ Parameters:
+ beaconDescr - beacon description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiBeaconInd(MAC_FrameDescr_t *beaconDescr);
+
+/******************************************************************************
+ Indicates, that coordinator realignment connamd was received.
+ Parameters:
+ realignmentDescr - realignment command description.
+ Returns:
+ none.
+******************************************************************************/
+void machwiCoordRealignmentCommandInd(MAC_FrameDescr_t *realignmentDescr);
+
+/******************************************************************************
+ Resets scan handler.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetScanHandler(void);
+
+#endif /* _MACHWISCANHANDLER_H */
+
+// eof machwiScanHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h
new file mode 100644
index 00000000..10866d27
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h
@@ -0,0 +1,50 @@
+/******************************************************************************
+ \file machwiSetGetHandler.h
+
+ \brief machwiSetGetHandler 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:
+ 21/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWISETGETHANDLER_H
+#define _MACHWISETGETHANDLER_H
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <machwiManager.h>
+#include <macSetGet.h>
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Gets request parameters from PIB.
+ Parameters:
+ none.
+ Returns:
+ current status of operation (always success).
+******************************************************************************/
+MachwiHandlerResult_t machwiGetReqHandler(void);
+
+/**************************************************************************
+ Sets request parameters to PIB and RF chip (if it is needed).
+ Parameters:
+ none.
+ Returns:
+ current status of operation (success or "in progress").
+******************************************************************************/
+MachwiHandlerResult_t machwiSetReqHandler(void);
+
+
+#endif //_MACHWISETGETHANDLER_H
+
+// eof machwiSetGetHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiStartHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiStartHandler.h
new file mode 100644
index 00000000..c838988d
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiStartHandler.h
@@ -0,0 +1,69 @@
+/******************************************************************************
+ \file machwiStartHandler.h
+
+ \brief Header file of machwiStartHandler.
+
+ \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:
+ 24/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWISTARTHANDLER_H
+#define _MACHWISTARTHANDLER_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <machwd.h>
+#include <machwiManager.h>
+
+/******************************************************************************
+ Defines section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef enum
+{
+ MACHWI_IDLE_START_STATE,
+ MACHWI_SET_PAN_ID_START_STATE,
+ MACHWI_SET_PAN_COORDINATOR_START_STATE,
+ MACHWI_SET_PAGE_START_STATE,
+ MACHWI_SET_CHANNEL_START_STATE,
+ MACHWI_TX_COORD_REALIG_CMD_STATE,
+} MachwiStartState_t;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ TBD
+ Parameters:
+ TBD - TBD.
+ Returns:
+ TBD.
+******************************************************************************/
+MachwiHandlerResult_t machwiStartReqHandler(void);
+
+/******************************************************************************
+ Resets start handler.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetStartHandler(void);
+
+#endif // _FFD_
+#endif /* _MACHWISTARTHANDLER_H */
+
+// eof machwiStartHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h
new file mode 100644
index 00000000..6891b07c
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h
@@ -0,0 +1,113 @@
+/******************************************************************************
+ \file machwiSwitchRxCtrl.h
+
+ \brief Implementation of switching receiver control.
+
+ \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:
+ 23/08/07 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWISWITCHRXCTRL_H
+#define _MACHWISWITCHRXCTRL_H
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+#include <machwiMemAccess.h>
+#include <machwiHwdReqMemPool.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+
+/******************************************************************************
+ Constants section
+******************************************************************************/
+
+/******************************************************************************
+ External variables
+******************************************************************************/
+extern bool __switchIsLocked;
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ Switches receiver to TRX OFF if RxOnWhenIdle parameter isn't set.
+ Parameters:
+ hwdReq - pointer to MACHWD request memory.
+ switchingCompleted - callback to indicate the end of switching receiver.
+ Returns:
+ none.
+******************************************************************************/
+void machwiSwitchRxAccordToRxOnWhenIdle(MachwiHwdReqDescr_t *hwdReq,
+ void (*switchingCompleted)(void));
+
+/******************************************************************************
+ Inline static functions section
+******************************************************************************/
+/******************************************************************************
+ Resets switching receiver control.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+static inline void machwiResetSwitchingRxCtrl(void)
+{
+ machwiGetMem()->switchIsLocked = false;
+}
+
+/******************************************************************************
+ Locks switching receiver control.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+static inline void machwiLockSwitchingRx(void)
+{
+ machwiGetMem()->switchIsLocked = true;
+}
+
+/******************************************************************************
+ Unlocks switching receiver control.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+static inline void machwiUnlockSwitchingRx(void)
+{
+ machwiGetMem()->switchIsLocked = false;
+}
+
+/******************************************************************************
+ Tests switching receiver control state.
+ Parameters:
+ none.
+ Returns:
+ true - switching receiver is locked.
+ false - otherwise.
+******************************************************************************/
+static inline bool machwiIsSwitchingRxLocked(void)
+{
+ return machwiGetMem()->switchIsLocked;
+}
+
+#endif /* _MACHWISWITCHRXCTRL_H */
+
+// eof machwiSwitchRxCtrl.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionHandler.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionHandler.h
new file mode 100644
index 00000000..cd5d31a8
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionHandler.h
@@ -0,0 +1,85 @@
+/******************************************************************************
+ \file machwiTransactionHandler.h
+
+ \brief machwiTransactionHandler 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:
+ 28/06/07 ALuzhetsky - Created.
+******************************************************************************/
+
+#ifndef _MACHWITRANSACTIONHANDLER_H
+#define _MACHWITRANSACTIONHANDLER_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section.
+******************************************************************************/
+#include <types.h>
+#include <machwiTransactionQueue.h>
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+typedef enum
+{
+ MACHWI_IDLE_TRANSACTION_HANDLER_STATE,
+ MACHWI_BUSY_ASSOCIATE_TRANSACTION_HANDLER_STATE,
+#ifdef _MAC_DISASSOCIATE_
+
+ MACHWI_BUSY_DISASSOCIATE_TRANSACTION_HANDLER_STATE,
+#endif //_MAC_DISASSOCIATE_
+
+ MACHWI_BUSY_DATA_TRANSACTION_HANDLER_STATE,
+#ifdef _PENDING_EMPTY_DATA_FRAME_
+ MACHWI_BUSY_EMPTY_DATA_HANDLER_STATE,
+#endif // _PENDING_EMPTY_DATA_FRAME_
+} MachwiTransactionHandlerState_t;
+
+/******************************************************************************
+ Prototypes section.
+******************************************************************************/
+
+/******************************************************************************
+ Indicates, that transaction event happened (it was requested or just expired).
+ Parameters:
+ transaction - transaction descriptor.
+ event - type of the event (MAC_TRANSACTION_EXPIRED_EVENT or
+ MAC_TRANSACTION_READY_EVENT).
+ Returns:
+ true - activate the kicked transaction, false - otherwise.
+******************************************************************************/
+bool machwiSendTransactionEvent(MachwiTransaction_t *transaction, MachwiTransactionEvent_t event);
+
+
+/******************************************************************************
+ Resets transaction handler.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetTransactionHandler(void);
+
+#ifdef _PENDING_EMPTY_DATA_FRAME_
+/******************************************************************************
+ Sends an empty data frame in reply to the data request.
+ Parameters:
+ frameDescr - data request frame description.
+ Returns:
+ none.
+******************************************************************************/
+void replyWithEmptyDataFrame(MAC_FrameDescr_t *frameDescr);
+#endif // _PENDING_EMPTY_DATA_FRAME_
+
+#endif //_FFD_
+#endif //_MACHWITRANSACTIONHANDLER_H
+
+// eof machwiTransactionHandler.h
diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h
new file mode 100644
index 00000000..584924a0
--- /dev/null
+++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h
@@ -0,0 +1,123 @@
+/******************************************************************************
+ \file machwiTransactionQueue.h
+
+ \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:
+ 25/06/07 A. Mandychev - Created.
+******************************************************************************/
+
+#ifndef _MACHWITRANSACTIONQUEUE_H
+#define _MACHWITRANSACTIONQUEUE_H
+#ifdef _FFD_
+
+/******************************************************************************
+ Includes section
+******************************************************************************/
+#include <types.h>
+#include <macData.h>
+#include <macFrame.h>
+#include <macAssociate.h>
+#include <macDisassociate.h>
+
+/******************************************************************************
+ Define(s) section
+******************************************************************************/
+
+/******************************************************************************
+ Types section
+******************************************************************************/
+// Transaction event.
+typedef enum
+{
+ MAC_TRANSACTION_EXPIRED_EVENT = MAC_TRANSACTION_EXPIRED_STATUS,
+ MAC_TRANSACTION_ACTIVATED_EVENT
+} MachwiTransactionEvent_t;
+
+// Transaction.
+typedef union
+{
+ MAC_DataReq_t dataReq;
+ MAC_AssociateResp_t associateResp;
+ MAC_DisassociateReq_t disassociateReq;
+} MachwiTransaction_t;
+
+/******************************************************************************
+ Constants section
+******************************************************************************/
+
+/******************************************************************************
+ External variables
+******************************************************************************/
+
+/******************************************************************************
+ Prototypes section
+******************************************************************************/
+/******************************************************************************
+ TBD.
+******************************************************************************/
+void machwiPutTransactionToQueue(MachwiTransaction_t *transaction);
+
+/******************************************************************************
+ TBD.
+******************************************************************************/
+result_t machwiPurgeTransactionFromQueue(uint8_t msduHandle);
+
+/**************************************************************************//**
+ \brief Compares MAC Data Request command's parameters with transactions in the
+ transaction queue. If matched - transaction is marked as "activated".
+
+ \param frameDescr - Data Request MAC command descriptor.
+ \return true if transaction to be transmitted is found, false otherwise
+******************************************************************************/
+bool machwiTestAndKickQueueTransactions(MAC_FrameDescr_t *frameDescr);
+
+/**************************************************************************//**
+ \brief Finds trunsactions which were already activated.
+
+ \return Activated transaction pointer if found, NULL otherwise.
+******************************************************************************/
+MachwiTransaction_t *machwiGetActivatedTransactionFromQueue(void);
+
+/******************************************************************************
+ TBD.
+******************************************************************************/
+uint8_t* machwiFillPendingAddrSpecAndList(uint8_t *beaconPayload);
+
+/******************************************************************************
+ Resets transaction queue.
+ Parameters:
+ none.
+ Returns:
+ none.
+******************************************************************************/
+void machwiResetTransactionQueue(void);
+
+/******************************************************************************
+ Deletes transaction from queue.
+ Parameters:
+ transaction - pointer to transaction wich should be deleted.
+ Returns:
+ none.
+******************************************************************************/
+void machwiDeleteTransactionFromQueue(MachwiTransaction_t *transaction);
+
+/******************************************************************************
+ Checks if MAC transaction queue is empty
+ Parameters:
+ none
+ Returns:
+ true, if MAC transaction queue is empty, false otherwise.
+******************************************************************************/
+bool machwiTransactionQueueEmpty(void);
+
+#endif //_FFD_
+#endif /* _MACHWITRANSACTIONQUEUE_H */
+
+// eof machwiTransactionQueue.h