Commit 15e59665 authored by Sakthivel Velumani's avatar Sakthivel Velumani

mac: change array beam_allocation to int16_t

int16_t is sufficient to hold beam_id and -1 if not allocated. Following
commits will bring changes to only pass LSB 15 bits as beam_id to PHY.
parent 35e5cb69
...@@ -1630,7 +1630,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg) ...@@ -1630,7 +1630,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
AssertFatal(NFAPI_MODE == NFAPI_MONOLITHIC, "Analog beamforming only supported for monolithic scenario\n"); AssertFatal(NFAPI_MODE == NFAPI_MONOLITHIC, "Analog beamforming only supported for monolithic scenario\n");
NR_beam_info_t *beam_info = &RC.nrmac[j]->beam_info; NR_beam_info_t *beam_info = &RC.nrmac[j]->beam_info;
int beams_per_period = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAMS_PERIOD_IDX].u8ptr; int beams_per_period = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAMS_PERIOD_IDX].u8ptr;
beam_info->beam_allocation = malloc16(beams_per_period * sizeof(int *)); beam_info->beam_allocation = malloc16(beams_per_period * sizeof(beam_info->beam_allocation));
beam_info->beam_duration = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAM_DURATION_IDX].u8ptr; beam_info->beam_duration = *MacRLC_ParamList.paramarray[j][MACRLC_ANALOG_BEAM_DURATION_IDX].u8ptr;
beam_info->beams_per_period = beams_per_period; beam_info->beams_per_period = beams_per_period;
beam_info->beam_allocation_size = -1; // to be initialized once we have information on frame configuration beam_info->beam_allocation_size = -1; // to be initialized once we have information on frame configuration
......
...@@ -780,7 +780,7 @@ static void initialize_beam_information(NR_beam_info_t *beam_info, int mu, int s ...@@ -780,7 +780,7 @@ static void initialize_beam_information(NR_beam_info_t *beam_info, int mu, int s
slots_per_frame); slots_per_frame);
beam_info->beam_allocation_size = size / beam_info->beam_duration; beam_info->beam_allocation_size = size / beam_info->beam_duration;
for (int i = 0; i < beam_info->beams_per_period; i++) { for (int i = 0; i < beam_info->beams_per_period; i++) {
beam_info->beam_allocation[i] = malloc16(beam_info->beam_allocation_size * sizeof(int)); beam_info->beam_allocation[i] = malloc16(beam_info->beam_allocation_size * sizeof(*beam_info->beam_allocation));
for (int j = 0; j < beam_info->beam_allocation_size; j++) for (int j = 0; j < beam_info->beam_allocation_size; j++)
beam_info->beam_allocation[i][j] = -1; beam_info->beam_allocation[i][j] = -1;
} }
......
...@@ -3666,7 +3666,7 @@ static inline int get_beam_index(const NR_beam_info_t *beam_info, int frame, int ...@@ -3666,7 +3666,7 @@ static inline int get_beam_index(const NR_beam_info_t *beam_info, int frame, int
return ((frame * slots_per_frame + slot) / beam_info->beam_duration) % beam_info->beam_allocation_size; return ((frame * slots_per_frame + slot) / beam_info->beam_duration) % beam_info->beam_allocation_size;
} }
NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame) NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int16_t beam_index, int slots_per_frame)
{ {
// if no beam allocation for analog beamforming we always return beam index 0 (no multiple beams) // if no beam allocation for analog beamforming we always return beam index 0 (no multiple beams)
if (beam_info->beam_mode == NO_BEAM_MODE) if (beam_info->beam_mode == NO_BEAM_MODE)
...@@ -3675,7 +3675,7 @@ NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, ...@@ -3675,7 +3675,7 @@ NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame,
const int index = get_beam_index(beam_info, frame, slot, slots_per_frame); const int index = get_beam_index(beam_info, frame, slot, slots_per_frame);
for (int i = 0; i < beam_info->beams_per_period; i++) { for (int i = 0; i < beam_info->beams_per_period; i++) {
NR_beam_alloc_t beam_struct = {.new_beam = false, .idx = i}; NR_beam_alloc_t beam_struct = {.new_beam = false, .idx = i};
int *beam = &beam_info->beam_allocation[i][index]; int16_t *beam = &beam_info->beam_allocation[i][index];
if (*beam == -1) { if (*beam == -1) {
beam_struct.new_beam = true; beam_struct.new_beam = true;
*beam = beam_index; *beam = beam_index;
...@@ -3689,7 +3689,7 @@ NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, ...@@ -3689,7 +3689,7 @@ NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame,
return (NR_beam_alloc_t) {.new_beam = false, .idx = -1}; return (NR_beam_alloc_t) {.new_beam = false, .idx = -1};
} }
void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame, bool new_beam) void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int16_t beam_index, int slots_per_frame, bool new_beam)
{ {
if(!new_beam) // need to reset only if the beam was allocated specifically for this instance if(!new_beam) // need to reset only if the beam was allocated specifically for this instance
return; return;
......
...@@ -447,8 +447,8 @@ int ul_buffer_index(int frame, int slot, int slots_per_frame, int size); ...@@ -447,8 +447,8 @@ int ul_buffer_index(int frame, int slot, int slots_per_frame, int size);
void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t frameP, int slotP); void UL_tti_req_ahead_initialization(gNB_MAC_INST *gNB, int n, int CCid, frame_t frameP, int slotP);
void fapi_beam_index_allocation(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac); void fapi_beam_index_allocation(NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config, gNB_MAC_INST *mac);
int get_fapi_beamforming_index(gNB_MAC_INST *mac, int ssb_idx); int get_fapi_beamforming_index(gNB_MAC_INST *mac, int ssb_idx);
NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame); NR_beam_alloc_t beam_allocation_procedure(NR_beam_info_t *beam_info, int frame, int slot, int16_t beam_index, int slots_per_frame);
void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int beam_index, int slots_per_frame, bool new_beam); void reset_beam_status(NR_beam_info_t *beam_info, int frame, int slot, int16_t beam_index, int slots_per_frame, bool new_beam);
void beam_selection_procedures(gNB_MAC_INST *mac, NR_UE_info_t *UE); void beam_selection_procedures(gNB_MAC_INST *mac, NR_UE_info_t *UE);
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP); void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP);
bwp_info_t get_pdsch_bwp_start_size(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE); bwp_info_t get_pdsch_bwp_start_size(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE);
......
...@@ -826,7 +826,7 @@ typedef enum { ...@@ -826,7 +826,7 @@ typedef enum {
typedef struct { typedef struct {
/// list of allocated beams per period /// list of allocated beams per period
int **beam_allocation; int16_t **beam_allocation;
int beam_duration; // in slots int beam_duration; // in slots
int beams_per_period; int beams_per_period;
int beam_allocation_size; int beam_allocation_size;
......
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