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

📄 dlul_map_analyze.c

📁 开发的802.16e物理层上下行MAP解析
💻 C
📖 第 1 页 / 共 5 页
字号:

		   /* other Extended-2 DL_MAP IE is not supported now */
		   else{
			   printf("Error: This extended-2 DL_MAP IE is not supported!\n");		   
			   exit_phy(-505);
		   }
	   }

/********************************* analyze extended DL_MAP IE ***********************************/

	   else if(diuc == 15){                           
		   if(byte_align_flag == 0){
			   e_diuc = (UINT16)(*(p_dlul_map_data + i) & 0x0f);               //Extended DIUC    
			   i++;
		   }
		   else{
			   e_diuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);        //Extended DIUC    
		   }

/******************************** analyze STC/DL_zone switch IE *********************************/
		   if(e_diuc == 0x01){
			   /* increase zone index */
			   zone_num = zone_num + 1;
			   /* increase the number of IE */
			   ie_cnt++;
			   /* STC/DL_zone switch IE is half-byte IE */
			   nibble_ie_cnt++;
			   /* if current IE is aligned to byte */
			   if(byte_align_flag == 0){
				   ofdma_symbol_offset = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));           //ofdma symbol offset of current zone
				   i++;
				   permutation_type = (UINT16)((*(p_dlul_map_data + i) & 0x0c) >> 2);             //permutation type of current zone
				   use_all_sc_indicator = (UINT16)((*(p_dlul_map_data + i) & 0x02) >> 1);         //use all sc indicator of current zone
				   i++;
				   permbase = (UINT16)((*(p_dlul_map_data + i) & 0x1f));            //DL PermBase of current zone
				   i++;
				   prbs_id = (UINT16)((*(p_dlul_map_data + i) & 0xc0) >> 6);           //PRBS ID of current zone
				   i += 2;	
			   }
			   else{
				   i++;
				   ofdma_symbol_offset = (UINT16)(*(p_dlul_map_data + i));                        //ofdma symbol offset of current zone
				   i++;
				   permutation_type = (UINT16)((*(p_dlul_map_data + i) & 0xc0) >> 6);             //permutation type of current zone
				   use_all_sc_indicator = (UINT16)((*(p_dlul_map_data + i) & 0x20) >> 5);         //use all sc indicator of current zone
				   permbase = (UINT16)(((*(p_dlul_map_data + i) & 0x01) << 4) + ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));                 //DL PermBase of current zone
				   i++;
				   prbs_id = (UINT16)((*(p_dlul_map_data + i) & 0x0c) >> 2);          //PRBS ID of current zone
				   i += 2;		   
			   }

			   
			   /* assign zone parameter to subframe stuct */
			   p_dl_subframe_rx->zone[zone_num].zone_type = 0;
			   p_dl_subframe_rx->zone[zone_num].zone_index = zone_num;
			   p_dl_subframe_rx->zone[zone_num].start_symbol_offset = ofdma_symbol_offset;
			   p_dl_subframe_rx->zone[zone_num-1].end_symbol_offset = ofdma_symbol_offset - 1;
			   p_dl_subframe_rx->zone[zone_num].permutation_type = permutation_type;
			   p_dl_subframe_rx->zone[zone_num].use_all_sc_indicator = use_all_sc_indicator;
			   p_dl_subframe_rx->zone[zone_num].dl_permbase = permbase;
			   p_dl_subframe_rx->zone[zone_num].prbs_id = prbs_id;
			   p_dl_subframe_rx->zone[zone_num-1].number_of_burst = burst_num;

			   
			   /* reset burst index to 0 */
			   burst_num = 0;			   
		   }

/************************************ analyze CID Switch IE  ************************************/

		   else if(e_diuc == 0x04){
			   /* increase the number of IE */
			   ie_cnt++;
			   /* CID Switch IE is half-byte IE */
			   nibble_ie_cnt++;
			   /* reverse current cid included flag */
			   inc_cid = (UINT16)(inc_cid ^ 0x01);
			   i++;
		   }


		   /* other Extended DL_MAP IE is not supported now */
		   else{
			   printf("Error: This extended DL_MAP IE is not supported!\n");
			   exit_phy(-506);
		   }	   
	   }


/****************** analyze normal DL_MAP IE with different burst profiles **********************/

	   else if(diuc >= 0 && diuc < 13){ 
		   /* increase the number of IE */
		   ie_cnt++;			 
		   /* normal DL_MAP IE is half-byte IE */
		   nibble_ie_cnt++;
		   /* if current IE is aligned to byte */
		   if(byte_align_flag == 0){
			   /* if CID is included in current IE */
		       if(inc_cid == 1){
				   num_cid = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));            //number of CID of current burst
				   i++;
				   for(j = 0; j < num_cid; j++){
					   p_dl_subframe_rx->zone[zone_num].burst[burst_num].cid_burst[j] = ((UINT16)(*(p_dlul_map_data + i) & 0x0f) << 12) | ((UINT16)(*(p_dlul_map_data + i + 1)) << 4) | ((UINT16)(*(p_dlul_map_data + i + 2) & 0xf0) >> 4);       //Burst CID
					   i += 2;
				   }
			   }
			   else{
				   num_cid = 0;			 
			   }
			   ofdma_symbol_offset = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));    //ofdma symbol offset of current burst
			   i++;
			   subchannel_offset = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 2) | ((*(p_dlul_map_data + i + 1) & 0xc0) >> 6));      //subchannel offset of current burst
			   i++;
			   boosting = (UINT16)((*(p_dlul_map_data + i) & 0x38) >> 3);                                                           //boosting of current burst
			   num_symbol = (UINT16)(((*(p_dlul_map_data + i) & 0x07) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));             //number of symbols of current burst
			   i++;
			   num_subchannel = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 2) | ((*(p_dlul_map_data + i + 1) & 0xc0) >> 6));         //number of subchannels of current burst
			   i++;
			   repetition = (UINT16)((*(p_dlul_map_data + i) & 0x30) >> 4);                                                         //repetition factor of current burst
			   i++;	
			    
		   }
		   else{
			   if(inc_cid == 1){
				   num_cid = (UINT16)(*(p_dlul_map_data + i));                                                                      //number of CID of current burst
				   i++;
				   for(j = 0; j < num_cid; j++){
					 p_dl_subframe_rx->zone[zone_num].burst[burst_num].cid_burst[j] = ((UINT16)(*(p_dlul_map_data + i)) << 8) | (UINT16)(*(p_dlul_map_data + i + 1));       //Burst CID
					 i += 2;
				   }
			   }
			   else{
				   num_cid = 0;				   
			   }
			   ofdma_symbol_offset = (UINT16)(*(p_dlul_map_data + i));                                                              //ofdma symbol offset of current burst
			   i++;
			   subchannel_offset = (UINT16)((*(p_dlul_map_data + i) & 0xfc) >> 2);                                                  //subchannel offset of current burst
			   boosting = (UINT16)(((*(p_dlul_map_data + i) & 0x03) << 1) | ((*(p_dlul_map_data + i + 1) & 0x80) >> 7));               //boosting of current burst
			   i++;
			   num_symbol = (UINT16)(*(p_dlul_map_data + i) & 0x7f);                                                                //number of symbols of current burst
			   i++;
			   num_subchannel = (UINT16)((*(p_dlul_map_data + i) & 0xfc) >> 2);                                                     //number of subchannels of current burst
			   repetition = (UINT16)(*(p_dlul_map_data + i) & 0x03);                                                                //repetition factor of current burst
			   i++;

		   }


		   /* calculate total number of slots of current burst */
		   burst_total_slot = (UINT16)(num_subchannel * (num_symbol >> 1));  
	   

		   /* reflect diuc to fec_code_type*/
		   fec_code_type = diuc_fec_code[diuc];

		   /* calculate fec code block of current burst */
		   slot_to_blk(fec_code_type,burst_total_slot,repetition,&burst_data_len_byte,&burst_num_slot,&burst_num_slot_remain,&num_block,uncoded_blk_len,coded_blk_len,blk_num_slot);


		   /* assign burst parameter to subframe stuct */
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].burst_type = 2;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].burst_index = burst_num;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_cid = num_cid;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].fec_code_type = fec_code_type;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].burst_data_len_byte = burst_data_len_byte;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].ofdma_symbol_offset = ofdma_symbol_offset;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].subchannel_offset = subchannel_offset;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].boosting = boosting;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_symbol = num_symbol;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_subchannel = num_subchannel;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].repetition_coding = repetition;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_slot = burst_num_slot;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_slot_remain = burst_num_slot_remain;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_subburst = 0;
		   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_block = num_block;
		   

		   /* assign block parameter of current burst to subframe stuct */
		   for(j = 0; j < num_block; j++){
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].block[j].block_index = j;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].block[j].block_len_uncoded = uncoded_blk_len[j];
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].block[j].block_len_coded = coded_blk_len[j];
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].block[j].number_of_slot = blk_num_slot[j];
		   }
		   

		   /* increase burst index */
		   burst_num++;
	   }


    }


	/* assign remain parameter to downlink subframe stuct */
	p_dl_subframe_rx->subframe_type = 0; 
	p_dl_subframe_rx->number_of_zone = zone_num + 1;
	p_dl_subframe_rx->zone[zone_num].number_of_burst = burst_num;	
	p_dl_subframe_rx->zone[zone_num].end_symbol_offset = p_dl_subframe_rx->symbol_num - 1;


	/* Compressed DL_MAP Message analysis is over */
//	printf("Compressed DL_MAP analysis is over!\n");



/***************************** analyze Compressed UL_MAP Message ********************************/
	if(comp_ulmap_app == 1){
	p_ul_subframe_tx->ucd_cnt = (UINT16)(*(p_dlul_map_data + i));                     //UCD Count
	i++;
	p_ul_subframe_tx->alloc_stime = ((UINT32)(*(p_dlul_map_data + i)) << 24) | ((UINT32)(*(p_dlul_map_data + i + 1)) << 16) | ((UINT32)(*(p_dlul_map_data + i + 2)) << 8) | (UINT32)(*(p_dlul_map_data + i + 3));                     //Allocation Start Time
	i += 4;
	p_ul_subframe_tx->symbol_num = (UINT16)(*(p_dlul_map_data + i));                  //Number of OFDMA symbols in the UL subframe
	i++;


	/* assign remain parameter to uplink subframe stuct */
	p_ul_subframe_tx->subframe_type = 1; 
	p_ul_subframe_tx->frame_duration_code = p_dl_subframe_rx->frame_duration_code; 
	p_ul_subframe_tx->frame_number = p_dl_subframe_rx->frame_number; 

	
/********************* analyze variable UL_MAP IE in Compressed UL_MAP Message***********************/

	/* initialize the uplink zone index*/
	zone_num = 0;

	/* initialize the burst index in the first zone*/
	burst_num = 0;

	/* initialize the number of UL_MAP IE */
	ie_cnt = 0;


	/* assign remain parameter to uplink subframe stuct */
	p_ul_subframe_tx->zone[zone_num].end_symbol_offset = p_ul_subframe_tx->symbol_num - 1;
	p_ul_subframe_tx->number_of_zone = zone_num + 1;


	/* assign the parameter of the first zone */
	p_ul_subframe_tx->zone[0].zone_type = 0; 
	p_ul_subframe_tx->zone[0].zone_index = 0; 
	p_ul_subframe_tx->zone[0].start_symbol_offset = 0;
	p_ul_subframe_tx->zone[0].permutation_type = 0; 
	
		


	/* if UL_MAP IE in Compressed UL_MAP analysis is not over */
	while(i < comp_map_len - 4){
		/* if number of half-byte DL_MAP IE is even*/
		if(nibble_ie_cnt%2 == 0){
			byte_align_flag = 0;                                       //current IE is aligned to byte  
		}
		else{
			byte_align_flag = 1;                                       //current IE is not aligned to byte 
		}


/************************* analyze CID and UIUC in all UL_MAP IE *******************************/
		/* if current IE is aligned to byte */
		if(byte_align_flag == 0){
			cid = ((UINT16)(*(p_dlul_map_data + i)) << 8) | ((UINT16)(*(p_dlul_map_data + i + 1)));               //CID
			i += 2;
			uiuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);     //UIUC of current burst
			i++;
			byte_align_flag = 1;
		}
		else{
			cid = ((UINT16)(*(p_dlul_map_data + i - 1) & 0x0f) << 12) | ((UINT16)(*(p_dlul_map_data + i)) << 4) | ((UINT16)(*(p_dlul_map_data + i + 1) & 0xf0) >> 4);             //CID
			i++;
			uiuc = (UINT16)(*(p_dlul_map_data + i) & 0x0f);            //UIUC of current burst 
			i++;
			byte_align_flag = 0;		
		}



/******************************** analyze FAST FEEDBACK IE **************************************/
		/* Fast Feedback Channel burst */
		if(uiuc == 0){
			/* increase the number of IE */
			ie_cnt++;
			/* FAST-FEEDBACK IE is half-byte IE */
			nibble_ie_cnt++;
			/* if current byte is aligned to byte */
			if(byte_align_flag == 0){
				ofdma_symbol_offset = (UINT16)(*(p_dlul_map_data + i));                    //OFDMA symbol offset
				i++;
				subchannel_offset = (UINT16)((*(p_dlul_map_data + i) & 0xfe) >> 1);        //Subchannel offset
				num_symbol = (UINT16)(((*(p_dlul_map_data + i) & 0x01) << 6) | ((*(p_dlul_map_data + i + 1) & 0xfc) >> 2));          //Number of OFDMA symbols
				i++;
				num_subchannel = (UINT16)(((*(p_dlul_map_data + i) & 0x03) << 5) | ((*(p_dlul_map_data + i + 1) & 0xf8) >> 3));      //Number of Subchannels
				i++;
			}
			else{
				ofdma_symbol_offset = (UINT16)(((*(p_dlul_map_data + i - 1) & 0x0f) << 4) | ((*(p_dlul_map_data + i) & 0xf0) >> 4));  //OFDMA symbol offset

⌨️ 快捷键说明

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