From b24866225a6301d3a663f874725e83c012dc25d3 Mon Sep 17 00:00:00 2001 From: Florent Duchon Date: Wed, 26 Dec 2012 17:36:00 +0100 Subject: digital/beacon: add bitcloud stack into common directory digital/zigbit --- .../Components/MAC_PHY/MAC_ENV/include/macenvMem.h | 114 ++++++ .../Components/MAC_PHY/MAC_ENV/include/macenvPib.h | 444 +++++++++++++++++++++ .../MAC_PHY/MAC_HWD_PHY/include/machwd.h | 34 ++ .../MAC_PHY/MAC_HWD_PHY/include/machwdBatMon.h | 50 +++ .../MAC_HWD_PHY/include/machwdCalibration.h | 52 +++ .../MAC_PHY/MAC_HWD_PHY/include/machwdData.h | 92 +++++ .../MAC_PHY/MAC_HWD_PHY/include/machwdEd.h | 61 +++ .../MAC_PHY/MAC_HWD_PHY/include/machwdEncrypt.h | 51 +++ .../MAC_PHY/MAC_HWD_PHY/include/machwdMem.h | 41 ++ .../MAC_PHY/MAC_HWD_PHY/include/machwdReset.h | 32 ++ .../MAC_PHY/MAC_HWD_PHY/include/machwdRnd.h | 58 +++ .../MAC_PHY/MAC_HWD_PHY/include/machwdService.h | 57 +++ .../MAC_PHY/MAC_HWD_PHY/include/machwdSet.h | 94 +++++ .../MAC_PHY/MAC_HWD_PHY/include/machwdSetTrx.h | 65 +++ .../MAC_HWI/include/machwiAssociateHandler.h | 101 +++++ .../MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h | 50 +++ .../MAC_PHY/MAC_HWI/include/machwiDataHandler.h | 65 +++ .../MAC_HWI/include/machwiDisassociateHandler.h | 98 +++++ .../MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h | 48 +++ .../MAC_PHY/MAC_HWI/include/machwiManager.h | 234 +++++++++++ .../Components/MAC_PHY/MAC_HWI/include/machwiMem.h | 82 ++++ .../MAC_PHY/MAC_HWI/include/machwiMemAccess.h | 88 ++++ .../MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h | 61 +++ .../MAC_HWI/include/machwiPanIdConflictHandler.h | 41 ++ .../MAC_PHY/MAC_HWI/include/machwiPanServer.h | 67 ++++ .../MAC_PHY/MAC_HWI/include/machwiPollHandler.h | 82 ++++ .../MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h | 58 +++ .../MAC_PHY/MAC_HWI/include/machwiResetHandler.h | 41 ++ .../MAC_HWI/include/machwiRxEnableHandler.h | 50 +++ .../MAC_PHY/MAC_HWI/include/machwiScanHandler.h | 97 +++++ .../MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h | 50 +++ .../MAC_PHY/MAC_HWI/include/machwiStartHandler.h | 69 ++++ .../MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h | 113 ++++++ .../MAC_HWI/include/machwiTransactionHandler.h | 85 ++++ .../MAC_HWI/include/machwiTransactionQueue.h | 123 ++++++ .../stack/Components/MAC_PHY/include/mac.h | 51 +++ .../stack/Components/MAC_PHY/include/macAddr.h | 85 ++++ .../stack/Components/MAC_PHY/include/macAffix.h | 48 +++ .../Components/MAC_PHY/include/macAssociate.h | 154 +++++++ .../stack/Components/MAC_PHY/include/macBanNode.h | 121 ++++++ .../stack/Components/MAC_PHY/include/macBeacon.h | 108 +++++ .../stack/Components/MAC_PHY/include/macBuffers.h | 54 +++ .../Components/MAC_PHY/include/macCommStatus.h | 64 +++ .../stack/Components/MAC_PHY/include/macCommon.h | 90 +++++ .../stack/Components/MAC_PHY/include/macData.h | 143 +++++++ .../stack/Components/MAC_PHY/include/macDbg.h | 210 ++++++++++ .../Components/MAC_PHY/include/macDisassociate.h | 129 ++++++ .../Components/MAC_PHY/include/macEnvironment.h | 59 +++ .../stack/Components/MAC_PHY/include/macFrame.h | 205 ++++++++++ .../stack/Components/MAC_PHY/include/macMem.h | 52 +++ .../stack/Components/MAC_PHY/include/macOrphan.h | 81 ++++ .../stack/Components/MAC_PHY/include/macPoll.h | 105 +++++ .../stack/Components/MAC_PHY/include/macPurge.h | 75 ++++ .../stack/Components/MAC_PHY/include/macReset.h | 73 ++++ .../stack/Components/MAC_PHY/include/macRxEnable.h | 78 ++++ .../stack/Components/MAC_PHY/include/macScan.h | 116 ++++++ .../stack/Components/MAC_PHY/include/macSetGet.h | 113 ++++++ .../stack/Components/MAC_PHY/include/macStart.h | 89 +++++ .../Components/MAC_PHY/include/macSuperframe.h | 104 +++++ .../stack/Components/MAC_PHY/include/macSync.h | 70 ++++ .../stack/Components/MAC_PHY/include/macphyPib.h | 381 ++++++++++++++++++ .../stack/Components/MAC_PHY/include/phy.h | 163 ++++++++ .../stack/Components/MAC_PHY/include/rfBattery.h | 126 ++++++ .../Components/MAC_PHY/include/rfCalibration.h | 78 ++++ .../stack/Components/MAC_PHY/include/rfEncrypt.h | 72 ++++ .../stack/Components/MAC_PHY/include/rfInit.h | 45 +++ .../stack/Components/MAC_PHY/include/rfRandom.h | 73 ++++ 67 files changed, 6363 insertions(+) create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvMem.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvPib.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwd.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdBatMon.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdCalibration.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdData.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEd.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEncrypt.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdMem.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdReset.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdRnd.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdService.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSet.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSetTrx.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiAssociateHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiBeaconHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDataHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiDisassociateHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiHwdReqMemPool.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiManager.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMem.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiMemAccess.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiOrphanHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanIdConflictHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPanServer.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPollHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiPurgeHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiResetHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiRxEnableHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiScanHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSetGetHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiStartHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiSwitchRxCtrl.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionHandler.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWI/include/machwiTransactionQueue.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/mac.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAddr.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAffix.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAssociate.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBanNode.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBeacon.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBuffers.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommStatus.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommon.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macData.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDbg.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDisassociate.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macEnvironment.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macFrame.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macMem.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macOrphan.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPoll.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPurge.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macReset.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macRxEnable.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macScan.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSetGet.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macStart.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSuperframe.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSync.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macphyPib.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/phy.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfBattery.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfCalibration.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfEncrypt.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfInit.h create mode 100644 digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfRandom.h (limited to 'digital/zigbit/bitcloud/stack/Components/MAC_PHY') diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvMem.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvMem.h new file mode 100644 index 00000000..fcc8da32 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvMem.h @@ -0,0 +1,114 @@ +/**************************************************************************//** + \file macenvMem.h + + \brief MAC and PHY PIB 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: + 23/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACENVMEM_H +#define _MACENVMEM_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! PHY PIB attributes. +typedef struct +{ + uint8_t channel; + uint32_t channelsSupported; // Just one row for current page. + int8_t transmitPower; + PHY_CcaMode_t ccaMode; + uint8_t currentPage; + uint16_t maxFrameDuration; + uint8_t shrDuration; + uint8_t symbolsPerOctet; +} PhyPibAttr_t; + +//! MAC PIB attributes. +typedef struct +{ + uint32_t ackWaitDuration; + bool associatedPanCoord; +#ifdef _FFD_ + bool associationPermit; +#endif // _FFD_ + bool autoRequest; + //bool battLifeExt; + //uint8_t battLifeExtPeriods; +#ifdef _FFD_ + uint8_t *beaconPayload; + uint8_t beaconPayloadLength; + //uint8_t beaconOrder; + //uint32_t beaconTxTime; + uint8_t bsn; +#endif // _FFD_ + ExtAddr_t coordExtAddr; + ShortAddr_t coordShortAddr; + uint8_t dsn; + //bool gtsPermit; + uint8_t maxBe; + uint8_t maxCsmaBackoffs; + //uint8_t maxFrameTotalWaitTime; + uint8_t maxFrameRetries; + uint8_t minBe; + //uint8_t minLifsPeriod; + //uint8_t minSifsPeriod; + PanId_t panId; +#ifdef _FFD_ + //bool promiscuousMode; +#endif // _FFD_ + uint8_t responseWaitTime; + bool rxOnWhenIdle; + bool securityEnabled; + ShortAddr_t shortAddr; +#ifdef _FFD_ + //uint8_t superframeOrder; + //uint8_t syncSymbolOffset; +#endif // _FFD_ + //bool timestampSupported; +#ifdef _FFD_ + //uint16_t transactionPersistenceTime; +#endif // _FFD_ + /************************************************************/ + // Additional attributes. NOT described in the standard. + ExtAddr_t extAddr; // Device own extended address. + bool panCoordinator; + // For PanServer needs. +#ifdef _FFD_ + bool beaconTxEnable; +#endif //_FFD_ +/** Duration in milliseconds of maximum length frame transferring. */ + uint8_t maxFrameTransmissionTime; +} MacPibAttr_t; + +//! MAC and PHY PIB attributes. +typedef struct +{ + MacPibAttr_t macAttr; + PhyPibAttr_t phyAttr; +} PIB_t; + +#endif /*_MACENVMEM_H*/ + +// eof macphyPibMem.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvPib.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvPib.h new file mode 100644 index 00000000..e1d9e2a9 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_ENV/include/macenvPib.h @@ -0,0 +1,444 @@ +/**************************************************************************//** + \file macenvPib.h + + \brief MAC and PHY PIB access function prototypes. + + \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/09/07 A. Mandychev - Created macphyPibServer.h. + 10/06/08 A. Mandychev - Renamed to macenvPib.h. + 22/12/10 A. Razinkov - Merged with macenvPibOldCs.h +******************************************************************************/ + +#ifndef _MACENVPIB_H +#define _MACENVPIB_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +#define MS_1000 1000U /* Divider from us to ms. */ + +/****************************************************************************** + Types section +******************************************************************************/ +//! PIB request's descriptor. +typedef struct +{ + MACPHY_PibId_t id; + MACPHY_PibAttr_t attr; +} MacPhyPibReq_t; + +/****************************************************************************** + Constants section +******************************************************************************/ + +/****************************************************************************** + External variables section +******************************************************************************/ +extern PIB_t csPIB; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Resets MACPHY PIB. + \param none. + \return none. +******************************************************************************/ +void macenvResetPib(void); + +/**************************************************************************//** + \brief Sets MAC or PHY attribute to PIB. + \param[in] pibAttr - pointer to attribute structure. + \return SUCCESS, READ_ONLY, UNSUPPORTED_ATTRIBUTE or INVALID_PARAMETER. +******************************************************************************/ +MAC_Status_t macenvSetPibAttr(const MacPhyPibReq_t *pibAttr); + +/**************************************************************************//** + \brief Gets MAC or PHY attribute from PIB. + \param[inout] pibAttr - pointer to attribute structure. + \return SUCCESS or UNSUPPORTED_ATTRIBUTE. +******************************************************************************/ +MAC_Status_t macenvGetPibAttr(MacPhyPibReq_t *pibAttr); + +/**************************************************************************//** + \brief Calculates maximum frame total wait time. + \return maximum frame total wait time. +******************************************************************************/ +uint32_t macenvCalculateMaxFrameTotalWaitTimeInMs(void); + +/****************************************************************************** + Calculates MAC response wait time (IEEE standart: macResponseWaitTime). + Parameters: + none. + Return: + MAC response wait time. +******************************************************************************/ +uint32_t macenvCalculateResponceWaitTimeInMs(void); + +/**************************************************************************//** + \brief Detects PHY symbol duration. + \param none; + \return PHY symbol duration. +******************************************************************************/ +uint8_t macenvGetPhySymbolDuration(void); + +#ifdef _FFD_ +/**************************************************************************//** + \brief Calculates MAC transaction persistence time im ms. + + \param[in] MAC transaction persistence time in unit periods. + IEEE802.15.4_2006, 7.4.2, Table 86, page 166. + \return time calculated (milliseconds). +******************************************************************************/ +uint32_t macenvConvertTransPersistTimeFromUnitsToMs(uint16_t transPersTimeInUnits); +#endif // _FFD_ + +/**************************************************************************//** + \brief Gets current value for dsn parameter of PHY&MAC PIB and then increments it. + \return current dsn value. +******************************************************************************/ +INLINE uint8_t macenvGetAndIncDsn(void) +{ + return csPIB.macAttr.dsn++; +} + +/**************************************************************************//** + \brief Gets current value for bsn parameter of PHY&MAC PIB and then increments it. + \return current bsn value. +******************************************************************************/ +#ifdef _FFD_ +INLINE uint8_t macenvGetAndIncBsn(void) +{ + return csPIB.macAttr.bsn++; +} +#endif // _FFD_ + +/**************************************************************************//** + \brief Gets channel. + \return current channel. +******************************************************************************/ +INLINE uint8_t macenvGetChannel(void) +{ + return csPIB.phyAttr.channel; +} + +/**************************************************************************//** + \brief Gets supported channels. + \return supported channels. +******************************************************************************/ +INLINE uint32_t macenvGetChannelsSupported(void) +{ + return csPIB.phyAttr.channelsSupported; +} + +/**************************************************************************//** + \brief Gets tx power. + \return current tx power. +******************************************************************************/ +INLINE int8_t macenvGetTxPower(void) +{ + return csPIB.phyAttr.transmitPower; +} + +/**************************************************************************//** + \brief Gets CCA mode. + \return current CCA mode. +******************************************************************************/ +INLINE PHY_CcaMode_t macenvGetCcaMode(void) +{ + return csPIB.phyAttr.ccaMode; +} + +/**************************************************************************//** + \brief Gets current page. + \return current page. +******************************************************************************/ +INLINE uint8_t macenvGetCurrentPage(void) +{ + return csPIB.phyAttr.currentPage; +} + +/**************************************************************************//** + \brief Gets max CSMA backoffs. + \return max CSMA backoffs. +******************************************************************************/ +INLINE uint8_t macenvGetMaxCsmaBackoffs(void) +{ + return csPIB.macAttr.maxCsmaBackoffs; +} + +/**************************************************************************//** + \brief Gets PAN ID. + \return PAN ID. +******************************************************************************/ +INLINE PanId_t macenvGetPanId(void) +{ + return csPIB.macAttr.panId; +} + +/**************************************************************************//** + \brief Gets short address. + \return short address. +******************************************************************************/ +INLINE ShortAddr_t macenvGetShortAddr(void) +{ + return csPIB.macAttr.shortAddr; +} + +/**************************************************************************//** + \brief Gets min BE. + \return min BE. +******************************************************************************/ +INLINE uint8_t macenvGetMinBe(void) +{ + return csPIB.macAttr.minBe; +} + +/**************************************************************************//** + \brief Gets max frame retries. + \return max frame retries. +******************************************************************************/ +INLINE uint8_t macenvGetMaxFrameRetries(void) +{ + return csPIB.macAttr.maxFrameRetries; +} + +/**************************************************************************//** + \brief Gets rx on when idle parameter. + \return rx on when idle parameter. +******************************************************************************/ +INLINE bool macenvGetRxOnWhenIdle(void) +{ + return csPIB.macAttr.rxOnWhenIdle; +} + +/**************************************************************************//** + \brief Gets coordinator short address. + \return coordinator short address. +******************************************************************************/ +INLINE ShortAddr_t macenvGetCoordShortAddr(void) +{ + return csPIB.macAttr.coordShortAddr; +} + +/**************************************************************************//** + \brief Gets pointer to coordinator extended address. + \return pointer to coordinator extended address. +******************************************************************************/ +INLINE ExtAddr_t* macenvGetCoordExtAddr(void) +{ + return &csPIB.macAttr.coordExtAddr; +} + +/**************************************************************************//** + \brief Gets response wait time. + \return response wait time. +******************************************************************************/ +INLINE uint8_t macenvGetResponseWaitTime(void) +{ + return csPIB.macAttr.responseWaitTime; +} + +/**************************************************************************//** + \brief Gets PAN coordinator parameter. + \return PAN coordinator parameter. +******************************************************************************/ +INLINE bool macenvGetPanCoordinator(void) +{ + return csPIB.macAttr.panCoordinator; +} + +/**************************************************************************//** + \brief Gets association permit parameter. + \return association permit parameter. +******************************************************************************/ +#ifdef _FFD_ +INLINE bool macenvGetAssociationPermit(void) +{ + return csPIB.macAttr.associationPermit; +} +#endif + +/**************************************************************************//** + \brief Gets beacon payload pointer. + \return beacon payload pointer. +******************************************************************************/ +#ifdef _FFD_ +INLINE uint8_t* macenvGetBeaconPayload(void) +{ + return csPIB.macAttr.beaconPayload; +} +#endif + +/**************************************************************************//** + \brief Gets beacon payload length. + \return beacon payload length. +******************************************************************************/ +#ifdef _FFD_ +INLINE uint8_t macenvGetBeaconPayloadLength(void) +{ + return csPIB.macAttr.beaconPayloadLength; +} +#endif + +/**************************************************************************//** + \brief Gets beacon tx enable parameter. + \return beacon tx enable parameter. +******************************************************************************/ +#ifdef _FFD_ +INLINE bool macenvGetBeaconTxEnable(void) +{ + return csPIB.macAttr.beaconTxEnable; +} +#endif + +/**************************************************************************//** + \brief Gets auto request parameter. + \return auto request parameter. +******************************************************************************/ +INLINE bool macenvGetAutoRequest(void) +{ + return csPIB.macAttr.autoRequest; +} + +/**************************************************************************//** + \brief Gets associated PAN coordinator parameter. + \return associated PAN coordinator parameter. +******************************************************************************/ +INLINE bool macenvGetAssociatedPanCoord(void) +{ + return csPIB.macAttr.associatedPanCoord; +} + +/**************************************************************************//** + \brief Sets channel. + \param channel - channel to set. + \return none. +******************************************************************************/ +INLINE void macenvSetChannel(uint8_t channel) +{ + csPIB.phyAttr.channel = channel; +} + +/**************************************************************************//** + \brief Sets short address. + \param shortAddr - short address. + \return none. +******************************************************************************/ +INLINE void macenvSetShortAddr(ShortAddr_t shortAddr) +{ + csPIB.macAttr.shortAddr = shortAddr; +} + +/**************************************************************************//** + \brief Sets associated pan coordinator parameter. + \param associatedPanCoord. + \return none. +******************************************************************************/ +INLINE void macenvSetAssociatedPanCoord(bool associatedPanCoord) +{ + csPIB.macAttr.associatedPanCoord = associatedPanCoord; +} + +/**************************************************************************//** + \brief Sets coordinator short address. + \param coordShortAddr - coordinator short address. + \return none. +******************************************************************************/ +INLINE void macenvSetCoordShortAddr(ShortAddr_t coordShortAddr) +{ + csPIB.macAttr.coordShortAddr = coordShortAddr; +} + +/**************************************************************************//** + \brief Sets coordinator ext address. + \param coordExtAddr - coordinator ext address. + \return none. +******************************************************************************/ +INLINE void macenvSetCoordExtAddr(ExtAddr_t* coordExtAddr) +{ + COPY_EXT_ADDR(csPIB.macAttr.coordExtAddr, *coordExtAddr); +} + +/**************************************************************************//** + \brief Sets PAN ID. + \param panId - PAN ID. + \return none. +******************************************************************************/ +INLINE void macenvSetPanId(PanId_t panId) +{ + csPIB.macAttr.panId = panId; +} + +/**************************************************************************//** + \brief Sets PAN coordinator parameter. + \param panCoordinator - PAN coordinator parameter. + \return none. +******************************************************************************/ +INLINE void macenvSetPanCoordinator(bool panCoordinator) +{ + csPIB.macAttr.panCoordinator = panCoordinator; +} + +/**************************************************************************//** + \brief Sets beacon payload length. + \param beaconTxEnable - beacon tx enable parameter. + \return none. +******************************************************************************/ +#ifdef _FFD_ +INLINE void macenvSetBeaconTxEnable(bool beaconTxEnable) +{ + csPIB.macAttr.beaconTxEnable = beaconTxEnable; +} +#endif + +/****************************************************************************** + \brief Converts time in Microseconds to time in Milliseconds. + \param[in] time in microseconds. + \return time in milliseconds +******************************************************************************/ +INLINE uint32_t convertTimeFromUsToMs(uint32_t timeInUs) +{ + return (timeInUs / MS_1000); +} + +/**************************************************************************//** + \brief Sets max frame transmission time attribute value. + + \param[in] time - new max frame transmission time value. + \return None. + ******************************************************************************/ +INLINE void MAC_SetMaxFrameTransmissionTime(const uint8_t time) +{ + csPIB.macAttr.maxFrameTransmissionTime = time; +} + +/**************************************************************************//** + \brief Gets max frame transmission time attribute value. + + \return Max frame transmission time attribute value. + ******************************************************************************/ +INLINE uint8_t MAC_GetMaxFrameTransmissionTime(void) +{ + return csPIB.macAttr.maxFrameTransmissionTime; +} + +#endif /* _MACENVPIB_H */ + +// eof macenvPib.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwd.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwd.h new file mode 100644 index 00000000..2e3c47cb --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwd.h @@ -0,0 +1,34 @@ +/**************************************************************************//** + \file machwd.h + + \brief IEEE 802.15.4-2006 (hardware dependent part) public headers files' union. + + \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/05/07 A. Mandychev - Created. + 26/09/07 A. Mandychev - Redesigned. +******************************************************************************/ + +#ifndef _MACHWD_H +#define _MACHWD_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include +#include +#include +#include + +#endif /* _MACHWD_H */ + +// eof machwd.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdBatMon.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdBatMon.h new file mode 100644 index 00000000..240228f9 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdBatMon.h @@ -0,0 +1,50 @@ +/**************************************************************************//** + \file machwdBatMon.h + + \brief Prototypes of battery monitor functions and corresponding types. + + \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: + 16/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDBATMON_H +#define _MACHWDBATMON_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Redefenition of battery request function name. +#define MACHWD_BatMonReq RF_BatteryMonReq + +/****************************************************************************** + Types section +******************************************************************************/ +//! Redefenition of battery request structure. +typedef RF_BatteryMonReq_t MACHWD_BatMonReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Sets battery monitor voltage. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void MACHWD_BatMonReq(MACHWD_BatMonReq_t *reqParams); + +#endif /*_MACHWDBATMON_H*/ + +// eof machwdBatMon.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdCalibration.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdCalibration.h new file mode 100644 index 00000000..38e231c4 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdCalibration.h @@ -0,0 +1,52 @@ +/**************************************************************************//** + \file machwdCalib.h + + \brief MACHWD interface for PLL calibration and filter tuning. + + \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: + 2011-10-04 Max Gekk - Created. + Last change: + $Id: machwdCalibration.h 18970 2011-10-21 12:48:41Z mgekk $ + ******************************************************************************/ +#if !defined _MACHWDCALIB_H +#define _MACHWDCALIB_H + +/****************************************************************************** + Includes section + ******************************************************************************/ +#include + +/****************************************************************************** + Definitions section + ******************************************************************************/ +/** Redefenition of RF calibration request function name. **/ +#define MACHWD_CalibrationReq RF_CalibrationReq + +/****************************************************************************** + Types section + ******************************************************************************/ +/** Redefenition of random generation request structure. **/ +typedef RF_CalibrationReq_t MACHWD_CalibrationReq_t; + +/****************************************************************************** + Prototypes section + ******************************************************************************/ +/**************************************************************************//** + \brief Request to perform PLL and FTN calibration. + + \param[in] reqParams - pointer to calibration parameters - callback and + confirmation status. + \return None. + ******************************************************************************/ +void MACHWD_CalibrationReq(MACHWD_CalibrationReq_t *reqParams); + +#endif /* _MACHWDCALIB_H */ +/** eof machwdCalib.h */ diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdData.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdData.h new file mode 100644 index 00000000..fa4e1c86 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdData.h @@ -0,0 +1,92 @@ +/*************************************************************************//** + \file machwdData.h + + \brief MACHWD data types types and function prototypes. + + \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: + 26/09/07 A. Mandychev - Created. +*****************************************************************************/ + +#ifndef _MACHWDDATA_H +#define _MACHWDDATA_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! Set of frame transmission statuses. +typedef enum +{ + MACHWD_DATA_PENDING_DATA_STATUS, + MACHWD_CHANNEL_ACCESS_FAIL_DATA_STATUS, + MACHWD_NO_ACK_DATA_STATUS, + MACHWD_SUCCESS_DATA_STATUS, +} MACHWD_DataStatus_t; + +//! MACHWD data confirm structure. +typedef struct +{ + //! Frame transmission status. + MACHWD_DataStatus_t status; +} MACHWD_DataConf_t; + +//! MACHWD data request structure. +typedef struct +{ + //! Service field - for internal needs. + MACHWD_Service_t service; + //! Description of the frame to be transmitted. + MAC_FrameDescr_t frameDescr; + //! Command to set trx state after transmitting frame. + MACHWD_TrxCmd_t trxCmdToSetAfterTransmitTrxState; + //! MACHWD data transmission confirm callback function's pointer. + void (*MACHWD_DataConf)(MACHWD_DataConf_t *confParams); + //! MACHWD confirm structure. + MACHWD_DataConf_t confirm; +} MACHWD_DataReq_t; + +//! MACHWD data indication structure. +typedef struct +{ + //! Received frame description. + MAC_FrameDescr_t frameDescr; +} MACHWD_DataInd_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MACHWD data request primitive's prototype. + \param reqParams - MACHWD data request's parameters' structure pointer. + \return none. +******************************************************************************/ +void MACHWD_DataReq(MACHWD_DataReq_t *reqParams); + +/**************************************************************************//** + \brief MACHWD data indication primitive's prototype. + \param indParams - MACHWD data indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MACHWD_DataInd(MACHWD_DataInd_t *indParams); + +#endif /* _MACHWDDATA_H */ + +// eof machwdData.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEd.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEd.h new file mode 100644 index 00000000..9cd339f7 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEd.h @@ -0,0 +1,61 @@ +/**************************************************************************//** + \file machwdEd.h + + \brief MACHWD energy detection types and function prototypes. + + \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/05/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDED_H +#define _MACHWDED_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! MACHWD energy detection confirm structure. +typedef struct +{ + PHY_EnergyLevel_t energyLevel; +} MACHWD_EdConf_t; + +//! MACHWD energy detection request structure. +typedef struct +{ + MACHWD_Service_t service; + // Callback pointer. + void (*MACHWD_EdConf)(MACHWD_EdConf_t *confParams); + // Confirm parameters. + MACHWD_EdConf_t confirm; +} MACHWD_EdReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Detects energy level on channel. + \param reqParams - MACHWD energy detection request structure pointer. + \return none. +******************************************************************************/ +void MACHWD_EdReq(MACHWD_EdReq_t *reqParams); + +#endif /* _MACHWDED_H */ + +// eof machwdEd.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEncrypt.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEncrypt.h new file mode 100644 index 00000000..4da3710b --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdEncrypt.h @@ -0,0 +1,51 @@ +/**************************************************************************//** + \file machwdEncrypt.h + + \brief Prototypes of ecnryption functions and corresponding types. + Note that encryption is supported only for RF231 and RF212. + + \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/01/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDENCRYPT_H +#define _MACHWDENCRYPT_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Redefenition of encryption request function name. +#define MACHWD_EncryptReq RF_EncryptReq + +/****************************************************************************** + Types section +******************************************************************************/ +//! Redefenition of encryption request structure. +typedef RF_EncryptReq_t MACHWD_EncryptReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Executes AES command. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void MACHWD_EncryptReq(MACHWD_EncryptReq_t *reqParams); + +#endif /*_MACHWDENCRYPT_H*/ + +// eof machwdEncrypt.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdMem.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdMem.h new file mode 100644 index 00000000..f094f0c5 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdMem.h @@ -0,0 +1,41 @@ +/****************************************************************************** + \file machwdMem.h + + \brief MACHWD memory type. + + \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). + + \brief + History: + 24/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDMEM_H +#define _MACHWDMEM_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +typedef struct +{ + FrameRxBufferState_t rxBufferState; +} MachwdMem_t; + +#endif /*_MACHWDMEM_H*/ + +// eof machwdMem.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdReset.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdReset.h new file mode 100644 index 00000000..d403355a --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdReset.h @@ -0,0 +1,32 @@ +/**************************************************************************//** + \file machwdReset.h + + \brief MACHWD reset types and function prototypes. + + \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: + 26/09/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDRESET_H +#define _MACHWDRESET_H + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Resets MAC_HWD_PHY layer. + \return none. +******************************************************************************/ +void MACHWD_Reset(void); + +#endif /* _MACHWDRESET_H */ + +// eof machwdReset.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdRnd.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdRnd.h new file mode 100644 index 00000000..ab551e89 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdRnd.h @@ -0,0 +1,58 @@ +/**************************************************************************//** + \file machwdRnd.h + + \brief MACHWD random generation types and function prototypes. + + \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: + 08/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDRND_H +#define _MACHWDRND_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Redefenition of random generation request function name. +#define MACHWD_RndReq RF_RandomReq +//! Redefenition of random seq generation request function name . +#define MACHWD_RndSeqReq RF_RandomSeqReq +/****************************************************************************** + Types section +******************************************************************************/ +//! Redefenition of random generation request structure. +typedef RF_RandomReq_t MACHWD_RndReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Requests random value. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void MACHWD_RndReq(MACHWD_RndReq_t *reqParams); + +/**************************************************************************//** + \brief Requests random seq. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void MACHWD_RndSeqReq(MACHWD_RndReq_t *reqParams); + +#endif /*_MACHWDRND_H*/ + +// eof machwdRnd.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdService.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdService.h new file mode 100644 index 00000000..76f96b46 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdService.h @@ -0,0 +1,57 @@ +/**************************************************************************//** + \file machwdService.h + + \brief Describes types' declarations for internal needs. + + \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: + 30/05/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDSERVISE_H +#define _MACHWDSERVISE_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include + +/****************************************************************************** + Types section. +******************************************************************************/ +//! Set of MACHWD request identifiers. +enum +{ + MACHWD_TX_DATA_REQ_ID, + MACHWD_SET_TRX_STATE_REQ_ID, + MACHWD_SET_REQ_ID, + MACHWD_ED_REQ_ID, +#ifdef _RF_AES_ + MACHWD_ENCRYPT_REQ_ID, +#endif +#ifdef _RF_BAT_MON_ + MACHWD_BAT_MON_REQ_ID, +#endif +#ifdef _RF_RND_ + MACHWD_RND_REQ_ID, + MACHWD_RND_REQ_F_ID, +#endif +#ifdef _RF_CALIBRATION_ + MACHWD_CALIBRATION_REQ_ID +#endif +}; + +//! Inherited service structure. +typedef MAC_Service_t MACHWD_Service_t; + +#endif /* _MACHWDSERVISE_H */ + +// eof machwdService.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSet.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSet.h new file mode 100644 index 00000000..7b1909e3 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSet.h @@ -0,0 +1,94 @@ +/**************************************************************************//** + \file machwdSet.h + + \brief MACHWD set types and function prototypes. + + \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: + 26/09/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDSET_H +#define _MACHWDSET_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Start point for Atmel own identifier counting. +#define MACHWD_ATMEL_RESERVED_ID 0xF0 + +/****************************************************************************** + Types section +******************************************************************************/ +//! MACHWD PIB identifiers. +typedef enum +{ + // PHY id. + MACHWD_PIB_CURRENT_CHANNEL_ID = PHY_PIB_CURRENT_CHANNEL_ID, + MACHWD_PIB_TRANSMIT_POWER_ID = PHY_PIB_TRANSMIT_POWER_ID, + MACHWD_PIB_CCA_MODE_ID = PHY_PIB_CCA_MODE_ID, + MACHWD_PIB_CURRENT_PAGE_ID = PHY_PIB_CURRENT_PAGE_ID, + // MAC id. + MACHWD_PIB_MAX_CSMA_BACKOFFS_ID = MAC_PIB_MAX_CSMA_BACKOFFS_ID, + MACHWD_PIB_PANID_ID = MAC_PIB_PANID_ID, + MACHWD_PIB_SHORT_ADDR_ID = MAC_PIB_SHORT_ADDR_ID, + MACHWD_PIB_MIN_BE_ID = MAC_PIB_MIN_BE_ID, + MACHWD_PIB_MAX_FRAME_RETRIES_ID = MAC_PIB_MAX_FRAME_RETRIES_ID, + MACHWD_PIB_EXT_ADDR_ID = MAC_PIB_EXT_ADDR_ID, + // Additional id for software needs. + MACHWD_PIB_RF_IRQ_DISABLE_ID = MACHWD_ATMEL_RESERVED_ID, + MACHWD_PIB_BEACON_RX_MODE_ID = MACHWD_ATMEL_RESERVED_ID + 1, + // Additional id for hardware needs. + MACHWD_PIB_PAN_COORDINATOR_ID = MACHWD_ATMEL_RESERVED_ID + 2, +} MACHWD_PibId_t; + +//! MACHWD PIB attribute type. +typedef union +{ + MAC_PibAttr_t macPib; + PHY_PibAttr_t phyPib; + bool panCoordinator; + bool rfIrqDisable; + bool beaconRxMode; +} MACHWD_PibAttr_t; + +//! MACHWD set request structure. +typedef struct +{ + //! Service field - for internal needs. + MACHWD_Service_t service; + //! MACHWD PIB identifier. + MACHWD_PibId_t id; + //! MACHWD PIB attribute. + MACHWD_PibAttr_t attr; + // MACHWD set confirm callback function's pointer. + void (*MACHWD_SetConf)(void); +} MACHWD_SetReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Sets MACHWD attributes. + \param reqParams - MACHWD set request structure pointer. + \return none. +******************************************************************************/ +void MACHWD_SetReq(MACHWD_SetReq_t *reqParams); + +#endif /* _MACHWDSET_H */ + +// eof machwdSet.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSetTrx.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSetTrx.h new file mode 100644 index 00000000..7c0ac92c --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/MAC_HWD_PHY/include/machwdSetTrx.h @@ -0,0 +1,65 @@ +/**************************************************************************//** + \file machwdSetTrx.h + + \brief MACHWD transcivier control types and function prototypes. + + \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: + 26/09/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACHWDSETTRX_H +#define _MACHWDSETTRX_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! Set of commands to control radio transcivier. +typedef enum +{ + MACHWD_TX_ON_CMD, + MACHWD_RX_ON_CMD, + MACHWD_TRX_OFF_CMD, +} MACHWD_TrxCmd_t; + +//! Set TRX state request structure. +typedef struct +{ + //! Service field - for internal needs. + MACHWD_Service_t service; + //! Command to chnage the trancivier current state. + MACHWD_TrxCmd_t trxCmd; + // MACHWD set trx state confirm callback function's pointer. + void (*MACHWD_SetTrxStateConf)(void); +} MACHWD_SetTrxStateReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Set trx state. + \param reqParams - MACHWD set trx state request structure pointer. + \return none. +******************************************************************************/ +void MACHWD_SetTrxStateReq(MACHWD_SetTrxStateReq_t *reqParams); + +#endif /* _MACHWDSETTRX_H */ + +// eof machwdSetTrx.h 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 + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include +#include +#include + + +/****************************************************************************** + 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 +#include +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/****************************************************************************** + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include +#include + +/****************************************************************************** + 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 + + +/****************************************************************************** + 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 + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include +#include + +/****************************************************************************** + 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 +#include + +/****************************************************************************** + 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 +#include +#include +#include +#include + +/****************************************************************************** + 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 diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/mac.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/mac.h new file mode 100644 index 00000000..368c0d9a --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/mac.h @@ -0,0 +1,51 @@ +/**************************************************************************//** + \file mac.h + + \brief IEEE 802.15.4-2006 public headers files' union. + + \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 _MAC_H +#define _MAC_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif //_MAC_H + +// eof mac.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAddr.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAddr.h new file mode 100644 index 00000000..c9ff0ccb --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAddr.h @@ -0,0 +1,85 @@ +/**************************************************************************//** + \file macAddr.h + + \brief MAC addressing types and constants. + + \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 _MACADDR_H +#define _MACADDR_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section. +******************************************************************************/ +#define MAC_BROADCAST_PANID 0xFFFFU ///< Broadcast PANID. +#define MAC_BROADCAST_SHORT_ADDR 0xFFFFU ///< Broadcast short address, no association. +#define MAC_NO_SHORT_ADDR 0xFFFEU ///< After association no short address. +#define MAC_NO_EXT_ADDR 0x00ULL + +/****************************************************************************** + Types section. +******************************************************************************/ +typedef uint16_t PanId_t; ///< PAN identifier type declaration. +typedef uint16_t ShortAddr_t; ///< Short address type declaration. +typedef uint64_t ExtAddr_t; ///< Extended address type declaration. + +/// Union of possible MAC address types. +typedef union +{ + ShortAddr_t sh; + ExtAddr_t ext; +} MAC_Addr_t; + +//! MAC address mode types (IEEE 802.15.4-2006 Table 80). + typedef enum +{ + MAC_NO_ADDR_MODE = 0x00, + MAC_RSRV_ADDR_MODE = 0x01, + MAC_SHORT_ADDR_MODE = 0x02, + MAC_EXT_ADDR_MODE = 0x03 +} MAC_AddrMode_t; + +/****************************************************************************** + Definitions section. +******************************************************************************/ +#if defined UINT64_MEMCMP + #define IS_EQ_EXT_ADDR(A, B) (0 == memcmp(&(A), &(B), sizeof(uint64_t))) + #define IS_CORRECT_EXT_ADDR(A) isCorrectExtAddr((const uint8_t *)&A) + #define COPY_EXT_ADDR(DST, SRC) __builtin_memcpy(&(DST), &(SRC), sizeof(uint64_t)) +#else + #define IS_EQ_EXT_ADDR(A, B) ((A) == (B)) + #define IS_CORRECT_EXT_ADDR(A) (MAC_NO_EXT_ADDR != (A)) + #define COPY_EXT_ADDR(DST, SRC) (DST) = (SRC) +#endif + +/****************************************************************************** + Inline static functions prototypes section +******************************************************************************/ +INLINE bool isCorrectExtAddr(const uint8_t *extAddr) +{ + uint8_t i = 0U; + + do + if (extAddr[i]) return true; + while (++i < sizeof(uint64_t)); + return false; +} + +#endif //_MACADDR_H + +// eof macAddr.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAffix.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAffix.h new file mode 100644 index 00000000..3f5427ff --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAffix.h @@ -0,0 +1,48 @@ +/**************************************************************************//** + \file macAffix.h + + \brief MAC frames' header and footer size constants. + + \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 _MACAFFIX_H +#define _MACAFFIX_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Defines section +******************************************************************************/ +//! aMaxMACPayloadSize (IEEE 802.15.4-2006 Table 85). +#define MAC_MAX_MSDU_SIZE (PHY_MAX_PACKET_SIZE - MAC_MAX_MPDU_UNSECURED_OVERHEAD) +//! aMaxBeaconOverhead (IEEE 802.15.4-2006 Table 85). +#define MAC_MAX_BEACON_HEADER_LENGTH MAC_MAX_BEACON_OVERHEAD +//! aMaxMPDUUnsecuredOverhead (IEEE 802.15.4-2006 Table 85). +#define MAC_MAX_DATA_FRAME_HEADER_LENGTH MAC_MAX_MPDU_UNSECURED_OVERHEAD +/** + * \brief MAC footer length in common frame buffer. + * It has zero length becouse FCS is calculated by RF chip. MAC does't has to + * reserve bytes to allocate it's footer. + */ +#define MAC_MAX_DATA_FRAME_FOOTER_LENGTH 0U +//! Offset in common frame buffer for allocating MPDU. +#define MAC_MSDU_OFFSET MAC_MAX_MPDU_UNSECURED_OVERHEAD +//! MAC affix. +#define MAC_AFFIX_LENGTH (MAC_MAX_MPDU_UNSECURED_OVERHEAD + MAC_MAX_DATA_FRAME_FOOTER_LENGTH) + +#endif /* _MACAFFIX_H */ + +// eof macAffix.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAssociate.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAssociate.h new file mode 100644 index 00000000..68779d54 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macAssociate.h @@ -0,0 +1,154 @@ +/**************************************************************************//** + \file macAssociate.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + association 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 _MACASSOCIATE_H +#define _MACASSOCIATE_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include +#include +#include + +/****************************************************************************** + Definitions section. +******************************************************************************/ + +/****************************************************************************** + Types section. +******************************************************************************/ +/** + \brief MAC capability information field. + IEEE 802.15.4-2006 7.3.1.2 Capability Information field. +*/ +BEGIN_PACK +typedef struct PACK +{ + LITTLE_ENDIAN_OCTET(7, ( + uint8_t alternatePANCoordinator : 1, + uint8_t deviceType : 1, + uint8_t powerSource : 1, + uint8_t rxOnWhenIdle : 1, + uint8_t reserved : 2, + uint8_t securityCapability : 1, + uint8_t allocateAddress : 1 + )) +} MAC_CapabilityInf_t; +END_PACK + +/** + \brief MLME-ASSOCIATE confirm primitive's parameters structure declaration. + IEEE 802.15.4-2006 7.1.3.4 MLME-ASSOCIATE.confirm. +*/ +typedef struct +{ + //! The short device address allocated by the coordinator on successful association. + ShortAddr_t shortAddr; + //! The extended device address of coordinator wich allocated short address. + //! It's additional parameter, not included in IEEE 802.15.4. + ExtAddr_t extAddr; + //! The status of the association attempt. + MAC_Status_t status; +} MAC_AssociateConf_t; + +/** + \brief MLME-ASSOCIATE request primitive's parameters structure declaration. + IEEE 802.15.4-2006 7.1.3.1 MLME-ASSOCIATE.request. +*/ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The logical channel on which to attempt association. + uint8_t channel; + //! The channel page on which to attempt association. + uint8_t page; + //! The coordinator addressing mode for this primitive. + MAC_AddrMode_t coordAddrMode; + //! The identifier of the PAN with which to associate. + PanId_t coordPANId; + //! The address of the coordinator with which to associate. + MAC_Addr_t coordAddr; + //! Specifies the operational capabilities of the associating device. + MAC_CapabilityInf_t capability; + //! MLME-ASSOCIATE confirm callback fubction's pointer. + void (*MAC_AssociateConf)(MAC_AssociateConf_t *conf); + //! MLME-ASSOCIATE confirm parameters' structure. + MAC_AssociateConf_t confirm; +} MAC_AssociateReq_t; + +/** + \brief MLME-ASSOCIATE indication primitive's parameters. + IEEE 802.15.4-2006 7.1.3.2 MLME-ASSOCIATE.indication. +*/ +typedef struct +{ + //! The address of the device requesting association. + ExtAddr_t extAddr; + //! The operational capabilities requesting association. + MAC_CapabilityInf_t capability; +} MAC_AssociateInd_t; + +/** + \brief MLME-ASSOCIATE response pritive's parameters. + IEEE 802.15.4-2006 7.1.3.3 MLME-ASSOCIATE.response. +*/ +typedef struct +{ + //! Service field - for internal needs. + MAC_ServiceTransaction_t service; + //! The address of the device requesting association. + ExtAddr_t extAddr; + //! The 16-bit short device address allocated by the coordinator on successful association. + ShortAddr_t shortAddr; + //! The status of the association attempt. + MAC_Status_t status; + //! MLME-COMM STATUS callback function's pointer. + void (*MAC_CommStatusInd)(MAC_CommStatusInd_t *commStat); + //! Comm staus parameters' structure. + MAC_CommStatusInd_t commStatus; +} MAC_AssociateResp_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-ASSOCIATE request primitive's prototype. + \param reqParams - MLME-ASSOCIATE request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_AssociateReq(MAC_AssociateReq_t *reqParams); + +/**************************************************************************//** + \brief MLME-ASSOCIATE indication primitive's prototype. + \param indParams - MLME-ASSOCIATE indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_AssociateInd(MAC_AssociateInd_t *indParams); + +/**************************************************************************//** + \brief MLME-ASSOCIATE response primitive's prototype. + \param respParams - MLME-ASSOCIATE response parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_AssociateResp(MAC_AssociateResp_t *respParams); + +#endif //_MACASSOCIATE_H +// eof macAssociate.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBanNode.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBanNode.h new file mode 100644 index 00000000..e187792d --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBanNode.h @@ -0,0 +1,121 @@ +/**************************************************************************//** + \file macBanNode.h + + \brief Interface of the ban node functionality. + + \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: + 29/03/10 M. Gekk - Created. + 18/05/10 A. Luzhetsky - link cost control is added + ******************************************************************************/ +#ifndef _MAC_BAN_NODE_H +#define _MAC_BAN_NODE_H + +/****************************************************************************** + Includes section + ******************************************************************************/ +#include + +/****************************************************************************** + Definitions section + ******************************************************************************/ +#define LINK_COST_VALUE_NODE_BANNED 0xFF + +/****************************************************************************** + Types section + ******************************************************************************/ +/** Type of node ban table entry. */ +typedef struct _MAC_BanTableEntry_t +{ + /* Short address of the banned node. */ + ShortAddr_t shortAddr; + /* IEEE address of the banned node. */ + ExtAddr_t extAddr; + /* Link cost to be used for all messages from the node. */ + /* Valid range to correct the link cost (not to ban the node): 1 - 7 */ + /* Use link cost value LINK_COST_VALUE_NODE_BANNED to ban the node */ + uint8_t cost; +} MAC_BanTableEntry_t; + +/** Type of the ban table size. */ +typedef uint8_t MAC_BanTableSize_t; +/** Type of a ban entry index. */ +typedef MAC_BanTableSize_t MAC_BanTableIndex_t; + +/** Type of the ban node table. */ +typedef struct _MAC_BanTable_t +{ + /* Current size of the ban node table. */ + MAC_BanTableSize_t size; + /* Pointer to the first entry of the ban table. */ + MAC_BanTableEntry_t *entry; + /* Index of the oldest banned node. */ + MAC_BanTableIndex_t oldBannedNode; + /* Ban all nodes by default (true) or not (false). After reset this attribute + * is equal to false. */ + bool banAll; +} MAC_BanTable_t; + +/****************************************************************************** + Prototypes section + ******************************************************************************/ +/**************************************************************************//** + \brief Ban any frame from the node or correct link cost for all the frames + from the node. + + \param shortAddr - short address of the node affected. + If the short address of banned node is unknown then pass MAC_NO_SHORT_ADDR. + \param extAddr - extended address of the node affetced. + If the extended address of banned node is unknown then pass 0. + \param cost - link cost value for all the frames received from the node. + If node shall be baned - use link cost value LINK_COST_VALUE_NODE_BANNED. + + \return None. + ******************************************************************************/ +void MAC_BanNode(const ShortAddr_t shortAddr, const ExtAddr_t extAddr, + const uint8_t cost); + +/**************************************************************************//** + \brief Set global flag banAll + + \param banAll - ban all nodes by default or not. + + \return None. + ******************************************************************************/ +void MAC_BanAllNodes(const bool banAll); + +/**************************************************************************//** + \brief Is given short address banned or not. + + \param shortAddr - short address of the banned node. + \param lqi - frame lqi pointer to be corrected if it is needed. + + \return 'true' if the node is banned otherwise return 'false'. + ******************************************************************************/ +bool MAC_IsBannedShortAddr(const ShortAddr_t shortAddr, uint8_t *const lqi); + +/**************************************************************************//** + \brief Is given extended addresss banned or not. + + \param extAddr - extended address of the banned node. + \param lqi - frame lqi pointer to be corrected if it is needed. + + \return 'true' if the node is banned otherwise return 'false'. + ******************************************************************************/ +bool MAC_IsBannedExtAddr(const ExtAddr_t extAddr, uint8_t *const lqi); + +/****************************************************************************** + \brief Reload from the config server and reset the ban table. + ******************************************************************************/ +void MAC_ResetBanTable(void); + +#endif /* _MAC_BAN_NODE_H */ +/** eof macBanNode.h */ + diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBeacon.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBeacon.h new file mode 100644 index 00000000..457d301b --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBeacon.h @@ -0,0 +1,108 @@ +/**************************************************************************//** + \file macBeacon.h + + \brief Beacon specific types declarations and prototypes. + + \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 _MACBEACON_H +#define _MACBEACON_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include + +/****************************************************************************** + Definitions section. +******************************************************************************/ +#define MAC_MAX_PENDING_ADDRESS_COUNT 7 +#define MAC_FINAL_CAP_SLOT 15 + +/****************************************************************************** + Types section. +******************************************************************************/ +/** + \brief Pending address specification fields. + IEEE 802.15.4-2006 7.2.2.1.6 Pending Address Specification field. +*/ +BEGIN_PACK +typedef struct PACK +{ + LITTLE_ENDIAN_OCTET(4, ( + uint8_t shortAddrNum : 3, + uint8_t reserved1 : 1, + uint8_t extAddrNum : 3, + uint8_t reserved2 : 1 + )) +} MAC_PendingAddrSpec_t; +END_PACK + +/** + \brief PAN descriptor. + IEEE 802.15.4-2006 Table 55. +*/ +typedef struct +{ + MAC_AddrMode_t coordAddrMode; + PanId_t coordPANId; + MAC_Addr_t coordAddr; + uint8_t channel; + uint8_t page; + MAC_SuperframeSpec_t superframeSpec; + bool gtsPermit; + uint8_t quality; + int8_t rssi; // Additional parameter (NOT described in the standard) + // RSSI value while beacon frame receiving procedure. + uint32_t timeStamp; +} MAC_PanDescriptor_t; + +/** + \brief Parameters of BEACON indication. + IEEE 802.15.4-2006 7.1.5.1 MLME-BEACON-NOTIFY.indication. +*/ +typedef struct +{ + //! The beacon sequence number. + uint8_t bsn; + //! The PANDescriptor for the received beacon. + MAC_PanDescriptor_t panDescr; + //! The beacon pending address specification. + MAC_PendingAddrSpec_t pendAddrSpec; + //! List of short addresses. + ShortAddr_t (*shortPendAddrList)[]; + //! List of extended addresses. + ExtAddr_t (*extPendAddrList)[]; + //! The number of octets contained in the beacon payload of the beacon frame + //! received by the MAC sublayer. + uint8_t msduLength; + //! The set of octets comprising the beacon payload to be transferred from the + //! MAC sublayer entity to the next higher layer. + uint8_t *msdu; +} MAC_BeaconNotifyInd_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-BEACON_NOTIFY indication primitive's prototype. + \param indParams - MLME-BEACON_NOTIFY indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_BeaconNotifyInd(MAC_BeaconNotifyInd_t *indParams); + +#endif //_MACBEACON_H + +// eof macBeacon.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBuffers.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBuffers.h new file mode 100644 index 00000000..b05be87f --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macBuffers.h @@ -0,0 +1,54 @@ +/**************************************************************************//** + \file macBuffers.h + + \brief MAC and PHY buffers' 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: + 09/10/07 A. Luzhetsky - Created. +******************************************************************************/ + +#ifndef _MACBUFFERS_H +#define _MACBUFFERS_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Size of internal reception buffer. +#define FRAME_RX_BUFFER_SIZE (PHY_FRAME_LENGTH_FIELD_SIZE + \ + PHY_MAX_PACKET_SIZE + \ + PHY_LQI_FIELD_SIZE + \ + PHY_RSSI_FIELD_SIZE) + +/****************************************************************************** + Types section +******************************************************************************/ +//! Rx frame buffer state descriptor. +typedef struct +{ + uint8_t *buffer; + uint8_t *reserved; + uint8_t *gap1b; + uint8_t *gap1e; + uint8_t *gap2b; + uint8_t *gap2e; +} FrameRxBufferState_t; + +#endif // _MACBUFFERS_H + +// eof macBuffers.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommStatus.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommStatus.h new file mode 100644 index 00000000..770ab148 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommStatus.h @@ -0,0 +1,64 @@ +/**************************************************************************//** + \file macCommStatus.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + comm status 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 _MACCOMMSTATUS_H +#define _MACCOMMSTATUS_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include + +/****************************************************************************** + Definitions section. +******************************************************************************/ + +/****************************************************************************** + Types section. +******************************************************************************/ + +/** + * \brief MLME-COMM_STATUS indication primitive's parameters. + * IEEE 802.15.4-2006 7.1.12.1 MLME-COMM-STATUS.indication. +*/ +typedef struct +{ + //! The 16-bit PAN identifier of the device from which the frame was received + //! or to which the frame was being sent. + PanId_t panId; + //! The source addressing mode for this primitive. + MAC_AddrMode_t srcAddrMode; + //! The individual device address of the entity from which the frame causing + //! the error originated. + MAC_Addr_t srcAddr; + //! The destination addressing mode for this primitive. + MAC_AddrMode_t dstAddrMode; + //! The individual device address of the device for which the frame was intended. + MAC_Addr_t dstAddr; + //! The communications status. + MAC_Status_t status; +} MAC_CommStatusInd_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +#endif //_MACCOMMSTATUS_H + +// eof macCommStatus.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommon.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommon.h new file mode 100644 index 00000000..fecb1f6f --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macCommon.h @@ -0,0 +1,90 @@ +/**************************************************************************//** + \file macCommon.h + + \brief Declarations of common MAC layer fields and types. + + \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 _MACCOMMON_H +#define _MACCOMMON_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include + +/****************************************************************************** + Definitions section. +******************************************************************************/ +//! MAC primitives' return codes. +typedef enum +{ + // IEEE802.15.4 table - 83. + MAC_PAN_AT_CAPACITY_STATUS = 0x01, + MAC_PAN_ACCESS_DENIED_STATUS = 0x02, + // IEEE802.15.4 table - 78. + MAC_SUCCESS_STATUS = 0x00, + MAC_BEACON_LOSS_STATUS = 0xE0, + MAC_CHANNEL_ACCESS_FAILURE_STATUS = 0xE1, + MAC_DENIED_STATUS = 0xE2, + MAC_DISABLE_TRX_FAILURE_STATUS = 0xE3, + MAC_FRAME_TOO_LONG_STATUS = 0xE5, + MAC_INVALID_GTS_STATUS = 0xE6, + MAC_INVALID_HANDLE_STATUS = 0xE7, + MAC_INVALID_PARAMETER_STATUS = 0xE8, + MAC_NO_ACK_STATUS = 0xE9, + MAC_NO_BEACON_STATUS = 0xEA, + MAC_NO_DATA_STATUS = 0xEB, + MAC_NO_SHORT_ADDRESS_STATUS = 0xEC, + MAC_PAN_ID_CONFLICT_STATUS = 0xEE, + MAC_REALIGNMENT_STATUS = 0xEF, + MAC_TRANSACTION_EXPIRED_STATUS = 0xF0, + MAC_TRANSACTION_OVERFLOW_STATUS = 0xF1, + MAC_TX_ACTIVE_STATUS = 0xF2, + MAC_UNSUPPORTED_ATTRIBUTE_STATUS = 0xF4, + MAC_INVALID_ADDRESS_STATUS = 0xF5, + MAC_INVALID_INDEX_STATUS = 0xF9, + MAC_LIMIT_REACHED_STATUS = 0xFA, ///< There are some unscanned channels yet, but there is no memory. + MAC_ON_TIME_TOO_LONG_STATUS = 0xF6, + MAC_PAST_TIME_STATUS = 0xF7, + MAC_READ_ONLY_STATUS = 0xFB, + MAC_SCAN_IN_PROGRESS_STATUS = 0xFC, + MAC_SUPERFRAME_OVERLAP_STATUS = 0xFD, + MAC_TRACKING_OFF_STATUS = 0xF8 +} MAC_Status_t; + +/****************************************************************************** + Types section. +******************************************************************************/ +//! Internal service fields which give us opportunity to compose requests' queue. +typedef struct +{ + void *next; + uint8_t requestId; +} MAC_Service_t; + +/** + * \brief Internal service fields which give us opportunity to compose and to serve + * transactions frame queue. +*/ +typedef struct +{ + void *next; + uint8_t requestId; + uint32_t ttl; + bool activated; +} MAC_ServiceTransaction_t; + +#endif //_MACCOMMON_H + +// eof macCommon.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macData.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macData.h new file mode 100644 index 00000000..2110e04c --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macData.h @@ -0,0 +1,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 +#include + + +/****************************************************************************** + 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 diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDbg.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDbg.h new file mode 100644 index 00000000..049fbbbf --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDbg.h @@ -0,0 +1,210 @@ +/********************************************************************************* + \file macDbg.h + + \brief Assert's code are located here. + + \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/11/07 A. Mandychev - Created. +**********************************************************************************/ +#ifndef _MACDBG_H +#define _MACDBG_H + +/********************************************************************************* + ASSERT is used for debugging wrong conditions + + Types of messages: + + +*********************************************************************************/ + +/*************************************************************** + Defines with 1 in the high-order bit should not be used as enum is signed int type +***************************************************************/ +typedef enum +{ + /*********************************** + MAC & PHY section. Range 0x1000 - 0x1FFFF + ***********************************/ + // PHY asserts' ID. + PHYRFIRQDISPATCHER_RFINTERRUPTSUBROUTINE_0 = 0x1001, + PHYTXFRAME_DATAREQ_0 = 0x1002, + PHYPIB_PHYSETPIBPARAM_0 = 0x1003, + PHYPIB_PHYGETPIBPARAM_0 = 0x1004, + PHYTXFRAME_PHYDATAREQ_0 = 0x1005, + PHYRXFRAME_PHYDOWNLOADFRAME_0 = 0x1006, + MACPHYMACENV_GETSYMBOLPEROCTET_0 = 0x1007, + MACPHYMACENV_GETPHYSYMBOLDURATION_0 = 0x1008, + PHYSET_PHYSETREQ_0 = 0x1009, + PHYSETTRXSTATE_PHYSETTRXSTATEREQ_0 = 0x100A, + PHYRFSPIPROTO_PHYENCRYPTBYSPI_0 = 0x100B, + MACPHYPIBSERVER_STORETXPOWER_0 = 0x100C, + PHYSET_CONVERTTXPOWER_0 = 0x100D, + PHYSET_PHYSETREQ_1 = 0x100E, + MACPHYMACENV_SETPIBATTR_0 = 0x100F, + MACPHYMACENV_GETPIBATTR_0 = 0x1010, + HALMACISRC_DISPATHRTIMEREVENT_0 = 0x1011, + PHYRFTXRX_CANNOT_BE_ENABLED = 0x1012, + PHYRFTXRX_CANNOT_BE_DISABLED = 0x1013, + PHYRFIRQDISPATCHER_WRONGSTATE_0 = 0x1014, + PHYRFIRQDISPATCHER_WRONGSTATE_1 = 0x1015, + PHYSET_PHYSETREQ_2 = 0x1016, + PHYANTEXTSW_CANNOT_BE_ENABLED = 0x1017, + PHYANTEXTSW_CANNOT_BE_DISABLED = 0x1018, + + PHYRFIRQ_UNREASONABLE_IRQ = 0x1019, + PHYRFIRQ_UNKNOWN_RX_STATUS = 0x101A, + PHYRFIRQ_UNKNOWN_TX_STATUS = 0x101B, + PHYRFIRQ_OTHER_IRQ = 0x101C, + PHYRF_EXTRA_RX_FRAME = 0x101D, + + // MAC_HWD asserts' ID. + MACHWDFRAMEROUTINE_MACHWDCOMPOSEFRAME_0 = 0x1021, + MACHWDPIB_MACHWDGETPIBPARAM_0 = 0x1022, + MACHWDGETHANDLER_MACHWDGETREQHANDLER_0 = 0x1023, + MACHWDRXFRAMEHANDLER_GETCURRENTCHANNEL_0 = 0x1024, + MACHWDMANAGER_TASKHANDLER_0 = 0x1025, + MACHWDMANAGER_TASKHANDLER_1 = 0x1026, + MACHWDMANAGER_TASKHANDLER_2 = 0x1027, + MACHWDMANAGER_SENDREQTOHANDLER_0 = 0x1028, + MACHWDMANAGER_DISPATCHETASKTOHANDLER_0 = 0x1029, + MACHWDEDHNDLR_MACHWDEDHANDLER_0 = 0x102A, + MACHWDEDHNDLR_MACHWDEDHANDLER_1 = 0x102B, + MACHWDEDHNDLR_MACHWDEDTASKHANDLER_0 = 0x102C, + MACHWDTRXHANDLER_MACHWDTRXREQHANDLER_0 = 0x102D, + MACHWDTRXHANDLER_TRXTASKHANDLER_0 = 0x102E, + MACHWDSETHANDLER_MACHWDSETREQHANDLER_0 = 0x102F, + MACHWDSETHANDLER_MACHWDSETREQHANDLER_1 = 0x1030, + MACHWDSETHANDLER_MACHWDSETTASKHANDLER_0 = 0x1031, + MACHWDSETHANDLER_MACHWDSETTASKHANDLER_1 = 0x1032, + MACHWDSETHANDLER_EXECUTESETREQ_0 = 0x1033, + MACHWDSETHANDLER_EXECUTEPHYSETREQ_0 = 0x1034, + MACHWDSETHANDLER_SETRXONSTATE_0 = 0x1035, + MACHWDTXFRAMEHANDLER_MACHWDTXFRAMEREQHANDLER_0 = 0x1036, + MACHWDTXFRAMEHANDLER_MACHWDTXFRAMETASKHANDLER_0 = 0x1037, + MACHWDTXFRAMEHANDLER_EXECUTEPHYDATAREQ_0 = 0x1038, + MACHWDTXFRAMEHANDLER_SETRXONSTATE_0 = 0x1039, + MACHWDRESETHANDLER_MACHWDRESETREQHANDLER_0 = 0x1040, + MACHWDTXFRAMEHANDLER_EXECUTEDATAREQ_0 = 0x1041, + MACHWDTXFRAMEHANDLER_MACHWDTXFRAMETASKHANDLER_1 = 0x1042, + MACHWDGETHANDLER_MACHWDGETREQHANDLER_1 = 0x1043, + MACHWDSETHANDLER_MACHWDSETREQHANDLER_2 = 0x1044, + MACHWDTRXCTRL_GETPHYTRXCMD_0 = 0x1045, + MACHWDTRXCTRL_CONVERTTRXCMDTOTRXSTATE_0 = 0x1046, + MACHWDEDHANDLER_MACHWDEDREQHANDLER_2 = 0x1047, + MACHWDTXFRAMEHANDLER_GETDATASTATUS_0 = 0x1048, + MACHWDENCRYPTHANDLER_MACHWDENCRYPTREQHANDLER_0 = 0x1049, + MACHWDENCRYPTHANDLER_MACHWDENCRYPTREQHANDLER_1 = 0x104A, + MACHWDENCRYPTHANDLER_MACHWDENCRYPTTASKHANDLER_0 = 0x104B, + MACHWDRNDHANDLER_MACHWDRNDREQHANDLER_0 = 0x104C, + MACHWDRNDHANDLER_MACHWDRNDREQHANDLER_1 = 0x104D, + MACHWDRNDHANDLER_MACHWDRNDTASKHANDLER_0 = 0x104E, + MACHWDBATMONHANDLER_MACHWDBATMONREQHANDLER_0 = 0x104F, + MACHWDBATMONHANDLER_MACHWDBATMONREQHANDLER_1 = 0x1050, + MACHWDBATMONHANDLER_MACHWDBATMONTASKHANDLER_0 = 0x1051, + MACHWDBATMONHANDLER_MACHWDBATMONTASKHANDLER_1 = 0x1052, + MACHWDTRXCTRL_CONVERTTRXSTATETOTRXCMD_0 = 0x1053, + MACHWDRXBUFFER_CHECKBUFFERSPACE_0 = 0x1054, + MACHWDRXBUFFER_COMMITRXBUFFER_0 = 0x1055, + MACHWDRXBUFFER_ROLLBACKRXBUFFER_0 = 0x1056, + MACHWDRXBUFFER_GETBUFFER_0 = 0x1057, + MACHWDRXBUFFER_NEXTBUFFER_0 = 0x1058, + MACHWDRXBUFFER_NEXTBUFFER_1 = 0x1059, + MACHWDRNDHANDLER_MACHWDCALIBREQHANDLER_0 = 0x1060, + MACHWDRNDHANDLER_MACHWDCALIBREQHANDLER_1 = 0x1061, + MACHWDCALIBHANDLER_MACHWDCALIBTASKHANDLER_0 = 0x1062, + + // MAC_HWI asserts' ID. + MACHWIDATAHANDLER_CONVERTMACHWDDATACONFIRMTYPES_0 = 0x1080, + MACHWIMANAGER_SENDREQTOHANDLER_0 = 0x1083, + MACHWIMANAGER_TASKHANDLER_0 = 0x1084, + MACHWIMANAGER_TASKHANDLER_1 = 0x1085, + MACHWISCANHANDLER_MACHWDSETCONFIRM_0 = 0x1086, + MACHWISCANHANDLER_MACHWDSETCONFIRM_1 = 0x1087, + MACHWISCANHANDLER_MACHWIBEACONINDICATION_0 = 0x1088, + MACHWIASSOCIATEHANDLER_MACHWDSETCONFIRM_0 = 0x1089, + MACHWIASSOCIATEHANDLER_MACHWDSETTRXSTATECONFIRM_0 = 0x108A, + MACHWIASSOCIATEHANDLER_MACHWDDATACONFIRM_0 = 0x108B, + MACHWIASSOCIATEHANDLER_MACHWDDATACONFIRM_1 = 0x108C, + MACHWIASSOCIATEHANDLER_MACHWDDATACONFIRM_2 = 0x108D, + MACHWIASSOCIATEHANDLER_ASSOCIATETIMERFIRED_0 = 0x108E, + MACHWITRANSACTIONQUEUE_GETDSTADDRINFO_0 = 0x108F, + MACHWITRANSACTIONQUEUE_GETDSTADDRINFO_1 = 0x1090, + MACHWITRANSACTIONHANDLER_MACHWDDATACONFIRM_0 = 0x1091, + MACHWITRANSACTIONHANDLER_MACHWDDATACONFIRM_1 = 0x1092, + MACHWITRANSACTIONHANDLER_SENDTRANSACTIONEVENT_0 = 0x1093, + MACHWITRANSACTIONHANDLER_SENDTRANSACTIONEVENT_1 = 0x1094, + MACHWITRANSACTIONQUEUE_GETACTIVATEDTRANSACTION_0 = 0x1095, + MACHWISTARTHANDLER_MACHWDSETCONFIRM_0 = 0x1096, + MACHWISTARTHANDLER_MACHWDSETCONFIRM_1 = 0x1097, + MACHWISCANHANDLER_MACHWDSETTRXSTATECONFIRM_0 = 0x1098, + MACHWIPOLLHANDLER_MACHWDDATACONFIRM_0 = 0x1099, + MACHWIPOLLHANDLER_ISITREQUESTEDDATA_0 = 0x109A, + MACHWISCANHANDLER_MACHWDSETTRXSTATECONFIRM_1 = 0x109B, + MACHWISCANHANDLER_MACHWDSETTRXSTATECONFIRM_2 = 0x109C, + MACHWISCANHANDLER_MACHWISCANREQHANDLER_0 = 0x109D, + MACHWISCANHANDLER_MACHWDSETCONFIRM_2 = 0x109E, + MACHWISCANHANDLER_MACHWDSETCONFIRM_3 = 0x109F, + MACHWISCANHANDLER_MACHWDSETCONFIRM_4 = 0x10A0, + MACHWIDISASSOCIATEHANDLER_MACHWDDATACONFIRM_0 = 0x10A1, + MACHWISWITCHRXCTRL_SWITCHRXONWHENIDLE_0 = 0x10A2, + MACHWIMANAGER_MACHWISENDCONFTOUPPERLAYER_0 = 0x10A3, + MACHWISETHANDLER_MACHWDSETCONFIRM_0 = 0x10A4, + MACHWIGETHANDLER_MACHWDGETCONFIRM_0 = 0x10A5, + MACHWISTARTHANDLER_MACHWISTARTREQHANDLER_0 = 0x10A6, + MACHWIRESETHANDLER_MACHWDSETCONFIRM_0 = 0x10A7, + MACHWIDISASSOCIATEHANDLER_MACHWDSETCONFIRM_0 = 0x10A8, + MACHWISTARTHANDLER_MACHWDDATACONFIRM_0 = 0x10A9, + MACHWIENCRYPTHANDLER_MACHWISETKEYREQ_0 = 0x10AA, + MACHWIENCRYPTHANDLER_MACHWDENCRYPTCONF_0 = 0x10AB, + MACHWIENCRYPTHANDLER_MACHWIENCRYPTREQHANDLER_0 = 0x10AC, + MACHWIASSOCIATEHANDLER_SETHANDLING_0 = 0x10AD, + MACHWIASSOCIATEHANDLER_MACHWDSETCONFIRM_1 = 0x10AE, + MACHWIASSOCIATEHANDLER_ASSOCIATETIMERFIRED_1 = 0x10AF, + MACHWIDISASSOCIATEHANDLER_SETHANDLING_0 = 0x10B0, + MACHWIRESETHANDLER_SETHANDLING_0 = 0x10B1, + MACHWISCANHANDLER_SETHANDLING_0 = 0x10B2, + MACHWISCANHANDLER_MACHWDEDCONFIRM_0 = 0x10B3, + MACHWISCANHANDLER_TRXSTATEHANDLING_0 = 0x10B4, + MACHWISTARTHANDLER_MACHWDSETCONFIRM_2 = 0x10B5, + MACHWISWITCHRXCTRL_SWITCHRXONWHENIDLE_1 = 0x10B6, + MACHWISTARTHANDLER_SETHANDLING_0 = 0x10B7, + MACHWISCANHANDLERC_MACHWDEDCONFIRM_0 = 0x10B8, + MACHWISCANHANDLERC_TRXSTATEHANDLING_0 = 0X10b9, + PHYRFIRQDISPATCHER_RFINTERRUPTSUBROUTINE_1 = 0x10ba, + MACHWITRANSACTIONQUEUE_TESTANDKICKQUEUETRANS_0 = 0x10bb, + MACHWIMANAGER_PROCEEDPOSTPONEDACTIONS_0 = 0x10bc, + MACHWITRANSACTIONHANDLER_SENDTRANSACTIONEVENT_2 = 0x10bd, + MACHWITRANSACTIONHANDLER_SENDTRANSACTIONEVENT_3 = 0x10be, + MACHWITRANSACTIONHANDLER_SENDTRANSACTIONEVENT_4 = 0x10bf, + MACHWIBANNODE_MACBANNODE0 = 0x10c0, + + MACHWD_RX_RELEASE_BUFFER_LIMIT = 0x1ff9, + MACHWD_POST_TASK_TIME_LIMIT = 0x1ffa, + MACHWD_RESET_TIME_LIMIT = 0x1ffb, + MACHWD_SETHANDLER_ID_1_TIME_LIMIT = 0x1ffc, + MACHWD_SETHANDLER_ID_2_TIME_LIMIT = 0x1ffd, + MACHWD_SETHANDLER_ID_3_TIME_LIMIT = 0x1ffe, + MACHWD_SETHANDLER_ID_4_TIME_LIMIT = 0x1fff +} MacDbgCode_t; + +typedef enum +{ + LOG_MAC_MAC_DATA_REQ, + LOG_MAC_SEND_REQ_TO_HANDLER, + LOG_MAC_SEND_CONF_TO_UPPER, + LOG_MAC_SEND_TRANSAC_EVENT, + LOG_MAC_SEND_TRANSAC_EVENT2 +} MacLogCodeId_t; + +#endif /* _MACDBG_H */ + +//end of macDbg.h + diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDisassociate.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDisassociate.h new file mode 100644 index 00000000..81e22edf --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macDisassociate.h @@ -0,0 +1,129 @@ +/**************************************************************************//** + \file macDisassociate.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + disassociation 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 _MACDISASSOCIATE_H +#define _MACDISASSOCIATE_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + + +/****************************************************************************** + Types section +******************************************************************************/ +/**************************************************************************//** + \brief Disassociation possible reasons. + + IEEE 802.15.4-2006 7.3.3.2 Disassociation Reason field. +******************************************************************************/ +typedef enum +{ + MAC_COORDINATOR_WISHES_DEVICE_LEAVE_PAN_REASON = 0x01, + MAC_DEVICE_WISHES_LEAVE_PAN_REASON = 0x02, +} MAC_DeassociateReason_t; + +/**************************************************************************//** + \brief MLME-DISASSOCIATE confirm primitive's parameters structure declaration. + + IEEE 802.15.4-2006 7.1.4.3 MLME-DISASSOCIATE.confirm. +******************************************************************************/ +typedef struct +{ + //! The status of the disassociation attempt. + MAC_Status_t status; + //! The addressing mode of the device that has either requested + //! disassociation or been instructed to disassociate by its coordinator. + MAC_AddrMode_t deviceAddrMode; + //! The PAN identifier of the device that has either requested disassociation or + //! been instructed to disassociate by its coordinator. + PanId_t devicePanId; + //! The address of the device that has either requested disassociation or + //! been instructed to disassociate by its coordinator. + MAC_Addr_t deviceAddr; +} MAC_DisassociateConf_t; + +/**************************************************************************//** + \brief MLME-DISASSOCIATE request primitive's parameters structure declaration. + + IEEE 802.15.4-2006 7.1.4.3 MLME-DISASSOCIATE.confirm. +******************************************************************************/ +typedef struct +{ + //! Service field - for internal needs. + MAC_ServiceTransaction_t service; + //! The addressing mode of the device to which to send the disassociation + //! notification command. + MAC_AddrMode_t deviceAddrMode; + //! The PAN identifier of the device to which to send the disassociation + //! notification command. + PanId_t devicePanId; + //! The address of the device to which to send the disassociation notification command. + MAC_Addr_t deviceAddr; + //! The reason for the disassociation. + MAC_DeassociateReason_t reason; + //! TRUE if the disassociation notification command is to be sent indirectly. + bool txIndirect; + //! MLME-DISASSOCIATE confirm callback fubction's pointer. + void (*MAC_DisassociateConf)(MAC_DisassociateConf_t *conf); + //! MLME-DISASSOCIATE confirm parameters' structure. + MAC_DisassociateConf_t confirm; +} MAC_DisassociateReq_t; + +/*************************************************************************//** + \brief MLME-DISASSOCIATE indication primitive's parameters. + + IEEE 802.15.4-2006 7.1.4.2 MLME-DISASSOCIATE.indication. +*****************************************************************************/ +typedef struct +{ + //! The address of the device requesting disassociation. + ExtAddr_t extAddr; + //! The reason for the disassociation. + MAC_DeassociateReason_t reason; +} MAC_DisassociateInd_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-DISASSOCIATE request primitive's prototype. + + \param reqParams - MLME-DISASSOCIATE request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_DisassociateReq(MAC_DisassociateReq_t *reqParams); + +/**************************************************************************//** + \brief MLME-DISASSOCIATE indication primitive's prototype. + + \param indParams - MLME-DISASSOCIATE indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_DisassociateInd(MAC_DisassociateInd_t *indParams); + +#endif /* _MACDISASSOCIATE_H */ + +// eof macDisassociate.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macEnvironment.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macEnvironment.h new file mode 100644 index 00000000..155f7983 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macEnvironment.h @@ -0,0 +1,59 @@ +/**************************************************************************//** + \file macEnvironment.h + + \brief Public interface of MAC Environment. + + \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: + 22/02/11 M. Gekk - Created. + ******************************************************************************/ +#ifndef _MAC_ENVIRONMENT_H +#define _MAC_ENVIRONMENT_H + +/****************************************************************************** + Includes section + ******************************************************************************/ +#include + +/****************************************************************************** + Prototypes section + ******************************************************************************/ +/**************************************************************************//** + \brief Gets pointer to extended address. + \return pointer to extended address. + ******************************************************************************/ +const ExtAddr_t* MAC_GetExtAddr(void); + +/**************************************************************************//** + \brief Sets extended address. + \param extAddr - extended address. + + \return none. + ******************************************************************************/ +void MAC_SetExtAddr(const ExtAddr_t *const extAddr); + +/**************************************************************************//** + \brief Checks, if extended address is equal to our own one + \param extAddr - pointer to extended address to check + + \return true, if extended address is equal to our own one; false - otherwise + ******************************************************************************/ +bool MAC_IsOwnExtAddr(const ExtAddr_t *const extAddr); + +/**************************************************************************//** + \brief Convert octet amount to transmit duration. + \param octets - number of octets. + + \return Time of octets transmission in milliseconds. + ******************************************************************************/ +uint32_t MAC_GetOctetsTransmissionTimeInMs(const uint32_t octets); + +#endif /* _MAC_ENVIRONMENT_H */ +/** eof macEnvironment.h */ diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macFrame.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macFrame.h new file mode 100644 index 00000000..21b0e62d --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macFrame.h @@ -0,0 +1,205 @@ +/**************************************************************************//** + \file macFrame.h + + \brief MAC frame fields' 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: + 19/06/07 ALuzhetsky - Created. +******************************************************************************/ + +#ifndef _MACFRAME_H +#define _MACFRAME_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +//! Beacon frame type. IEEE 802.15.4-2006 Table 79. +#define MAC_BEACON_FRAME_CODE 0x00 +//! Data frame type. IEEE 802.15.4-2006 Table 79. +#define MAC_DATA_FRAME_CODE 0x01 +//! Ack frame type. IEEE 802.15.4-2006 Table 79. +#define MAC_ACK_FRAME_CODE 0x02 +//! Command frame type. IEEE 802.15.4-2006 Table 79. +#define MAC_CMD_FRAME_CODE 0x03 + +//! IEEE 802.15.4-2003 standart frames. +#define FRAME_VERSION_2003 0x00 +//! IEEE 802.15.4-2006 standart frames. +#define FRAME_VERSION_2006 0x01 + +#ifdef _MAC_IEEE_STD_2003_ +#define FRAME_VERSION FRAME_VERSION_2003 +#else +#define FRAME_VERSION FRAME_VERSION_2006 +#endif + +#define MAC_FRAME_CONTROL_FIELD_SIZE 2 +#define MAC_SUPERFRAME_SPEC_FIELD_SIZE 2 +#define MAC_GTS_LIST_FIELD_SIZE 3 ///< See IEEE 802.15.4-2006 chart 7.2.2.1.5 +#define MAC_GTS_SPEC_FIELD_SIZE 1 +#define MAC_PEND_ADDR_SPEC_FIELD_SIZE 1 +#define MAC_CAPABILITY_INF_FIELD_SIZE 1 + +/****************************************************************************** + Types section +******************************************************************************/ +//! Set of possible frame types and commands. +typedef enum +{ + MAC_UNKNOWN_FRAME_TYPE, + MAC_BEACON_FRAME_TYPE, + MAC_DATA_FRAME_TYPE, + MAC_ACK_FRAME_TYPE, + MAC_ASSOCIATE_REQ_CMD_FRAME_TYPE, + MAC_ASSOCIATE_RESP_CMD_FRAME_TYPE, + MAC_DISASSOCIATE_NOTIF_CMD_FRAME_TYPE, + MAC_DATA_REQ_CMD_FRAME_TYPE, + MAC_PANID_CONFLICT_NOTIF_CMD_FRAME_TYPE, + MAC_ORPHAN_NOTIF_CMD_FRAME_TYPE, + MAC_BEACON_REQ_CMD_FRAME_TYPE, + MAC_COORD_REALIG_CMD_FRAME_TYPE, + //MAC_GTS_REQ_CMD_FRAME_TYPE, +} MAC_Frame_t; + +//! Frame contol field. IEEE 802.15.4-2006, Figure 42. +BEGIN_PACK +typedef struct PACK // Frame control. +{ + LITTLE_ENDIAN_OCTET(6, ( + uint16_t type : 3, + uint16_t security : 1, + uint16_t framePending : 1, + uint16_t ack : 1, + uint16_t intraPAN : 1, + uint16_t reserved1 : 1 + )) + LITTLE_ENDIAN_OCTET(4, ( + uint16_t reserved2 : 2, + uint16_t dstAddrMode : 2, + uint16_t frameVersion : 2, + uint16_t srcAddrMode : 2 + )) +} MAC_FrameCtrl_t; +END_PACK + +//! Associate request payload description. +typedef struct +{ + //! See IEEE 802.15.4-2006, Figure 56. + MAC_CapabilityInf_t capability; +} MAC_AssociateReqPldDescr_t; + +//! Beacon description. +typedef struct +{ + //uint32_t timeStamp; + //! Channel on which beacon was received. + uint8_t channel; + //! Superframe specification field, IEEE 802.15.4-2006 Figure 47. + MAC_SuperframeSpec_t superframeSpec; + //! GTS specification field, IEEE 802.15.4-2006 Figure 48. + MAC_GtsSpec_t gtsSpec; + //! GTS direction field, IEEE 802.15.4-2006 Figure 49. + MAC_GtsDirection_t gtsDirection; + //! IEEE 802.15.4-2006, 7.2.2.1.5 GTS List field. + MAC_GtsDescr_t *gtsList[MAC_GTS_MAX]; + //! IEEE 802.15.4-2006, 7.2.2.1.6 Pending Address Specification field + MAC_PendingAddrSpec_t pendAddrSpec; + //! Short addresses list pointer. + ShortAddr_t (*shortPendAddrList)[]; + //! Extended addresses list pointer. + ExtAddr_t (*extPendAddrList)[]; +} MAC_BeaconPldDescr_t; + +//! Description of associate response command MAC payload. +typedef struct +{ + //! Allocated short address (in case of successfull association). + ShortAddr_t shortAddr; + //! Result of association. + uint8_t status; +} MAC_AssociateRespPldDescr_t; + +//! Description of diassociate notification command MAC payload. +typedef struct +{ + //! Disassociation reason. + MAC_DeassociateReason_t reason; +} MAC_DisassociateNotifPldDescr_t; + +//! Coordinator realignment command MAC payload. IEEE 802.15.4-2006, 7.3.8 +typedef struct +{ + //! PAN identifier that the coordinator intends to use for all future communications. + PanId_t panId; + //! The coordinator short address field shall contain the value of macShortAddress. + ShortAddr_t coordShortAddr; + //! The logical channel that the coordinator intends to use for all future communications. + uint8_t channel; + //! Short address allocated for the device in case of orphan scan procedure, 0xffff otherwise. + ShortAddr_t shortAddr; + uint8_t page; +} MAC_CoordinatorRealignmentPldDescr_t; + +//! Frame descriptor. +typedef struct +{ + //! Frame type. + MAC_Frame_t type; + //! Frame control field, IEEE 802.15.4-2006 Figure 42. + MAC_FrameCtrl_t frameControl; + //! Data sequense number field. + uint8_t dsn; + //! Frame's destination PAN identifire. + PanId_t dstPANId; + + //! Frame's destination address. + MAC_Addr_t dstAddr; + //! Frame's source PAN identifire. + PanId_t srcPANId; + //! Frame's source address. + MAC_Addr_t srcAddr; + union + { + //! Beacon payload description. + MAC_BeaconPldDescr_t beacon; + //! Associate request command payload description. + MAC_AssociateReqPldDescr_t associateReq; + //! Associate response command payload description. + MAC_AssociateRespPldDescr_t associateResp; + //! Disassociate nofification command payload description. + MAC_DisassociateNotifPldDescr_t disassociateNotif; + //! Coordinator realignment command payload description. + MAC_CoordinatorRealignmentPldDescr_t coordRealig; + //! GTS characteristics. + MAC_GtsCharacteristics_t gtsCharacteristics; + } payload; + //! MSDU pointer. + uint8_t *msdu; + //! MSDU length. + uint8_t msduLength; + //! Incoming frame's link quality. + uint8_t quality; + //! Incoming frame's RSSI. + int8_t rssi; +} MAC_FrameDescr_t; + +#endif // _MACFRAME_H + +// eof macFrame.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macMem.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macMem.h new file mode 100644 index 00000000..01331ed4 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macMem.h @@ -0,0 +1,52 @@ +/****************************************************************************** + \file macMem.h + + \brief MAC memory type. + + \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/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACMEM_H +#define _MACMEM_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +typedef struct +{ + MachwiMem_t hwi; + MachwdMem_t hwd; +} MAC_Mem_t; + +/****************************************************************************** + Extern variables section +******************************************************************************/ +extern MAC_Mem_t macMem; + +/****************************************************************************** + Prototypes section +******************************************************************************/ + +#endif /*_MACMEM_H*/ + +// eof macMem.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macOrphan.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macOrphan.h new file mode 100644 index 00000000..a4dfa05b --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macOrphan.h @@ -0,0 +1,81 @@ +/**************************************************************************//** + \file macOrphan.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + orphan 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 _MACORPHAN_H +#define _MACORPHAN_H + +/****************************************************************************** + Includes section. +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Definitions section. +******************************************************************************/ + +/****************************************************************************** + Types section. +******************************************************************************/ +//! MLME-ORPHAN indication primitive's parameters. IEEE 802.15.4-2006 7.1.8.1 +typedef struct +{ + //! The address of the orphaned device. + ExtAddr_t extAddr; +} MAC_OrphanInd_t; + +//! MLME-ORPHAN response pritive's parameters. IEEE 802.15.4-2006 7.1.8.2 +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The address of the orphaned device. + ExtAddr_t extAddr; + //! The 16-bit short address allocated to the orphaned device if it is + //! associated with this coordinator. + ShortAddr_t shortAddr; + //! TRUE if the orphaned device is associated with this coordinator or FALSE otherwise. + bool associate; + //! MLME-ORPHAN response callback function pointer. + void (*MAC_CommStatusInd)(MAC_CommStatusInd_t *commStat); + // MLME-COMM_STATUS parameters' structure. + MAC_CommStatusInd_t commStatus; +} MAC_OrphanResp_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-ORPHAN indication primitive's prototype. + \param indParams - MLME-ORPHAN indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_OrphanInd(MAC_OrphanInd_t *indParams); + +/**************************************************************************//** + \brief MLME-ORPHAN response primitive's prototype. + \param respParams - MLME-ORPHAN response parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_OrphanResp(MAC_OrphanResp_t *respParams); + +#endif // _MACORPHAN_H + +// eof macOrphan.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPoll.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPoll.h new file mode 100644 index 00000000..b1581508 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPoll.h @@ -0,0 +1,105 @@ +/**************************************************************************//** + \file macPoll.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + data requesting 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 _MACPOLL_H +#define _MACPOLL_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MLME-POLL confirm primitive's parameters structure. + * IEEE 802.15.4-2006 7.1.16.2 MLME-POLL.confirm. + */ +typedef struct +{ + //! The status of the data request. + MAC_Status_t status; +} MAC_PollConf_t; + +/** + * \brief MLME-POLL request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.16.1 MLME-POLL.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The addressing mode of the coordinator to which the poll is intended. + MAC_AddrMode_t coordAddrMode; + //! The PAN identifier of the coordinator to which the poll is intended. + PanId_t coordPANId; + //! The address of the coordinator to which the poll is intended. + MAC_Addr_t coordAddr; + //! MLME-POLL callback function's pointer. + void (*MAC_PollConf)(MAC_PollConf_t *conf); + //! MLME-POLL confirm parameters' structure. + MAC_PollConf_t confirm; +} MAC_PollReq_t; + +/** + * \brief MLME-POLL indication primitive's parameters. + * This primitive is not described in IEEE 802.15.4-2006. Non-standard addition. + */ +typedef struct +{ + //! The addressing mode of the device from which poll request is isued. + MAC_AddrMode_t srcAddrMode; + //! The PAN identifier of the device from which poll request is isued. + PanId_t srcPANId; + //! The address of the device from which poll request is isued. + MAC_Addr_t srcAddr; + //! LQI value measured during reception of the data request command. + uint8_t linkQuality; + //! The DSN of the received data request command + uint8_t dsn; + // RSSI value measured during reception of the data request command. + int8_t rssi; +} MAC_PollInd_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-POLL indication primitive's prototype. + \param indParams - MLME-POLL indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_PollInd(MAC_PollInd_t *indParams); + +/**************************************************************************//** + \brief MLME-POLL request primitive's prototype. + \param reqParams - MLME-POLL request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_PollReq(MAC_PollReq_t *reqParams); + +#endif /* _MACPOLL_H */ + +// eof macPoll.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPurge.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPurge.h new file mode 100644 index 00000000..dad169a3 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macPurge.h @@ -0,0 +1,75 @@ +/**************************************************************************//** + \file macPurge.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + purge 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 _MACPURGE_H +#define _MACPURGE_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MCPS-PURGE confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.1.5 MCPS-PURGE.confirm. + */ +typedef struct +{ + //! The handle of the MSDU requested to be purge from the transaction queue. + uint8_t msduHandle; + //! The status of the request to be purged an MSDU from the transaction queue. + MAC_Status_t status; +} MAC_PurgeConf_t; + +/** + * \brief MCPS-PURGE request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.1.4 MCPS-PURGE.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The handle of the MSDU to be purged from the transaction queue. + uint8_t msduHandle; + //! MCPS-PURGE confirm callback function pointer. + void (*MAC_PurgeConf)(MAC_PurgeConf_t *conf); + //! MCPS-PURGE confirm parameters' structure. + MAC_PurgeConf_t confirm; +} MAC_PurgeReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MCPS-PURGE request primitive's prototype. + \param reqParams - MCPS-PURGE request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_PurgeReq(MAC_PurgeReq_t *reqParams); + +#endif /* _MACPURGE_H */ + +// eof macPurge.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macReset.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macReset.h new file mode 100644 index 00000000..6f1365ea --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macReset.h @@ -0,0 +1,73 @@ +/**************************************************************************//** + \file macReset.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + reset 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 _MACRESET_H +#define _MACRESET_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MLME-RESET confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.9.2 MLME-RESET.confirm. + */ +typedef struct +{ + //! The result of the reset operation. + MAC_Status_t status; +} MAC_ResetConf_t; + +/** + * \brief MLME-RESET request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.9.1 MLME-RESET.request + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! If TRUE, the MAC sublayer is reset, and all MAC PIB attributes are set + //! to their default values. It resets radio chip also. + bool setDefaultPib; + // MLME-RESET confirm callback function's pointer. + void (*MAC_ResetConf)(MAC_ResetConf_t *conf); + // MLME-RESET confirm parameters structure. + MAC_ResetConf_t confirm; +} MAC_ResetReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-RESET request primitive's prototype. + \param reqParams - MLME-RESET request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_ResetReq(MAC_ResetReq_t *reqParams); + +#endif /* _MACRESET_H */ + +// eof macReset.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macRxEnable.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macRxEnable.h new file mode 100644 index 00000000..f8a8e65c --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macRxEnable.h @@ -0,0 +1,78 @@ +/**************************************************************************//** + \file macRxEnable.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + rx enable 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 _MACRXENABLE_H +#define _MACRXENABLE_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MLME-RX_ENABLE confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.10.2 MLME-RX-ENABLE.confirm. + */ +typedef struct +{ + //! The result of the request to enable or disable the receiver. + MAC_Status_t status; +} MAC_RxEnableConf_t; + +/** + * \brief MLME-RX_ENABLE request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.10.1 MLME-RX-ENABLE.request. + * deferPermit and rxOnTime are NOT used - superframe functionality is not implemented. + * rxOnDuration behaviour is changed. Non-standard addition. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! Behaviour is changed. If rxOnDuration == 0 the receiver is switched off. + //! If rxOnDuartion != 0 the receiver is switched on. + uint32_t rxOnDuration; + //! MLME-RX-ENABLE callback pointer. + void (*MAC_RxEnableConf)(MAC_RxEnableConf_t *conf); + //! MLME-RX-ENABLE confirm parameters' structure. + MAC_RxEnableConf_t confirm; +} MAC_RxEnableReq_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-RX_ENABLE request primitive's prototype. + \param reqParams - MLME-RX_ENABLE request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_RxEnableReq(MAC_RxEnableReq_t *reqParams); + +#endif /* _MACRXENABLE_H */ + +// eof macRxEnable.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macScan.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macScan.h new file mode 100644 index 00000000..e5ae53b9 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macScan.h @@ -0,0 +1,116 @@ +/**************************************************************************//** + \file macScan.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + scanning 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 _MACSCAN_H +#define _MACSCAN_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ +//! Set of MAC scanning types. IEEE 802.15.4-2006 Table 67. +typedef enum +{ + MAC_ED_SCAN = 0x00, + MAC_ACTIVE_SCAN = 0x01, + MAC_PASSIVE_SCAN = 0x02, + MAC_ORPHAN_SCAN = 0x03 +} MAC_ScanType_t; + + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief Scanning results union. Contains results of energy scanning + * procedure and passive/active scan procedures. + */ +typedef union +{ + //! Energy scanning procedure results. + PHY_EnergyLevel_t (*energy)[]; + //! Active/passive scanning procedure results. + MAC_PanDescriptor_t (*panDescr)[]; +} MAC_ScanResult_t; + +/** + * \brief MLME-SCAN confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.11.2 MLME-SCAN.confirm + */ +typedef struct +{ + //! The status of the scan request. + MAC_Status_t status; + //! Indicates the type of scan performed: + MAC_ScanType_t type; + //! The channel page on which the scan was performed TBD + uint8_t page; + //! Indicates which channels given in the request were not scanned. + uint32_t unScannedChannels; + //! The number of elements returned in the appropriate result lists. + uint8_t resultSize; + //! EnergyDetectList and PANDescriptorList union. Non-standard addition. + MAC_ScanResult_t result; +} MAC_ScanConf_t; + +/** + * \brief MLME-SCAN request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.11.1 MLME-SCAN.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! Indicates the type of scan performed. + MAC_ScanType_t type; + //! The 27 bits indicate which channels are to be scanned. + uint32_t channels; + //! A value used to calculate the length of time to spend scanning each channel + //! for ED, active, and passive scans. This parameter is ignored for orphan scans. + uint8_t duration; + //! The channel page on which to perform the scan. + uint8_t page; + //! Non-standard addition. Max number of scan results. + uint8_t maxResultSize; + // MLME-SCAN confirm callback function's pointer. + void (*MAC_ScanConf)(MAC_ScanConf_t *conf); + // MLME-SCAN confirm parameters structure. + MAC_ScanConf_t confirm; +} MAC_ScanReq_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-SCAN request primitive's prototype. + \param reqParams - MLME-SCAN request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_ScanReq(MAC_ScanReq_t *reqParams); + +#endif /* _MACSCAN_H */ + +// eof macScan.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSetGet.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSetGet.h new file mode 100644 index 00000000..71eaaa67 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSetGet.h @@ -0,0 +1,113 @@ +/**************************************************************************//** + \file macSetGet.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + set and get 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 _MACSETGET_H +#define _MACSETGET_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MLME-SET confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.13.2 MLME-SET.confirm. +*/ +typedef struct +{ + //! The result of the request to write the PIB attribute. + MAC_Status_t status; + //! The identifier of the PIB attribute that was written. + MACPHY_PibId_t attrId; +} MAC_SetConf_t; + +/** + * \brief MLME-SET request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.13.1 MLME-SET.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The identifier of the PIB attribute to write. + MACPHY_PibId_t attrId; + //! The value to write to the indicated PIB attribute. + MACPHY_PibAttr_t attrValue; + //! MLME-SET confirm callback function's pointer. + void (*MAC_SetConf)(MAC_SetConf_t *conf); + //! MLME-SET confirm parameters' structure. + MAC_SetConf_t confirm; +} MAC_SetReq_t; + +/** + * \brief MLME-GET confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.6.2 MLME-GET.confirm. + */ +typedef struct +{ + //! The result of the request for PIB attribute information. + MAC_Status_t status; + //! The identifier of the PIB attribute that was read. + MACPHY_PibId_t attrId; + //! The value of the indicated PIB attribute that was read. + MACPHY_PibAttr_t attrValue; +} MAC_GetConf_t; + +/** + * \brief MLME-GET request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.6.1 MLME-GET.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The identifier of the PIB attribute to read. + MACPHY_PibId_t attrId; + //! MLME-GET confirm callback function's pointer. + void (*MAC_GetConf)(MAC_GetConf_t *conf); + //! MLME-GET confirm parameters' structure. + MAC_GetConf_t confirm; +} MAC_GetReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-SET request primitive's prototype. + \param reqParams - MLME-SET request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_SetReq(MAC_SetReq_t *reqParams); + +/**************************************************************************//** + \brief MLME-GET request primitive's prototype. + \param reqParams - MLME-GET request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_GetReq(MAC_GetReq_t *reqParams); + +#endif /* _MACSETGET_H */ + +// eof macSetGet.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macStart.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macStart.h new file mode 100644 index 00000000..62abc6ea --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macStart.h @@ -0,0 +1,89 @@ +/**************************************************************************//** + \file macStart.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + start 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 _MACSTART_H +#define _MACSTART_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Defines section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +/** + * \brief MLME-START confirm primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.14.2 MLME-START.confirm. + */ +typedef struct +{ + //! The result of the attempt to start using an updated superframe configuration. + MAC_Status_t status; +} MAC_StartConf_t; + +/** + * \brief MLME-START request primitive's parameters structure declaration. + * IEEE 802.15.4-2006 7.1.14.1 MLME-START.request. + */ +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! The PAN identifier to be used by the device. + PanId_t panId; + //! The logical channel on which to start using the new configuration. + uint8_t channel; + //! The channel page on which to begin using the new configuration. + uint8_t page; + // NOT used - superframe functionality is not implemented. + //uint8_t beaconOrder; + // NOT used - superframe functionality is not implemented. + //uint8_t superframeOrder; + //! If this value is TRUE, the device will become the PAN coordinator of a new PAN. + bool panCoordinator; + // NOT used - superframe functionality is not implemented. + //bool batteryLifeExt; + //! TRUE if a coordinator realignment command is to be transmitted prior to + //! changing the superframe configuration or FALSE otherwise. TBD. + bool coordRealignment; + //! MLME-START confirm callback fubction's pointer. + void (*MAC_StartConf)(MAC_StartConf_t *conf); + //! MLME-START confirm parameters' structure. + MAC_StartConf_t confirm; +} MAC_StartReq_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-START request primitive's prototype. + \param reqParams - MLME-START request parameters' structure pointer. + \return none. +******************************************************************************/ +void MAC_StartReq(MAC_StartReq_t *reqParams); + +#endif /* _MACSTART_H */ + +// eof macStart.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSuperframe.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSuperframe.h new file mode 100644 index 00000000..7203deb5 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSuperframe.h @@ -0,0 +1,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 +#include +#include + +/****************************************************************************** + 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 diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSync.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSync.h new file mode 100644 index 00000000..a91a4fed --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macSync.h @@ -0,0 +1,70 @@ +/**************************************************************************//** + \file macSync.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + sync 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 _MACSYNC_H +#define _MACSYNC_H + +/****************************************************************************** + Includes section +******************************************************************************/ + +/****************************************************************************** + Defines section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! Set of loss indication reasons. IEEE 802.15.4-2006 Table 75. +typedef enum +{ + MAC_PAN_ID_CONFLICT = 0, + MAC_REALIGNMENT = 1, + MAC_BEACON_LOSS = 2 +} MAC_SyncLossReason_t; + +//! MLME-SYNC_LOSS indication structure. IEEE 802.15.4-2006 7.1.15.2 +typedef struct +{ + //! The reason that synchronization was lost. + MAC_SyncLossReason_t reason; + //! The PAN identifier with which the device lost synchronization or to which + //! it was realigned. + PanId_t panId; + //! The logical channel on which the device lost synchronization or to which it + //! was realigned. + uint8_t logicalChannel; + //! The channel page on which the device lost synchronization or to which it + //! was realigned. + uint8_t channelPage; +} MAC_SyncLossInd_t; + + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief MLME-SYNC_LOSS indication primitive's prototype. + \param indParams - MLME-SYNC_LOSS indication parameters' structure pointer. + \return none. +******************************************************************************/ +extern void MAC_SyncLossInd(MAC_SyncLossInd_t *indParams); + +#endif /* _MACSYNC_H */ + +// eof macSync.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macphyPib.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macphyPib.h new file mode 100644 index 00000000..36cb28b0 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/macphyPib.h @@ -0,0 +1,381 @@ +/**************************************************************************//** + \file macphyPib.h + + \brief Types', constants' and functions' declarations for IEEE 802.15.4-2006 + MAC and PHY PIB access. + + \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/09/07 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _MACPHYPIB_H +#define _MACPHYPIB_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +/** + * \brief The maximum PSDU size (in octets) the PHY shall be able to receive/send. + * IEEE Std 802.15.4-2006. Table 22. +*/ +#define PHY_MAX_PACKET_SIZE 127U + +//! RX-to-TX or TX-to-RX maximum turnaround time. IEEE Std 802.15.4-2006. Table 22. +#define PHY_TURNARROUND_TIME 12 + +/** + * \brief The number of symbols forming a superframe slot when the superframe + * order is equal to 0. IEEE Std 802.15.4-2006. Table 85. +*/ +#define MAC_BASE_SLOT_DURATION 60 + +//! The number of slots contained in any superframe. IEEE Std 802.15.4-2006. Table 85. +#define MAC_NUM_SUPERFRAME_SLOTS 16 + +/** + * \brief The number of symbols forming a superframe when the superframe + * order is equal to 0. IEEE Std 802.15.4-2006. Table 85. +*/ +#define MAC_BASE_SUPERFRAME_DURATION (MAC_BASE_SLOT_DURATION * MAC_NUM_SUPERFRAME_SLOTS) + +/** + * \brief The number of superframes in which a GTS descriptor + * exists in the beacon frame of the PAN coordinator. IEEE Std 802.15.4-2006. Table 85. +*/ +#define MAC_GTS_DESC_PERSISTENCE_TIME 4 + +/** + * \brief The maximum number of octets added by the MAC + * sublayer to the MAC payload of a beacon frame. IEEE Std 802.15.4-2006. Table 85. +*/ +#define MAC_MAX_BEACON_OVERHEAD 75 + +/** + * \brief The maximum size, in octets, of a beacon payload. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_MAX_BEACON_PAYLOAD_LENGTH (PHY_MAX_PACKET_SIZE - MAC_MAX_BEACON_OVERHEAD) + +/** + * \brief The number of consecutive lost beacons that will cause the MAC + * sublayer of a receiving device to declare a loss of synchronization. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_MAX_LOST_BEACONS 4 + +/** + * \brief The maximum number of octets added by the MAC sublayer to the PSDU + * without security. IEEE Std 802.15.4-2006. Table 85. +*/ +/** + * \brief ZigBee Document 053474r17: D.4 aMaxMACFrameSize. + * +*/ + +#ifndef _IEEE_ZIGBEE_COMPLIANCE_ + #define MAC_MAX_MPDU_UNSECURED_OVERHEAD 25U +#else + #define MAC_MAX_MPDU_UNSECURED_OVERHEAD 11U // 25 - 8*2(ext addr) + 2*2(short addr) - 2(dst panId) +#endif // _IEEE_ZIGBEE_COMPLIANCE_ + +/**************************************************************************//** + \brief The minimum number of octets added by the MAC sublayer to the PSDU. + + IEEE Std 802.15.4-2006. Table 85. +******************************************************************************/ +#define MAC_MIN_MPDU_OVERHEAD 9 + +/** + * \brief The maximum number of octets that can be transmitted in the MAC Payload + * field of an unsecured MAC frame that will be guaranteed not to exceed aMaxPHYPacketSize. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_MAX_SAFE_PAYLOAD_SIZE (PHY_MAX_PACKET_SIZE - MAC_MAX_MPDU_UNSECURED_OVERHEAD) + +/** + * \brief The maximum number of octets that can be transmitted in the MAC Payload field. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_MAX_PAYLOAD_SIZE (PHY_MAX_PACKET_SIZE - MAC_MIN_MPDU_OVERHEAD) + +/** + * \brief The maximum size of an MPDU, in octets, that can be followed by a SIFS period. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_MAX_SIFS_FRAME_SIZE 18 + +//! The minimum number of symbols forming the CAP.IEEE Std 802.15.4-2006. Table 85. +#define MAC_MIN_CAP_LENGTH 440 + +/** + * \brief The number of symbols forming the basic time period used + * by the CSMA-CA algorithm. + * IEEE Std 802.15.4-2006. Table 85. + */ +#define MAC_UNIT_BACKOFF_PERIOD 20 + +/** Bit mask of frequency bands that are supported by the underlying + * IEEE 802.15.4 radio. */ +#define PHY_FREQUENCY_BAND_868 0x01 +#define PHY_FREQUENCY_BAND_902 0x04 +#define PHY_FREQUENCY_BAND_2400 0x08 + +/**************************************************************************//** + \def PHY_PIB_TRANSMIT_POWER_DEFAULT + \brief Default transmit power for the radio trancivier. +******************************************************************************/ +/**************************************************************************//** + \def PHY_PIB_CURRENT_CHANNEL_DEFAULT + \brief Default channel to start for the radio trancivier. +******************************************************************************/ +/**************************************************************************//** + \def PHY_PIB_CURRENT_PAGE_DEFAULT + \brief Default page to start for the radio trancivier. +******************************************************************************/ +#ifdef AT86RF230 + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_3 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x0B + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS PHY_FREQUENCY_BAND_2400 +#endif // AT86RF230 +#ifdef AT86RF230B + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_3 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x0B + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS PHY_FREQUENCY_BAND_2400 +#endif // AT86RF230B +#ifdef AT86RF231 + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_3 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x0B + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS PHY_FREQUENCY_BAND_2400 +#endif // AT86RF231 +#ifdef AT86RF212 + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_3 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x05 + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS (PHY_FREQUENCY_BAND_868 | PHY_FREQUENCY_BAND_902) +#endif // AT86RF212 +#ifdef ATMEGA128RFA1 + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_3 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x0B + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS PHY_FREQUENCY_BAND_2400 +#endif // ATMEGA128RFA1 +#ifdef CUSTOMRF3 + #define PHY_PIB_TRANSMIT_POWER_DEFAULT DBM_0 + #define PHY_PIB_CURRENT_CHANNEL_DEFAULT 0x05 + #define PHY_PIB_CURRENT_PAGE_DEFAULT 0 + #define PHY_FREQUENCY_BANDS (PHY_FREQUENCY_BAND_868 | PHY_FREQUENCY_BAND_902) +#endif // CUSTOMRF3 + +//! Default channel access mode. +#define PHY_PIB_CCA_MODE_DEFAULT PHY_CCA_MODE_1 + +// Default values of MAC PIB attributes. +#ifdef AT86RF230 +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 54 +#endif +#ifdef AT86RF230B +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 54 +#endif +#ifdef AT86RF231 +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 54 +#endif +#ifdef AT86RF212 +# if PHY_PIB_CURRENT_PAGE_DEFAULT == 0 +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 120 +# endif +#endif +#ifdef CUSTOMRF3 +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 120 +#endif +#ifdef ATMEGA128RFA1 +# define MAC_PIB_ACK_WAIT_DURATION_DEFAULT 54 +#endif +#define MAC_PIB_ASSOCIATION_PERMIT_DEFAULT false +#define MAC_PIB_AUTO_REQUEST_DEFAULT true +#define MAC_PIB_BATT_LIFE_EXT_DEFAULT false +#define MAC_PIB_BEACON_PAYLOAD_DEFAULT NULL +#define MAC_PIB_BEACON_PAYLOAD_LENGTH_DEFAULT 0 +#define MAC_PIB_BEACON_ORDER_DEFAULT 15 +#define MAC_PIB_BEACON_TX_TIME_DEFAULT 0 +#define MAC_PIB_COORD_SHORT_ADDR_DEFAULT 0xFFFF +#define MAC_PIB_COORD_EXT_ADDR_DEFAULT 0xFFFFFFFFFFFFFFFFLL ///< Not defined in standard. +#define MAC_PIB_GTS_PERMIT_DEFAULT true +#define MAC_PIB_MAX_CSMA_BACKOFFS_DEFAULT 4 +#define MAC_PIB_MAX_BE_DEFAULT 5 +#define MAC_PIB_MIN_BE_DEFAULT 3 +#define MAC_PIB_PANID_DEFAULT 0xFFFF +#define MAC_PIB_PROMISCUOUS_MODE_DEFAULT false +#define MAC_PIB_RX_ON_WHEN_IDLE_DEFAULT false +#define MAC_PIB_SHORT_ADDR_DEFAULT 0xFFFF +#define MAC_PIB_SUPERFRAME_ORDER_DEFAULT 15 +#define MAC_PIB_TRANSACTION_PERSISTENCE_TIME_DEFAULT 0x01F4 +#define MAC_PIB_ASSOCIATED_PAN_COORD_DEFAULT false +#define MAC_PIB_MAX_FRAME_RETRIES_DEFAULT 3 +#define MAC_PIB_RESPONSE_WAIT_TIME_DEFAULT 32 +#define MAC_PIB_SECURITY_ENABLED_DEFAULT false + +/****************************************************************************** + Types section +******************************************************************************/ +//! PHY PIB attribute identifiers (IEEE Std 802.15.4-2006. - table 23). +typedef enum +{ + PHY_PIB_CURRENT_CHANNEL_ID = 0x00, + PHY_PIB_CHANNELS_SUPPORTED_ID = 0x01, // Read-only + PHY_PIB_TRANSMIT_POWER_ID = 0x02, + PHY_PIB_CCA_MODE_ID = 0x03, + PHY_PIB_CURRENT_PAGE_ID = 0x04, + PHY_PIB_MAX_FRAME_DURATION_ID = 0x05, // Read-only + PHY_PIB_SHR_DURATION_ID = 0x06, // Read-only + PHY_PIB_SYMBOLS_PER_OCTET_ID = 0x07, // Read-only +} PHY_PibId_t; + +//! PHY PIB attribute types (IEEE Std 802.15.4-2006. - table 23). +typedef union +{ + uint8_t channel; + uint32_t channelsSupported; + int8_t transmitPower; + PHY_CcaMode_t ccaMode; + uint8_t currentPage; + uint16_t maxFrameDuration; + uint8_t shrDuration; + uint8_t symbolsPerOctet; +} PHY_PibAttr_t; + +//! MAC PIB attribute ID type. +typedef enum +{ + MAC_PIB_ACK_WAIT_DURATION_ID = 0x40, + MAC_PIB_ASSOCIATION_PERMIT_ID = 0x41, + MAC_PIB_AUTO_REQUEST_ID = 0x42, + MAC_PIB_BATT_LIFE_EXT_ID = 0x43, + MAC_PIB_BATT_LIFE_EXT_PERIODS_ID = 0x44, + MAC_PIB_BEACON_PAYLOAD_ID = 0x45, + MAC_PIB_BEACON_PAYLOAD_LENGTH_ID = 0x46, + MAC_PIB_BEACON_ORDER_ID = 0x47, + MAC_PIB_BEACON_TX_TIME_ID = 0x48, + MAC_PIB_BSN_ID = 0x49, + MAC_PIB_COORD_EXT_ADDR_ID = 0x4A, + MAC_PIB_COORD_SHORT_ADDR_ID = 0x4B, + MAC_PIB_DSN_ID = 0x4C, + MAC_PIB_GTS_PERMIT_ID = 0x4D, + MAC_PIB_MAX_CSMA_BACKOFFS_ID = 0x4E, + MAC_PIB_MIN_BE_ID = 0x4F, + MAC_PIB_PANID_ID = 0x50, + MAC_PIB_PROMISCUOUS_MODE_ID = 0x51, + MAC_PIB_RX_ON_WHEN_IDLE_ID = 0x52, + MAC_PIB_SHORT_ADDR_ID = 0x53, + MAC_PIB_SUPERFRAME_ORDER_ID = 0x54, + MAC_PIB_TRANSACTION_PERSISTENCE_TIME_ID = 0x55, + MAC_PIB_ASSOCIATED_PAN_COORD_ID = 0x56, + MAC_PIB_MAX_BE_ID = 0x57, + MAC_PIB_MAX_FRAME_TOTAL_WAIT_TIME_ID = 0x58, + MAC_PIB_MAX_FRAME_RETRIES_ID = 0x59, + MAC_PIB_RESPONSE_WAIT_TIME_ID = 0x5A, ///< There is in additional parameter exist in PIB - MAC_PIB_RESPONSE_WAIT_TIME_MS_ID. Time in ms. + MAC_PIB_SYNC_SYMBOL_OFFSET_ID = 0x5B, + MAC_PIB_TIMESTAMP_SUPPORTED_ID = 0x5C, + MAC_PIB_SECURITY_ENABLED_ID = 0x5D, + + MAC_PIB_EXT_ADDR_ID = 0x6F, + + MAC_PIB_KEY_TABLE_ID = 0x71, + MAC_PIB_KEY_TABLE_ENTRIES_ID = 0x72, + MAC_PIB_DEVICE_TABLE_ID = 0x73, + MAC_PIB_DEVICE_TABLE_ENTRIES_ID = 0x74, + MAC_PIB_SECURITY_LEVEL_TABLE_ID = 0x75, + MAC_PIB_SECUTITY_LEVEL_TABLE_ENTRIES_ID = 0x76, + MAC_PIB_FRAME_COUNTER_ID = 0x77, + MAC_PIB_AUTO_REQ_SECURITY_LEVEL_ID = 0x78, + MAC_PIB_AUTO_REQ_SECUTITY_KEY_ID_MODE_ID = 0x79, + MAC_PIB_AUTO_REQ_KEY_SOURCE_ID = 0x7A, + MAC_PIB_AUTO_REQUEST_KEY_INDEX_ID = 0x7B, + MAC_PIB_DEFAULT_KEY_SOURCE_ID = 0x7C, + MAC_PIB_PAN_COORD_EXT_ADDR_ID = 0x7D, + MAC_PIB_PAN_COORD_SHORT_ADDR_ID = 0x7E, + + MAC_PIB_BEACON_TX_ENABLE_ID = 0x80, ///< Additional identifier. NOT described in the standard. + MAC_PIB_RESPONSE_WAIT_TIME_MS_ID = 0x81, ///< Additional identifier. NOT described in the standard. Time in ms. Read only. + MAC_PIB_TRANSACTION_PERSIST_TIME_MS_ID = 0x83, /// + +} MAC_PibId_t; + +//! MAC PIB attribute type. +typedef union +{ + uint32_t ackWaitDuration; + bool associationPermit; + bool autoRequest; + //bool battLifeExt; + //uint8_t battLifeExtPeriods; + uint8_t *beaconPayload; + uint8_t beaconPayloadLength; + //uint8_t beaconOrder; + //uint32_t beaconTxTime; + uint8_t bsn; + ExtAddr_t coordExtAddr; + ShortAddr_t coordShortAddr; + uint8_t dsn; + bool gtsPermit; + uint8_t maxCsmaBackoffs; + uint8_t minBe; + PanId_t panId; + //bool promiscuousMode; + bool rxOnWhenIdle; + ShortAddr_t shortAddr; + ExtAddr_t extAddr; // Additional parameter. NOT described in the standard. + // This parameter replaces MAC_EXTENDED_ADDRESS constant. + // Device own extended address. + //uint8_t superframeOrder; + uint16_t transactionPersistenceTime; + uint32_t transactionPersistenceTimeInMs; + bool associatedPanCoord; + uint8_t maxBe; + //uint8_t maxFrameTotalWaitTime; + uint8_t maxFrameRetries; + uint8_t responseWaitTime; + bool timestampSupported; + bool securityEnabled; + bool beaconTxEnable; + uint32_t responseWaitTimeMs; // MAC response wait time in !!!milliseconds!!!. +} MAC_PibAttr_t; + +//! Union of MAC and PHY PIB attributes. +typedef union +{ + MAC_PibAttr_t macPibAttr; + PHY_PibAttr_t phyPibAttr; +} MACPHY_PibAttr_t; + +//! Union of MAC and PHY PIB attributes IDs. +typedef union +{ + MAC_PibId_t macPibId; + PHY_PibId_t phyPibId; +} MACPHY_PibId_t; + +/****************************************************************************** + Constants section +******************************************************************************/ + +#endif /* _MACPHYPIB_H */ + +// eof macphyPib.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/phy.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/phy.h new file mode 100644 index 00000000..24c87d81 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/phy.h @@ -0,0 +1,163 @@ +/**************************************************************************//** + \file phy.h + + \brief Types and constants declaration for IEEE std 802.15.4-2006 + PHY implementation. + + \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/05/07 ALuzhetsky - Created. +******************************************************************************/ + +#ifndef _PHY_H +#define _PHY_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ +#define DBM_11 11 +#define DBM_10 10 +#define DBM_9 9 +#define DBM_8 8 +#define DBM_7 7 +#define DBM_6 6 +#define DBM_5 5 +#define DBM_4 4 +#define DBM_3 3 +#define DBM_2 2 +#define DBM_1 1 +#define DBM_0 0 +#define DBM_MIN_1 (-1) +#define DBM_MIN_2 (-2) +#define DBM_MIN_3 (-3) +#define DBM_MIN_4 (-4) +#define DBM_MIN_5 (-5) +#define DBM_MIN_6 (-6) +#define DBM_MIN_7 (-7) +#define DBM_MIN_8 (-8) +#define DBM_MIN_9 (-9) +#define DBM_MIN_10 (-10) +#define DBM_MIN_11 (-11) +#define DBM_MIN_12 (-12) +#define DBM_MIN_13 (-13) +#define DBM_MIN_14 (-14) +#define DBM_MIN_15 (-15) +#define DBM_MIN_16 (-16) +#define DBM_MIN_17 (-17) +#define DBM_MIN_18 (-18) +#define DBM_MIN_19 (-19) +#define DBM_MIN_20 (-20) +#define DBM_MIN_21 (-21) +#define DBM_MIN_22 (-22) +#define DBM_MIN_23 (-23) +#define DBM_MIN_24 (-24) +#define DBM_MIN_25 (-25) +#define DBM_MIN_26 (-26) +#define DBM_MIN_27 (-27) + +#define PHY_CHANNEL_0 0 +#define PHY_CHANNEL_1 1 +#define PHY_CHANNEL_2 2 +#define PHY_CHANNEL_3 3 +#define PHY_CHANNEL_4 4 +#define PHY_CHANNEL_5 5 +#define PHY_CHANNEL_6 6 +#define PHY_CHANNEL_7 7 +#define PHY_CHANNEL_8 8 +#define PHY_CHANNEL_9 9 +#define PHY_CHANNEL_10 10 +#define PHY_CHANNEL_11 11 +#define PHY_CHANNEL_12 12 +#define PHY_CHANNEL_13 13 +#define PHY_CHANNEL_14 14 +#define PHY_CHANNEL_15 15 +#define PHY_CHANNEL_16 16 +#define PHY_CHANNEL_17 17 +#define PHY_CHANNEL_18 18 +#define PHY_CHANNEL_19 19 +#define PHY_CHANNEL_20 20 +#define PHY_CHANNEL_21 21 +#define PHY_CHANNEL_22 22 +#define PHY_CHANNEL_23 23 +#define PHY_CHANNEL_24 24 +#define PHY_CHANNEL_25 25 +#define PHY_CHANNEL_26 26 + +#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_0 50 ///< Symbol duration for channel 0 and BPSK modulation. +#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_1_10 25 ///< Symbol duration for channels [1 - 10] and BPSK modulation. +#define PHY_SYMBOL_DURATION_PAGE_0_CHANNELS_11_26 16 ///< Symbol duration for channels [11 - 26] and OQPSK modulation. +#define PHY_SYMBOL_DURATION_PAGE_1_CHANNELS_0 80 ///< Symbol duration for channel 0 and ASK modulation. +#define PHY_SYMBOL_DURATION_PAGE_1_CHANNELS_1_10 20 ///< Symbol duration for channels [1 - 10] and ASK modulation. +#define PHY_SYMBOL_DURATION_PAGE_2_CHANNELS_0 40 ///< Symbol duration for channel 0 and OQPSK modulation. +#define PHY_SYMBOL_DURATION_PAGE_2_CHANNELS_1_10 16 ///< Symbol duration for channels [1 - 10] and OQPSK modulation. +//Chinese frequencies. +#define PHY_SYMBOL_DURATION_PAGE_5_CHANNELS_0_3 16 ///< Symbol duration for channels [0 - 3] OQPSK modulation. +//#define PHY_SYMBOL_DURATION_PAGE_5_CHANNELS_4_7 16 ///< Symbol duration for channels [4 - 7] MPSK modulation. Not supported. + +#define PHY_SYMBOL_DURATION_PAGE_20_CHANNELS_0_25 50 ///< Symbol duration for channels [0 - 25] and BPSK modulation. +#define PHY_SYMBOL_DURATION_PAGE_22_CHANNELS_0_25 40 ///< Symbol duration for channels [0 - 25] and OQPSK modulation. + +// PHY PIB attribute read only parameters. +#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_0 8 +#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_0_10 8 +#define PHY_SYMBOLS_PER_OCTET_PAGE_0_CHANNELS_11_26 2 +//#define PHY_SYMBOLS_PER_OCTET_PAGE_1_CHANNELS_0 (2/5) +//#define PHY_SYMBOLS_PER_OCTET_PAGE_1_CHANNELS_1_10 (6/3.75) +#define PHY_SYMBOLS_PER_OCTET_PAGE_2_CHANNELS_0 2 +#define PHY_SYMBOLS_PER_OCTET_PAGE_2_CHANNELS_0_10 2 +//Chinese frequencies. +#define PHY_SYMBOLS_PER_OCTET_PAGE_5_CHANNELS_0_3 2 +//#define PHY_SYMBOLS_PER_OCTET_PAGE_5_CHANNELS_4_7 2 // Not supported. + +#define PHY_SYMBOLS_PER_OCTET_PAGE_20_CHANNELS_0_25 8 +#define PHY_SYMBOLS_PER_OCTET_PAGE_22_CHANNELS_0_25 2 + +// Size of frame fields +#define PHY_FRAME_LENGTH_FIELD_SIZE 1 +#define PHY_FCS_FIELD_SIZE 2 +#define PHY_SFD_FIELD_SIZE 1 +#define PHY_PREAMBLE_FIELD_SIZE 4 +#define PHY_LQI_FIELD_SIZE 1 +#define PHY_RSSI_FIELD_SIZE 1 + +/****************************************************************************** + Types section +******************************************************************************/ +//! CCA mode types. IEEE 802.15.4-2006 6.9.9 Clear channel assessment (CCA). +typedef enum +{ + PHY_CCA_MODE_N = 0, + PHY_CCA_MODE_1 = 1, + PHY_CCA_MODE_2 = 2, + PHY_CCA_MODE_3 = 3 +} PHY_CcaMode_t; + +//! Energy level type. +typedef uint8_t PHY_EnergyLevel_t; + +//! Evailible channel pages. +enum +{ + CHANNEL_PAGE_0 = 0, + CHANNEL_PAGE_1 = 1, + CHANNEL_PAGE_2 = 2, + CHANNEL_PAGE_5 = 5, + CHANNEL_PAGE_20 = 20, + CHANNEL_PAGE_22 = 22, +}; + +#endif /* _PHY_H */ + +// eof phy.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfBattery.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfBattery.h new file mode 100644 index 00000000..2d1a65cb --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfBattery.h @@ -0,0 +1,126 @@ +/**************************************************************************//** + \file rfBattery.h + + \brief Prototypes of battery monitor functions and corresponding types. + Powered by RF chip. + + \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/01/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _RFBATTERY_H +#define _RFBATTERY_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ + +//! Possible set of battery monitor values. +typedef enum +{ + RF_1V70_BAT_VTG = 0x0, + RF_1V75_BAT_VTG = 0x1, + RF_1V80_BAT_VTG = 0x2, + RF_1V85_BAT_VTG = 0x3, + RF_1V90_BAT_VTG = 0x4, + RF_1V95_BAT_VTG = 0x5, + RF_2V00_BAT_VTG = 0x6, + RF_2V05_BAT_VTG = 0x7, + RF_2V10_BAT_VTG = 0x8, + RF_2V15_BAT_VTG = 0x9, + RF_2V20_BAT_VTG = 0xA, + RF_2V25_BAT_VTG = 0xB, + RF_2V30_BAT_VTG = 0xC, + RF_2V35_BAT_VTG = 0xD, + RF_2V40_BAT_VTG = 0xE, + RF_2V45_BAT_VTG = 0xF, + RF_2V550_BAT_VTG = 0x10 | 0x0, + RF_2V625_BAT_VTG = 0x10 | 0x1, + RF_2V700_BAT_VTG = 0x10 | 0x2, + RF_2V775_BAT_VTG = 0x10 | 0x3, + RF_2V850_BAT_VTG = 0x10 | 0x4, + RF_2V925_BAT_VTG = 0x10 | 0x5, + RF_3V000_BAT_VTG = 0x10 | 0x6, + RF_3V075_BAT_VTG = 0x10 | 0x7, + RF_3V150_BAT_VTG = 0x10 | 0x8, + RF_3V225_BAT_VTG = 0x10 | 0x9, + RF_3V300_BAT_VTG = 0x10 | 0xA, + RF_3V375_BAT_VTG = 0x10 | 0xB, + RF_3V450_BAT_VTG = 0x10 | 0xC, + RF_3V525_BAT_VTG = 0x10 | 0xD, + RF_3V600_BAT_VTG = 0x10 | 0xE, + RF_3V675_BAT_VTG = 0x10 | 0xF, +} RF_BatteryMonVtg_t; + +/** + * \brief Battery monitor status type. +* RF_SUCCESS_BAT_MON_STATUS means that voltage threshold has been +* successfuly set. RF_BatteryMonInd() will appeared when supply voltage +* is lower than voltage threshold. +* RF_FAIL_BAT_MON_STATUS means that voltage threshold hasn't been +* successfuly set. Because supply voltage is lower than voltage threshold. +* RF_BatteryMonInd() wont appeared in this case. +*/ +typedef enum +{ + RF_SUCCESS_BAT_MON_STATUS, + RF_FAIL_BAT_MON_STATUS, +} RF_BatteryMonStatus_t; + +//! Battery monitor confirm structure. +typedef struct +{ + //! Status of RF_BatteryMonReq. + RF_BatteryMonStatus_t status; +} RF_BatteryMonConf_t; + +//! Battery monitor request structure. +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! Threshold voltage. + RF_BatteryMonVtg_t voltage; + //! Confirm structure on RF_BatteryMonReq. + RF_BatteryMonConf_t confirm; + //! Callback on RF_BatteryMonReq. + void (*RF_BatteryMonConf)(RF_BatteryMonConf_t *conf); +} RF_BatteryMonReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Sets battery monitor voltage. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void RF_BatteryMonReq(RF_BatteryMonReq_t *reqParams); + +/**************************************************************************//** + \brief Inidicates that supply voltage drop below the configured threshold. + \return none. +******************************************************************************/ +extern void RF_BatteryMonInd(void); + +#endif /*_RFBATTERY_H*/ + +// eof rfBattery.h diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfCalibration.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfCalibration.h new file mode 100644 index 00000000..b3e06d56 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfCalibration.h @@ -0,0 +1,78 @@ +/**************************************************************************//** + \file rfCalibration.h + + \brief Interface for PLL calibration and filter tuning. + + \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: + 2011-10-04 Max Gekk - Created. + Last change: + $Id: rfCalibration.h 18970 2011-10-21 12:48:41Z mgekk $ + ******************************************************************************/ +#if !defined _RFCALIBRATION_H +#define _RFCALIBRATION_H + +/****************************************************************************** + Includes section + ******************************************************************************/ +#include + +/****************************************************************************** + Types section + ******************************************************************************/ +/** + * \brief RF calibration status type. + * + * - RF_CALIBRATION_SUCCESS_STATUS means that the calibration cycle has finished + * successfuly and the radio chip is ready to work. + * - RF_CALIBRATION_FAIL_STATUS - MAC hardware depended subsystem cannot preform + * the calibration at this time. + **/ +typedef enum _RF_CalibrationStatus_t +{ + RF_CALIBRATION_SUCCESS_STATUS, + RF_CALIBRATION_FAIL_STATUS +} RF_CalibrationStatus_t; + +/**//** + * \brief The structure declaration of RF calibration confirmation parameters. + */ +typedef struct _RF_CalibrationConf_t +{ + RF_CalibrationStatus_t status; +} RF_CalibrationConf_t; + +/**//** + * \brief Parameters of RF Calibration request. + */ +typedef struct _RF_CalibrationReq_t +{ + /*! Service field - for internal needs. */ + MAC_Service_t service; + + /** RF Calibration confirm callback function's pointer. */ + void (*RF_CalibrationConf)(RF_CalibrationConf_t *conf); + /** Status of processing this request. */ + RF_CalibrationConf_t confirm; +} RF_CalibrationReq_t; + +/****************************************************************************** + Prototypes section + ******************************************************************************/ +/**************************************************************************//** + \brief initiates a calibration cycle. + + \param[in] req - pointer to calibration parameters - callback and conf status. + \return None. + ******************************************************************************/ +void RF_CalibrationReq(RF_CalibrationReq_t *const req); + +#endif /* _RFCALIBRATION_H */ +/** eof rfCalibration.h */ diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfEncrypt.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfEncrypt.h new file mode 100644 index 00000000..fa760078 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfEncrypt.h @@ -0,0 +1,72 @@ +/**************************************************************************//** + \file rfEncrypt.h + + \brief Prototypes of ecnryption functions and corresponding types. + Powered by RF chip. + + \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/01/08 A. Mandychev - Created. + 24/03/08 A. Mandychev - Renamed to rfEncrypt.h +******************************************************************************/ + +#ifndef _RFECNRYPT_H +#define _RFECNRYPT_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! Set of AES command. +typedef enum +{ + RF_SET_KEY_AES_CMD = 0, + RF_SET_INIT_VECT_AES_CMD, + RF_ECB_ENCRYPT_AES_CMD, + RF_CBC_ENCRYPT_AES_CMD, +} RF_AesCmd_t; + +//! Encryption request structure. +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! AES command. + RF_AesCmd_t aesCmd; + //! Pointer to input data for AES command. + uint8_t *text; + //! Size of input data in blocks. + uint8_t blockCount; // Block is 128-bit data. + void (*RF_EncryptConf)(void); +} RF_EncryptReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Executes AES command. Valid for RF231 and RF212. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void RF_EncryptReq(RF_EncryptReq_t *reqParams); + +#endif /*_RFECNRYPT_H*/ + +// eof rfEncrypt.h + diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfInit.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfInit.h new file mode 100644 index 00000000..e1b4f127 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfInit.h @@ -0,0 +1,45 @@ +/**************************************************************************//** + \file rfInit.h + + \brief Prototype of RF init function. + + \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/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _RFINIT_H +#define _RFINIT_H + +/****************************************************************************** + Includes section +******************************************************************************/ + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Initializes RF chip. + \return none. +******************************************************************************/ +void RF_Init(void); + +#endif /*_RFINIT_H*/ + +// eof rfInit.h + diff --git a/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfRandom.h b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfRandom.h new file mode 100644 index 00000000..759944c7 --- /dev/null +++ b/digital/zigbit/bitcloud/stack/Components/MAC_PHY/include/rfRandom.h @@ -0,0 +1,73 @@ +/**************************************************************************//** + \file rfRandom.h + + \brief Prototype of random generation function. + + \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: + 08/04/08 A. Mandychev - Created. +******************************************************************************/ + +#ifndef _RFRANDOM_H +#define _RFRANDOM_H + +/****************************************************************************** + Includes section +******************************************************************************/ +#include +#include + +/****************************************************************************** + Define(s) section +******************************************************************************/ + +/****************************************************************************** + Types section +******************************************************************************/ +//! Random confirm structure. +typedef struct +{ + uint8_t *buff; + uint16_t value; +} RF_RandomConf_t; + +//! Random request structure. +typedef struct +{ + //! Service field - for internal needs. + MAC_Service_t service; + //! Number of bytes to be generated + uint8_t numberOfBytes; + //! Confirm structure on RF_RandomReq. + RF_RandomConf_t confirm; + //! Callback on RF_RandomReq. + void (*RF_RandomConf)(RF_RandomConf_t *conf); +} RF_RandomReq_t; + +/****************************************************************************** + Prototypes section +******************************************************************************/ +/**************************************************************************//** + \brief Requests random value from RF chip. Valid for RF231 and RF212. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void RF_RandomReq(RF_RandomReq_t *reqParams); + +/**************************************************************************//** + \brief Requests random value from RF chip. Valid for RF231 and RF212. + \param reqParams - request parameters structure pointer. + \return none. +******************************************************************************/ +void RF_RandomSeqReq(RF_RandomReq_t *reqParams); + +#endif /*_RFRANDOM_H*/ + +// eof rfRandom.h -- cgit v1.2.3