⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mac_const.h.svn-base

📁 802.15.4协议的实现
💻 SVN-BASE
字号:
/*
 * @author IPP HURRAY http://www.hurray.isep.ipp.pt/art-wise
 * @author Andre Cunha
 */

// The MAC constants are defined in here.
// Notice that these makes use of the PHY constants.
//pag 134

#define aBaseSlotDuration          60
#define aBaseSuperframeDuration    960 //aBaseSlotDuration*aNumSuperframeSlots

//#define aExtendedAddress         // This should be defined by the device!


#define aMaxBE                     5 //CSMA-CA

#define aMaxBeaconOverhead         75
#define aMaxBeaconPayloadLength    aMaxPHYPacketSize-aMaxBeaconOverhead
#define aGTSDescPersistenceTime    4
#define aMaxFrameOverhead          25
#define aMaxFrameResponseTime      1220
#define aMaxFrameRetries           3

//(SYNC)number of beacons lost before sending a Beacon-Lost indication
#define aMaxLostBeacons            4
#define aMaxMACFrameSize           aMaxPHYPacketSize-aMaxFrameOverhead
#define aMaxSIFSFrameSize          18
#define aMinCAPLength              440
#define aMinLIFSPeriod             40
#define aMinSIFSPeriod             12
#define aNumSuperframeSlots        16
#define aResponseWaitTime          32*aBaseSuperframeDuration
#define aUnitBackoffPeriod         20


#define TYPE_BEACON 0
#define TYPE_DATA 1
#define TYPE_ACK 2
#define TYPE_CMD 3

#define SHORT_ADDRESS 2
#define LONG_ADDRESS 3
#define RESERVED_ADDRESS 1

//buffer sizes
#define MAX_GTS_BUFFER 7



// MAC PIB attribute
typedef struct
{
	//pag 135
	uint8_t macAckWaitDuration;
	bool macAssociationPermit;//FDD
	bool macAutoRequest;
	bool macBattLifeExt;
	uint8_t macBattLifeExtPeriods;
	
	uint8_t macBeaconPayload[aMaxBeaconPayloadLength];//FDD
	
	uint8_t macBeaconPayloadLenght;//FDD
	uint8_t macBeaconOrder;//FDD
	
	uint32_t macBeaconTxTime;//FDD
	uint8_t macBSN;//FDD
	uint32_t macCoordExtendedAddress0;
	uint32_t macCoordExtendedAddress1;
	uint32_t macCoordShortAddress;
	uint8_t macDSN;
	bool macGTSPermit;//FDD
	uint8_t macMaxCSMABackoffs;
	uint8_t macMinBE;
	uint16_t macPANId;
	bool macPromiscuousMode;//FDD
	bool macRxOnWhenIdle;
	uint32_t macShortAddress;
	uint8_t macSuperframeOrder;//FDD
	uint32_t macTransactionPersistenceTime;//FDD
	
} macPIB;

// MAC PIB security ACL entry descriptor
typedef struct
{
	uint32_t ACLExtendedAddress[1];
	uint16_t ACLShortAddress;
	uint16_t ACLPANId;
	uint8_t ACLSecurityMaterialLength;
	//variable string
	uint8_t ACLSecurityMaterial;
	uint8_t ACLSecuritySuite;
	
}ACLDescriptor;

// MAC PIB security attribute
typedef struct
{
	//pag 138
	ACLDescriptor macACLEntryDescriptorSet;
	uint8_t macACLEntryDescriptorSetSize;
	bool macDefaultSecurity;
	uint8_t macDefaultSecurityMaterialLength;
	//variable string
	uint8_t macDefaultSecurityMaterial;
	uint8_t macDefaultSecuritySuite;
	uint8_t macSecurityMode;
	
}macPIBsec;

//MAC PANDescriptor
typedef struct
{
	//pag76
	uint8_t CoordAddrMode;
	uint16_t CoordPANId;
	uint32_t CoordAddress0;
	uint32_t CoordAddress1;
	uint8_t LogicalChannel;
	//superframe specification field
	uint16_t SuperframeSpec;
	bool GTSPermit;
	uint8_t LinkQuality;
	uint32_t TimeStamp;
	bool SecurityUse;
	uint8_t ACLEntry;
	bool SecurityFailure;

}PANDescriptor;

//GTS entry (used in the PAN coordinator)
typedef struct
{
	uint8_t gts_id;
	uint8_t starting_slot;
	uint8_t length;
	uint8_t direction;
	uint16_t DevAddressType;

}GTSinfoEntryType;

//GTS entry (used in the PAN coordinator)
typedef struct
{
	uint8_t gts_id;
	uint8_t starting_slot;
	uint8_t length;
	uint16_t DevAddressType;
	uint8_t persistencetime;

}GTSinfoEntryType_null;


typedef struct
{
	
	uint8_t handler;
	uint8_t dest_address_mode;
	uint32_t dest_addres0;
	uint32_t dest_addres1;
	
	uint16_t sd_count;
	//MPDU frame;
	uint8_t frame[127];

}indirect_transmission_element;

typedef struct
{
	uint8_t start_slot;
	uint8_t frame[127];

}gts_buffer_element;




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -