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

📄 dlul_map_analyze.c

📁 开发的802.16e物理层上下行MAP解析
💻 C
📖 第 1 页 / 共 5 页
字号:
    p_ul_subframe_tx->zone[0].use_all_sc_indicator = 0;
    p_ul_subframe_tx->zone[0].permutation_type = 0;
    p_ul_subframe_tx->zone[0].ul_permbase = 0xf;
	/**************************************************/
   


/***************************** analyze Compressed DL_MAP Message ********************************/

	/* get Compressed MAP appended indicator*/
	comp_ulmap_app = (UINT8)((*(p_dlul_map_data) & 0x10) >> 4);
	
	/* get Compressed MAP length Message*/
	comp_map_len = ((UINT16)(*(p_dlul_map_data) & 0x07) << 8) | (UINT16)(*(p_dlul_map_data + 1));

	
	i = 2;
	p_dl_subframe_rx->frame_duration_code = (UINT16)(*(p_dlul_map_data + i));         //Frame Duration Code, refer to table 274
	i++;
	p_dl_subframe_rx->frame_number = ((UINT32)(*(p_dlul_map_data + i)) << 16) | ((UINT32)(*(p_dlul_map_data + i + 1)) << 8) | (UINT32)(*(p_dlul_map_data + i + 2));      //Frame Index 
	i += 3;
	p_dl_subframe_rx->dcd_cnt = (UINT16)(*(p_dlul_map_data + i));                     //DCD Count
	i++;
	p_dl_subframe_rx->operator_id = (UINT16)(*(p_dlul_map_data + i));                 //Operator ID
	i++;
	p_dl_subframe_rx->sector_id = (UINT16)(*(p_dlul_map_data + i));                   //Sector ID
	i++;
	p_dl_subframe_rx->symbol_num = (UINT16)(*(p_dlul_map_data + i));                  //Number of OFDMA Symbols
	i++;
	dl_ie_cnt = (UINT16)(*(p_dlul_map_data + i));                                     //DL IE Count
	i++;




/****************** analyze variable DL_MAP IE in Compressed DL_MAP Message*********************/
	/* assign the parameter of the first zone */
	p_dl_subframe_rx->zone[0].zone_type = 0; 
	p_dl_subframe_rx->zone[0].zone_index = 0; 
	p_dl_subframe_rx->zone[0].permutation_type = 0; 

	/* assign the parameter of the first burst of the first zone */	
	p_dl_subframe_rx->zone[0].burst[0].number_of_cid = 0; 
	p_dl_subframe_rx->zone[0].burst[0].number_of_subburst = 0; 


			  
	/* initialize the number of zone */
	zone_num = 0;

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

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

	/* initialize the number of half-byte IE */
	nibble_ie_cnt = 0;

	/* if Compressed MAP analysis is not over */
	while(ie_cnt < dl_ie_cnt){
		/* if number of half-byte DL_MAP IE is even*/
		if(nibble_ie_cnt%2 == 0){
	        diuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);     //DIUC of current burst
			byte_align_flag = 0;                                       //current IE is aligned to byte  
		}
		else{
		    diuc = (UINT16)(*(p_dlul_map_data + i - 1) & 0x0f);        //DIUC of current burst
			byte_align_flag = 1;                                       //current IE is not aligned to byte 
		}

/******************************** analyze extended-2 DL_MAP IE **********************************/
	   if(diuc == 14){ 
		   /* if current IE is aligned to byte */
		   if(byte_align_flag == 0){
			   e2_diuc = (UINT16)(*(p_dlul_map_data + i) & 0x0f);                     //Extended-2 DIUC                           
			   i++;
		   }
		   else{
			   e2_diuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);              //Extended-2 DIUC  
		   }


/********************************** analyze HARQ DL MAP IE **************************************/

		   if(e2_diuc == 0x07){
			   /* increase the number of IE */
			   ie_cnt++;
			   /* if current IE is aligned to byte */
			   if(byte_align_flag == 0){
				   harqmap_ie_len = (UINT16)(*(p_dlul_map_data + i));                //HARQ MAP IE length
				   i++;
				   boosting = (UINT16)((*(p_dlul_map_data + i) & 0x0e) >> 1);        //Boosting of current burst
				   i++;
				   ofdma_symbol_offset = (UINT16)(*(p_dlul_map_data + i));           //ofdma symbol offset of current burst
				   i++;
				   subchannel_offset = (UINT16)((*(p_dlul_map_data + i) & 0xfe) >> 1);         //subchannel offset of current burst
				   num_symbol = (UINT16)(((*(p_dlul_map_data + i) & 0x01) << 6) | ((*(p_dlul_map_data + i + 1) & 0xfc) >> 2));              //number of symbols of current burst  
				   i++; 
				   num_subchannel = (UINT16)(((*(p_dlul_map_data + i) & 0x03) << 5) | ((*(p_dlul_map_data + i + 1) & 0xf8) >> 3));          //number of subchannels of current burst
				   i += 2;
				   subburst_mode = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);       //subburst mode
				   subburst_ie_len = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));         //Subburst IE length in nibbles  
				   i++;
				   num_subburst = (UINT16)(*(p_dlul_map_data + i) & 0x0f);           //number of subbursts
				   i += 2;


				   /* analyze subburst IE one by one */ 		
				   for(j = 0; j < num_subburst; j++){
					   /* if subburst index is even */ 
						if(j % 2 == 0){
							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);         //Subburst CID
							i++;
							subburst_total_slot = ((UINT16)(*(p_dlul_map_data + i) & 0x0f) << 6) | ((UINT16)(*(p_dlul_map_data + i + 1) & 0xfc) >> 2);            //total number of slots of current subburst
							i += 2;
							diuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);                 //DIUC of current subburst
							repetition = (UINT16)((*(p_dlul_map_data + i) & 0x0c) >> 2);           //repetition factor of current subburst       
							i++;
							ack_disable = (UINT16)((*(p_dlul_map_data + i) & 0x04) >> 2);          //ACK Disable indicator of current subburst
							i++;						
						}
						else{
							cid = ((UINT16)(*(p_dlul_map_data + i)) << 8) | ((UINT16)(*(p_dlul_map_data + i + 1)));          //Subburst CID
							i += 2;
							subburst_total_slot = ((UINT16)(*(p_dlul_map_data + i)) << 2) | ((UINT16)(*(p_dlul_map_data + i + 1) & 0xc0));           //total number of slots of current subburst
							i++;
							diuc = (UINT16)(*(p_dlul_map_data + i) & 0x0f);                        //DIUC of current subburst
							i++;
							repetition = (UINT16)((*(p_dlul_map_data + i) & 0xc0) >> 6);           //repetition factor of current subburst      
							i++;
							ack_disable = (UINT16)((*(p_dlul_map_data + i) & 0x40) >> 6);          //ACK Disable indicator of current subburst
							i++;		
						}


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


						/* calculate fec code block of current subburst */
						slot_to_blk(fec_code_type,subburst_total_slot,repetition,&subburst_data_len,&subburst_num_slot,&subburst_num_slot_remain,&num_block,uncoded_blk_len,coded_blk_len,blk_num_slot);

						
						/* assign subburst parameter to subframe stuct */
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_type = subburst_mode;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_index = j;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].fec_code_type = fec_code_type;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].repetition_coding = repetition;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].number_of_slot = subburst_num_slot;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].number_of_block = num_block;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_data_len = subburst_data_len;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].cid_subburst = cid;

						
						/* assign block parameter of current subburst to subframe stuct */
						for(k = 0; k < num_block; k++){
							p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].block[k].block_index = k;
							p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].block[k].block_len_uncoded = uncoded_blk_len[k];
							p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].block[k].block_len_coded = coded_blk_len[k];
							p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].block[k].number_of_slot = blk_num_slot[k];
						}
				   }
			   }
			   else{
				   harqmap_ie_len = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));            //HARQ MAP IE length
				   i += 2;
				   boosting = (UINT16)((*(p_dlul_map_data + i) & 0xe0) >> 5);                                                              //Boosting of current burst
				   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) << 3) | ((*(p_dlul_map_data + i + 1) & 0xe0) >> 5));         //subchannel offset of current burst
				   i++;
				   num_symbol = (UINT16)(((*(p_dlul_map_data + i) & 0x1f) << 2) | ((*(p_dlul_map_data + i + 1) & 0xc0) >> 6));                //number of symbols of current burst    
				   i++;
				   num_subchannel = (UINT16)(((*(p_dlul_map_data + i) & 0x3f) << 1) | ((*(p_dlul_map_data + i + 1) & 0x80) >> 7));            //number of subchannels of current burst
				   i++;
				   subburst_mode = (UINT16)(*(p_dlul_map_data + i) & 0x0f);                  //HARQ mode
				   i++;
				   subburst_ie_len = (UINT16)(*(p_dlul_map_data + i));                   //Subburst IE length in nibbles           
				   i++;
				   num_subburst = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);        //number of subbursts
				   i++;


				   /* analyze subburst IE one by one */ 
				   for(j = 0; j < num_subburst; j++){
						if(j % 2 == 0){
							cid = ((UINT16)(*(p_dlul_map_data + i)) << 8) | ((UINT16)(*(p_dlul_map_data + i + 1)));                //Subburst CID
							i += 2;
							subburst_total_slot = ((UINT16)(*(p_dlul_map_data + i)) << 2) | ((UINT16)(*(p_dlul_map_data + i + 1) & 0xc0) >> 6);         //total number of slots of current subburst
							i++;
							diuc = (UINT16)(*(p_dlul_map_data + i) & 0x0f);                   //DIUC of current subburst
							i++;
							repetition = (UINT16)((*(p_dlul_map_data + i) & 0xc0) >> 6);      //repetition factor of current subburst 
							i++;
							ack_disable = (UINT16)((*(p_dlul_map_data + i) & 0x40) >> 6);     //ACK Disable indicator of current subburst
							i++;		
						}
						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);          //Subburst CID
							i++;
							subburst_total_slot = ((UINT16)(*(p_dlul_map_data + i) & 0x0f) << 6) | ((UINT16)(*(p_dlul_map_data + i + 1) & 0xfc) >> 2);           //total number of slots of current subburst
							i += 2;
							diuc = (UINT16)((*(p_dlul_map_data + i) & 0xf0) >> 4);            //DIUC of current subburst
							repetition = (UINT16)((*(p_dlul_map_data + i) & 0x0c) >> 2);      //repetition factor of current subburst 
							i++; 
							ack_disable = (UINT16)((*(p_dlul_map_data + i) & 0x04) >> 2);     //ACK Disable indicator of current subburst
							i++;								
						}
				   
				  
						/* reflect diuc to fec_code_type*/
						fec_code_type = diuc_fec_code[diuc];
											
						/* calculate fec code block of current subburst */
						slot_to_blk(fec_code_type,subburst_total_slot,repetition,&subburst_data_len,&subburst_num_slot,&subburst_num_slot_remain,&num_block,uncoded_blk_len,coded_blk_len,blk_num_slot);

						
						/* assign subburst parameter to subframe stuct */
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_type = subburst_mode;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_index = j;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].fec_code_type = fec_code_type;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].repetition_coding = repetition;						
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].number_of_slot = subburst_total_slot;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].number_of_block = num_block;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].subburst_data_len = subburst_data_len;
						p_dl_subframe_rx->zone[zone_num].burst[burst_num].subburst[j].cid_subburst = cid;


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


				   /* if current HARQ MAP IE is not byte aligned and number of subursts is even, 
				           increase the last i by one to pad the whole HARQ MAP IE to byte*/ 
				   if(num_subburst % 2 == 0){
					   i++;		   
				   }
			   }
			   
			   
			   /* 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 = 0;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].fec_code_type = 100;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].burst_data_len_byte = 0;
			   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].repetition_coding = 0;
			   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].number_of_subburst = num_subburst;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_slot = 0;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_slot_remain = 0;
			   p_dl_subframe_rx->zone[zone_num].burst[burst_num].number_of_block = 0;

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



/*********************************** analyze HARQ ACK IE ****************************************/

		   if(e2_diuc == 0x08){
			   /* increase the number of IE */
			   ie_cnt++;
			   /* if current IE is aligned to byte */
			   if(byte_align_flag == 0){
				   harqack_ie_len = (UINT16)(*(p_dlul_map_data + i));          //HARQ ACK IE length
				   i++;
				   for(j = 0; j < harqack_ie_len; j++){
					   harq_bitmap[j] = p_dlul_map_data[i + j];                //HARQ Bitmap 
				   }
				   i = i + harqack_ie_len;
			   }
			   else{
				   harqack_ie_len = (UINT16)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));            //HARQ ACK IE length
				   i++;
				   for(j = 0; j < harqack_ie_len; j++){
					   harq_bitmap[j] = (UINT8)(((*(p_dlul_map_data + i) & 0x0f) << 4) | ((*(p_dlul_map_data + i + 1) & 0xf0) >> 4));         //HARQ Bitmap 
					   i++;				   
				   }
				   i++;			   
			   }
		   }

⌨️ 快捷键说明

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