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 --- .../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 ++++ 32 files changed, 3415 insertions(+) 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/include') 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