📄 dlul_map_analyze.c
字号:
*burst_num_block = num_blk;
*burst_data_len_byte = bst_len;
return(0);
}
int dl_fch_analyze(
UINT8 *p_fch_data,
DL_SUBFRAME_STRUCT *p_dl_subframe_rx
)
{
/*
***************************************************************************************
* Variable definition
***************************************************************************************
*/
UINT16 fch_bitmap_dec; // FCH bitmap for decimal
UINT16 fch_bitmap[6]; // FCH bitmap sequence
UINT16 subchn_num_pusc; // subchannel number of PUSC zone
UINT16 repet_cod_dlmap; // Repetition coding of dlmap
UINT16 modulaiton_type_dlmap; // modulation type of dlmap
UINT16 slot_total_dlmap; // total slot number of dlmap
UINT16 fec_code_type_dlmap; // FEC Code type of dlmap
UINT16 sym_num_dlmap; // symbol number of dlmap
/* block parameter */
UINT16 slot_num_dlmap; // used slot number of dlmap
UINT16 slot_num_dlmap_remain; // remain lot number of dlmap
UINT16 burst_data_len_byte; //data length of current burst
UINT16 num_block; //number of blocks of current burst or subburst
UINT16 *uncoded_blk_len; //block length before encoded
UINT16 *coded_blk_len; //block length after encoded
UINT16 *blk_num_slot; //slot number of block
UINT16 i;
/*
***************************************************************************************
* function definition
***************************************************************************************
*/
uncoded_blk_len = malloc(MAX_BLOCK_NUM * sizeof(UINT16));
coded_blk_len = malloc(MAX_BLOCK_NUM * sizeof(UINT16));
blk_num_slot = malloc(MAX_BLOCK_NUM * sizeof(UINT16));
/* Get fch bit map in decimal */
// printf("%x\n",(*(p_fch_data + 1) & 0x70));
fch_bitmap_dec = *p_fch_data >> 2;
/* Get Repetition code,FEC Code type and Slot number of DL-MAP(Zone#0,burst#1)*/
repet_cod_dlmap = (((*p_fch_data & 0x1) << 1) | ((*(p_fch_data + 1) & 0x80) >> 7)); //repetition coding
modulaiton_type_dlmap = ((*(p_fch_data + 1) & 0x70) >> 4);
slot_total_dlmap = (((*(p_fch_data + 1) & 0xf) << 4) | ((*(p_fch_data + 2) & 0xf0) >> 4));
switch(modulaiton_type_dlmap){
case 0 :
fec_code_type_dlmap = 0;
break;
case 1 :
fec_code_type_dlmap = 7;
printf("Error: the modulation of dlmap is BTC(dl_fch_analyze)");
break;
case 2 :
fec_code_type_dlmap = 13;
break;
case 3 :
printf("Error: the modulation of dlmap is ZT CC(dl_fch_analyze)");
break;
case 4 :
printf("Error: the modulation of dlmap is Optional CC(dl_fch_analyze)");
break;
case 5 :
printf("Error: the modulation of dlmap is LDPC(dl_fch_analyze)");
break;
default:
printf("Error: the modulation of dlmap is Reserved(dl_fch_analyze)");
break;
}
fch_bitmap[0] = (fch_bitmap_dec & 0x1);
fch_bitmap[1] = (fch_bitmap_dec & 0x2) >> 1;
fch_bitmap[2] = (fch_bitmap_dec & 0x4) >> 2;
fch_bitmap[3] = (fch_bitmap_dec & 0x8) >> 3;
fch_bitmap[4] = (fch_bitmap_dec & 0x10) >> 4;
fch_bitmap[5] = (fch_bitmap_dec & 0x20) >> 5;
subchn_num_pusc = 0;
for (i = 0; i < 6; i++){
if ((fch_bitmap[i] == 1) && (i % 2 == 0) ){
subchn_num_pusc = subchn_num_pusc + 6;
}
else if ((fch_bitmap[i] == 1) && (i % 2 == 1) ){
subchn_num_pusc = subchn_num_pusc + 4;
}
}
sym_num_dlmap = 2; //(UINT16)(ceil((double)(slot_total_dlmap + 4) / (double)(subchn_num_pusc)) * 2);
for (i = 0; i < 6; i++){
p_dl_subframe_rx->bit_map[i] = fch_bitmap[i];
}
slot_to_blk(
fec_code_type_dlmap,
slot_total_dlmap,
repet_cod_dlmap,
&burst_data_len_byte,
&slot_num_dlmap,
&slot_num_dlmap_remain,
&num_block,
uncoded_blk_len,
coded_blk_len,
blk_num_slot
);
p_dl_subframe_rx->zone[0].start_symbol_offset = 1;
// p_dl_subframe_rx->zone[0].end_symbol_offset = 1 + sym_num_dlmap;
p_dl_subframe_rx->zone[0].burst[0].burst_type = 0; // 0 -> dlmap,1 -> normal data, 2-> subburst
p_dl_subframe_rx->zone[0].burst[0].burst_index = 0;
p_dl_subframe_rx->zone[0].burst[0].repetition_coding = repet_cod_dlmap;
p_dl_subframe_rx->zone[0].burst[0].boosting = 0;
p_dl_subframe_rx->zone[0].burst[0].number_of_slot_remain = slot_num_dlmap_remain;
p_dl_subframe_rx->zone[0].burst[0].number_of_slot = slot_num_dlmap;
p_dl_subframe_rx->zone[0].burst[0].fec_code_type = fec_code_type_dlmap;
p_dl_subframe_rx->zone[0].burst[0].number_of_symbol = sym_num_dlmap;
p_dl_subframe_rx->zone[0].burst[0].ofdma_symbol_offset = 1;
p_dl_subframe_rx->zone[0].burst[0].subchannel_offset = 4;
p_dl_subframe_rx->zone[0].burst[0].number_of_block = num_block;
p_dl_subframe_rx->zone[0].burst[0].burst_data_len_byte = burst_data_len_byte;
for(i = 0; i < num_block; i++){
p_dl_subframe_rx->zone[0].burst[0].block[i].block_index = i;
p_dl_subframe_rx->zone[0].burst[0].block[i].block_len_uncoded = uncoded_blk_len[i];
p_dl_subframe_rx->zone[0].burst[0].block[i].block_len_coded = coded_blk_len[i];
p_dl_subframe_rx->zone[0].burst[0].block[i].number_of_slot = blk_num_slot[i];
}
free(uncoded_blk_len);
free(coded_blk_len);
free(blk_num_slot);
return(1);
}
/*
* =====================================================================================
* function: dlul_map_analyze module
* parameters:
* UINT8 *p_dlul_map_data, //Compressed MAP data
* DL_SUBFRAME_STRUCT *p_dl_subframe_rx, //DL subframe struct by analyzing MAP data
* UL_SUBFRAME_STRUCT *p_ul_subframe_tx) //UL subframe struct by analyzing MAP data
* return value: 0 : the program operates correctly
* others : the program is illegal or incorrect
* description: generate DL subframe struct and UL subframe struct by analyzing MAP data from BS
* Author : yanhua.bai
* -------------------------------------------------------------------------------------
*/
int dlul_map_analyze(
UINT8 *p_dlul_map_data,
DL_SUBFRAME_STRUCT *p_dl_subframe_rx,
UL_SUBFRAME_STRUCT *p_ul_subframe_tx
)
{
/*
***************************************************************************************
* basic parameter definition
***************************************************************************************
*/
/* Tempory variable definiton*/
UINT16 i,j,k,m,n;
/* generic parameter */
UINT8 comp_ulmap_app; //Compressed UL_MAP appended indicator
UINT16 comp_map_len; //Compressed MAP Message length in bytes
UINT16 dl_ie_cnt; //DL IE Count
UINT16 byte_align_flag; //byte aligned flag, 0:aligned; 1:not aligned
UINT16 ie_cnt; //number of MAP IE
UINT16 nibble_ie_cnt; //number of half-byte MAP IE
/* zone parameter */
UINT16 zone_num; //current zone index
UINT16 permutation_type; //for downlink zone: 0000:PUSC permutation; 0001:FUSC permutation
//for uplink zone: 000: PUSC ; 001: Optional PUSC
UINT16 use_all_sc_indicator; //use all sc indicator of current zone, 0:not use all subchannels; 1:use all subchannels
UINT16 permbase; //for downlink zone: DL_PermBase of current zone
//for uplink zone: UL_PermBase of current zone
UINT16 prbs_id; //PRBS_ID of downlink zone, Values: 0,1,2
/* burst and subburst parameter */
UINT16 burst_num = 0; //current burst index
UINT16 ofdma_symbol_offset; //ofdma symbol offset of current burst
UINT16 subchannel_offset; //subchannel offset of current burst
UINT16 num_symbol; //number of symbols of current burst
UINT16 num_subchannel; //number of subchannels of current burst
UINT16 boosting; //boosting factor of current burst
UINT16 repetition; //repetition factor of current burst, 0b00: no repetition coding; 0b01: repetition coding of 2;
//0b10: repetition coding of 4; 0b11: repetition coding of 6;
UINT16 burst_data_len_byte; //data length of current burst
UINT16 burst_total_slot; //number of slots of current burst after repetition
UINT16 burst_num_slot; //number of used slots of current burst before repetition
UINT16 burst_num_slot_remain; //number of remain slots of current burst
UINT16 num_subburst; //number of subbursts of current burst
UINT16 fec_code_type; //fec code type of current burst or subburst
UINT16 subburst_data_len; //data lentth of current subburst
UINT16 subburst_total_slot; //number of slots of current subburst after repetition
UINT16 subburst_num_slot; //number of used slots of current subburst before repetition
UINT16 subburst_num_slot_remain; //number of remain slots of current subburst
/* block parameter */
UINT16 num_block; //number of blocks of current burst or subburst
UINT16 *uncoded_blk_len; //block length before encoded
UINT16 *coded_blk_len; //block length after encoded
UINT16 *blk_num_slot; //number of slots of current block
/* dlmap parameter */
UINT16 diuc; //DIUC of current burst or subburst
UINT16 e2_diuc; //Extended-2 DIUC when DIUC = 14
UINT16 e_diuc; //Extended DIUC when DIUC = 15
/* ulmap parameter */
UINT16 uiuc; //UIUC of current burst or subburst
// UINT16 e2_uiuc; //Extended-2 UIUC when UIUC = 11
UINT16 e_uiuc; //Extended-2 UIUC when UIUC = 15
/*CDMA RANGING IE parameter*/
UINT16 ranging_method;
/*CDMA Allocation IE parameter*/
UINT16 cdma_alloc_dura;
UINT16 trans_uiuc;
UINT16 frm_num_index;
UINT16 ranging_code;
UINT16 ranging_sym;
UINT16 ranging_subch;
/*HARQ DL MAP IE parameter */
UINT16 harqmap_ie_len; //HARQ DL MAP IE length
UINT16 subburst_mode; //suburst mode, 01100000: No HARQ; 01100001: HARQ Chase Combining; 01100010: HARQ IR-CTC; 01100011: HARQ IR-CC
UINT16 ack_disable; //indicate whether or not to require an ACK by the SS
UINT16 subburst_ie_len; //length in nibbles to indicate the size of the subburst IE in HARQ mode
/*HARQ ACK IE parameter */
UINT16 harqack_ie_len; //HARQ ACK IE length
UINT8 *harq_bitmap; //HARQ Bitmap to indicate ACK for HARQ enabled UL bursts
/*CID parameter */
UINT16 inc_cid = 0; //CID inclued flag indicated by CID Switch IE
UINT16 num_cid; //number of CID when CID is included in DL_MAP IE
UINT16 cid; //CID of Burst or Subburst
uncoded_blk_len = malloc(MAX_BLOCK_NUM*sizeof(UINT16));
coded_blk_len = malloc(MAX_BLOCK_NUM*sizeof(UINT16));
blk_num_slot = malloc(MAX_BLOCK_NUM*sizeof(UINT16));
harq_bitmap = malloc(64*sizeof(UINT8));
/***************************************************/
p_dl_subframe_rx->zone[0].use_all_sc_indicator = 0;
p_dl_subframe_rx->zone[0].permutation_type = 0;
p_dl_subframe_rx->zone[0].dl_permbase = 0xf;
p_dl_subframe_rx->zone[0].prbs_id = 1;
p_dl_subframe_rx->segment_id = 0;
p_dl_subframe_rx->cp = 256;
/**************************************************/
/***************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -