Commit bf674468 authored by Calvin HSU's avatar Calvin HSU

UE: Add DL_CONFIG_REQ for PDCCH(DCI) and DLSCH config

clean code
parent 28fd97c0
...@@ -1441,9 +1441,13 @@ set(L2_SRC_UE ...@@ -1441,9 +1441,13 @@ set(L2_SRC_UE
${RRC_DIR}/rrc_common.c ${RRC_DIR}/rrc_common.c
${RRC_DIR}/L2_interface_common.c ${RRC_DIR}/L2_interface_common.c
${RRC_DIR}/L2_interface_ue.c ${RRC_DIR}/L2_interface_ue.c
)
set(NR_L2_SRC_UE
${NR_UE_RRC_DIR}/L2_interface_ue.c ${NR_UE_RRC_DIR}/L2_interface_ue.c
${NR_UE_RRC_DIR}/main_ue.c ${NR_UE_RRC_DIR}/main_ue.c
${NR_UE_RRC_DIR}/rrc_UE.c ${NR_UE_RRC_DIR}/rrc_UE.c
# ${NR_UE_RRC_DIR}/mac_vars.c
) )
set (MAC_SRC set (MAC_SRC
...@@ -1514,12 +1518,19 @@ add_library(L2 ...@@ -1514,12 +1518,19 @@ add_library(L2
add_library(L2_UE add_library(L2_UE
${L2_SRC_UE} ${L2_SRC_UE}
${MAC_SRC_UE} ${MAC_SRC_UE}
)
add_library( NR_L2_UE
${L2_SRC_UE}
${NR_L2_SRC_UE}
${MAC_NR_SRC_UE} ${MAC_NR_SRC_UE}
${MAC_SRC_UE}
) )
include_directories(${NR_UE_PHY_INTERFACE_DIR}) include_directories("${OPENAIR2_DIR}/NR_UE_PHY_INTERFACE")
include_directories(${OPENAIR1_DIR}/SCHED_NR_UE) include_directories("${OPENAIR2_DIR}/LAYER2/NR_MAC_UE")
include_directories(${NFAPI_USER_DIR}) include_directories("${OPENAIR1_DIR}/SCHED_NR_UE")
#include_directories("${NFAPI_USER_DIR}"")
# L3 Libs # L3 Libs
########################## ##########################
...@@ -2294,7 +2305,7 @@ add_executable(nr-uesoftmodem ...@@ -2294,7 +2305,7 @@ add_executable(nr-uesoftmodem
target_link_libraries (nr-uesoftmodem target_link_libraries (nr-uesoftmodem
-Wl,--start-group -Wl,--start-group
RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS L2_UE RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_NR_UE PHY_COMMON PHY_UE PHY_RU LFDS NR_L2_UE
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
-Wl,--end-group z dl) -Wl,--end-group z dl)
......
...@@ -67,11 +67,6 @@ typedef struct { ...@@ -67,11 +67,6 @@ typedef struct {
#define FAPI_NR_TAG_LENGTH_PACKED_LEN 4 #define FAPI_NR_TAG_LENGTH_PACKED_LEN 4
typedef struct { typedef struct {
// config
uint8_t cce_idx;
uint8_t aggregation_level;
uint16_t rnti;
// dci pdu // dci pdu
uint8_t dci_format; uint8_t dci_format;
uint8_t frequency_domain_resouce_assignment; // 38.214 chapter 5.1.2.2 uint8_t frequency_domain_resouce_assignment; // 38.214 chapter 5.1.2.2
...@@ -149,7 +144,19 @@ typedef struct { ...@@ -149,7 +144,19 @@ typedef struct {
uint32_t sr; uint32_t sr;
} fapi_nr_uci_pdu_rel15_t; } fapi_nr_uci_pdu_rel15_t;
typedef struct {
uint32_t frequency_domain_resource;
uint8_t duration;
uint8_t cce_reg_mapping_type; // interleaved or noninterleaved
uint8_t cce_reg_interleaved_reg_bundle_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_interleaver_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_shift_index; // valid if CCE to REG mapping type is interleaved type
uint8_t precoder_granularity;
uint8_t tci_state_pdcch;
uint8_t tci_present_in_dci;
uint16_t pdcch_dmrs_scrambling_id;
} fapi_nr_coreset_t;
// //
// Top level FAPI messages // Top level FAPI messages
...@@ -233,22 +240,7 @@ typedef struct { ...@@ -233,22 +240,7 @@ typedef struct {
uint8_t pdu_type; uint8_t pdu_type;
uint8_t pdu_size; uint8_t pdu_size;
union { union {
/*fapi_nr_ul_config_ulsch_pdu ulsch_pdu;
fapi_nr_ul_config_ulsch_cqi_ri_pdu ulsch_cqi_ri_pdu;
fapi_nr_ul_config_ulsch_harq_pdu ulsch_harq_pdu;
fapi_nr_ul_config_ulsch_cqi_harq_ri_pdu ulsch_cqi_harq_ri_pdu;
fapi_nr_ul_config_uci_cqi_pdu uci_cqi_pdu;
fapi_nr_ul_config_uci_sr_pdu uci_sr_pdu;
fapi_nr_ul_config_uci_harq_pdu uci_harq_pdu;
fapi_nr_ul_config_uci_sr_harq_pdu uci_sr_harq_pdu;
fapi_nr_ul_config_uci_cqi_harq_pdu uci_cqi_harq_pdu;
fapi_nr_ul_config_uci_cqi_sr_pdu uci_cqi_sr_pdu;
fapi_nr_ul_config_uci_cqi_sr_harq_pdu uci_cqi_sr_harq_pdu;
fapi_nr_ul_config_srs_pdu srs_pdu;
fapi_nr_ul_config_harq_buffer_pdu harq_buffer_pdu;
fapi_nr_ul_config_ulsch_uci_csi_pdu ulsch_uci_csi_pdu;
fapi_nr_ul_config_ulsch_uci_harq_pdu ulsch_uci_harq_pdu;
fapi_nr_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu;*/
}; };
} fapi_nr_ul_config_request_pdu_t; } fapi_nr_ul_config_request_pdu_t;
...@@ -264,21 +256,48 @@ typedef struct { ...@@ -264,21 +256,48 @@ typedef struct {
} fapi_nr_ul_config_request_t; } fapi_nr_ul_config_request_t;
typedef struct {
uint16_t rnti;
fapi_nr_coreset_t coreset;
uint32_t duration;
uint8_t aggregation_level;
uint8_t number_of_candidates;
uint16_t monitoring_symbols_within_slot;
// DCI foramt-specific
uint8_t format_2_0_number_of_candidates[5]; // aggregation level 1, 2, 4, 8, 16
uint8_t format_2_3_monitorying_periodicity;
uint8_t format_2_3_number_of_candidates;
} fapi_nr_dl_config_dci_dl_pdu_rel15_t;
typedef struct {
fapi_nr_dl_config_dci_dl_pdu_rel15_t dci_config_rel15;
} fapi_nr_dl_config_dci_pdu;
typedef struct {
uint16_t rnti;
fapi_nr_dci_pdu_rel15_t dci_config;
} fapi_nr_dl_config_dlsch_pdu_rel15_t;
typedef struct {
fapi_nr_dl_config_dlsch_pdu_rel15_t dlsch_config_rel15;
} fapi_nr_dl_config_dlsch_pdu;
typedef struct { typedef struct {
uint8_t pdu_type; uint8_t pdu_type;
uint8_t pdu_size; uint8_t pdu_size;
union { union {
/*fapi_nr_dl_config_dlsch_pdu dlsch_pdu; fapi_nr_dl_config_dci_pdu dci_pdu;
fapi_nr_dl_config_prs_pdu prs_pdu; fapi_nr_dl_config_dlsch_pdu dlsch_pdu;
fapi_nr_dl_config_csi_rs_pdu csi_rs_pdu;*/
}; };
} fapi_nr_dl_config_request_pdu_t; } fapi_nr_dl_config_request_pdu_t;
typedef struct { typedef struct {
fapi_nr_p7_message_header_t header; fapi_nr_p7_message_header_t header;
uint16_t sfn_sf_slot; uint16_t sfn_sf_slot;
fapi_nr_dl_config_request_pdu_t dl_config_request_body; uint8_t number_dci;
uint8_t number_pdsch;
fapi_nr_dl_config_request_pdu_t *dl_config_request_body;
} fapi_nr_dl_config_request_t; } fapi_nr_dl_config_request_t;
...@@ -286,19 +305,7 @@ typedef struct { ...@@ -286,19 +305,7 @@ typedef struct {
// P5 // P5
// //
typedef struct {
uint32_t frequency_domain_resource;
uint8_t duration;
uint8_t cce_reg_mapping_type; // interleaved or noninterleaved
uint8_t cce_reg_interleaved_reg_bundle_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_interleaver_size; // valid if CCE to REG mapping type is interleaved type
uint8_t cce_reg_interleaved_shift_index; // valid if CCE to REG mapping type is interleaved type
uint8_t precoder_granularity;
uint8_t tci_state_pdcch;
uint8_t tci_present_in_dci;
uint16_t pdcch_dmrs_scrambling_id;
} fapi_nr_coreset_t;
typedef struct { typedef struct {
fapi_nr_coreset_t coreset; fapi_nr_coreset_t coreset;
......
...@@ -68,6 +68,7 @@ typedef int32_t sdu_size_t; ...@@ -68,6 +68,7 @@ typedef int32_t sdu_size_t;
typedef uint32_t frame_t; typedef uint32_t frame_t;
typedef int32_t sframe_t; typedef int32_t sframe_t;
typedef uint32_t sub_frame_t; typedef uint32_t sub_frame_t;
typedef uint32_t slot_t;
typedef uint8_t module_id_t; typedef uint8_t module_id_t;
typedef uint8_t slice_id_t; typedef uint8_t slice_id_t;
typedef uint8_t eNB_index_t; typedef uint8_t eNB_index_t;
......
...@@ -30,14 +30,14 @@ ...@@ -30,14 +30,14 @@
* \warning * \warning
*/ */
#include "defs.h" //#include "mac_defs.h"
#include "proto.h" #include "mac_proto.h"
#include "NR_MAC-CellGroupConfig.h" #include "NR_MAC-CellGroupConfig.h"
int nr_rrc_mac_config_req_ue( int nr_rrc_mac_config_req_ue(
module_id_t module_id, module_id_t module_id,
int CC_idP, int cc_idP,
uint8_t gNB_index, uint8_t gNB_index,
NR_MIB_t *mibP, NR_MIB_t *mibP,
NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
......
...@@ -47,7 +47,7 @@ typedef enum { ...@@ -47,7 +47,7 @@ typedef enum {
CONNECTION_LOST, CONNECTION_LOST,
PHY_RESYNCH, PHY_RESYNCH,
PHY_HO_PRACH PHY_HO_PRACH
} UE_L2_STATE_t; } NR_UE_L2_STATE_t;
#endif /*__LAYER2_MAC_DEFS_H__ */ #endif /*__LAYER2_MAC_DEFS_H__ */
...@@ -34,31 +34,68 @@ ...@@ -34,31 +34,68 @@
#define __LAYER2_MAC_PROTO_H__ #define __LAYER2_MAC_PROTO_H__
#include "mac_defs.h" #include "mac_defs.h"
#include "mac.h"
/**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message /**\brief decode mib pdu in NR_UE, from if_module ul_ind with P7 tx_ind message
\param module_id module id \param module_id module id
\param CC_id component carrier id \param cc_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param extra_bits extra bits for frame calculation \param extra_bits extra bits for frame calculation
\param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1 \param l_ssb_equal_64 check if ssb number of candicate is equal 64, 1=equal; 0=non equal. Reference 38.212 7.1.1
\param pduP pointer to pdu \param pduP pointer to pdu
\param pdu_length length of pdu*/ \param pdu_length length of pdu*/
int8_t nr_ue_decode_mib(module_id_t module_id, int CC_id, uint8_t gNB_index, uint8_t extra_bits, uint32_t l_ssb_equal_64, void *pduP, uint16_t pdu_len); int8_t nr_ue_decode_mib(
module_id_t module_id,
int cc_id,
uint8_t gNB_index,
uint8_t extra_bits,
uint32_t l_ssb_equal_64,
void *pduP,
uint16_t pdu_len);
/**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config) /**\brief primitive from RRC layer to MAC layer for configuration L1/L2, now supported 4 rrc messages: MIB, cell_group_config for MAC/PHY, spcell_config(serving cell config)
\param module_id module id \param module_id module id
\param CC_id component carrier id \param cc_id component carrier id
\param gNB_index gNB index \param gNB_index gNB index
\param mibP pointer to RRC message MIB \param mibP pointer to RRC message MIB
\param mac_cell_group_configP pointer to RRC message MAC-related in cell group config \param mac_cell_group_configP pointer to RRC message MAC-related in cell group config
\param phy_cell_group_configP pointer to RRC message PHY-related in cell group config \param phy_cell_group_configP pointer to RRC message PHY-related in cell group config
\param spcell_configP pointer to RRC message serving cell config*/ \param spcell_configP pointer to RRC message serving cell config*/
int nr_rrc_mac_config_req_ue( module_id_t module_id, int CC_id, uint8_t gNB_index, NR_MIB_t *mibP, NR_MAC_CellGroupConfig_t *mac_cell_group_configP, NR_PhysicalCellGroupConfig_t *phy_cell_group_configP, NR_SpCellConfig_t *spcell_configP ); int nr_rrc_mac_config_req_ue(
module_id_t module_id,
int cc_id,
uint8_t gNB_index,
NR_MIB_t *mibP,
NR_MAC_CellGroupConfig_t *mac_cell_group_configP,
NR_PhysicalCellGroupConfig_t *phy_cell_group_configP,
NR_SpCellConfig_t *spcell_configP );
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
int nr_l2_init_ue(void); int nr_l2_init_ue(void);
NR_UE_MAC_INST_t *get_mac_inst(module_id_t Mod_idP); /**\brief fetch MAC instance by module_id, within 0 - (NB_NR_UE_MAC_INST-1)
\param module_id index of MAC instance(s)*/
NR_UE_MAC_INST_t *get_mac_inst(
module_id_t module_id);
/**\brief called at each slot, slot length based on numerology. now use u=0, scs=15kHz, slot=1ms
performs BSR/SR/PHR procedures, random access procedure handler and DLSCH/ULSCH procedures.
\param module_id module id
\param gNB_index corresponding gNB index
\param cc_id component carrier id
\param rx_frame receive frame number
\param rx_slot receive slot number
\param tx_frame transmit frame number
\param tx_slot transmit slot number*/
NR_UE_L2_STATE_t nr_ue_scheduler(
const module_id_t module_id,
const uint8_t gNB_index,
const int cc_id,
const frame_t rx_frame,
const slot_t rx_slot,
const frame_t tx_frame,
const slot_t tx_slot);
#endif #endif
/** @}*/ /** @}*/
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
* \warning * \warning
*/ */
#include "defs.h" //#include "defs.h"
#include "proto.h" #include "mac_proto.h"
static NR_UE_MAC_INST_t *nr_ue_mac_inst; static NR_UE_MAC_INST_t *nr_ue_mac_inst;
...@@ -49,6 +49,6 @@ nr_l2_init_ue(void) ...@@ -49,6 +49,6 @@ nr_l2_init_ue(void)
return (1); return (1);
} }
NR_UE_MAC_INST_t *get_mac_inst(module_id_t Mod_idP){ NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id){
return &nr_ue_mac_inst[(int)Mod_idP]; return &nr_ue_mac_inst[(int)module_id];
} }
...@@ -30,14 +30,14 @@ ...@@ -30,14 +30,14 @@
* \warning * \warning
*/ */
#include "proto.h" #include "mac_proto.h"
#include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_proto.h"
#include <stdio.h> #include <stdio.h>
int8_t nr_ue_decode_mib( int8_t nr_ue_decode_mib(
module_id_t module_id, module_id_t module_id,
int CC_id, int cc_id,
uint8_t gNB_index, uint8_t gNB_index,
uint8_t extra_bits, // 8bits 38.212 c7.1.1 uint8_t extra_bits, // 8bits 38.212 c7.1.1
uint32_t l_ssb_equal_64, uint32_t l_ssb_equal_64,
...@@ -50,7 +50,7 @@ int8_t nr_ue_decode_mib( ...@@ -50,7 +50,7 @@ int8_t nr_ue_decode_mib(
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_mac_rrc_data_ind_ue( module_id, CC_id, gNB_index, nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index,
NR_BCCH_BCH, (uint8_t *) pduP, pdu_len ); NR_BCCH_BCH, (uint8_t *) pduP, pdu_len );
...@@ -105,3 +105,20 @@ int8_t nr_ue_decode_mib( ...@@ -105,3 +105,20 @@ int8_t nr_ue_decode_mib(
return 0; return 0;
} }
// Performs :
// 1. TODO: Call RRC for link status return to PHY
// 2. TODO: Perform SR/BSR procedures for scheduling feedback
// 3. TODO: Perform PHR procedures
NR_UE_L2_STATE_t nr_ue_scheduler(
const module_id_t module_id,
const uint8_t gNB_index,
const int cc_id,
const frame_t rx_frame,
const slot_t rx_slot,
const frame_t tx_frame,
const slot_t tx_slot){
return CONNECTION_OK;
}
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
*/ */
#include "NR_IF_Module.h" #include "NR_IF_Module.h"
#include "LAYER2/NR_MAC_UE/proto.h" #include "mac_proto.h"
#include <stdio.h> #include <stdio.h>
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "rrc_defs.h" #include "rrc_defs.h"
#include "rrc_proto.h" #include "rrc_proto.h"
#include "rrc_vars.h" #include "rrc_vars.h"
#include "LAYER2/NR_MAC_UE/proto.h" #include "mac_proto.h"
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "fapi_nr_ue_l1.h" #include "fapi_nr_ue_l1.h"
#include "PHY/phy_extern_nr_ue.h" #include "PHY/phy_extern_nr_ue.h"
#include "LAYER2/NR_MAC_UE/proto.h" #include "LAYER2/NR_MAC_UE/mac_proto.h"
#include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_proto.h"
#include "SCHED_NR/extern.h" #include "SCHED_NR/extern.h"
......
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