Commit 6cd7e611 authored by cig's avatar cig Committed by Thomas Schlichter

UL grant tx and rx in RAR PDU. TS 38.213 ch 8.2, TS 38.321 ch 6.2.3

parent 7bd76fda
...@@ -50,6 +50,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) { ...@@ -50,6 +50,7 @@ int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
else return(N_RB-1-tmp2); else return(N_RB-1-tmp2);
} }
/* TS 38.214 ch. 6.1.2.2.2 - Resource allocation type 1 for DL and UL */
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) { int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d)\n",NPRB,RBstart); AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d)\n",NPRB,RBstart);
if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart); if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart);
...@@ -59,14 +60,21 @@ int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) { ...@@ -59,14 +60,21 @@ int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) { int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) {
return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275)); return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275));
} }
/// Target code rate tables indexed by Imcs /// Target code rate tables indexed by Imcs
/* TS 38.214 table 5.1.3.1-1 - MCS index table 1 for PDSCH */
uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \ uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \
616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948}; 616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948};
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
/* TS 38.214 table 5.1.3.1-2 - MCS index table 2 for PDSCH */
// Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \ uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \
616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948}; 616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948};
/* TS 38.214 table 5.1.3.1-3 - MCS index table 3 for PDSCH */
uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \ uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \
378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772}; 378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772};
uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \ uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \ 336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \ 1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \
......
...@@ -965,11 +965,12 @@ typedef struct { ...@@ -965,11 +965,12 @@ typedef struct {
char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX]; char ulsch_no_allocation_counter[NUMBER_OF_CONNECTED_eNB_MAX];
unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_gNB_MAX]; unsigned char ulsch_Msg3_active[NUMBER_OF_CONNECTED_gNB_MAX];
uint32_t ulsch_Msg3_frame[NUMBER_OF_CONNECTED_gNB_MAX]; uint32_t ulsch_Msg3_frame[NUMBER_OF_CONNECTED_gNB_MAX];
unsigned char ulsch_Msg3_subframe[NUMBER_OF_CONNECTED_gNB_MAX]; unsigned char ulsch_Msg3_subframe[NUMBER_OF_CONNECTED_gNB_MAX];
uint8_t Msg3_startSymbol[NUMBER_OF_CONNECTED_gNB_MAX];
uint8_t Msg3_Length[NUMBER_OF_CONNECTED_gNB_MAX];
NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX]; NR_PRACH_RESOURCES_t *prach_resources[NUMBER_OF_CONNECTED_gNB_MAX];
int turbo_iterations, turbo_cntl_iterations; int turbo_iterations, turbo_cntl_iterations;
/// \brief ?. /// \brief ?.
......
...@@ -3135,7 +3135,7 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) { ...@@ -3135,7 +3135,7 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) {
NR_PRACH_RESOURCES_t *prach_resources = ue->prach_resources[gNB_index]; NR_PRACH_RESOURCES_t *prach_resources = ue->prach_resources[gNB_index];
uint16_t slots_per_frame = ue->frame_parms.slots_per_frame; uint16_t slots_per_frame = ue->frame_parms.slots_per_frame;
uint8_t mu_pusch = 1; uint8_t mu_pusch = 1, sliv_S, sliv_L;
// definition table j Table 6.1.2.1.1-4 // definition table j Table 6.1.2.1.1-4
uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1; uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1;
uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1 uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1
...@@ -3188,6 +3188,9 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) { ...@@ -3188,6 +3188,9 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) {
// PUSCH time domain resource allocation A for normal CP // PUSCH time domain resource allocation A for normal CP
// TS 38.214 ch 6.1.2.1.1 // TS 38.214 ch 6.1.2.1.1
k2 = table_6_1_2_1_1_2_time_dom_res_alloc_A[0][0]; k2 = table_6_1_2_1_1_2_time_dom_res_alloc_A[0][0];
sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[0][1];
sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[0][2];
switch (mu_pusch) { switch (mu_pusch) {
case 0: case 0:
delta = 2; delta = 2;
...@@ -3203,6 +3206,8 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) { ...@@ -3203,6 +3206,8 @@ void nr_process_rar(nr_downlink_indication_t *dl_info) {
break; break;
} }
ue->Msg3_startSymbol[gNB_index] = sliv_S;
ue->Msg3_Length[gNB_index] = sliv_L;
ue->ulsch_Msg3_subframe[gNB_index] = (nr_tti_rx + k2 + delta) % slots_per_frame; ue->ulsch_Msg3_subframe[gNB_index] = (nr_tti_rx + k2 + delta) % slots_per_frame;
if (nr_tti_rx + k2 + delta > slots_per_frame){ if (nr_tti_rx + k2 + delta > slots_per_frame){
ue->ulsch_Msg3_frame[gNB_index] = (frame_rx + 1) % 1024; ue->ulsch_Msg3_frame[gNB_index] = (frame_rx + 1) % 1024;
......
...@@ -164,6 +164,8 @@ typedef struct { ...@@ -164,6 +164,8 @@ typedef struct {
uint8_t RA_contention_resolution_cnt; uint8_t RA_contention_resolution_cnt;
/// Msg3 Delta Preamble /// Msg3 Delta Preamble
int8_t deltaPreamble_Msg3; int8_t deltaPreamble_Msg3;
/// Received TPC command (in dB) from RAR
int8_t Msg3_TPC;
/// Flag to monitor if matching RAPID was received in RAR /// Flag to monitor if matching RAPID was received in RAR
uint8_t RA_RAPID_found; uint8_t RA_RAPID_found;
/// Flag to monitor if BI was received in RAR /// Flag to monitor if BI was received in RAR
......
...@@ -65,8 +65,33 @@ uint16_t table_7_2_1[16] = { ...@@ -65,8 +65,33 @@ uint16_t table_7_2_1[16] = {
1920, // row index 13 1920, // row index 13
}; };
/////////////////////////////////////
// Random Access Response PDU //
// TS 38.213 ch 8.2 //
// TS 38.321 ch 6.2.3 //
/////////////////////////////////////
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
//| E | T | R A P I D |//
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |//
//| R | T A |//
//| T A | UL grant |//
//| UL grant |//
//| UL grant |//
//| UL grant |//
//| T C - R N T I |//
//| T C - R N T I |//
/////////////////////////////////////
// UL grant (27 bits) //
/////////////////////////////////////
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
//|-------------------|FHF|F_alloc|//
//| Freq allocation |//
//| F_alloc |Time allocation|//
//| MCS | TPC |CSI|//
/////////////////////////////////////
// WIP todo: // WIP todo:
// - UL grant // - apply UL grant freq alloc & time alloc as per 8.2 TS 38.213
// - apply tpc command, csi req, mcs
uint16_t nr_ue_process_rar(module_id_t mod_id, uint16_t nr_ue_process_rar(module_id_t mod_id,
int CC_id, int CC_id,
frame_t frameP, frame_t frameP,
...@@ -81,7 +106,9 @@ uint16_t nr_ue_process_rar(module_id_t mod_id, ...@@ -81,7 +106,9 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
uint8_t n_subPDUs = 0; // number of RAR payloads uint8_t n_subPDUs = 0; // number of RAR payloads
uint8_t n_subheaders = 0; // number of MAC RAR subheaders uint8_t n_subheaders = 0; // number of MAC RAR subheaders
uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
uint16_t ta_command = 0; unsigned char freq_hopping, msg3_t_alloc, mcs, tpc_command, csi_req;
uint16_t ta_command = 0, msg3_f_alloc, bwp_size;
int f_alloc, mask;
AssertFatal(CC_id == 0, "RAR reception on secondary CCs is not supported yet\n"); AssertFatal(CC_id == 0, "RAR reception on secondary CCs is not supported yet\n");
...@@ -102,12 +129,8 @@ uint16_t nr_ue_process_rar(module_id_t mod_id, ...@@ -102,12 +129,8 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
ue_mac->RA_RAPID_found = 1; ue_mac->RA_RAPID_found = 1;
break; break;
} }
// if (abs((int) rarh->RAPID - (int) preamble_index) < abs((int) best_rx_rapid - (int) preamble_index)) {
// best_rx_rapid = rarh->RAPID;
// rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR));
// }
if (rarh->E == 0) { if (rarh->E == 0) {
LOG_I(PHY, "No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n", best_rx_rapid); LOG_I(PHY, "No RAR found with the intended RAPID. \n");
break; break;
} else { } else {
rarh += sizeof(NR_MAC_RAR) + 1; rarh += sizeof(NR_MAC_RAR) + 1;
...@@ -120,10 +143,58 @@ uint16_t nr_ue_process_rar(module_id_t mod_id, ...@@ -120,10 +143,58 @@ uint16_t nr_ue_process_rar(module_id_t mod_id,
// mod_id, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3], rar[4], rar[5], rarh->RAPID, preamble_index); // mod_id, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2], rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
if (ue_mac->RA_RAPID_found) { if (ue_mac->RA_RAPID_found) {
// TC-RNTI
*t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8); *t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8);
ue_mac->t_crnti = *t_crnti; ue_mac->t_crnti = *t_crnti;
ue_mac->rnti_type = NR_RNTI_TC; ue_mac->rnti_type = NR_RNTI_TC;
// TA command
ta_command = rar->TA2 + (rar->TA1 << 5); ta_command = rar->TA2 + (rar->TA1 << 5);
// CSI
csi_req = (unsigned char) (rar->UL_GRANT_4 & 0x01);
// TPC
tpc_command = (unsigned char) ((rar->UL_GRANT_4 >> 1) & 0x07);
switch (tpc_command){
case 0:
ue_mac->Msg3_TPC = -6;
break;
case 1:
ue_mac->Msg3_TPC = -4;
break;
case 2:
ue_mac->Msg3_TPC = -2;
break;
case 3:
ue_mac->Msg3_TPC = 0;
break;
case 4:
ue_mac->Msg3_TPC = 2;
break;
case 5:
ue_mac->Msg3_TPC = 4;
break;
case 6:
ue_mac->Msg3_TPC = 6;
break;
case 7:
ue_mac->Msg3_TPC = 8;
break;
}
//MCS
mcs = (unsigned char) (rar->UL_GRANT_4 >> 4);
// time and frequency alloc
bwp_size = NRRIV2BW(ue_mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
msg3_t_alloc = (unsigned char) (rar->UL_GRANT_3 & 0x07);
msg3_f_alloc = (uint16_t) ((rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12));
if (bwp_size < 180)
mask = (1 << ((int) ceil(log2((bwp_size*(bwp_size+1))>>1)))) - 1;
else
mask = (1 << (28 - (int)(ceil(log2((bwp_size*(bwp_size+1))>>1))))) - 1;
f_alloc = msg3_f_alloc & mask;
// frequency hopping flag
freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2);
} else { } else {
ue_mac->t_crnti = 0; ue_mac->t_crnti = 0;
ta_command = (0xffff); ta_command = (0xffff);
......
...@@ -186,23 +186,6 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t ...@@ -186,23 +186,6 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
AssertFatal(ra->state != RA_IDLE, "RA is not active for RA %X\n", ra->rnti); AssertFatal(ra->state != RA_IDLE, "RA is not active for RA %X\n", ra->rnti);
// if(N_RB_UL == 25) {
// ra->msg3_first_rb = 1;
// } else {
// if (cc->tdd_Config && N_RB_UL == 100) {
// ra->msg3_first_rb = 3;
// } else {
// ra->msg3_first_rb = 2;
// }
// }
// ra->msg3_nb_rb = 1;
// /* UL Grant */
// ra->msg3_mcs = 10;
// ra->msg3_TPC = 3;
// ra->msg3_ULdelay = 0;
// ra->msg3_cqireq = 0;
// ra->msg3_round = 0;
LOG_D(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); LOG_D(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
ul_req->SFN = ra->Msg3_frame << 4 | ra->Msg3_slot; ul_req->SFN = ra->Msg3_frame << 4 | ra->Msg3_slot;
...@@ -456,7 +439,7 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -456,7 +439,7 @@ void nr_generate_Msg2(module_id_t module_idP,
// Program UL processing for Msg3 // Program UL processing for Msg3
// nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot); // todo // nr_get_Msg3alloc(&cc[CC_id], slotP, frameP,&ra->Msg3_frame, &ra->Msg3_slot); // todo
LOG_D(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); LOG_D(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
nr_fill_rar(ra, cc[CC_id].RAR_pdu.payload, N_RB_UL); nr_fill_rar(module_idP, ra, cc[CC_id].RAR_pdu.payload, N_RB_UL);
nr_add_msg3(module_idP, CC_id, frameP, slotP); nr_add_msg3(module_idP, CC_id, frameP, slotP);
ra->state = WAIT_Msg3; ra->state = WAIT_Msg3;
LOG_D(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); LOG_D(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state);
...@@ -486,40 +469,89 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ ...@@ -486,40 +469,89 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){
ra->msg3_round = 0; ra->msg3_round = 0;
} }
/////////////////////////////////////
// Random Access Response PDU //
// TS 38.213 ch 8.2 //
// TS 38.321 ch 6.2.3 //
/////////////////////////////////////
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
//| E | T | R A P I D |//
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |//
//| R | T A |//
//| T A | UL grant |//
//| UL grant |//
//| UL grant |//
//| UL grant |//
//| T C - R N T I |//
//| T C - R N T I |//
/////////////////////////////////////
// UL grant (27 bits) //
/////////////////////////////////////
//| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |// bit-wise
//|-------------------|FHF|F_alloc|//
//| Freq allocation |//
//| F_alloc |Time allocation|//
//| MCS | TPC |CSI|//
/////////////////////////////////////
// WIP // WIP
// todo: // todo:
// - handle MAC RAR BI subheader // - handle MAC RAR BI subheader
// - sending only 1 RAR subPDU // - sending only 1 RAR subPDU
// - UL Grant // - UL Grant: hardcoded CSI, TPC, time alloc
// - padding // - padding
void nr_fill_rar(NR_RA_t * ra, void nr_fill_rar(uint8_t Mod_idP,
NR_RA_t * ra,
uint8_t * dlsch_buffer, uint8_t * dlsch_buffer,
uint16_t N_RB_UL){ uint16_t N_RB_UL){
LOG_D(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d ", ra->Msg2_frame, ra-> Msg2_slot); LOG_D(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d ", ra->Msg2_frame, ra-> Msg2_slot);
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0];
nfapi_nr_pusch_pdu_t *pusch_pdu = &UL_tti_req->pdus_list[0].pusch_pdu;
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer;
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1);
unsigned char frequency_hopping_flag = 0, csi_req = 0, tpc_command = 0, mcs = 9, t_alloc = 0;
uint8_t N_UL_Hop;
uint16_t ul_grant, f_alloc, prb_alloc;
int bwp_size;
// E/T/RAPID subheader /// E/T/RAPID subheader ///
// E = 0, one only RAR, first and last // E = 0, one only RAR, first and last
// T = 1, RAPID // T = 1, RAPID
rarh->E = 0; rarh->E = 0;
rarh->T = 1; rarh->T = 1;
rarh->RAPID = ra->preamble_index; rarh->RAPID = ra->preamble_index;
// RAR MAC payload /// RAR MAC payload ///
rar->R = 0; rar->R = 0;
// TA command
rar->TA1 = (uint8_t) (ra->timing_offset >> 5); // 7 MSBs of timing advance rar->TA1 = (uint8_t) (ra->timing_offset >> 5); // 7 MSBs of timing advance
rar->TA2 = (uint8_t) (ra->timing_offset & 0x1f); // 5 LSBs of timing advance rar->TA2 = (uint8_t) (ra->timing_offset & 0x1f); // 5 LSBs of timing advance
// TC-RNTI
rar->TCRNTI_1 = (uint8_t) (ra->rnti >> 8); // 8 MSBs of rnti rar->TCRNTI_1 = (uint8_t) (ra->rnti >> 8); // 8 MSBs of rnti
rar->TCRNTI_2 = (uint8_t) (ra->rnti & 0xff); // 8 LSBs of rnti rar->TCRNTI_2 = (uint8_t) (ra->rnti & 0xff); // 8 LSBs of rnti
// uint16_t rballoc = nr_mac_compute_RIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant // UL grant
// uint32_t buffer = 0;
// rar->UL_GRANT_1 = (uint8_t) (buffer >> 24) & 0x7;
// rar->UL_GRANT_2 = (uint8_t) (buffer >> 16) & 0xFF;
// rar->UL_GRANT_3 = (uint8_t) (buffer >> 8) & 0xFF;
// rar->UL_GRANT_4 = (uint8_t) buffer & 0xff;
} ra->msg3_mcs = mcs;
ra->msg3_TPC = tpc_command;
bwp_size = pusch_pdu->bwp_size;
prb_alloc = PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, bwp_size);
if (frequency_hopping_flag){
// PUSCH with frequency hopping
} else {
N_UL_Hop = 0;
}
f_alloc = (prb_alloc & 0xfff) | (N_UL_Hop << 12);
ul_grant = csi_req | (tpc_command << 1) | (mcs << 4) | (t_alloc << 8) | (f_alloc << 12) | (frequency_hopping_flag << 26);
rar->UL_GRANT_1 = (uint8_t) (ul_grant >> 24) & 0x07;
rar->UL_GRANT_2 = (uint8_t) (ul_grant >> 16) & 0xff;
rar->UL_GRANT_3 = (uint8_t) (ul_grant >> 8) & 0xff;
rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff;
}
\ No newline at end of file
...@@ -941,7 +941,6 @@ int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot) { ...@@ -941,7 +941,6 @@ int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot) {
} }
int extract_startSymbol(int startSymbolAndLength) { int extract_startSymbol(int startSymbolAndLength) {
int tmp = startSymbolAndLength/14; int tmp = startSymbolAndLength/14;
int tmp2 = startSymbolAndLength%14; int tmp2 = startSymbolAndLength%14;
......
...@@ -107,7 +107,8 @@ void nr_get_Msg3alloc(NR_COMMON_channels_t *cc, ...@@ -107,7 +107,8 @@ void nr_get_Msg3alloc(NR_COMMON_channels_t *cc,
@param dlsch_buffer Pointer to RAR input buffer @param dlsch_buffer Pointer to RAR input buffer
@param N_RB_UL Number of UL resource blocks @param N_RB_UL Number of UL resource blocks
*/ */
void nr_fill_rar(NR_RA_t * ra, void nr_fill_rar(uint8_t Mod_idP,
NR_RA_t * ra,
uint8_t * dlsch_buffer, uint8_t * dlsch_buffer,
uint16_t N_RB_UL); uint16_t N_RB_UL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment