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

📄 wib_dl_phy.c

📁 开发的802.16e物理层上下行MAP解析
💻 C
📖 第 1 页 / 共 3 页
字号:
					p_data_prerepet_block = dl_data.interleave_data;
				} 
				else if(fec_code_type_bst > 6){						// CTC Encode								
					/* CTC Encode */
					dl_ctc_enc (
                    dl_data.rand_data,				// encode data input  AB AB
                    dl_data.ctc_data,				// encode data output // 6N
                    (UINT16)(block_len_uncoded * 4)	// N
					);   

					fprintf(fp_test_data,"\n/* CTC data length: %3d bytes */ \n",block_len_coded);
					fprintf(fp_encode_data,"\n/* CTC data length: %3d bytes */ \n",block_len_coded);
					for (l = 0; l < block_len_coded; l++){
						fprintf(fp_test_data," %02x ",dl_data.ctc_data[l]);
						fprintf(fp_encode_data," %02x ",dl_data.ctc_data[l]);
						if (l % 10 == 9){
							fprintf(fp_test_data,"\n");
							fprintf(fp_encode_data,"\n");
						}
					}
					
					/* assign the data point before repeated*/
					p_data_prerepet_block = dl_data.ctc_data;
				}
				
				/*-------------------- Repetition --------------------*/
				for (l = 0; l < dl_subframe_desc_tx.zone[i].burst[j].block[k].number_of_slot;l++){	// every slot
					/* For every slot,it should be repeated m times*/
					for (m = 0; m < repet_facotor_bst; m++){
						for (n = 0; n < slot_len_coded_bst; n++){
							tmp1 = slot_len_coded_bst * (m + l * repet_facotor_bst) + n;
							dl_data.repetititon_data[tmp1] = *(p_data_prerepet_block + slot_len_coded_bst * l + n);
						}
					}
				}

				fprintf(fp_test_data,"\n/* Repetition data length: %3d bytes */ \n",block_len_coded * repet_facotor_bst);
				fprintf(fp_repet_data,"\n/* Repetition data length: %3d bytes */ \n",block_len_coded * repet_facotor_bst);
			
				/* output dlmap*/
				if (i == 0 && j == 0 ){			// burst#0 is DL-MAP
					fprintf(fp_dlmap_data,"\n/*----- Repetition Encode data  --------*/\n");
				}
				
				for (l = 0; l < block_len_coded * repet_facotor_bst; l++){
					fprintf(fp_test_data," %02x ",dl_data.repetititon_data[l]);
					fprintf(fp_repet_data," %02x ",dl_data.repetititon_data[l]);
					if (l % 10 == 9){
						fprintf(fp_test_data,"\n");
						fprintf(fp_repet_data,"\n");
					}
					/* output dlmap*/
					if (i == 0 && j == 0 ){			// burst#0 is DL-MAP
						fprintf(fp_dlmap_data," %02x ",dl_data.repetititon_data[l]);
						if (l % 10 == 9){
								fprintf(fp_dlmap_data,"\n");
						}
					}

				}

				/*-------------------- Modulation --------------------*/
				for (l = 0; l < (repet_facotor_bst* dl_subframe_desc_tx.zone[i].burst[j].block[k].number_of_slot); l++){	//every slot

					tmp1 = l * slot_len_coded_bst;

					p_data_repet_slot = &dl_data.repetititon_data[tmp1];			// Current slot start data pointer before modulation
					p_data_map_slot = &dl_data.map_data[block_index_modulation];	// Current slot start data pointer after modulation
					
					/* constellation map*/
					dl_modulation(
						p_data_repet_slot,
						p_data_map_slot,
						data_width,
						fec_code_type_bst
					);

					block_index_modulation = block_index_modulation + SC_NUM_SLOT;	// current slot start index in map data
									
				}

 				fprintf(fp_test_data,"\n/* Modulation data length: %3d */ \n",block_len_coded * repet_facotor_bst);
				fprintf(fp_modulation_data,"\n/* Modulation data length: %3d */ \n",block_len_coded * repet_facotor_bst);

				/* output dlmap*/
				if (i == 0 && j == 0 ){			// burst#0 is DL-MAP
					fprintf(fp_dlmap_data,"\n/*----- Modulation Encode data  --------*/\n");
				}

				for (l = 0; l < 48 * (repet_facotor_bst* dl_subframe_desc_tx.zone[i].burst[j].block[k].number_of_slot); l++){
					if (l % 48 == 0){
						fprintf(fp_test_data,"//slot # %4d\n",l/24);
						fprintf(fp_modulation_data,"//slot # %4d\n",l/24);
					}
					fprintf(fp_test_data,"  %6d +   %6d i\n",dl_data.map_data[l].real,dl_data.map_data[l].imag);
					fprintf(fp_modulation_data,"  %6d +   %6d i\n",dl_data.map_data[l].real,dl_data.map_data[l].imag);

					/* output dlmap*/
					if (i == 0 && j == 0 ){			// burst#0 is DL-MAP
						fprintf(fp_dlmap_data,"  %6d +   %6d i\n",dl_data.map_data[l].real,dl_data.map_data[l].imag);
					}
				} 
				
			}
						
			/*------------------ generate logic frame data --------------------*/

			/* write logic frame data after modulation of every burst */
			p_data_map_slot = &dl_data.map_data[0];	
			dl_logic_frame_construct(
				p_dl_subframe_desc_tx,		// frame descriptor
				p_data_map_slot,			// input data : modulation data
				p_log_frame,				// output data: logic frame data
				0,							// FCH flag
				i,							// zone number
				j							// burst number
			);
		}	
	}

#endif

	/*-------------- generate preamble and pilot -----------*/

	p_tmp1 = (COMPLEX16*)(dl_data.phy_preamble);
	dl_gen_preamble(
		p_dl_subframe_desc_tx,
		dl_subframe_desc_tx.preamble_index,
		coef_std,
		p_tmp1
    );

	/*********************  frame generate *********************************/

	/*------------------ output logic frame data --------------------*/
	fprintf(fp_test_data,"/********************* Logic frame data **************************/\n");
	fprintf(fp_logic_frame,"/********************* Logic frame data **************************/\n");
	for (i =0; i < 42; i++){
				fprintf(fp_test_data,"       symbol %3d      ",i);
				fprintf(fp_logic_frame,"       symbol %3d      ",i);			
	}

	fprintf(fp_test_data,"\n");
	fprintf(fp_logic_frame,"\n");

	for (i =0; i < MAX_DATASC_NUM; i++){	
		for (j = 0; j < 42; j++){		
			fprintf(fp_test_data,"  %6d  +  %6d i |",dl_data.log_frame[j][i].real,dl_data.log_frame[j][i].imag);
			fprintf(fp_logic_frame,"  %6d +  %6d i |",dl_data.log_frame[j][i].real,dl_data.log_frame[j][i].imag);
			if (j == 41){	
				fprintf(fp_test_data,"\n");
				fprintf(fp_logic_frame,"\n");
			}
		}
	}
	/*-------------- generate the physical subcarrier map location -----------*/

	/* subcarriers allocation */  
	p_fch_bitmap = &dl_subframe_desc_tx.bit_map[0];
	segment_id = dl_subframe_desc_tx.segment_id;
	
	for (i = 0; i < dl_subframe_desc_tx.number_of_zone; i++){

		p_datasc_subchn_even = &dl_data.alloc_datasc_subchn_even[i][0][0];
		p_datasc_subchn_odd = &dl_data.alloc_datasc_subchn_odd[i][0][0];
		p_pilotsc_even = &dl_data.alloc_pilotsc_even[i][0];
		p_pilotsc_odd = &dl_data.alloc_pilotsc_odd[i][0];
		p_physc_even = &dl_data.alloc_data_physc_even[i][0];
		p_physc_odd = &dl_data.alloc_data_physc_odd[i][0];
		
		zone_perm_type = dl_subframe_desc_tx.zone[i].permutation_type;
		zone_use_all_sc = dl_subframe_desc_tx.zone[i].use_all_sc_indicator;
		zone_PRBS_ID = dl_subframe_desc_tx.zone[i].prbs_id;

		
		if (i == 0)	{		// First DL zone
			zone_dl_permbase = dl_subframe_desc_tx.id_cell;
			first_dl_flag = 1;	// first dl zone 
			symbol_parity = 0;	// even symbol

			dl_subcarrier_alloc_pusc(			
				p_datasc_subchn_even,		// sc location of every subchannel
				p_pilotsc_even,				// pilot sc location of every subchannel
				p_physc_even,
				first_dl_flag,				// first_dl_flag
				zone_use_all_sc,			// use all subcarrier indicator
				zone_dl_permbase,			// DL_permbase for zone
				zone_PRBS_ID,				// PRBS_ID for zone
				p_fch_bitmap,				// FCH bitmap
				symbol_parity,				// symbol parity
				segment_id 					// Segment ID for current segment
			);
			
			symbol_parity = 1;	// odd symbol
			dl_subcarrier_alloc_pusc(			
				p_datasc_subchn_odd,		// sc location of every subchannel
				p_pilotsc_odd,				// pilot sc location of every subchannel
				p_physc_odd,
				first_dl_flag,				// first_dl_flag
				zone_use_all_sc,			// use all subcarrier indicator
				zone_dl_permbase,			// DL_permbase for zone
				zone_PRBS_ID,				// PRBS_ID for zone
				p_fch_bitmap,				// FCH bitmap
				symbol_parity,				// symbol parity
				segment_id					// Segment ID for current segment
			);

		} 
		else if(zone_perm_type == 0){	// PUSC
			zone_dl_permbase = dl_subframe_desc_tx.zone[i].dl_permbase;
			first_dl_flag = 0;

			symbol_parity = 0;	// even symbol
			dl_subcarrier_alloc_pusc(			
				p_datasc_subchn_even,		// sc location of every subchannel
				p_pilotsc_even,				// pilot sc location of every subchannel
				p_physc_even,
				first_dl_flag,				// first_dl_flag
				zone_use_all_sc,			// use all subcarrier indicator
				zone_dl_permbase,			// DL_permbase for zone
				zone_PRBS_ID,				// PRBS_ID for zone
				p_fch_bitmap,				// FCH bitmap
				symbol_parity,				// symbol parity
				segment_id					// Segment ID for current segment
			);

			symbol_parity = 1;	// odd symbol
			dl_subcarrier_alloc_pusc(			
				p_datasc_subchn_odd,		// sc location of every subchannel
				p_pilotsc_odd,				// pilot sc location of every subchannel
				p_physc_odd,
				first_dl_flag,				// first_dl_flag
				zone_use_all_sc,			// use all subcarrier indicator
				zone_dl_permbase,			// DL_permbase for zone
				zone_PRBS_ID,				// PRBS_ID for zone
				p_fch_bitmap,				// FCH bitmap
				symbol_parity,				// symbol parity
				segment_id					// Segment ID for current segment
			);
		}

		else if(zone_perm_type == 1){	// FUSC
			zone_dl_permbase = dl_subframe_desc_tx.zone[i].dl_permbase;
			first_dl_flag = 0;
			symbol_parity = 0;	// even symbol
	
			dl_subcarrier_alloc_fusc(
				p_datasc_subchn_even,		// sc location of every subchannel
				p_pilotsc_even,				// pilot sc location of every subchannel
				p_physc_even,
				zone_dl_permbase,			// DL_permbase for zone
				symbol_parity				// symbol parity
			);

			symbol_parity = 1;	// odd symbol

			dl_subcarrier_alloc_fusc(
				p_datasc_subchn_odd,		// sc location of every subchannel
				p_pilotsc_odd,				// pilot sc location of every subchannel
				p_physc_odd,
				zone_dl_permbase,			// DL_permbase for zone
				symbol_parity				// symbol parity
			);
		}
	}

	

	/*-------------- map logic frame to physical frame -----------*/
	p_dl_data = &dl_data;
	dl_phy_frame_map(
		p_dl_subframe_desc_tx,
		p_dl_data,
		coef_std,
		&sym_num_frame
	);

	/*------------------ output physical frame data --------------------*/
	fprintf(fp_test_data,"/********************* Physical frame data **************************/\n");
	fprintf(fp_physc_frame,"/********************* Physical frame data **************************/\n");
	for (i =0; i < sym_num_frame; i++){
		fprintf(fp_test_data,"       symbol %3d      ",i);
		fprintf(fp_physc_frame,"       symbol %3d      ",i);			
	}

	fprintf(fp_test_data,"\n");
	fprintf(fp_physc_frame,"\n");

	for (i =0; i < FFT_SIZE; i++){	
		for (j = 0; j < sym_num_frame; j++){		
			fprintf(fp_test_data,"  %6d  +  %6d i |",dl_data.phy_frame[j][i].real,dl_data.phy_frame[j][i].imag);
			fprintf(fp_physc_frame,"  %6d +  %6d i |",dl_data.phy_frame[j][i].real,dl_data.phy_frame[j][i].imag);
			if (j == sym_num_frame - 1 ){	
				fprintf(fp_test_data,"\n");
				fprintf(fp_physc_frame,"\n");
			}
		}
	}
	
	/*--------------  physical frame subcarrier randomize -----------*/
	dl_phy_frame_rand(
		p_dl_subframe_desc_tx,
		p_dl_data
		);
	
	fprintf(fp_test_data,"/********************* Physical frame randomize data **************************/\n");
	fprintf(fp_physc_rand_frame,"/********************* Physical frame randomize data **************************/\n");
/**/for (i =0; i < sym_num_frame; i++){
		fprintf(fp_test_data,"       symbol %3d      ",i);
		fprintf(fp_physc_rand_frame,"       symbol %3d      ",i);			
	}

	fprintf(fp_test_data,"\n");
	fprintf(fp_physc_rand_frame,"\n");

	for (i =0; i < FFT_SIZE; i++){	
		for (j = 0; j < sym_num_frame; j++){		
			fprintf(fp_test_data,"  %6d  +  %6d i |",dl_data.phy_frame[j][i].real,dl_data.phy_frame[j][i].imag);
			fprintf(fp_physc_rand_frame,"  %6d +  %6d i |",dl_data.phy_frame[j][i].real,dl_data.phy_frame[j][i].imag);
			if (j == sym_num_frame - 1){	
				fprintf(fp_test_data,"\n");
				fprintf(fp_physc_rand_frame,"\n");
			}
		}
	}

	fclose(fp_test_data);
	fclose(fp_fch_data);
	fclose(fp_dlmap_data);
	fclose(fp_source_data);
	fclose(fp_rand_data);
	fclose(fp_encode_data);
	fclose(fp_repet_data);
	fclose(fp_modulation_data);
	fclose(fp_logic_frame);
	fclose(fp_physc_frame);
	fclose(fp_physc_rand_frame);
	fclose(fp_ifft_data);
	fclose(fp_ifft_exponent);
	fclose(fp_addcp_data);
	

}

⌨️ 快捷键说明

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