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

📄 maclibc.nc.svn-base

📁 802.15.4协议的实现
💻 SVN-BASE
字号:
// $Id: MacLibC.nc,v 1.0 2006/01/24 17:19:43 idgay Exp $
/*
 *
 * Authors:		Andre Cunha
 * Date last modified:  
 *
 */

/**
 * @author Andre Cunha
 */
 
includes MacConst;

 
module MacLibC {
  provides interface MacLib;
}
implementation
{

async command uint16_t MacLib.set_frame_control(uint8_t frame_type,uint8_t security,uint8_t frame_pending,uint8_t ack_request,uint8_t intra_pan,uint8_t dest_addr_mode,uint8_t source_addr_mode) {
	  uint8_t fc_b1=0;
	  uint8_t fc_b2=0;
	  uint16_t frame_control=0;
  
  	  fc_b1 = ( (intra_pan << 6) | (ack_request << 5) | (frame_pending << 4) |
 	   		  (security << 3) | (frame_type << 0) );
	   				  
	  fc_b2 = ( (source_addr_mode << 6) | (dest_addr_mode << 2));

	  frame_control = ( (fc_b2 <<8 ) | (fc_b1 << 0) );
	  
 	  return frame_control;
}


async command uint16_t MacLib.set_superframe_specification(uint8_t beacon_order,uint8_t superframe_order,uint8_t final_cap_slot,uint8_t battery_life_extension,uint8_t pan_coordinator,uint8_t association_permit){
	  uint8_t sf_b1=0;
	  uint8_t sf_b2=0;
	  uint16_t superframe =0;
	  
	  sf_b1 = ( (superframe_order << 4) | (beacon_order <<0));
	  
	  sf_b2 = ( (association_permit << 7) | (pan_coordinator << 6) |
	  		    (battery_life_extension << 4) | (final_cap_slot << 0) );

	  superframe = ( (sf_b2 <<8 ) | (sf_b1 << 0) );  
	   
return superframe;	   
}

async command uint8_t MacLib.set_gts_specification(uint8_t gts_descriptor_count, uint8_t gts_permit){
	  uint8_t gts_specification=0;
	  
	  gts_specification = ( (gts_permit << 7) | ( gts_descriptor_count << 0) );  
	  
	  return gts_specification;
}


}

⌨️ 快捷键说明

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