Commit a4ee72db authored by Calvin HSU's avatar Calvin HSU

UE: Add UL_IND message in IF module, for trigger L2 scheduler per TTI(slot).

Add Type0-PDCCH search space & coreset right after decode MIB and storage corresponding parameters in L2.
parent bf674468
...@@ -998,6 +998,7 @@ typedef struct { ...@@ -998,6 +998,7 @@ typedef struct {
nr_ue_if_module_t *if_inst; nr_ue_if_module_t *if_inst;
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
nr_uplink_indication_t ul_indication;
// point to the current rxTx thread index // point to the current rxTx thread index
uint8_t current_thread_id[10]; uint8_t current_thread_id[10];
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/* \file config.c /* \file config_ue.c
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures * \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
* \author R. Knopp, K.H. HSU * \author R. Knopp, K.H. HSU
* \date 2018 * \date 2018
......
...@@ -63,15 +63,22 @@ ...@@ -63,15 +63,22 @@
typedef struct { typedef struct {
//// MAC config //// MAC config
NR_DRX_Config_t *drx_Config; /* OPTIONAL */ NR_DRX_Config_t *drx_Config;
NR_SchedulingRequestConfig_t *schedulingRequestConfig; /* OPTIONAL */ NR_SchedulingRequestConfig_t *schedulingRequestConfig;
NR_BSR_Config_t *bsr_Config; /* OPTIONAL */ NR_BSR_Config_t *bsr_Config;
NR_TAG_Config_t *tag_Config; /* OPTIONAL */ NR_TAG_Config_t *tag_Config;
NR_PHR_Config_t *phr_Config; /* OPTIONAL */ NR_PHR_Config_t *phr_Config;
NR_RNTI_Value_t *cs_RNTI;
NR_MIB_t *mib;
NR_RNTI_Value_t *cs_RNTI; /* OPTIONAL */ /// Type0-PDCCH seach space coreset
uint32_t num_rbs;
uint32_t num_symbols;
uint32_t rb_offset;
/// Type0-PDCCH seach space
NR_MIB_t *mib;
//// FAPI-like interface //// FAPI-like interface
fapi_nr_tx_request_t tx_request; fapi_nr_tx_request_t tx_request;
...@@ -80,9 +87,12 @@ typedef struct { ...@@ -80,9 +87,12 @@ typedef struct {
fapi_nr_dci_indication_t dci_indication; fapi_nr_dci_indication_t dci_indication;
fapi_nr_rx_indication_t rx_indication; fapi_nr_rx_indication_t rx_indication;
/// Interface module instances
nr_ue_if_module_t *if_module; nr_ue_if_module_t *if_module;
nr_scheduled_response_t scheduled_response; nr_scheduled_response_t scheduled_response;
nr_phy_config_t phy_config; nr_phy_config_t phy_config;
} NR_UE_MAC_INST_t; } NR_UE_MAC_INST_t;
/*@}*/ /*@}*/
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* \file extern.h
* \brief extern variables for MAC layer
* \author R. Knopp, K.H. HSU
* \date 2018
* \version 0.1
* \company Eurecom / NTUST
* \email: knopp@eurecom.fr, kai-hsiang.hsu@eurecom.fr
* \note
* \warning
*/
extern const int32_t table_38213_13_1_c2[16];
extern const int32_t table_38213_13_1_c3[16];
extern const int32_t table_38213_13_1_c4[16];
extern const int32_t table_38213_13_2_c2[16];
extern const int32_t table_38213_13_2_c3[16];
extern const int32_t table_38213_13_2_c4[16];
extern const int32_t table_38213_13_3_c2[16];
extern const int32_t table_38213_13_3_c3[16];
extern const int32_t table_38213_13_3_c4[16];
extern const int32_t table_38213_13_4_c2[16];
extern const int32_t table_38213_13_4_c3[16];
extern const int32_t table_38213_13_4_c4[16];
extern const int32_t table_38213_13_5_c2[16];
extern const int32_t table_38213_13_5_c3[16];
extern const int32_t table_38213_13_5_c4[16];
extern const int32_t table_38213_13_6_c2[16];
extern const int32_t table_38213_13_6_c3[16];
extern const int32_t table_38213_13_6_c4[16];
extern const int32_t table_38213_13_7_c2[16];
extern const int32_t table_38213_13_7_c3[16];
extern const int32_t table_38213_13_7_c4[16];
extern const int32_t table_38213_13_8_c2[16];
extern const int32_t table_38213_13_8_c3[16];
extern const int32_t table_38213_13_8_c4[16];
extern const int32_t table_38213_13_9_c2[16];
extern const int32_t table_38213_13_9_c3[16];
extern const int32_t table_38213_13_9_c4[16];
extern const int32_t table_38213_13_10_c2[16];
extern const int32_t table_38213_13_10_c3[16];
extern const int32_t table_38213_13_10_c4[16];
extern const float table_38213_13_11_c1[16];
extern const int32_t table_38213_13_11_c2[16];
extern const float table_38213_13_11_c3[16];
extern const int32_t table_38213_13_11_c4[16];
extern const float table_38213_13_12_c1[16];
extern const int32_t table_38213_13_12_c2[16];
extern const float table_38213_13_12_c3[16];
\ No newline at end of file
...@@ -32,6 +32,59 @@ ...@@ -32,6 +32,59 @@
#include "mac_defs.h" #include "mac_defs.h"
NR_UE_MAC_INST_t UE_mac_inst; //[NB_MODULE_MAX]; #define reserved 0xffff
// specification mapping talbe, table_38$x_$y_$z_c$a
// - $x: specification
// - $y: subclause-major
// - $z: subclause-minor
// - $a: ($a)th of column in table, start from zero
const int32_t table_38213_13_1_c2[16] = {24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 96, 96, 96, reserved}; // index 15 reserved
const int32_t table_38213_13_1_c3[16] = { 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved}; // index 15 reserved
const int32_t table_38213_13_1_c4[16] = { 0, 2, 4, 0, 2, 4, 12, 16, 12, 16, 12, 16, 38, 38, 38, reserved}; // index 15 reserved
const int32_t table_38213_13_2_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved}; // index 14-15 reserved
const int32_t table_38213_13_2_c3[16] = { 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved}; // index 14-15 reserved
const int32_t table_38213_13_2_c4[16] = { 5, 6, 7, 8, 5, 6, 7, 8, 18, 20, 18, 20, 18, 20, reserved, reserved}; // index 14-15 reserved
const int32_t table_38213_13_3_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_3_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_3_c4[16] = { 2, 6, 2, 6, 2, 6, 28, 28, 28, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_4_c2[16] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48};
const int32_t table_38213_13_4_c3[16] = { 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 1, 1, 1, 2, 2, 2};
const int32_t table_38213_13_4_c4[16] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 12, 14, 16, 12, 14, 16};
const int32_t table_38213_13_5_c2[16] = {48, 48, 48, 96, 96, 96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_5_c3[16] = { 1, 2, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_5_c4[16] = { 4, 4, 4, 0, 56, 0, 56, 0, 56, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 09-15 reserved
const int32_t table_38213_13_6_c2[16] = {24, 24, 24, 24, 48, 48, 48, 48, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
const int32_t table_38213_13_6_c3[16] = { 2, 2, 3, 3, 1, 1, 2, 2, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
const int32_t table_38213_13_6_c4[16] = { 0, 4, 0, 4, 0, 28, 0, 28, 0, 28, reserved, reserved, reserved, reserved, reserved, reserved}; // index 10-15 reserved
const int32_t table_38213_13_7_c2[16] = {48, 48, 48, 48, 48, 48, 96, 96, 48, 48, 96, 96, reserved, reserved, reserved, reserved}; // index 12-15 reserved
const int32_t table_38213_13_7_c3[16] = { 1, 1, 2, 2, 3, 3, 1, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved}; // index 12-15 reserved
const int32_t table_38213_13_7_c4[16] = { 0, 8, 0, 8, 0, 8, 28, 28,-41, 49,-41, 97, reserved, reserved, reserved, reserved}; // index 12-15 reserved, condition A as default
const int32_t table_38213_13_8_c2[16] = { 1, 1, 1, 1, 3, 3, 3, 3, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
const int32_t table_38213_13_8_c3[16] = {24, 24, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved
const int32_t table_38213_13_8_c4[16] = { 0, 4, 14, 14,-20, 24,-20, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 15 reserved, condition A as default
const int32_t table_38213_13_9_c2[16] = {96, 96, 96, 96, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
const int32_t table_38213_13_9_c3[16] = { 1, 1, 2, 2, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
const int32_t table_38213_13_9_c4[16] = { 0, 16, 0, 16, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 04-15 reserved
const int32_t table_38213_13_10_c2[16] = {48, 48, 48, 48, 24, 24, 48, 48, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
const int32_t table_38213_13_10_c3[16] = { 1, 1, 2, 2, 1, 1, 1, 1, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved
const int32_t table_38213_13_10_c4[16] = { 0, 8, 0, 8,-41, 25,-41, 49, reserved, reserved, reserved, reserved, reserved, reserved, reserved, reserved}; // index 08-15 reserved, condition A as default
const float table_38213_13_11_c1[16] = { 0, 0, 2, 2, 5, 5, 7, 7, 0, 5, 0, 0, 2, 2, 5, 5};
const int32_t table_38213_13_11_c2[16] = { 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1};
const float table_38213_13_11_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 0.5f, 1, 1, 1, 1, 1, 1, 1, 1};
const int32_t table_38213_13_11_c4[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 2, 1, 2}; // i is even as default
const float table_38213_13_12_c1[16] = { 0, 0, 2.5f, 2.5f, 5, 5, 0, 2.5f, 5, 7.5f, 7.5f, 7.5f, 0, 5, reserved, reserved}; // index 14-15 reserved
const int32_t table_38213_13_12_c2[16] = { 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 1, 1, reserved, reserved}; // index 14-15 reserved
const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f, 0.5f, 1, 0.5f, 0.5f, 1, 1, reserved, reserved}; // index 14-15 reserved
...@@ -62,6 +62,34 @@ int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){ ...@@ -62,6 +62,34 @@ int8_t handle_bcch_dlsch(uint32_t pdu_len, uint8_t *pduP){
return 0; return 0;
} }
int8_t nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
NR_UE_L2_STATE_t ret;
ret = nr_ue_scheduler(
ul_info->module_id,
ul_info->gNB_index,
ul_info->cc_id,
ul_info->frame,
ul_info->slot,
0, 0); // TODO check tx/rx frame/slot is need for NR version
switch(ret){
case CONNECTION_OK:
break;
case CONNECTION_LOST:
break;
case PHY_RESYNCH:
break;
case PHY_HO_PRACH:
break;
default:
break;
}
return 0;
}
int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
module_id_t module_id = dl_info->module_id; module_id_t module_id = dl_info->module_id;
...@@ -99,11 +127,16 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){ ...@@ -99,11 +127,16 @@ int8_t nr_ue_dl_indication(nr_downlink_indication_t *dl_info){
nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){
if (nr_ue_if_module_inst[module_id] == NULL) { if (nr_ue_if_module_inst[module_id] == NULL) {
nr_ue_if_module_inst[module_id] = (nr_ue_if_module_t*)malloc(sizeof(nr_ue_if_module_t)); nr_ue_if_module_inst[module_id] = (nr_ue_if_module_t *)malloc(sizeof(nr_ue_if_module_t));
memset((void*)nr_ue_if_module_inst[module_id],0,sizeof(nr_ue_if_module_t)); memset((void*)nr_ue_if_module_inst[module_id],0,sizeof(nr_ue_if_module_t));
nr_ue_if_module_inst[module_id]->CC_mask=0; nr_ue_if_module_inst[module_id]->cc_mask=0;
nr_ue_if_module_inst[module_id]->current_frame = 0;
nr_ue_if_module_inst[module_id]->current_slot = 0;
nr_ue_if_module_inst[module_id]->phy_config_request = NULL;
nr_ue_if_module_inst[module_id]->scheduled_response = NULL;
nr_ue_if_module_inst[module_id]->dl_indication = nr_ue_dl_indication; nr_ue_if_module_inst[module_id]->dl_indication = nr_ue_dl_indication;
nr_ue_if_module_inst[module_id]->ul_indication = nr_ue_ul_indication;
} }
return nr_ue_if_module_inst[module_id]; return nr_ue_if_module_inst[module_id];
......
...@@ -40,11 +40,9 @@ typedef struct { ...@@ -40,11 +40,9 @@ typedef struct {
/// module id /// module id
module_id_t module_id; module_id_t module_id;
/// component carrier id /// component carrier id
int CC_id; int cc_id;
/// frame /// frame
frame_t frame; frame_t frame;
/// subframe
sub_frame_t subframe;
/// slot /// slot
uint8_t slot; uint8_t slot;
...@@ -57,6 +55,20 @@ typedef struct { ...@@ -57,6 +55,20 @@ typedef struct {
} nr_downlink_indication_t; } nr_downlink_indication_t;
typedef struct {
/// module id
module_id_t module_id;
/// gNB index
uint32_t gNB_index;
/// component carrier id
int cc_id;
/// frame
frame_t frame;
/// slot
uint32_t slot;
} nr_uplink_indication_t;
// Downlink subframe P7 // Downlink subframe P7
...@@ -104,7 +116,7 @@ typedef struct { ...@@ -104,7 +116,7 @@ typedef struct {
* -1: Failed to consume bytes. Abort the mission. * -1: Failed to consume bytes. Abort the mission.
* Non-negative return values indicate success, and ignored. * Non-negative return values indicate success, and ignored.
*/ */
typedef int8_t(nr_ue_scheduled_response_f)(nr_scheduled_response_t *scheduled_response); typedef int8_t (nr_ue_scheduled_response_f)(nr_scheduled_response_t *scheduled_response);
/* /*
...@@ -114,7 +126,7 @@ typedef int8_t(nr_ue_scheduled_response_f)(nr_scheduled_response_t *scheduled_re ...@@ -114,7 +126,7 @@ typedef int8_t(nr_ue_scheduled_response_f)(nr_scheduled_response_t *scheduled_re
* -1: Failed to consume bytes. Abort the mission. * -1: Failed to consume bytes. Abort the mission.
* Non-negative return values indicate success, and ignored. * Non-negative return values indicate success, and ignored.
*/ */
typedef int8_t(nr_ue_phy_config_request_f)(nr_phy_config_t *phy_config); typedef int8_t (nr_ue_phy_config_request_f)(nr_phy_config_t *phy_config);
/* /*
...@@ -124,18 +136,27 @@ typedef int8_t(nr_ue_phy_config_request_f)(nr_phy_config_t *phy_config); ...@@ -124,18 +136,27 @@ typedef int8_t(nr_ue_phy_config_request_f)(nr_phy_config_t *phy_config);
* -1: Failed to consume bytes. Abort the mission. * -1: Failed to consume bytes. Abort the mission.
* Non-negative return values indicate success, and ignored. * Non-negative return values indicate success, and ignored.
*/ */
typedef int8_t(nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info); typedef int8_t (nr_ue_dl_indication_f)(nr_downlink_indication_t *dl_info);
/*
* Generic type of an application-defined callback to return various
* types of data to the application.
* EXPECTED RETURN VALUES:
* -1: Failed to consume bytes. Abort the mission.
* Non-negative return values indicate success, and ignored.
*/
typedef int8_t (nr_ue_ul_indication_f)(nr_uplink_indication_t *ul_info);
// TODO check this stuff can be reuse of need modification // TODO check this stuff can be reuse of need modification
typedef struct nr_ue_if_module_s { typedef struct nr_ue_if_module_s {
nr_ue_scheduled_response_f *scheduled_response; nr_ue_scheduled_response_f *scheduled_response;
nr_ue_phy_config_request_f *phy_config_request; nr_ue_phy_config_request_f *phy_config_request;
nr_ue_dl_indication_f *dl_indication; nr_ue_dl_indication_f *dl_indication;
nr_ue_ul_indication_f *ul_indication;
uint32_t CC_mask; uint32_t cc_mask;
uint16_t current_frame; uint32_t current_frame;
uint8_t current_subframe; uint32_t current_slot;
//pthread_mutex_t nr_if_mutex; //pthread_mutex_t nr_if_mutex;
} nr_ue_if_module_t; } nr_ue_if_module_t;
......
...@@ -215,17 +215,19 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_ ...@@ -215,17 +215,19 @@ void init_thread(int sched_runtime, int sched_deadline, int sched_fifo, cpu_set_
void init_UE(int nb_inst) void init_UE(int nb_inst)
{ {
int inst; int inst;
NR_UE_MAC_INST_t *mac_inst;
for (inst=0; inst < nb_inst; inst++) { for (inst=0; inst < nb_inst; inst++) {
// UE->rfdevice.type = NONE_DEV; // UE->rfdevice.type = NONE_DEV;
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0]; PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]); LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);
PHY_vars_UE_g[inst][0] = init_nr_ue_vars(NULL,inst,0); PHY_vars_UE_g[inst][0] = init_nr_ue_vars(NULL,inst,0);
AssertFatal((UE->if_inst = nr_ue_if_module_init(inst)) != NULL,"Can't register interface module\n"); AssertFatal((UE->if_inst = nr_ue_if_module_init(inst)) != NULL, "can not initial IF module\n");
nr_l3_init_ue(); nr_l3_init_ue();
nr_l2_init_ue(); nr_l2_init_ue();
NR_UE_MAC_INST_t *UE_MAC_INST = get_mac_inst(0);
UE_MAC_INST->if_module = UE->if_inst; mac_inst = get_mac_inst(0);
mac_inst->if_module = UE->if_inst;
UE->if_inst->scheduled_response = nr_ue_scheduled_response; UE->if_inst->scheduled_response = nr_ue_scheduled_response;
UE->if_inst->phy_config_request = nr_ue_phy_config_request; UE->if_inst->phy_config_request = nr_ue_phy_config_request;
...@@ -621,6 +623,23 @@ static void *UE_thread_rxn_txnp4(void *arg) { ...@@ -621,6 +623,23 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#endif #endif
if (UE->mac_enabled==1) { if (UE->mac_enabled==1) {
// trigger L2 to run ue_scheduler thru IF module
// [TODO] mapping right after NR initial sync
if(1)
if(UE->if_inst != NULL && UE->if_inst->ul_indication != NULL){
UE->ul_indication.module_id = 0;
UE->ul_indication.gNB_index = 0;
UE->ul_indication.cc_id = 0;
// [TODO] mapping right after NR initial sync
//UE->ul_indication.frame = ;
//UE->ul_indication.slot = ;
UE->if_inst->ul_indication(&UE->ul_indication);
}
#ifdef NEW_MAC #ifdef NEW_MAC
ret = mac_xface->ue_scheduler(UE->Mod_id, ret = mac_xface->ue_scheduler(UE->Mod_id,
proc->frame_rx, proc->frame_rx,
......
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