📄 wib_dl_source_gen.c
字号:
comp_ulmap_header.alloc_stime = (UINT32)ul_subframe_tx->alloc_stime; // Allocation start time
comp_ulmap_header.symb_num = (UINT8)ul_subframe_tx->symbol_num; // Number of OFDMA symbols in the UL subframe including all zone
/* get the address of compressed ulmap header */
p_comp_ulmap_header = (UINT8*)(&comp_ulmap_header);
/* assign compressed ulmap message format (totally 6 bytes)*/
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header); // UCD Count
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 4); // Alloc start time[31:24]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 3); // Alloc start time[23:16]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 2); // Alloc start time[15:8]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 1); // Alloc start time[7:0]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 5); // Number of OFDMA symbols in the UL subframe including all zone
dlul_map_len++;
/*
//* get Compressed DL_MAP and Compressed UL_MAP length in bytes*
comp_map_len = dlul_map_len;
for(i = 0; i < comp_map_len; i++){
*(p_comp_map + i) = *(p_dlul_map + i);
}
comp_map_crc32 = dl_crc32(p_comp_map,comp_map_len);
*(p_dlul_map + dlul_map_len) = (UINT8)((comp_map_crc32 >> 24) & 0xff);
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)((comp_map_crc32 >> 16) & 0xff);
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)((comp_map_crc32 >> 8) & 0xff);
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(comp_map_crc32 & 0xff);
dlul_map_len++;
comp_map_len = comp_map_len + 4;
*/
/*******************************Generate SUB-DL-UL-MAP message header************************************/
/* assign SUB-DL-UL-MAP message header */
sub_dlul_map_header.comp_map_indic = 0b111; // Compressed map indicator
sub_dlul_map_header.map_len = 100; // Map message length
sub_dlul_map_header.rcid_type = 0b00; // RCID Type
sub_dlul_map_header.harq_ack_indic = 0; // HARQ ACK offset indicator
sub_dlul_map_header.dl_ie_cnt = 3; // DL IE Count
sub_dlul_map_header.symb_ofset = 20; // OFDMA Symbol offset
sub_dlul_map_header.subchn_ofset = 20; // Subchannel offset
sub_dlul_map_header.rsv = 0; // Reserved
/* get the address of SUB-DL-UL-MAP message header */
p_sub_dlul_map_header = (UINT8*)(&sub_dlul_map_header);
/* assign SUB-DL-UL-MAP message format */
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 1); // Compressed map indicator, MAP message length[9:5]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header); // MAP message length[4:0], RCID_Type, HARQ ACK offset indicator
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_comp_ulmap_header + 2); // DL IE Count
dlul_map_len++;
/***********************Generate DL_MAP IE included in SUB-DL-UL-MAP message*****************************/
/********************************** Generate ZONE IE *********************************/
/* generate the content of DL-MAP IE */
dl_zone_num = dl_subframe_tx->number_of_zone; // get the zone number of dl subframe;
/* The DL-MAP starts with INC_CID = 0 */
inc_cid = 0;
/* initialize byte align flag */
byte_align_flag = 0;
/* assign ZONE SWITCH IE format */
for (i = 0; i < dl_zone_num; i++){
if(i > 0 ){ // the first zone of downlink not need zone switch ie
/* generate STC_DL_ZONE_IE */
dl_zone_switch.diuc = 0xf; // DIUC = 15 for Extended DIUC
dl_zone_switch.ext_diuc = 0x1; // Extended DIUC = 0x1
dl_zone_switch.len = 0x4; // Length = 0x04;
dl_zone_switch.sym_ofset = dl_subframe_tx->zone[i].start_symbol_offset; // OFDMA symbol offset ;
dl_zone_switch.perm_type = dl_subframe_tx->zone[i].permutation_type; // Permutation; 0b00 = PUSC permutation; 0b01 = FUSC permutation
dl_zone_switch.use_all_sc = dl_subframe_tx->zone[i].use_all_sc_indicator; // Use All SC indicator
dl_zone_switch.stc = 0; // 0b00 = No STC;
dl_zone_switch.matrix = 0; // Matrix indicator
dl_zone_switch.permbase = dl_subframe_tx->zone[i].dl_permbase; // DL_PermBase
dl_zone_switch.prbs_id = dl_subframe_tx->zone[i].prbs_id; // PRBS_ID
dl_zone_switch.amc_type = 0; // AMC type
dl_zone_switch.midamble = 0; // Midamble presence
dl_zone_switch.midamb_boost = 0; // Midamble boosting
dl_zone_switch.anten_sel = 0; // 2/3 antennas select
dl_zone_switch.dedic_pilot = 0; // Dedicated Pilots
dl_zone_switch.reserved = 3; // Reserved 4bits
dl_zone_switch.byte_align = 0; // align to byte boundary
/* get the address of dlmap header variable */
p_dl_zone_switch = (UINT8*)(&dl_zone_switch);
/* assign dlmap message format (total 5.5 bytes) */
/* if current is align to byte */
if(byte_align_flag == 0){
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_dl_zone_switch); // DIUC = 15;Extended DIUC = 0x1
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 4)); // Length,OFDMA symbol offset[7:4]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 3)); // OFDMA symbol offset[3:0],
// Permutation,Use All SC indicator,STC[12]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 2)); // STC[:0],Matrix indicator[1:0],DL_PermBase[4:0]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 1)); // PRBS_ID[1:0],AMC type[1:0],Midamble presence,
// Midamble boosting,antennas select,Dedicated Pilots
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 5)); // Resverved
/* not align to byte */
byte_align_flag = 1;
}
/* if current is align to byte */
else if(byte_align_flag == 1){
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_dl_zone_switch); // DIUC = 15;Extended DIUC = 0x1
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 4)); // Length,OFDMA symbol offset[7:4]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 3)); // OFDMA symbol offset[3:0],
// Permutation,Use All SC indicator,STC[12]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 2)); // STC[:0],Matrix indicator[1:0],DL_PermBase[4:0]
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 1)); // PRBS_ID[1:0],AMC type[1:0],Midamble presence,
// Midamble boosting,antennas select,Dedicated Pilots
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_zone_switch + 5)); // Resverved
/* All byte shift left 4bits */
*(p_dlul_map + dlul_map_len - 6) = (UINT8)(*(p_dlul_map + dlul_map_len - 6) >> 4);
for(j = 0; j < 6; j++){ //if the current ie not align to byte ,then shift bytes equal ceil(ie lenth) : Ceil(5.5) = 6
*(p_dlul_map + dlul_map_len - 6 + j) = (UINT8)(((*(p_dlul_map + dlul_map_len - 6 + j)) << 4)
| ((*(p_dlul_map + dlul_map_len - 5 + j)) >> 4));
}
/* align to byte */
byte_align_flag = 0;
}
}
/* get burst number included in current zone */
bst_num_zone = dl_subframe_tx->zone[i].number_of_burst;
/* generate burst IE*/
for(j = 0; j < bst_num_zone; j++){
/* get burst type */
dl_burst_type = dl_subframe_tx->zone[i].burst[j].burst_type;
/* set the length of HARQ DL MAP IE */
harq_ie_len = 0;
/* Normal data burst */
if(dl_burst_type == 1){
/********************************** Insert CID Switch IE *********************************/
/* get CID number included in current burst */
number_of_cid_bst = dl_subframe_tx->zone[i].burst[j].number_of_cid;
/* generate CID switch IE*/
cid_flag_bst_last = inc_cid;
if(number_of_cid_bst >= 1){ // current burst include CID
inc_cid = 1;
}
else if (number_of_cid_bst == 0){ // current burst not include CID
inc_cid = 0;
}
/* CID Switch IE used when current burst include CID and the last burst not
or when when current burst not include CID and the last burst did*/
if(inc_cid != cid_flag_bst_last){
/* assign CID SWITCH IE*/
dl_cid_switch.diuc = 0xf; // DIUC = 15 for Extended DIUC
dl_cid_switch.ext_diuc = 0x4; // Extended DIUC = 0x4
dl_cid_switch.len = 0; // length;should be 0;not align to byte boundary
dl_cid_switch.byte_align = 0;
p_dl_cid_switch = (UINT8*)(&dl_cid_switch);
/* if current is align to byte */
if(byte_align_flag == 0){
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_dl_cid_switch); //DIUC = 0xf;Extended DIUC = 0x04
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_cid_switch + 1)); //length;
/* not align to byte */
byte_align_flag = 1;
}
else if (byte_align_flag == 1)
{
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*p_dl_cid_switch); //DIUC = 0xf;Extended DIUC = 0x04
dlul_map_len++;
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dl_cid_switch + 1)); //length;
/* All byte shift left 4bits */
*(p_dlul_map + dlul_map_len - 2) = (UINT8)((*(p_dlul_map + dlul_map_len - 2)) | (((*(p_dlul_map + dlul_map_len - 1)) & 0xf0) >> 4));
*(p_dlul_map + dlul_map_len - 1) = (UINT8)(((*(p_dlul_map + dlul_map_len - 1)) << 4) | (((*(p_dlul_map + dlul_map_len)) & 0xf0) >> 4));
/* align to byte */
byte_align_flag = 0;
}
}
/********************************** Insert CID List and DIUC *********************************/
/* reflect FEC type to DIUC */
fec_code_type_bst = dl_subframe_tx->zone[i].burst[j].fec_code_type;
diuc_bst = (UINT16)fec_code_diuc((UINT8)fec_code_type_bst);
/* Add CID List in burst profile IE */
if(inc_cid == 1){ //the cid included flag is valid
/* if current is align to byte */
if(byte_align_flag == 0){
//DIUC;CID number included in current burst(high 4 bits) */
*(p_dlul_map + dlul_map_len) = (UINT8)(((diuc_bst & 0xf) << 4) | ((number_of_cid_bst & 0xf0) >> 4));
dlul_map_len++;
//CID number included in current burst(Low 4 bits);
*(p_dlul_map + dlul_map_len) = (UINT8)(0x0 | ((number_of_cid_bst & 0x0f) << 4));
/* List CID of current burst */
for(k = 0; k < number_of_cid_bst; k++){
cid_burst = dl_subframe_tx->zone[i].burst[j].cid_burst[k];
/* CID[15:12] */
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dlul_map + dlul_map_len) | (cid_burst & 0xf000) >> 12);
dlul_map_len++;
/* CID[12:4] */
*(p_dlul_map + dlul_map_len) = (UINT8)((cid_burst & 0xff0) >> 4);
dlul_map_len++;
/* CID[3:0] */
*(p_dlul_map + dlul_map_len) = (UINT8)((cid_burst & 0xf) << 4);
/* not align to byte */
byte_align_flag = 1;
}
}
/* if current is not align to byte */
else if(byte_align_flag == 1){
//DIUC(low 4 bits) */
*(p_dlul_map + dlul_map_len) = (UINT8)(*(p_dlul_map + dlul_map_len) | (diuc_bst & 0xf));
dlul_map_len++;
//CID number included in current burst;
*(p_dlul_map + dlul_map_len) = (UINT8)(number_of_cid_bst & 0xff);
dlul_map_len++;
/* List CID of current burst */
for(k = 0; k < number_of_cid_bst; k++){
cid_burst = dl_subframe_tx->zone[i].burst[j].cid_burst[k];
/* CID[15:8] */
*(p_dlul_map + dlul_map_len) = (UINT8)((cid_burst & 0xff00) >> 8);
dlul_map_len++;
/* CID[7:0] */
*(p_dlul_map + dlul_map_len) = (UINT8)(cid_burst & 0xff);
dlul_map_len++;
/* align to byte */
byte_align_flag = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -